/* Customer Hub — shared styles (Cellsius Design System). Loaded by _layout.html.
   Page-specific styles stay in each template's {% block extra_styles %}. */
/* ============================================================
   Cellsius Customer Hub — v2 (Cellsius Design System)
   ------------------------------------------------------------
   Inter 400/500 only (never bold) · 10px corners · thin-stroke
   icons from the sprite below · green #48A111 = primary actions
   only · orange #EF8B34 = badges only · one colour per data
   source (see "Source colours"). Desktop 1440 + mobile 390.
   ============================================================ */
:root {
  /* Brand palette */
  --navy: #1C1D3A;          /* Blue Night */
  --navy-ink: #0E132F;
  --navy-hover: #2A2C52;
  --mist: #F0F5F7;          /* Blue Mist 1 */
  --mist-2: #F6FAFC;        /* Blue Mist 2 */
  --mist-3: #E2EFF3;
  --warm: #FEFAF8;          /* Warm Light */
  --white: #FFFFFF;
  --stone: #252525;
  --muted: #686868;
  --placeholder: #757575;
  --line: #DCE3E6;
  --line-strong: #C6D0D5;
  --action: #48A111;
  --action-hover: #3F8E0F;
  --action-press: #377A0D;
  --badge: #EF8B34;
  --badge-soft: #FDEBDC;
  --badge-ink: #9A4F0C;
  --danger: #B3261E;
  --danger-soft: #FCECEA;
  --on-navy: #FFFFFF;
  --on-navy-muted: #A4A5B8;
  --on-navy-line: rgba(255, 255, 255, 0.18);
  --on-navy-hover: rgba(255, 255, 255, 0.12);

  /* Legacy aliases (pages not yet redesigned still use these names) */
  --dark: var(--navy);
  --dark-2: var(--navy-hover);
  --light: var(--mist);
  --light-2: var(--mist-3);
  --beige: var(--warm);
  --beige-2: var(--badge-soft);
  --gray: var(--muted);
  --gray-2: var(--placeholder);
  --gray-3: #A3ABB0;
  --green: var(--action);
  --green-soft: #E6F2DD;
  --green-ink: #2F6B0B;
  --orange: var(--badge);
  --orange-soft: var(--badge-soft);
  --orange-ink: var(--badge-ink);
  --red: var(--danger);
  --red-soft: var(--danger-soft);
  --hairline: var(--line);
  --hairline-strong: var(--line-strong);
  --shadow-card: none;
  --shadow-pop: 0 4px 8px rgba(0, 0, 0, 0.2);

  /* Source colours — ONE colour per data source, everywhere.
     ink = text/icon on white · soft = tinted ground · bright = on navy */
  --src-order: #2B55A6;   --src-order-soft: #E9EFFA;   --src-order-bright: #8FB0F0;
  --src-refund: #B3261E;  --src-refund-soft: #FCECEA;  --src-refund-bright: #F28B82;
  --src-call: #6B45B8;    --src-call-soft: #F1ECFA;    --src-call-bright: #BBA2F0;
  --src-chat: #0B7469;    --src-chat-soft: #E1F3F0;    --src-chat-bright: #5FCFC0;
  --src-ticket: #7D5C00;  --src-ticket-soft: #FAF1D6;  --src-ticket-bright: #E6C459;
  --src-comment: #A12E76; --src-comment-soft: #F9EAF3; --src-comment-bright: #EE97CB;
  --src-survey: #0A6596;  --src-survey-soft: #E2F0F7;  --src-survey-bright: #72C4EC;
  --src-review: #8A4724;  --src-review-soft: #F6ECE6;  --src-review-bright: #E3AA88;

  /* Shape, type, motion */
  --r: 10px;
  --r-sm: 7px;
  --r-lg: 10px;
  --sidebar-w: 248px;
  --topbar-h: 0px;
  --bottombar-h: 0px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fast: 120ms;
  --base: 200ms;
  --focus-ring: 0 0 0 2px var(--white), 0 0 0 4px var(--navy);

  --t-display: 24px;
  --t-h1: 24px;
  --t-h2: 18px;
  --t-h3: 15px;
  --t-body: 15px;
  --t-meta: 13.5px;
  --t-micro: 12px;
}

