/* ═══════════════════════════════════════════════════════
   ORDER TRACKING PRO — Professional Grade UI
   Design System: 8px grid · Inter/System · Light + Dark
   ═══════════════════════════════════════════════════════ */

/* ── Foundation — Light Theme (default) ── */
:root {
  --bg-base: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-raised: #f0f0f2;
  --bg-overlay: #e8e8ec;
  --bg-input: #f0f0f2;
  --bg-hover: #e4e4e8;
  --bg-active: #d8d8dc;
  --border-subtle: #e5e5ea;
  --border-default: #d1d1d6;
  --border-strong: #b0b0b8;
  --text-primary: #1a1a1e;
  --text-secondary: #5a5a66;
  --text-tertiary: #8e8e99;
  --text-disabled: #b0b0bb;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-muted: rgba(37,99,235,.08);
  --green: #16a34a;
  --green-muted: rgba(22,163,74,.08);
  --amber: #d97706;
  --amber-muted: rgba(217,119,6,.08);
  --red: #dc2626;
  --red-muted: rgba(220,38,38,.08);
  --purple: #7c3aed;
  --purple-muted: rgba(124,58,237,.08);
  --cyan: #0891b2;
  --cyan-muted: rgba(8,145,178,.08);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --transition: .15s cubic-bezier(.4,0,.2,1);
  --font: -apple-system,BlinkMacSystemFont,'Inter','Segoe UI',system-ui,sans-serif;
  --font-mono: 'SF Mono','Fira Code',monospace;
}

/* ── Dark Theme ── */
html.dark-mode {
  --bg-base: #09090b;
  --bg-surface: #0f0f12;
  --bg-raised: #18181b;
  --bg-overlay: #1c1c21;
  --bg-input: #1c1c21;
  --bg-hover: #27272a;
  --bg-active: #2c2c32;
  --border-subtle: #222228;
  --border-default: #2c2c33;
  --border-strong: #3f3f46;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-disabled: #52525b;
  --blue: #3b82f6;
  --blue-hover: #2563eb;
  --blue-muted: rgba(59,130,246,.12);
  --green: #22c55e;
  --green-muted: rgba(34,197,94,.1);
  --amber: #f59e0b;
  --amber-muted: rgba(245,158,11,.1);
  --red: #ef4444;
  --red-muted: rgba(239,68,68,.1);
  --purple: #a78bfa;
  --purple-muted: rgba(167,139,250,.1);
  --cyan: #22d3ee;
  --cyan-muted: rgba(34,211,238,.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); background: var(--bg-base); color: var(--text-primary); height: 100vh; height: 100dvh; overflow: hidden; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ═══ LOGIN ═══ */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; height: 100dvh;
  background: radial-gradient(ellipse at top, #e0e7ff 0%, var(--bg-base) 70%);
}
.login-card {
  width: 100%; max-width: 400px; padding: 40px 32px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.login-card .logo { text-align: center; margin-bottom: 32px; }
.login-card .logo span { font-size: 40px; }
.login-card .logo h1 { font-size: 20px; font-weight: 600; margin-top: 8px; letter-spacing: -.3px; }
.login-card .logo p { font-size: 13px; color: var(--text-tertiary); margin-top: 4px; }
.login-card input {
  width: 100%; padding: 10px 14px; margin-bottom: 12px;
  background: var(--bg-input); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 14px; outline: none; transition: border var(--transition);
}
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-muted); }
.login-card input::placeholder { color: var(--text-disabled); }
.login-card .btn-login {
  width: 100%; padding: 10px; margin-top: 4px;
  background: var(--blue); border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background var(--transition);
}
.login-card .btn-login:hover { background: var(--blue-hover); }
.login-err { color: var(--red); font-size: 12px; text-align: center; margin-top: 8px; display: none; }

/* ═══ APP SHELL ═══ */
.app { display: none; height: 100vh; height: 100dvh; flex-direction: column; }
.app.active { display: flex; }

