/* ============================================================
   TELEMAMBA DESIGN SYSTEM v2
   Telestars-dark blue-black base · PLATINUM accent (silver/white/dark blue/black) · sharp cards
   Simple like ops-desk. Inter everywhere, mono for money.
   Platinum silver = the brand accent, used boldly (primary buttons, active nav,
   live metrics). Telegram blue ONLY for TG entities.
   ============================================================ */

/* ── Fonts (self-hosted) ── */
@font-face { font-family: "Bebas Neue"; src: url("/fonts/bebas-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/sgro-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/sgro-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jbmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jbmono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* ── Tokens ── */
:root {
  /* surfaces — deep blue-black ladder (Telestars-like) */
  --bg: #070B14;
  --surface: #0C1322;
  --raised: #111A2E;
  --overlay: #16203A;

  /* borders */
  --line: #1B2438;
  --line-strong: #27324A;

  /* text */
  --text: #EEF2F9;
  --text-2: #93A0B8;
  --text-3: #55617A;

  /* brand */
  --acc: #C9D5EA;          /* platinum silver */
  --acc-hover: #E6ECF7;    /* bright platinum */
  --acc-down: #9AA9C4;     /* worn silver */
  --acc-wash: rgba(201, 213, 234, 0.10);
  --acc-glow: rgba(220, 230, 246, 0.22);
  /* platinum metal gradient — the ONE brand finish, reuse everywhere */
  --plat: linear-gradient(180deg, #FFFFFF 0%, #E8EDF5 45%, #98A5BC 100%);

  /* semantic */
  --ok: #2ECC71;
  --ok-wash: rgba(46, 204, 113, 0.13);
  --danger: #FF4D4D;
  --danger-wash: rgba(255, 77, 77, 0.13);
  --warn: #FFB020;
  --tg: #229ED9;
  --tg-wash: rgba(34, 158, 217, 0.13);

  /* type */
  --font-ui: "Inter", -apple-system, sans-serif;
  --font-tech: "Space Grotesk", "Inter", sans-serif;   /* buttons, labels, nav — technical edge */
  --font-display: "Bebas Neue", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* radius — SHARP. Depth via borders, aggression via edges. */
  --r: 2px;        /* cards, drawers, modals */
  --r-sm: 2px;     /* buttons, inputs, nav items */
  --r-full: 2px;   /* badges, segments — sharp too; circles only for dots/avatars */

  /* scale (4px grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;

  /* motion */
  --fast: 120ms ease-out;
  --move: 150ms ease-out;

  --sidebar-w: 200px;
  --topbar-h: 48px;
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; overscroll-behavior-x: none; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--acc); color: #0B0E16; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--acc-down); }

/* ── Typography helpers ── */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}
/* platinum text — silver metallic gradient for display headings */
.platinum {
  background: linear-gradient(180deg, #FFFFFF 0%, #E8EDF5 45%, #98A5BC 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.star-sep { color: var(--acc); font-size: 0.85em; margin: 0 6px; }
.label {
  font-family: var(--font-tech);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--text-3);
}
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.t2 { color: var(--text-2); }
.t3 { color: var(--text-3); }

/* ── Buttons — sharp, bold, platinum primary ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 14px;
  font-family: var(--font-tech);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--raised);
  color: var(--text);
  transition: background var(--fast), border-color var(--fast), color var(--fast), box-shadow var(--fast);
  user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--overlay); border-color: var(--acc); }
.btn:active { background: var(--surface); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid #E6ECF7; outline-offset: 1px; }

.btn-primary {
  background: var(--plat);
  border-color: #FFFFFF; color: #0B0E16;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.6), 0 0 20px var(--acc-glow);
}
.btn-primary:hover { background: linear-gradient(180deg, #FFFFFF 0%, #F2F5FA 55%, #B4C0D6 100%); box-shadow: 3px 3px 0 rgba(0,0,0,0.6), 0 0 26px rgba(220,230,246,0.35); }
.btn-primary:active { box-shadow: 1px 1px 0 rgba(0,0,0,0.6); }

.btn-outline { background: transparent; border-color: var(--acc); color: var(--acc); }
.btn-outline:hover { background: var(--acc-wash); border-color: var(--acc); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--raised); border-color: transparent; color: var(--text); }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #0B0E16; }

.btn-lg { height: 40px; padding: 0 var(--s5); font-size: 13px; border-radius: 2px; }
.btn-sm { height: 24px; padding: 0 var(--s2); font-size: 10.5px; border-radius: 2px; }

/* ── Inputs ── */
.input, .select, .textarea {
  width: 100%; height: 30px; padding: 0 var(--s2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.textarea { height: auto; min-height: 80px; padding: var(--s2) var(--s3); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-wash); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2355617A' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 30px;
}
.field { display: flex; flex-direction: column; gap: var(--s1); margin-bottom: var(--s4); }
.field .label { margin-bottom: 2px; }

/* ── Cards / KPI ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.kpi {
  display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s3) var(--s3) var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.kpi .label { display: flex; align-items: center; justify-content: space-between; }
.kpi .num {
  font-size: 22px; font-weight: 600; line-height: 1.15;
  background: var(--plat);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.kpi .delta { font-size: 11px; font-family: var(--font-mono); color: var(--text-3); }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--danger); }
.kpi.hot { border-color: rgba(201, 213, 234, 0.45); background: linear-gradient(160deg, rgba(220, 230, 246, 0.08), transparent 55%), var(--surface); }
.kpi.hot .num {
  background: var(--plat);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Tables ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  text-align: left; padding: 5px var(--s2);
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3);
  font-family: var(--font-tech);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.tbl td { padding: 7px var(--s2); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background var(--fast); }
.tbl tbody tr:hover { background: var(--raised); box-shadow: inset 3px 0 0 var(--acc); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .num { text-align: right; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }

/* ── Badges & status dots ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 18px; padding: 0 7px;
  font-size: 10px; font-weight: 600;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  background: var(--raised);
}
.badge.acc { background: var(--plat); border-color: #FFFFFF; color: #0B0E16; font-weight: 700; }
.badge.ok { background: var(--ok-wash); border-color: transparent; color: var(--ok); }
.badge.danger { background: var(--danger-wash); border-color: transparent; color: var(--danger); }
.badge.tg { background: var(--tg-wash); border-color: transparent; color: var(--tg); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); }
.dot.danger { background: var(--danger); }
.dot.tg { background: var(--tg); }
.dot.live { background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── Tabs ── */
.tabs { display: flex; gap: var(--s1); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; width: max-content; }
.tab {
  padding: 6px var(--s4); border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: all var(--fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--acc); background: var(--acc-wash); }

/* ── Segbar ── */
.segbar { display: flex; gap: 4px; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; scrollbar-width: none; }
.segbar::-webkit-scrollbar { display: none; }
/* albums (can be dozens per model) — wrap into rows instead of one endless horizontal scroll */
.segbar-wrap {
  display: flex;
  flex-wrap: wrap;
  overflow: visible;
  white-space: normal;
  row-gap: 6px;
  column-gap: 4px;
  max-width: 100%;
}
.seg {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  font-family: var(--font-tech);
  font-size: 10.5px; font-weight: 600; color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: var(--r-full);
  background: var(--raised);
  transition: all 100ms ease-out; flex: none;
  cursor: pointer; user-select: none;
}
.seg:hover { border-color: var(--acc-down); color: var(--text); background: var(--overlay); }
.seg.active {
  border-color: #FFFFFF; color: #0B0E16;
  background: var(--plat);
  font-weight: 700; box-shadow: 2px 2px 0 rgba(0,0,0,0.55);
}
.seg:active { transform: scale(.97); }
.seg .cnt { font-family: var(--font-mono); font-size: 9px; color: var(--text-3); min-width: 14px; text-align: center; }
.seg.active .cnt { color: rgba(11, 14, 22, 0.7); }

/* ── Lightbox (fullscreen photo/video viewer) ── */
.lightbox-veil {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(2, 3, 7, 0.9);
  opacity: 0; transition: opacity var(--move);
}
.lightbox-veil.open { opacity: 1; }
.lightbox {
  position: fixed; inset: 0; z-index: 81;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; transform: scale(0.97); transition: opacity var(--move), transform var(--move);
  pointer-events: none;
}
.lightbox.open { opacity: 1; transform: scale(1); pointer-events: auto; }
.lightbox-media {
  max-width: min(94vw, 900px); max-height: 92vh; width: auto; height: auto;
  border-radius: var(--r); border: 1px solid rgba(201,213,234,.35);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  background: #05070C; object-fit: contain;
}
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  width: 38px; height: 38px; border-radius: 2px;
  background: var(--raised); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { border-color: var(--acc); color: var(--acc); }

/* ── Drawer ── */
.drawer-veil {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 5, 10, 0.72);
  opacity: 0; transition: opacity var(--move);
}
.drawer-veil.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(560px, 100vw);
  background: var(--surface);
  border-left: 3px solid #C9D5EA;
  transform: translateX(100%); transition: transform var(--move);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s4); }

/* ── Modal ── */
.modal-veil {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(3, 5, 10, 0.78);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s4);
}
.modal {
  width: 100%; max-width: 420px;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: var(--s5);
}
.modal h3 { font-size: 15px; font-weight: 600; margin-bottom: var(--s2); }
.modal p { color: var(--text-2); font-size: 13px; margin-bottom: var(--s4); }
.modal .row { display: flex; gap: var(--s2); justify-content: flex-end; }

