/* ============================================
   FlowTrack V2 — Design System
   Professional dark themes with Lucide icons
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Theme: Tokyo Night (default) ── */
:root, [data-theme="tokyo"] {
  --bg-primary: #1a1b26;
  --bg-secondary: #16161e;
  --bg-tertiary: #24283b;
  --bg-elevated: #292e42;
  --bg-hover: #33394d;
  --bg-active: #3b4261;
  --bg-glass: rgba(26, 27, 38, 0.88);
  --text-primary: #c0caf5;
  --text-secondary: #9aa5ce;
  --text-muted: #565f89;
  --text-inverse: #1a1b26;
  --accent-blue: #7aa2f7;
  --accent-purple: #bb9af7;
  --accent-cyan: #7dcfff;
  --accent-green: #9ece6a;
  --accent-orange: #ff9e64;
  --accent-red: #f7768e;
  --accent-yellow: #e0af68;
  --accent-pink: #ff007c;
  --accent-teal: #73daca;
  --border-color: #292e42;
  --border-light: #3b4261;
  --border-focus: #7aa2f7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(122,162,247,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sidebar-width: 240px;
}

[data-theme="dracula"] {
  --bg-primary: #282a36; --bg-secondary: #21222c; --bg-tertiary: #343746;
  --bg-elevated: #3c3f58; --bg-hover: #44475a; --bg-active: #515470;
  --bg-glass: rgba(40, 42, 54, 0.88);
  --text-primary: #f8f8f2; --text-secondary: #bfbfbf; --text-muted: #6272a4; --text-inverse: #282a36;
  --accent-blue: #8be9fd; --accent-purple: #bd93f9; --accent-cyan: #8be9fd;
  --accent-green: #50fa7b; --accent-orange: #ffb86c; --accent-red: #ff5555;
  --accent-yellow: #f1fa8c; --accent-pink: #ff79c6; --accent-teal: #50fa7b;
  --border-color: #343746; --border-light: #44475a; --border-focus: #bd93f9;
  --shadow-glow: 0 0 20px rgba(189,147,249,0.12);
}

[data-theme="nord"] {
  --bg-primary: #2e3440; --bg-secondary: #272c36; --bg-tertiary: #3b4252;
  --bg-elevated: #434c5e; --bg-hover: #4c566a; --bg-active: #5a657a;
  --bg-glass: rgba(46, 52, 64, 0.88);
  --text-primary: #eceff4; --text-secondary: #d8dee9; --text-muted: #7b88a1; --text-inverse: #2e3440;
  --accent-blue: #88c0d0; --accent-purple: #b48ead; --accent-cyan: #8fbcbb;
  --accent-green: #a3be8c; --accent-orange: #d08770; --accent-red: #bf616a;
  --accent-yellow: #ebcb8b; --accent-pink: #b48ead; --accent-teal: #8fbcbb;
  --border-color: #3b4252; --border-light: #434c5e; --border-focus: #88c0d0;
  --shadow-glow: 0 0 20px rgba(136,192,208,0.12);
}

[data-theme="midnight"] {
  --bg-primary: #0d1117; --bg-secondary: #090c10; --bg-tertiary: #161b22;
  --bg-elevated: #1c2128; --bg-hover: #252c35; --bg-active: #2d333b;
  --bg-glass: rgba(13, 17, 23, 0.92);
  --text-primary: #c9d1d9; --text-secondary: #8b949e; --text-muted: #484f58; --text-inverse: #0d1117;
  --accent-blue: #58a6ff; --accent-purple: #bc8cff; --accent-cyan: #56d4dd;
  --accent-green: #3fb950; --accent-orange: #d29922; --accent-red: #f85149;
  --accent-yellow: #d29922; --accent-pink: #db61a2; --accent-teal: #3fb950;
  --border-color: #1c2128; --border-light: #2d333b; --border-focus: #58a6ff;
  --shadow-glow: 0 0 20px rgba(88,166,255,0.1);
}

