/* ─── Geist Font ─────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Geist';
  src: url('/fonts/GeistVF.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/GeistMonoVF.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ─── Order Care Hub — Slate + Teal ─────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces — slate scale */
  --bg:         #0b1014;
  --surface:    #0f161c;
  --surface-2:  #131b23;
  --surface-3:  #19232d;
  --border:     #1f2a35;
  --border-2:   #2a3744;

  /* Text */
  --text:       #e6edf3;
  --text-soft:  #c2ccd6;
  --muted:      #7d8a99;
  --muted-2:    #5b6775;

  /* Accent — calm teal */
  --accent:       #2dd4bf;
  --accent-soft:  rgba(45, 212, 191, 0.12);
  --accent-line:  rgba(45, 212, 191, 0.35);
  --accent-dark:  #14b8a6;
  --accent-text:  #0b1014;

  /* Status (muted, not neon) */
  --red:     #f87171;
  --red-soft:   rgba(248, 113, 113, 0.12);
  --amber:   #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --green:   #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --blue:    #60a5fa;
  --blue-soft:  rgba(96, 165, 250, 0.12);

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius:    10px;
  --radius-sm: 6px;

  /* Type */
  --font-sans: "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv01";
  min-width: 320px;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
input, textarea, select { font: inherit; color: inherit; }

code, .mono {
  font-family: var(--font-mono);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--text-soft);
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  max-width: 100%;
}
.page-content > .container { max-width: 1200px; margin: 0 auto; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar-brand { padding: 20px 16px 4px; position: relative; }
.brand-switcher-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, background .15s ease;
}
.brand-switcher-btn:hover { border-color: var(--border-2); background: var(--surface-3); }
.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(45,212,191,0.18);
}
.brand-name { letter-spacing: -0.01em; }
.chevron { margin-left: auto; color: var(--muted); }

.sidebar-nav { padding: 14px 10px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: color .15s ease, background .15s ease;
}
.nav-item svg { color: var(--muted-2); transition: color .15s ease; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover svg { color: var(--muted); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.nav-label { flex: 1; letter-spacing: -0.005em; }

.sidebar-collapse-btn { display: none; }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
  flex-shrink: 0;
}
.topbar-left { flex: 1; display: flex; align-items: center; gap: 18px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.search-form { flex-shrink: 0; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; color: var(--muted-2); pointer-events: none; }
.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px 8px 34px;
  font-size: 13px;
  width: 320px;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.search-input::placeholder { color: var(--muted-2); }
.search-input:focus { border-color: var(--accent-line); background: var(--surface-3); }

/* Bank-page tab strip */
.bank-tabs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.bank-tab {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.bank-tab:hover { color: var(--text); background: var(--surface-2); }
.bank-tab.active {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-2);
}
.bank-tab .bank-dot {
  width: 6px; height: 6px; border-radius: 50%;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
}

.user-btn {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none;
  color: var(--text); cursor: pointer;
  font-size: 13px; padding: 6px 8px; border-radius: var(--radius-sm);
  transition: background .15s ease;
}
.user-btn:hover { background: var(--surface-2); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-menu-wrap { position: relative; }
.user-dropdown {
  position: absolute; right: 0; top: 42px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 160px; z-index: 100;
  padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.45);
}
.dropdown-item {
  display: block; width: 100%;
  background: none; border: none;
  color: var(--text); cursor: pointer;
  font-size: 13px; padding: 9px 12px;
  text-align: left; border-radius: var(--radius-sm);
}
.dropdown-item:hover { background: var(--surface-3); }
.dropdown-item.danger:hover { color: var(--red); }

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 28px;
}
.page-title {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.02em;
}
.page-subtitle {
  color: var(--muted);
  font-size: 13.5px;
}
.page-header-meta { display: flex; gap: 8px; margin-left: auto; }

.count-pill {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}
.count-pill.open    { background: var(--blue-soft);  color: var(--blue);  border-color: rgba(96,165,250,0.22); }
.count-pill.pending { background: var(--amber-soft); color: var(--amber); border-color: rgba(251,191,36,0.22); }
.count-pill.resolved{ background: var(--green-soft); color: var(--green); border-color: rgba(74,222,128,0.22); }

/* ─── Filters ────────────────────────────────────────────────────────────── */
.filter-bar { margin-bottom: 18px; }
.filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s ease;
}
.filter-select:focus { border-color: var(--accent-line); }

/* ─── Ticket list ────────────────────────────────────────────────────────── */
.ticket-list { display: flex; flex-direction: column; gap: 4px; }
.ticket-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.ticket-row:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}
.ticket-row.urgent {
  border-left: 3px solid var(--red);
  padding-left: 17px;
}
.ticket-row.unread { background: var(--surface-2); }

.ticket-row-urgency { flex-shrink: 0; }
.urgency-dot { width: 8px; height: 8px; border-radius: 50%; display: block; }
.urgency-dot.high, .urgency-dot.urgent { background: var(--red); }
.urgency-dot.normal { background: var(--muted-2); }
.urgency-dot.low    { background: var(--border-2); }

.ticket-row-main { flex: 1; min-width: 0; }
.ticket-row-subject {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.ticket-row-subject.bold { font-weight: 600; }
.ticket-row-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; font-size: 12.5px;
  color: var(--muted);
}
.meta-sep { color: var(--border-2); }
.ticket-row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ticket-time { font-size: 12px; color: var(--muted); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.badge-open       { background: var(--blue-soft);   color: var(--blue);    border-color: rgba(96,165,250,0.22); }
.badge-pending    { background: var(--amber-soft);  color: var(--amber);   border-color: rgba(251,191,36,0.22); }
.badge-resolved   { background: var(--green-soft);  color: var(--green);   border-color: rgba(74,222,128,0.22); }
.badge-urgent,
.badge-high       { background: var(--red-soft);    color: var(--red);     border-color: rgba(248,113,113,0.25); }
.badge-normal     { background: var(--surface-3);   color: var(--muted);   border-color: var(--border-2); }
.badge-low        { background: var(--surface-2);   color: var(--muted-2); }
.badge-cat        { background: var(--surface-3);   color: var(--text-soft); border-color: var(--border-2); }
.badge-shipped    { background: var(--blue-soft);   color: var(--blue); }
.badge-delivered  { background: var(--green-soft);  color: var(--green); }
.badge-processing { background: var(--amber-soft);  color: var(--amber); }
.badge-cancelled  { background: var(--red-soft);    color: var(--red); }
.badge-xs { font-size: 10px; padding: 2px 7px; }

/* ─── Ticket detail ──────────────────────────────────────────────────────── */
.ticket-page { padding-top: 4px; }
.ticket-back { margin-bottom: 18px; }
.back-link { color: var(--muted); font-size: 13px; }
.back-link:hover { color: var(--text); }
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 320px;
  gap: 32px;
  align-items: start;
}
.ticket-header { margin-bottom: 24px; }
.ticket-subject-row {
  display: flex; align-items: flex-start; gap: 12px;
  flex-wrap: wrap;
}
.ticket-subject {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  flex: 1;
  line-height: 1.3;
}
.ticket-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ticket-id-line { font-size: 12.5px; margin-top: 8px; color: var(--muted); }