/* ── Toasts ── */
.toasts { position: fixed; bottom: var(--s4); right: var(--s4); z-index: 80; display: flex; flex-direction: column; gap: var(--s2); }
.toast {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  border-left: 3px solid var(--text-3);
  font-size: 12.5px;
  animation: toastIn var(--move);
  max-width: 340px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.danger { border-left-color: var(--danger); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Skeletons ── */
.skel { background: var(--raised); border-radius: 6px; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel-row { height: 14px; margin: var(--s2) 0; }

/* ── Empty state ── */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s16) var(--s4); text-align: center; }
.empty img, .empty svg { opacity: 0.16; }
.empty .label { font-size: 11px; }

/* ── App layout ── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none;
  background: linear-gradient(180deg, #090E1A 0%, #060A12 100%);
  border-right: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  height: max(var(--topbar-h), env(titlebar-area-height, var(--topbar-h)));
  padding: 0 var(--s4);
  padding-left: var(--s4);
  border-bottom: 1px solid var(--line-strong);
  position: relative;
  flex: none;
}
.sidebar .brand::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, #FFFFFF, #C9D5EA 45%, rgba(152,165,188,0.25));
}
.sidebar .brand > span:first-child { display: inline-flex; align-items: center; }
.sidebar .brand img, .sidebar .brand svg { width: 34px; height: 34px; }
.sidebar .brand .name {
  font-family: var(--font-display); font-size: 24px; letter-spacing: 0.05em; text-transform: uppercase;
  background: linear-gradient(180deg, #FFFFFF 0%, #E8EDF5 45%, #98A5BC 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar nav { flex: 1; overflow-y: auto; padding: var(--s4) var(--s2) var(--s3); }
.navsec { margin-bottom: var(--s4); }
.navsec > .label { display: flex; align-items: center; gap: 6px; padding: var(--s1) var(--s3) var(--s1) var(--s4); color: var(--text-3); }
.navsec > .label::before { content: ""; width: 8px; height: 2px; background: var(--plat); flex: none; }
.navitem {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 34px; padding: 0 var(--s4);
  font-family: var(--font-tech);
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  border-radius: 0;
  border-left: 3px solid transparent;
  transition: all var(--fast);
  text-align: left;
}
.navitem:hover { color: var(--text); background: rgba(255,255,255,0.03); transform: translateX(2px); }
.navitem.active {
  color: #FFF; font-weight: 700; border-left-color: #E6ECF7;
  background: linear-gradient(90deg, rgba(220,230,246,0.16), transparent 75%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.navitem .ico { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--text-3); transition: color var(--fast); }
.navitem:hover .ico { color: var(--text-2); }
.navitem.active .ico { color: #E6ECF7; }
.sidebar .foot { padding: var(--s3) var(--s4); border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* impersonation banner (platform owner inside a client space) */
.impbar {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  background: var(--raised); border: 1px solid var(--acc); border-radius: var(--r);
  font-family: var(--font-tech); font-size: 12px; font-weight: 600; box-shadow: 4px 4px 0 rgba(0,0,0,.5);
}
.estclock { font-size: 11px; color: var(--text-3); letter-spacing: 0.04em; flex: none; }
.topbar {
  height: max(var(--topbar-h), env(titlebar-area-height, var(--topbar-h))); flex: none;
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s5);
  padding-left: max(var(--s5), env(titlebar-area-x, 0px));
  /* the other half of the same fix as .sidebar .brand — on Windows the min/max/close cluster sits
     top-RIGHT instead, which the left-only inset above never covered. titlebar-area-x + -width is
     the OS's safe zone; whatever's left over past its right edge is the control cluster's width. */
  padding-right: max(var(--s5), calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw)));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 40;
  -webkit-app-region: drag; app-region: drag;
}
.topbar button, .topbar input, .topbar select { -webkit-app-region: no-drag; app-region: no-drag; }
/* PWA window-controls-overlay only: push brand logo past macOS traffic lights (●●● ~8–78px) */
@media (display-mode: window-controls-overlay) {
  .sidebar .brand { padding-left: max(78px, env(titlebar-area-x, 78px)); }
}
.topbar .crumb {
  position: relative;
  font-family: var(--font-display); font-size: 18px; letter-spacing: 0.05em; text-transform: uppercase;
  background: linear-gradient(180deg, #FFFFFF 0%, #E8EDF5 45%, #98A5BC 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.topbar .spacer { flex: 1; }
.content { padding: var(--s4); flex: 1; }

.viewhead { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.viewhead h2 {
  font-family: var(--font-display); font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase;
  background: linear-gradient(180deg, #FFFFFF 0%, #E8EDF5 45%, #98A5BC 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.viewhead .sub { color: var(--text-2); font-size: 11.5px; width: 100%; margin-top: -4px; }
.viewhead .spacer { flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--s2); margin-bottom: var(--s4); }

/* ── Mobile bottom nav ── */
.botnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  padding-bottom: env(safe-area-inset-bottom);
}
.botnav .navitem {
  flex-direction: column; gap: 3px; height: 56px; padding: var(--s2) 0;
  justify-content: center; font-size: 10px; font-weight: 600;
  border-radius: 0;
}
.botnav .navitem.active { background: none; color: #FFF; }
.botnav .navitem.active .ico { color: #E6ECF7; }
.botnav .navitem .ico { width: auto; font-size: 17px; }

/* Mobile "More" sheet — reaches every section not in the bottom bar */
.moresheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(4,7,12,.6);
  display: flex; align-items: flex-end; animation: msfade .16s ease; }
.moresheet { width: 100%; background: var(--surface); border-top: 1px solid var(--line-strong);
  padding: 10px 14px calc(16px + env(safe-area-inset-bottom)); animation: msup .2s cubic-bezier(.2,.8,.2,1); }
.moresheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line-strong);
  margin: 2px auto 14px; }
.moresheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moresheet-item { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 16px 6px; background: var(--raised); border: 1px solid var(--line);
  color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.moresheet-item .ico { color: var(--text-3); display: inline-flex; }
.moresheet-item:active { background: var(--surface); }
.moresheet-item.active { border-color: var(--acc); color: var(--text); }
.moresheet-item.active .ico { color: var(--acc); }
@keyframes msfade { from { opacity: 0; } }
@keyframes msup { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .moresheet-bg, .moresheet { animation: none; } }

/* ── Fans CRM table — compact, qualification-first ── */
.tbl-fans { font-size: 11px; }
.tbl-fans td { white-space: nowrap; padding: 5px 6px; vertical-align: middle; }
.tbl-fans th { padding: 6px 6px; font-size: 9px; }
/* fan name cell — two-line: name+badges on top, stage below */
.fan-name-cell { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; white-space: nowrap; }
.fan-nm { font-weight: 700; font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.fan-star { flex: none; cursor: pointer; font-size: 12px; opacity: .3; transition: opacity 80ms; }
.fan-star.on { opacity: 1; color: gold; }
.fan-star:hover { opacity: .8; }
.fan-live { font-size: 11px; color: var(--acc); }
.fan-folder-btn { opacity: .4; font-size: 10px; cursor: pointer; }
.fan-folder-btn:hover { opacity: .9; }
/* stage badge — tiny colored chip under name */
.fan-stage { font-family: var(--font-tech); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 1px 5px; border-radius: 2px; border: 1px solid var(--line); color: var(--text-3); background: var(--bg); }
.fan-stage-spender { color: var(--ok); border-color: rgba(46,204,113,.3); }
.fan-stage-new { color: var(--text-3); }
.fan-stage-profiled { color: var(--acc); border-color: rgba(201,213,234,.3); }
.fan-stage-inscript { color: var(--warn); border-color: rgba(255,176,32,.3); }
.fan-stage-ignored { color: var(--danger); border-color: rgba(255,77,77,.3); }
/* signals — tight emoji strip */
.fan-signals { font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
/* inline progress ladder (👋▶️1️⃣…) */
.fan-ladder { display: inline-flex; gap: 1px; }
.fan-ladder .fl { font-size: 10px; opacity: .25; transition: opacity 80ms; }
.fan-ladder .fl.done { opacity: .85; }
.fan-ladder .fl.now { opacity: 1; filter: drop-shadow(0 0 3px var(--acc)); }
/* levels compact */
.fan-levels { display: inline-flex; align-items: center; gap: 0; white-space: nowrap; }
/* 24h window */
.fan-win { font-size: 10px; color: var(--ok); white-space: nowrap; }
.fan-win-closed { font-size: 10px; }
/* last-open glow */
.tbl-fans tr.lastopen td { animation: lastopen-fade 5s ease-out forwards; }
@keyframes lastopen-fade {
  0% { background: var(--acc-wash); box-shadow: inset 2px 0 0 var(--acc); }
  70% { background: var(--acc-wash); box-shadow: inset 2px 0 0 var(--acc); }
  100% { background: transparent; box-shadow: none; }
}

/* ── Responsive: fluid at EVERY width ──
   ≥1081px full sidebar · 641–1080px icon rail · ≤640px bottom nav.
   CRM table: .c2 columns (Progress/Inv/$) hide on narrow left panels. */
@media (max-width: 1280px) { .tbl-fans .c4 { display: none; } }
@media (max-width: 1020px) { .tbl-fans .c3 { display: none; } }

@media (max-width: 1080px) {
  .sidebar { width: 60px; }
  .sidebar .brand { justify-content: center; padding: 0; }
  .sidebar .brand .name { display: none; }
  .navsec > .label { visibility: hidden; height: 10px; padding: 0; }
  .navitem { font-size: 0; gap: 0; justify-content: center; padding: 0; }
  .navitem .ico { font-size: 16px; width: auto; }
  .sidebar .foot { display: none; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .botnav { display: flex; }
  .botnav .navitem { flex: 1; font-size: 10px; gap: 3px; padding: var(--s2) 0; justify-content: center; }
  .botnav .navitem .ico { font-size: 17px; }
  .content { padding: var(--s3); padding-bottom: 84px; }
  .drawer { width: 100vw; border-left: 0; }
  .kpi .num { font-size: 22px; }
  .tbl-fans .c2 { display: none; }
  .viewhead h2 { font-size: 24px; }
  .fanprev { display: none !important; }
  /* free up the cramped topbar on phones: the EST clock is a nice-to-have, drop it so the
     section's action buttons (+ Add chatter / manager, etc.) fit instead of being clipped */
  .estclock { display: none; }
  .topbar { gap: var(--s2); padding: 0 var(--s3); }
  .crumb { flex: none; }
  /* card headers with action buttons wrap to a new line instead of running off-screen */
  .autocard-head { flex-wrap: wrap; row-gap: 6px; }
  .autocard-head .ttl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  /* any addrow (composer/filters) stacks its controls instead of overflowing */
  .addrow { flex-wrap: wrap; }
  .addrow .input, .addrow .select, .addrow .textarea { min-width: 0; }

  /* PRAVÝ HORNÍ ROH MUSÍ JÍT ZMÁČKNOUT (2026-09-12, owner).
     Horní lišta byla jeden neklopitelný řádek s pevnou výškou 48 px, takže na telefonu se
     tlačítka té sekce (+ Add chatter, + Add manager, + Add links VA) vytlačila za pravý okraj —
     a protože stránka do stran neroluje, prostě zmizela: owner si z mobilu nemohl přidat
     chattera vůbec. Naměřeno na 390 px: třetí tlačítko končí na 391 px, čtvrté a páté na 509
     a 622 px, obě mimo obraz a neklikatelná. Lišta teď narostou o druhý řádek místo toho, aby
     cokoliv vystrčila ze stránky; nic se nezmenšuje, jen se to zalomí. */
  .topbar {
    height: auto; min-height: var(--topbar-h);
    flex-wrap: wrap; row-gap: 6px;
    padding-top: 6px; padding-bottom: 6px;
    /* a v landscape ať lišta neleze pod výřez displeje */
    padding-left: max(var(--s3), env(safe-area-inset-left));
    padding-right: max(var(--s3), env(safe-area-inset-right));
  }
  .topbar .crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #topbar-actions { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
  /* prst není kurzor: každé tlačítko v liště musí mít na co šlápnout */
  .topbar .btn { min-height: 32px; }
  /* obsah taky mimo výřez a nad domovskou čárou */
  .content {
    padding-left: max(var(--s3), env(safe-area-inset-left));
    padding-right: max(var(--s3), env(safe-area-inset-right));
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
  /* v zásuvce se dá dojet až na konec i na telefonu s domovskou čárou */
  .drawer-body { padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom)); }

  /* FILTRY SE NESCHOVÁVAJÍ ZA OKRAJ (2026-09-12, owner). Pruh filtrů je vodorovný scroller —
     na 390 px je široký 1153 px, takže poslední polovina chipů a hlavně tlačítko „＋ folder"
     (na 1165 px) byly mimo obraz. Technicky se tam dá dorolovat, prakticky o nich nikdo neví
     a owner hlásil přesně tohle: „nejde kliknout do pravého horního rohu". Na telefonu se
     tedy zalomí do řádků — nic se nezmenšuje, jen je všechno vidět najednou. */
  .segbar { flex-wrap: wrap; overflow-x: visible; white-space: normal; row-gap: 5px; }
}

/* ── Login ── */
.gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 420px at 50% -10%, rgba(220, 230, 246, 0.10), transparent 65%),
    var(--bg);
  padding: var(--s4);
}
.gate-box {
  position: relative;
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: var(--s10) var(--s8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 24px 80px rgba(0, 0, 0, 0.55);
}
.gate-box::before {
  content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 3px;
  background: var(--plat);
}
.gate-box .mark { display: flex; justify-content: center; margin-bottom: var(--s5); position: relative; }
.gate-box h1 {
  font-family: var(--font-display); font-size: 40px; text-align: center; letter-spacing: 0.06em; text-transform: uppercase;
  background: linear-gradient(180deg, #FFFFFF 0%, #E8EDF5 45%, #98A5BC 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.gate-box .sub {
  text-align: center; margin: var(--s1) 0 var(--s8);
  font-size: 12.5px; color: var(--text-2);
}
.gate-box form { display: flex; flex-direction: column; gap: var(--s3); }
.gate-box .input { height: 44px; }
.gate-box .btn { height: 44px; border-radius: var(--r-sm); font-size: 14px; }
.gate-err { text-align: center; color: var(--danger); font-size: 12px; min-height: 18px; }
.gate-foot { text-align: center; margin-top: var(--s6); font-size: 11px; color: var(--text-3); }

/* ── AGGRESSIVE PASS ── */
.hazard { height: 2px; background: var(--plat); opacity: 0.9; }
.btn-primary { box-shadow: 3px 3px 0 rgba(0,0,0,0.55), 0 0 18px var(--acc-glow); }
.btn-primary:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(0,0,0,0.55); }
.kpi.hot { border-color: var(--acc); border-width: 1px; position: relative; overflow: hidden; }
.kpi.hot::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--acc); }

/* ── Fan hover preview card ── */
.fanprev {
  position: fixed; z-index: 55; width: 300px; pointer-events: none;
  background: var(--raised); border: 1px solid var(--acc); border-radius: var(--r);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.5); padding: var(--s3) var(--s4);
  font-size: 12px;
}
.fanprev .row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.fanprev .row b { font-weight: 600; }

/* ── Chat dock (ops-desk style full overlay) ── */
.dock-veil { position: fixed; inset: 0; z-index: 60; background: rgba(3,5,10,0.82); }
.dock {
  position: fixed; inset: 16px; z-index: 61;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  border-top: 3px solid #C9D5EA;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.5);
  display: flex; flex-direction: column; overflow: hidden;
}
.dock-head {
  flex: none; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-strong);
  background: var(--raised);
}
.dock-head .who { font-weight: 700; font-size: 15px; }
.dock-head .meta { color: var(--text-2); font-size: 12px; }
.dock-body { flex: 1; display: flex; min-height: 0; }
.dock-side {
  width: 300px; flex: none; overflow-y: auto; padding: var(--s4);
  border-left: 1px solid var(--line);
}
.dock-side h4 { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--acc); margin: var(--s4) 0 var(--s2); }
.dock-side h4:first-child { margin-top: 0; }
.dock-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dock-msgs { flex: 1; overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: 6px; }
.dock-compose { flex: none; border-top: 1px solid var(--line-strong); padding: var(--s3) var(--s4); }
.dock-tools { display: flex; gap: 8px; margin-bottom: 8px; }
/* attach panel + chips (Gallery/Scripts content → compose attachments, price set at the box) */
.attachpanel { margin-bottom: 8px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--raised); }
.attachpanel-head { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.attachpanel-body { padding: 8px; max-height: 250px; overflow-y: auto; }
.attachpanel-body .mediagrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.attachpanel-body .mediacard img, .attachpanel-body .mediacard video { height: 72px; }
.attachpanel-body .mediacard .cap { padding: 4px 6px; font-size: 10px; }
.attachpanel-body .mediacard.sel { outline: 2px solid var(--acc); outline-offset: -2px; }
.attachbar { display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; padding: 8px; border: 1px solid var(--acc); border-radius: var(--r); background: var(--raised); }
.attachchips { display: flex; flex-wrap: wrap; gap: 6px; }
.attachchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 3px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); font-size: 11px; color: var(--text-2); }
.attachchip img { width: 30px; height: 30px; object-fit: cover; border-radius: 2px; display: block; }
.attachchip .x { cursor: pointer; color: var(--text-3); padding: 0 3px; font-size: 12px; }
.attachchip .x:hover { color: #E6697B; }
.attachprice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* emoji picker (dock compose) */
.emopicker { margin-bottom: 8px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--raised); }
.emopicker-tabs { display: flex; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.emopicker-tabs::-webkit-scrollbar { display: none; }
.emotab { flex: none; font-size: 14px; line-height: 1; padding: 4px 6px; border: 1px solid transparent; border-radius: var(--r); background: none; cursor: pointer; opacity: 0.6; }
.emotab:hover { opacity: 1; background: var(--overlay); }
.emotab.active { opacity: 1; background: var(--overlay); border-color: var(--acc); }
.emopicker-grid { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; max-height: 150px; overflow-y: auto; }
.emo { font-size: 17px; line-height: 1; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--r); background: none; cursor: pointer; }
.emo:hover { background: var(--overlay); }
.bubble {
  max-width: 72%; padding: 8px 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word;
  border-radius: var(--r);
}
.bubble.in { align-self: flex-start; background: var(--raised); border: 1px solid var(--line); }
.bubble.out { align-self: flex-end; background: var(--plat); color: #10131C; border: 1px solid #FFFFFF; font-weight: 500; }
.bubble .stamp { display: block; font-size: 10px; margin-top: 3px; opacity: 0.65; }

/* Dělítko dne v chatu — jako v Messengeru: Today / Yesterday / Monday / Aug 4. Bez něj byl
   u zprávy jen čas, takže nešlo poznat, jestli je z dneška nebo z minulého měsíce. */
.daysep { display: flex; align-items: center; gap: 10px; margin: 14px 2px 8px; }
.daysep::before, .daysep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.daysep span {
  flex: none; font-family: var(--font-tech); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3);
}