[data-theme="abyss"] {
  --bg-primary: #060a10; --bg-secondary: #040710; --bg-tertiary: #0c1220;
  --bg-elevated: #111a2e; --bg-hover: #162034; --bg-active: #1c2940;
  --bg-glass: rgba(6, 10, 16, 0.94);
  --text-primary: #b0bdd4; --text-secondary: #7a8ba0; --text-muted: #3e4f68; --text-inverse: #060a10;
  --accent-blue: #6e9bef; --accent-purple: #a78bfa; --accent-cyan: #67c8d8;
  --accent-green: #6dd390; --accent-orange: #e8a55a; --accent-red: #e5534b;
  --accent-yellow: #d4a855; --accent-pink: #c678dd; --accent-teal: #56c1a0;
  --border-color: #0e1525; --border-light: #182438; --border-focus: #6e9bef;
  --shadow-glow: 0 0 24px rgba(110,155,239,0.08);
}

[data-theme="moonlight"] {
  --bg-primary: #1e2030; --bg-secondary: #191a2a; --bg-tertiary: #2f3146;
  --bg-elevated: #383a4f; --bg-hover: #444660; --bg-active: #50527a;
  --bg-glass: rgba(30, 32, 48, 0.88);
  --text-primary: #c8d3f5; --text-secondary: #a9b8d8; --text-muted: #636da6; --text-inverse: #1e2030;
  --accent-blue: #82aaff; --accent-purple: #c099ff; --accent-cyan: #86e1fc;
  --accent-green: #c3e88d; --accent-orange: #ff966c; --accent-red: #ff757f;
  --accent-yellow: #ffc777; --accent-pink: #fca7ea; --accent-teal: #4fd6be;
  --border-color: #2f3146; --border-light: #383a4f; --border-focus: #82aaff;
  --shadow-glow: 0 0 20px rgba(130,170,255,0.12);
}

[data-theme="oled"] {
  --bg-primary: #000000; --bg-secondary: #000000; --bg-tertiary: #0a0a0a;
  --bg-elevated: #111111; --bg-hover: #1a1a1a; --bg-active: #222222;
  --bg-glass: rgba(0, 0, 0, 0.95);
  --text-primary: #e0e0e0; --text-secondary: #999999; --text-muted: #555555; --text-inverse: #000000;
  --accent-blue: #5b9bf5; --accent-purple: #a78bfa; --accent-cyan: #5bc4d4;
  --accent-green: #6dd390; --accent-orange: #e8a55a; --accent-red: #ef5350;
  --accent-yellow: #d4a855; --accent-pink: #ec4899; --accent-teal: #4db6ac;
  --border-color: #1a1a1a; --border-light: #2a2a2a; --border-focus: #5b9bf5;
  --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
  --shadow-glow: none;
}

/* ── Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-purple); color: var(--text-inverse); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Layout ── */
.app-container { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width); min-width: var(--sidebar-width);
  background: var(--bg-secondary); border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column; z-index: 100;
  transition: transform var(--transition-normal);
}
.sidebar-header { padding: 16px 16px 12px; border-bottom: 1px solid var(--border-color); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo .logo-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-icon svg { width: 16px; height: 16px; stroke: #fff; }
.sidebar-logo h1 {
  font-size: 1.05rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -0.02em;
}
.sidebar-nav { flex: 1; padding: 8px 8px; overflow-y: auto; }
.nav-section { margin-bottom: 16px; }
.nav-section-title {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); padding: 0 10px; margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer;
  transition: all var(--transition-fast); font-size: 0.85rem; font-weight: 450;
  position: relative; user-select: none; transform: translateX(0);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); transform: translateX(2px); }