/* ------------------------------------------------------------ */
/* Reset + base                                                   */
/* ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: var(--t-body);
  line-height: 1.4;
  color: var(--stone);
  background: var(--mist-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "tnum" 0;
}
a { color: inherit; }
b, strong, th { font-weight: 500; }
h1, h2, h3, h4 { font-weight: 500; color: var(--navy-ink); line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; } }

/* Icons — thin stroke, from the sprite at the top of <body> */
.ico { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ico-sm { width: 16px; height: 16px; }
.ico-md { width: 18px; height: 18px; }
.ico-lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------ */
/* Source colours (classes)                                       */
/* ------------------------------------------------------------ */
.src-order   { --src: var(--src-order);   --src-soft: var(--src-order-soft);   --src-bright: var(--src-order-bright); }
.src-refund  { --src: var(--src-refund);  --src-soft: var(--src-refund-soft);  --src-bright: var(--src-refund-bright); }
.src-call    { --src: var(--src-call);    --src-soft: var(--src-call-soft);    --src-bright: var(--src-call-bright); }
.src-chat    { --src: var(--src-chat);    --src-soft: var(--src-chat-soft);    --src-bright: var(--src-chat-bright); }
.src-ticket  { --src: var(--src-ticket);  --src-soft: var(--src-ticket-soft);  --src-bright: var(--src-ticket-bright); }
.src-comment { --src: var(--src-comment); --src-soft: var(--src-comment-soft); --src-bright: var(--src-comment-bright); }
.src-survey  { --src: var(--src-survey);  --src-soft: var(--src-survey-soft);  --src-bright: var(--src-survey-bright); }
.src-review  { --src: var(--src-review);  --src-soft: var(--src-review-soft);  --src-bright: var(--src-review-bright); }
.src-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--src, var(--navy)); flex: 0 0 auto; }
.src-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px 0 7px;
  border-radius: var(--r-sm);
  background: var(--src-soft, var(--mist)); color: var(--src, var(--navy));
  font-size: var(--t-micro); font-weight: 500; white-space: nowrap;
}
.src-chip .ico { width: 14px; height: 14px; }

/* ------------------------------------------------------------ */
/* App shell: sidebar (desktop) · top bar + tab bar (mobile)      */
/* ------------------------------------------------------------ */
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  padding: 8px 12px; background: var(--navy); color: var(--white);
  border-radius: var(--r); font-size: 13.5px;
}
.skip:focus { left: 16px; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: var(--navy); color: var(--on-navy);
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  color: var(--on-navy); text-decoration: none;
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
}
.sb-brand .mono-mark { width: 26px; height: 24px; fill: currentColor; flex: 0 0 auto; }
.sb-brand small { display: block; font-size: 12px; font-weight: 400; color: var(--on-navy-muted); letter-spacing: 0; }
.sb-search {
  display: flex; align-items: center; gap: 10px;
  margin: 0 12px 8px; height: 40px; padding: 0 10px 0 12px;
  background: transparent; color: var(--on-navy-muted);
  border: 1px solid var(--on-navy-line); border-radius: var(--r);
  cursor: pointer; text-align: left; font-size: 14px;
  transition: background var(--base) var(--ease), border-color var(--base) var(--ease), color var(--base) var(--ease);
}
.sb-search:hover { background: var(--on-navy-hover); border-color: rgba(255,255,255,0.6); color: var(--on-navy); }
.sb-search span { flex: 1 1 auto; }
.sb-search kbd { font: inherit; font-size: 11px; color: var(--on-navy-muted); border: 1px solid var(--on-navy-line); border-radius: 5px; padding: 1px 6px; }
.sb-group { padding: 10px 12px 4px; }
.sb-label {
  display: block; padding: 6px 10px 6px;
  font-size: 11px; font-weight: 500; color: var(--on-navy-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.sb-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 36px; padding: 0 10px;
  color: rgba(255, 255, 255, 0.78); text-decoration: none;
  font-size: 14px; font-weight: 400;
  border-radius: var(--r);
  transition: background var(--base) var(--ease), color var(--base) var(--ease);
}
.sb-link:hover { background: var(--on-navy-hover); color: var(--on-navy); }
.sb-link.active { background: rgba(255, 255, 255, 0.14); color: var(--on-navy); font-weight: 500; }
.sb-link .ico { color: var(--on-navy-muted); }
.sb-link.active .ico, .sb-link:hover .ico { color: var(--on-navy); }
.sb-link .src-dot { width: 8px; height: 8px; margin: 0 5px; background: var(--src-bright); }
.sb-link .sb-count { margin-left: auto; font-size: 12px; color: var(--on-navy-muted); font-variant-numeric: tabular-nums; }
.sb-sources .sb-link { min-height: 32px; font-size: 13.5px; }
.sb-foot { margin-top: auto; padding: 12px 12px 16px; border-top: 1px solid var(--on-navy-line); }

.app { min-height: 100vh; margin-left: var(--sidebar-w); }
.is-bare .app { margin-left: 0; }
.is-bare .page { padding-bottom: 32px; }

/* Mobile top bar */
.topbar { display: none; }
.bottombar { display: none; }

@media (max-width: 1023px) {
  :root { --topbar-h: 56px; --bottombar-h: 64px; }
  .sidebar { display: none; }
  .app { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 40;
    height: var(--topbar-h); padding: 0 8px 0 16px;
    background: var(--white); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; font-size: 15px; font-weight: 500; }
  .topbar .brand .mono-mark { width: 24px; height: 22px; fill: currentColor; }
  .topbar .brand span { color: var(--muted); font-weight: 400; }
  .topbar .tb-actions { margin-left: auto; display: flex; gap: 4px; }
  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border: 0; border-radius: var(--r);
    background: transparent; color: var(--navy); cursor: pointer;
  }
  .icon-btn:hover { background: var(--mist); }

  .bottombar {
    display: block;
    position: fixed; inset: auto 0 0 0; z-index: 40;
    height: calc(var(--bottombar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--white); border-top: 1px solid var(--line);
  }
  .bottombar-inner { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--bottombar-h); }
  .bottombar a, .bottombar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: 0; background: transparent; cursor: pointer;
    color: var(--muted); text-decoration: none;
    font-size: 11px; font-weight: 500;
  }
  .bottombar .ico { width: 22px; height: 22px; }
  .bottombar a.active { color: var(--navy); }
  .bottombar a.active .tab-ico { background: var(--mist); }
  .bottombar .tab-ico { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 28px; border-radius: 999px; transition: background var(--base) var(--ease); }
}

