/* ==========================================================================
   SENDLINKS — design system (light theme)
   Mobile-first. Plain CSS. No framework.

   White page, white cards, hairline borders and soft shadows doing the
   separating. The chart palette below is the validated LIGHT set, checked
   against the #FFFFFF card surface it actually renders on.
   ========================================================================== */

/* ---------- 1. TOKENS ---------------------------------------------------- */
:root {
  color-scheme: light;

  /* surfaces */
  --bg:            #FFFFFF;   /* page plane */
  --surface:       #FFFFFF;   /* card + chart surface — palette validated on this */
  --surface-2:     #F4F5F8;   /* inputs, wells, thumbnails */
  --surface-3:     #E7E9EF;   /* hover, tracks */
  --border:        #E4E6EC;
  --border-soft:   rgba(16,24,40,.08);

  /* ink */
  --ink:           #14161C;
  --ink-2:         #4C5361;
  --ink-3:         #656B78;   /* 5.4:1 on white, 5.0:1 on surface-2 */
  --ink-4:         #8A91A0;   /* decorative only: placeholders, field icons */

  /* brand — gradient stops chosen so white text on them still clears AA */
  --accent:        #4F46E5;
  --accent-hi:     #4338CA;
  --accent-lo:     #4338CA;
  --accent-wash:   rgba(79,70,229,.09);
  --accent-2:      #0E8FD6;
  --grad:          linear-gradient(135deg, #5B4CE0 0%, #1D6FD0 100%);
  --grad-soft:     linear-gradient(135deg, rgba(91,76,224,.09), rgba(29,111,208,.06));

  /* status (reserved — never used as a series color) */
  --good:          #0CA30C;
  --warning:       #FAB219;
  --serious:       #EC835A;
  --critical:      #D03B3B;
  --good-wash:     rgba(12,163,12,.11);
  --warning-wash:  rgba(250,178,25,.16);
  --critical-wash: rgba(208,59,59,.10);
  /* darker steps for status *text*, which needs 4.5:1 on white */
  --good-ink:      #067806;
  --warning-ink:   #8A5B00;
  --critical-ink:  #B42318;

  /* chart series — validated light palette (see README) */
  --series-1: #2A78D6;  --series-2: #EB6834;  --series-3: #1BAF7A;
  --series-4: #EDA100;  --series-5: #E87BA4;  --series-6: #008300;
  --series-7: #4A3AA7;  --series-8: #E34948;
  /* sequential blue ramp, light → dark */
  --seq-1: #86B6EF; --seq-2: #5598E7; --seq-3: #2A78D6; --seq-4: #1C5CAB; --seq-5: #0D366B;
  --meter-track: #DCE9FA;
  --grid:      #EBEDF1;
  --axis:      #D3D6DE;

  /* engagement bands */
  --hot:  #B42318;  --warm: #8A5B00;  --cool: #1C5CAB;  --cold: #656B78;

  /* geometry */
  --r-sm: 9px; --r: 14px; --r-lg: 20px; --r-xl: 26px; --r-pill: 999px;
  --pad: 16px;
  --shadow:    0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.07);
  --shadow-lg: 0 16px 40px -10px rgba(16,24,40,.20), 0 4px 12px rgba(16,24,40,.06);
  --ring:      0 0 0 3px rgba(79,70,229,.22);
  --nav-h: 62px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.32,.72,0,1);
}

/* ---------- 2. RESET ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent-hi); text-decoration: none; }
a:hover { color: var(--accent); }
h1,h2,h3,h4,p,ul,ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
:focus-visible { outline: 0; box-shadow: var(--ring); border-radius: var(--r-sm); }
::selection { background: rgba(79,70,229,.18); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D6D9E0; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #C2C6D0; }

/* ---------- 3. TYPE ------------------------------------------------------ */
.h1 { font-size: 25px; font-weight: 800; letter-spacing: -.6px; line-height: 1.2; }
.h2 { font-size: 19px; font-weight: 750; letter-spacing: -.35px; }
.h3 { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.sub { color: var(--ink-2); font-size: 14px; }
.muted { color: var(--ink-3); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.mono-n { font-variant-numeric: tabular-nums; }
.bold { font-weight: 700; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grad-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px;
       border-radius: 5px; font-size: .9em; }

/* ---------- 4. LAYOUT ---------------------------------------------------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 640px; }
.page { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.wrap-flex { flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); }
.g-4 { grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); }
.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-20{margin-top:20px}
.mt-24{margin-top:24px}.mt-32{margin-top:32px}
.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.hide { display: none !important; }

/* ---------- 5. TOP BAR --------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { display: flex; align-items: center; gap: 12px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px;
         letter-spacing: -.4px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: 0 3px 10px rgba(79,70,229,.3);
}
/* The glyph is drawn edge-to-edge in its 64 viewBox with its own optical inset,
   so it fills the tile rather than sitting in it like a font icon would. */
.brand-mark .logo-glyph { width: 100%; height: 100%; display: block; }
.brand-word { line-height: 1; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--border);
  transition: .16s var(--ease); position: relative; flex: none;
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--critical); border: 2px solid var(--surface);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad); flex: none;
  display: grid; place-items: center; font-weight: 750; font-size: 13px; color: #fff;
  object-fit: cover; overflow: hidden;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

