/* ===========================================================================
   Ommly design system — v3

   A self-contained UI kit. No Bootstrap, no !important fights.

   Read top to bottom:
     1.  Tokens (colour, type, space, motion) — light + dark
     2.  Base + utilities
     3.  App shell: sidebar, main, safe-mode banner, toasts
     4.  Components: buttons, cards, forms, badges, tables, stats, callouts…
     5.  Approval desk (queue / thread / composer)
     6.  Page-specific bits: login, rules, campaigns, simulator
     7.  Motion: keyframes + reduced-motion guard

   Principles
     - One strong primary action per view (Approve, Save, Create).
     - Colour carries meaning (status, platform), never decoration.
     - Everything that appears, moves; everything that moves, is quick (<= 400ms)
       and is switched off for people who ask for reduced motion.
   =========================================================================== */


/* ---------------------------------------------------------------------------
   1. Tokens
   --------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Surfaces */
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --sunken: #eef0f6;
  --hover: #f1f3f9;
  --line: #e4e7ef;
  --line-strong: #d2d7e3;

  /* Ink */
  --ink: #0d1020;
  --ink-2: #444c61;
  --ink-3: #6b7389;

  /* Brand */
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-hover: #4338ca;
  --brand-soft: #eef0ff;
  --brand-ink: #3730a3;

  /* Status */
  --success: #12804a;
  --warn: #a8590a;
  --danger: #c2273a;
  --info: #1d5fd6;
  --success-soft: color-mix(in srgb, var(--success) 11%, var(--surface));
  --warn-soft: color-mix(in srgb, var(--warn) 12%, var(--surface));
  --danger-soft: color-mix(in srgb, var(--danger) 10%, var(--surface));
  --info-soft: color-mix(in srgb, var(--info) 10%, var(--surface));

  /* Platforms */
  --ig: #d6246e;
  --fb: #1877f2;
  --wa: #1c9a52;
  --ig-soft: color-mix(in srgb, var(--ig) 10%, var(--surface));
  --fb-soft: color-mix(in srgb, var(--fb) 10%, var(--surface));
  --wa-soft: color-mix(in srgb, var(--wa) 11%, var(--surface));

  /* Sidebar is a dark surface in both themes: it anchors the eye. */
  --sb-bg: #0d1020;
  --sb-ink: #e9ebf5;
  --sb-dim: #8b91a8;
  --sb-line: rgba(255, 255, 255, 0.07);
  --sb-w: 248px;

  /* Geometry */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(13, 16, 32, 0.05), 0 1px 1px rgba(13, 16, 32, 0.03);
  --shadow-2: 0 4px 12px -2px rgba(13, 16, 32, 0.08), 0 2px 4px -1px rgba(13, 16, 32, 0.04);
  --shadow-3: 0 18px 40px -12px rgba(13, 16, 32, 0.22), 0 6px 14px -6px rgba(13, 16, 32, 0.1);
  --ring: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #0a0b11;
  --surface: #12141d;
  --surface-2: #171a25;
  --sunken: #0e1017;
  --hover: #1c1f2c;
  --line: #242839;
  --line-strong: #343950;

  --ink: #eef0f8;
  --ink-2: #b9bed0;
  --ink-3: #868ca3;

  --brand: #8b83ff;
  --brand-2: #a78bfa;
  --brand-hover: #a39cff;
  --brand-soft: color-mix(in srgb, #8b83ff 15%, var(--surface));
  --brand-ink: #cfcbff;

  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  --ig: #f472b6;
  --fb: #60a5fa;
  --wa: #34d399;

  --sb-bg: #07080d;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 6px 16px -4px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
}