/* Mobile "More" sheet */
.more-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(14, 19, 47, 0.45);
  opacity: 0; pointer-events: none; transition: opacity var(--base) var(--ease);
}
.more-backdrop[data-open="1"] { opacity: 1; pointer-events: auto; }
.more-sheet {
  position: fixed; inset: auto 0 0 0; z-index: 60;
  max-height: 85vh; overflow-y: auto;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  padding: 8px 12px max(20px, env(safe-area-inset-bottom));
  transform: translateY(100%); visibility: hidden;
  transition: transform var(--base) var(--ease), visibility var(--base);
}
.more-sheet[data-open="1"] { transform: translateY(0); visibility: visible; }
.more-sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 8px; }
.more-sheet h3 { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; margin: 14px 10px 6px; }
.more-sheet a {
  display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 0 10px;
  color: var(--navy); text-decoration: none; font-size: 15px;
  border-radius: var(--r);
}
.more-sheet a:hover { background: var(--mist); }
.more-sheet a.active { background: var(--mist); font-weight: 500; }
.more-sheet .src-dot { margin: 0 5px; }
.more-sheet a.signout { color: var(--danger); }
@media (min-width: 1024px) { .more-sheet, .more-backdrop { display: none; } }

/* ------------------------------------------------------------ */
/* Page                                                           */
/* ------------------------------------------------------------ */
.page {
  max-width: 1240px; margin: 0 auto;
  padding: 32px 40px 48px;
}
.page.narrow { max-width: 920px; }
.page.wide { max-width: 1500px; }
@media (max-width: 1023px) {
  .page { padding: 24px 24px calc(32px + var(--bottombar-h) + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .page { padding: 16px 16px calc(24px + var(--bottombar-h) + env(safe-area-inset-bottom)); }
}

/* Shared page heading */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head h1 { font-size: var(--t-h1); }
.page-head .page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-head .page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) { .page-head { margin-bottom: 14px; } .page-head h1 { font-size: 20px; } }

/* Legacy header block (pages not yet redesigned) */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: var(--t-h1); }
.page-header .lead { color: var(--muted); font-size: var(--t-body); margin-top: 6px; max-width: 720px; }
.page-header .meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: var(--t-meta); margin-top: 8px; }