/* Postup fanouška funnelem (opener → start → timewaster pokusy). Hotové příčky svítí,
   ta rozdělaná má rámeček, zbytek je tlumený. */
.ladder { display: flex; flex-wrap: wrap; gap: 4px; }
.ladder .st {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-tech); font-size: 10.5px; padding: 2px 7px;
  border: 1px solid var(--line); border-radius: var(--r-full); color: var(--text-3);
}
.ladder .st.done { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.ladder .st.now { color: var(--acc); border-color: var(--acc); font-weight: 700; }

/* Plán a poznámky: jedno pole, které roste s textem, ať je vidět celé bez rolování v rolování. */
.grow-area { min-height: 76px; overflow: hidden; resize: none; line-height: 1.5; }
.fieldnote { font-size: 10.5px; color: var(--text-3); margin-top: 3px; min-height: 13px; }
.bubble-media {
  position: relative; width: 220px; max-width: 100%; aspect-ratio: 1/1; overflow: hidden;
  border-radius: 2px; margin-bottom: 6px; cursor: zoom-in; background: #05070C;
  border: 1px solid rgba(255,255,255,.12);
}
.bubble-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bubble-media.blurred img, .bubble-media.blurred video { filter: blur(16px); transform: scale(1.08); }
.media-lock {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  padding: 5px 10px; border-radius: var(--r); font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: rgba(11,14,22,.7); border: 1px solid rgba(255,255,255,.5); color: #fff;
  pointer-events: none; backdrop-filter: blur(2px);
}
/* a PPV he actually bought — sits at the bottom of the (now unblurred) tile, not over it */
.media-lock.paid {
  top: auto; bottom: 6px; left: 6px; transform: none;
  background: rgba(11,14,22,.78); border-color: rgba(74,222,128,.8); color: #4ADE80;
}
/* info fields */
.inforow { display: grid; grid-template-columns: 104px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.inforow .label { font-size: 9.5px; }
.inforow .input, .inforow .select { height: 28px; font-size: 12px; background: var(--raised); }
/* tag chips */
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; }
.tagchip {
  font-family: var(--font-tech);
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: all var(--fast); background: var(--raised);
}
.tagchip:hover { border-color: var(--acc); color: var(--text); }
.tagchip.on { background: var(--plat); border-color: #FFFFFF; color: #10131C; }

/* ── Fans CRM two-panel layout ── */
.fans-crm { display: flex; gap: 0; height: calc(100vh - var(--topbar-h, 48px) - 16px); overflow: hidden; }
.fans-left { width: 360px; flex: none; overflow-y: auto; display: flex; flex-direction: column; padding-right: 0; }
.fans-right { flex: 1; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); position: relative; }
.fans-right-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 13px; }
/* inline dock fills .fans-right instead of fixed overlay */
.dock.dock-inline {
  position: relative; inset: auto; z-index: auto;
  border: 0; border-top: 0; border-radius: 0; box-shadow: none;
  flex: 1; min-height: 0;
}
.dock.dock-inline .dock-head { border-top: 0; }
/* inline tabs sit inside .fans-right header, not fixed */
.docktabs-inline {
  position: relative; top: auto; left: auto; right: auto;
  z-index: auto; border-top: 0; border-radius: 0;
  box-shadow: none; border-bottom: 1px solid var(--line-strong);
  min-height: 32px; padding: 0 6px;
}
/* no veil for inline docks */
.dock-veil-inline { display: none; }
/* mini chat popup (bottom-right, per-fan) */
.dock-mini {
  position: fixed; bottom: 70px; right: 18px; z-index: 59;
  width: 320px; height: 440px; background: var(--surface);
  border: 1px solid var(--acc); border-radius: var(--r);
  box-shadow: 6px 6px 0 rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden;
}
.dock-mini .dock-head { padding: 6px 8px; gap: 6px; }
.dock-mini .dock-head .who { font-size: 13px; }
.dock-mini .dock-msgs { flex: 1; padding: 8px; gap: 4px; }
.dock-mini .dock-compose { padding: 6px 8px; }
.dock-mini .dock-compose .dock-tools { display: none; }
.dock-mini .dock-side { display: none; }
.dock-mini .dock-body { flex-direction: column; }
/* mini launcher bubbles (stacked vertically in bottom-right) */
.dock-minis { position: fixed; bottom: 18px; right: 18px; z-index: 58; display: flex; flex-direction: column-reverse; gap: 6px; }
.dock-mini-av {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: var(--raised); border: 2px solid var(--acc);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-tech); font-size: 11px; font-weight: 700; color: var(--acc);
  box-shadow: 3px 3px 0 rgba(0,0,0,.5); position: relative;
}
.dock-mini-av:hover { background: var(--overlay); border-color: #fff; }
.dock-mini-badge {
  position: absolute; top: -4px; right: -4px; min-width: 14px; height: 14px;
  background: var(--danger); color: #fff; font-size: 8px; font-weight: 700;
  border-radius: 7px; display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

@media (max-width: 900px) {
  .fans-crm { flex-direction: column; height: auto; }
  .fans-left { width: 100%; flex: none; overflow-y: visible; }
  .fans-right { display: none; } /* mobile uses fullscreen dock overlay */
  .dock { inset: 0; border: 0; border-radius: 0; }
  .dock-body { flex-direction: column; }
  .dock-side { width: 100%; max-height: 38vh; border-left: 0; border-top: 1px solid var(--line-strong); order: 2; }
}
/* channel post feed — Telegram-style bubbles (same feel as the fan chat) */
.chwrap {
  background: radial-gradient(600px 300px at 50% -8%, rgba(220,230,246,.05), transparent 60%), var(--bg);
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px 16px 18px;
}
.chfeed { max-width: 470px; display: flex; flex-direction: column; gap: 12px; }
.chdivider {
  align-self: center; font-family: var(--font-tech); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3);
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-full);
  padding: 3px 10px; margin: 2px 0;
}
.chpost {
  position: relative; max-width: 92%; min-width: 220px; align-self: flex-start;
  background: linear-gradient(180deg, var(--overlay) 0%, var(--raised) 100%);
  border: 1px solid var(--line-strong); border-left: 2px solid var(--acc);
  border-radius: var(--r); padding: 8px 12px 6px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
.chpost.sched { border-left-color: var(--warn); opacity: .92; }
.chpost .chname {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-tech); font-size: 11.5px; font-weight: 700; color: var(--tg);
  margin-bottom: 5px;
}
.chpost .chname .schedtag { font-size: 10px; color: var(--warn); font-weight: 600; }
.chpost .txt { font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.chfoot { display: flex; align-items: flex-end; gap: 8px; margin-top: 4px; }
.chfoot .stamp { margin-left: auto; font-size: 9.5px; color: var(--text-3); }
.chfoot .actions { display: inline-flex; gap: 0; opacity: 0; transition: opacity 120ms ease-out; }
.chpost:hover .chfoot .actions { opacity: 1; }
@media (hover: none) { .chfoot .actions { opacity: 1; } }
/* poll inside a post — Telegram look with fill bars */
.chpoll { padding: 2px 0 4px; min-width: 240px; }
.chpoll .q { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.chpoll .sub { font-size: 10.5px; color: var(--text-3); margin-bottom: 8px; }
.chpoll .opt {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 9px; margin-bottom: 5px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg);
}
.chpoll .opt .fill { position: absolute; inset: 0; width: 0; background: var(--acc-wash); border-right: 1px solid var(--acc); }
.chpoll .opt .otxt { position: relative; font-size: 12px; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chpoll .opt .opct { position: relative; font-size: 10.5px; color: var(--acc); flex: none; }

/* media grid */
.mediagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); }
.mediacard { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--raised); cursor: pointer; transition: border-color var(--fast); }
.mediacard:hover { border-color: var(--acc); }
.mediacard { position: relative; aspect-ratio: 1 / 1; }
.mediacard img, .mediacard video { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--bg); }
.media-doc { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 30px; background: var(--bg); }
.media-view-btn {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(11,14,22,.6); border: 1px solid rgba(255,255,255,.4); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; cursor: zoom-in;
  backdrop-filter: blur(2px); z-index: 1;
}
.media-view-btn:hover { background: rgba(11,14,22,.85); }
/* Sent/pending overlays on gallery cards */
.mediacard.sent { opacity: .35; cursor: default; }
.mediacard.sent:hover { border-color: var(--line); }
.mediacard.ppv-pending { border: 2px dashed var(--warn); opacity: .75; }
.sent-badge { font-family: var(--font-tech); font-size: 9px; font-weight: 700; color: var(--ok); background: rgba(46,204,113,.12); border: 1px solid rgba(46,204,113,.25); padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.pending-badge { font-family: var(--font-tech); font-size: 9px; font-weight: 700; color: var(--warn); background: rgba(255,176,32,.12); border: 1px solid rgba(255,176,32,.25); padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.steprow.sent { opacity: .4; }
.steprow.partial-sent { border-left: 3px solid var(--warn); }
.media-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 7px 9px; font-size: 11px; font-weight: 600; letter-spacing: .01em; color: #EDF1F8;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: linear-gradient(180deg, rgba(9,13,22,.55), rgba(7,10,17,.94));
  backdrop-filter: blur(7px) saturate(1.1); -webkit-backdrop-filter: blur(7px) saturate(1.1);
  border-top: 1px solid rgba(201,213,234,.32);
  box-shadow: 0 -1px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}
.media-price {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: var(--plat); color: #0B0E16; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 2px; border: 1px solid #FFF;
}

/* ── Dock bar — minimized chats (ops-desk style) ── */
/* minimized launcher — fixed bottom-right corner */
.docklauncher {
  position: fixed; right: 18px; bottom: 18px; z-index: 59;
  width: 46px; height: 46px; flex: none;
  border-radius: 50%; border: 1px solid #C9D5EA;
  background: linear-gradient(160deg, var(--raised), var(--surface));
  box-shadow: 0 6px 20px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform var(--fast), box-shadow var(--fast);
}
.docklauncher.hidden { display: none; }
.docklauncher:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.55), 0 0 22px var(--acc-glow); }
.docklauncher .ico { color: var(--acc); display: inline-flex; }
.docklauncher .count {
  position: absolute; bottom: -3px; right: -3px;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--plat); color: #0B0E16; border: 2px solid var(--bg);
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.docklauncher .dockbadge.float { position: absolute; top: -5px; right: -5px; }
.dockbadge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; flex: none;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}
@media (max-width: 640px) { .docklauncher { bottom: 74px; } }

