/* app.css — the Post Bridge product shell (behind sign-in).
   Loads after site.css for tokens. Denser, app-grade UI. */

:root {
  --app-bg: #f4f2ec;
  --app-surface: #ffffff;
  --app-sink: #faf9f5;
  --app-line: #e6e2d7;
  --app-line-2: #d9d4c7;
  --side-w: 256px;
}

body.app { background: var(--app-bg); overflow-x: hidden; }

/* global inline-icon sizing safety net */
.pf-ic { display: inline-flex; align-items: center; justify-content: center; }
.pf-ic svg { width: 100%; height: 100%; }
.conn-add svg { width: 15px; height: 15px; vertical-align: -2px; }
.cmp-label svg { width: 16px; height: 16px; flex: 0 0 auto; }
.empty .ei svg { width: 26px; height: 26px; }
.demo-flag svg, .status svg { width: 13px; height: 13px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--app-surface); border-right: 1px solid var(--app-line);
  display: flex; flex-direction: column; padding: 14px 12px; gap: 4px;
}
.side::-webkit-scrollbar { width: 8px; } .side::-webkit-scrollbar-thumb { background: #e0dbcd; border-radius: 4px; }
.ws-switch {
  display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--app-line);
  border-radius: 10px; cursor: pointer; margin-bottom: 8px; transition: background .15s;
}
.ws-switch:hover { background: var(--app-sink); }
.ws-switch .ws-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; flex: 0 0 auto; }
.ws-switch .ws-name { font-weight: 700; font-size: .92rem; line-height: 1.1; }
.ws-switch .ws-lbl { font-size: .7rem; color: var(--muted); font-family: var(--f-mono); letter-spacing: .06em; }
.ws-switch .caret { margin-left: auto; color: var(--muted); }

