/* Tanki Ops: design system.
   Mirrors the Tanki app's v3 language (theme.jsx): flat surfaces, Geist,
   hairlines that feather at their ends, colour only where it means
   something. Never left-border accents; never glows.
   Layout: sidebar >= 1000px, icon rail 720-999px, top bar + bottom tabs
   below 720px. */

:root {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-hi: #1c1c1f;
  --surface-top: #232327;
  --inset: rgba(255,255,255,.04);
  --line: rgba(255,255,255,.07);
  --line-hi: rgba(255,255,255,.12);
  --text: #fafafa;
  --text2: #a1a1aa;
  --text3: #71717a;
  --text4: #52525b;
  --green: #34d399;
  --green-bg: rgba(52,211,153,.12);
  --amber: #fbbf24;
  --amber-bg: rgba(251,191,36,.12);
  --red: #f87171;
  --red-bg: rgba(248,113,113,.12);
  --blue: #60a5fa;
  --blue-bg: rgba(96,165,250,.12);
  --e10: #22c55e;
  --b7: #0ea5e9;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  --radius: 18px;
  --radius-sm: 12px;
  --gutter: 20px;
  --tabbar-h: 58px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--sans); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.028em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
::selection { background: rgba(255,255,255,.18); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 8px; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); letter-spacing: -0.01em; }
.muted { color: var(--text2); }
.faint { color: var(--text3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Feathered hairline: fades at both ends instead of stopping dead. */
.hr { height: 1px; border: 0; margin: 20px 0; background: linear-gradient(90deg, transparent, var(--line-hi) 16%, var(--line-hi) 84%, transparent); }

/* ---------- App frame ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px 18px; view-transition-name: side;
  background: linear-gradient(180deg, rgba(255,255,255,.015), transparent 40%);
}
.side::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: linear-gradient(180deg, transparent, var(--line) 12%, var(--line) 88%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; text-decoration: none; }
.brand svg { height: 21px; width: auto; }
.brand .tag { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text3); padding: 4px 6px; border-radius: 6px; background: var(--inset); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px;
  border-radius: 12px; color: var(--text2); text-decoration: none; font-weight: 500; font-size: 14.5px;
  transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--inset); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-hi); }
.count { font-style: normal; }
.nav a .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font: 600 11px/1 var(--mono); background: var(--text); color: var(--bg); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text3); font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-top); color: var(--text); font: 600 12px/1 var(--sans); text-transform: uppercase; }

.main { min-width: 0; padding: 34px clamp(20px, 3.4vw, 44px) 80px; view-transition-name: main; }
.wrap { max-width: 1180px; margin: 0 auto; }

/* Mobile top bar + bottom tabs */
.topbar, .tabbar { display: none; }

@media (max-width: 999px) and (min-width: 720px) {
  .app { grid-template-columns: 76px minmax(0, 1fr); }
  .side { padding: 20px 12px; align-items: center; }
  .brand { padding: 4px 0 22px; }
  .brand svg { height: 16px; }
  .brand .tag, .nav a span, .side-user span { display: none; }
  .nav a { width: 48px; height: 46px; justify-content: center; padding: 0; }
  .nav a .count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 16px; font-size: 10px; }
}
@media (max-width: 719px) {
  .app { display: block; }
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40;
    height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
    background: rgba(10,10,11,.78); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
    view-transition-name: topbar;
  }
  .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent); }
  .topbar .brand { padding: 0; }
  .topbar .brand svg { height: 18px; }
  .topbar .spacer { flex: 1; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(14,14,16,.86); -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
    view-transition-name: tabbar;
  }
  .tabbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line-hi) 15%, var(--line-hi) 85%, transparent); }
  .tabbar a { position: relative; display: flex; align-items: center; justify-content: center; color: var(--text4); text-decoration: none; transition: color .2s; -webkit-tap-highlight-color: transparent; }
  .tabbar a svg.i { width: 24px; height: 24px; transition: transform .25s var(--ease), color .2s; }
  .tabbar a:active svg.i { transform: scale(.86); }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a[aria-current="page"] svg.i { stroke-width: 2.2; animation: pop .3s var(--ease); }
  .tabbar a .count { position: absolute; top: 10px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center; font: 600 10px/1 var(--mono); background: var(--text); color: var(--bg); }
  .main { padding: 18px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); }
}