/* ------------------------------------------------------------ */
/* Cards                                                          */
/* ------------------------------------------------------------ */
.card, .panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 24px;
}
.panel { margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h2, .panel h2 { font-size: 16px; }
.panel h2 { margin: 0 0 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel h2 .count, .card-head .count { font-size: var(--t-meta); color: var(--muted); font-weight: 400; }
.eyebrow, .card h2.eyebrow, .panel h2.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.eyebrow .ico { width: 16px; height: 16px; }
.panel-warm { background: var(--warm); }
.panel-tight { padding: 16px 20px; }
.panel-flat { background: transparent; border: none; padding: 0; }
@media (max-width: 640px) { .card, .panel { padding: 16px; } }

/* ------------------------------------------------------------ */
/* Buttons — green fill = primary action only                     */
/* ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap;
  border-radius: var(--r);
  border: 1px solid var(--line-strong);
  background: var(--white); color: var(--navy);
  text-decoration: none; cursor: pointer;
  transition: background var(--base) var(--ease), border-color var(--base) var(--ease), color var(--base) var(--ease);
}
.btn:hover { background: var(--mist); border-color: var(--navy); }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary, .btn-go { background: var(--action); border-color: var(--action); color: var(--white); }
.btn-primary:hover, .btn-go:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-primary:active, .btn-go:active { background: var(--action-press); border-color: var(--action-press); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--mist); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(179, 38, 30, 0.35); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15px; }
.btn .ico { width: 16px; height: 16px; }
.btn .badge-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--badge); color: var(--navy); font-size: 12px; font-weight: 500; }

/* ------------------------------------------------------------ */
/* Form controls                                                  */
/* ------------------------------------------------------------ */
.input, .select, textarea.input {
  font: inherit; font-size: 15px; color: var(--stone);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  height: 44px; padding: 0 12px;
  width: 100%;
  transition: border-color var(--base) var(--ease);
}
textarea.input { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.input:hover, .select:hover { border-color: var(--navy); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus-ring); }
.input::placeholder, textarea::placeholder { color: var(--placeholder); }
.field-label, label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.field .input, label.field .select { font-weight: 400; }

.search-bar { position: relative; }
.search-bar .input { height: 50px; padding-left: 44px; }
.search-bar .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* ------------------------------------------------------------ */
/* Chips, pills, badges                                           */
/* ------------------------------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  background: var(--mist); color: var(--navy);
  border-radius: var(--r-sm);
}
.chip-outline { background: var(--white); border: 1px solid var(--line); }
.chip-store { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; height: 22px; padding: 0 7px; }
.chip .ico { width: 14px; height: 14px; }
/* Orange = badges only */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--badge); color: var(--navy);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-soft { background: var(--badge-soft); color: var(--badge-ink); }

/* Status chip — colour comes from the status table (--sc) */
.status-wrap { position: relative; display: inline-flex; }
.status-chip {
  --sc: var(--navy);
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 10px 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sc) 11%, var(--white));
  border: 1px solid color-mix(in srgb, var(--sc) 35%, var(--white));
  color: var(--navy-ink);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: default;
}
.status-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sc); flex: 0 0 auto; }
.status-chip .ico { width: 14px; height: 14px; color: var(--muted); margin-right: -2px; }
button.status-chip { cursor: pointer; transition: border-color var(--base) var(--ease), background var(--base) var(--ease); }
button.status-chip:hover { border-color: var(--sc); }
.status-chip-lg { height: 36px; padding: 0 12px; font-size: 14px; }

.status-popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 90;
  min-width: 220px; padding: 6px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop);
}
.status-popover.align-right { left: auto; right: 0; }
.status-popover .head { font-size: 11px; color: var(--muted); padding: 6px 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.status-popover .opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--navy); font-size: 14px; text-align: left; cursor: pointer;
}
.status-popover .opt:hover { background: var(--mist); }
.status-popover .opt.current { background: var(--mist); font-weight: 500; }
.status-popover .opt .swatch { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.status-popover .opt .ico { margin-left: auto; width: 16px; height: 16px; }

/* Legacy pills (pages not yet redesigned) */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; font-size: var(--t-micro); font-weight: 500; background: var(--mist); color: var(--navy); border-radius: var(--r-sm); white-space: nowrap; }
.pill-store { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.pill.pill-status { color: var(--white); }
.pill-multiple { background: var(--badge); color: var(--navy); }
.pill-outline { background: transparent; border: 1px solid var(--line); }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  font-size: 13.5px; font-weight: 500;
  background: var(--white); color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; cursor: pointer;
  transition: border-color var(--base) var(--ease), color var(--base) var(--ease), background var(--base) var(--ease);
}
.filter-pill:hover { color: var(--navy); border-color: var(--navy); }
.filter-pill.active { background: var(--mist); color: var(--navy); border-color: var(--navy); }
.filter-pill .count { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Legacy source pills → source colours */
.source-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: var(--r-sm); background: var(--mist); color: var(--navy);
}
.source-pill.shopify_order, .source-pill.orders { background: var(--src-order-soft); color: var(--src-order); }
.source-pill.shopify_refund, .source-pill.refunds { background: var(--src-refund-soft); color: var(--src-refund); }
.source-pill.ringover_call, .source-pill.ringover, .source-pill.calls { background: var(--src-call-soft); color: var(--src-call); }
.source-pill.zipchat_chat, .source-pill.zipchat, .source-pill.chats { background: var(--src-chat-soft); color: var(--src-chat); }
.source-pill.richpanel_ticket, .source-pill.richpanel_message, .source-pill.richpanel, .source-pill.tickets { background: var(--src-ticket-soft); color: var(--src-ticket); }
.source-pill.posts, .source-pill.meta_comment, .source-pill.social_comment { background: var(--src-comment-soft); color: var(--src-comment); }
.source-pill.typeform_response, .source-pill.typeform, .source-pill.surveys,
.source-pill.zigpoll_response, .source-pill.zigpoll { background: var(--src-survey-soft); color: var(--src-survey); }
.source-pill.loox_review, .source-pill.loox, .source-pill.loox_store_review, .source-pill.loox_store,
.source-pill.trustpilot_review, .source-pill.trustpilot { background: var(--src-review-soft); color: var(--src-review); }