.nav-group { margin-top: 12px; }
.nav-group .gl { font-family: var(--f-mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); padding: 0 10px 6px; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 500; font-size: .92rem; cursor: pointer; transition: background .13s, color .13s;
  border: none; background: none; width: 100%; text-align: left; font-family: inherit;
}
.side-link:hover { background: var(--app-sink); color: var(--ink); }
.side-link.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-link .li { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; }
.side-link .li svg { width: 18px; height: 18px; }
.side-link .badge { margin-left: auto; font-family: var(--f-mono); font-size: .68rem; background: var(--paper-2); color: var(--muted); padding: .1em .45em; border-radius: 6px; }
.side-link.active .badge { background: #fff; color: var(--accent-ink); }
.side-new { background: var(--ink); color: var(--paper); margin: 4px 0 6px; justify-content: center; font-weight: 600; padding: 11px; }
.side-new:hover { background: var(--accent); color: #fff; }
.side-spacer { flex: 1; }
.side-foot { border-top: 1px solid var(--app-line); padding-top: 10px; margin-top: 8px; font-size: .82rem; }
.side-foot .who { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.side-foot .who .avatar { width: 32px; height: 32px; font-size: .8rem; }

/* topbar */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(244,242,236,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--app-line); padding: 0 clamp(16px, 3vw, 32px); height: 60px;
  display: flex; align-items: center; gap: 16px;
}
.topbar h1 { font-size: 1.3rem; margin: 0; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: .85rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.demo-flag { display: inline-flex; align-items: center; gap: .5em; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .04em; color: var(--gold); background: #fff6e2; border: 1px solid #f3e2b8; padding: .35em .7em; border-radius: 999px; }
.mobile-side-toggle { display: none; }

.view { padding: clamp(18px, 3vw, 32px); flex: 1; max-width: 1180px; width: 100%; }
.view-wide { max-width: 100%; }

/* segmented tabs */
.seg { display: inline-flex; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; font: inherit; font-size: .86rem; font-weight: 600; padding: .42em 1em; border-radius: 999px; cursor: pointer; color: var(--muted); transition: all .15s; }
.seg button.on { background: var(--ink); color: var(--paper); }

.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.selectlite { font: inherit; font-size: .84rem; font-weight: 500; padding: .5em .8em; border: 1px solid var(--app-line-2); border-radius: 8px; background: var(--app-surface); cursor: pointer; color: var(--ink-2); }

/* ---------- composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0,1fr) minmax(340px, 460px); gap: 22px; align-items: start; }
@media (max-width: 1080px) { .composer { grid-template-columns: 1fr; } }
.cmp-card { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg); padding: 20px; }
.cmp-card + .cmp-card { margin-top: 16px; }
.cmp-label { font-weight: 700; font-size: .82rem; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cmp-label .n { color: var(--muted); font-family: var(--f-mono); font-size: .72rem; }

/* platform picker */
.pf-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: .5em .8em; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--app-line-2); background: var(--app-surface); font: inherit; font-size: .84rem; font-weight: 600; color: var(--muted);
  transition: all .15s;
}
.pf-btn .pf-ic { display: inline-flex; }
.pf-btn .pf-ic svg { width: 17px; height: 17px; }
.pf-btn:hover { border-color: var(--ink-2); color: var(--ink); }
.pf-btn.on { color: #fff; border-color: transparent; }
.pf-btn .ct { font-family: var(--f-mono); font-size: .68rem; opacity: .85; }
.pf-btn.dim { opacity: .5; }
.pf-btn .cnt-tag { font-family: var(--f-mono); font-size: .64rem; background: rgba(0,0,0,.14); padding: 0 .4em; border-radius: 5px; }

/* accounts under platform */
.acct-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.acct-chip { display: inline-flex; align-items: center; gap: 7px; padding: .35em .6em .35em .35em; border: 1.5px solid var(--app-line-2); border-radius: 999px; cursor: pointer; background: var(--app-surface); font-size: .8rem; font-weight: 600; color: var(--ink-2); transition: all .13s; }
.acct-chip .pv-av { width: 22px; height: 22px; }
.acct-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.acct-chip .k { font-family: var(--f-mono); font-size: .66rem; color: var(--muted); font-weight: 500; }

/* main caption */
.cap-wrap { position: relative; }
.cap-area {
  width: 100%; border: 1.5px solid var(--app-line-2); border-radius: var(--r); background: var(--app-surface);
  padding: 14px; font: inherit; font-size: 1.02rem; line-height: 1.55; min-height: 130px; resize: vertical; color: var(--ink);
}
.cap-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,90,44,.13); }
.cap-tools { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--app-line-2); background: var(--app-surface); border-radius: 8px; padding: .4em .7em; font: inherit; font-size: .8rem; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .13s; }
.tool-btn:hover { border-color: var(--ink-2); background: var(--app-sink); }
.tool-btn.ai { border-color: #d9c4f0; color: #7b3fb8; background: #f8f2ff; }
.tool-btn.ai:hover { background: #f1e6ff; }
.tool-btn svg { width: 15px; height: 15px; }
.cap-tools .grow { flex: 1; }

/* char ring */
.ring { --p: 0; width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--rc, var(--accent)) calc(var(--p)*1%), var(--app-line) 0); }
.ring::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--app-surface); }
.ring .rn { position: relative; z-index: 1; font-family: var(--f-mono); font-size: .58rem; font-weight: 700; }
.count-line { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: .78rem; color: var(--muted); }
.count-line.over { color: var(--accent-ink); }