/* ---------- 6. BOTTOM NAV (mobile) --------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: grid; grid-template-columns: repeat(5,1fr);
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; height: var(--nav-h); color: var(--ink-3); font-size: 10.5px; font-weight: 600;
  transition: color .15s; position: relative;
}
.tab i { font-size: 18px; }
.tab.on { color: var(--accent-hi); }
.tab.on::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.tab-fab { position: relative; }
.tab-fab .fab {
  width: 44px; height: 44px; border-radius: 15px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 18px; margin-top: -12px;
  box-shadow: 0 8px 20px -6px rgba(79,70,229,.55);
}

/* ---------- 7. CARDS ----------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--pad); box-shadow: var(--shadow);
}
.card-flush { padding: 0; overflow: hidden; }
.card-hd { padding: 15px 16px; border-bottom: 1px solid var(--border); display: flex;
           align-items: center; justify-content: space-between; gap: 10px; }
.card-bd { padding: 16px; }
.card-ft { padding: 13px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.card-hover { transition: .18s var(--ease); }
.card-hover:hover { border-color: #D3D7E0; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
/* The brand tint is built from rgba stops, so it has to sit on an opaque base —
   otherwise a `.card-accent` used as a sticky bar lets the page scroll through it. */
.card-accent {
  background-color: var(--surface); background-image: var(--grad-soft);
  border-color: rgba(79,70,229,.22);
}

/* Sticky action bar (the send row on share.php). Same tinted card, but it has to
   survive content scrolling underneath, so it gets a real lift and an opaque base. */
.action-bar {
  position: sticky; z-index: 20;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  box-shadow: var(--shadow-lg);
}
.action-bar .btn-row { display: flex; gap: 9px; margin-top: 12px; }
.action-bar .btn-row .btn { flex: 1; min-width: 0; }
@media (min-width: 900px) { .action-bar { bottom: 16px; } }

.section-title { display: flex; align-items: center; justify-content: space-between;
                 gap: 12px; margin: 26px 0 12px; }

/* ---------- 8. BUTTONS --------------------------------------------------- */
/* TWO RULES FOR ANYONE EDITING THIS BLOCK — both were learned the hard way.
   1. Variants are written `.btn.btn-x` (0,2,0), never `.btn-x` (0,1,0), so they
      outrank both `.btn:hover` (0,1,1) and context rules like `.sidenav a`
      (0,1,1) no matter what order the file ends up in.
   2. Every variant :hover must restate `background` in full. `background` is a
      shorthand: `.btn:hover`'s `background: var(--surface-2)` also resets
      `background-image` to none, so a gradient button that only tweaks `filter`
      on hover loses its gradient and renders white text on a white pill. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 13px; font-weight: 650; font-size: 14.5px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  transition: .16s var(--ease); white-space: nowrap; text-align: center;
  box-shadow: var(--shadow);
}
.btn:hover  { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: scale(.975); }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }

.btn.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 12px -4px rgba(79,70,229,.5);
}
.btn.btn-primary:hover {
  background: var(--accent-lo); border-color: var(--accent-lo); color: #fff;
}

.btn.btn-grad {
  background: var(--grad); border: 0; color: #fff;
  box-shadow: 0 5px 16px -5px rgba(79,70,229,.55);
}
.btn.btn-grad:hover {
  background: var(--grad); color: #fff; filter: brightness(1.07);
  box-shadow: 0 7px 20px -5px rgba(79,70,229,.62);
}

/* Ghost is transparent by design, so it only works on an untinted plane.
   On a tinted or sticky surface use the plain `.btn` instead. */