/* ------------------------------------------------------------ */
/* Stats                                                          */
/* ------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.stat { background: var(--mist-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: var(--t-micro); font-weight: 500; }
.stat .v { font-size: 20px; font-weight: 500; line-height: 1.25; margin-top: 4px; color: var(--navy-ink); font-variant-numeric: tabular-nums; }
.stat .v.muted { color: var(--stone); font-weight: 400; font-size: 15px; }
.stat .sub { color: var(--muted); font-size: var(--t-meta); }

/* Definition list (key/value) */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--muted); margin: 0 0 2px; }
.kv dd { margin: 0; font-size: 16px; font-weight: 500; color: var(--navy-ink); font-variant-numeric: tabular-nums; }
.kv dd.plain { font-size: 14px; font-weight: 400; color: var(--stone); }
.kv dd small { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); }

/* ------------------------------------------------------------ */
/* Empty state                                                    */
/* ------------------------------------------------------------ */
.empty { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 56px 24px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--navy-ink); margin: 0 0 6px; font-size: 18px; }
.empty p { max-width: 420px; margin: 0 auto; line-height: 1.5; }
.empty .icon-circle { width: 52px; height: 52px; border-radius: 50%; background: var(--mist); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; color: var(--navy); }

/* ------------------------------------------------------------ */
/* Tag picker (refund category / subcategory)                     */
/* ------------------------------------------------------------ */
.tag-picker {
  position: absolute; z-index: 90; top: calc(100% + 6px); left: 0;
  width: min(440px, calc(100vw - 32px));
  padding: 14px; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop);
}
.tag-picker .head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; margin-bottom: 10px; }
.tag-picker .group { margin-bottom: 12px; }
.tag-picker .group:last-of-type { margin-bottom: 4px; }
.tag-picker .group-label { display: block; font-size: 13px; font-weight: 500; color: var(--navy-ink); margin-bottom: 6px; }
.tag-picker .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-picker .opt {
  display: inline-flex; align-items: center; height: 32px; padding: 0 10px;
  font-size: 13px; border-radius: var(--r-sm); cursor: pointer; user-select: none;
  background: var(--white); color: var(--navy); border: 1px solid var(--line);
}
.tag-picker .opt:hover { border-color: var(--navy); }
.tag-picker .opt.current { background: var(--mist); border-color: var(--navy); font-weight: 500; }
.tag-picker .clear { display: inline-flex; margin-top: 6px; font-size: 13px; color: var(--danger); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ */
/* Legacy components still used by other pages                   */
/* ------------------------------------------------------------ */
.case-back {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px 0 6px; margin: 0 0 12px -6px;
  font-size: 14px; color: var(--muted); font-weight: 500; text-decoration: none;
  border-radius: var(--r);
  transition: background var(--base) var(--ease), color var(--base) var(--ease);
}
.case-back:hover { background: var(--mist); color: var(--navy); }
.home-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .home-layout { grid-template-columns: 1fr; } }
.activity-rail { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 18px 12px; }
.activity-rail h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.activity-item { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; }
.activity-item:first-of-type { border-top: none; padding-top: 4px; }
.activity-item .who { width: 28px; height: 28px; border-radius: 50%; background: var(--mist); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; }
.activity-item .body { color: var(--muted); }
.activity-item .body strong { color: var(--navy); }
.activity-item .body .when { font-size: 11px; color: var(--gray-3); display: block; margin-top: 2px; }
.ai-headline { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin-bottom: 12px; background: var(--mist); border-radius: var(--r); font-size: 13.5px; line-height: 1.5; }
.ai-headline .badge { flex: 0 0 auto; }
.cd-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.cd-tab { padding: 10px 14px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.cd-tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.thread { display: flex; flex-direction: column; gap: 10px; }
.thread-day { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; padding: 12px 0 4px; border-bottom: 1px solid var(--line); }
.thread-msg { display: grid; grid-template-columns: 110px 1fr 64px; gap: 12px; align-items: start; }
@media (max-width: 640px) { .thread-msg { grid-template-columns: 1fr; gap: 4px; } .thread-msg .when { text-align: left !important; } }
.thread-msg .src { font-size: 11px; color: var(--muted); padding-top: 8px; font-weight: 500; }
.thread-msg .when { font-size: 11px; color: var(--muted); padding-top: 8px; text-align: right; }
.thread-msg .bubble { padding: 10px 14px; border-radius: var(--r); font-size: 13.5px; line-height: 1.5; color: var(--stone); border-left: 3px solid var(--line); background: var(--mist-2); }
.thread-msg .bubble .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.thread-msg.call .bubble     { background: var(--src-call-soft);   border-left-color: var(--src-call); }
.thread-msg.chat-in .bubble  { background: var(--src-chat-soft);   border-left-color: var(--src-chat); }
.thread-msg.chat-out .bubble { background: var(--mist);            border-left-color: var(--navy); }
.thread-msg.refund .bubble   { background: var(--src-refund-soft); border-left-color: var(--src-refund); }
.thread-msg.order .bubble    { background: var(--src-order-soft);  border-left-color: var(--src-order); }
.thread-msg.review .bubble   { background: var(--src-review-soft); border-left-color: var(--src-review); }
.bulk-bar { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5; margin-bottom: 10px; background: var(--navy); color: var(--white); border-radius: var(--r); padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bulk-bar .count { background: var(--badge); color: var(--navy); font-weight: 500; font-size: 13px; padding: 2px 10px; border-radius: 999px; }
.bulk-bar .spacer { flex: 1; }
.bulk-bar .b { background: var(--on-navy-hover); color: var(--white); border: none; padding: 8px 14px; border-radius: var(--r); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.bulk-check { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--white); cursor: pointer; flex: 0 0 auto; position: relative; }
.bulk-check:checked { background: var(--navy); border-color: var(--navy); }
.source-card, .home-stat { transition: border-color var(--base) var(--ease); }
.source-card:hover, .home-stat:hover { border-color: var(--navy); }
.home-stat { position: relative; cursor: pointer; }
.home-stat .arrow { position: absolute; top: 14px; right: 14px; opacity: 0; transition: opacity var(--base) var(--ease); color: var(--muted); }
.home-stat:hover .arrow { opacity: 1; }
.saved-views { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ */
/* Command palette, shortcuts, toasts                             */
/* ------------------------------------------------------------ */
.palette-overlay, .shortcuts-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(14, 19, 47, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.palette { width: min(620px, 100%); background: var(--white); border-radius: var(--r); box-shadow: var(--shadow-pop); overflow: hidden; }
.palette .input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette .input-wrap .ico { color: var(--muted); }
.palette input { flex: 1; min-width: 0; border: none; outline: none; font: inherit; font-size: 16px; color: var(--stone); background: transparent; }
.palette input:focus { box-shadow: none; }
.palette .esc { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; }
.palette .results { max-height: 460px; overflow-y: auto; padding: 6px 8px 10px; }
.palette .group-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; padding: 10px 10px 6px; }
.palette .row { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; color: inherit; }
.palette .row:hover, .palette .row.active { background: var(--mist); }
.palette .row .icon { width: 32px; height: 32px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; background: var(--mist); color: var(--navy); }
.palette .row .icon.refund { background: var(--src-refund-soft); color: var(--src-refund); }
.palette .row .icon.cust { background: var(--mist); color: var(--navy); }
.palette .row .icon.data { background: var(--mist); color: var(--navy); }
.palette .row .icon.action { background: var(--mist); color: var(--navy); }
.palette .row .title { font-size: 14px; color: var(--navy-ink); font-weight: 500; }
.palette .row .sub { font-size: 12.5px; color: var(--muted); }
.palette .row .meta { font-size: 11px; color: var(--muted); }
.palette .footer { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); background: var(--mist-2); }
.palette kbd, .shortcuts kbd { font: inherit; font-size: 11px; background: var(--white); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.shortcuts { width: min(560px, 100%); max-height: 78vh; overflow-y: auto; background: var(--white); border-radius: var(--r); padding: 22px 24px; box-shadow: var(--shadow-pop); }
.shortcuts h2 { font-size: 18px; margin-bottom: 14px; }
.shortcuts .sc-h { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 18px 0 2px; }
.shortcuts .sc-h:first-of-type { margin-top: 4px; }
.shortcuts .sc-h + .sc-row { border-top: none; }
.shortcuts .sc-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.shortcuts .sc-row:first-of-type { border-top: none; }
.shortcuts .sc-row .keys { display: inline-flex; gap: 4px; }
.toast-host { position: fixed; bottom: calc(24px + var(--bottombar-h)); left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--navy); color: var(--white); border-radius: var(--r); padding: 10px 14px; font-size: 14px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-pop); }
.toast.success::before, .toast.info::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--action); }
.toast.info::before { background: var(--badge); }