/* ---------- Page header ---------- */
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; margin-bottom: 26px; }
.ph-text { flex: 1 1 320px; min-width: 0; }
.ph .eyebrow { font: 500 11.5px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--text3); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.ph h1 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.08; letter-spacing: -0.04em; }
.ph p { margin-top: 8px; color: var(--text2); max-width: 62ch; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text3); text-decoration: none; font-size: 13.5px; margin-bottom: 14px; transition: color .2s; }
.back:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-weight: 600; font-size: 14px; letter-spacing: -0.01em;
  background: var(--surface-hi); color: var(--text); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, box-shadow .2s, transform .15s var(--ease), opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-top); box-shadow: inset 0 0 0 1px var(--line-hi); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--text); color: var(--bg); box-shadow: none; }
.btn-primary:hover { background: #e4e4e7; box-shadow: none; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--text2); }
.btn-ghost:hover { background: var(--inset); color: var(--text); box-shadow: none; }
.btn-danger { background: var(--red-bg); color: var(--red); box-shadow: none; }
.btn-danger:hover { background: rgba(248,113,113,.2); box-shadow: none; }
.btn-success { background: var(--green-bg); color: var(--green); box-shadow: none; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; border-radius: 14px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn .i { width: 16px; height: 16px; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent; animation: spin .7s linear infinite; }
.btn-primary.is-loading::after { border-color: var(--bg) transparent var(--bg) transparent; }
.btn.is-done { background: var(--green-bg); color: var(--green); box-shadow: none; }

/* ---------- Cards & surfaces ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-head h2, .card-head h3 { font-size: 16px; letter-spacing: -0.02em; }
.card-body { padding: 16px 20px 20px; }
.section { margin-top: 32px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 18px; }
.section-title a { color: var(--text3); font-size: 13.5px; text-decoration: none; }
.section-title a:hover { color: var(--text); }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
@media (max-width: 719px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; } .grid-4 .stat { padding: 14px 16px; } .grid-4 .stat .v { font-size: 26px; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- Stats ---------- */
.stat { padding: 18px 20px; }
.stat .k { font-size: 13px; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.stat .v { margin-top: 10px; font: 500 30px/1 var(--mono); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .5em; color: var(--text3); margin-left: 2px; letter-spacing: 0; }
.stat .s { margin-top: 8px; font-size: 12.5px; color: var(--text3); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-live { animation: breathe 2.4s ease-in-out infinite; }

/* ---------- Badges, chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--inset); color: var(--text2); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-solid { background: var(--text); color: var(--bg); }
.grade { display: inline-grid; place-items: center; min-width: 30px; height: 20px; padding: 0 6px; border-radius: 6px; font: 700 10.5px/1 var(--mono); color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }

/* Segmented control (links or radio labels) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg label { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; color: var(--text2); text-decoration: none; font-size: 13px; font-weight: 550; white-space: nowrap; cursor: pointer; transition: background .2s, color .2s; }
.seg a:hover, .seg label:hover { color: var(--text); }
.seg a[aria-current="page"], .seg input:checked + label, .seg label.is-on { background: var(--surface-top); color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .n { font: 500 11.5px/1 var(--mono); color: var(--text3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 999px; background: var(--surface-hi); box-shadow: inset 0 0 0 1px var(--line); color: var(--text2); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all .2s var(--ease); user-select: none; }
.chip span:hover { color: var(--text); }
.chip input:checked + span { background: var(--text); color: var(--bg); box-shadow: none; }
.chip input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 16px; }
.label { font-size: 13px; font-weight: 550; color: var(--text2); display: flex; justify-content: space-between; gap: 12px; }
.label .opt { color: var(--text4); font-weight: 450; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 0; outline: 0;
  background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-hi);
  transition: box-shadow .2s, background .2s;
}
.input::placeholder, .textarea::placeholder { color: var(--text4); }
.input:hover, .select:hover, .textarea:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.input:focus, .select:focus, .textarea:focus { box-shadow: inset 0 0 0 1.5px var(--text); background: #0d0d0f; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input-lg { min-height: 54px; font-size: 18px; }
.input-code { text-align: center; font: 600 22px/1 var(--mono); letter-spacing: .3em; text-transform: uppercase; }
.hint { font-size: 12.5px; color: var(--text3); }
.error-text { font-size: 13px; color: var(--red); }
.input-group { position: relative; }
.input-group .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
.input-group .input { padding-left: 42px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--text); }

/* ---------- Lists / tables ---------- */
.list { display: flex; flex-direction: column; }
.list-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 20px; text-decoration: none; color: inherit; transition: background .2s; }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 20px; right: 20px; height: 1px; background: linear-gradient(90deg, var(--line), var(--line) 75%, transparent); }
a.list-row:hover, .list-row.is-link:hover { background: var(--inset); }
.list-row .main-col { flex: 1; min-width: 0; }
.list-row .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: 13px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.list-row .chev { color: var(--text4); transition: transform .2s var(--ease), color .2s; }
a.list-row:hover .chev { transform: translateX(3px); color: var(--text2); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 500 11px/1.4 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--text3); padding: 14px 16px 10px; white-space: nowrap; }
.table td { padding: 13px 16px; vertical-align: middle; background: linear-gradient(90deg, var(--line), var(--line)) top / 100% 1px no-repeat; }
.table tr:hover td { background-color: var(--inset); }
.table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
@media (max-width: 719px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; padding: 12px 16px; position: relative; }
  .table.responsive tr + tr::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--line); }
  .table.responsive td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; background: none; }
  .table.responsive td::before { content: attr(data-label); color: var(--text3); font-size: 12.5px; }
  .table.responsive td.full::before { display: none; }
}