/* ---------------------------------------------------------------------------
   2. Base + utilities
   --------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  word-spacing: 0.1em;
  line-height: 1.2;
  color: var(--ink);
}
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
button { font-family: inherit; }

code {
  font-family: var(--font-mono); font-size: 0.84em; color: var(--brand-ink);
  background: var(--brand-soft); padding: 1px 6px; border-radius: 5px;
}
kbd {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  padding: 1px 5px; border-radius: 5px; line-height: 1.5;
  background: var(--sunken); border: 1px solid var(--line-strong); color: var(--ink-2);
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }

/* Utilities — a deliberately small set. */
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.mono { font-family: var(--font-mono); }
.tiny { font-size: 12px; line-height: 1.45; color: var(--ink-3); }
.small { font-size: 13px; }
.strong { font-weight: 600; color: var(--ink); }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.cluster { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cluster-lg { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px)  { .grid-2 { grid-template-columns: minmax(0, 1fr); } }


/* ---------------------------------------------------------------------------
   3. App shell
   --------------------------------------------------------------------------- */

html[data-sidebar='collapsed'] { --sb-w: 74px; }

.shell { display: flex; min-height: 100vh; }

/* --- Sidebar ------------------------------------------------------------- */
.sidebar {
  width: var(--sb-w); flex: none; position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; padding: 16px 12px;
  background:
    radial-gradient(260px 200px at 0% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    var(--sb-bg);
  color: var(--sb-ink);
  transition: width 0.3s var(--ease);
  view-transition-name: sidebar;
  overflow: hidden;
}
.sb-top { display: flex; align-items: center; gap: 10px; padding: 2px 6px 18px; min-height: 52px; }
.sb-brand { display: flex; align-items: center; gap: 11px; color: #fff; min-width: 0; }
.sb-brand:hover { color: #fff; }
.sb-logo {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff; font: 800 17px var(--font-display);
  background: linear-gradient(135deg, #5b50f0, #9b6bff 60%, #e0408a);
  box-shadow: 0 6px 16px -4px rgba(124, 58, 237, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.4s var(--spring);
}
.sb-brand:hover .sb-logo { transform: rotate(-8deg) scale(1.06); }
.sb-wordmark { font: 700 19px var(--font-display); letter-spacing: -0.03em; }

.sb-collapse {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 0; cursor: pointer;
  background: transparent; color: var(--sb-dim); display: grid; place-items: center;
  transition: background 0.15s, color 0.15s, transform 0.3s var(--ease);
}
.sb-collapse:hover { background: var(--sb-line); color: #fff; }
html[data-sidebar='collapsed'] .sb-collapse { transform: rotate(180deg); }

/* The link list scrolls on its own, so a long menu never spills out of the dark panel. */
.sb-nav {
  display: flex; flex-direction: column; gap: 3px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 6px; }
.sb-link.sb-sub { height: 34px; padding-left: 44px; font-size: 13px; }
.sb-link.sb-sub::before { display: none; }

/* Group headings fold their links away. Only applies in the full-width sidebar. */
html:not([data-sidebar='collapsed']) .sb-section[data-group] { cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
html:not([data-sidebar='collapsed']) .sb-section[data-group]::after {
  content: '\F282'; font-family: 'bootstrap-icons'; font-size: 11px; letter-spacing: 0; transition: transform 0.2s var(--ease);
}
html:not([data-sidebar='collapsed']) .sb-section[data-group].is-closed::after { transform: rotate(-90deg); }
html:not([data-sidebar='collapsed']) .sb-link.group-closed { display: none; }
.sb-section {
  font: 600 10.5px var(--font-sans); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sb-dim); padding: 16px 12px 6px; opacity: 0.8;
}
.sb-link {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px;
  border-radius: 11px; color: var(--sb-dim); font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background 0.18s, color 0.18s, transform 0.15s var(--ease);
}
.sb-link > i { font-size: 18px; width: 20px; text-align: center; flex: none; transition: transform 0.25s var(--spring); }
.sb-link:hover { background: var(--sb-line); color: #fff; }
.sb-link:hover > i { transform: scale(1.12); }
.sb-link:active { transform: scale(0.98); }
.sb-link.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sb-link.active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #8b83ff, #e0408a); animation: grow-y 0.35s var(--ease);
}
.sb-link.dev > i { color: #fbbf24; }
.sb-badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; font: 600 11px var(--font-mono);
  background: #fbbf24; color: #1a1300;
}
.sb-link.has-new .sb-badge { animation: pulse-badge 2.4s ease-in-out infinite; }

.sb-spacer { flex: 0 0 0; }

.sb-user {
  display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 8px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--sb-line);
}
.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font: 700 14px var(--font-display); color: #fff;
  background: linear-gradient(135deg, #5b50f0, #e0408a);
}
.sb-avatar::after {
  content: ''; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #34d399; border: 2px solid var(--sb-bg);
}
.sb-avatar.admin::after { background: #f87171; }
.sb-who { min-width: 0; line-height: 1.25; }
.sb-who b { display: block; font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-who span { display: block; font-size: 11.5px; color: var(--sb-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-tools { margin-left: auto; display: flex; gap: 2px; }
.sb-tool {
  width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: var(--sb-dim);
  display: grid; place-items: center; cursor: pointer; font-size: 15px; transition: background 0.15s, color 0.15s;
}
.sb-tool:hover { background: var(--sb-line); color: #fff; }
.theme-icon-sun { display: none; }
:root[data-theme='dark'] .theme-icon-sun { display: inline; }
:root[data-theme='dark'] .theme-icon-moon { display: none; }
.sb-tool:hover .theme-icon { animation: spin-once 0.5s var(--ease); }

/* Expanded sidebar: the name gets its own row, the tools sit underneath. */
@media (min-width: 961px) {
  html:not([data-sidebar='collapsed']) .sb-user { flex-wrap: wrap; row-gap: 8px; }
  html:not([data-sidebar='collapsed']) .sb-who { flex: 1; }
  html:not([data-sidebar='collapsed']) .sb-tools { width: 100%; margin: 0; padding-top: 8px; border-top: 1px solid var(--sb-line); }
  html:not([data-sidebar='collapsed']) .sb-tools > * { flex: 1; display: flex; }
  html:not([data-sidebar='collapsed']) .sb-tools .sb-tool { flex: 1; width: auto; }
}

/* Collapsed rail: icons only, with tooltips. */
html[data-sidebar='collapsed'] .sb-label,
html[data-sidebar='collapsed'] .sb-who { display: none; }
html[data-sidebar='collapsed'] .sb-top { flex-direction: column; padding-bottom: 12px; }
html[data-sidebar='collapsed'] .sb-collapse { margin: 0; }
html[data-sidebar='collapsed'] .sb-link { justify-content: center; padding: 0; }
html[data-sidebar='collapsed'] .sb-section { height: 1px; padding: 0; margin: 10px 12px; background: var(--sb-line); font-size: 0; }
html[data-sidebar='collapsed'] .sb-badge {
  position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 4px;
}
html[data-sidebar='collapsed'] .sb-user { flex-direction: column; padding: 10px 4px; }
html[data-sidebar='collapsed'] .sb-tools { margin: 0; flex-direction: column; }
html[data-sidebar='collapsed'] .sb-link::after,
html[data-sidebar='collapsed'] .sb-tool::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%;
  transform: translate(-6px, -50%); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); font: 600 12px var(--font-sans); padding: 6px 11px; border-radius: 8px;
  white-space: nowrap; box-shadow: var(--shadow-3); transition: opacity 0.15s, transform 0.2s var(--ease);
}
html[data-sidebar='collapsed'] .sb-tool { position: relative; }
html[data-sidebar='collapsed'] .sb-link:hover::after,
html[data-sidebar='collapsed'] .sb-tool:hover::after { opacity: 1; transform: translate(0, -50%); }

/* --- Main column ---------------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.safe-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; font-size: 13px; font-weight: 500; text-align: center;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, color-mix(in srgb, var(--warn) 7%, transparent) 14px 28px),
    var(--warn-soft);
  color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
}
.safe-banner i { animation: pulse-soft 2.4s ease-in-out infinite; }
.safe-banner code { background: color-mix(in srgb, var(--warn) 14%, transparent); color: inherit; }

.page { width: 100%; max-width: 1220px; margin: 0 auto; padding: 30px 36px 72px; }
.page-bg {
  background:
    radial-gradient(900px 320px at 12% -60px, color-mix(in srgb, var(--brand) 8%, transparent), transparent 70%),
    radial-gradient(700px 260px at 95% -80px, color-mix(in srgb, var(--ig) 6%, transparent), transparent 70%);
  background-repeat: no-repeat;
}

/* --- Page header --------------------------------------------------------- */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); font-weight: 500; display: inline-flex; align-items: center; gap: 5px; transition: color 0.15s; }
.crumbs a:hover { color: var(--brand); }
.crumbs i.sep { font-size: 10px; opacity: 0.6; }
.crumbs .here { color: var(--ink); font-weight: 600; }

.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head-icon {
  width: 50px; height: 50px; border-radius: 15px; flex: none; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(145deg, var(--brand-soft), color-mix(in srgb, var(--ig) 12%, var(--surface)));
  color: var(--brand-ink); border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--line));
  font-family: var(--font-display); font-weight: 800;
}
.page-head-text { flex: 1; min-width: 220px; }
.page-head h1 { font-size: 27px; letter-spacing: -0.03em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lede { color: var(--ink-3); font-size: 14px; margin-top: 4px; max-width: 62ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- Toasts (Django flash messages) -------------------------------------- */
.toasts {
  position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px;
  width: min(380px, calc(100vw - 36px)); pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px 13px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-3); animation: toast-in 0.45s var(--spring) both;
}
.toast.leaving { animation: toast-out 0.25s var(--ease) forwards; }
.toast-icon {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 15px;
  background: var(--info-soft); color: var(--info);
}
.toast.success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast.error .toast-icon, .toast.danger .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast.warning .toast-icon { background: var(--warn-soft); color: var(--warn); }
.toast-body { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.45; color: var(--ink); padding-top: 4px; }
.toast-close {
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; transition: background 0.15s;
}
.toast-close:hover { background: var(--hover); color: var(--ink); }
.toast-timer {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left;
  background: var(--info); animation: timer var(--life, 5s) linear forwards;
}
.toast.success .toast-timer { background: var(--success); }
.toast.error .toast-timer, .toast.danger .toast-timer { background: var(--danger); }
.toast.warning .toast-timer { background: var(--warn); }
.toast:hover .toast-timer { animation-play-state: paused; }


/* ---------------------------------------------------------------------------
   4. Components
   --------------------------------------------------------------------------- */

/* --- Buttons ------------------------------------------------------------- */
.btn {
  word-spacing: 0.05em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 11px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; user-select: none;
  font: 600 13.5px/1 var(--font-sans); letter-spacing: -0.005em;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s, filter 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn i { font-size: 1.05em; }
.btn-primary {
  color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand-hover));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 14px -6px color-mix(in srgb, var(--brand) 75%, transparent);
}
:root[data-theme='dark'] .btn-primary { color: #0a0b11; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 20px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
:root[data-theme='dark'] .btn-primary:hover { color: #0a0b11; }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); border-color: color-mix(in srgb, var(--line-strong) 70%, var(--ink-3)); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--hover); color: var(--ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 20%, var(--surface)); color: var(--brand-ink); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
:root[data-theme='dark'] .btn-success { color: #052e16; }
.btn-success:hover { filter: brightness(1.1); color: #fff; transform: translateY(-1px); }
:root[data-theme='dark'] .btn-success:hover { color: #052e16; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 14.5px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; filter: saturate(0.6); }
.btn.is-loading { pointer-events: none; opacity: 0.85; }
.btn.is-loading > i { display: none; }
.btn.is-loading::before {
  content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.65s linear infinite;
}
.btn .kbd-hint { display: inline-flex; gap: 3px; margin-left: 4px; opacity: 0.85; }
.btn .kbd-hint kbd { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.28); color: inherit; }
:root[data-theme='dark'] .btn .kbd-hint kbd { background: rgba(0,0,0,.14); border-color: rgba(0,0,0,.25); }
.inline-form { display: inline; margin: 0; }

/* --- Cards --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 20px; border-bottom: 1px solid var(--line); min-height: 56px;
}
.card-title { font: 700 14.5px var(--font-display); letter-spacing: -0.01em; word-spacing: 0.1em; display: flex; align-items: center; gap: 9px; }
.card-title i { color: var(--brand); font-size: 16px; }
.card-sub { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-lift { transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s; }
.card-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }

/* --- Badges & dots ------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font: 600 11.5px var(--font-sans); background: var(--sunken); color: var(--ink-2); white-space: nowrap; letter-spacing: 0;
}
.badge i { font-size: 11px; }
.b-success { background: var(--success-soft); color: var(--success); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-brand { background: var(--brand-soft); color: var(--brand-ink); }
.b-ig { background: var(--ig-soft); color: var(--ig); }
.b-fb { background: var(--fb-soft); color: var(--fb); }
.b-wa { background: var(--wa-soft); color: var(--wa); }
.b-outline { background: transparent; border: 1px solid var(--line-strong); }
.b-pulse { animation: pulse-badge 2s ease-in-out infinite; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--ink-3); }
.dot.on { background: var(--success); animation: pulse-ring 2.2s ease-out infinite; }
.dot.off { background: var(--warn); }
.dot.idle { background: var(--ink-3); opacity: 0.6; }
.dot.person { background: var(--success); }
.dot.ai { background: var(--brand); }
.dot.system { background: var(--ink-3); }

/* --- Avatars -------------------------------------------------------------- */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font: 700 14px var(--font-display); color: #fff; background: linear-gradient(135deg, var(--brand), var(--ig));
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 46px; height: 46px; font-size: 17px; }
.avatar.plat-ig { background: linear-gradient(135deg, #f58529, #dd2a7b 55%, #8134af); }
.avatar.plat-fb { background: linear-gradient(135deg, #1877f2, #5aa2ff); }
.avatar.plat-wa { background: linear-gradient(135deg, #1ba95a, #3ddc84); }
.avatar.sq { border-radius: 12px; }
.avatar-wrap { position: relative; flex: none; display: inline-block; line-height: 0; align-self: flex-start; }
.plat-glyph {
  position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: 9.5px; color: #fff; border: 2px solid var(--surface); line-height: 1;
}
.plat-glyph.plat-ig { background: var(--ig); }
.plat-glyph.plat-fb { background: var(--fb); }
.plat-glyph.plat-wa { background: var(--wa); }
.plat-ico { font-size: 1.05em; }
.plat-ico.plat-ig { color: var(--ig); } .plat-ico.plat-fb { color: var(--fb); } .plat-ico.plat-wa { color: var(--wa); }

/* --- Forms --------------------------------------------------------------- */
.form-card { max-width: 700px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 700px) minmax(240px, 340px); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .form-layout { grid-template-columns: minmax(0, 700px); } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: baseline; gap: 6px; }
.label .opt { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.field-row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row.r-3-1 { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
@media (max-width: 560px) { .field-row, .field-row.r-3-1 { grid-template-columns: minmax(0, 1fr); } }

.input, .select, .textarea {
  width: 100%; background: var(--surface); color: var(--ink); font: 400 14.5px/1.45 var(--font-sans);
  border: 1.5px solid var(--line-strong); border-radius: 11px; padding: 10px 13px; min-height: 42px;
  transition: border-color 0.15s, box-shadow 0.2s, background 0.15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 0.75; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--ink-3)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.select {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238a90a6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .peek {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3); cursor: pointer; display: grid; place-items: center;
}
.input-wrap .peek:hover { background: var(--hover); color: var(--ink); }

.form-section { font: 600 11px var(--font-sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 22px 0 14px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-section:first-child { margin-top: 0; }

/* Toggle switch: <label class="switch-row"><input class="switch" type=checkbox><span class="switch-text">…</span></label> */
.switch-row {
  display: flex; align-items: flex-start; gap: 14px; cursor: pointer; padding: 14px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface-2); transition: border-color 0.15s, background 0.15s;
}
.switch-row:hover { border-color: var(--line-strong); }
.switch-row + .switch-row { margin-top: 10px; }
.switch-text { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.switch-text strong { color: var(--ink); font-weight: 600; }
.switch-text span { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.switch {
  appearance: none; flex: none; width: 42px; height: 25px; border-radius: 999px; margin: 1px 0 0; cursor: pointer; position: relative;
  background: var(--line-strong); transition: background 0.25s var(--ease);
}
.switch::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--spring);
}
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(17px); }
.switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 999px; }

/* Chip checkbox: pick any of several. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chip-box {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13px;
  transition: all 0.2s var(--ease); user-select: none;
}
.chip:hover .chip-box { border-color: var(--ink-3); }
.chip input:checked + .chip-box { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.chip input:checked + .chip-box::after { content: '\F633'; font-family: 'bootstrap-icons'; font-size: 13px; margin-left: -2px; animation: pop-in 0.3s var(--spring); }
.chip input:focus-visible + .chip-box { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Option cards: pick exactly one. */
.options { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .options { grid-template-columns: minmax(0, 1fr); } }
.option { position: relative; cursor: pointer; display: block; }
.option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.option-box {
  display: flex; gap: 12px; padding: 14px; height: 100%; border-radius: var(--r-md); background: var(--surface);
  border: 1.5px solid var(--line-strong); transition: all 0.2s var(--ease);
}
.option:hover .option-box { border-color: var(--ink-3); transform: translateY(-1px); }
.option-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 17px;
  background: var(--sunken); color: var(--ink-2); transition: all 0.2s;
}
.option-box b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.option-box small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.option input:checked + .option-box { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--ring); }
.option input:checked + .option-box .option-ico { background: var(--brand); color: #fff; transform: scale(1.06); }
.option input:focus-visible + .option-box { outline: 2px solid var(--brand); outline-offset: 2px; }

/* --- Tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font: 600 11px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
  padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 11px 16px; }
.table td.num, .table th.num { text-align: right; }
.table td.num { font-family: var(--font-mono); }
.table .cell-name { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; }
.table-wrap > .table:first-child thead th:first-child { border-top-left-radius: var(--r-lg); }
.table-wrap > .table:first-child thead th:last-child { border-top-right-radius: var(--r-lg); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ts { font: 500 12px var(--font-mono); color: var(--ink-3); white-space: nowrap; }

/* --- Stats --------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.stat-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; flex: none; background: var(--brand-soft); color: var(--brand-ink); }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat-ico.success { background: var(--success-soft); color: var(--success); }
.stat-ico.danger { background: var(--danger-soft); color: var(--danger); }
.stat-label { word-spacing: 0.04em; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.stat-value { font: 800 28px/1.1 var(--font-display); letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-value.sm { font-size: 18px; letter-spacing: -0.02em; line-height: 1.3; }
.stat-value.warn { color: var(--warn); } .stat-value.success { color: var(--success); } .stat-value.danger { color: var(--danger); }

/* --- Callouts ------------------------------------------------------------ */
.callout {
  display: flex; gap: 14px; padding: 15px 17px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2);
}
.callout > i { font-size: 18px; margin-top: 1px; flex: none; color: var(--ink-3); }
.callout-title { font-weight: 700; font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }
.callout p, .callout .callout-text { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.callout.accent { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.callout.accent > i { color: var(--brand); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.callout.warn > i, .callout.warn .callout-title { color: var(--warn); }
.callout.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.callout.danger > i, .callout.danger .callout-title, .callout.danger p { color: var(--danger); }
.callout.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.callout.success > i { color: var(--success); }

.tips { position: sticky; top: 24px; }
.tips ul { margin: 10px 0 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.tips li { display: flex; gap: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.tips li i { color: var(--brand); margin-top: 3px; font-size: 13px; flex: none; }

/* --- Empty states -------------------------------------------------------- */
.empty { text-align: center; padding: 56px 24px; }
.empty-ico {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 16px; display: grid; place-items: center; font-size: 28px;
  background: var(--brand-soft); color: var(--brand); animation: float 4s ease-in-out infinite;
}
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p { color: var(--ink-3); font-size: 13.5px; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

/* --- Details / dropdown menu --------------------------------------------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; bottom: calc(100% + 8px); min-width: 220px; z-index: 30; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-3);
  animation: pop-in 0.2s var(--ease); transform-origin: bottom right;
}
.menu.down .menu-pop { bottom: auto; top: calc(100% + 8px); transform-origin: top right; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: transparent; border-radius: 8px;
  font: 500 13.5px var(--font-sans); color: var(--ink-2); cursor: pointer; text-align: left; transition: background 0.12s;
}
.menu-item:hover { background: var(--hover); color: var(--ink); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }

/* --- Segmented control / filter chips ----------------------------------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; background: var(--sunken); border-radius: 12px; }
.seg-item {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 6px; border-radius: 9px; border: 0; background: transparent;
  font: 600 12.5px var(--font-sans); color: var(--ink-3); cursor: pointer; transition: all 0.2s var(--ease); white-space: nowrap;
}
.seg-item:hover { color: var(--ink); }
.seg-item.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg-item .n { font: 500 11px var(--font-mono); color: var(--ink-3); }
.seg-item.active .n { color: var(--brand); }

.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--font-sans); cursor: pointer; transition: all 0.2s var(--ease);
}
.filter-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.filter-chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.filter-chip .n { font: 500 11px var(--font-mono); opacity: 0.8; }

.search { position: relative; }
.search > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; font-size: 14px; }
.search .input { padding-left: 38px; min-height: 40px; height: 40px; }

/* --- Modal dialog (native <dialog>) -------------------------------------- */
.modal { border: 0; padding: 0; background: transparent; color: inherit; width: min(660px, calc(100vw - 24px)); max-width: none; margin: auto; overflow: visible; }
.modal[open] { animation: pop-in 0.3s var(--ease); }
.modal::backdrop { background: rgba(10, 12, 24, 0.55); backdrop-filter: blur(4px); animation: fade-in 0.2s ease; }
.modal-card { display: flex; flex-direction: column; max-height: calc(100vh - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; letter-spacing: -0.02em; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }

/* --- Meter (confidence) -------------------------------------------------- */
.meter { display: inline-flex; align-items: center; gap: 7px; font: 500 11.5px var(--font-mono); color: var(--ink-3); }
.meter-bar { width: 56px; height: 5px; border-radius: 3px; background: var(--sunken); overflow: hidden; display: block; }
.meter-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transform-origin: left; animation: bar-grow 0.8s var(--ease) 0.2s both; }

/* --- Copy field ---------------------------------------------------------- */
.copybox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line-strong); }
.copybox code { flex: 1; min-width: 0; background: none; color: var(--ink-2); font-size: 12px; padding: 0; word-break: break-all; }

/* Definition rows (key: value) */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); font-weight: 500; }
.kv dd { margin: 0; color: var(--ink-2); min-width: 0; word-break: break-all; }

.divider-label { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; font: 600 11px var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.divider-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.note-box {
  white-space: pre-wrap; font: 400 13px/1.7 var(--font-mono); color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px;
}


/* ---------------------------------------------------------------------------
   5. Approval desk
   --------------------------------------------------------------------------- */

.is-desk .main { height: 100vh; overflow: hidden; }
.desk { flex: 1; min-height: 0; display: grid; grid-template-columns: 372px minmax(0, 1fr); }

/* --- Queue --------------------------------------------------------------- */
.queue { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.queue-head { padding: 20px 18px 14px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--line); }
.queue-title { display: flex; align-items: center; gap: 10px; }
.queue-title h1 { font-size: 19px; letter-spacing: -0.03em; }
.queue-count {
  min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;
  font: 600 12px var(--font-mono); background: var(--warn-soft); color: var(--warn);
}
.queue-count.clear { background: var(--success-soft); color: var(--success); }
.queue-scroll { flex: 1; overflow-y: auto; min-height: 0; }

.q-group {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 9px 18px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); border-top: 1px solid var(--line);
  font: 600 11px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.q-group:first-child { border-top: 0; }
.q-group .count { margin-left: auto; font: 500 11px var(--font-mono); background: var(--sunken); padding: 1px 8px; border-radius: 999px; }

.q-item {
  position: relative; display: flex; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: inherit;
  transition: background 0.18s, padding-left 0.25s var(--ease);
}
.q-item:hover { background: var(--hover); color: inherit; }
.q-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--brand), var(--brand-2));
  transform: scaleY(0); transform-origin: center; transition: transform 0.3s var(--ease);
}
.q-item.active { background: var(--brand-soft); }
.q-item.active::before { transform: scaleY(1); }
.q-body { min-width: 0; flex: 1; }
.q-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.q-name { font-weight: 600; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-time { font: 500 12px var(--font-sans); color: var(--ink-3); flex: none; }
.q-snippet { font-size: 13px; color: var(--ink-3); margin: 3px 0 8px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; }
.q-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.q-tags .badge { height: 20px; font-size: 11px; }

.queue-empty { padding: 56px 24px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.queue-empty .empty-ico { background: var(--success-soft); color: var(--success); }
.queue-empty b { display: block; color: var(--ink); font: 700 15px var(--font-display); margin-bottom: 4px; }

.queue-foot { padding: 10px 18px; border-top: 1px solid var(--line); display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.queue-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* --- Thread -------------------------------------------------------------- */
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.thread::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 220px; pointer-events: none; opacity: 0.7;
  background: radial-gradient(600px 200px at 70% -40px, color-mix(in srgb, var(--thread-accent, var(--brand)) 11%, transparent), transparent 70%);
}
.thread.plat-ig { --thread-accent: var(--ig); }
.thread.plat-fb { --thread-accent: var(--fb); }
.thread.plat-wa { --thread-accent: var(--wa); }

.thread-head {
  position: relative; flex: none; display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.thread-head::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--thread-accent, var(--brand)); opacity: 0.55;
  transform-origin: left; animation: bar-grow 0.6s var(--ease) both;
}
.thread-name { font: 700 16px var(--font-display); letter-spacing: -0.02em; word-spacing: 0.1em; line-height: 1.25; }
.thread-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; flex-wrap: wrap; }
.thread-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-to-queue { display: none; }
.convo-divider {
  align-self: center; display: inline-flex; align-items: center; gap: 7px; max-width: 90%; padding: 5px 13px; border-radius: 999px;
  font: 600 11.5px var(--font-sans); color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line-strong);
}
.out-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.out-meta .badge { height: 18px; font-size: 10.5px; }

.assign-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--font-sans); cursor: pointer; transition: all 0.2s var(--ease);
}
button.assign-chip:hover { border-color: var(--brand); color: var(--brand); }
.assign-chip.mine { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.assign-chip .x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; opacity: 0.6; display: inline-flex; font-size: 11px; }
.assign-chip .x:hover { opacity: 1; }

.optout-banner {
  display: flex; align-items: center; gap: 10px; padding: 11px 26px; flex-wrap: wrap;
  background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 500; border-bottom: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
}
.optout-banner form { margin-left: auto; }

.thread-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 24px 26px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.thread-body > * { animation: pop-in 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.thread-body > *:nth-child(1) { --i: 0; } .thread-body > *:nth-child(2) { --i: 1; } .thread-body > *:nth-child(3) { --i: 2; }
.thread-body > *:nth-child(4) { --i: 3; } .thread-body > *:nth-child(5) { --i: 4; } .thread-body > *:nth-child(n+6) { --i: 5; }

.day-label { align-self: center; font: 600 11px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 3px 12px; background: var(--sunken); border-radius: 999px; }

.window-pill { align-self: flex-start; display: flex; align-items: center; gap: 12px; padding: 9px 15px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.window-pill.good { background: var(--success-soft); color: var(--success); }
.window-pill.bad { background: var(--danger-soft); color: var(--danger); }
.window-pill.bad i.bi-clock-history { animation: pulse-soft 1.6s ease-in-out infinite; }
.window-track { width: 110px; height: 5px; border-radius: 3px; background: color-mix(in srgb, currentColor 18%, transparent); overflow: hidden; display: block; }
.window-track i { display: block; height: 100%; background: currentColor; border-radius: 3px; transform-origin: left; animation: bar-grow 1s var(--ease) 0.25s both; }

.post-context {
  align-self: flex-start; max-width: 520px; display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: 13px; color: var(--ink-2);
}
.post-context .pc-ico { width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--sunken); color: var(--ink-3); font-size: 18px; }
.post-context b { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }

.bubble-row { display: flex; flex-direction: column; max-width: min(640px, 82%); }
.bubble-row.theirs { align-self: flex-start; align-items: flex-start; }
.bubble-row.mine { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 11px 15px; font-size: 14.5px; line-height: 1.55; border-radius: 18px; word-break: break-word; }
.bubble.theirs { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; color: var(--ink); box-shadow: var(--shadow-1); }
.bubble.mine { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-bottom-right-radius: 5px; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
:root[data-theme='dark'] .bubble.mine { color: #0a0b11; }
.bubble-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; padding: 0 4px; }

.no-reply {
  align-self: stretch; display: flex; gap: 14px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1.5px dashed var(--line-strong);
}
.no-reply > i { font-size: 22px; color: var(--ink-3); }
.no-reply b { display: block; margin-bottom: 3px; color: var(--ink); }
.no-reply p { color: var(--ink-2); font-size: 13.5px; }

.media-row { display: flex; gap: 10px; flex-wrap: wrap; }
.media-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); transition: transform 0.25s var(--ease), box-shadow 0.25s; }
.media-thumb:hover { transform: scale(1.04) rotate(-1deg); box-shadow: var(--shadow-2); }

.thread-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 40px; color: var(--ink-3); }
.thread-empty .empty-ico { background: var(--brand-soft); width: 84px; height: 84px; font-size: 36px; border-radius: 26px; }
.thread-empty b { display: block; font: 700 18px var(--font-display); color: var(--ink); margin-bottom: 6px; }

/* --- Composer ------------------------------------------------------------ */
.composer { position: relative; flex: none; background: var(--surface); border-top: 1px solid var(--line); padding: 16px 26px 20px; box-shadow: 0 -10px 30px -18px rgba(13, 16, 32, 0.25); }
.composer-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12.5px; }
.ai-tag {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-weight: 700; font-size: 11.5px; color: var(--brand-ink);
  background: linear-gradient(110deg, var(--brand-soft) 30%, color-mix(in srgb, var(--brand-2) 22%, var(--surface)) 50%, var(--brand-soft) 70%);
  background-size: 220% 100%; animation: shimmer 3.6s ease-in-out infinite;
}
.ai-tag i { color: var(--brand); }
.composer-box { position: relative; }
.composer .textarea { min-height: 104px; max-height: 280px; font-size: 14.5px; border-radius: 14px; padding: 13px 15px; background: var(--surface-2); }
.composer .textarea:focus { background: var(--surface); }
.composer-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.author-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--sunken); color: var(--ink-2); transition: background 0.25s, color 0.25s;
}
.author-pill.is-edited { background: var(--success-soft); color: var(--success); }
.author-pill i { transition: transform 0.4s var(--spring); }
.author-pill.is-edited i { transform: rotate(-12deg) scale(1.15); }
.char-count { font: 500 11.5px var(--font-mono); color: var(--ink-3); }
.composer-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.private-card { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.private-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; border: 0; background: transparent; cursor: pointer; font: 600 13px var(--font-sans); color: var(--ink-2); text-align: left; }
.private-toggle i.lead { color: var(--brand); font-size: 16px; }
.private-toggle .chev { margin-left: auto; transition: transform 0.3s var(--ease); font-size: 12px; color: var(--ink-3); }
.private-card.open .chev { transform: rotate(180deg); }
.private-card.static { padding: 11px 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); }
.private-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--ease); }
.private-card.open .private-panel { grid-template-rows: 1fr; }
.private-panel > div { overflow: hidden; }
.private-panel .inner { padding: 0 14px 14px; }
.private-panel .textarea { min-height: 72px; margin-bottom: 10px; }

@media (max-width: 960px) {
  .is-desk .main { height: calc(100dvh - 66px); }
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk[data-pane='thread'] .queue { display: none; }
  .desk[data-pane='queue'] .thread { display: none; }
  .back-to-queue { display: inline-flex; }
  .thread-head { padding: 12px 14px; gap: 10px; }
  .thread-head .grow { min-width: 0; }
  .thread-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .thread-meta .kind { display: none; }
  .thread-tools { gap: 6px; }
  .thread-tools .btn span, .assign-chip .lbl { display: none; }
  .thread-tools .btn { width: 32px; padding: 0; }
  .thread-body { padding: 18px 14px; }
  .composer { padding: 12px 14px 14px; }
  .optout-banner { padding: 10px 14px; }
  .bubble-row { max-width: 92%; }
  .kbd-hint, .queue-foot { display: none !important; }
}


/* ---------------------------------------------------------------------------
   6. Page-specific
   --------------------------------------------------------------------------- */

/* --- Login --------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--bg); }
.auth-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 56px; color: #fff;
  background: linear-gradient(145deg, #1a1650 0%, #2b1a73 45%, #5a1f78 100%);
}
.auth-hero::before, .auth-hero::after { content: ''; position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; pointer-events: none; }
.auth-hero::before { width: 460px; height: 460px; left: -120px; top: -100px; background: #5b50f0; animation: blob 14s ease-in-out infinite; }
.auth-hero::after { width: 420px; height: 420px; right: -100px; bottom: -120px; background: #e0408a; animation: blob 17s ease-in-out infinite reverse; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; font: 700 22px var(--font-display); letter-spacing: -0.03em; }
.auth-brand .sb-logo { width: 42px; height: 42px; font-size: 20px; }
.auth-hero h2 { color: #fff; font-size: clamp(30px, 3.2vw, 44px); line-height: 1.1; letter-spacing: -0.04em; max-width: 14ch; margin-bottom: 14px; }
.auth-hero .sub { color: rgba(255, 255, 255, 0.72); font-size: 16px; max-width: 42ch; line-height: 1.55; }

.demo { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.demo-msg { padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.45; opacity: 0; animation: demo-in 12s var(--ease) infinite; }
.demo-in { align-self: flex-start; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(14px); border-bottom-left-radius: 5px; animation-delay: 0.4s; }
.demo-ai { align-self: flex-end; max-width: 92%; background: #fff; color: #1a1650; border-bottom-right-radius: 5px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5); animation-delay: 2.2s; }
.demo-ai .tag { display: flex; width: fit-content; align-items: center; gap: 5px; font: 700 10.5px var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase; color: #5b50f0; margin-bottom: 4px; }
.demo-ai .row { display: flex; gap: 8px; margin-top: 10px; }
.demo-ai .row span { padding: 6px 12px; border-radius: 9px; font: 600 12px var(--font-sans); background: #eef0ff; color: #3730a3; }
.demo-ai .row span.go { background: #4f46e5; color: #fff; animation: press 12s var(--ease) infinite 2.2s; }
.demo-sent { align-self: flex-end; background: #34d399; color: #052e16; font-weight: 600; border-bottom-right-radius: 5px; animation-delay: 5s; }
.auth-hero .foot { font-size: 13px; color: rgba(255, 255, 255, 0.55); }

.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 390px; animation: rise 0.6s var(--ease) both; }
.auth-card h1 { font-size: 30px; letter-spacing: -0.04em; margin-bottom: 8px; }
.auth-card .lede { margin-bottom: 28px; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; font: 700 20px var(--font-display); letter-spacing: -0.03em; }
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; }
}

/* --- Rule form ----------------------------------------------------------- */
.reveal { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.35s var(--ease), opacity 0.25s; }
.reveal.is-closed { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
.reveal > div { overflow: hidden; min-height: 0; }
.reveal > div > .field:last-child { margin-bottom: 20px; }

/* --- Campaign preview: phone-ish WhatsApp bubble ------------------------- */
.wa-preview { padding: 18px; border-radius: var(--r-md); background: color-mix(in srgb, var(--wa) 9%, var(--surface-2)); border: 1px solid var(--line); }
.wa-bubble { display: inline-block; max-width: 100%; padding: 10px 14px; background: var(--surface); border-radius: 4px 14px 14px 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; box-shadow: var(--shadow-1); word-break: break-word; }

/* --- Simulator steps ----------------------------------------------------- */
.steps { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 18px; }
.steps::before { content: ''; position: absolute; left: 15px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.steps li { position: relative; display: flex; gap: 14px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; padding-top: 4px; animation: rise 0.5s var(--ease) both; }
.steps li:nth-child(1) { animation-delay: .1s } .steps li:nth-child(2) { animation-delay: .2s } .steps li:nth-child(3) { animation-delay: .3s }
.steps li:nth-child(4) { animation-delay: .4s } .steps li:nth-child(5) { animation-delay: .5s }
.step-n { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 700 13px var(--font-display); background: var(--surface); border: 2px solid var(--brand); color: var(--brand); z-index: 1; margin-top: -4px; }
.steps li:last-child .step-n { background: var(--success); border-color: var(--success); color: #fff; }
.sample-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sample-btn { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: 500 12.5px var(--font-sans); cursor: pointer; transition: all 0.2s var(--ease); }
.sample-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }

/* --- History ------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; }
.actor { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; }

/* --- Account cards (client detail) --------------------------------------- */
.acct { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: border-color 0.2s, box-shadow 0.2s; }
.acct:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.acct + .acct { margin-top: 12px; }
.acct-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.acct-name { font-weight: 700; color: var(--ink); font-size: 14px; }

/* --- WhatsApp connect ---------------------------------------------------- */
.wa-hero { text-align: center; padding: 52px 24px; }
.wa-hero .wa-logo { width: 76px; height: 76px; border-radius: 24px; margin: 0 auto 18px; display: grid; place-items: center; font-size: 38px; color: #fff; background: linear-gradient(135deg, #1ba95a, #3ddc84); box-shadow: 0 16px 34px -12px rgba(28, 154, 82, 0.6); animation: float 4s ease-in-out infinite; }

/* Tiny helper so a long list of rows reveals one-by-one. */
.page > *, .rise { animation: rise 0.55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
.page > *:nth-child(1) { --i: 0; } .page > *:nth-child(2) { --i: 1; } .page > *:nth-child(3) { --i: 2; } .page > *:nth-child(4) { --i: 3; }
.page > *:nth-child(5) { --i: 4; } .page > *:nth-child(6) { --i: 5; } .page > *:nth-child(n+7) { --i: 6; }
.stagger > * { animation: rise 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.stagger > *:nth-child(1) { --i: 1; } .stagger > *:nth-child(2) { --i: 2; } .stagger > *:nth-child(3) { --i: 3; } .stagger > *:nth-child(4) { --i: 4; }
.stagger > *:nth-child(5) { --i: 5; } .stagger > *:nth-child(6) { --i: 6; } .stagger > *:nth-child(n+7) { --i: 7; }
tbody.stagger > tr { animation-name: fade-in; }


/* ---------------------------------------------------------------------------
   Mobile shell: the sidebar becomes a bottom tab bar.
   --------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .shell { flex-direction: column; }
  .main { min-height: calc(100vh - 66px); padding-bottom: 66px; }
  .is-desk .main { padding-bottom: 0; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; width: 100%; height: 66px; flex-direction: row; align-items: center; padding: 6px 10px;
    background: var(--sb-bg); border-top: 1px solid var(--sb-line); view-transition-name: none;
  }
  .sb-top, .sb-section, .sb-spacer, .sb-who, .sb-collapse { display: none; }
  .sb-nav { flex-direction: row; flex: 1; justify-content: flex-start; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .sb-nav::-webkit-scrollbar { display: none; }
  .sb-link.sb-sub { display: none; }
  html:not([data-sidebar='collapsed']) .sb-section[data-group] { display: none; }
  html:not([data-sidebar='collapsed']) .sb-link.group-closed { display: flex; }
  html:not([data-sidebar='collapsed']) .sb-link.sb-sub.group-closed { display: none; }
  .sb-nav { min-width: 0; }
  .sb-link { flex-direction: column; justify-content: center; gap: 3px; height: 52px; padding: 0 12px; font-size: 10.5px; border-radius: 12px; flex: 0 0 auto; min-width: 68px; max-width: 96px; }
  .sb-link > i { font-size: 19px; }
  .sb-link.active::before { left: 50%; top: 2px; bottom: auto; width: 22px; height: 3px; transform: translateX(-50%); border-radius: 0 0 3px 3px; background: linear-gradient(90deg, #8b83ff, #e0408a); }
  .sb-badge { position: absolute; top: 3px; right: 16px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 4px; }
  .sb-user { margin: 0; padding: 0; border: 0; background: none; }
  .sb-avatar { display: none; }
  .sb-tools { margin: 0; }
  html[data-sidebar='collapsed'] .sb-label { display: inline; }
  html[data-sidebar='collapsed'] .sb-link { padding: 0 12px; }
  html[data-sidebar='collapsed'] .sb-link::after, html[data-sidebar='collapsed'] .sb-tool::after { display: none; }
  html[data-sidebar='collapsed'] .sb-user { padding: 0; }
  html[data-sidebar='collapsed'] .sb-tools { flex-direction: row; }
  html[data-sidebar='collapsed'] .sb-badge { top: 3px; right: 16px; }
  .page { padding: 22px 16px 40px; }
  .page-head h1 { font-size: 23px; }
  .toasts { top: 10px; right: 10px; left: 10px; width: auto; }
  .card-head { padding: 13px 16px; }
  .card-body { padding: 16px; }
}


/* ---------------------------------------------------------------------------
   7. Motion
   --------------------------------------------------------------------------- */

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fade-out 0.14s ease both; }
::view-transition-new(root) { animation: fade-in 0.22s ease both; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-once { from { transform: rotate(-90deg) scale(0.7); } to { transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes pulse-badge { 0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.55); } 50% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px) scale(0.96); } }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes blob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(60px, 40px) scale(1.12); } 66% { transform: translate(-30px, 70px) scale(0.92); } }
@keyframes demo-in {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  4%, 86% { opacity: 1; transform: none; }
  94%, 100% { opacity: 0; transform: translateY(-6px); }
}
@keyframes press { 0%, 38%, 46%, 100% { transform: scale(1); } 42% { transform: scale(0.9); box-shadow: 0 0 0 6px rgba(79, 70, 229, 0.25); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
  .demo-msg { opacity: 1; }
}
.sb-sub{padding-left:44px;font-size:13px;opacity:.9}
