/* =========================================================
   Relay — design tokens
   ========================================================= */
:root {
  --bg: #f4f3ef;
  --bg-elev: #ffffff;
  --bg-sunk: #eceae4;
  --line: #e4e1da;
  --line-strong: #d3cfc6;
  --ink: #17171a;
  --ink-2: #4a4945;
  --muted: #8a877f;
  --accent: #ff5b1f;
  --accent-ink: #ffffff;
  --accent-soft: #ffece4;

  --ok: #1f8a4c;      --ok-soft: #e3f3e8;
  --warn: #b4690e;    --warn-soft: #fbf0dd;
  --err: #c8341c;     --err-soft: #fbe5e0;
  --info: #2b59c3;    --info-soft: #e5ecfa;

  --fb: #0866ff;
  --ig: linear-gradient(45deg, #feda75, #fa7e1e 30%, #d62976 60%, #962fbf 85%, #4f5bd5);
  --tt: #000000;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow: 0 1px 0 rgba(23, 23, 26, .04), 0 1px 3px rgba(23, 23, 26, .06);
  --shadow-lg: 0 24px 48px -18px rgba(23, 23, 26, .22), 0 2px 6px rgba(23, 23, 26, .05);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --bg-elev: #1a1a18;
    --bg-sunk: #0b0b0a;
    --line: #2a2926;
    --line-strong: #3a3935;
    --ink: #eeede9;
    --ink-2: #bdbbb4;
    --muted: #85837c;
    --accent-soft: #3a1d12;
    --ok: #4cc27c;   --ok-soft: #14291c;
    --warn: #e5a34a; --warn-soft: #2f2412;
    --err: #f0705a;  --err-soft: #34160f;
    --info: #7da2f2; --info-soft: #172240;
    --tt: #000;
    --shadow: 0 1px 0 rgba(0,0,0,.4);
    --shadow-lg: 0 24px 48px -18px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

i[data-icon], i[data-pf] { display: inline-flex; flex: none; font-style: normal; }
i[data-icon] svg { width: 16px; height: 16px; }

/* =========================================================
   Shell
   ========================================================= */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
}
.logo {
  display: flex; align-items: center; gap: 10px; padding: 0 8px;
  text-decoration: none; color: var(--ink); font-weight: 650; font-size: 17px; letter-spacing: -.02em;
}
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--bg-sunk); color: var(--ink); }
.nav a.active { background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow); }
.nav .count {
  margin-left: auto; font: 500 11px var(--mono); color: var(--muted);
}
.nav .count:empty { display: none; }

.sidebar-foot { margin-top: auto; }
.mode {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg-elev);
}
.mode .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); flex: none; }
.mode.live .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.mode b { display: block; font-size: 13px; font-weight: 600; }
.mode small { color: var(--muted); line-height: 1.4; display: block; }

.main { padding: 40px 48px 96px; max-width: 1280px; width: 100%; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  margin-bottom: 32px;
}
.eyebrow {
  font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin-bottom: 10px;
}
h1 {
  font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1.02; letter-spacing: -.015em;
}
h1 em { font-style: italic; color: var(--muted); }

/* =========================================================
   Controls
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--bg-elev);
  font-weight: 550; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  transition: transform .08s, background .15s, opacity .15s, box-shadow .15s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-sm svg { width: 14px; height: 14px; }
.btn:hover { background: var(--bg-sunk); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-ink:hover { background: var(--ink); opacity: .88; }
.btn-accent {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: 10px;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn-accent:hover { background: var(--accent); filter: brightness(1.05); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-sunk); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-danger { color: var(--err); }

.toggle {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--bg-sunk); border-radius: 10px;
}
.toggle button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px;
  font-weight: 500; font-size: 13px; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.toggle button.on { background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow); }
.toggle button span { font: 500 11px var(--mono); color: var(--muted); }
.toggle button span:empty { display: none; }
.toggle.small button { padding: 4px 10px; font-size: 12.5px; }
.toggle button.off:not(.on) { color: var(--muted); opacity: .55; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-strong); background: transparent; border-radius: 999px;
  padding: 4px 11px; font-size: 12.5px; color: var(--ink-2);
}
.chip.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }

textarea, input[type="datetime-local"] {
  width: 100%; border: 1px solid var(--line); background: var(--bg-elev);
  border-radius: var(--r); padding: 12px 14px; resize: vertical; line-height: 1.55;
  transition: border-color .15s, box-shadow .15s;
}
textarea::placeholder { color: var(--muted); }
textarea:focus, input:focus {
  outline: none; border-color: var(--ink-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 7%, transparent);
}

/* =========================================================
   Composer
   ========================================================= */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }

.editor { display: grid; gap: 30px; }
.block-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.block-head .num { font: 500 11px var(--mono); color: var(--accent); }
.block-head h3 { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.block-head .hint { margin-left: auto; font-size: 12px; color: var(--muted); }

.brief {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elev);
  box-shadow: var(--shadow); overflow: hidden;
}
.brief textarea { border: 0; border-radius: 0; box-shadow: none !important; padding: 14px 16px 6px; font-size: 14.5px; }
.brief-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 10px 10px 16px; border-top: 1px dashed var(--line);
}
.brief-bar .btn i svg { color: var(--accent); }
.btn.loading i svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs-line { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs-line button {
  border: 0; background: none; padding: 0 0 10px; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs-line button.on { color: var(--ink); border-color: var(--ink); }
.tabs-line button.filled::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.caption { font-size: 15px; min-height: 170px; }
.note { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

.drop {
  display: block; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--bg-elev); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--ink-2); }
.drop.over { background: var(--accent-soft); }
.drop-empty { display: flex; align-items: center; gap: 14px; padding: 22px; color: var(--ink-2); }
.drop-empty > i {
  width: 40px; height: 40px; border-radius: 10px; background: var(--bg-sunk);
  align-items: center; justify-content: center;
}
.drop-empty b { font-weight: 600; color: var(--ink); }
.drop-empty small { display: block; color: var(--muted); margin-top: 2px; }
.drop-file { display: flex; align-items: center; gap: 14px; padding: 12px; }
.drop-file .media-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--bg-sunk); }
.drop-file .meta { flex: 1; min-width: 0; }
.drop-file .meta b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-file .meta small { color: var(--muted); font-family: var(--mono); }