/* per-platform overrides */
.ovr { border: 1px solid var(--app-line); border-radius: var(--r); margin-top: 10px; overflow: hidden; }
.ovr-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; background: var(--app-sink); transition: background .13s; }
.ovr-head:hover { background: #f2efe7; }
.ovr-head .pf-ic svg { width: 18px; height: 18px; }
.ovr-head .pname { font-weight: 700; font-size: .88rem; }
.ovr-head .status { margin-left: auto; font-family: var(--f-mono); font-size: .7rem; }
.ovr-head .status.warn { color: var(--accent-ink); }
.ovr-head .status.ok { color: var(--ok); }
.ovr-head .caret { transition: transform .2s; color: var(--muted); }
.ovr.open .caret { transform: rotate(90deg); }
.ovr-body { display: none; padding: 14px; border-top: 1px solid var(--app-line); }
.ovr.open .ovr-body { display: block; }
.ovr-body .cap-area { min-height: 90px; font-size: .95rem; }
.ovr-title { margin-bottom: 10px; }
.ovr-note { font-size: .78rem; color: var(--muted); margin-top: 8px; }
.ovr-warn { display: flex; align-items: center; gap: .5em; font-size: .8rem; color: var(--accent-ink); background: var(--accent-soft); border-radius: 8px; padding: .5em .7em; margin-top: 8px; }
.ovr-inherit { font-size: .76rem; color: var(--muted); font-style: italic; margin-bottom: 8px; }

/* media dropzone */
.drop { border: 1.6px dashed var(--app-line-2); border-radius: var(--r); padding: 22px; text-align: center; cursor: pointer; transition: all .15s; color: var(--muted); }
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.drop svg { width: 26px; height: 26px; margin-bottom: 6px; }
.media-preview { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.media-preview .mp-thumb { width: 88px; height: 88px; border-radius: 10px; object-fit: cover; border: 1px solid var(--app-line); background: var(--app-sink); }
.media-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* schedule bar */
.sched-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sched-bar .selectlite, .sched-bar input { font-size: .88rem; }
.dt-input { font: inherit; padding: .5em .7em; border: 1px solid var(--app-line-2); border-radius: 8px; background: var(--app-surface); color: var(--ink); }

.cmp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.cmp-actions .grow { flex: 1; }

/* POST button + states */
.postbtn { position: relative; overflow: hidden; min-width: 170px; }
.postbtn[data-state="posting"] { pointer-events: none; }
.postbtn .pb-fill { position: absolute; inset: 0; background: rgba(255,255,255,.22); width: 0; transition: width .2s linear; }

/* previews panel */
.pv-panel { position: sticky; top: 76px; }
.pv-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pv-panel-head .t { font-weight: 700; font-size: .92rem; }
.pv-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pv-tab { width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--app-line-2); background: var(--app-surface); display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: all .13s; position: relative; }
.pv-tab svg { width: 18px; height: 18px; }
.pv-tab.on { border-color: transparent; color: #fff; }
.pv-tab.warn::after { content: "!"; position: absolute; top: -5px; right: -5px; width: 15px; height: 15px; background: var(--accent); color: #fff; border-radius: 50%; font-size: .6rem; font-weight: 800; display: grid; place-items: center; font-family: var(--f-mono); }
.pv-stage { background: var(--app-sink); border: 1px solid var(--app-line); border-radius: var(--r-lg); padding: 18px; min-height: 320px; }
.pv-stage-lbl { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin-bottom: 12px; display: flex; justify-content: space-between; }

/* ---- the previews themselves ---- */
.pv { background: #fff; border-radius: 14px; padding: 16px; box-shadow: var(--shadow-sm); font-size: .9rem; line-height: 1.4; color: #0f1419; animation: pvpop .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pvpop { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.pv-row { display: flex; align-items: flex-start; gap: 10px; }
.pv-av { border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.pv-av-fallback { display: grid; place-items: center; color: #fff; font-weight: 700; font-family: var(--f-display); font-size: .8rem; }
.pv-hd { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pv-name { font-weight: 700; }
.pv-sub { font-size: .78rem; color: #536471; }
.pv-handle { font-size: .8rem; color: #536471; }
.pv-more { margin-left: auto; color: #8b98a5; font-weight: 700; }
.pv-body { margin-top: 8px; white-space: pre-wrap; word-break: break-word; }
.pv-ph { color: #aab3bb; }
.pv-media { border-radius: 14px; overflow: hidden; background: #eef0f1; }
.pv-media img, .pv-media video { width: 100%; display: block; object-fit: cover; }
.pv-vid { aspect-ratio: 16/9; }
.pv-playbadge { position: absolute; }
.pv-media { position: relative; }
.pv-eng { display: flex; gap: 18px; margin-top: 12px; color: #536471; align-items: center; font-size: .82rem; }
.pv-eng svg { width: 17px; height: 17px; }
.pv-eng span { display: inline-flex; align-items: center; gap: 5px; }
.pv-eng-icons { justify-content: flex-start; gap: 20px; }
.pv-more-t { color: #536471; }

/* X + bluesky share base */
.pv-x .pv-body, .pv-bsky .pv-body { font-size: .96rem; }

/* instagram */
.pv-ig { padding: 0; overflow: hidden; }
.pv-igtop { display: flex; align-items: center; gap: 9px; padding: 11px 13px; }
.pv-igtop .pv-name { font-size: .86rem; }
.pv-igph { aspect-ratio: 1; display: grid; place-items: center; color: #aab3bb; font-size: .82rem; text-align: center; background: repeating-linear-gradient(45deg,#f6f6f6,#f6f6f6 12px,#f0f0f0 12px,#f0f0f0 24px); padding: 20px; }
.pv-igactions { display: flex; gap: 15px; padding: 11px 13px 4px; color: #0f1419; }
.pv-igactions svg { width: 22px; height: 22px; }
.pv-iglikes { padding: 0 13px; font-weight: 700; font-size: .84rem; }
.pv-igcap { padding: 5px 13px 14px; margin-top: 2px; font-size: .86rem; }

/* linkedin */
.pv-li .pv-eng-li { justify-content: space-between; border-top: 1px solid #eee; border-bottom: 1px solid #eee; padding: 8px 0; margin-top: 12px; font-size: .78rem; }
.pv-libar { display: flex; justify-content: space-around; padding-top: 8px; color: #536471; font-size: .82rem; font-weight: 600; }

/* facebook */
.pv-fb { padding-bottom: 12px; }
.pv-fb .pv-body { padding: 0 0 4px; }
.pv-eng-fb { justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; font-size: .8rem; }

/* tiktok */
.pv-tt .pv-ttframe { position: relative; aspect-ratio: 9/16; max-height: 460px; margin-inline: auto; border-radius: 14px; overflow: hidden; background: #000; width: 260px; }
.pv-ttph { position: absolute; inset: 0; display: grid; place-items: center; color: #777; background: #111; }
.pv-ttrail { position: absolute; right: 8px; bottom: 74px; display: flex; flex-direction: column; gap: 16px; align-items: center; color: #fff; }
.pv-ttrail svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.pv-ttrail span { display: flex; flex-direction: column; align-items: center; font-size: .66rem; font-weight: 700; }
.pv-ttrail .pv-ttav .pv-av { width: 42px; height: 42px; border: 2px solid #fff; }
.pv-ttcap { position: absolute; left: 12px; right: 60px; bottom: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.pv-ttcap b { font-size: .88rem; } .pv-ttcap div { font-size: .82rem; margin: 3px 0; }
.pv-ttmusic { font-size: .74rem; opacity: .9; }

/* pinterest */
.pv-pin { padding: 0; overflow: hidden; }
.pv-pinmedia { aspect-ratio: 3/4; position: relative; }
.pv-pinmedia img, .pv-pinmedia video { height: 100%; object-fit: cover; }
.pv-pinsave { position: absolute; top: 10px; right: 10px; background: var(--accent); color: #fff; font-weight: 700; padding: .4em .8em; border-radius: 999px; font-size: .8rem; }
.pv-pinph { aspect-ratio: 3/4; display: grid; place-items: center; color: #aab3bb; background: #f6f6f6; }
.pv-pinmeta { padding: 12px 14px 16px; }
.pv-pindesc { font-size: .82rem; color: #536471; margin-top: 4px; }

/* youtube */
.pv-yt { padding: 0; overflow: hidden; }
.pv-ytthumb { position: relative; aspect-ratio: 16/9; background: #000; }
.pv-ytph { position: absolute; inset: 0; display: grid; place-items: center; color: #888; background: #181818; }
.pv-ytdur { position: absolute; bottom: 7px; right: 7px; background: rgba(0,0,0,.82); color: #fff; font-size: .7rem; padding: .1em .4em; border-radius: 4px; font-weight: 700; }
.pv-ytmeta { padding: 12px; }
.pv-yttitle { font-size: .96rem; line-height: 1.25; }

/* ---------- cards / grids ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pcard { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; cursor: pointer; }
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard .pc-thumb { aspect-ratio: 16/10; background: var(--app-sink); position: relative; overflow: hidden; display: grid; place-items: center; }
.pcard .pc-thumb img, .pcard .pc-thumb video { width: 100%; height: 100%; object-fit: cover; }
.pcard .pc-thumb .noimg { color: var(--muted-2); }
.pc-status { position: absolute; top: 10px; left: 10px; }
.status-pill { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .04em; padding: .3em .6em; border-radius: 999px; font-weight: 600; text-transform: uppercase; }
.status-pill.scheduled { background: #e7eefe; color: #2b5bd7; }
.status-pill.posted { background: var(--ok-soft); color: #157a3f; }
.status-pill.draft { background: #f0ede4; color: #7a7566; }
.status-pill.failed { background: #fde7e7; color: #c0392b; }
.pcard .pc-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard .pc-cap { font-size: .9rem; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pc-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.pf-avs { display: flex; }
.pf-avs .pf-mini { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; margin-left: -6px; border: 2px solid var(--app-surface); }
.pf-avs .pf-mini:first-child { margin-left: 0; }
.pf-avs .pf-mini svg { width: 12px; height: 12px; }
.pc-when { margin-left: auto; font-family: var(--f-mono); font-size: .72rem; color: var(--muted); }
.pc-metrics { display: flex; gap: 12px; font-size: .76rem; color: var(--muted); font-family: var(--f-mono); }
.pc-metrics b { color: var(--ink); }

/* empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ei { width: 56px; height: 56px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto 16px; }
.empty h3 { color: var(--ink); }

/* ---------- calendar ---------- */
.cal { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg); overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--app-line); }
.cal-head div { padding: 10px; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-cell { min-height: 116px; border-right: 1px solid var(--app-line); border-bottom: 1px solid var(--app-line); padding: 7px; position: relative; transition: background .12s; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.out { background: var(--app-sink); }
.cal-cell.today .cal-num { background: var(--accent); color: #fff; }
.cal-cell:hover { background: var(--accent-soft); }
.cal-cell:hover .cal-add { opacity: 1; }
.cal-num { font-size: .8rem; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.cal-add { position: absolute; top: 7px; right: 7px; opacity: 0; width: 20px; height: 20px; border-radius: 6px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; transition: opacity .13s; }
.cal-ev { margin-top: 4px; font-size: .72rem; padding: 3px 6px; border-radius: 6px; display: flex; align-items: center; gap: 5px; cursor: pointer; background: var(--app-sink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-ev .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.cal-ev:hover { background: var(--accent-soft); }
.cal-week { display: grid; grid-template-columns: 60px 1fr; }
.cal-week .wk-hours { border-right: 1px solid var(--app-line); }
.cal-week .wk-hr { height: 52px; font-family: var(--f-mono); font-size: .66rem; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--app-line); }

/* ---------- connections ---------- */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 16px; }
.conn-card { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg); padding: 18px; }
.conn-card .cc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.conn-card .cc-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.conn-card .cc-ic svg { width: 22px; height: 22px; }
.conn-card .cc-name { font-weight: 700; }
.conn-card .cc-n { font-size: .78rem; color: var(--muted); font-family: var(--f-mono); }
.conn-acct { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--app-line); }
.conn-acct .pv-av { width: 30px; height: 30px; }
.conn-acct .ca-name { font-weight: 600; font-size: .86rem; line-height: 1.15; }
.conn-acct .ca-handle { font-size: .76rem; color: var(--muted); }
.conn-acct .ca-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--app-line-2); background: var(--app-surface); display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: all .13s; }
.icon-btn:hover { border-color: var(--ink-2); color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; }
.conn-add { width: 100%; margin-top: 10px; border: 1.5px dashed var(--app-line-2); background: none; border-radius: 9px; padding: 9px; font: inherit; font-weight: 600; font-size: .82rem; color: var(--muted); cursor: pointer; transition: all .13s; }
.conn-add:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- tables / api keys ---------- */
.tbl { width: 100%; border-collapse: collapse; background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg); overflow: hidden; }
.tbl th { text-align: left; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--app-line); background: var(--app-sink); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--app-line); font-size: .88rem; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--app-sink); }
.mono { font-family: var(--f-mono); font-size: .82rem; }
.key-val { display: inline-flex; align-items: center; gap: 8px; background: var(--app-sink); border: 1px solid var(--app-line); padding: .3em .6em; border-radius: 8px; }

/* stat cards (analytics) */
.astat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 22px; }
.astat { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg); padding: 18px; }
.astat .l { font-size: .8rem; color: var(--muted); }
.astat .v { font-family: var(--f-display); font-weight: 800; font-size: 2rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.astat .d { font-size: .78rem; font-family: var(--f-mono); margin-top: 4px; }
.astat .d.up { color: var(--ok); } .astat .d.down { color: #c0392b; }
.chart-card { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-lg); padding: 18px; margin-bottom: 18px; }
.chart-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
:root { --chart-text: #6e6a60; --chart-grid: #ece8de; --chart-c1: #ff5a2c; --chart-c2: #1d9bf0; --chart-c3: #f4a300; --chart-c4: #1f9d55; --chart-c5: #7b3fb8; --chart-c6: #e1306c; --chart-tooltip-bg: #17150f; --chart-tooltip-text: #fff; }

/* ---------- modal / drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(23,21,15,.42); backdrop-filter: blur(2px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity .22s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.modal { position: fixed; z-index: 101; top: 50%; left: 50%; transform: translate(-50%, -46%); width: min(560px, 92vw); max-height: 88vh; overflow-y: auto; background: var(--app-surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 26px; opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; }
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal h2 { font-size: 1.4rem; }
.modal-close { position: absolute; top: 16px; right: 16px; }
.detail-modal { width: min(680px, 94vw); }

/* auth screen */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 70% -10%, rgba(255,90,44,.10), transparent 60%), var(--app-bg); }
.auth-card { width: min(440px, 100%); background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--r-xl); padding: 34px; box-shadow: var(--shadow-lg); }
.auth-card .brand { justify-content: center; margin-bottom: 8px; }
.auth-card h1 { font-size: 1.7rem; text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.auth-alt { text-align: center; font-size: .86rem; color: var(--muted); margin-top: 16px; }
.auth-demo { margin-top: 18px; padding: 12px; border-radius: 10px; background: #fff6e2; border: 1px solid #f3e2b8; font-size: .8rem; color: #8a6d1e; text-align: center; }

/* AI popover */
.ai-pop { border: 1px solid #e0d0f2; background: #faf6ff; border-radius: var(--r); padding: 14px; margin-top: 12px; }
.ai-pop .aih { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .84rem; color: #7b3fb8; margin-bottom: 8px; }
.ai-variant { border: 1px solid #ecdfff; background: #fff; border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; cursor: pointer; font-size: .9rem; transition: all .13s; }
.ai-variant:hover { border-color: #b98fe0; background: #faf6ff; }
.ai-variant .use { font-size: .72rem; color: #7b3fb8; font-weight: 700; font-family: var(--f-mono); }
.spin { width: 16px; height: 16px; border: 2px solid #e0d0f2; border-top-color: #7b3fb8; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* proofs overlay (essence loop finale) */
.proofs { display: grid; gap: 10px; margin-top: 14px; }
.proof { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--app-line); border-radius: var(--r); background: var(--app-surface); opacity: 0; transform: translateY(10px); }
.proof.in { animation: proofin .4s cubic-bezier(.2,.9,.3,1.2) forwards; }
@keyframes proofin { to { opacity: 1; transform: none; } }
.proof .p-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.proof .p-ic svg { width: 18px; height: 18px; }
.proof .p-txt { flex: 1; }
.proof .p-name { font-weight: 700; font-size: .9rem; }
.proof .p-url { font-family: var(--f-mono); font-size: .74rem; color: var(--muted); }
.proof .p-check { width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; transform: scale(0); }
.proof.in .p-check { animation: checkpop .3s .15s cubic-bezier(.2,.9,.3,1.4) forwards; }
@keyframes checkpop { to { transform: scale(1); } }
.proof.pending .p-check { background: var(--app-line); }
.proof .spin { width: 18px; height: 18px; }

/* confetti canvas */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 150; }

/* mobile */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; width: 280px; transform: translateX(-100%); transition: transform .24s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .mobile-side-toggle { display: inline-flex; }
  .composer { grid-template-columns: 1fr; }
}
.side-scrim { position: fixed; inset: 0; background: rgba(23,21,15,.4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
.side-scrim.open { opacity: 1; pointer-events: auto; }