/* ── Header ── */
.header {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 52px; flex-shrink: 0;
  background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
}
.header-brand { display: flex; align-items: center; gap: 8px; }
.header-brand h1 { font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.header-search {
  flex: 1; max-width: 480px; margin: 0 auto; position: relative;
}
.header-search input {
  width: 100%; padding: 7px 14px 7px 34px;
  background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 13px; outline: none; transition: all var(--transition);
}
.header-search input:focus { border-color: var(--blue); background: var(--bg-input); box-shadow: 0 0 0 3px var(--blue-muted); }
.header-search input::placeholder { color: var(--text-disabled); }
.header-search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-disabled); font-size: 14px; pointer-events: none; }
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs);
  color: var(--text-secondary); font-size: 16px; cursor: pointer; position: relative;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-subtle); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-default); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-danger-ghost { color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-muted); color: #f87171; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover { background: #1da851; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: var(--radius-xs); }

/* ── Content Area ── */
.content { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar / Order List ── */
.sidebar {
  width: 380px; min-width: 380px; display: flex; flex-direction: column;
  background: var(--bg-surface); border-right: 1px solid var(--border-subtle);
  min-height: 0;
}
.sidebar-tabs {
  display: flex; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.sidebar-tab {
  flex: 1; padding: 10px; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--text-tertiary); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.sidebar-tab.active { color: var(--text-primary); border-bottom-color: var(--blue); }
.sidebar-tab:hover:not(.active) { color: var(--text-secondary); }

/* Stats row */
.stats-row {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px;
  background: var(--border-subtle); border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.stat-cell {
  padding: 10px 6px; background: var(--bg-surface); text-align: center; cursor: pointer;
  transition: background var(--transition);
}
.stat-cell:hover { background: var(--bg-raised); }
.stat-cell .value { font-size: 17px; font-weight: 700; letter-spacing: -.5px; }
.stat-cell .label { font-size: 9px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* Filters */
.filter-row {
  display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
}
.filter-pill {
  padding: 4px 10px; border-radius: 100px; font-size: 11px; font-weight: 600;
  background: transparent; color: var(--text-tertiary); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; transition: all var(--transition);
}
.filter-pill.active { background: var(--blue-muted); color: var(--blue); border-color: rgba(59,130,246,.2); }
.filter-pill:hover:not(.active) { background: var(--bg-hover); color: var(--text-secondary); }
.filter-pill.branch { color: var(--red, #ef4444); }
.filter-pill.branch.active { background: rgba(239,68,68,.1); color: var(--red, #ef4444); border-color: rgba(239,68,68,.2); }
.filter-sep { display: flex; align-items: center; color: var(--border-default); font-size: 14px; padding: 0 4px; }

/* Order list */
.order-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.order-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}
.order-row:hover { background: var(--bg-raised); }
.order-row.active { background: var(--bg-hover); border-left: 2px solid var(--blue); }
.order-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.order-row .body { flex: 1; min-width: 0; }
.order-row .top { display: flex; justify-content: space-between; align-items: baseline; }
.order-row .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-row .num { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); flex-shrink: 0; }
.order-row .mid { font-size: 12px; color: var(--text-secondary); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-row .foot { display: flex; align-items: center; gap: 6px; }
.badge-status {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 100px; font-size: 10px; font-weight: 600;
}

/* ── Customer Loyalty Badges ── */
.cust-badge {
  display: inline-flex; align-items: center; padding: 1px 5px; border-radius: 100px;
  font-size: 9px; font-weight: 700; margin-left: 4px; vertical-align: middle;
  letter-spacing: 0.3px; white-space: nowrap;
}
.cust-returning { background: rgba(205,127,50,.12); color: #cd7f32; border: 1px solid rgba(205,127,50,.25); }
.cust-loyal { background: rgba(192,192,192,.15); color: #c0c0c0; border: 1px solid rgba(192,192,192,.3); }
.cust-vip { background: rgba(255,215,0,.15); color: #ffd700; border: 1px solid rgba(255,215,0,.3); }
.order-row .time { margin-left: auto; font-size: 10px; color: var(--text-disabled); }
.order-row.urgent { border-left: 2px solid var(--red); background: rgba(239,68,68,.05); }
.order-row.warning { border-left: 2px solid var(--amber); background: rgba(245,158,11,.05); }
.sla-badge { font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.sla-badge.critical { background: rgba(239,68,68,.15); color: var(--red); }
.sla-badge.warn { background: rgba(245,158,11,.15); color: var(--amber); }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text-disabled); gap: 8px; padding: 40px;
}
.empty-state .icon { font-size: 32px; opacity: .4; }
.empty-state p { font-size: 13px; }

/* ═══ MAIN AREA (right) ═══ */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-base); }

/* Tabs for main area */
.main-tabs { display: flex; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface); flex-shrink: 0; }
.main-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 500; color: var(--text-tertiary);
  cursor: pointer; border-bottom: 2px solid transparent; transition: all var(--transition);
}
.main-tab.active { color: var(--text-primary); border-bottom-color: var(--blue); }
.main-tab:hover:not(.active) { color: var(--text-secondary); }

/* ── Order Detail View ── */
.detail-view { flex: 1; display: none; flex-direction: column; overflow: hidden; }
.detail-view.active { display: flex; }

.detail-header {
  padding: 16px 24px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.detail-header .row1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.detail-header .row1 h2 { min-width: 0; flex-shrink: 1; }
.detail-header h2 { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.detail-header .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.detail-header .meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px;
  font-size: 13px; color: var(--text-secondary);
}
.detail-header .meta span { display: inline-flex; align-items: center; gap: 4px; }

/* Progress */
.detail-progress {
  display: flex; align-items: center; gap: 0; padding: 12px 24px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto; flex-shrink: 0;
}
.step-item { display: flex; align-items: center; gap: 0; white-space: nowrap; }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0; transition: all var(--transition);
}
.step-dot.done { background: var(--green); color: #fff; }
.step-dot.now { background: var(--blue); color: #fff; box-shadow: 0 0 0 3px var(--blue-muted); }
.step-dot.wait { background: var(--bg-hover); color: var(--text-disabled); }
.step-line { width: 20px; height: 2px; flex-shrink: 0; }
.step-line.done { background: var(--green); }
.step-line.wait { background: var(--border-default); }
.step-label { font-size: 9px; color: var(--text-tertiary); margin-left: 4px; margin-right: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.step-label.now { color: var(--blue); }
.step-label.done { color: var(--green); }

/* Info cards */
.detail-info {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px; background: var(--border-subtle); flex-shrink: 0;
}
.info-cell {
  padding: 10px 24px; background: var(--bg-surface);
  font-size: 12px; color: var(--text-secondary);
}
.info-cell strong { color: var(--text-primary); font-weight: 600; }
.info-cell a { color: var(--blue); }

/* Timeline */
.detail-timeline { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 24px; }
.tl-divider { text-align: center; margin: 16px 0; }
.tl-divider span { font-size: 11px; color: var(--text-disabled); background: var(--bg-base); padding: 0 12px; }
.tl-entry { display: flex; gap: 12px; margin-bottom: 16px; }
.tl-entry .tl-icon {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; background: var(--bg-raised); border: 1px solid var(--border-default);
}
.tl-entry .tl-content { flex: 1; min-width: 0; }
.tl-entry .tl-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.tl-entry .tl-body { font-size: 12px; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.tl-entry .tl-meta { font-size: 11px; color: var(--text-disabled); margin-top: 4px; }

/* Detail footer */
.detail-footer {
  padding: 12px 24px; background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.detail-footer .next-label { flex: 1; font-size: 13px; color: var(--text-secondary); }
.detail-footer .next-label strong { color: var(--blue); }

/* ── Status Jump Dropdown ── */
.status-jump-wrap { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }
.status-jump-dropdown {
  display: none; position: absolute; bottom: 100%; right: 0; margin-bottom: 6px;
  background: var(--bg-overlay); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); padding: 8px; min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 100;
  max-height: 320px; overflow-y: auto;
  display: none; flex-wrap: wrap; gap: 4px;
}
.status-jump-dropdown.open { display: flex; }
.status-jump-btn { font-size: 11px !important; white-space: nowrap; }
.status-jump-btn:hover { background: var(--bg-hover) !important; }

/* ── Clickable Progress Dots ── */
.step-dot[onclick]:hover { transform: scale(1.2); filter: brightness(1.3); transition: all 0.15s; }

/* ── Chat / Command View ── */
.chat-view { flex: 1; display: none; flex-direction: column; overflow: hidden; }
.chat-view.active { display: flex; }
.chat-feed { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 24px; }
.chat-entry { margin-bottom: 12px; max-width: 85%; }
.chat-entry.from-user { margin-left: auto; }
.chat-entry.from-sys { margin-right: auto; }
.chat-bubble-v2 {
  padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px;
  line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.chat-entry.from-user .chat-bubble-v2 { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.chat-entry.from-sys .chat-bubble-v2 { background: var(--bg-raised); border: 1px solid var(--border-default); border-bottom-left-radius: 4px; }
.chat-entry.err .chat-bubble-v2 { background: var(--red-muted); border-color: rgba(239,68,68,.2); }
.chat-entry.ok .chat-bubble-v2 { background: var(--green-muted); border-color: rgba(34,197,94,.2); }
.chat-bubble-v2 .btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── Command Bar ── */
.command-bar {
  padding: 12px 24px; background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle); display: flex; gap: 8px;
  align-items: flex-end; flex-shrink: 0;
}
.command-bar textarea {
  flex: 1; padding: 9px 14px; min-height: 38px; max-height: 100px;
  background: var(--bg-input); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 13px; font-family: var(--font); line-height: 1.4;
  resize: none; outline: none; transition: border var(--transition);
}
.command-bar textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-muted); }
.command-bar textarea::placeholder { color: var(--text-disabled); }
.command-bar .send-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--blue);
  border: none; color: #fff; font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.command-bar .send-btn:hover { background: var(--blue-hover); }

/* ── Slash Command Menu ── */
.slash-menu {
  display: none; flex-shrink: 0; background: var(--bg-surface);
  border-top: 1px solid var(--border-default); max-height: 280px;
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 12px;
}
.slash-menu.open { display: block; }
.slash-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition);
}
.slash-menu-item:hover, .slash-menu-item.active { background: var(--bg-hover); }
.slash-menu-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.slash-body { flex: 1; min-width: 0; }
.slash-cmd { font-size: 13px; font-weight: 700; color: var(--blue); }
.slash-label { font-size: 12px; color: var(--text-secondary); margin-left: 6px; font-weight: 400; }
.slash-hint { font-size: 11px; color: var(--text-disabled); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
@media (max-width: 768px) {
  .slash-menu { padding: 4px 8px; max-height: 220px; }
  .slash-menu-item { padding: 9px 10px; gap: 8px; }
}

/* ═══ MODALS ═══ */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); width: 100%; max-width: 540px;
  max-height: 90vh; max-height: 90dvh; overflow: hidden;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-tertiary); font-size: 20px; cursor: pointer; padding: 4px; border-radius: var(--radius-xs); transition: all var(--transition); }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-content { padding: 20px; max-height: 65vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-content::-webkit-scrollbar { width: 4px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
.edit-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); margin-bottom: 12px; }
.edit-divider { height: 1px; background: var(--border-subtle); margin: 20px 0; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border-subtle);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-tertiary); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 12px;
  background: var(--bg-input); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 13px; font-family: var(--font); outline: none;
  transition: border var(--transition);
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-muted); }
.field textarea { resize: vertical; min-height: 56px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* Chip selector */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px; border-radius: 100px; font-size: 12px; font-weight: 500;
  background: var(--bg-input); border: 1px solid var(--border-default);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.chip.selected { background: var(--blue-muted); border-color: rgba(59,130,246,.3); color: var(--blue); }
.chip:hover:not(.selected) { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); }