/* ── Automation view ── */
.auto-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); align-items: start; }
.auto-col { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.auto-full { margin-bottom: var(--s3); }
@media (max-width: 980px) { .auto-cols { grid-template-columns: 1fr; } }

/* calendar (Scheduled DMs) */
.schedwrap { display: grid; grid-template-columns: 320px 1fr; gap: var(--s5); align-items: start; }
@media (max-width: 980px) { .schedwrap { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-head .mon { font-family: var(--font-tech); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-family: var(--font-tech); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: 3px 0; }
.cal-day {
  position: relative; height: 38px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer; transition: border-color var(--fast), background var(--fast);
}
.cal-day:hover { border-color: var(--acc-down); color: var(--text); }
.cal-day.dim { opacity: 0.32; }
.cal-day.today { border-color: var(--acc); }
.cal-day.sel { background: var(--plat); border-color: #FFFFFF; color: #0B0E16; font-weight: 700; }
.cal-day .cnt {
  font-size: 8.5px; line-height: 1; color: var(--acc);
  font-weight: 700;
}
.cal-day.sel .cnt { color: rgba(11,14,22,0.7); }

.autocard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: inset 0 1px 0 rgba(255,255,255,0.09); }
.autocard[draggable="true"] { cursor: grab; }
.autocard.dragging { opacity: 0.35; cursor: grabbing; }
.ttl-editable:hover { color: var(--acc); text-decoration: underline; cursor: pointer; }
.autocard-head { display: flex; align-items: center; gap: 10px; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.autocard-head .ttl { font-family: var(--font-tech); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.autocard-head .spacer { flex: 1; }
.autocard-sub { padding: var(--s2) var(--s4) 0; color: var(--text-3); font-size: 11.5px; }
.autocard-body { padding: var(--s3) var(--s4) var(--s4); }
.autocard-body.off { opacity: 0.4; pointer-events: none; user-select: none; }
/* Campaign queue: a folded run is one dense line, an open one gets the full room back. Only the
   campaign cards and campaign steps opt in, so welcome/follow-up cards keep their own breathing. */
.autocard.fold .autocard-head { padding: 5px var(--s3); gap: 7px; }
.autocard.fold .autocard-body { padding: 0 var(--s3) 6px; }

.script-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.script-stats.dim, .script-stats .dim { color: var(--text-3); }
.script-stats .ok { color: var(--ok); font-weight: 600; }
.script-stats-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-bottom: 14px; }
.script-kpi { background: var(--overlay); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
.script-kpi .t3 { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.script-kpi-n { font-family: var(--font-tech); font-size: 14px; font-weight: 700; margin-top: 2px; }

/* switch — sharp platinum */
.switch { position: relative; width: 42px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .sl {
  position: absolute; inset: 0; background: var(--overlay);
  border: 1px solid var(--line-strong); border-radius: var(--r); transition: all var(--fast);
}
.switch .sl::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  background: var(--text-3); border-radius: var(--r); transition: all var(--fast);
}
.switch input:checked + .sl { background: var(--plat); border-color: #FFFFFF; }
.switch input:checked + .sl::before { left: 22px; background: #0B0E16; }

/* variant rows */
.varrow { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.varrow .idx {
  flex: none; width: 22px; height: 22px; margin-top: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  border: 1px solid var(--line); border-radius: var(--r); background: var(--raised);
}
.varrow .textarea { flex: 1; min-height: 42px; font-size: 12.5px; }
.varrow .rm { flex: none; margin-top: 3px; }

/* follow-up steps */
.steprow { border: 1px solid var(--line); border-radius: var(--r); background: var(--raised); padding: var(--s2) var(--s3) var(--s3); margin-bottom: var(--s2); cursor: grab; transition: opacity var(--fast); }
.steprow.dragging { opacity: 0.35; cursor: grabbing; }
.steprow-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.steprow-head > * { cursor: auto; }
.steprow.fold { padding: 4px var(--s2); margin-bottom: 4px; }
.steprow.fold .steprow-head { margin-bottom: 0; gap: 6px; }
.steprow-head .stepno {
  font-family: var(--font-tech); font-size: 10px; font-weight: 700; color: var(--acc);
  width: 18px; height: 18px; flex: none; border-radius: 2px; background: var(--overlay);
  display: flex; align-items: center; justify-content: center;
}
.step-name-input {
  border: 1px solid transparent; background: none; color: var(--text); font-weight: 600;
  font-size: 13px; padding: 3px 6px; border-radius: 2px; min-width: 60px; flex: 1 1 auto; max-width: 480px;
}
.step-name-input:hover { border-color: var(--line); }
.step-name-input:focus { border-color: var(--acc); background: var(--bg); outline: none; }
.step-name-input::placeholder { color: var(--t3); font-weight: 400; }
.steprow-head .input { width: 72px; height: 26px; font-size: 12px; }
.steprow .textarea { min-height: 42px; font-size: 12.5px; background: var(--bg); }
.step-bubbles { display: flex; flex-direction: column; gap: 8px; }
.step-bubble {
  display: grid; grid-template-columns: 16px 22px 1fr auto; grid-template-rows: auto auto auto;
  column-gap: 8px; row-gap: 6px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); cursor: grab;
}
.step-bubble > .step-bubble-grip { grid-column: 1; grid-row: 1; padding-top: 10px; }
.step-bubble > .step-bubble-no { grid-column: 2; grid-row: 1; padding-top: 10px; }
.step-bubble > .step-bubble-text { grid-column: 3; grid-row: 1; }
.step-bubble > .step-bubble-x { grid-column: 4; grid-row: 1; }
.step-bubble.lock {
  border-color: color-mix(in srgb, var(--acc) 55%, var(--line));
  box-shadow: inset 3px 0 0 var(--acc);
}
.step-bubble.drop-hot { outline: 2px solid var(--acc); }
.step-bubble.dragging { opacity: .35; }
.step-bubble-grip { flex: none; font-size: 11px; color: var(--text-3); letter-spacing: -2px; cursor: grab; user-select: none; }
.step-bubble-no { font-size: 10px; color: var(--text-3); font-weight: 600; }
.step-bubble-text { flex: 1; min-height: 48px; width: 100%; }
.step-lockbar {
  grid-column: 2 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 8px; border-radius: 8px; background: var(--raised); cursor: grab;
}
.step-lockbar.dragging { opacity: .4; }
.step-lock-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 3px 7px;
  border-radius: 999px; background: var(--acc); color: #0b0f18;
}
.step-bubble .step-content {
  grid-column: 2 / -1; width: auto; display: flex; flex-flow: row wrap; gap: 6px;
}
.step-bubble .step-thumb { width: 72px; height: 72px; border-radius: 8px; }
.step-bubble .step-content .btn { width: auto; height: 72px; min-width: 72px; border-radius: 8px; font-size: 11px; }
.step-add {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px;
}
.step-after {
  margin-top: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--raised) 80%, transparent);
}
.step-after-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; margin-bottom: 8px; color: var(--text-2);
}
.step-after .step-bubble { background: var(--bg); cursor: default; grid-template-columns: 22px 1fr auto; }
.step-after .step-bubble > .step-bubble-no { grid-column: 1; }
.step-after .step-bubble > .step-bubble-text { grid-column: 2; }
.step-after .step-bubble > .step-bubble-x { grid-column: 3; }
.picker-bubble { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.picker-bubble:first-of-type { border-top: none; }
.picker-media { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.picker-thumbs { display: flex; gap: 6px; flex: none; }
.picker-afterpay { margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--line); }
.step-body { display: flex; gap: 12px; align-items: flex-start; cursor: auto; }
.step-body .step-text { flex: 1; min-width: 0; }
.step-content {
  flex: none; width: 128px; display: flex; flex-flow: row wrap; align-content: flex-start;
  gap: 5px; align-self: stretch;
}
.step-thumb {
  position: relative; width: 88px; height: 88px; flex: none; border-radius: 2px; overflow: hidden;
  cursor: pointer; background: #05070C; border: 1px solid var(--line-strong);
}
.step-thumb .media-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(7,11,20,.78); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; z-index: 3;
}
.step-media-grab {
  position: absolute; left: 2px; top: 2px; z-index: 3;
  font-size: 10px; letter-spacing: -1px; cursor: grab;
  background: rgba(7,11,20,.75); color: #fff; padding: 1px 4px; border-radius: 2px;
}
.step-thumb.dragging, .step-voice.dragging { opacity: 0.4; }
.step-thumb.drop-hot, .step-voice.drop-hot { outline: 2px solid var(--acc); }
.step-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.step-thumb .media-play { width: 20px; height: 20px; font-size: 8px; }
.step-thumb .x {
  position: absolute; top: 2px; right: 2px; z-index: 2; width: 15px; height: 15px;
  border-radius: 50%; background: rgba(7,11,20,.85); color: #fff; font-size: 9px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.step-content .btn { flex: none; width: 60px; height: 60px; font-size: 10px; padding: 2px; line-height: 1.2; white-space: normal; }

/* scheduled + manager rows */
.listrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.listrow:last-of-type { border-bottom: 0; }
.listrow .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addrow { display: flex; gap: 8px; margin-top: var(--s3); flex-wrap: wrap; align-items: center; }
.addrow .input, .addrow .select { height: 30px; }
.addrow input[type="datetime-local"] { font-family: var(--font-mono); font-size: 11.5px; padding: 0 6px; }
.listrow .when { width: 106px; flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
@media (max-width: 640px) {
  .addrow > * { flex: 1 1 100%; }
  .addrow .btn { width: 100%; }
}

/* empty state inside grids spans full width (centered cobra) */
.mediagrid .empty { grid-column: 1 / -1; }

/* ── Stats — model cards + arrivals chart ── */
/* model card header: dot · name · @handle · badge */
.mhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mhead .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mhead .un { flex: none; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* per-model mini-stats grid */
.mstats { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-bottom: 10px; font-size: 12px; }
/* arrivals / revenue bar chart row */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.bar-cap { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); min-height: 15px; margin-top: 4px; }
/* arrivals chart — hover tooltip with the day's count */
.arr-bar { position: relative; flex: 1; border-radius: 1px; cursor: default; }
.arr-bar:hover { outline: 1px solid var(--acc); }
.arr-bar:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--overlay); border: 1px solid var(--acc); border-radius: var(--r);
  padding: 3px 8px; font-family: var(--font-mono); font-size: 10.5px; white-space: nowrap;
  color: var(--text); z-index: 20; box-shadow: 2px 2px 0 rgba(0,0,0,0.5); pointer-events: none;
}
/* tapped bar (mobile: tap = tooltip substitute) */
.arr-bar.tapped { outline: 1px solid var(--acc); }
/* day-by-day table — fixed min-width so it scrolls horizontally on mobile */
.tbl-days { }
.tbl-days .tbl { min-width: 680px; }
.tbl-days .tbl td, .tbl-days .tbl th { white-space: nowrap; }
/* goal line under a KPI */
.kgoal { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-3); cursor: pointer; margin-top: 4px; line-height: 1.3; }
.kgoal.met { color: var(--ok); }
.kgoal-bar { display: inline-block; width: 36px; height: 3px; background: var(--line-strong); border-radius: 2px; overflow: hidden; flex: none; }
.kgoal-bar b { display: block; height: 100%; background: var(--acc); border-radius: 2px; }
.kgoal-in { font-family: var(--font-mono); font-size: 10.5px; width: 80px; padding: 1px 5px; height: 20px; background: var(--raised); border: 1px solid var(--acc); border-radius: var(--r); color: var(--text); outline: none; }
/* running-costs editor */
.costrow { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.costrow .input { flex: 1; min-width: 80px; }

/* full-width tab strip across the top of the shared dock window */
/* top bar: compact chat tabs (left) + MIN/CLOSE actions (top-right corner) */
.docktabs {
  position: fixed; top: 12px; left: 16px; right: 16px; min-height: 36px; z-index: 62;
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong); border-top: 3px solid #C9D5EA;
  border-radius: var(--r); padding: 0 8px; box-shadow: 0 8px 22px rgba(0,0,0,.55);
}
.docktabs.hidden { display: none; }
/* compact tabs: many fit side by side and wrap to more rows when needed */
.docktabs-scroll { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; height: auto; padding: 5px 0; }
.docktab {
  flex: 0 1 auto; max-width: 130px; min-width: 0; height: 24px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 7px; border-radius: 2px; cursor: pointer;
  font-family: var(--font-tech); font-size: 11px; font-weight: 600; color: var(--text-2);
  border: 1px solid var(--line); background: var(--raised);
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.docktab .av {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--overlay); border: 1px solid var(--line-strong);
  color: var(--acc); font-size: 7.5px; font-weight: 700;
}
.docktab .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docktab:hover { color: var(--text); background: var(--overlay); border-color: var(--line-strong); }
.docktab.active { background: var(--plat); color: #0B0E16; border-color: #FFF; font-weight: 700; }
.docktab.active .av { background: rgba(11,14,22,.15); border-color: rgba(11,14,22,.25); color: #0B0E16; }
.docktab .tabu {
  min-width: 13px; height: 13px; padding: 0 3px; border-radius: 7px; flex: none;
  background: var(--danger); color: #fff; font-family: var(--font-mono); font-size: 8.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.docktab.active .tabu { background: #0B0E16; color: #E8EDF5; }
.docktab .x { color: var(--text-3); font-size: 11px; flex: none; }
.docktab.active .x { color: rgba(11,14,22,.55); }
.docktab .x:hover { color: var(--danger); }
.docktabs-actions { flex: none; display: flex; align-items: center; gap: 2px; margin-left: 8px; height: 34px; }
.docktabs-btn {
  width: 26px; height: 26px; border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 14px; border-radius: 2px;
  display: inline-flex; align-items: center; justify-content: center;
}
.docktabs-btn:hover { background: var(--raised); color: var(--text); }
.docktabs-btn.danger:hover { background: var(--danger); color: #fff; }
.dock.behind { display: none; }
/* dock starts under the tab strip — height is dynamic (rows), set by dock.js as --docktabs-h */
body.dock-tabbed .dock { top: calc(20px + var(--docktabs-h, 36px)); }
@media (max-width: 640px) { .docktab .nm { display: none; } }

/* ── Gallery: storage setup + upload (with cobra) ── */
.setup-hero { text-align: center; padding: 4px 2px; }
.setup-mark { display: inline-flex; margin: 4px auto 14px; }
.setup-mark img, .setup-mark svg { width: 56px; height: 56px; filter: drop-shadow(0 0 20px var(--acc-glow)); }
.setup-title {
  font-family: var(--font-display); font-size: 26px; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--plat); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.setup-sub { color: var(--text-2); font-size: 12.5px; line-height: 1.6; margin: 6px auto 20px; max-width: 340px; }
.setup-step { display: flex; gap: 12px; align-items: flex-start; text-align: left; margin-bottom: 12px; }
.setup-num {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--plat); color: #0B0E16; font-family: var(--font-tech); font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px #FFF, 2px 2px 0 rgba(0,0,0,.4);
}
.setup-txt { color: var(--text); font-size: 13px; line-height: 1.5; padding-top: 2px; }
.setup-txt b { color: var(--tg); font-weight: 700; }
.setup-code {
  display: flex; gap: 8px; align-items: center; margin: 6px 0 12px 36px;
}
.setup-code code {
  flex: 1; text-align: center; font-family: var(--font-mono); font-size: 18px; font-weight: 700; letter-spacing: 3px;
  background: var(--bg); border: 1px dashed var(--acc); border-radius: var(--r); padding: 10px 12px; color: #E6ECF7;
}
.setup-cta { width: 100%; margin-top: 6px; }
.setup-status {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  margin-top: 16px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--raised); font-size: 12px; color: var(--text-2);
}

/* upload dropzone */
.up-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 30px 20px; cursor: pointer; border-radius: var(--r);
  border: 2px dashed var(--line-strong); background: var(--raised);
  transition: border-color var(--fast), background var(--fast);
}
.up-drop:hover { border-color: var(--acc); background: var(--overlay); }
.up-mark img, .up-mark svg { width: 48px; height: 48px; opacity: .9; filter: drop-shadow(0 0 16px var(--acc-glow)); }
.up-drop-t { font-weight: 700; font-size: 14px; color: var(--text); }
.up-drop-s { font-size: 11.5px; color: var(--text-3); max-width: 280px; }
.up-bar { height: 6px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); margin-top: 12px; overflow: hidden; }
.up-bar-fill { height: 100%; width: 0; background: var(--plat); transition: width var(--fast); }

/* video preview play badge */
.mediacard { position: relative; }
.media-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(11,14,22,.55); border: 1px solid rgba(255,255,255,.5); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; padding-left: 2px;
  pointer-events: none; backdrop-filter: blur(2px);
}

/* gallery detail preview */
.media-view-hero { position: relative; margin-bottom: 14px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-strong); background: #05070C; }
.media-view-hero img { width: 100%; max-height: 340px; object-fit: contain; display: block; }
.media-view-hero-video { width: 100%; max-height: 340px; display: block; background: #05070C; }

/* ── AI Agents (views/agents.js) — Claude agents running on the owner's own Mac ── */
.agent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.agent-err {
  border: 1px solid var(--danger); border-left-width: 3px; border-radius: var(--r);
  background: var(--danger-wash); color: var(--danger);
  padding: 6px 8px; font-size: 11px; margin-bottom: 10px; word-break: break-word;
}
/* live event feed — newest at the bottom, scrolls inside itself (never grows the drawer) */
.agent-feed {
  max-height: 240px; overflow-y: auto; padding: 8px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--raised);
}
.agent-ev { display: flex; gap: 8px; padding: 2px 0; font-size: 11.5px; line-height: 1.5; }
.agent-ev .ts { flex: none; color: var(--text-3); font-size: 10.5px; }
.agent-ev .tx { color: var(--text-2); word-break: break-word; }
.agent-ev.warn .tx { color: var(--warn); }
.agent-ev.error .tx { color: var(--danger); }
.agent-ev.tool .tx { color: var(--acc); }
/* setup: the pairing code + the one command the user pastes into Terminal */
.agent-code {
  font-size: 30px; letter-spacing: 6px; font-weight: 700; color: var(--text);
  padding: 8px 0 2px; word-break: break-all;
}
.agent-cmd {
  padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg);
  font-size: 11px; color: var(--acc); word-break: break-all; user-select: all;
}
.agent-step { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; font-size: 12px; }
.agent-step .n {
  flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--plat); color: #10131C; font-weight: 700; font-size: 11px; border-radius: var(--r);
}
/* chat with an agent — a real two-way thread, not a log */
.agent-chat {
  max-height: 420px; min-height: 320px; overflow-y: auto; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--raised);
  display: flex; flex-direction: column; gap: 8px;
}
.agent-bubble {
  max-width: 78%; padding: 8px 12px; border-radius: var(--r); font-size: 12.5px; line-height: 1.55;
  align-self: flex-start; background: var(--bg); border: 1px solid var(--line); color: var(--text-2);
}
.agent-bubble.mine { align-self: flex-end; background: var(--plat); color: #0B0E16; border: none; font-weight: 500; }
.agent-bubble.pending { opacity: .55; font-style: italic; }
.agent-bubble.err { border-color: var(--danger); color: var(--danger); }

/* ── AI Team Command Center (views/aichat.js) ── */
.ai-team-header { margin-bottom: 4px; }
.ai-team-title { display: flex; align-items: baseline; margin-bottom: 14px; }
.ai-team-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px; margin-bottom: 4px;
}
.ai-team-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; transition: border-color .15s;
}
.ai-team-card:hover { border-color: var(--acc); }
.ai-team-card.empty {
  border-style: dashed; opacity: .55;
}
.ai-team-card.empty:hover { opacity: .8; border-color: var(--acc); }
.ai-team-insights { }
.ai-team-insight-row {
  padding: 8px 10px; border-left: 3px solid var(--line-strong);
  margin-bottom: 6px; background: var(--raised); border-radius: 0 var(--r) var(--r) 0;
}