/* ---------- Empty, skeleton ---------- */
.empty { text-align: center; padding: 56px 24px; }
.empty .icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-hi); color: var(--text2); }
.empty .icon svg.i { width: 24px; height: 24px; }
.empty h3 { font-size: 18px; }
.empty p { margin: 6px auto 0; color: var(--text2); max-width: 44ch; }
.empty .btn { margin-top: 18px; }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ---------- Toasts (flash) ---------- */
.toasts { position: fixed; z-index: 90; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border-radius: 14px; background: rgba(28,28,31,.94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 16px 40px rgba(0,0,0,.45), inset 0 0 0 1px var(--line-hi); font-size: 14px; animation: toastIn .4s var(--ease) both; }
.toast .i { margin-top: 1px; }
.toast-success .i { color: var(--green); }
.toast-error .i { color: var(--red); }
.toast-info .i { color: var(--blue); }
.toast .x { margin-left: auto; background: none; border: 0; color: var(--text3); cursor: pointer; padding: 0 2px; font-size: 18px; line-height: 1; }
.toast.out { animation: toastOut .3s var(--ease) both; }
@media (max-width: 719px) { .toasts { top: auto; right: 16px; left: 16px; width: auto; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); } }

/* Inline notices (not toasts) */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--inset); font-size: 14px; color: var(--text2); }
.notice .i { margin-top: 2px; color: var(--text2); }
.notice b { color: var(--text); font-weight: 600; }
.notice-amber { background: var(--amber-bg); }
.notice-amber .i { color: var(--amber); }
.notice-red { background: var(--red-bg); }
.notice-red .i { color: var(--red); }
.notice-green { background: var(--green-bg); }
.notice-green .i { color: var(--green); }