.btn.btn-ghost {
  background: transparent; border-color: var(--border); color: var(--ink-2); box-shadow: none;
}
.btn.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn.btn-danger {
  background: var(--critical-wash); border-color: rgba(208,59,59,.28);
  color: var(--critical-ink); box-shadow: none;
}
.btn.btn-danger:hover { background: rgba(208,59,59,.16); color: #8E1B12; }
.btn-sm { height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn-xs { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 15px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn.is-loading .fa-spinner { display: inline-block; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 9. FORMS ----------------------------------------------------- */
.field { margin-bottom: 15px; }
.label { display: block; font-size: 13px; font-weight: 650; color: var(--ink-2); margin-bottom: 7px; }
.label .req { color: var(--critical); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 13px;
  background: var(--surface); border: 1px solid #D9DCE4; color: var(--ink);
  transition: .15s var(--ease); font-size: 15px; /* 15px+ stops iOS zoom-on-focus */
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); outline: 0;
}
.input.err, .textarea.err { border-color: var(--critical); }
.select {
  appearance: none; -webkit-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 fill='%23737B8C' d='M6 8 0 1.4 1.4 0 6 4.8 10.6 0 12 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.err-msg { font-size: 12.5px; color: var(--critical-ink); margin-top: 6px; }
.input-group { position: relative; }
.input-group .input { padding-left: 42px; }
.input-group > i {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); font-size: 14px; pointer-events: none;
}
.input-group .in-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px;
         color: var(--ink-2); user-select: none; }
.check input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; flex: none;
  border: 1.5px solid #C9CDD7; border-radius: 6px; background: var(--surface);
  margin-top: 1px; transition: .14s; position: relative; cursor: pointer; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after {
  content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: #fff;
  font-size: 10px; position: absolute; inset: 0; display: grid; place-items: center;
}
.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 100%; height: 100%; margin: 0;
  background: #D3D7E0; border-radius: var(--r-pill); transition: .2s var(--ease); cursor: pointer; }
.switch input:checked { background: var(--accent); }
.switch input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; transition: .2s var(--ease);
  box-shadow: 0 1px 3px rgba(16,24,40,.28);
}
.switch input:checked::after { transform: translateX(19px); }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
       border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 650;
              color: var(--ink-3); transition: .15s; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.seg-block { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }

/* ---------- 10. BADGES / PILLS ------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px;
  border-radius: 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .1px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge i { font-size: 9.5px; }
.badge-good     { background: var(--good-wash);     color: var(--good-ink); }
.badge-warning  { background: var(--warning-wash);  color: var(--warning-ink); }
.badge-critical { background: var(--critical-wash); color: var(--critical-ink); }
.badge-accent   { background: var(--accent-wash);   color: var(--accent-hi); }
.badge-pro      { background: var(--grad); color: #fff; }
.badge-hot  { background: rgba(180,35,24,.10);  color: var(--hot); }
.badge-warm { background: rgba(250,178,25,.18); color: var(--warm); }
.badge-cool { background: rgba(42,120,214,.11); color: var(--cool); }
.badge-cold { background: var(--surface-2);     color: var(--cold); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--ink-2); transition: .15s; white-space: nowrap;
}
.chip:hover { color: var(--ink); border-color: #D3D7E0; background: var(--surface-2); }
.chip.on { background: var(--accent-wash); border-color: rgba(79,70,229,.35); color: var(--accent-hi); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
            scrollbar-width: none; -ms-overflow-style: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* ---------- 11. STAT TILES ----------------------------------------------- */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -.9px; line-height: 1.15; }
.stat-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; }
.delta.up   { color: var(--good-ink); }
.delta.down { color: var(--critical-ink); }
.delta.flat { color: var(--ink-3); }
.hero-figure { font-size: 48px; font-weight: 800; letter-spacing: -2px; line-height: 1; }

/* meter — unfilled track is a lighter step of the fill's own ramp */
.meter { height: 7px; border-radius: 4px; background: var(--meter-track); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--series-1);
                transition: width .5s var(--ease); }
.meter.good > span    { background: var(--good); }
.meter.warning > span { background: var(--warning); }
.meter.critical > span{ background: var(--critical); }

/* ---------- 12. LIST ROWS ------------------------------------------------ */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--border); transition: background .14s; min-width: 0;
  color: var(--ink);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); color: var(--ink); }