/* ─── Thread ─────────────────────────────────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: 18px; margin-bottom: 28px; }
.thread-message { display: flex; gap: 12px; }
.msg-agent { flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.avatar-agent    { background: var(--accent); color: var(--accent-text); }
.avatar-customer { background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text-soft); }
.msg-body-wrap {
  flex: 0 1 auto;
  max-width: 75%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.msg-customer .msg-body-wrap { align-items: flex-start; }
.msg-agent    .msg-body-wrap { align-items: flex-end; }
.msg-meta {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 6px; font-size: 12px;
}
.msg-agent .msg-meta { flex-direction: row-reverse; }
.msg-from { font-weight: 500; color: var(--text-soft); }
.msg-time { color: var(--muted); }
.msg-body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-agent .msg-body {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

/* ─── Reply box ──────────────────────────────────────────────────────────── */
.reply-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.reply-tabs {
  display: flex; gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.reply-tab {
  background: none; border: none;
  color: var(--muted); font-size: 13px;
  cursor: pointer; padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.reply-tab:hover { color: var(--text); }
.reply-tab.active { color: var(--text); background: var(--surface-2); }
.template-picker { margin-bottom: 12px; }
.reply-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .15s ease;
}
.reply-textarea:focus { border-color: var(--accent-line); }
.reply-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.reply-hint { font-size: 11.5px; color: var(--muted); }

/* ─── Ticket sidebar panels ──────────────────────────────────────────────── */
.ticket-sidebar-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  /* Note: border-radius clip handled per-child */
}
.panel-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.panel-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cust-name { font-weight: 600; color: var(--text); }
.cust-email, .cust-phone { font-size: 12.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: break-all; }
.cust-email { word-break: break-all; white-space: normal; }