/* ── Mindmap Editor ── */
.mm-wrap {
  position: relative; width: 100%; height: calc(100vh - 120px); min-height: 400px;
  overflow: hidden; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  cursor: grab; user-select: none;
  background-image: radial-gradient(circle, rgba(201,213,234,.06) 1px, transparent 1px);
  background-size: 20px 20px;
}
.mm-wrap:active { cursor: grabbing; }
.mm-canvas {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  transform-origin: 0 0; will-change: transform;
}
.mm-svg {
  position: absolute; left: 0; top: 0;
  pointer-events: none; z-index: 1; overflow: visible;
}
.mm-path { stroke: var(--line-strong); stroke-width: 2; fill: none; }
.mm-path.active { stroke: var(--acc); stroke-width: 2.5; }
.mm-path.preview { stroke: var(--acc); stroke-width: 1.5; stroke-dasharray: 6 4; opacity: .6; }
.mm-conn-label {
  font-family: var(--font-tech); font-size: 10px; fill: var(--text-3);
  text-anchor: middle; dominant-baseline: auto;
}

/* Nodes */
.mm-node {
  position: absolute; z-index: 2; min-width: 140px; max-width: 500px;
  padding: 10px 18px 10px 12px; border: 2px solid var(--line);
  border-radius: var(--r); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  font-family: var(--font-tech); transition: box-shadow .15s;
  box-sizing: border-box;
}
.mm-node:hover { box-shadow: 0 0 12px rgba(201,213,234,.15); }
.mm-node.selected { box-shadow: 0 0 0 2px var(--acc), 0 0 16px rgba(201,213,234,.25); }
.mm-node.connect-target { box-shadow: 0 0 0 2px var(--acc), 0 0 20px rgba(201,213,234,.35); }
.mm-type {
  font-size: 9.5px; font-weight: 700; letter-spacing: .8px; opacity: 1;
  text-transform: uppercase;
}
.mm-text {
  font-size: 14px; font-weight: 600; line-height: 1.4; word-break: break-word;
  min-height: 1.4em;
}
.mm-text.editing {
  outline: 1.5px solid var(--acc); outline-offset: 2px; padding: 2px 4px;
  border-radius: 2px; background: rgba(201,213,234,.08);
  user-select: text; cursor: text; -webkit-user-select: text;
}