.list-row .grow { min-width: 0; }
.thumb {
  width: 52px; height: 52px; border-radius: 12px; flex: none; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center;
  color: var(--ink-3); font-size: 17px; position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.wide { width: 84px; height: 52px; }

/* ---------- collection preview mosaic -----------------------------------
   The old version stretched every preview to full width at a fixed 56px, so a
   collection holding one or two assets rendered as a letterboxed sliver. This
   is a fixed 16:9 plate that re-tiles itself by how many previews there are, so
   1, 2, 3 and 4 all look deliberate. */
.col-preview {
  display: grid; gap: 2px; aspect-ratio: 16 / 9; width: 100%;
  border-radius: 12px; overflow: hidden; position: relative;
  background: var(--surface-3); border: 1px solid var(--border);
  grid-template-columns: 1fr; grid-template-rows: 1fr;
}
.col-preview .cp {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center;
  color: var(--ink-3); font-size: 16px;
}
.col-preview .cp img { width: 100%; height: 100%; object-fit: cover; }
.col-preview[data-n="2"] { grid-template-columns: 1fr 1fr; }
.col-preview[data-n="3"],
.col-preview[data-n="4"] { grid-template-columns: 1.62fr 1fr; grid-template-rows: 1fr 1fr; }
.col-preview[data-n="3"] .cp:first-child,
.col-preview[data-n="4"] .cp:first-child { grid-row: span 2; }
.col-preview[data-n="4"] .cp:nth-child(4) { display: none; }   /* 4th becomes the +N badge */
.col-preview .cp-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(12,14,20,.28); color: #fff; font-size: 15px;
}
.col-preview .cp-more {
  position: absolute; right: 7px; bottom: 7px; z-index: 2;
  background: rgba(12,14,20,.78); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 7px; backdrop-filter: blur(4px);
}
.col-preview.is-empty { background: var(--grad-soft); border-color: rgba(79,70,229,.18); }
.col-preview.is-empty .cp { background: none; color: var(--accent-hi); font-size: 20px; }
.thumb .play-dot {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.32); color: #fff; font-size: 15px;
}
.dur-tag { position: absolute; right: 4px; bottom: 4px; background: rgba(20,22,28,.82);
           color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px; }

/* ---------- 13. EMPTY / SKELETON ----------------------------------------- */
.empty { text-align: center; padding: 46px 22px; }
.empty-icon {
  width: 66px; height: 66px; border-radius: 22px; margin: 0 auto 16px;
  background: var(--grad-soft); border: 1px solid rgba(79,70,229,.18);
  display: grid; place-items: center; font-size: 25px; color: var(--accent-hi);
}
.skeleton { background: linear-gradient(90deg, #F1F2F6 25%, #E7E9EF 50%, #F1F2F6 75%);
            background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 14. MODAL / SHEET -------------------------------------------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(20,22,28,.42); z-index: 200;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .22s var(--ease);
}
.backdrop.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-top: 1px solid var(--border);
  max-height: 92vh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .3s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -16px 48px rgba(16,24,40,.18);
}
.sheet.on { transform: translateY(0); }
.sheet-grab { width: 40px; height: 4px; border-radius: 3px; background: #D9DCE4;
              margin: 10px auto 2px; flex: none; }
.sheet-hd { padding: 10px 18px 14px; display: flex; align-items: center; justify-content: space-between;
            gap: 12px; border-bottom: 1px solid var(--border); flex: none; }
.sheet-bd { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-ft { padding: 14px 18px; border-top: 1px solid var(--border); flex: none;
            background: var(--surface); }

/* ---------- 15. TOAST ---------------------------------------------------- */
#toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  z-index: 400; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px);
  max-width: 400px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 550;
  animation: toastIn .28s var(--ease); pointer-events: auto;
}
.toast.ok  i { color: var(--good); }
.toast.err i { color: var(--critical); }
.toast.info i { color: var(--accent); }
.toast.out { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------- 16. CHART SHELL ---------------------------------------------- */
.chart-card { background: var(--surface); border: 1px solid var(--border);
              border-radius: var(--r-lg); padding: 16px 16px 10px; box-shadow: var(--shadow); }
.chart-hd { display: flex; align-items: flex-start; justify-content: space-between;
            gap: 12px; margin-bottom: 4px; }
.chart-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; }
.chart-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; padding-top: 10px;
          border-top: 1px solid var(--border); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.legend-key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-key.line { width: 14px; height: 2px; border-radius: 2px; }

