:root {
  /* YappHub brand (matches website/styles.css) */
  --violet: #6C3BFF;
  --coral: #E8383D;
  --sun: #FFD23F;
  --pink: #FF9BB0;
  --teal: #2EC4B6;
  --ink: #1A1530;
  --font-display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #FFF8EE;
  --panel: #ffffff;
  --panel-2: #F8F2EA;
  --border: #ECE3D8;
  --text: #1A1530;
  --muted: #57506B;
  --faint: #918AA5;
  --accent: #6C3BFF;
  --accent-text: #6C3BFF;
  --accent-soft: #EFE8FF;
  --line: #1A1530;                     /* chunky brand outlines */
  --pop: var(--line);                  /* offset-shadow colour */
  --pop-shadow: 3px 3px 0 var(--pop);
  --green: #0E8F81; --green-soft: #DDF5F2;
  --amber: #A86A00; --amber-soft: #FFF3C9;
  --red: #D42F35; --red-soft: #FDE6E7;
  --blue: #2563eb; --blue-soft: #e5eefe;
  --gray-soft: #F1EBE3;
  --shadow: 0 1px 2px rgba(26, 21, 48, .05), 0 4px 16px rgba(26, 21, 48, .06);
  --shadow-lg: 0 20px 60px rgba(26, 21, 48, .22);
  --radius: 14px;
  --sidebar: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120F1F; --panel: #1C1830; --panel-2: #262040; --border: #312A4D; --text: #FFF8EE; --muted: #BDB5D4; --faint: #8880A3;
    --accent: #6C3BFF; --accent-text: #B49BFF; --accent-soft: #2A2150;
    --line: #FFF8EE; --pop: #000; --pop-shadow: 3px 3px 0 #000;
    --green: #4FD8C9; --green-soft: #12302E; --amber: #FFD23F; --amber-soft: #352C10; --red: #FF7378; --red-soft: #3A1820;
    --blue: #6f9dff; --blue-soft: #172647; --gray-soft: #2A2442;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font-body); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.015em; }
h1 { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 15.5px; font-weight: 700; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--sun); color: var(--ink); }
p { margin: 0; }
svg { width: 18px; height: 18px; flex: none; }
img { max-width: 100%; }
code { background: var(--panel-2); padding: 2px 6px; border-radius: 6px; font-size: 12.5px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; padding: 0 6px 14px; }
.brand picture { display: block; }
.brand-logo { display: block; height: 58px; width: auto; }
.compose-btn { margin: 0 4px 12px; justify-content: center; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav .count { margin-left: auto; background: var(--sun); color: var(--ink); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 4px; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 12px; color: var(--muted); text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .menu-btn { display: none; }
.client-switch { display: flex; align-items: center; gap: 8px; }
.client-switch select { min-width: 220px; font-weight: 500; }
.page { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- primitives ---------- */
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.gap { gap: 8px; } .gap-lg { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.stack > * + * { margin-top: 12px; }
.mt { margin-top: 16px; } .mt-sm { margin-top: 8px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .12s ease, box-shadow .12s ease; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
/* brand "chunky outline + offset shadow" - only on primary actions */
.btn.primary { background: var(--violet); border: 2px solid var(--line); color: #fff; box-shadow: var(--pop-shadow); }
.btn.primary:hover:not(:disabled) { background: var(--violet); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--pop); }
.btn.primary:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--pop); }
.btn.danger { background: var(--coral); color: #fff; border-color: transparent; }
.btn.danger:hover { background: #D42F35; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.sm.primary { box-shadow: 2px 2px 0 var(--pop); }
.btn.success { background: var(--teal); color: var(--ink); border-color: transparent; }
.btn.success:hover { background: #27B3A6; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; width: 100%; outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
input[type=checkbox], input[type=radio], input[type=color] { width: auto; }
input[type=color] { padding: 2px; height: 36px; width: 52px; }
select { height: 36px; padding-top: 0; padding-bottom: 0; }
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.field .help { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.badge.gray { background: var(--gray-soft); color: var(--muted); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

.net { display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: 28%; background: var(--c); color: #fff; font-size: calc(var(--s) * .52); font-weight: 800; line-height: 1; flex: none; font-family: system-ui, sans-serif; }
.avatar { position: relative; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: 50%; background: var(--panel-2); color: var(--muted); font-size: calc(var(--s) * .36); font-weight: 600; flex: none; }
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-net { position: absolute; right: -3px; bottom: -3px; border-radius: 30%; box-shadow: 0 0 0 2px var(--panel); display: flex; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 12px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tabs button .n { margin-left: 5px; font-size: 11.5px; background: var(--gray-soft); border-radius: 99px; padding: 1px 7px; }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 13px; border-radius: 999px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-art { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.empty-art svg { width: 26px; height: 26px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 16px; }

.callout { padding: 12px 14px; border-radius: 10px; background: var(--blue-soft); color: var(--text); font-size: 13px; }
.callout.warn { background: var(--amber-soft); }
.callout.err { background: var(--red-soft); }

/* ---------- toasts & modals ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--ink); color: #FFF8EE; border: 2px solid var(--line); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); white-space: pre-line; animation: tin .2s ease; transition: opacity .3s, transform .3s; }
.toast.err { background: var(--coral); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(26, 21, 48, .5); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; background: var(--panel); border-radius: 20px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; animation: pop .18s ease; }
.modal.wide { width: min(1180px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-body { padding: 24px; }
.modal-body > h3:first-child, .modal-body > h2:first-child { margin-bottom: 16px; padding-right: 30px; }
.modal-x { position: absolute; top: 14px; right: 14px; z-index: 2; }
.confirm-msg { margin-bottom: 20px; font-size: 15px; padding-right: 24px; }

/* ---------- auth ---------- */
.auth { position: relative; overflow: hidden; min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.auth::before, .auth::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; z-index: 0; }
.auth::before { width: 520px; height: 520px; left: -180px; top: -200px; background: radial-gradient(circle, color-mix(in srgb, var(--pink) 55%, transparent), transparent 68%); }
.auth::after { width: 560px; height: 560px; right: -200px; bottom: -240px; background: radial-gradient(circle, color-mix(in srgb, var(--violet) 30%, transparent), transparent 68%); }
.auth .card { position: relative; z-index: 1; width: min(420px, 100%); padding: 32px; border: 2.5px solid var(--line); border-radius: 22px; box-shadow: 6px 6px 0 var(--pop); }
.auth .brand { justify-content: center; padding: 0 0 10px; }
.auth .brand-logo { height: 84px; }
.auth .btn.primary { height: 44px; font-size: 15px; box-shadow: 4px 4px 0 var(--pop); }
.auth p.lead { text-align: center; color: var(--muted); margin-bottom: 22px; }

/* ---------- dashboard ---------- */
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; margin: 0; }
.kpi .value { font-family: var(--font-display); font-size: 28px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--faint); }
.post-row { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--panel-2); }
.post-row .when { width: 92px; flex: none; font-size: 12.5px; color: var(--muted); }
.post-row .when b { display: block; color: var(--text); font-weight: 600; }
.post-row .text { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-row .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--panel-2); }
.nets { display: flex; gap: 3px; flex-wrap: wrap; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h2 { min-width: 180px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--border); gap: 1px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: var(--panel-2); padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-day { background: var(--panel); min-height: 124px; padding: 6px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.cal-day.other { background: color-mix(in srgb, var(--panel) 60%, var(--bg)); }
.cal-day.other .num { color: var(--faint); }
.cal-day.today .num { background: var(--violet); color: #fff; }
.cal-day.drop { background: var(--accent-soft); }
.cal-day .num { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-day .add { position: absolute; top: 4px; right: 4px; opacity: 0; width: 24px; height: 24px; }
.cal-day:hover .add { opacity: 1; }
.cal-day .more { font-size: 12px; color: var(--muted); padding-left: 4px; cursor: pointer; }
.chip { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 6px; border-radius: 6px; background: var(--panel-2); border-left: 3px solid var(--cc, var(--accent)); cursor: pointer; overflow: hidden; }
.chip:hover { filter: brightness(.97); }
.chip[draggable=true] { cursor: grab; }
.chip .t { font-weight: 600; flex: none; color: var(--muted); }
.chip .x { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.published { opacity: .75; }
.chip.failed, .chip.partial { background: var(--red-soft); }
.chip.pending_approval, .chip.rejected { background: var(--amber-soft); }
.chip.draft { border-left-style: dashed; }
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.week .wh { padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--panel-2); text-align: center; }
.week .wh.today { color: var(--accent-text); }
.week .hr { font-size: 11px; color: var(--faint); text-align: right; padding: 2px 6px 0 0; border-top: 1px solid var(--border); height: 52px; }
.week .slot { border-top: 1px solid var(--border); border-left: 1px solid var(--border); height: 52px; padding: 2px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; cursor: pointer; }
.week .slot:hover { background: var(--panel-2); }
.week .slot.drop { background: var(--accent-soft); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0; margin: -24px; min-height: min(760px, calc(100vh - 40px)); }
.composer-edit { padding: 22px 24px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.composer-preview { padding: 22px 24px; background: var(--panel-2); overflow-y: auto; max-height: calc(100vh - 40px); }
.acct-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.acct-opt { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 99px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; font-size: 13px; font-weight: 500; user-select: none; }
.acct-opt:hover { border-color: var(--faint); }
.acct-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.acct-opt.err { border-color: var(--red); }
.editor-box { border: 1px solid var(--border); border-radius: 11px; background: var(--panel); }
.editor-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.editor-box textarea { border: 0; box-shadow: none !important; min-height: 170px; border-radius: 11px 11px 0 0; }
.editor-tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.counters { margin-left: auto; display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.counters span { display: inline-flex; align-items: center; gap: 4px; }
.counters .over { color: var(--red); font-weight: 700; }
.ov-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ov-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 4px 9px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.ov-tabs button.active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.ov-tabs button.custom::after { content: '•'; color: var(--accent-text); font-weight: 900; }
.media-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.media-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--border); }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; }
.media-thumb .rm svg { width: 13px; height: 13px; }
.media-thumb .vid { position: absolute; left: 5px; bottom: 5px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.media-add { width: 84px; height: 84px; border-radius: 10px; border: 1.5px dashed var(--border); display: grid; place-items: center; color: var(--muted); cursor: pointer; background: none; font: inherit; font-size: 12px; text-align: center; }
.media-add:hover { border-color: var(--accent); color: var(--accent-text); }
.media-add.drag { border-color: var(--accent); background: var(--accent-soft); }
.when-box { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.quick-times { display: flex; gap: 6px; flex-wrap: wrap; }
.composer-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.problems { font-size: 12.5px; color: var(--red); white-space: pre-line; }

/* network previews */
.preview { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.preview-head b { display: block; font-size: 13.5px; }
.preview-head span { font-size: 12px; color: var(--muted); }
.preview-text { white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.preview-text .over { background: var(--red-soft); color: var(--red); }
.preview-text .hl { color: var(--accent-text); }
.preview-media { display: grid; gap: 3px; margin-top: 10px; border-radius: 10px; overflow: hidden; grid-template-columns: repeat(var(--n, 1), 1fr); }
.preview-media img, .preview-media video { width: 100%; aspect-ratio: var(--ar, 1.6); object-fit: cover; display: block; background: var(--panel-2); }
.preview-foot { display: flex; gap: 18px; margin-top: 10px; color: var(--faint); font-size: 12px; }
.preview-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }

/* ---------- post detail ---------- */
.target { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.target:last-child { border-bottom: 0; }
.metrics { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); }
.metrics b { color: var(--text); }
.comment { display: flex; gap: 10px; padding: 8px 0; }
.comment .bubble { background: var(--panel-2); border-radius: 10px; padding: 8px 12px; flex: 1; }
.comment .bubble b { font-size: 12.5px; }

/* ---------- streams ---------- */
.streams { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.stream { flex: 0 0 340px; max-height: calc(100vh - 210px); display: flex; flex-direction: column; }
.stream-body { overflow-y: auto; }
.item { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.item .meta b { color: var(--text); }
.item .body { white-space: pre-wrap; word-wrap: break-word; }
.item img.pic { border-radius: 8px; margin-top: 8px; max-height: 180px; object-fit: cover; width: 100%; }

/* ---------- analytics ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 10px; }
.bars .b { flex: 1; background: var(--violet); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .9; }
.bars .b:hover { opacity: 1; background: var(--coral); }
.bars .b:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #FFF8EE; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; }
.bar-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 70px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.hbar .track { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; }
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat div { aspect-ratio: 1; border-radius: 4px; background: var(--violet); }
.heat-axis { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 10px; color: var(--faint); margin-top: 4px; }

/* ---------- accounts / clients / library ---------- */
.net-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.net-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.net-card:hover { border-color: var(--accent); }
.net-card .sub { font-size: 12px; color: var(--muted); }
.acct-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.acct-row:last-child { border-bottom: 0; }
.client-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; border-top: 4px solid var(--cc); }
.stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.stats b { color: var(--text); font-size: 15px; display: block; }
.lib-item { padding: 14px 16px; }
.lib-item .body { white-space: pre-wrap; color: var(--muted); font-size: 13px; max-height: 90px; overflow: hidden; margin-top: 6px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.media-grid .media-thumb { width: 100%; height: auto; aspect-ratio: 1; cursor: pointer; }
.media-grid .media-thumb.on { outline: 3px solid var(--accent); outline-offset: -3px; }
.media-grid .media-thumb .name { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; font-size: 11px; padding: 14px 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setting-block { padding: 18px; border-bottom: 1px solid var(--border); }
.setting-block:last-child { border-bottom: 0; }
.copy-line { display: flex; gap: 6px; align-items: center; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer { grid-template-columns: 1fr; }
  .composer-edit { border-right: 0; }
  .composer-preview { max-height: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s, box-shadow .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-grid; }
  .client-switch select { min-width: 0; }
  .page { padding: 18px 16px 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .cal-day { min-height: 84px; }
  .chip .x { display: none; }
  .post-row .when { width: 70px; }
  .modal-body { padding: 18px; }
  .composer { margin: -18px; }
  .hbar { grid-template-columns: 90px 1fr 50px; }
}

/* ---------- v2: navigation, security, tour ---------- */
.btn.block { width: 100%; justify-content: center; }
.center { text-align: center; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
kbd { font: 600 11px/1 var(--font-body); background: var(--panel-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; color: var(--muted); }
.code-input { font-size: 22px; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.auth .faint svg { width: 13px; height: 13px; vertical-align: -2px; }
.auth .lead svg { vertical-align: -3px; }

.search-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 11px; min-width: 260px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); color: var(--faint); font: inherit; cursor: pointer; text-align: left; }
.search-btn:hover { border-color: var(--faint); color: var(--muted); }
.search-btn svg { width: 16px; height: 16px; }
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; border-radius: 99px; background: var(--coral); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.bell-panel { position: fixed; z-index: 90; width: min(380px, calc(100vw - 16px)); max-height: min(520px, calc(100vh - 80px)); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .15s ease; }
.bell-list { overflow-y: auto; }
.bell-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; font: inherit; color: inherit; cursor: pointer; }
.bell-item:hover { background: var(--panel-2); }
.bell-item.unread { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.bell-item b { display: block; font-weight: 600; font-size: 13px; }
.bell-item .small { display: block; }
.bell-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); flex: none; }
.bell-ic svg { width: 15px; height: 15px; }
.bell-ic.k-failed, .bell-ic.k-changes_requested { background: var(--red-soft); color: var(--red); }
.bell-ic.k-approved { background: var(--green-soft); color: var(--green); }
.bell-ic.k-approval_requested { background: var(--amber-soft); color: var(--amber); }
.bell-ic.k-assigned, .bell-ic.k-comment { background: var(--blue-soft); color: var(--blue); }

.palette-wrap { position: fixed; inset: 0; z-index: 150; background: rgba(26, 21, 48, .5); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: fade .12s; }
.palette { width: min(640px, 100%); background: var(--panel); border-radius: 18px; border: 2px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .15s ease; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.palette-input input { border: 0; box-shadow: none !important; padding: 0; font-size: 16px; background: transparent; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px; background: none; font: inherit; color: var(--text); cursor: pointer; }
.palette-item svg { width: 16px; height: 16px; color: var(--muted); }
.palette-item.active { background: var(--accent-soft); }
.palette-item.active svg { color: var(--accent-text); }
.palette-empty { padding: 24px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.palette-foot kbd { margin-right: 3px; }

.tour-overlay { position: fixed; inset: 0; z-index: 180; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(26, 21, 48, .55); transition: all .25s ease; pointer-events: none; outline: 3px solid var(--sun); }
.tour-card { position: fixed; padding: 20px; border: 2px solid var(--line); box-shadow: 5px 5px 0 var(--pop); transition: top .25s ease, left .25s ease; }
.tour-step { margin-bottom: 4px; }

.help-list { padding-left: 20px; line-height: 1.7; margin: 0; }
.help-list li + li { margin-top: 6px; }
.steps { padding-left: 20px; line-height: 1.7; margin: 0 0 8px; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 12px; width: 224px; margin: 8px auto; }
.qr svg { width: 200px; height: 200px; }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.check-list li:last-child { border-bottom: 0; }
.check-list .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; }
.check-list .done .tick { background: var(--teal); border-color: var(--teal); color: var(--ink); }
.check-list .done .tick svg { width: 13px; height: 13px; }
.check-list .done .lbl { color: var(--muted); text-decoration: line-through; }
.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--violet); border-radius: 99px; }
.progress.warn > div { background: var(--sun); }
.progress.over > div { background: var(--coral); }

@media (max-width: 820px) {
  .search-btn { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
}
.comment .bubble.internal { background: var(--amber-soft); }
.crop-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.crop-stage { position: relative; height: min(56vh, 460px); background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 0 / 20px 20px; border-radius: 12px; overflow: hidden; margin-top: 12px; touch-action: none; cursor: grab; user-select: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage img { position: absolute; max-width: none; pointer-events: none; }
.crop-frame { position: absolute; box-shadow: 0 0 0 9999px rgba(10, 12, 25, .55); outline: 2px solid #fff; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px); background-size: 33.33% 33.33%; }
.media-thumb .crop { position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; }
.media-thumb .crop svg { width: 12px; height: 12px; }
.ai-variant { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-top: 10px; }
.ai-variant .tags { color: var(--accent-text); font-size: 13px; margin-top: 6px; }
.tag-chip { display: inline-flex; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--panel); font: inherit; font-size: 13px; cursor: pointer; margin: 0 6px 6px 0; color: var(--text); }
.tag-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.tool-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.tool-btn:hover { background: var(--panel-2); color: var(--text); }
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn.ai { color: var(--accent-text); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -4px; }
@keyframes spin { to { transform: rotate(360deg); } }