/* Notes preview on node */
.mm-notes-preview {
  font-size: 12px; line-height: 1.45; opacity: 1; color: #fff !important;
  display: block; max-height: 7.25em; /* ~5 lines */
  overflow: hidden; word-break: break-word; margin-top: 5px;
  font-style: normal; border-top: 1px solid rgba(255,255,255,.2); padding-top: 5px;
  white-space: pre-line;
}

/* Connection handles (drag to connect) */
.mm-handle {
  position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%; background: var(--acc);
  border: 2px solid var(--bg); cursor: crosshair; z-index: 3; opacity: 0;
  transition: opacity .15s;
}
.mm-handle-left { right: auto; left: -7px; }
.mm-node:hover .mm-handle { opacity: 1; }

/* Add branch buttons (+) */
.mm-add-btn {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: var(--acc); color: var(--bg); font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 5; opacity: 0; transition: opacity .15s, transform .1s;
  line-height: 1; border: 2px solid var(--bg); pointer-events: auto;
}
.mm-add-btn:hover { transform: scale(1.2); }
.mm-node:hover .mm-add-btn { opacity: 1; }
.mm-add-right { right: -30px; top: 50%; transform: translateY(-50%); }
.mm-add-right:hover { transform: translateY(-50%) scale(1.2); }
.mm-add-bottom { bottom: -28px; left: 50%; transform: translateX(-50%); }
.mm-add-bottom:hover { transform: translateX(-50%) scale(1.2); }