.tip {
  position: absolute; z-index: 30; pointer-events: none; opacity: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 9px 11px; font-size: 12.5px; line-height: 1.5; white-space: nowrap;
  box-shadow: var(--shadow-lg); transition: opacity .12s; color: var(--ink);
  transform: translate(-50%, -100%);
}
.tip.on { opacity: 1; }
.tip-title { font-weight: 700; margin-bottom: 3px; }
.tip-row { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.tip-row b { color: var(--ink); font-variant-numeric: tabular-nums; }

.axis-txt { fill: #898781; font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.grid-line { stroke: var(--grid); stroke-width: 1; }
.axis-line { stroke: var(--axis); stroke-width: 1; }

/* data table fallback (accessibility) */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--ink-3); font-weight: 650; font-size: 12px; }
.data-table td { font-variant-numeric: tabular-nums; }
.table-toggle { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.table-toggle:hover { color: var(--accent-hi); }

/* ---------- 17. TIMELINE ------------------------------------------------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px;
                    width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -28px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2); border: 2px solid var(--surface); display: grid; place-items: center;
  font-size: 9px; color: var(--ink-2); box-shadow: 0 0 0 1px var(--border);
}
.tl-dot.hi { background: var(--accent); color: #fff; box-shadow: none; }
.tl-dot.good { background: var(--good); color: #fff; box-shadow: none; }
.tl-time { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- 18. LOCKED / UPSELL ------------------------------------------ */
.locked { position: relative; }
.locked > .locked-content { filter: blur(6px); opacity: .5; pointer-events: none; user-select: none; }
.lock-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px;
  background: radial-gradient(120% 90% at 50% 50%, rgba(255,255,255,.72), rgba(255,255,255,.94));
  border-radius: var(--r-lg); z-index: 5;
}
.lock-badge {
  width: 42px; height: 42px; border-radius: 14px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 16px;
  box-shadow: 0 5px 16px -5px rgba(79,70,229,.6);
}
.upsell-bar {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: var(--r);
  background: var(--grad-soft); border: 1px solid rgba(79,70,229,.22);
}

/* ---------- 19. PROGRESS RING -------------------------------------------- */
.ring { position: relative; width: 46px; height: 46px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: var(--series-1); stroke-linecap: round; transition: stroke-dashoffset .7s var(--ease); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center;
             font-size: 11.5px; font-weight: 750; font-variant-numeric: tabular-nums; }

/* ---------- 20. COPY FIELD ----------------------------------------------- */
.copy-field {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 13px; padding: 5px 5px 5px 14px;
}
.copy-field input { flex: 1; min-width: 0; background: none; border: 0; height: 38px;
                    font-size: 13.5px; color: var(--ink-2); outline: 0; }

/* ---------- 21. RESPONSIVE ----------------------------------------------- */
@media (min-width: 900px) {
  :root { --pad: 20px; }
  body { font-size: 15px; }
  .tabbar { display: none; }
  .page { padding-bottom: 60px; }
  .h1 { font-size: 30px; }
  .app-shell { display: grid; grid-template-columns: 232px 1fr; gap: 26px; align-items: start; }
  .sidenav { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 3px; }
  .sidenav a {
    display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 12px;
    color: var(--ink-2); font-weight: 620; font-size: 14.5px; transition: .15s;
  }
  .sidenav a i { width: 19px; text-align: center; font-size: 15px; }
  .sidenav a:hover { background: var(--surface-2); color: var(--ink); }
  .sidenav a.on { background: var(--accent-wash); color: var(--accent-hi); }
  /* `.sidenav a` (0,1,1) outranks the bare `.btn` (0,1,0), so a button dropped
     into the sidebar would otherwise inherit nav-link ink and a nav hover fill.
     `:where()` contributes no specificity, so this pair stays at (0,1,1) — high
     enough to beat `.btn`, low enough that the `.btn.btn-*` variants (0,2,0)
     keep their own colours without needing a sidebar copy of each one. */
  .sidenav a:where(.btn)       { color: var(--ink); background: var(--surface); }
  .sidenav a:where(.btn):hover { color: var(--ink); background: var(--surface-2); }
  .sidenav .sn-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
                       color: var(--ink-3); font-weight: 700; padding: 16px 13px 6px; }
  .sidenav .sn-lock { margin-left: auto; width: auto; font-size: 11px; color: var(--ink-3); }
  .g-2 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .modal-center {
    position: fixed; inset: 0; z-index: 210; display: grid; place-items: center; padding: 24px;
    pointer-events: none;
  }
  .modal-center .sheet {
    position: relative; inset: auto; max-width: 560px; width: 100%; border-radius: var(--r-xl);
    border: 1px solid var(--border); transform: translateY(16px) scale(.98); opacity: 0;
    pointer-events: auto; max-height: 86vh;
  }
  .modal-center .sheet.on { transform: translateY(0) scale(1); opacity: 1; }
  .sheet-grab { display: none; }
  #toasts { bottom: 24px; }
}
@media (max-width: 899px) {
  .sidenav { display: none; }
  .desktop-only { display: none !important; }
}
@media (min-width: 900px) { .mobile-only { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
