/* Layout: planner-style workspace. Left rail (brands + nav), wide calendar sheet, composer card docked right.
   Palette: sage-tinted paper and deep forest ink, with a marigold accent for "go" actions and today. */
:root {
  --paper: #f4f5f0; --surface: #ffffff; --sunk: #eceee7; --line: #dfe2d8; --line-strong: #c9cdc0;
  --ink: #17221d; --ink-2: #4b5a52; --muted: #7b877f;
  --forest: #1f5a45; --forest-ink: #ffffff; --forest-soft: #e2ede6;
  --marigold: #f0a020; --marigold-soft: #fdf0d6; --marigold-ink: #3a2500;
  --ok: #1f8a4c; --ok-soft: #dff3e6; --warn: #b7791f; --warn-soft: #fbefd9; --bad: #c0392b; --bad-soft: #fbe3df; --info: #2f6fb3; --info-soft: #e1ecf8;
  --shadow: 0 1px 2px rgba(23, 34, 29, .06), 0 8px 24px rgba(23, 34, 29, .06);
  --facebook: #1877f2; --instagram: #d62976; --linkedin: #0a66c2; --youtube: #e62117; --gbp: #1a73e8;
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --r: 14px; --r-sm: 9px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1512; --surface: #161e1a; --sunk: #1c2621; --line: #26322c; --line-strong: #34433b;
    --ink: #e9efe9; --ink-2: #b4c1b8; --muted: #7f8f86;
    --forest: #3fa37c; --forest-ink: #06140e; --forest-soft: #1b3329;
    --marigold: #f5b13d; --marigold-soft: #3a2c12; --marigold-ink: #1c1200;
    --ok: #4cc27f; --ok-soft: #173225; --warn: #e5a94a; --warn-soft: #382a14; --bad: #ef6b5e; --bad-soft: #3b1c19; --info: #6aa8ea; --info-soft: #172a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1512; --surface: #161e1a; --sunk: #1c2621; --line: #26322c; --line-strong: #34433b;
  --ink: #e9efe9; --ink-2: #b4c1b8; --muted: #7f8f86;
  --forest: #3fa37c; --forest-ink: #06140e; --forest-soft: #1b3329;
  --marigold: #f5b13d; --marigold-soft: #3a2c12; --marigold-ink: #1c1200;
  --ok: #4cc27f; --ok-soft: #173225; --warn: #e5a94a; --warn-soft: #382a14; --bad: #ef6b5e; --bad-soft: #3b1c19; --info: #6aa8ea; --info-soft: #172a3d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 11px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px var(--forest-soft); }
textarea { resize: vertical; line-height: 1.55; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
button { cursor: pointer; border: 1px solid transparent; border-radius: var(--r-sm); padding: 9px 15px; background: var(--sunk); font-weight: 600; transition: background .15s, border-color .15s, transform .05s; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--forest); color: var(--forest-ink); }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.secondary { background: var(--forest-soft); color: var(--forest); }
.go { background: var(--marigold); color: var(--marigold-ink); }
.go:hover:not(:disabled) { filter: brightness(1.05); }
.ghost { background: transparent; border-color: var(--line-strong); }
.ghost:hover:not(:disabled) { background: var(--sunk); }
.danger { background: transparent; border-color: var(--bad-soft); color: var(--bad); }
.icon { background: transparent; padding: 6px; border-radius: 8px; display: inline-grid; place-items: center; }
.icon:hover { background: var(--sunk); }
.icon svg, .nav-ico { width: 18px; height: 18px; }
.small { font-size: 12px; padding: 6px 11px; }
.wide { width: 100%; padding: 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.lbl { display: flex; gap: 6px; align-items: baseline; font-size: 11px; color: var(--muted); margin: 0 0 7px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.lbl .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
a { color: var(--forest); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr) 380px; height: 100%; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; min-height: 0; overflow: auto; }
.logo { display: flex; align-items: center; gap: 10px; font: 700 19px var(--font-display); padding: 0 8px; letter-spacing: -.02em; }
.logo img { width: 30px; height: 30px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--ink-2); text-decoration: none; padding: 9px 10px; border-radius: 10px; display: flex; align-items: center; gap: 11px; font-weight: 600; }
.sidebar nav a:hover { background: var(--sunk); color: var(--ink); }
.sidebar nav a.active { background: var(--forest-soft); color: var(--forest); }
.side-sec { display: flex; flex-direction: column; gap: 2px; }
.side-sec .lbl { padding: 0 10px; margin-bottom: 4px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: transparent; border: 0; text-align: left; font-weight: 600; color: var(--ink-2); width: 100%; }
.side-brand:hover { background: var(--sunk); }
.side-brand.on { background: var(--sunk); color: var(--ink); }
.side-brand .count { margin-left: auto; font: 500 11px var(--font-mono); color: var(--muted); }
.mono-badge { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font: 800 11px var(--font-display); color: #fff; flex: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 6px; font-size: 12px; }
.sidebar-foot .row2 { display: flex; align-items: center; justify-content: space-between; }
.sidebar-foot a { color: var(--muted); }
#modeBadge:not(:empty) { background: var(--marigold-soft); color: var(--warn); padding: 7px 10px; border-radius: 9px; font-weight: 600; }

.main { overflow: auto; padding: 26px 28px 40px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar h1 { font-size: 28px; margin: 0; margin-right: auto; line-height: 1.1; }
.toolbar h1 small { display: block; font: 600 12px var(--font-body); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.toolbar select { width: auto; }
.cal-nav { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.cal-nav strong { min-width: 132px; text-align: center; font-family: var(--font-display); }
.cal-nav button { padding: 5px 10px; background: transparent; }
.cal-nav button:hover { background: var(--sunk); }
.banner { padding: 11px 14px; border-radius: 11px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.banner.info { background: var(--info-soft); color: var(--info); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.stat b { font: 700 24px var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat i { width: 8px; height: 8px; border-radius: 50%; align-self: center; flex: none; }

.brand-filter, .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; }
.chip:hover { border-color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.dow { padding: 10px 10px 8px; font: 700 11px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.day { min-height: 124px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; min-width: 0; position: relative; transition: background .12s; }
.day:nth-child(7n) { border-right: 0; }
.day:nth-last-child(-n+7) { border-bottom: 0; }
.day.other { background: var(--paper); }
.day.other .num { color: var(--line-strong); }
.day:hover { background: var(--sunk); }
.day:hover::after { content: "+"; position: absolute; top: 5px; right: 8px; color: var(--muted); font-weight: 700; }
.day.drop-over { background: var(--forest-soft); }
.num { font: 600 13px var(--font-mono); color: var(--ink-2); align-self: flex-start; padding: 1px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.day.today .num { background: var(--marigold); color: var(--marigold-ink); }
.pchip { display: flex; gap: 7px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 4px; font-size: 11.5px; cursor: grab; min-width: 0; overflow: hidden; box-shadow: 0 1px 0 var(--line); position: relative; }
.pchip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--bc, var(--forest)); }
.pchip:hover { border-color: var(--line-strong); }
.pchip img, .pchip video, .pchip .noimg { width: 30px; height: 30px; object-fit: cover; border-radius: 6px; flex: none; background: var(--sunk); margin-left: 3px; }
.pchip .noimg { display: grid; place-items: center; color: var(--muted); font-weight: 800; font-size: 13px; }
.pchip .noimg::after { content: "Aa"; }
.pchip .meta { min-width: 0; flex: 1; }
.pchip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.pchip .t time { font: 600 11px var(--font-mono); color: var(--ink-2); }
.pchip .badges .pb { width: 17px; height: 17px; border-radius: 5px; }
.pchip .badges { display: flex; gap: 2px; margin-top: 3px; align-items: center; overflow: hidden; }
.sdot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none; background: var(--muted); }
.sdot.scheduled { background: var(--info); } .sdot.published { background: var(--ok); } .sdot.failed { background: var(--bad); }
.sdot.partial { background: var(--warn); } .sdot.publishing { background: var(--marigold); } .sdot.draft { background: var(--line-strong); }
.more { font-size: 11px; color: var(--forest); font-weight: 700; padding-left: 4px; }

.pb { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; color: #fff; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.pb svg { width: 82%; height: 82%; display: block; }
.pb.lg { width: 36px; height: 36px; border-radius: 10px; }
.pb.xl { width: 44px; height: 44px; border-radius: 12px; }
.pb.facebook { background: var(--facebook); } .pb.instagram { background: linear-gradient(45deg, #feda75, #fa7e1e 25%, #d62976 55%, #962fbf 80%, #4f5bd5); }
.pb.facebook { background: #1877f2; } .pb.linkedin { background: #0a66c2; } .pb.youtube { background: #ff0033; } .pb.gbp { background: #1a73e8; }
.st { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.st.scheduled { background: var(--info-soft); color: var(--info); } .st.published { background: var(--ok-soft); color: var(--ok); } .st.failed { background: var(--bad-soft); color: var(--bad); }
.st.partial { background: var(--warn-soft); color: var(--warn); } .st.publishing { background: var(--marigold-soft); color: var(--warn); }

/* ---------- composer ---------- */
.composer { background: var(--surface); border-left: 1px solid var(--line); padding: 22px 20px 28px; overflow: auto; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.composer-head { display: flex; align-items: center; justify-content: space-between; }
.composer-head h2 { margin: 0; font-size: 21px; }
#closeComposer { display: none; }
.field { display: flex; flex-direction: column; }
.acct-toggles { display: flex; flex-direction: column; gap: 6px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 7px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; transition: border-color .15s, background .15s; }
.toggle:has(input:checked) { border-color: var(--forest); background: var(--forest-soft); }
.toggle .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.toggle input { display: none; }
.switch { width: 36px; height: 21px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .switch { background: var(--forest); }
.toggle input:checked + .switch::after { left: 18px; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 12px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; background: var(--paper); }
.drop.over { border-color: var(--forest); background: var(--forest-soft); }
.drop .small.muted { font-size: 12px; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 9px; overflow: hidden; background: var(--sunk); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 3px; right: 3px; padding: 0 6px; font-size: 11px; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; }
.thumb .vtag { position: absolute; bottom: 3px; left: 3px; font-size: 10px; font-weight: 700; background: rgba(0,0,0,.6); color: #fff; padding: 1px 6px; border-radius: 5px; }
.thumb.uploading { display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; }
.actions > * { flex: 1; }
.warnings:not(:empty) { padding: 10px 12px; background: var(--warn-soft); border-radius: 10px; color: var(--warn); font-size: 12.5px; font-weight: 600; }
.formats:empty { display: none; }
.formats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.formats div { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--sunk); padding: 3px 9px 3px 4px; border-radius: 999px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; cursor: pointer; font-weight: 600; }
.check input { width: auto; accent-color: var(--forest); }
.targets { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.target { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; background: var(--paper); border: 1px solid var(--line); padding: 7px 9px; border-radius: 10px; }
.target .err { color: var(--bad); }
.preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.preview .ph { display: flex; align-items: center; gap: 8px; padding: 9px 11px; font-weight: 700; font-size: 13px; }
.preview .ph .mono-badge { width: 26px; height: 26px; border-radius: 50%; }
.preview .pm { aspect-ratio: 4 / 3; max-width: 100%; background: var(--sunk); position: relative; }
.preview .pm img, .preview .pm video { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview .pm .count { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.preview .pc { padding: 9px 11px 11px; font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 7.5em; overflow: hidden; }
.preview .pc:empty::before { content: "Your caption will appear here."; color: var(--muted); }

/* ---------- lists & accounts ---------- */
.post-list { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; gap: 14px; align-items: center; padding: 10px 14px 10px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; position: relative; overflow: hidden; }
.prow::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--bc, var(--forest)); }
.prow:hover { border-color: var(--line-strong); }
.prow img, .prow video, .prow .noimg { width: 54px; height: 54px; border-radius: 9px; object-fit: cover; background: var(--sunk); flex: none; margin-left: 4px; }
.prow .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.prow .cap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.prow .sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

.brand-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.bcard h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 18px; }
.bcard h3 .mono-badge { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
.bcard h3 input[type=color] { width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }
.bcard h3 .bname { flex: 1; min-width: 0; }
.bcard h3 .bname small { display: block; font: 600 12px var(--font-body); color: var(--muted); }
.acct-list { display: flex; flex-direction: column; }
.acct { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.acct .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.connect { display: flex; flex-wrap: wrap; gap: 6px; }
.connect a { text-decoration: none; color: var(--ink-2); font-size: 12px; font-weight: 600; border: 1px dashed var(--line-strong); border-radius: 9px; padding: 6px 10px 6px 6px; display: inline-flex; gap: 6px; align-items: center; }
.connect a:hover { border-style: solid; border-color: var(--forest); color: var(--forest); }
.connect a.off { opacity: .55; }

dialog { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; width: min(460px, 92vw); padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 21, 18, .45); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 4px; }
dialog form { display: flex; flex-direction: column; gap: 10px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.pick-list label { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); padding: 8px; border-radius: 11px; cursor: pointer; font-weight: 600; }
.pick-list label:has(input:checked) { border-color: var(--forest); background: var(--forest-soft); }
.pick-list input { width: auto; accent-color: var(--forest); }
.pick-list img { width: 26px; height: 26px; border-radius: 50%; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 12px; z-index: 50; max-width: 90vw; font-weight: 600; box-shadow: var(--shadow); }
.toast.err { background: var(--bad); color: #fff; }

.login-body { display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.error { color: var(--bad); margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 18px 10px; align-items: center; }
  .sidebar nav a span, .logo span, .side-sec, .sidebar-foot { display: none; }
  .composer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); z-index: 20; box-shadow: -20px 0 60px rgba(0,0,0,.2); transform: translateX(105%); transition: transform .22s ease; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
  .composer.open { transform: none; }
  #closeComposer { display: inline-grid; }
}
@media (max-width: 680px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sidebar { order: 2; flex-direction: row; padding: 6px max(16px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)); border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .sidebar .logo { display: none; }
  .sidebar nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .main { padding: 18px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
  .toolbar h1 { font-size: 23px; width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day { min-height: 74px; padding: 4px; }
  .num { font-size: 11px; padding: 0 4px; }
  .pchip { padding: 2px; } .pchip .meta { display: none; }
  .pchip img, .pchip video, .pchip .noimg { width: 100%; height: 24px; margin: 0; }
  .day:hover::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* festivals */
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fest-toggle { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.fest { display: block; width: 100%; text-align: left; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--marigold-soft); color: var(--warn); border: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fest.finance { background: var(--info-soft); color: var(--info); }
.fest.national, .fest.day { background: var(--forest-soft); color: var(--forest); }
.fest:hover { filter: brightness(.97); }
.idea { padding: 10px 12px; border-radius: 10px; background: var(--marigold-soft); color: var(--ink); font-size: 12.5px; }
.idea b { color: var(--warn); }
/* caption writer */
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.cap-head .lbl { margin: 0; }
.ai-btn { background: var(--marigold-soft); color: var(--warn); border: 1px solid transparent; }
.ai-btn:hover { border-color: var(--marigold); }
.ai-btn.on { background: var(--marigold); color: var(--marigold-ink); }
.ai-panel { border: 1px solid var(--marigold); background: var(--surface); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.ai-panel .lbl { margin-bottom: 5px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.row3 select { padding: 8px 6px; font-size: 13px; }
.ai-out { display: flex; flex-direction: column; gap: 8px; }
.ai-out:empty { display: none; }
.ai-opt { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--paper); display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.ai-opt p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.ai-opt .tags { color: var(--info); font-size: 12px; word-break: break-word; }
.ai-opt button { align-self: flex-start; }
.ai-note { font-size: 12px; color: var(--muted); margin: 0; }
.ai-loading { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.ai-loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--marigold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.about { display: flex; flex-direction: column; gap: 6px; }
.about textarea { font-size: 13px; }
.about .vrow { display: flex; justify-content: flex-end; }
.rep { color: var(--forest); font-weight: 800; margin-right: 3px; }

.wide-dialog { width: min(760px, 94vw); }
.cols { font-size: 12.5px; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; line-height: 1.7; }
.cols code { font-family: var(--font-mono); font-size: 11.5px; background: var(--sunk); padding: 1px 5px; border-radius: 5px; }
.cols a { display: block; margin-top: 4px; font-weight: 700; }
.import-preview { max-height: 40vh; overflow: auto; }
.import-preview:empty { display: none; }
.import-preview table { width: 100%; border-collapse: collapse; font-size: 12px; }
.import-preview th, .import-preview td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.import-preview th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); position: sticky; top: 0; background: var(--surface); }
.import-preview td.cap { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-preview .bad { color: var(--bad); font-weight: 600; }
.import-preview .good { color: var(--ok); font-weight: 600; }

.me { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.me small { display: block; color: var(--muted); font-weight: 500; text-transform: capitalize; }
.sdot.pending, .st.pending { background: var(--marigold); }
.st.pending { background: var(--marigold-soft); color: var(--warn); }
.review { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--marigold-soft); }
.review p { margin: 0; font-size: 13px; }
.review .actions button { padding: 8px 10px; }
.note { padding: 9px 11px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 12.5px; font-weight: 600; }
.byline { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.team-list { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.member .who { flex: 1; min-width: 160px; }
.member .who b { display: block; }
.member .who span { font-size: 12px; color: var(--muted); }
.member select { width: auto; }
.team-add { max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.team-add h3 { margin: 0; }
.chip input { display: none; }
.chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
body.not-owner .owner-only { display: none !important; }

.badge-n:not(:empty) { margin-left: auto; background: var(--marigold); color: var(--marigold-ink); font: 700 11px var(--font-mono); padding: 1px 7px; border-radius: 999px; }
.an-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.an-tiles .stat { flex-direction: column; gap: 2px; align-items: flex-start; }
.an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.bar-row .nm { display: flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar { height: 10px; border-radius: 999px; background: var(--sunk); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--forest); }
.bar-row .v { font: 600 12px var(--font-mono); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mets { display: flex; gap: 12px; flex-wrap: wrap; font: 600 12px var(--font-mono); color: var(--ink-2); }
.empty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 12px; }
.inbox-list { display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.cmt { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.cmt.done { opacity: .6; }
.cmt .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.cmt .top b { color: var(--ink); font-size: 13px; }
.cmt .txt { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.cmt .on { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt .replied { font-size: 13px; background: var(--forest-soft); color: var(--forest); padding: 7px 10px; border-radius: 9px; }
.cmt .reply { display: flex; gap: 8px; }
.cmt .reply input { flex: 1; min-width: 180px; }
@media (max-width: 900px) { .an-grid { grid-template-columns: minmax(0, 1fr); } .an-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
.bar-row .v { white-space: normal; text-align: right; }

/* ---------- new channels ---------- */
.pb.threads { background: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pb.threads { box-shadow: 0 0 0 1px #555; } }
:root[data-theme="dark"] .pb.threads { box-shadow: 0 0 0 1px #555; }
body.not-approver .approver-only { display: none !important; }

/* ---------- sidebar with more items ---------- */
.sidebar nav a { padding: 8px 10px; }
@media (max-width: 680px) {
  .sidebar nav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { flex: none; min-width: 46px; justify-content: center; }
}

/* ---------- shared bits ---------- */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input:not([type=checkbox]) { flex: 1 1 220px; min-width: 0; }
.inline-form select { width: auto; flex: 0 1 auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 9px 14px; border-radius: 10px; font-weight: 700; text-decoration: none; border: 1px solid var(--line-strong); color: var(--ink); background: var(--surface); font-size: 14px; }
.err { color: var(--bad); margin: 0; }
.client-ok { color: var(--ok); font-weight: 700; }

/* ---------- best time ---------- */
.best-times { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: -6px; }
.best-times .lbl { margin-right: 2px; }
.best-times .chip { padding: 4px 10px; font-size: 12px; }
.bt-top { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.heat { display: grid; grid-template-columns: 34px repeat(18, minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat i { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--forest); max-height: 26px; }
.heat .dl { font-size: 11px; color: var(--muted); font-weight: 600; }
.heat .hl { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: visible; }

/* ---------- leads ---------- */
.rule-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.rule { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
.rule.off { opacity: .55; }
.rule .rule-msg { flex: 1 1 200px; min-width: 0; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-form { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.lead-list, .comp-list, .ai-list, .rl-list { display: flex; flex-direction: column; gap: 10px; }
.lead { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.lead .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lead .txt { font-size: 15px; }
.lead-ctl { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-ctl select { width: auto; } .lead-ctl input { flex: 1 1 200px; min-width: 0; }

/* ---------- competitors ---------- */
.comp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.comp { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.comp.self { border-color: var(--forest); box-shadow: 0 0 0 2px var(--forest-soft); }
.comp .who { display: flex; align-items: center; gap: 10px; }
.comp .who > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.comp .who img, .comp .noav { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--sunk); flex: none; }
.cstats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cstats div { display: flex; flex-direction: column; min-width: 0; }
.cstats b { font: 700 17px var(--font-display); font-variant-numeric: tabular-nums; } .cstats span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.cstats b.up { color: var(--ok); } .cstats b.down { color: var(--bad); }
.spark { width: 100%; height: 30px; color: var(--forest); }

/* ---------- AI visibility ---------- */
.aiq { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--bc); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.aiq .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aiq .top b { flex: 1 1 260px; }
.biz { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--sunk); margin: 2px 2px 0 0; }
.biz.me { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.aiq .answer { white-space: pre-wrap; color: var(--ink-2); max-height: 260px; overflow: auto; }
.aiq summary { cursor: pointer; color: var(--forest); font-weight: 600; }
.hist i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 3px; vertical-align: middle; }
.hist i.y { background: var(--ok); } .hist i.n { background: var(--bad); }
#aiIdeas .chip { font-size: 12px; padding: 4px 10px; }

/* ---------- link in bio ---------- */
.bio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.bio { display: flex; flex-direction: column; gap: 10px; }
.bio h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.bio-url { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.bio-url a { word-break: break-all; }
.slug { display: flex; align-items: center; gap: 4px; }
.links { display: flex; flex-direction: column; gap: 6px; }
.lrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto auto; gap: 6px; align-items: center; }
@media (max-width: 520px) { .lrow { grid-template-columns: minmax(0, 1fr) auto; } .lrow input[name=url] { grid-column: 1; } .lrow .clicks { display: none; } }

/* ---------- settings ---------- */
.settings-form { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.settings-form input[type=color] { height: 40px; padding: 3px; }
.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-row img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); }
.rl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rl-url { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
p.small, div.small, span.small, details .small, summary.small { padding: 0; }
.comp .who .st { align-self: flex-start; } #btSource { display: block; margin-top: 2px; font-weight: 500; }

/* ---------- friendlier layout (v3) ---------- */
.nav-grp { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 3px; }
.new-post-side { margin: 0 0 4px; padding: 11px 12px; font-size: 15px; width: 100%; }
@media (max-width: 1180px) { .nav-grp { display: none; } .new-post-side { padding: 10px 0; font-size: 0; } .new-post-side::before { content: '+'; font-size: 20px; } }
@media (max-width: 680px) { .new-post-side { display: none; } }
.composer { gap: 14px; }
.step { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.step-h { display: flex; align-items: center; gap: 9px; font: 700 15px var(--font-display); color: var(--ink); }
.step-h .muted { font: 500 12px var(--font-body); }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--forest); color: var(--forest-ink); display: inline-grid; place-items: center; font: 800 12px var(--font-body); flex: none; }
.gemini-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 12px; padding: 11px 14px; cursor: pointer; color: #fff;
  background: linear-gradient(100deg, #4285f4, #9b72cb 60%, #d96570); box-shadow: 0 4px 14px rgba(66,133,244,.25); }
.gemini-btn:hover { filter: brightness(1.06); }
.gemini-btn .gem { font-size: 22px; line-height: 1; }
.gemini-btn b { display: block; font-size: 15px; }
.gemini-btn small { display: block; font-size: 12px; opacity: .92; font-weight: 500; }
.gemini-btn.on { box-shadow: 0 0 0 3px rgba(155,114,203,.35); }
.gemini-btn:disabled { opacity: .5; cursor: default; }
.ai-panel { border-color: #9b72cb; }
.quick-ai { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip-btn:hover { border-color: #9b72cb; color: var(--ink); }
.chip-btn.busy { background: linear-gradient(100deg, #4285f4, #9b72cb); color: #fff; border-color: transparent; }
.chip-btn:disabled { opacity: .6; cursor: default; }
details.more { border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
details.more summary .muted { font-weight: 500; font-size: 12px; }
details.more[open] { display: flex; flex-direction: column; gap: 12px; }
.composer .actions button, .composer #nowBtn { padding-top: 12px; padding-bottom: 12px; font-size: 15px; }
.toast-act { margin-left: 10px; background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 3px 10px; font-weight: 700; cursor: pointer; }
.auto-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.auto-head b { display: block; font: 700 16px var(--font-display); margin-bottom: 2px; }
.auto-head span { display: block; }
.auto-rows { display: flex; flex-direction: column; gap: 8px; }
.auto-row { display: grid; grid-template-columns: minmax(140px, 200px) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.auto-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: 7px 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--forest); color: var(--forest-ink); }
.seg button.on[data-mode="ai"] { background: linear-gradient(100deg, #4285f4, #9b72cb); color: #fff; }
.auto-text { min-width: 0; }
@media (max-width: 760px) { .auto-row { grid-template-columns: 1fr; gap: 6px; } .seg { width: 100%; } .seg button { flex: 1; } }
.reply { flex-wrap: wrap; }