/* Resize handle (right edge) */
.mm-resize {
  position: absolute; right: -3px; top: 6px; bottom: 6px; width: 6px;
  cursor: ew-resize; z-index: 4; border-radius: 2px;
}
.mm-resize:hover, .mm-resize:active { background: rgba(201,213,234,.2); }

/* Toolbar */
.mm-toolbar {
  position: absolute; top: 8px; left: 8px; z-index: 10;
  display: flex; gap: 6px; align-items: center;
  padding: 4px 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r);
}
.mm-zoom-label {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  min-width: 32px; text-align: center;
}

/* Type picker popup */
.mm-type-picker {
  position: absolute; z-index: 20; display: flex; flex-direction: column; gap: 2px;
  padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.mm-type-pick-item {
  padding: 6px 16px; text-align: left; font-family: var(--font-tech); font-size: 11px;
  font-weight: 600; color: var(--text); background: none; border: 1px solid transparent;
  border-radius: var(--r); cursor: pointer;
}
.mm-type-pick-item:hover { background: var(--raised); border-color: currentColor; }

/* Side panel */
.mm-side {
  position: absolute; top: 0; right: 0; width: 0; height: 100%; z-index: 15;
  background: var(--surface); border-left: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden; transition: width .2s;
  user-select: auto; -webkit-user-select: auto;
}
.mm-side.open { width: 300px; padding: 14px; }
.mm-side input, .mm-side textarea, .mm-side select {
  user-select: auto; -webkit-user-select: auto; cursor: text;
}
.mm-side-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.mm-side-type-badge {
  display: inline-block; padding: 2px 8px; font-family: var(--font-tech);
  font-size: 10px; font-weight: 700; border: 1px solid; border-radius: var(--r);
}
.mm-side-close {
  background: none; border: none; color: var(--text-3); font-size: 18px;
  cursor: pointer; padding: 0 4px;
}
.mm-side-close:hover { color: var(--text); }
.mm-side-row { margin-bottom: 10px; }
.mm-side-label {
  display: block; font-family: var(--font-tech); font-size: 10px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.mm-side-select, .mm-side-input, .mm-side-textarea {
  width: 100%; padding: 6px 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--text); font-family: var(--font-tech); font-size: 12px;
}
.mm-side-textarea { resize: vertical; min-height: 120px; }
.mm-conn-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 4px 6px; font-size: 11px; color: var(--text-2);
  border-left: 2px solid var(--line-strong); margin: 3px 0;
}
.mm-conn-label-input {
  padding: 3px 6px !important; font-size: 10px !important;
  background: var(--bg) !important; border: 1px solid var(--line) !important;
  border-radius: var(--r); color: var(--text-3); width: 100%;
}
.mm-conn-del {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 14px; padding: 0 4px;
}
.mm-conn-del:hover { color: var(--danger, #ef4444); }

/* Right-click context menu */
.mm-ctx {
  position: fixed; z-index: 50; display: flex; flex-direction: column; gap: 1px;
  padding: 4px; min-width: 160px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.mm-ctx-item {
  padding: 6px 12px; font-family: var(--font-tech); font-size: 11px;
  color: var(--text); cursor: pointer; border-radius: var(--r);
  display: flex; align-items: center;
}
.mm-ctx-item:hover { background: var(--raised); }
.mm-ctx-danger { color: var(--danger, #ef4444); }
.mm-ctx-danger:hover { background: rgba(239,68,68,.12); }

/* AI Chat tabs */
.ai-tabs {
  display: flex; gap: 0; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ai-tab {
  padding: 8px 20px; font-family: var(--font-tech); font-size: 12px;
  font-weight: 600; color: var(--text-3); cursor: pointer; border: none;
  background: none; border-bottom: 2px solid transparent; transition: all .15s;
}
.ai-tab:hover { color: var(--text); }
.ai-tab.active {
  color: var(--acc); border-bottom-color: var(--acc);
}