/* ------------------------------------------------------------ */
/* Shared detail-page building blocks                             */
/* ------------------------------------------------------------ */
.ent-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 20px; }
.ent-head h1 { font-size: 24px; word-break: break-word; }
.ent-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.ent-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.ent-meta .strong { color: var(--stone); }
.ent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) { .ent-head { margin-bottom: 14px; } .ent-head h1 { font-size: 20px; } }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.split > div { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

.person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--navy-ink); transition: border-color var(--base) var(--ease); }
a.person:hover { border-color: var(--navy); }
.person .avatar { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; background: var(--mist); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; }
.person .who { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.person .who small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.person .end { margin-left: auto; color: var(--muted); }

/* Compact event rows — colour = source family */
.jlist { list-style: none; margin: 0; padding: 0; }
.jrow { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.jlist > li:first-child > .jrow { border-top: 0; padding-top: 2px; }
a.jrow:hover .jtitle { text-decoration: underline; text-underline-offset: 3px; }
.jnode { width: 32px; height: 32px; border-radius: 50%; background: var(--src-soft, var(--mist)); color: var(--src, var(--navy)); display: inline-flex; align-items: center; justify-content: center; }
.jnode .ico { width: 16px; height: 16px; }
.jtitle { font-size: 14px; color: var(--stone); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jtitle .src { color: var(--src, var(--navy)); font-weight: 500; margin-right: 4px; }
.jwhen { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Questions & answers (surveys) */
.qa-list { list-style: none; margin: 0; padding: 0; }
.qa-item { padding: 16px 0; border-top: 1px solid var(--line); }
.qa-item:first-child { border-top: 0; padding-top: 2px; }
.qa-item:last-child { padding-bottom: 2px; }
.qa-q { font-size: 14px; line-height: 1.45; color: var(--muted); white-space: pre-line; }
.qa-a { margin-top: 6px; font-size: 16px; line-height: 1.45; color: var(--navy-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.qa-a.is-empty { font-size: 14px; color: var(--muted); }

/* Call transcripts (turns are built by JS from [Speaker N] / [AGENT] markers) */
.transcript { background: var(--mist-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 14px; line-height: 1.55; color: var(--stone); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 520px; overflow-y: auto; }
.transcript-turn { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 4px 0; white-space: normal; }
.transcript-turn .speaker { font-size: 12px; font-weight: 500; color: var(--src-call); padding-top: 2px; }
.transcript-turn.s2 .speaker, .transcript-turn.agent .speaker { color: var(--navy); }
@media (max-width: 640px) { .transcript-turn { grid-template-columns: 1fr; gap: 2px; } }

/* Sample-data marker (until the backend sends the real values) */
.sample-flag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--badge-soft); color: var(--badge-ink); font-size: 12px; font-weight: 500; }

/* ------------------------------------------------------------ */
/* v3 — sidebar groups, account, badges                           */
/* ------------------------------------------------------------ */
.sb-badge {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--badge); color: var(--navy); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.sb-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer;
  font-size: 11px; font-weight: 500; color: var(--on-navy-muted); text-transform: uppercase; letter-spacing: 0.08em; text-align: left;
}
.sb-toggle:hover { color: var(--on-navy); }
.sb-toggle .ico { width: 14px; height: 14px; margin-left: auto; transition: transform var(--base) var(--ease); }
.sb-group[data-collapsed="1"] .sb-toggle .ico { transform: rotate(-90deg); }
.sb-group[data-collapsed="1"] .sb-collapsible { display: none; }
.sb-account { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 4px 0 10px; border-top: 1px solid var(--on-navy-line); }
.sb-avatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.14); color: var(--on-navy); font-size: 12px; font-weight: 500; text-transform: uppercase;
}
.sb-account .who { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--on-navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-account .who small { display: block; font-size: 11.5px; color: var(--on-navy-muted); overflow: hidden; text-overflow: ellipsis; }
.sb-icon-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm); color: var(--on-navy-muted); text-decoration: none;
  transition: background var(--base) var(--ease), color var(--base) var(--ease);
}
.sb-icon-btn:hover { background: var(--on-navy-hover); color: var(--on-navy); }
.sb-brand .ws-logo { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; }
.tab-ico { position: relative; }
.tab-badge {
  position: absolute; top: -5px; left: calc(50% + 4px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--badge); color: var(--navy); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums;
  border: 2px solid var(--white);
}

/* ------------------------------------------------------------ */
/* v3 — breadcrumbs + queue navigation (detail pages)             */
/* ------------------------------------------------------------ */
.topline { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; min-height: 34px; margin: -4px 0 14px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; font-size: 14px; color: var(--muted); }
.crumbs a {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px;
  color: var(--muted); font-weight: 500; text-decoration: none; border-radius: var(--r-sm);
  transition: background var(--base) var(--ease), color var(--base) var(--ease);
}
.crumbs a:first-child { margin-left: -8px; }
.crumbs a:hover { background: var(--mist); color: var(--navy); }
.crumbs .sep { color: var(--line-strong); }
.crumbs .here { padding: 0 8px; color: var(--stone); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.qnav { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.qnav .pos { padding: 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; min-width: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--white); color: var(--navy); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: border-color var(--base) var(--ease), background var(--base) var(--ease);
}
.qbtn:hover { border-color: var(--navy); }
.qbtn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.qbtn .ico { width: 16px; height: 16px; }

/* Keyboard hints — desktop with a pointer only */
kbd.k {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font: inherit; font-size: 11px; font-weight: 500; line-height: 1; color: var(--muted);
  background: var(--white); border: 1px solid var(--line); border-radius: 5px;
}
@media (max-width: 1023px), (hover: none) { .kbd-hint { display: none !important; } }

/* ------------------------------------------------------------ */
/* v3 — dialog (replaces window.prompt / confirm)                 */
/* ------------------------------------------------------------ */
.dlg-overlay { position: fixed; inset: 0; z-index: 250; display: flex; align-items: flex-start; justify-content: center; padding: 16vh 16px 16px; background: rgba(14, 19, 47, 0.5); animation: dlg-fade var(--base) var(--ease); }
.dlg { width: min(440px, 100%); padding: 22px 24px 20px; background: var(--white); border-radius: var(--r); box-shadow: var(--shadow-pop); animation: dlg-rise var(--base) var(--ease); }
.dlg h2 { font-size: 18px; margin: 0 0 6px; }
.dlg p { font-size: 14px; line-height: 1.5; color: var(--muted); }
.dlg .input { margin-top: 16px; }
.dlg .err { margin-top: 8px; font-size: 13px; color: var(--danger); }
.dlg .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.btn-destructive { background: var(--danger); border-color: var(--danger); color: var(--white); }
.btn-destructive:hover { background: #9A2019; border-color: #9A2019; }
@keyframes dlg-fade { from { opacity: 0; } }
@keyframes dlg-rise { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 640px) {
  .dlg-overlay { align-items: flex-end; padding: 0; }
  .dlg { width: 100%; border-radius: 16px 16px 0 0; padding: 20px 16px max(20px, env(safe-area-inset-bottom)); }
  .dlg .actions .btn { flex: 1 1 0; height: 46px; }
}

/* Toasts with an action (Undo) */
.toast { min-height: 44px; animation: dlg-rise var(--base) var(--ease); }
.toast .t-msg { flex: 1 1 auto; }
.toast .t-act {
  flex: 0 0 auto; height: 30px; padding: 0 10px; margin-right: -4px;
  border: 0; border-radius: var(--r-sm); background: rgba(255, 255, 255, 0.14); color: var(--white);
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.toast .t-act:hover { background: rgba(255, 255, 255, 0.24); }
.toast.error::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #F28B82; }
@media (max-width: 640px) { .toast-host { left: 16px; right: 16px; transform: none; top: calc(var(--topbar-h) + 8px); bottom: auto; } }

.page-head .eyebrow { margin-bottom: 6px; }
.settings-tabs { margin-bottom: 20px; }

/* Tag picker: bottom sheet on phones */
.tag-picker .tp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tag-picker .tp-close { display: none; }
@media (max-width: 640px) {
  .tag-picker, .cd-tags .tag-picker {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 72vh; overflow-y: auto; z-index: 260;
    border-radius: 16px 16px 0 0; padding: 14px 16px max(16px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.18); animation: dlg-rise var(--base) var(--ease);
  }
  .tag-picker .tp-close { display: inline-flex; }
  .tag-picker .opt { height: 38px; font-size: 14px; }
}

/* Palette v3: sections, active row, hints */
.palette .row.active { background: var(--mist); box-shadow: inset 2px 0 0 var(--navy); }
.palette .row .icon.src { background: var(--src-soft); color: var(--src); }
.palette .hint { padding: 14px 12px 6px; font-size: 13px; color: var(--muted); }