.nav-item.active { background: var(--bg-tertiary); color: var(--accent-blue); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 55%; background: var(--accent-blue); border-radius: 0 3px 3px 0;
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-item .icon svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.nav-item .badge {
  margin-left: auto; background: var(--bg-active); color: var(--text-secondary);
  font-size: 0.65rem; font-weight: 600; padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.nav-item.active .badge { background: var(--accent-blue); color: var(--text-inverse); }

.sidebar-footer { padding: 10px 8px; border-top: 1px solid var(--border-color); }
.theme-selector { display: flex; gap: 5px; padding: 2px 4px; justify-content: center; flex-wrap: wrap; }
.theme-dot {
  width: 16px; height: 16px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all var(--transition-fast);
}
.theme-dot:hover { transform: scale(1.2); }
.theme-dot.active { border-color: var(--text-primary); box-shadow: 0 0 6px rgba(255,255,255,0.15); }
.theme-dot[data-theme="tokyo"]     { background: linear-gradient(135deg, #7aa2f7, #bb9af7); }
.theme-dot[data-theme="dracula"]   { background: linear-gradient(135deg, #bd93f9, #ff79c6); }
.theme-dot[data-theme="nord"]      { background: linear-gradient(135deg, #88c0d0, #b48ead); }
.theme-dot[data-theme="midnight"]  { background: linear-gradient(135deg, #58a6ff, #3fb950); }
.theme-dot[data-theme="abyss"]     { background: linear-gradient(135deg, #6e9bef, #a78bfa); }
.theme-dot[data-theme="moonlight"] { background: linear-gradient(135deg, #82aaff, #c099ff); }
.theme-dot[data-theme="oled"]      { background: linear-gradient(135deg, #333, #111); border: 1px solid #444; }

.lang-toggle {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 8px; padding: 4px; background: var(--bg-tertiary); border-radius: var(--radius-sm);
}
.lang-btn {
  padding: 3px 10px; font-size: 0.7rem; font-weight: 600; font-family: var(--font-sans);
  background: transparent; border: none; color: var(--text-muted);
  border-radius: 4px; cursor: pointer; transition: all var(--transition-fast);
}
.lang-btn.active { background: var(--bg-active); color: var(--text-primary); }
.lang-btn:hover { color: var(--text-secondary); }

/* ── Main Content ── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.top-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  border-bottom: 1px solid var(--border-color); background: var(--bg-primary); flex-shrink: 0;
}
.menu-toggle { display: none; background: none; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; padding: 4px; }
.page-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.search-bar { flex: 1; max-width: 360px; margin-left: auto; position: relative; }
.search-bar input {
  width: 100%; padding: 7px 12px 7px 32px; background: var(--bg-tertiary);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  color: var(--text-primary); font-family: var(--font-sans); font-size: 0.82rem; outline: none;
  transition: all var(--transition-fast);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px rgba(122,162,247,0.08); }
.search-bar .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); display: flex; }
.search-bar .search-icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.top-bar-actions { display: flex; align-items: center; gap: 6px; }

.content-area { flex: 1; overflow-y: auto; padding: 20px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--radius-sm); font-family: var(--font-sans);
  font-size: 0.8rem; font-weight: 500; border: none; cursor: pointer;
  transition: all var(--transition-fast); white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff; box-shadow: 0 2px 8px rgba(122,162,247,0.25);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(122,162,247,0.35); filter: brightness(1.08); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { filter: brightness(1.12); }
.btn-success { background: var(--accent-green); color: var(--text-inverse); }
.btn-icon { width: 30px; height: 30px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-lg { padding: 10px 20px; font-size: 0.9rem; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { filter: brightness(1.15); }

/* ── Tab bar ── */
.tab-bar { display: flex; gap: 2px; margin-bottom: 16px; }
.tab-btn {
  padding: 7px 16px; font-size: 0.8rem; font-weight: 500; font-family: var(--font-sans);
  background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all var(--transition-fast);
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

/* ── Dashboard ── */
.page-section { display: none; animation: fadeSlideIn 0.25s ease-out; }
.page-section.active { display: block; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 16px; position: relative; overflow: hidden;
  transition: all var(--transition-normal);
  animation: cardSlideUp 0.3s ease-out both;
}
.stats-grid .stat-card:nth-child(1) { animation-delay: 0s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.04s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.08s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.12s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: 0.16s; }
.stats-grid .stat-card:nth-child(6) { animation-delay: 0.2s; }
.stats-grid .stat-card:nth-child(7) { animation-delay: 0.24s; }
.stats-grid .stat-card:nth-child(8) { animation-delay: 0.28s; }
@keyframes cardSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.blue::before   { background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--accent-green), var(--accent-teal)); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink)); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow)); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--accent-red), var(--accent-orange)); }
.stat-card.cyan::before   { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue)); }
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); border-color: var(--border-light); }
.stat-card .stat-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.stat-card .stat-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.stat-card .stat-icon svg { width: 16px; height: 16px; stroke-width: 2; fill: none; }
.stat-card.blue .stat-icon   { background: rgba(122,162,247,0.12); }
.stat-card.blue .stat-icon svg { stroke: var(--accent-blue); }
.stat-card.green .stat-icon  { background: rgba(158,206,106,0.12); }
.stat-card.green .stat-icon svg { stroke: var(--accent-green); }
.stat-card.purple .stat-icon { background: rgba(187,154,247,0.12); }
.stat-card.purple .stat-icon svg { stroke: var(--accent-purple); }
.stat-card.orange .stat-icon { background: rgba(255,158,100,0.12); }
.stat-card.orange .stat-icon svg { stroke: var(--accent-orange); }
.stat-card.red .stat-icon    { background: rgba(247,118,142,0.12); }
.stat-card.red .stat-icon svg { stroke: var(--accent-red); }
.stat-card.yellow .stat-icon  { background: rgba(224,175,104,0.12); }
.stat-card.yellow .stat-icon svg { stroke: var(--accent-yellow); }
.stat-card.cyan .stat-icon   { background: rgba(125,207,255,0.12); }
.stat-card.cyan .stat-icon svg { stroke: var(--accent-cyan); }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 2px; }
.stat-card .stat-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 20px; }
.dashboard-grid.equal { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 16px; transition: all var(--transition-normal);
  animation: cardSlideUp 0.3s ease-out both;
}
.card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card h3 { font-size: 0.82rem; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card h3 svg { width: 14px; height: 14px; stroke: var(--text-muted); stroke-width: 2; fill: none; }

/* Status bars */
.status-bars { display: flex; flex-direction: column; gap: 10px; }
.status-bar-item { display: flex; align-items: center; gap: 8px; }
.status-bar-item .sbl { font-size: 0.75rem; color: var(--text-secondary); min-width: 85px; display: flex; align-items: center; gap: 4px; }
.status-bar-item .sbl .status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-bar-item .sbv { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); min-width: 24px; text-align: right; }
.status-bar-track { flex: 1; height: 6px; background: var(--bg-active); border-radius: 10px; overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 10px; transition: width var(--transition-slow); }
.status-bar-fill.notfound       { background: #999; }
.status-bar-fill.inforeceived   { background: var(--accent-cyan); }
.status-bar-fill.intransit      { background: var(--accent-blue); }
.status-bar-fill.pickup         { background: #9678ff; }
.status-bar-fill.delivered      { background: var(--accent-green); }
.status-bar-fill.outfordelivery { background: #64b4ff; }
.status-bar-fill.undelivered    { background: var(--accent-red); }
.status-bar-fill.alert          { background: var(--accent-orange); }
.status-bar-fill.expired        { background: #dc5050; }
.status-bar-fill.return         { background: var(--accent-orange); }
.status-bar-fill.refunded       { background: var(--accent-pink); }

/* Activity */
.activity-list { display: flex; flex-direction: column; gap: 1px; }
.activity-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-sm); transition: background var(--transition-fast); cursor: pointer;
}
.activity-item:hover { background: var(--bg-hover); }
.activity-item .ai-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.activity-item .ai-text { flex: 1; min-width: 0; }
.activity-item .ai-text .ai-title { font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-item .ai-text .ai-time { font-size: 0.68rem; color: var(--text-muted); }

/* Chart */
.mini-chart { display: flex; align-items: flex-end; gap: 5px; height: 100px; padding-top: 8px; }
.mini-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.mini-chart .bar {
  width: 100%; max-width: 32px; border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, var(--accent-blue), var(--accent-purple));
  transition: height var(--transition-slow); min-height: 3px;
}
.mini-chart .bar-label { font-size: 0.6rem; color: var(--text-muted); }

/* ── Orders Table ── */
.orders-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-group {
  display: flex; gap: 2px; background: var(--bg-tertiary); padding: 2px;
  border-radius: var(--radius-md); border: 1px solid var(--border-color);
}
.filter-btn {
  padding: 5px 10px; font-size: 0.73rem; font-weight: 500; font-family: var(--font-sans);
  background: transparent; border: none; color: var(--text-muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition-fast); white-space: nowrap;
}
.filter-btn:hover { color: var(--text-secondary); }
.filter-btn.active { background: var(--bg-active); color: var(--text-primary); }

.type-toggle {
  display: flex; gap: 2px; background: var(--bg-tertiary); padding: 2px;
  border-radius: var(--radius-md); border: 1px solid var(--border-color);
}
.type-btn {
  padding: 5px 12px; font-size: 0.73rem; font-weight: 500; font-family: var(--font-sans);
  background: transparent; border: none; color: var(--text-muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition-fast);
}
.type-btn:hover { color: var(--text-secondary); }
.type-btn.active { background: var(--accent-blue); color: #fff; }

.sort-select {
  padding: 5px 26px 5px 8px; font-size: 0.73rem; font-family: var(--font-sans);
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); color: var(--text-primary); cursor: pointer; outline: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23565f89'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.sort-select:focus { border-color: var(--border-focus); }

.table-wrap {
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); overflow: hidden;
}
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th {
  text-align: left; padding: 10px 14px; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
  background: var(--bg-elevated); border-bottom: 1px solid var(--border-color);
  white-space: nowrap; user-select: none;
}
.orders-table td {
  padding: 10px 14px; font-size: 0.82rem; border-bottom: 1px solid var(--border-color);
  white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}
.orders-table tr { transition: background var(--transition-fast), box-shadow var(--transition-fast); }
.orders-table tbody tr:hover { background: var(--bg-hover); cursor: pointer; box-shadow: inset 3px 0 0 var(--accent-blue); }
.orders-table tbody tr:last-child td { border-bottom: none; }

.status-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  border-radius: 16px; font-size: 0.7rem; font-weight: 600; white-space: nowrap;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.status-badge:hover { transform: scale(1.05); }
.status-badge .dot { width: 5px; height: 5px; border-radius: 50%; }
.status-badge.notfound        { background: rgba(150,150,150,0.1); color: #999; }
.status-badge.notfound .dot   { background: #999; }
.status-badge.inforeceived    { background: rgba(125,207,255,0.1); color: var(--accent-cyan); }
.status-badge.inforeceived .dot { background: var(--accent-cyan); }
.status-badge.intransit       { background: rgba(122,162,247,0.1); color: var(--accent-blue); }
.status-badge.intransit .dot  { background: var(--accent-blue); }
.status-badge.pickup          { background: rgba(150,120,255,0.1); color: #9678ff; }
.status-badge.pickup .dot     { background: #9678ff; }
.status-badge.delivered       { background: rgba(158,206,106,0.1); color: var(--accent-green); }
.status-badge.delivered .dot  { background: var(--accent-green); }
.status-badge.outfordelivery  { background: rgba(100,180,255,0.1); color: #64b4ff; }
.status-badge.outfordelivery .dot { background: #64b4ff; }
.status-badge.undelivered     { background: rgba(247,118,142,0.1); color: var(--accent-red); }
.status-badge.undelivered .dot { background: var(--accent-red); }
.status-badge.alert           { background: rgba(255,158,100,0.1); color: var(--accent-orange); }
.status-badge.alert .dot      { background: var(--accent-orange); }
.status-badge.expired         { background: rgba(220,80,80,0.1); color: #dc5050; }
.status-badge.expired .dot    { background: #dc5050; }
.status-badge.return          { background: rgba(255,158,100,0.1); color: var(--accent-orange); }
.status-badge.return .dot     { background: var(--accent-orange); }
.status-badge.refunded        { background: rgba(255,0,124,0.1); color: var(--accent-pink); }
.status-badge.refunded .dot   { background: var(--accent-pink); }

.type-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px;
  border-radius: 4px; font-size: 0.68rem; font-weight: 600;
}
.type-badge.outgoing { background: rgba(122,162,247,0.1); color: var(--accent-blue); }
.type-badge.incoming { background: rgba(187,154,247,0.1); color: var(--accent-purple); }

.order-id-tag { font-family: var(--font-mono); font-size: 0.76rem; color: var(--accent-purple); }
.track-link { color: var(--accent-cyan); text-decoration: none; font-family: var(--font-mono); font-size: 0.76rem; transition: color var(--transition-fast); }
.track-link:hover { color: var(--accent-blue); text-decoration: underline; }

.row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--transition-fast); }
.orders-table tr:hover .row-actions { opacity: 1; }
.row-actions .btn-icon { width: 26px; height: 26px; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; text-align: center; }
.empty-state .empty-icon { margin-bottom: 12px; opacity: 0.3; }
.empty-state .empty-icon svg { width: 48px; height: 48px; stroke: var(--text-muted); stroke-width: 1; fill: none; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 16px; }

/* ── Pipeline / Kanban ── */
.pipeline-container { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; height: calc(100vh - 120px); }
.pipeline-column {
  min-width: 260px; width: 260px; background: var(--bg-tertiary);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.pipeline-column-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 7px;
}
.pipeline-column-header .col-dot { width: 7px; height: 7px; border-radius: 50%; }
.pipeline-column-header .col-title { font-size: 0.78rem; font-weight: 600; }
.pipeline-column-header .col-count { font-size: 0.68rem; color: var(--text-muted); margin-left: auto; background: var(--bg-active); padding: 1px 7px; border-radius: 10px; }
.pipeline-column-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.pipeline-card {
  background: var(--bg-elevated); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 12px; cursor: pointer;
  transition: all var(--transition-fast);
}
.pipeline-card:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.pipeline-card .pc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.pipeline-card .pc-id { font-family: var(--font-mono); font-size: 0.68rem; color: var(--accent-purple); }
.pipeline-card .pc-price { font-size: 0.75rem; font-weight: 600; color: var(--accent-green); }
.pipeline-card .pc-name { font-size: 0.8rem; font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipeline-card .pc-customer { font-size: 0.7rem; color: var(--text-muted); }
.pipeline-card .pc-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border-color); }
.pipeline-card .pc-track { font-family: var(--font-mono); font-size: 0.65rem; color: var(--accent-cyan); }
.pipeline-card .pc-date { font-size: 0.65rem; color: var(--text-muted); }

/* ── Analytics ── */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.top-items { display: flex; flex-direction: column; gap: 8px; }
.top-item { display: flex; align-items: center; gap: 10px; }
.top-item .ti-rank { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-active); display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.top-item .ti-name { flex: 1; font-size: 0.8rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-item .ti-value { font-size: 0.78rem; font-weight: 600; color: var(--accent-green); }
.top-item .ti-count { font-size: 0.73rem; color: var(--text-muted); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all var(--transition-normal);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: var(--radius-xl); width: 92%; max-width: 720px; max-height: 88vh;
  overflow-y: auto; box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(16px) scale(0.97); transition: transform var(--transition-spring);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-color); }
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%; background: var(--bg-tertiary);
  border: none; color: var(--text-muted); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-close svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 14px 20px; border-top: 1px solid var(--border-color); }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.form-group.third { grid-column: span 1; }
.form-group label { font-size: 0.73rem; font-weight: 500; color: var(--text-secondary); }
.form-group label .required { color: var(--accent-red); }
.form-input {
  padding: 8px 12px; background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-sans);
  font-size: 0.85rem; outline: none; transition: all var(--transition-fast); width: 100%;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px rgba(122,162,247,0.08); }
select.form-input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23565f89'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; cursor: pointer;
}
textarea.form-input { resize: vertical; min-height: 60px; line-height: 1.5; }

.form-section-title {
  grid-column: 1 / -1; font-size: 0.73rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); padding-top: 10px; margin-top: 4px;
  border-top: 1px solid var(--border-color);
}

/* Photo upload */
.photo-upload-area {
  border: 2px dashed var(--border-color); border-radius: var(--radius-md);
  padding: 16px; text-align: center; cursor: pointer; transition: all var(--transition-fast);
}
.photo-upload-area:hover { border-color: var(--border-focus); background: rgba(122,162,247,0.03); }
.photo-upload-area svg { width: 24px; height: 24px; stroke: var(--text-muted); stroke-width: 1.5; fill: none; margin-bottom: 6px; }
.photo-upload-area p { font-size: 0.75rem; color: var(--text-muted); }
.photo-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.photo-thumb {
  width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover;
  border: 1px solid var(--border-color); cursor: pointer;
}
.photo-thumb-wrap { position: relative; }
.photo-remove {
  position: absolute; top: -4px; right: -4px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent-red); border: none; color: #fff;
  font-size: 0.55rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ── Detail Panel ── */
.detail-panel {
  position: fixed; top: 0; right: -500px; width: 440px; height: 100vh;
  background: var(--bg-secondary); border-left: 1px solid var(--border-color);
  z-index: 200; transition: right var(--transition-slow); display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(0,0,0,0.3);
}
.detail-panel.active { right: 0; }
.detail-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.detail-panel-body { flex: 1; overflow-y: auto; padding: 16px; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 10px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.detail-row .dr-label { font-size: 0.78rem; color: var(--text-muted); }
.detail-row .dr-value { font-size: 0.8rem; font-weight: 500; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-timeline { display: flex; flex-direction: column; position: relative; padding-left: 18px; }
.status-timeline::before { content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1.5px; background: var(--border-color); }
.timeline-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; position: relative; }
.timeline-item .ti-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--bg-active);
  border: 2px solid var(--border-color); position: absolute; left: -18px; top: 8px; z-index: 1;
}
.timeline-item.active .ti-dot { background: var(--accent-blue); border-color: var(--accent-blue); box-shadow: 0 0 6px rgba(122,162,247,0.4); }
.timeline-item.completed .ti-dot { background: var(--accent-green); border-color: var(--accent-green); }
.timeline-item .ti-content { flex: 1; }
.timeline-item .ti-status { font-size: 0.78rem; font-weight: 500; }
.timeline-item .ti-date { font-size: 0.68rem; color: var(--text-muted); }
.detail-panel-footer { display: flex; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--border-color); flex-shrink: 0; }

/* ── Settings ── */
.settings-section {
  background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 12px;
}
.settings-section h3 { font-size: 0.88rem; font-weight: 600; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 6px; }
.settings-section h3 svg { width: 14px; height: 14px; stroke: var(--text-muted); stroke-width: 2; fill: none; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.setting-row .sr-info { flex: 1; }
.setting-row .sr-label { font-size: 0.82rem; font-weight: 500; }
.setting-row .sr-desc { font-size: 0.73rem; color: var(--text-muted); }

.toggle { width: 40px; height: 22px; background: var(--bg-active); border-radius: 11px; cursor: pointer; position: relative; transition: background var(--transition-fast); border: none; }
.toggle.active { background: var(--accent-blue); }
.toggle::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  top: 3px; left: 3px; transition: transform var(--transition-fast);
}
.toggle.active::after { transform: translateX(18px); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 6px; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 10px 14px; display: flex; align-items: center;
  gap: 8px; box-shadow: var(--shadow-lg); min-width: 260px; max-width: 380px;
  animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.removing { animation: slideOutRight 0.3s ease forwards; }
.toast .toast-icon { flex-shrink: 0; }
.toast .toast-icon svg { width: 16px; height: 16px; stroke-width: 2; fill: none; }
.toast .toast-msg { font-size: 0.78rem; flex: 1; }
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.success .toast-icon svg { stroke: var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.error .toast-icon svg { stroke: var(--accent-red); }
.toast.info    { border-left: 3px solid var(--accent-blue); }
.toast.info .toast-icon svg { stroke: var(--accent-blue); }
.toast.warning { border-left: 3px solid var(--accent-yellow); }
.toast.warning .toast-icon svg { stroke: var(--accent-yellow); }

/* ── Audit Log ── */
.audit-log { max-height: 300px; overflow-y: auto; }
.audit-entry { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-color); }
.audit-entry:last-child { border-bottom: none; }
.audit-entry .ae-time { font-size: 0.68rem; color: var(--text-muted); min-width: 110px; font-family: var(--font-mono); }
.audit-entry .ae-msg { font-size: 0.75rem; color: var(--text-secondary); }

/* ── Animations ── */
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }
.fade-in-up { animation: fadeInUp 0.4s ease; }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 299;
  opacity: 0; transition: opacity var(--transition-normal);
}
.sidebar-overlay.active { display: block; opacity: 1; }
.sidebar-user:hover { background: var(--bg-hover); }

/* ── Mobile Bottom Nav ── */
.mobile-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 250;
  background: var(--bg-secondary); border-top: 1px solid var(--border-color);
  padding: 4px 0; padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around; align-items: center;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.3);
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; background: none; border: none; color: var(--text-muted);
  font-family: var(--font-sans); font-size: 0.6rem; font-weight: 500;
  cursor: pointer; transition: color var(--transition-fast); position: relative;
  -webkit-tap-highlight-color: transparent; min-width: 48px;
}
.bottom-nav-item svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.bottom-nav-item.active { color: var(--accent-blue); }
.bottom-nav-item.active svg { stroke: var(--accent-blue); }
.bottom-nav-item .bnav-badge {
  position: absolute; top: 2px; right: 6px;
  background: var(--accent-red); color: #fff; font-size: 0.55rem;
  font-weight: 700; padding: 1px 4px; border-radius: 8px; min-width: 14px;
  text-align: center; line-height: 1.2;
}
/* FAB */
.fab-trigger { padding: 0; }
.fab-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(122,162,247,0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  margin-top: -16px;
}
.fab-trigger:active .fab-icon { transform: scale(0.92); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Sidebar */
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); z-index: 300; }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }

  /* Bottom nav visible */
  .mobile-bottom-nav { display: flex; }

  /* Content adjustments */
  .content-area { padding: 12px; padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-container { height: calc(100vh - 180px); }

  /* Search bar full width */
  .top-bar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .search-bar { order: 10; max-width: 100%; flex-basis: 100%; margin-left: 0; }
  .top-bar-actions { margin-left: auto; gap: 4px; }
  .top-bar-actions .btn span { display: none; }
  .top-bar-actions .btn-sm { padding: 6px 8px; }

  /* Detail panel full screen */
  .detail-panel { width: 100%; right: -100%; }

  /* Modal as bottom sheet */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    transform: translateY(100%);
    animation: none;
  }
  .modal-overlay.active .modal {
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .modal-body { padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .modal-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

  /* Orders toolbar */
  .orders-toolbar { flex-direction: column; align-items: stretch; gap: 6px; }
  .orders-toolbar .type-toggle,
  .orders-toolbar .filter-group { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

  /* Table tweaks */
  .orders-table th:nth-child(n+7),
  .orders-table td:nth-child(n+7) { display: none; }
  .orders-table td { padding: 8px 10px; font-size: 0.78rem; }
  .orders-table th { padding: 8px 10px; }
  .row-actions { opacity: 1; }

  /* Stat cards bigger tap area */
  .stat-card { padding: 14px; min-height: 80px; }
  .stat-card .stat-value { font-size: 1.4rem; }

  /* Toast position */
  .toast-container { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); right: 12px; left: 12px; }
  .toast { min-width: auto; width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .page-title { font-size: 0.9rem; }
  .top-bar-actions .btn-primary span { display: none; }
}

/* ── Utility ── */
.text-blue   { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }
.text-cyan   { color: var(--accent-cyan); }
.text-green  { color: var(--accent-green); }
.text-red    { color: var(--accent-red); }
.text-yellow { color: var(--accent-yellow); }
.text-muted  { color: var(--text-muted); }
.text-mono   { font-family: var(--font-mono); }
.ml-auto     { margin-left: auto; }
.mt-sm       { margin-top: 6px; }
.mt-md       { margin-top: 12px; }
.gap-sm      { gap: 6px; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chart tooltip */
.chart-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 8px 12px;
  box-shadow: var(--shadow-lg); font-size: 0.75rem;
  opacity: 0; transition: opacity 120ms ease;
  line-height: 1.5;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .ct-label { color: var(--text-muted); font-weight: 500; }
.chart-tooltip .ct-value { color: var(--text-primary); font-weight: 700; font-size: 0.88rem; }

/* Settings theme grid */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.theme-card {
  padding: 10px; border-radius: var(--radius-md); border: 2px solid var(--border-color);
  cursor: pointer; transition: all var(--transition-fast); text-align: center;
  font-size: 0.72rem; font-weight: 600;
}
.theme-card:hover { border-color: var(--border-light); }
.theme-card.active { border-color: var(--accent-blue); box-shadow: 0 0 8px rgba(122,162,247,0.2); }
.theme-card .tc-preview {
  width: 100%; height: 24px; border-radius: 4px; margin-bottom: 6px;
}

/* Accent color selector */
.accent-row { display: flex; gap: 6px; flex-wrap: wrap; }
.accent-dot {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all var(--transition-fast);
}
.accent-dot:hover { transform: scale(1.15); }
.accent-dot.active { border-color: var(--text-primary); box-shadow: 0 0 6px rgba(255,255,255,0.2); }