/* Order detail grid — stack on narrow viewports */
@media (max-width: 1100px) {
  .order-detail-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
.cust-stats { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.order-id { font-weight: 700; font-size: 14px; color: var(--text); font-family: var(--font-mono); }
.order-product { font-size: 13px; color: var(--text-soft); }
.order-status { display: flex; align-items: center; gap: 8px; }
.order-tracking { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.other-ticket-link {
  display: block; font-size: 12.5px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  color: var(--text-soft);
}
.other-ticket-link:last-child { border-bottom: none; }
.other-ticket-link:hover { color: var(--text); }
.other-ticket-link .muted { margin-right: 6px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost {
  background: var(--surface-2);
  color: var(--text-soft);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-3); }
.btn-sm  { padding: 6px 12px; font-size: 12.5px; }
.btn-full { width: 100%; }
.mt8 { margin-top: 8px; }

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-body {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(45,212,191,0.06), transparent 60%),
    var(--bg);
}
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  margin-bottom: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; }
.login-sub { margin-bottom: 24px; color: var(--muted); }
.login-hint { font-size: 12px; text-align: center; color: var(--muted); }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; color: var(--text-soft); }
.form-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease;
}
.form-input:focus { border-color: var(--accent-line); }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
}
.alert-error {
  background: var(--red-soft);
  border: 1px solid rgba(248,113,113,0.25);
  color: var(--red);
}

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.bold  { font-weight: 600; }
.empty-state {
  padding: 72px 32px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty-state h3 { color: var(--text-soft); font-weight: 600; margin-bottom: 6px; }
.coming-soon { padding: 64px 32px; text-align: center; color: var(--muted); }

/* ─── Hamburger / sidebar overlay ───────────────────────────────────────── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  transition: background .15s, border-color .15s;
}
.hamburger-btn:hover { background: var(--surface-2); border-color: var(--border-2); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 199;
  backdrop-filter: blur(1px);
}
.sidebar-backdrop.open { display: block; }

/* Compact mailbox select (shown on narrow when pills hidden) */
.mailbox-select {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  max-width: 160px;
  transition: border-color .15s;
}
.mailbox-select:focus { border-color: var(--accent-line); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .search-input { width: 220px; }
}
@media (max-width: 980px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-sidebar-col { position: static; }
  .page-content { padding: 24px; }
  .topbar { padding: 0 18px; gap: 14px; }
}
@media (max-width: 820px) {
  /* mailbox-seg hidden via its own rule; show compact select */
  .mailbox-select { display: block; }
}
@media (max-width: 680px) {
  .search-input { width: 160px; }
  .bank-tabs { display: none; }
}

/* ─── Tablet (640–1024px) ────────────────────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 641px) {
  .page-content { padding: 24px; }
}

/* ─── Mobile (<640px) ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Show hamburger */
  .hamburger-btn { display: inline-flex; }

  /* Sidebar: slide-in overlay */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    will-change: transform;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.6);
  }

  /* App shell: block so sidebar doesn't take layout space */
  .app-shell { display: block; position: relative; }
  .main-area { width: 100%; }

  /* Page padding */
  .page-content { padding: 16px; }

  /* Topbar */
  .topbar { padding: 0 12px; gap: 10px; height: var(--topbar-h); }
  .topbar-left { gap: 10px; }
  .search-input { width: 130px; }
  /* Hide brand pill in topbar-right on mobile */
  .topbar-right .brand-pill { display: none; }
  /* Hide user name, keep avatar */
  .topbar-right .user-name { display: none; }

  /* Mailbox selector: hide pills, show select */
  .mailbox-seg { display: none !important; }
  .mailbox-select { display: block; max-width: 140px; }

  /* Ticket rows */
  .ticket-row { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .ticket-row-right { width: 100%; justify-content: flex-start; padding-left: 22px; margin-top: 2px; }
  .ticket-row-meta { flex-wrap: wrap; }

  /* Thread messages */
  .msg-body-wrap { max-width: calc(100% - 40px); }
  .thread-message { gap: 8px; }
  .msg-body { padding: 10px 12px; font-size: 13px; }

  /* Reply box */
  .reply-box { padding: 12px; }
  .reply-actions { flex-wrap: wrap; gap: 8px; }

  /* Page header stack on mobile */
  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-header-meta { margin-left: 0; }

  /* Ticket subject */
  .ticket-subject { font-size: 17px; }

  /* Filter bar */
  .filter-form { flex-wrap: wrap; }
  .filter-select { flex: 1; min-width: 120px; }

  /* Toast */
  #toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { font-size: 12.5px; }

  /* Flow chip wraps */
  .ticket-flow { flex-wrap: wrap; gap: 6px; }
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 28px; right: 28px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  animation: fadeIn .22s ease;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.toast-error {
  background: var(--red-soft);
  border-color: rgba(248,113,113,0.3);
  color: var(--red);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Scrollbar polish (webkit) ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ─── Theme toggle button ──────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-3); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ─── Stronger bold for the right things ──────────────────────────────── */
.ticket-row.unread .ticket-row-subject,
.ticket-row .ticket-row-subject.bold { font-weight: 650; color: var(--text); }
.cust-name      { font-weight: 650; letter-spacing: -0.01em; }
.order-id       { font-weight: 700; letter-spacing: -0.005em; }
.ticket-subject { font-weight: 700; }
.page-title     { font-weight: 700; }
.msg-from       { font-weight: 600; }
.brand-name     { font-weight: 650; }

/* ─── LIGHT THEME — Reamaze style ─────────────────────────────────────── */
[data-theme="light"] {
  --bg:         #f0f2f5;
  --surface:    #ffffff;
  --surface-2:  #f7f8fa;
  --surface-3:  #eef0f3;
  --border:     #e1e4e8;
  --border-2:   #c8cdd5;

  --text:       #1a202c;
  --text-soft:  #2d3748;
  --muted:      #718096;
  --muted-2:    #a0aec0;

  --accent:       #00b8c8;
  --accent-soft:  rgba(0, 184, 200, 0.10);
  --accent-line:  rgba(0, 184, 200, 0.35);
  --accent-dark:  #0099a8;
  --accent-text:  #ffffff;

  --red:        #c53030;
  --red-soft:   rgba(197, 48, 48, 0.10);
  --amber:      #c05621;
  --amber-soft: rgba(192, 86, 33, 0.10);
  --green:      #276749;
  --green-soft: rgba(39, 103, 73, 0.10);
  --blue:       #2b6cb0;
  --blue-soft:  rgba(43, 108, 176, 0.10);
}

/* Base */
[data-theme="light"] body { background: var(--bg); color: var(--text); }
[data-theme="light"] a { color: inherit; }
[data-theme="light"] code, [data-theme="light"] .mono { background: var(--surface-3); color: var(--text-soft); }

/* Sidebar — dark slate (readable) */
[data-theme="light"] .sidebar { background: #ffffff; border-right-color: #e1e4e8; }
[data-theme="light"] .sidebar-brand { border-bottom: 1px solid #e1e4e8; }
[data-theme="light"] .brand-switcher-btn { background: rgba(255,255,255,0.06); border-color: #2d3748; color: #e2e8f0; }
[data-theme="light"] .brand-switcher-btn:hover { background: rgba(255,255,255,0.1); }
[data-theme="light"] .brand-switcher-btn .brand-name { color: #e2e8f0; }
[data-theme="light"] .brand-switcher-btn .chevron { color: #718096; }
[data-theme="light"] .brand-dot { box-shadow: 0 0 0 2px rgba(0,184,200,0.35); }
[data-theme="light"] .nav-item { color: #2d3748; }
[data-theme="light"] .nav-item svg { color: #718096; }
[data-theme="light"] .nav-item:hover { background: #f7f8fa; color: #1a202c; }
[data-theme="light"] .nav-item:hover svg { color: #4a5568; }
[data-theme="light"] .nav-item.active { background: rgba(0,153,168,0.10); color: #0099a8; font-weight: 600; }
[data-theme="light"] .nav-item.active svg { color: #0099a8; }
[data-theme="light"] .sidebar-section-label { color: #4a5568; font-weight: 700; letter-spacing: 0.07em; }
[data-theme="light"] .mailbox-item { color: #a0aec0; }
[data-theme="light"] .mailbox-item svg { color: #718096; }
[data-theme="light"] .mailbox-item:hover { background: #f7f8fa; color: #1a202c; }
[data-theme="light"] .mailbox-item.active { background: rgba(0,184,200,0.18); color: #00d4e6; }
[data-theme="light"] .mailbox-item.active svg { color: #00d4e6; }
[data-theme="light"] .sidebar-footer { border-top-color: #2d3748; }
[data-theme="light"] .sidebar-footer-link { color: #4a5568; }
[data-theme="light"] .sidebar-footer-link:hover { color: #e2e8f0; }

/* Topbar */
[data-theme="light"] .topbar { background: #fff; border-bottom-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
[data-theme="light"] .mailbox-bar { background: #fff; border-bottom-color: var(--border); }
[data-theme="light"] .search-input { background: var(--surface-2); border-color: var(--border); color: var(--text); }
[data-theme="light"] .search-input::placeholder { color: var(--muted); }
[data-theme="light"] .search-input:focus { border-color: var(--accent-line); background: #fff; }
[data-theme="light"] .theme-toggle { background: var(--surface-2); border-color: var(--border); color: var(--muted); }
[data-theme="light"] .theme-toggle:hover { color: var(--text); border-color: var(--border-2); }
[data-theme="light"] .user-btn { color: var(--text); }
[data-theme="light"] .user-btn:hover { background: var(--surface-2); }
[data-theme="light"] .user-avatar { background: #00b8c8; color: #fff; }
[data-theme="light"] .user-dropdown { background: #fff; border-color: var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
[data-theme="light"] .dropdown-item { color: var(--text); }
[data-theme="light"] .dropdown-item:hover { background: var(--surface-2); }
[data-theme="light"] .brand-pill { background: rgba(0,184,200,0.1); color: #007a87; border-color: rgba(0,184,200,0.25); }

/* Page content */
[data-theme="light"] .page-content { background: var(--bg); }
[data-theme="light"] .page-title { color: var(--text); }
[data-theme="light"] .page-subtitle { color: var(--muted); }
[data-theme="light"] .muted { color: var(--muted); }

/* Count pills */
[data-theme="light"] .count-pill.open    { background: rgba(43,108,176,0.10); color: #2b6cb0; border-color: rgba(43,108,176,0.2); }
[data-theme="light"] .count-pill.pending { background: rgba(192,86,33,0.10);  color: #c05621; border-color: rgba(192,86,33,0.2); }
[data-theme="light"] .count-pill.resolved{ background: rgba(39,103,73,0.10);  color: #276749; border-color: rgba(39,103,73,0.2); }

/* Filters */
[data-theme="light"] .filter-select { background: #fff; border-color: var(--border-2); color: var(--text); font-weight: 500; }
[data-theme="light"] .filter-select:focus { border-color: var(--accent-line); }

/* Ticket rows */
[data-theme="light"] .ticket-row { background: #fff; border-color: var(--border); }
[data-theme="light"] .ticket-row:hover { background: #f5fdfe; border-color: rgba(0,184,200,0.5); }
[data-theme="light"] .ticket-row.unread { background: #f0fafc; }
[data-theme="light"] .ticket-row.urgent { border-left-color: var(--red); }
[data-theme="light"] .ticket-row-subject { color: var(--text); }
[data-theme="light"] .ticket-row-meta { color: #4a5568; }
[data-theme="light"] .ticket-time { color: #4a5568; }

/* Badges */
[data-theme="light"] .badge-open     { background: rgba(43,108,176,0.10); color: #2b6cb0; border-color: rgba(43,108,176,0.2); }
[data-theme="light"] .badge-pending  { background: rgba(192,86,33,0.10);  color: #c05621; border-color: rgba(192,86,33,0.2); }
[data-theme="light"] .badge-resolved { background: rgba(39,103,73,0.10);  color: #276749; border-color: rgba(39,103,73,0.2); }
[data-theme="light"] .badge-urgent,
[data-theme="light"] .badge-high     { background: rgba(197,48,48,0.10);  color: #c53030; border-color: rgba(197,48,48,0.2); }
[data-theme="light"] .badge-normal   { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
[data-theme="light"] .badge-cat      { background: var(--surface-2); color: var(--text-soft); border-color: var(--border); }
[data-theme="light"] .badge-shipped  { background: rgba(43,108,176,0.10);  color: #2b6cb0; }
[data-theme="light"] .badge-delivered{ background: rgba(39,103,73,0.10);   color: #276749; }
[data-theme="light"] .badge-processing{ background: rgba(192,86,33,0.10);  color: #c05621; }

/* Ticket detail */
[data-theme="light"] .back-link { color: var(--muted); }
[data-theme="light"] .back-link:hover { color: var(--text); }
[data-theme="light"] .ticket-subject { color: var(--text); }
[data-theme="light"] .ticket-id-line { color: var(--muted); }
[data-theme="light"] .ticket-flow { background: var(--surface-2); border-color: var(--border); }
[data-theme="light"] .flow-chip { background: #fff; border-color: var(--border); color: var(--text-soft); }
[data-theme="light"] .flow-chip.flow-inbox { color: #007a87; }
[data-theme="light"] .flow-chip.flow-inbox svg { color: #007a87; }
[data-theme="light"] .flow-arrow { color: var(--muted-2); }

/* Thread */
[data-theme="light"] .msg-body { background: var(--surface-2); border-color: var(--border); color: var(--text); }
[data-theme="light"] .msg-agent .msg-body { background: rgba(0,184,200,0.08); border-color: rgba(0,184,200,0.25); color: var(--text); }
[data-theme="light"] .avatar-customer { background: var(--surface-3); border-color: var(--border-2); color: var(--muted); }
[data-theme="light"] .msg-from { color: var(--text-soft); }
[data-theme="light"] .msg-time { color: var(--muted); }

/* Reply box */
[data-theme="light"] .reply-box { background: #fff; border-color: var(--border); }
[data-theme="light"] .reply-tabs { border-bottom-color: var(--border); }
[data-theme="light"] .reply-tab { color: var(--muted); }
[data-theme="light"] .reply-tab:hover { color: var(--text); }
[data-theme="light"] .reply-tab.active { background: var(--surface-2); color: var(--text); }
[data-theme="light"] .reply-textarea { background: var(--surface-2); border-color: var(--border); color: var(--text); }
[data-theme="light"] .reply-textarea:focus { border-color: var(--accent-line); background: #fff; }
[data-theme="light"] .reply-hint { color: var(--muted); }

/* Panels (ticket sidebar) */
[data-theme="light"] .panel { background: #fff; border-color: var(--border); }
[data-theme="light"] .panel-title { background: var(--surface-2); color: #4a5568; border-bottom-color: var(--border); font-weight: 700; }
[data-theme="light"] .panel-body { color: var(--text); }
[data-theme="light"] .cust-name { color: var(--text); }
[data-theme="light"] .cust-email, [data-theme="light"] .cust-phone { color: var(--text-soft); }
[data-theme="light"] .cust-stats { color: var(--muted); }
[data-theme="light"] .order-id { color: var(--text); }
[data-theme="light"] .order-product { color: var(--text-soft); }
[data-theme="light"] .order-tracking { color: var(--muted); }
[data-theme="light"] .other-ticket-link { color: var(--text-soft); border-bottom-color: var(--border); }
[data-theme="light"] .other-ticket-link:hover { color: var(--text); }

/* Buttons */
[data-theme="light"] .btn-ghost { background: var(--surface-2); color: var(--text-soft); border-color: var(--border); }
[data-theme="light"] .btn-ghost:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-3); }

/* Forms */
[data-theme="light"] .form-input { background: #fff; border-color: var(--border); color: var(--text); }
[data-theme="light"] .form-input:focus { border-color: var(--accent-line); }
[data-theme="light"] .form-label { color: var(--text-soft); }

/* Login */
[data-theme="light"] .login-body { background: linear-gradient(135deg, #00b8c8 0%, #0099a8 100%); }
[data-theme="light"] .login-card { background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
[data-theme="light"] .login-title { color: var(--text); }
[data-theme="light"] .login-sub { color: var(--muted); }

/* Empty state */
[data-theme="light"] .empty-state { background: #fff; border-color: var(--border); color: var(--muted); }
[data-theme="light"] .empty-state h3 { color: var(--text-soft); }

/* Toast */
[data-theme="light"] .toast { background: #fff; border-color: var(--border); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border-2); border-color: var(--bg); }

/* ─── Mailbox segmented selector (replaces bank-tabs) ─────────────────── */
.mailbox-seg {
  display: inline-flex;
  align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
  min-width: 0;
}
.mailbox-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.mailbox-seg-btn:hover { color: var(--text); background: var(--surface-3); }
.mailbox-seg-btn.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-2);
  box-shadow: 0 1px 0 rgba(255,255,255,0.02), 0 1px 6px rgba(0,0,0,0.18);
  font-weight: 600;
}
.mailbox-seg-btn svg { color: var(--muted-2); }
.mailbox-seg-btn.active svg { color: var(--accent); }
.mailbox-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.mailbox-email {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: -0.005em;
}

[data-theme="light"] .mailbox-seg-btn.active {
  box-shadow: 0 1px 2px rgba(15,23,42,0.06), 0 1px 0 rgba(255,255,255,0.6) inset;
}

@media (max-width: 1100px) {
  .mailbox-email { font-size: 12px; }
}
@media (max-width: 820px) {
  .mailbox-seg { display: none; }
}

/* ─── Ticket flow strip (inbox ↔ customer) ────────────────────────────── */
.ticket-flow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 6px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
}
.flow-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.flow-chip svg { color: var(--muted); }
.flow-chip.flow-inbox { color: var(--accent); }
.flow-chip.flow-inbox svg { color: var(--accent); }
.flow-chip .mono { background: transparent; padding: 0; font-size: 12.5px; color: inherit; }
.flow-arrow {
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1;
}

/* ─── Mailbox sub-bar (below topbar) ─────────────────────────────────── */
.mailbox-bar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 28px;
  display: flex;
  align-items: center;
  height: 46px;
  flex-shrink: 0;
}
.mailbox-bar .mailbox-seg {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  gap: 2px;
}
.mailbox-bar .mailbox-seg-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
}
.mailbox-bar .mailbox-seg-btn.active {
  background: var(--surface-2);
  border-color: var(--border-2);
  box-shadow: none;
}

/* ─── Page header count pills — properly aligned ─────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}
.count-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  line-height: 1;
}

/* ─── Main area — flex accounts for sub-bar ──────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Sidebar sections (inboxes) ─────────────────────────────────────── */
.sidebar-section { padding: 8px 10px 4px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  padding: 4px 12px 6px;
  margin-bottom: 2px;
}
.mailbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
  text-decoration: none;
  transition: color .15s, background .15s;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.mailbox-item svg { color: var(--muted-2); flex-shrink: 0; width: 13px; height: 13px; }
.mailbox-item:hover { background: var(--surface-2); color: var(--text); }
.mailbox-item:hover svg { color: var(--muted); }
.mailbox-item.active { color: var(--accent); font-weight: 600; }
.mailbox-item.active svg { color: var(--accent); }
.mailbox-item .mailbox-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.mailbox-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-footer-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.sidebar-footer-link:hover { color: var(--text); }

/* Light theme sidebar section */
[data-theme="light"] .sidebar-section-label { color: #4a5568; font-weight: 700; letter-spacing: 0.07em; }
[data-theme="light"] .mailbox-item { color: rgba(255,255,255,0.92); }
[data-theme="light"] .mailbox-item svg { color: rgba(255,255,255,0.85); }
[data-theme="light"] .mailbox-item:hover { background: #f7f8fa; color: #1a202c; }
[data-theme="light"] .mailbox-item.active { background: rgba(0,184,200,0.18); color: #00d4e6; }
[data-theme="light"] .mailbox-item.active svg { color: #00d4e6; }
[data-theme="light"] .sidebar-footer { border-top-color: #2d3748; }
[data-theme="light"] .sidebar-footer-link { color: #4a5568; }
[data-theme="light"] .sidebar-footer-link:hover { color: #e2e8f0; }

/* ═══════════════════════════════════════════════════════════════════════════
   INBOX UPGRADE — New ticket row (Reamaze style), Tags, Sidebar filters
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Sidebar divider ──────────────────────────────────────────────────── */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 10px;
}

/* ─── Sidebar filter items (FILTERS + TAGS sections) ─────────────────── */
.sidebar-filter-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition: color .15s, background .15s;
  cursor: pointer;
}
.sidebar-filter-item svg { color: var(--muted-2); flex-shrink: 0; width: 13px; height: 13px; }
.sidebar-filter-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar-filter-item:hover svg { color: var(--muted); }
.sidebar-filter-item.active { color: var(--text); font-weight: 600; }
.sidebar-filter-item.active svg { color: var(--accent); }
.sidebar-filter-item.active .count-badge { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.filter-label { flex: 1; }

/* ─── Count badge (sidebar right side) ────────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.count-badge-amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(251,191,36,0.3); }
.count-badge-blue  { background: var(--blue-soft);  color: var(--blue);  border-color: rgba(96,165,250,0.3); }
.count-badge-green { background: var(--green-soft); color: var(--green); border-color: rgba(74,222,128,0.3); }

/* ─── Tag swatch (small colored dot in sidebar) ───────────────────────── */
.tag-swatch {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ─── New ticket row v2 (Reamaze style) ───────────────────────────────── */
.ticket-row-v2 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.ticket-row-v2:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}
.ticket-row-v2.urgent {
  border-left: 3px solid var(--red);
  padding-left: 15px;
}
/* Status-based row differentiation — VA should know state in 2 seconds */

/* Unread (customer replied — needs VA attention) — most prominent */
.ticket-row-v2.unread {
  background: rgba(45, 212, 191, 0.05);
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}
.ticket-row-v2.unread .ticket-v2-name { color: var(--text); font-weight: 700; }
.ticket-row-v2.unread .ticket-preview { color: var(--text-soft); }

/* Pending (VA replied — waiting on customer) — dimmed */
.ticket-row-v2.ts-pending {
  opacity: 0.7;
}
.ticket-row-v2.ts-pending:hover { opacity: 1; }

/* On Hold — parked, amber tint */
.ticket-row-v2.ts-onhold {
  border-left: 3px solid #f59e0b;
  padding-left: 11px;
  background: rgba(245, 158, 11, 0.04);
}

/* Muted — very dimmed */
.ticket-row-v2.ts-muted {
  opacity: 0.45;
  filter: saturate(0.4);
}
.ticket-row-v2.ts-muted:hover { opacity: 0.8; filter: saturate(1); }

/* Resolved — almost invisible, for archive view */
.ticket-row-v2.ts-resolved {
  opacity: 0.5;
}

/* Unread dot */
.inbox-unread-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-right: 4px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Inline status pill next to name (for non-open states) */
.inbox-status-inline {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.inbox-status-inline.pending  { background: rgba(251,191,36,0.15); color: #f59e0b; }
.inbox-status-inline.onhold   { background: rgba(245,158,11,0.15); color: #f59e0b; }
.inbox-status-inline.muted    { background: rgba(148,163,184,0.15); color: var(--muted); }

/* Override: urgent + unread together — urgent border wins */
.ticket-row-v2.urgent.unread { border-left-color: var(--red); }
.ticket-row-v2.urgent.ts-onhold { border-left-color: var(--red); }

/* Checkbox */
.ticket-v2-check {
  padding-top: 2px;
  flex-shrink: 0;
}
.v2-checkbox {
  display: block;
  width: 15px; height: 15px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  background: transparent;
  transition: background .12s, border-color .12s;
  cursor: pointer;
}
.ticket-v2-check.checked .v2-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

/* Avatar */
.ticket-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

/* Main content column */
.ticket-v2-main {
  flex: 1;
  min-width: 0;
}
.ticket-v2-topline {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
  min-width: 0;
}
.ticket-v2-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.ticket-v2-name.bold { font-weight: 700; }
.ticket-v2-subject {
  font-size: 13.5px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Preview — expands to fill row width with ellipsis */
.ticket-preview {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  line-height: 1.45;
  max-width: 100%;
}

/* Source row */
.ticket-source-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.ticket-source-chip {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.ticket-source-chip.inbox-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* Reply state pills — tells VA at a glance what needs doing */
.reply-state-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.reply-state-pill.no-reply       { background: rgba(239,68,68,0.12);  color: #f87171; }
.reply-state-pill.customer-replied{ background: rgba(45,212,191,0.12); color: var(--accent); }
.reply-state-pill.replied         { background: rgba(74,222,128,0.10); color: #4ade80; }
.src-sep { color: var(--border-2); font-size: 11px; }

/* Right side */
.ticket-v2-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 2px;
}
.ticket-reply-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

/* ─── Tag pills ────────────────────────────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.tag-pill-removable { padding-right: 4px; }
.tag-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  color: inherit;
  opacity: 0.7;
  transition: opacity .12s;
}
.tag-remove-btn:hover { opacity: 1; }

/* ─── Tag dropdown ─────────────────────────────────────────────────────── */
.tag-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9000;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.tag-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.tag-dropdown-item:hover { background: var(--surface-3); }

/* ─── Ticket tags list (in ticket detail panel) ───────────────────────── */
.ticket-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ─── count-pill onhold ─────────────────────────────────────────────────── */
.count-pill.onhold { background: var(--blue-soft); color: var(--blue); border-color: rgba(96,165,250,0.22); }

/* ─── badge-onhold ──────────────────────────────────────────────────────── */
.badge-onhold { background: var(--blue-soft); color: var(--blue); border-color: rgba(96,165,250,0.25); }

/* ─── Settings page ─────────────────────────────────────────────────────── */
.settings-section { max-width: 640px; margin-bottom: 40px; }
.settings-section-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.01em; }
.settings-section-desc { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.tags-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.tag-settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tag-color-swatch {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.tag-settings-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.btn-danger-ghost { color: var(--red) !important; }
.btn-danger-ghost:hover { border-color: var(--red) !important; background: var(--red-soft) !important; }

/* ─── Color swatch picker (settings) ─────────────────────────────────── */
.color-swatches { display: flex; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.color-swatch-label { cursor: pointer; }
.color-swatch-pick {
  display: block;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s, border-color .1s;
}
.color-swatch-pick.selected {
  border-color: var(--text);
  transform: scale(1.2);
}

/* ─── Light theme overrides for new elements ──────────────────────────── */
[data-theme="light"] .sidebar-divider { background: #2d3748; }
[data-theme="light"] .sidebar-filter-item { color: #a0aec0; }
[data-theme="light"] .sidebar-filter-item svg { color: #718096; }
[data-theme="light"] .sidebar-filter-item:hover { background: #f7f8fa; color: #1a202c; }
[data-theme="light"] .sidebar-filter-item.active { background: rgba(0,184,200,0.18); color: #00d4e6; }
[data-theme="light"] .sidebar-filter-item.active svg { color: #00d4e6; }

[data-theme="light"] .ticket-row-v2 { background: #fff; border-color: var(--border); }
[data-theme="light"] .ticket-row-v2:hover { background: #f5fdfe; border-color: rgba(0,184,200,0.5); }
[data-theme="light"] .ticket-row-v2.unread { background: #f0fafc; }
[data-theme="light"] .ticket-v2-name { color: var(--text); }
[data-theme="light"] .ticket-v2-subject { color: var(--text-soft); }
[data-theme="light"] .ticket-preview { color: #4a5568; }
[data-theme="light"] .ticket-source-chip { color: var(--muted); }
[data-theme="light"] .ticket-reply-count { background: var(--surface-3); border-color: var(--border); color: var(--muted); }
[data-theme="light"] .v2-checkbox { border-color: var(--border-2); }

[data-theme="light"] .tag-dropdown { background: #fff; border-color: var(--border-2); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
[data-theme="light"] .tag-dropdown-item { color: var(--text); }
[data-theme="light"] .tag-dropdown-item:hover { background: var(--surface-2); }

[data-theme="light"] .count-badge { background: var(--surface-3); color: var(--muted); border-color: var(--border-2); }
[data-theme="light"] .tag-settings-row { background: #fff; border-color: var(--border); }
[data-theme="light"] .settings-section-title { color: var(--text); }
[data-theme="light"] .color-swatch-pick.selected { border-color: var(--text); }

[data-theme="light"] .badge-onhold { background: rgba(43,108,176,0.10); color: #2b6cb0; border-color: rgba(43,108,176,0.2); }
[data-theme="light"] .count-pill.onhold { background: rgba(43,108,176,0.10); color: #2b6cb0; border-color: rgba(43,108,176,0.2); }

/* ─── Panel title corner fix (overflow:visible on panel) ─────────────── */
.panel-title:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel-body:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── Light mode sidebar item fixes ──────────────────────────────────── */
[data-theme="light"] .mailbox-item { color: #1a202c; }
[data-theme="light"] .mailbox-item:hover { background: #f7f8fa; color: #1a202c; }
[data-theme="light"] .mailbox-item.active { color: #0099a8; font-weight: 600; }
[data-theme="light"] .sidebar-filter-item { color: #1a202c; }
[data-theme="light"] .sidebar-filter-item:hover { background: #f7f8fa; color: #1a202c; }
[data-theme="light"] .sidebar-filter-item.active { color: #0099a8; font-weight: 600; }
[data-theme="light"] .sidebar-filter-item.active svg { color: #0099a8; }
[data-theme="light"] .count-badge { background: #eef0f3; color: #2d3748; border-color: #c8cdd5; font-weight: 700; }
[data-theme="light"] .sidebar-filter-item.active .count-badge { background: rgba(0,153,168,0.10); color: #0099a8; border-color: rgba(0,153,168,0.25); }
[data-theme="light"] .sidebar-section-label { color: #718096; }

/* ═══════════════════════════════════════════════════════════════════════════
   ANALYTICS PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.analytics-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 32px;
}

.page-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.page-subtitle-badge {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-weight: 500;
}

/* ── Summary cards grid ─────────────────────────────────────────────────── */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

@media (max-width: 1100px) {
  .analytics-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--accent); }

.stat-card-danger { border-left: 3px solid #ef4444; }

.stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.stat-trend-up   { color: #10b981; }
.stat-trend-down { color: #ef4444; }

/* ── Chart cards ────────────────────────────────────────────────────────── */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.va-card { grid-column: 1 / -1; }

.chart-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.chart-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.chart-card-sub {
  font-size: 11px;
  color: var(--muted);
}

.chart-wrap { position: relative; }
.chart-wrap-lg     { height: 200px; }
.chart-wrap-md     { height: 180px; }
.chart-wrap-donut  { height: 200px; }

/* ── VA Leaderboard ─────────────────────────────────────────────────────── */
.va-table-wrap {
  overflow-x: auto;
}

.va-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.va-table thead th {
  text-align: left;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.va-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.va-table tbody tr:last-child { border-bottom: none; }
.va-table tbody tr:nth-child(even) { background: var(--surface-2); }
.va-table tbody tr:hover { background: rgba(45,212,191,0.05); }

.va-table tbody td {
  padding: 11px 14px;
  color: var(--text);
}

.va-name     { font-weight: 600; }
.va-resolved { font-weight: 500; color: var(--text); }
.va-response { color: var(--muted); }

.csat-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.csat-green { background: rgba(16,185,129,0.12); color: #10b981; border-color: rgba(16,185,129,0.25); }
.csat-amber { background: rgba(245,158,11,0.12); color: #f59e0b; border-color: rgba(245,158,11,0.25); }
.csat-red   { background: rgba(239,68,68,0.12);  color: #ef4444; border-color: rgba(239,68,68,0.25); }

.va-trend { font-size: 16px; font-weight: 700; }
.trend-up   { color: #10b981; }
.trend-down { color: #ef4444; }
.trend-flat { color: var(--muted); }

.va-csat-note {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ── Light theme overrides for analytics ────────────────────────────────── */
[data-theme="light"] .stat-card      { background: #fff; border-color: var(--border); }
[data-theme="light"] .stat-card:hover { border-color: var(--accent); }
[data-theme="light"] .stat-number    { color: #1a202c; }
[data-theme="light"] .chart-card     { background: #fff; border-color: var(--border); }
[data-theme="light"] .chart-card-title { color: #1a202c; }
[data-theme="light"] .va-table thead th { color: #718096; border-bottom-color: var(--border); }
[data-theme="light"] .va-table tbody tr { border-bottom-color: var(--border); }
[data-theme="light"] .va-table tbody tr:nth-child(even) { background: #f7f8fa; }
[data-theme="light"] .va-table tbody tr:hover { background: #f0fdfc; }
[data-theme="light"] .va-table tbody td { color: #1a202c; }
[data-theme="light"] .va-response    { color: #718096; }
[data-theme="light"] .page-subtitle-badge { background: #f0f2f5; color: #718096; border-color: #dde1e7; }

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS ADMIN PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout ────────────────────────────────────────────────────────────── */
.settings-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  max-width: 1100px;
}

/* ── Left sidenav ──────────────────────────────────────────────────────── */
.settings-sidenav {
  flex-shrink: 0;
  width: 172px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 24px;
}

.settings-sidenav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.settings-sidenav-item:hover { background: var(--surface-3); color: var(--text); }
.settings-sidenav-item.active { background: var(--accent-soft); color: var(--accent); }
.settings-sidenav-item svg { opacity: 0.7; flex-shrink: 0; }
.settings-sidenav-item.active svg { opacity: 1; }

/* ── Right body ────────────────────────────────────────────────────────── */
.settings-body { flex: 1; min-width: 0; }
.settings-section-panel { display: none; }

/* ── Section header ────────────────────────────────────────────────────── */
.settings-section-hd { margin-bottom: 20px; }
.settings-section-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 5px; }
.settings-section-desc  { font-size: 13px; color: var(--muted); }

/* ── Toast notifications ───────────────────────────────────────────────── */
.settings-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid transparent;
  max-width: 640px;
}
.settings-toast-success {
  background: var(--green-soft);
  border-color: rgba(74,222,128,0.25);
  color: var(--green);
}
.settings-toast-error {
  background: var(--red-soft);
  border-color: rgba(248,113,113,0.25);
  color: var(--red);
}

/* ── Admin table ───────────────────────────────────────────────────────── */
.sadmin-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 4px;
}
.sadmin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sadmin-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.sadmin-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.sadmin-table tbody tr:last-child { border-bottom: none; }
.sadmin-table tbody tr:hover { background: var(--surface-2); }
.sadmin-table tbody td { padding: 11px 14px; vertical-align: middle; }

/* ── Table helpers ─────────────────────────────────────────────────────── */
.sadmin-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
  flex-shrink: 0;
}
.sadmin-dot-xs {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.sadmin-fw     { font-weight: 600; }
.sadmin-mono   { font-family: var(--font-mono); font-size: 12px; }
.sadmin-mono-sm{ font-family: var(--font-mono); font-size: 12px; }
.sadmin-muted  { color: var(--muted); }
.sadmin-tagline{ font-size: 11.5px; color: var(--muted); margin-left: 8px; }
.sadmin-actions{ text-align: right; white-space: nowrap; }

.sadmin-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.sadmin-chip-muted { color: var(--muted); }

.sadmin-biz-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-soft);
}

/* ── Divider ───────────────────────────────────────────────────────────── */
.sadmin-divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* ── Form card ─────────────────────────────────────────────────────────── */
.sadmin-form-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sadmin-form-card-title {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
}
.sadmin-form { padding: 20px 18px; }
.sadmin-form .form-group:last-of-type { margin-bottom: 20px; }
.sadmin-form-actions { display: flex; gap: 10px; align-items: center; }
.sadmin-opt { font-size: 11px; color: var(--muted); font-weight: 400; }

/* ── Empty state ───────────────────────────────────────────────────────── */
.sadmin-empty {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  font-style: italic;
}

/* ── Color swatches (sadmin variant) ───────────────────────────────────── */
.sadmin-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.sadmin-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s, border-color 0.1s;
}
.sadmin-swatch:hover { transform: scale(1.15); }
.sadmin-swatch-sel {
  border-color: var(--text);
  transform: scale(1.15);
}

/* ── Tags list ─────────────────────────────────────────────────────────── */
.sadmin-tags-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
  max-width: 540px;
}
.sadmin-tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.sadmin-tag-swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sadmin-tag-name {
  font-size: 13.5px;
  font-weight: 500;
  flex: 1;
}
.sadmin-tag-del-form { margin-left: auto; }
.sadmin-tag-del {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.sadmin-tag-del:hover { color: var(--red); background: var(--red-soft); }

/* ── Coming soon ───────────────────────────────────────────────────────── */
.sadmin-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 32px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 440px;
}
.sadmin-coming-soon p { font-size: 13px; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════════════════
   TEAM SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Next-up banner ────────────────────────────────────────────────────── */
.team-nextup-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  max-width: 640px;
}
.team-nextup-label { color: var(--muted); font-weight: 500; }
.team-nextup-name  { font-weight: 700; color: var(--accent); }
.team-nextup-muted { color: var(--muted); font-size: 12px; }

/* ── Team table specifics ──────────────────────────────────────────────── */
.team-table { max-width: 720px; }
.team-row-inactive { opacity: 0.5; }
.team-order-num { color: var(--muted); font-size: 12px; font-weight: 600; width: 32px; }

.team-agent-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.team-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--accent-line);
}
.team-agent-name  { font-weight: 600; font-size: 13px; }
.team-agent-email { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }

/* ── Weight input ──────────────────────────────────────────────────────── */
.team-weight-form {
  display: flex;
  align-items: center;
  gap: 5px;
}
.team-weight-input {
  width: 52px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: center;
}
.team-weight-input:focus { outline: none; border-color: var(--accent-line); }
.team-weight-save {
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  transition: background 0.1s, border-color 0.1s;
}
.team-weight-save:hover { background: var(--accent-soft); border-color: var(--accent-line); }

/* ── Active toggle button ──────────────────────────────────────────────── */
.team-toggle-btn {
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s;
  white-space: nowrap;
}
.team-toggle-on {
  background: rgba(74,222,128,0.12);
  color: var(--green);
  border-color: rgba(74,222,128,0.3);
}
.team-toggle-on:hover { background: rgba(74,222,128,0.22); }
.team-toggle-off {
  background: var(--surface-3);
  color: var(--muted);
  border-color: var(--border);
}
.team-toggle-off:hover { background: var(--surface-2); color: var(--text-soft); }

/* ── Reorder arrows ────────────────────────────────────────────────────── */
.team-reorder-btns {
  display: flex;
  gap: 4px;
  align-items: center;
}
.team-arrow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font: inherit;
  line-height: 1;
}
.team-arrow-btn:hover { background: var(--surface-3); color: var(--accent); }
.team-arrow-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--border-2);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

/* ── Rotation preview strip ────────────────────────────────────────────── */
.team-rotation-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  max-width: 720px;
  font-size: 12px;
}
.team-rotation-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}
.team-rotation-chip {
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}
.team-rotation-arrow { color: var(--muted-2); font-size: 11px; }
.team-rotation-repeat { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ── Light theme overrides ─────────────────────────────────────────────── */
[data-theme="light"] .settings-sidenav-item        { color: #4a5568; }
[data-theme="light"] .settings-sidenav-item:hover  { background: #f0f2f5; color: #1a202c; }
[data-theme="light"] .settings-sidenav-item.active { background: rgba(45,212,191,0.1); color: #0d7a72; }
[data-theme="light"] .sadmin-table-wrap            { border-color: var(--border); }
[data-theme="light"] .sadmin-table thead th        { background: #f7f8fa; color: #718096; }
[data-theme="light"] .sadmin-table tbody tr        { border-bottom-color: var(--border); }
[data-theme="light"] .sadmin-table tbody tr:hover  { background: #f7fffe; }
[data-theme="light"] .sadmin-table tbody td        { color: #1a202c; }
[data-theme="light"] .sadmin-form-card             { background: #fff; border-color: var(--border); }
[data-theme="light"] .sadmin-form-card-title       { background: #f7f8fa; color: #4a5568; }
[data-theme="light"] .sadmin-tag-row               { background: #fff; border-color: var(--border); }
[data-theme="light"] .sadmin-chip                  { background: #f0f2f5; border-color: #dde1e7; color: #4a5568; }
[data-theme="light"] .sadmin-coming-soon           { background: #fff; }
[data-theme="light"] .team-weight-input            { background: #fff; border-color: var(--border); color: #1a202c; }
[data-theme="light"] .team-rotation-preview        { background: #f7f8fa; border-color: var(--border); }
[data-theme="light"] .team-rotation-chip           { background: #fff; border-color: #dde1e7; color: #4a5568; }
[data-theme="light"] .settings-toast-success       { background: rgba(16,185,129,0.08); }
[data-theme="light"] .settings-toast-error         { background: rgba(239,68,68,0.08); }



/* ─── Demo mode toggle ──────────────────────────────────────────────── */
.settings-demo-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid rgba(251,191,36,0.2);
}
.demo-toggle-card {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: var(--radius);
}
.demo-toggle-label { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.demo-toggle-desc { font-size: 13px; color: var(--muted); }
[data-theme="light"] .demo-toggle-card { background: #fff; border-color: rgba(192,86,33,0.2); }
[data-theme="light"] .settings-demo-section { border-top-color: rgba(192,86,33,0.2); }

/* ─── Team weight cell ──────────────────────────────────────────────── */
.team-weight-cell {
  display: flex; align-items: center; gap: 4px;
}
.team-weight-input {
  width: 60px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  text-align: center;
}
.team-weight-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,212,191,0.1); }
.team-weight-pct { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ─── Data table ────────────────────────────────────────────────────────── */
.table-wrap { margin-top: 16px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table thead { background: var(--bg); border-bottom: 1px solid var(--border); }
.data-table th { padding: 8px 12px; text-align: left; font-weight: 600; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.2s; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table td { padding: 8px 12px; font-size: 13px; color: var(--text); vertical-align: middle; }
.data-table .mono { font-family: 'Geist Mono', monospace; }

.order-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.order-status-shipped { background: rgba(34,197,94,0.15); color: #22c55e; }
.order-status-processing { background: rgba(59,130,246,0.15); color: #3b82f6; }
.order-status-delivered { background: rgba(168,85,247,0.15); color: #a855f7; }
.order-status-delayed { background: rgba(251,146,60,0.15); color: #fb923c; }

[data-theme="light"] .data-table { background: #fff; }
[data-theme="light"] .data-table thead { background: #f5f7fa; }

/* ─── Template modal ────────────────────────────────────────────────────── */
.template-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.template-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.template-modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.template-modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.template-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-modal-close:hover { color: var(--text); }

.template-modal-body {
  padding: 20px;
}

.template-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

[data-theme="light"] .template-card { background: #fff; }
[data-theme="light"] .template-modal-content { background: #fff; }

/* ─── Polish layer: depth, hover glow, micro-motion ─── */

/* Buttons — lift + soft accent glow on hover */
.btn {
  transition: background .18s ease, border-color .18s ease, color .18s ease,
              transform .12s ease, box-shadow .2s ease;
  will-change: transform;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px var(--accent-soft), 0 0 0 1px var(--accent-line);
}
.btn-ghost:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.btn-danger-ghost:hover {
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.18) !important;
}

/* Panels — subtle lift on hover (keeps cards feeling tactile) */
.panel {
  transition: border-color .2s ease, box-shadow .25s ease, transform .12s ease;
}
.panel:hover {
  border-color: var(--border-2, var(--border));
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

/* Sidebar filter rows — slide-in indicator on hover */
.sidebar-filter-item {
  position: relative;
  transition: background .15s ease, color .15s ease, padding-left .15s ease;
}
.sidebar-filter-item:hover {
  padding-left: calc(var(--sidebar-item-pl, 12px) + 4px);
}
.sidebar-filter-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity .15s ease;
}
.sidebar-filter-item:hover::before,
.sidebar-filter-item.active::before {
  opacity: 1;
}

/* Table rows (orders, customers, etc.) — row glow on hover */
.data-row, .data-table tbody tr {
  transition: background .15s ease, box-shadow .2s ease, transform .12s ease;
}
.data-row:hover, .data-table tbody tr:hover {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Ticket / inbox list cards */
a[href*="/tickets/"]:hover,
.ticket-card:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

/* Inputs / textareas — soft accent focus ring */
.form-input:focus,
.reply-textarea:focus,
.filter-select:focus,
textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft);
  transition: border-color .15s ease, box-shadow .15s ease;
}

/* Badges — soft pulse on real-time-ish updates */
.count-badge,
.badge {
  transition: transform .15s ease, box-shadow .2s ease;
}
.sidebar-filter-item:hover .count-badge,
.data-row:hover .badge {
  transform: scale(1.05);
}

/* Tag pills */
.tag-pill {
  transition: transform .12s ease, box-shadow .2s ease, filter .15s ease;
}
.tag-pill:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* Links inside panels */
.panel-body a:not(.btn) {
  transition: color .15s ease, text-shadow .2s ease;
}
.panel-body a:not(.btn):hover {
  text-shadow: 0 0 8px var(--accent-soft);
}

/* Light theme — softer shadows so it doesn’t feel heavy */
[data-theme="light"] .btn:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
[data-theme="light"] .btn-primary:hover { box-shadow: 0 4px 14px var(--accent-soft); }
[data-theme="light"] .panel:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
[data-theme="light"] .data-row:hover, [data-theme="light"] .data-table tbody tr:hover { box-shadow: inset 3px 0 0 var(--accent); }

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  .btn, .panel, .data-row, .data-table tbody tr,
  .sidebar-filter-item, .tag-pill, .badge, .count-badge,
  a[href*="/tickets/"], .ticket-card {
    transition: none !important;
  }
  .btn:hover, .panel:hover, .data-row:hover,
  a[href*="/tickets/"]:hover, .ticket-card:hover {
    transform: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE OPTIMIZATION
   Breakpoints: 320px base | 480px | 640px | 768px | 1024px
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Base (320px+): touch-friendly defaults ────────────────────────────── */

/* Touch targets: minimum 44px height for all interactive elements */
.btn {
  min-height: 44px;
}
.btn-sm {
  min-height: 36px;
}

/* iOS input zoom fix: 16px minimum font on all inputs prevents auto-zoom */
@media (max-width: 1024px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  input[type="url"],
  input[type="tel"],
  textarea,
  select,
  .form-input,
  .filter-select,
  .reply-textarea,
  .search-input,
  .mailbox-select,
  .team-weight-input {
    font-size: 16px !important;
  }
}

/* ─── Table horizontal scroll (mobile & tablet) ─────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sadmin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.va-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Ensure tables don't squish below 480px */
.data-table,
.sadmin-table,
.va-table {
  min-width: 480px;
}

/* ─── 480px: Small phones ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Tighter page content */
  .page-content { padding: 12px; }

  /* Page header: always stack vertically */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .page-header-meta { margin-left: 0; flex-wrap: wrap; }

  /* Full-width buttons in reply actions on very small screens */
  .reply-actions > .btn { flex: 1; min-width: 0; justify-content: center; }

  /* Page title smaller */
  .page-title { font-size: 18px; }

  /* Login card: no padding */
  .login-card { padding: 24px 16px; }
  .login-container { padding: 12px; }

  /* Stats grid: 1 column */
  .analytics-grid { grid-template-columns: 1fr; }
}

/* ─── 640px: Mobile/tablet boundary ─────────────────────────────────────── */
@media (max-width: 640px) {
  /* Forms: stack all inline groups vertically, full width */
  .form-group { margin-bottom: 14px; }
  .form-input  { font-size: 16px; }

  /* Inline flex form rows (brand contacts etc) — override inline style */
  .sadmin-form .form-group [style*="flex"] {
    width: 100% !important;
    flex: unset !important;
  }
  .sadmin-form-actions { flex-wrap: wrap; }
  .sadmin-form-actions .btn { flex: 1; min-width: 120px; }

  /* Filter bar: wrap and full-width selects */
  .filter-form { flex-direction: column; align-items: stretch; }
  .filter-select { width: 100%; min-width: unset; }
  .filter-form .btn { width: 100%; justify-content: center; }

  /* Ticket detail: full-width layout */
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-sidebar-col { position: static; }
  .ticket-subject { font-size: 16px; }

  /* Calls / orders: card-layout for data rows */
  .data-table,
  .sadmin-table {
    min-width: 560px;
  }

  /* Search: hide on mobile if needed, or shrink */
  .search-input { width: 120px; }

  /* Topbar adjustments */
  .topbar { padding: 0 10px; gap: 8px; height: 52px; }
  .topbar-right .user-name { display: none; }
  .topbar-right .brand-pill { display: none; }

  /* Reply box */
  .reply-box { padding: 10px; }
  .reply-actions { flex-wrap: wrap; gap: 8px; }

  /* Thread messages: full width */
  .msg-body-wrap { max-width: calc(100% - 36px); }

  /* Ticket rows v1 */
  .ticket-row { flex-wrap: wrap; gap: 8px; padding: 12px; }
  .ticket-row-right { width: 100%; justify-content: flex-start; padding-left: 0; }

  /* Ticket rows v2 */
  .ticket-v2-right { display: none; }
  .ticket-v2-topline { flex-wrap: wrap; gap: 4px; }

  /* Settings layout: stack sidebar above content */
  .settings-layout {
    flex-direction: column;
    gap: 16px;
  }
  .settings-sidenav {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    position: static;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
  }
  .settings-sidenav-item {
    flex: 1 1 auto;
    min-width: 120px;
    justify-content: center;
    font-size: 12px;
    padding: 8px 10px;
  }
  .settings-body { min-width: 0; }
  .settings-section { max-width: 100%; }

  /* sadmin form card: full width */
  .sadmin-form-card { width: 100%; }
  .sadmin-tags-list { max-width: 100%; }

  /* Team table: scroll */
  .sadmin-table-wrap { overflow-x: auto; }
  .team-table { min-width: 500px; }

  /* Pagination / action rows */
  .sadmin-form-actions { gap: 8px; }
}

/* ─── 768px: Tablet ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Modals: full-screen on mobile */
  .template-modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .template-modal {
    align-items: flex-end;
  }
  .template-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Ticket layout: single column */
  .ticket-layout { grid-template-columns: 1fr; gap: 20px; }
  .ticket-sidebar-col { position: static; }

  /* Analytics charts: single column */
  .chart-row { grid-template-columns: 1fr; }

  /* Settings sidenav: scrollable row */
  .settings-sidenav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    position: static;
    gap: 4px;
    padding-bottom: 4px;
  }
  .settings-sidenav-item {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Table scroll */
  .table-wrap,
  .sadmin-table-wrap { overflow-x: auto; }

  /* Buttons in panels: touch friendly */
  .panel-body .btn { min-height: 44px; }

  /* Page content padding */
  .page-content { padding: 16px 18px; }
}

/* ─── 1024px: Desktop threshold ─────────────────────────────────────────── */
@media (min-width: 1024px) {
  /* Reset iOS font-size override — let desktop use its native 13px */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  input[type="url"],
  input[type="tel"],
  textarea,
  select,
  .form-input,
  .filter-select,
  .reply-textarea,
  .search-input,
  .mailbox-select,
  .team-weight-input {
    font-size: inherit !important;
  }
}

/* ─── Grid system: mobile-first ─────────────────────────────────────────── */
/* 1 column on <640px, 2 on 640-1024px, 3+ on 1024px+ */
.analytics-grid {
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 1024px) {
  .analytics-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 480px) {
  .analytics-grid { grid-template-columns: 1fr; }
}

/* ─── Topbar search: hide on very small screens ─────────────────────────── */
@media (max-width: 400px) {
  .search-form { display: none; }
  .topbar { padding: 0 8px; gap: 6px; }
}

/* ─── Safe area insets (notch/home bar) ─────────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .app-shell {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .page-content {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ─── Light theme overrides for new mobile elements ─────────────────────── */
[data-theme="light"] .settings-sidenav {
  background: #f7f8fa;
  border-color: var(--border);
}