.format { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.format label { cursor: pointer; }
.format input { position: absolute; opacity: 0; pointer-events: none; }
.format span {
  display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg-elev); transition: border-color .15s, box-shadow .15s;
}
.format b { display: block; font-weight: 600; font-size: 13.5px; }
.format small { color: var(--muted); }
.format input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.format input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.acc {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg-elev); cursor: pointer; transition: border-color .15s, opacity .15s;
}
.acc input { position: absolute; opacity: 0; pointer-events: none; }
.acc .check {
  margin-left: auto; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong);
  display: grid; place-items: center; flex: none; transition: all .15s;
}
.acc .check svg { width: 12px; height: 12px; opacity: 0; color: var(--bg); }
.acc:has(input:checked) { border-color: var(--ink); }
.acc:has(input:checked) .check { background: var(--ink); border-color: var(--ink); }
.acc:has(input:checked) .check svg { opacity: 1; }
.acc .who { min-width: 0; }
.acc .who b { display: block; font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc .who small { color: var(--muted); }
.acc.blocked .who small { color: var(--warn); }
.acc.blocked:not(:has(input:checked)) { opacity: .6; }
.empty-inline {
  padding: 18px; border: 1px dashed var(--line-strong); border-radius: var(--r);
  color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}

.when { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.when input { width: auto; padding: 7px 12px; border-radius: 10px; font-family: var(--mono); font-size: 13px; }

.submit-bar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 10px 10px 18px; border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.submit-bar p { color: var(--ink-2); font-size: 13px; }
.submit-bar p b { color: var(--ink); font-weight: 600; }

/* ---------- platform marks ---------- */
.pf { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; flex: none; }
.pf svg { width: 13px; height: 13px; }
.pf.lg { width: 36px; height: 36px; border-radius: 10px; }
.pf.lg svg { width: 20px; height: 20px; }
.pf.facebook { background: var(--fb); }
.pf.instagram { background: var(--ig); }
.pf.tiktok { background: var(--tt); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.tabs-line .pf { width: 16px; height: 16px; border-radius: 4px; }
.tabs-line .pf svg { width: 10px; height: 10px; }

/* =========================================================
   Live preview (mockups)
   ========================================================= */
.preview { position: sticky; top: 40px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.preview-head .eyebrow { margin: 0; }
.stage {
  border-radius: 24px; padding: 28px 22px; min-height: 560px;
  background:
    radial-gradient(circle at 1px 1px, var(--line-strong) 1px, transparent 0) 0 0 / 16px 16px,
    var(--bg-sunk);
  border: 1px solid var(--line);
  display: grid; place-items: start center;
}

.mock { width: 100%; max-width: 320px; background: #fff; color: #111; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); font-size: 13px; animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.mock .m-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px; }
.mock .avatar { width: 30px; height: 30px; border-radius: 50%; background: #e9e7e1; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #555; flex: none; }
.mock .m-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.mock .m-sub { color: #8a8a8a; font-size: 11.5px; }
.mock .m-media { background: #ecebe7; display: grid; place-items: center; color: #9b9a95; overflow: hidden; }
.mock .m-media img, .mock .m-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mock .m-cap { padding: 4px 12px 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; max-height: 150px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.mock .m-cap.empty { color: #a5a49e; }
.mock .m-icons { display: flex; gap: 14px; padding: 10px 12px 6px; }
.mock .m-icons svg { width: 20px; height: 20px; }
.mock .m-icons .end { margin-left: auto; }
.placeholder-art { display: grid; place-items: center; gap: 6px; text-align: center; font-size: 11.5px; }
.placeholder-art svg { width: 28px; height: 28px; opacity: .6; }

/* Instagram */
.mock.ig .avatar { background: var(--ig); padding: 2px; }
.mock.ig .avatar span { width: 100%; height: 100%; border-radius: 50%; background: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.mock.ig .m-media { aspect-ratio: 4 / 5; }
.mock.ig .m-cap b { margin-right: 4px; }

/* Facebook */
.mock.fb { background: #fff; }
.mock.fb .avatar { background: #dfe6f3; color: var(--fb); }
.mock.fb .m-cap { padding: 0 12px 10px; }
.mock.fb .m-media { aspect-ratio: 1 / 1; }
.mock.fb .m-media.none { display: none; }
.mock.fb .fb-bar { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #eee; margin: 6px 12px 0; padding: 6px 0; color: #65676b; font-weight: 600; font-size: 12px; text-align: center; }

/* TikTok */
.mock.tt { background: #000; color: #fff; aspect-ratio: 9 / 16; position: relative; max-width: 270px; border-radius: 22px; }
.mock.tt .m-media { position: absolute; inset: 0; background: #161616; color: #666; }
.mock.tt .tt-side { position: absolute; right: 10px; bottom: 90px; display: grid; gap: 16px; justify-items: center; font-size: 10.5px; font-weight: 600; }
.mock.tt .tt-side svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.mock.tt .tt-foot { position: absolute; left: 0; right: 56px; bottom: 0; padding: 60px 12px 16px; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.mock.tt .tt-foot b { display: block; font-size: 13px; margin-bottom: 4px; }
.mock.tt .tt-foot p { font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; max-height: 68px; overflow: hidden; }
.mock.tt .tt-top { position: absolute; top: 14px; left: 0; right: 0; text-align: center; font-size: 12.5px; font-weight: 600; opacity: .9; }
.mock.tt .tt-top span { opacity: .55; margin-right: 14px; }

/* Story layout (IG/FB) */
.mock.story { aspect-ratio: 9 / 16; max-width: 270px; position: relative; background: #111; border-radius: 22px; }
.mock.story .m-media { position: absolute; inset: 0; background: #1d1d1d; color: #666; }
.mock.story .m-head { position: absolute; top: 14px; left: 0; right: 0; color: #fff; z-index: 1; }
.mock.story .m-head::before { content: ""; position: absolute; top: -8px; left: 10px; right: 10px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.5); }
.mock.story .m-sub { color: rgba(255,255,255,.7); }

.skip-card {
  max-width: 320px; width: 100%; border-radius: 16px; padding: 28px 24px; text-align: center;
  background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.skip-card .pf { margin: 0 auto 14px; }
.skip-card b { display: block; font-weight: 600; margin-bottom: 4px; }
.skip-card p { color: var(--muted); font-size: 13px; }

/* =========================================================
   Status pills
   ========================================================= */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 550; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.published { color: var(--ok); background: var(--ok-soft); }
.pill.failed { color: var(--err); background: var(--err-soft); }
.pill.partial, .pill.skipped { color: var(--warn); background: var(--warn-soft); }
.pill.scheduled, .pill.pending { color: var(--info); background: var(--info-soft); }
.pill.publishing { color: var(--info); background: var(--info-soft); }
.pill.publishing::before { animation: pulse 1s ease-in-out infinite; }
.pill.dummy { color: var(--muted); background: var(--bg-sunk); }
.pill.dummy::before { display: none; }
@keyframes pulse { 50% { opacity: .25; } }

/* =========================================================
   Queue
   ========================================================= */
.list { display: grid; gap: 12px; }
.post {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 18px; align-items: start;
  padding: 16px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.post .thumb {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--bg-sunk);
  display: grid; place-items: center; color: var(--muted);
}
.post .thumb svg { width: 22px; height: 22px; }
.post .body { min-width: 0; }
.post .top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.post .kind { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.post .cap { color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px; white-space: pre-line; }
.post .cap.empty { color: var(--muted); font-style: italic; }
.targets { display: flex; flex-wrap: wrap; gap: 8px; }
.target {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; max-width: 100%;
}
.target .pf { width: 20px; height: 20px; border-radius: 50%; }
.target .pf svg { width: 11px; height: 11px; }
.target .s { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.target .s.published { background: var(--ok); }
.target .s.failed { background: var(--err); }
.target .s.skipped { background: var(--warn); }
.target .s.pending, .target .s.publishing { background: var(--info); }
.target .s.publishing { animation: pulse 1s ease-in-out infinite; }
.errors { margin-top: 10px; display: grid; gap: 4px; }
.errors p { font-size: 12.5px; color: var(--ink-2); }
.errors p b { font-weight: 600; }
.errors p.failed b { color: var(--err); }
.errors p.skipped b { color: var(--warn); }
.post .side { display: grid; justify-items: end; gap: 10px; }
.post .time { font: 400 12px var(--mono); color: var(--muted); white-space: nowrap; text-align: right; }
.post .time b { display: block; color: var(--ink); font-weight: 500; font-size: 12.5px; }
.post .actions { display: flex; gap: 4px; }

.empty {
  padding: 72px 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
}
.empty h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 18px; }

/* =========================================================
   Accounts
   ========================================================= */
.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 20px;
  border-radius: var(--r); background: var(--warn-soft); color: var(--ink-2); font-size: 13px;
}
.banner:empty { display: none; }
.banner b { color: var(--ink); }
.banner code { font: 12px var(--mono); background: var(--bg-elev); padding: 1px 6px; border-radius: 4px; }
.channels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.channel {
  display: flex; flex-direction: column; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.channel .c-head { padding: 20px 20px 16px; display: grid; gap: 14px; }
.channel .c-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.channel .c-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.channel .c-req { display: grid; gap: 6px; padding: 0 20px 18px; }
.channel .c-req li { list-style: none; display: flex; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.channel .c-req li::before { content: "—"; color: var(--muted); }
.channel .c-list { border-top: 1px solid var(--line); flex: 1; }
.channel .c-acc { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.channel .c-acc:last-child { border-bottom: 0; }
.channel .c-acc .who { flex: 1; min-width: 0; }
.channel .c-acc .who b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel .c-acc .who small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.channel .c-acc .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-sunk); display: grid; place-items: center; font-weight: 600; font-size: 11px; color: var(--ink-2); }
.channel .c-none { padding: 18px 20px; color: var(--muted); font-size: 13px; }
.channel .c-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg); }
.channel .c-foot .btn { width: 100%; }

/* =========================================================
   Toasts
   ========================================================= */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px;
  padding: 12px 14px; border-radius: 12px; background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-lg); font-size: 13px; animation: rise .2s ease;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.error::before { background: var(--err); }

/* =========================================================
   Forms (shared: login, dialogs)
   ========================================================= */
.input { display: grid; gap: 6px; margin-bottom: 16px; }
.input > span { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.input input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-elev);
  transition: border-color .15s, box-shadow .15s;
}
.input input:disabled { background: var(--bg-sunk); color: var(--muted); }
.input input:focus {
  outline: none; border-color: var(--ink-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 7%, transparent);
}
.form-error {
  padding: 10px 12px; border-radius: 10px; background: var(--err-soft); color: var(--err);
  font-size: 13px; margin-bottom: 16px;
}
.btn-block { width: 100%; }
.pw { position: relative; }
.pw input { padding-right: 84px !important; }
.pw-toggle {
  position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 10px; border-radius: 7px;
  border: 0; background: var(--bg-sunk); color: var(--ink-2); font-size: 12px; font-weight: 550;
}

/* =========================================================
   Login
   ========================================================= */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 36px 44px; background: #17171a; color: #f4f3ef;
}
.auth-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0) 0 0 / 18px 18px;
}
.auth-art .logo { color: #f4f3ef; padding: 0; position: relative; z-index: 1; }
.auth-quote { position: relative; z-index: 1; max-width: 440px; }
.auth-quote h2 { font-family: var(--serif); font-weight: 400; font-size: 54px; line-height: 1; letter-spacing: -.015em; margin-bottom: 16px; }
.auth-quote h2 em { color: #ff5b1f; }
.auth-quote p { color: #a9a7a0; font-size: 15px; max-width: 360px; }

.orbit { position: relative; width: 300px; height: 300px; margin: 24px auto; z-index: 1; }
.orbit::before, .orbit::after {
  content: ""; position: absolute; border-radius: 50%; border: 1px dashed rgba(255,255,255,.14);
}
.orbit::before { inset: 0; }
.orbit::after { inset: 62px; }
.orbit .core {
  position: absolute; inset: 118px; border-radius: 50%; background: #ff5b1f;
  box-shadow: 0 0 0 10px rgba(255,91,31,.12), 0 0 60px rgba(255,91,31,.45);
}
.orbit .node {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px; border-radius: 12px;
  animation: orbit 18s linear infinite; box-shadow: 0 10px 24px rgba(0,0,0,.4);
  display: grid; place-items: center;
}
.orbit .node svg { width: 22px; height: 22px; }
.orbit .fb { background: var(--fb); }
.orbit .ig { background: var(--ig); animation-delay: -6s; }
.orbit .tt { background: #000; border: 1px solid #333; animation-delay: -12s; }
@keyframes orbit {
  from { transform: rotate(0deg) translateX(150px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(150px) rotate(-360deg); }
}
@media (prefers-reduced-motion: reduce) { .orbit .node { animation: none; } }

.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h1 { margin-bottom: 32px; }
.auth-form .btn-accent { margin-top: 8px; }
.auth-foot { margin-top: 20px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* =========================================================
   Sidebar user menu
   ========================================================= */
.sidebar-foot { display: grid; gap: 10px; }
.me { position: relative; }
.me-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 0; background: transparent; border-radius: 10px; text-align: left;
}
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--bg-sunk); }
.me-btn .who { flex: 1; min-width: 0; }
.me-btn .who b { display: block; font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-btn .who small { color: var(--muted); text-transform: capitalize; }
.me-btn > i { color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 11.5px; background: var(--bg-sunk); color: var(--ink-2);
}
.avatar.tone-1 { background: #ffe1d4; color: #a3360c; }
.avatar.tone-2 { background: #dbe7ff; color: #1f47a3; }
.avatar.tone-3 { background: #dff2e5; color: #1f6b3d; }
.avatar.tone-4 { background: #f1e1fb; color: #6f2a99; }
.avatar.tone-5 { background: #fdf0c9; color: #8a5d00; }
.menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30;
  padding: 6px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 0; background: none; border-radius: 8px; font-size: 13px; text-align: left;
}
.menu button:hover { background: var(--bg-sunk); }
.menu button.danger { color: var(--err); }

/* =========================================================
   Team table
   ========================================================= */
.table-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.table-tools { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 9px; background: var(--bg-sunk); color: var(--muted); min-width: 260px; }
.search input { border: 0; background: none; outline: none; width: 100%; font-size: 13px; color: var(--ink); }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 16px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--bg-sunk) 50%, transparent); }
.table .user { display: flex; align-items: center; gap: 12px; }
.table .user b { display: block; font-weight: 550; }
.table .user small { color: var(--muted); }
.table .you { font: 500 10.5px var(--mono); color: var(--accent); margin-left: 6px; text-transform: uppercase; letter-spacing: .05em; }
.table .num, .table .ts { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.table .ts { color: var(--muted); }
.table .row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.table .empty-row td { text-align: center; padding: 40px; color: var(--muted); }
.role { font-size: 12.5px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.role.admin::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.role.editor::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--line-strong); }
.roles-note { margin-top: 14px; }
.roles-note b { color: var(--ink-2); font-weight: 600; }

/* =========================================================
   Dialogs
   ========================================================= */
.modal {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow-lg);
}
.modal[open] { animation: rise .2s ease; }
.modal::backdrop { background: rgba(15, 15, 14, .45); backdrop-filter: blur(3px); }
.modal form { padding: 20px 22px 18px; }
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal header h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-pick input { position: absolute; opacity: 0; pointer-events: none; }
.role-pick span { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.role-pick b { display: block; font-size: 13px; font-weight: 600; }
.role-pick small { color: var(--muted); }
.role-pick input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.role-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: auto; padding: 24px; }
  .orbit { display: none; }
  .auth-quote { margin-top: 40px; }
  .auth-quote h2 { font-size: 40px; }
  .table th:nth-child(4), .table td:nth-child(4), .table th:nth-child(5), .table td:nth-child(5) { display: none; }
}
@media (max-width: 1180px) {
  .compose { grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; }
  .channels { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .compose { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center;
    padding: 10px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px);
  }
  .sidebar > .logo span, .sidebar-foot .mode, .me-btn .who, .me-btn > i { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; }
  .menu { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); width: 210px; }
  .table-tools .search { min-width: 0; flex: 1; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .nav { display: flex; gap: 2px; overflow-x: auto; }
  .nav a { padding: 6px 10px; white-space: nowrap; }
  .main { padding: 28px 16px 96px; }
  h1 { font-size: 34px; }
  .format { grid-template-columns: 1fr; }
  .channels { grid-template-columns: 1fr; }
  .post { grid-template-columns: 56px minmax(0, 1fr); }
  .post .thumb { width: 56px; height: 56px; }
  .post .side { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .post .time { text-align: left; }
  .submit-bar { flex-direction: column; align-items: stretch; }
  .submit-bar .btn { width: 100%; }
}