/* ---------- Dialog / sheet ---------- */
dialog.dlg { border: 0; padding: 0; color: var(--text); background: var(--surface); border-radius: 22px; width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 0 0 1px var(--line-hi); }
dialog.dlg[open] { animation: pop .28s var(--ease); }
dialog.dlg::backdrop { background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s ease; }
.dlg-body { padding: 22px 22px 8px; }
.dlg-body h3 { font-size: 19px; }
.dlg-body p { margin-top: 8px; color: var(--text2); }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 22px 22px; }
dialog.dlg-wide { width: min(760px, calc(100vw - 32px)); }
@media (max-width: 719px) {
  dialog.dlg { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog.dlg[open] { animation: sheetUp .38s var(--ease); }
  .dlg-actions { flex-direction: column-reverse; }
  .dlg-actions .btn { width: 100%; height: 48px; }
}

/* ---------- Auth pages ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 45%, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse 60% 55% at 50% 45%, #000 10%, transparent 70%); opacity: .6; }
.auth-card { position: relative; width: min(400px, 100%); padding: 32px 28px 28px; animation: rise .6s var(--ease) both; }
.auth-card .brand { justify-content: center; padding: 0 0 26px; }
.auth-card .brand svg { height: 26px; }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-card .lede { text-align: center; color: var(--text2); margin: 6px 0 24px; font-size: 14px; }
.qr { display: grid; place-items: center; padding: 16px; border-radius: 16px; background: #fff; width: fit-content; margin: 0 auto 16px; }
.secret { word-break: break-all; text-align: center; padding: 12px; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-hi); font: 500 14px/1.5 var(--mono); letter-spacing: .08em; }

/* ---------- Queue ---------- */
.q-card { overflow: hidden; }
.q-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 18px 20px 14px; }
.q-head h3 { font-size: 17px; letter-spacing: -0.025em; }
.q-head .when { font-size: 13px; color: var(--text3); }
.q-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 12px; padding: 0 20px; }
.q-asset { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 719px) {
  /* Files swipe sideways on phones so a post stays one screen tall. */
  .q-assets { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding: 0 20px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .q-assets::-webkit-scrollbar { display: none; }
  .q-asset { flex: 0 0 72%; scroll-snap-align: center; }
  .q-asset:only-child { flex-basis: 100%; }
}
.q-thumb { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); aspect-ratio: var(--ar, 4/5); }
.q-thumb img, .q-thumb video { width: 100%; height: 100%; object-fit: cover; }
.q-thumb .kind { position: absolute; left: 8px; top: 8px; height: 22px; padding: 0 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; font: 600 10.5px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: #fff; background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.q-dl { display: flex; flex-wrap: wrap; gap: 6px; }
.q-captions { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 0; }
.q-caption { border-radius: 14px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.q-caption-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; }
.q-caption-head .platforms { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.q-caption pre { margin: 0; padding: 0 14px 14px; white-space: pre-wrap; word-break: break-word; font: 14px/1.55 var(--sans); color: var(--text2); max-height: 220px; overflow: auto; }
.q-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 20px 20px; }
.q-card.is-done { opacity: .62; }
.q-card.is-done .q-assets, .q-card.is-done .q-captions { display: none; }
.plat { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: 999px; background: var(--surface-hi); font-size: 12.5px; font-weight: 550; color: var(--text); }
.plat svg { width: 14px; height: 14px; }

/* ---------- Library ---------- */
.dropzone { position: relative; display: grid; place-items: center; text-align: center; gap: 8px; padding: 34px 20px; border-radius: 20px; background: var(--surface); cursor: pointer; transition: background .25s, transform .25s var(--ease); background-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='none' rx='20' ry='20' stroke='%23ffffff2e' stroke-width='1.5' stroke-dasharray='6%2c 8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dropzone:hover, .dropzone.is-over { background-color: var(--surface-hi); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone .icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-top); }
.dropzone b { font-size: 15.5px; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-top); overflow: hidden; }
.progress > i { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: var(--text); transition: width .3s var(--ease); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 180px), 1fr)); gap: 12px; }
.tile { position: relative; display: block; width: 100%; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; aspect-ratio: 4/5; transition: transform .3s var(--ease), box-shadow .3s; }
.tile:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--line-hi), 0 18px 40px rgba(0,0,0,.35); }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.tile:hover img, .tile:hover video { transform: scale(1.04); }
.tile .meta { position: absolute; inset: auto 0 0 0; padding: 26px 10px 10px; display: flex; flex-wrap: wrap; gap: 4px; background: linear-gradient(transparent, rgba(0,0,0,.72)); }
.tile .meta span { height: 20px; padding: 0 7px; border-radius: 999px; display: inline-flex; align-items: center; font-size: 11px; font-weight: 550; color: #fff; background: rgba(255,255,255,.16); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tile .badge-vid { position: absolute; top: 8px; right: 8px; }
.preview-media { border-radius: 16px; overflow: hidden; background: var(--bg); max-height: 52vh; display: grid; place-items: center; }
.preview-media img, .preview-media video { max-height: 52vh; width: auto; }

/* ---------- Outreach / misc ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; font-size: 14px; }
.kv dt { color: var(--text3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { position: relative; padding: 0 0 20px 26px; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-top); box-shadow: 0 0 0 3px var(--surface); }
.tl-item::after { content: ""; position: absolute; left: 9px; top: 20px; bottom: 2px; width: 1px; background: linear-gradient(var(--line-hi), transparent); }
.tl-item:last-child::after { display: none; }
.tl-item.green::before { background: var(--green); }
.tl-item .t { font-size: 14px; font-weight: 550; }
.tl-item .d { font-size: 12.5px; color: var(--text3); }
.tl-item .b { margin-top: 8px; font-size: 13.5px; color: var(--text2); white-space: pre-wrap; }
.email-preview { border-radius: 16px; background: #fff; color: #111; padding: 22px; font: 15px/1.6 -apple-system, "Segoe UI", sans-serif; white-space: pre-wrap; }
.email-preview .subj { font-weight: 700; margin-bottom: 14px; }
.codeblock { display: inline-flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-hi); font: 600 16px/1 var(--mono); letter-spacing: .12em; }
.spark { width: 100%; height: 44px; }
.spark path { fill: none; stroke: var(--text2); stroke-width: 1.6; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes breathe { 50% { opacity: .35; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(.98); } }
@media (max-width: 719px) { @keyframes toastIn { from { opacity: 0; transform: translateY(12px); } } }

.anim > * { animation: rise .5s var(--ease) both; }
.anim > *:nth-child(2) { animation-delay: .04s; }
.anim > *:nth-child(3) { animation-delay: .08s; }
.anim > *:nth-child(4) { animation-delay: .12s; }
.anim > *:nth-child(5) { animation-delay: .16s; }
.anim > *:nth-child(6) { animation-delay: .2s; }
.anim > *:nth-child(n+7) { animation-delay: .24s; }

/* Cross-document page transitions (Chrome, Safari 18+). */
@view-transition { navigation: auto; }
::view-transition-old(main) { animation: .18s ease both fadeOutDown; }
::view-transition-new(main) { animation: .32s var(--ease) both rise; }
@keyframes fadeOutDown { to { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}

/* ---------- Outreach ---------- */
.o-stat-link { text-decoration: none; transition: background .2s, transform .25s var(--ease); }
.o-stat-link:hover { background: var(--surface-hi); transform: translateY(-2px); }
.o-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .o-detail { grid-template-columns: 1fr; } }
.o-note-form .textarea { resize: vertical; }
.o-compose { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.o-aside { position: sticky; top: 24px; }
@media (max-width: 960px) { .o-compose { grid-template-columns: 1fr; } .o-aside { position: static; order: -1; } }
.o-body { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.o-fixed { white-space: pre-wrap; color: var(--text3); font-size: 14.5px; line-height: 1.6; }
.o-slot { border-radius: 14px; padding: 10px; background: var(--amber-bg); transition: background .25s; }
.o-slot.is-ok { background: var(--inset); }
.o-slot-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 12.5px; font-weight: 550; color: var(--amber); }
.o-slot.is-ok .o-slot-head { color: var(--text2); }
.o-slot .textarea { min-height: 76px; background: var(--surface); }
.o-preview { max-width: 760px; }
.o-mail { border-radius: 20px; overflow: hidden; background: #fff; color: #111; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.o-mail-head { display: flex; flex-direction: column; gap: 8px; padding: 18px 22px; background: #f4f4f5; font: 14px/1.4 -apple-system, "Segoe UI", sans-serif; }
.o-mail-head .row { flex-wrap: nowrap; align-items: baseline; gap: 12px; }
.o-mail-head .faint { color: #71717a; width: 58px; flex-shrink: 0; }
.o-mail-body { border-radius: 0; padding: 22px; }
.o-spark svg { width: 100%; height: 72px; color: var(--text2); }
@media (max-width: 719px) { .o-hide-sm { display: none; } }

/* ---------- Generate now: location field ---------- */
.loc-fields:empty { display: none; }
.loc-fields .loc-field { margin-top: 16px; }
.loc-row { display: flex; gap: 8px; align-items: center; }
.loc-row .input { flex: 1; min-width: 0; }
.js-loc .loc-field[hidden] { display: none; }