/* Upload */
.file-upload {
  border: 1px dashed var(--border-default); border-radius: var(--radius-sm);
  padding: 14px; text-align: center; cursor: pointer; position: relative;
  font-size: 12px; color: var(--text-tertiary); transition: all var(--transition);
}
.file-upload:hover { border-color: var(--blue); background: var(--blue-muted); }
.file-upload:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-muted); }
.file-upload.paste-ready { border-color: var(--green, #22c55e); background: rgba(34,197,94,0.06); }
.file-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-upload img { max-width: 64px; max-height: 48px; border-radius: 4px; margin-top: 6px; }

/* Customer suggestion */
.suggest-list { margin-top: 4px; }
.suggest-item {
  padding: 8px 10px; background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs); margin-bottom: 4px; cursor: pointer;
  font-size: 12px; transition: background var(--transition);
}
.suggest-item:hover { background: var(--bg-hover); }
.suggest-item strong { color: var(--text-primary); }
.suggest-item span { color: var(--text-tertiary); }

/* ═══ TOAST ═══ */
.toast-area { position: fixed; top: 60px; right: 16px; z-index: 600; display: flex; flex-direction: column; gap: 6px; }
.toast-msg {
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md); animation: toastIn .25s ease;
}
.toast-msg.ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.toast-msg.err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.toast-msg.info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
html.dark-mode .toast-msg.ok { background: #065f46; color: #6ee7b7; border-color: #064e3b; }
html.dark-mode .toast-msg.err { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
html.dark-mode .toast-msg.info { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ MOBILE ═══ */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .sidebar { width: 100%; min-width: 100%; flex: 1; min-height: 0; }
  .content { flex-direction: column; }
  .main-area { display: none; }
  .main-area.mobile-open { display: flex; position: fixed; inset: 0; z-index: 200; overflow: hidden; }
  .main-area.mobile-open .chat-view.active,
  .main-area.mobile-open .detail-view.active { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
  .header-search { display: none; }
  .detail-header { padding: 12px 16px; }
  .detail-header h2 { font-size: 16px; }
  .detail-header .row1 { flex-direction: column; gap: 8px; }
  .detail-header .actions { justify-content: flex-start; }
  .detail-progress { padding: 10px 16px; }
  .detail-timeline { padding: 16px; }
  .detail-footer { padding: 10px 16px; }
  .command-bar { padding: 10px 16px; }
  .detail-info { grid-template-columns: 1fr; }
  .info-cell { padding: 8px 16px; }
  .mobile-back { display: inline-flex !important; }
  .modal-box { border-radius: var(--radius-md); }
}
@media (min-width: 769px) {
  .mobile-back { display: none !important; }
}

/* ═══ NOTIFICATIONS ═══ */
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  border-radius: 100px; background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  pointer-events: none; line-height: 1;
}
.notif-panel {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 380px;
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 300;
  max-height: 480px; overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border-subtle);
}
.notif-panel-header h3 { font-size: 14px; font-weight: 600; }
.notif-panel-body { max-height: 400px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle); cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-meta { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 10px; color: var(--text-disabled); margin-top: 2px; }
.notif-prio-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.notif-prio-dot.notif-high { background: var(--red); }
.notif-prio-dot.notif-med { background: var(--amber); }
.notif-prio-dot.notif-low { background: var(--green); }
.notif-empty {
  padding: 32px 16px; text-align: center; font-size: 13px; color: var(--text-tertiary);
}
.notif-item.notif-high { border-left: 3px solid var(--red); }
.notif-item.notif-med { border-left: 3px solid var(--amber); }
.notif-item.notif-low { border-left: 3px solid var(--green); }
@media (max-width: 768px) {
  .notif-panel { width: calc(100vw - 32px); right: -60px; }
}

/* ═══════════════════════════════════════
   SALES DASHBOARD
   ═══════════════════════════════════════ */
.sales-dashboard {
  display: none; flex-direction: column; position: fixed; inset: 0; z-index: 300;
  background: var(--bg-base); overflow: hidden;
}
.sales-dashboard.active { display: flex; }

.sd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.sd-header h2 { font-size: 15px; font-weight: 700; margin-left: 12px; color: var(--text-primary); }
.sd-header-left, .sd-header-right { display: flex; align-items: center; gap: 8px; }

/* Filters Bar */
.sd-filters {
  display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 24px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0; align-items: flex-end;
}
.sd-filter-group { display: flex; flex-direction: column; gap: 4px; }
.sd-filter-group label {
  font-size: 9px; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.sd-filter-group input, .sd-filter-group select {
  padding: 5px 10px; background: var(--bg-input); border: 1px solid var(--border-default);
  border-radius: var(--radius-xs); color: var(--text-primary); font-size: 12px;
  min-width: 0;
}
.sd-filter-group input:focus, .sd-filter-group select:focus { border-color: var(--blue); outline: none; }
.sd-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.sd-preset {
  padding: 4px 10px; border-radius: 100px; font-size: 11px; font-weight: 600;
  background: transparent; color: var(--text-tertiary); border: 1px solid transparent;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.sd-preset.active { background: rgba(59,130,246,.12); color: var(--blue); border-color: rgba(59,130,246,.2); }
.sd-preset:hover:not(.active) { background: var(--bg-hover); color: var(--text-secondary); }

/* Dashboard Grid */
.sd-grid {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.sd-loading {
  display: none; padding: 60px; text-align: center; font-size: 14px; color: var(--text-tertiary);
}
.sd-loading.active { display: block; }

/* KPI Row */
.sd-kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.sd-kpi {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 14px 16px;
  transition: border-color var(--transition);
}
.sd-kpi:hover { border-color: var(--border-strong); }
.sd-kpi-label {
  font-size: 10px; color: var(--text-tertiary); text-transform: uppercase;
  letter-spacing: 0.6px; font-weight: 700; margin-bottom: 4px;
}
.sd-kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.sd-kpi-sub { font-size: 11px; color: var(--text-disabled); margin-top: 2px; }

/* Monthly Comparison */
.sd-comparison { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sd-comp-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 12px 16px;
}
.sd-comp-label { font-size: 9px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.sd-comp-values { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.sd-comp-current { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.sd-comp-prev { font-size: 11px; color: var(--text-disabled); }
.sd-comp-change {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  display: inline-flex; align-items: center; gap: 2px;
}
.sd-comp-change.up { color: #22c55e; background: rgba(34,197,94,.1); }
.sd-comp-change.down { color: #ef4444; background: rgba(239,68,68,.1); }
.sd-comp-change.flat { color: var(--text-disabled); background: var(--bg-hover); }

/* Cards */
.sd-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); overflow: hidden;
}
.sd-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
}
.sd-card-header h3 { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.sd-card-body { padding: 14px 16px; }
.sd-card-body canvas { width: 100% !important; max-height: 260px; }

/* Chart Rows */
.sd-charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.sd-tables-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sd-bottom-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Toggle Group */
.sd-toggle-group {
  display: flex; gap: 2px; background: var(--bg-base);
  border-radius: var(--radius-xs); padding: 2px;
}
.sd-toggle {
  padding: 3px 10px; border-radius: var(--radius-xs); font-size: 10px; font-weight: 700;
  background: transparent; color: var(--text-tertiary); border: none; cursor: pointer;
  transition: all var(--transition); text-transform: uppercase; letter-spacing: 0.3px;
}
.sd-toggle.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.sd-toggle:hover:not(.active) { color: var(--text-secondary); }

/* Dashboard Tables */
.sd-table-wrap { max-height: 320px; overflow-y: auto; }
.sd-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sd-table th {
  text-align: left; padding: 8px 10px; font-size: 9px; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-default); position: sticky; top: 0;
  background: var(--bg-surface); z-index: 1;
}
.sd-table th.right, .sd-table td.right { text-align: right; }
.sd-table td { padding: 7px 10px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.sd-table tr:hover td { background: var(--bg-hover); }
.sd-table .product-thumb { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; vertical-align: middle; margin-right: 8px; }
.sd-table .gold { color: #C9A96E; font-weight: 600; }
.sd-table .green { color: var(--green); }
.sd-table .red { color: var(--red); }

/* Activity Feed */
.sd-activity-list { max-height: 320px; overflow-y: auto; }
.sd-activity-item {
  display: flex; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.sd-activity-item:last-child { border-bottom: none; }
.sd-activity-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.sd-activity-body { flex: 1; min-width: 0; }
.sd-activity-title { color: var(--text-primary); font-size: 12px; font-weight: 500; }
.sd-activity-meta { color: var(--text-disabled); font-size: 10px; margin-top: 2px; }

/* Empty state */
.sd-empty { padding: 32px 16px; text-align: center; font-size: 12px; color: var(--text-disabled); }

/* Mobile */
@media (max-width: 1024px) {
  .sd-bottom-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sd-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .sd-comparison { grid-template-columns: repeat(2, 1fr); }
  .sd-charts-row { grid-template-columns: 1fr; }
  .sd-tables-row { grid-template-columns: 1fr; }
  .sd-bottom-row { grid-template-columns: 1fr; }
  .sd-filters { gap: 8px; padding: 8px 16px; }
  .sd-grid { padding: 12px 16px; }
  .sd-header { padding: 8px 16px; }
  .sd-header h2 { font-size: 13px; }
  .sd-presets { gap: 3px; }
  .sd-preset { padding: 3px 8px; font-size: 10px; }
}
@media (max-width: 480px) {
  .sd-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .sd-kpi-value { font-size: 18px; }
  .sd-comparison { grid-template-columns: 1fr; }
}

/* ═══ Dashboard Tabs ═══ */
.sd-tabs { display: flex; gap: 2px; background: var(--bg-base); border-radius: var(--radius-xs); padding: 2px; margin-left: 12px; }
.sd-tab {
  padding: 5px 14px; border-radius: var(--radius-xs); font-size: 12px; font-weight: 700;
  background: transparent; color: var(--text-tertiary); border: none; cursor: pointer;
  transition: all var(--transition);
}
.sd-tab.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.sd-tab:hover:not(.active) { color: var(--text-secondary); }
.sd-tab-content { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.sd-tab-content.active { display: flex; }

/* ═══ OPERATIONS DASHBOARD (Mobile-First) ═══ */
.ops-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px; display: flex; flex-direction: column; gap: 12px;
  padding-bottom: 80px;
}
.ops-loading { display: none; padding: 40px; text-align: center; font-size: 13px; color: var(--text-tertiary); }
.ops-loading.active { display: block; }

/* KPI Grid — 2 cols on mobile */
.ops-kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.ops-kpi {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 12px; text-align: left;
}
.ops-kpi-label { font-size: 9px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.ops-kpi-value { font-size: 20px; font-weight: 800; line-height: 1.2; }
.ops-kpi-sub { font-size: 10px; color: var(--text-disabled); margin-top: 2px; }

/* Section containers */
.ops-section {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); overflow: visible;
}
.ops-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 12px; border-bottom: 1px solid var(--border-subtle);
}

/* Pipeline — grid on mobile, flex on desktop */
.ops-pipeline {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
  padding: 10px;
}
.ops-node {
  padding: 10px 8px; background: var(--bg-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs); text-align: center; position: relative;
  transition: all var(--transition);
}
.ops-node.healthy { border-color: rgba(34,197,94,.35); }
.ops-node.warning { border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.06); }
.ops-node.danger  { border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.07); }
.ops-node.caution { border-color: rgba(234,179,8,.4); background: rgba(234,179,8,.04); }
.ops-node.empty   { opacity: 0.4; }
.ops-node-icon { font-size: 16px; }
.ops-node-count { font-size: 18px; font-weight: 800; margin: 2px 0 1px; color: var(--text-primary); }
.ops-node-products { font-size: 8px; color: var(--text-disabled); margin-top: -1px; font-weight: 600; }
.ops-node-label { font-size: 8px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; line-height: 1.3; }
.ops-node-sla { font-size: 9px; margin-top: 3px; font-weight: 700; }
.ops-node-sla.ok { color: var(--green); }
.ops-node-sla.warning { color: var(--amber, #f59e0b); }
.ops-node-sla.critical { color: var(--red); font-weight: 800; }
.ops-node-sla.late { color: var(--red); }
.ops-pipeline-arrow { display: none; }

/* Critical Alerts */
.ops-alerts-section { border-color: rgba(239,68,68,.25); }
.ops-alerts-empty { padding: 16px 12px; font-size: 12px; color: var(--green); text-align: center; }
.ops-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle); border-left: 3px solid var(--red);
  cursor: pointer; transition: background var(--transition);
}
.ops-alert:last-child { border-bottom: none; }
.ops-alert:hover { background: var(--bg-hover); }
.ops-alert-icon { font-size: 16px; flex-shrink: 0; }
.ops-alert-body { flex: 1; min-width: 0; }
.ops-alert-title { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.ops-alert-meta { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.ops-alert-badge {
  font-size: 9px; font-weight: 800; padding: 2px 7px; border-radius: 100px;
  background: rgba(239,68,68,.15); color: var(--red); white-space: nowrap; align-self: center;
}
.ops-alert-badge.critical { background: var(--red); color: #fff; animation: pulse-red 1.5s infinite; }
@keyframes pulse-red { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* Tables (scroll horizontally on mobile) */
.ops-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ops-table { width: 100%; border-collapse: collapse; font-size: 11px; min-width: 480px; }
.ops-table th {
  position: sticky; top: 0; background: var(--bg-raised); padding: 8px 10px;
  font-size: 9px; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.5px; text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.ops-table th.r, .ops-table td.r { text-align: right; }
.ops-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary); white-space: nowrap;
}
.ops-table tr:hover td { background: var(--bg-hover); }
.ops-table tr[data-clickable] { cursor: pointer; }

/* Health bars in table */
.ops-bar { height: 5px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; margin-top: 4px; min-width: 60px; }
.ops-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }

/* Empty state */
.ops-empty { padding: 24px 12px; text-align: center; font-size: 12px; color: var(--text-disabled); }

/* ── Tablet (≥600px) ── */
@media (min-width: 600px) {
  .ops-scroll { padding: 16px; gap: 14px; }
  .ops-kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .ops-pipeline { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .ops-node-label { font-size: 9px; }
  .ops-node-count { font-size: 20px; }
  .ops-section-title { padding: 12px 16px; }
}

/* ── Desktop (≥1024px) ── */
@media (min-width: 1024px) {
  .ops-scroll { padding: 20px 24px; gap: 16px; }
  .ops-kpi-grid { grid-template-columns: repeat(6, 1fr); }
  .ops-pipeline {
    display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto;
    padding: 12px 16px; align-items: stretch;
  }
  .ops-pipeline::-webkit-scrollbar { height: 4px; }
  .ops-pipeline::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
  .ops-node { flex: 1 0 80px; min-width: 80px; }
  .ops-pipeline-arrow { display: flex; align-items: center; color: var(--text-disabled); font-size: 14px; flex-shrink: 0; }
  .ops-section-title { padding: 12px 16px; font-size: 12px; }
  .ops-table { min-width: unset; }
}

/* ═══ BRAND IN DASHBOARD HEADER ═══ */
.sd-brand {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 800; color: var(--text-primary); white-space: nowrap;
}
.sd-brand-icon { font-size: 18px; }

/* ═══ FLOATING DASHBOARD BUTTON ═══ */
.fab-dash {
  position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 400;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--blue); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fab-dash:hover { transform: translateY(-50%) scale(1.1); box-shadow: 0 6px 20px rgba(37,99,235,.45); }
.fab-dash:active { transform: translateY(-50%) scale(0.95); }

@media (min-width: 769px) { .fab-dash { display: none; } }
@media (max-width: 480px) { .fab-dash { right: 10px; width: 42px; height: 42px; font-size: 16px; } }

/* Tab responsive */
@media (max-width: 599px) {
  .sd-tabs { margin-left: 4px; }
  .sd-tab { padding: 4px 8px; font-size: 10px; }
}

/* ═══ DARK MODE OVERRIDES ═══ */
html.dark-mode .login-screen {
  background: radial-gradient(ellipse at top, #111118 0%, var(--bg-base) 70%);
}

/* Customer loyalty badges — boost contrast for light bg */
html:not(.dark-mode) .cust-returning { background: rgba(205,127,50,.1); color: #a06020; border-color: rgba(205,127,50,.3); }
html:not(.dark-mode) .cust-loyal { background: rgba(120,120,140,.1); color: #666680; border-color: rgba(120,120,140,.3); }
html:not(.dark-mode) .cust-vip { background: rgba(180,140,20,.1); color: #8a6d00; border-color: rgba(180,140,20,.3); }

/* Ops node states — light-friendly backgrounds */
html:not(.dark-mode) .ops-node.warning { background: rgba(245,158,11,.04); }
html:not(.dark-mode) .ops-node.danger { background: rgba(220,38,38,.04); }
html:not(.dark-mode) .ops-node.caution { background: rgba(234,179,8,.04); }

/* Comparison card change colors — light-friendly */
html:not(.dark-mode) .sd-comp-change.up { color: #16a34a; background: rgba(22,163,74,.08); }
html:not(.dark-mode) .sd-comp-change.down { color: #dc2626; background: rgba(220,38,38,.08); }

/* Theme toggle button styling */
#themeBtn { font-size: 18px; }
