:root {
  --bg: #fbf6ee; --surface: #ffffff; --surface-2: #f5eee2; --line: #e8dfd0; --ink: #1d1b1a; --muted: #6f675d; --faint: #9a9185;
  --cherry: #d7263d; --cherry-ink: #ffffff; --cherry-soft: #fde8ea; --teal: #1f8a8a; --teal-soft: #e0f2f1; --gold: #f2b63d; --gold-soft: #fdf1d6;
  --ok: #1e7d4f; --ok-soft: #e3f4ea; --warn: #b3621b; --warn-soft: #fbeedd; --bad: #b3261e; --bad-soft: #fbe4e2; --info: #3b5b8c; --info-soft: #e5ecf7;
  --radius: 18px; --radius-sm: 12px; --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 8px 24px rgba(40, 30, 20, .07);
  --tabbar-h: 64px; --topbar-h: 56px; --safe-b: env(safe-area-inset-bottom, 0px);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--teal); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; } h2 { font-size: 19px; font-weight: 750; } h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 55%, transparent); outline-offset: 2px; }

/* ---------- shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .title { font-weight: 750; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brandmark { width: 32px; height: 32px; border-radius: 10px; flex: none; }
.main { padding: 16px 14px calc(var(--tabbar-h) + 96px + var(--safe-b)); max-width: 1120px; margin: 0 auto; min-width: 0; outline: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 650;
  color: var(--muted); background: none; border: 0; padding: 6px 0; cursor: pointer; }
.tabbar .ico { font-size: 20px; line-height: 1; }
.tabbar [aria-current="page"] { color: var(--cherry); }
.iconbtn { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; font-size: 18px; }
.iconbtn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--cherry); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: var(--topbar-h) 1fr; }
  .sidebar { display: flex; flex-direction: column; grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; padding: 18px 14px; gap: 4px;
    border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
  .topbar { grid-column: 2; }
  .main { grid-column: 2; width: 100%; padding: 24px 28px 110px; }
  .tabbar { display: none; }
  .topbar .brandmark { display: none; }
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.side-brand b { display: block; font-size: 16px; } .side-brand small { color: var(--muted); font-size: 12px; }
.navlink { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink); font-weight: 600; }
.navlink:hover { background: var(--surface-2); }
.navlink[aria-current="page"] { background: var(--cherry-soft); color: var(--cherry); }
.navlink .ico { width: 22px; text-align: center; }
.navlink .count { margin-left: auto; font-size: 12px; background: var(--cherry); color: #fff; border-radius: 10px; padding: 0 7px; }
.navsection { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 750; padding: 16px 12px 6px; }
.side-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- building blocks ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; } .stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .row.nowrap { flex-wrap: nowrap; } .spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card.tap { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; } .card.tap:hover { transform: translateY(-1px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 2px; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin-top: 4px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 650; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--cherry); border-color: var(--cherry); color: var(--cherry-ink); } .btn.primary:hover { filter: brightness(.95); }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent; }
.pill.demo { background: var(--gold-soft); color: #7a5608; border-color: #f0dca8; }
.pill.disconnected, .pill.blocked, .pill.rejected { background: var(--bad-soft); color: var(--bad); }
.pill.connected, .pill.done, .pill.approved, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.awaiting_approval, .pill.pending, .pill.approval { background: var(--warn-soft); color: var(--warn); }
.pill.app, .pill.draft, .pill.planned { background: var(--info-soft); color: var(--info); }
.pill.archive { background: var(--teal-soft); color: var(--teal); }
.pill.high { background: var(--bad-soft); color: var(--bad); } .pill.medium { background: var(--warn-soft); color: var(--warn); } .pill.low { background: var(--surface-2); }
.notice { border-radius: var(--radius-sm); padding: 10px 12px; background: var(--gold-soft); color: #6a4a06; font-size: 13.5px; border: 1px solid #f0dca8; }
.notice.info { background: var(--info-soft); color: var(--info); border-color: #cfdcf0; }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: #f1c7c3; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }
input[type=text], input[type=search], input[type=password], input[type=date], textarea, select {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
textarea { resize: vertical; min-height: 90px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.segmented button { border: 0; background: none; padding: 7px 12px; border-radius: 10px; font-weight: 650; font-size: 13.5px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; max-width: min(82vw, 520px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13.5px; cursor: pointer; }
.chip:hover { border-color: var(--cherry); color: var(--cherry); }
.avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; color: #fff; }
.av-george { background: #3b5b8c; } .av-orchestrator { background: var(--cherry); } .av-content { background: #8a4fbf; } .av-calendar { background: var(--teal); }
.av-reputation { background: #d48a12; } .av-kitchen { background: #5a6b2e; } .av-outreach { background: #2f7cc1; } .av-website { background: #4b4b4b; }

/* ---------- chat ---------- */
.hero { padding: 18px 2px 8px; }
.hero h1 { font-size: 30px; }
.composer { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); }
.composer textarea { border: 0; padding: 8px 0; min-height: 44px; max-height: 180px; resize: none; background: transparent; }
.composer textarea:focus { outline: none; }
.composer .send { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--cherry); color: #fff; font-size: 18px; cursor: pointer; flex: none; }
.composer .send[disabled] { opacity: .45; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 10px 13px; white-space: pre-wrap; word-break: break-word; min-width: 0; max-width: 680px; }
.msg.user { flex-direction: row-reverse; }
.msg.user .bubble { background: var(--ink); color: #fff; border-color: var(--ink); border-radius: 18px 4px 18px 18px; }
.msg.blocker .bubble { background: var(--bad-soft); border-color: #f1c7c3; }
.msg .who { font-size: 12px; font-weight: 750; color: var(--muted); margin-bottom: 2px; }
.msg .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.typing { color: var(--muted); font-size: 13px; padding-left: 46px; }

/* ---------- media ---------- */
.media-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mcard { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 2px solid transparent; cursor: pointer; aspect-ratio: 9 / 13; }
.mcard img, .mcard .ph { width: 100%; height: 100%; object-fit: cover; }
.mcard .ph { display: grid; place-items: center; font-size: 28px; color: var(--faint); }
.mcard .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 7px; background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; font-size: 11.5px; line-height: 1.3; }
.mcard .meta p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mcard .badge { position: absolute; top: 7px; left: 7px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.mcard .sel { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.35); color: #fff; font-weight: 900; cursor: pointer; display: grid; place-items: center; }
.mcard.selected { border-color: var(--cherry); } .mcard.selected .sel { background: var(--cherry); border-color: var(--cherry); }
.selbar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); z-index: 45; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
.selbar select { flex: 1; min-width: 140px; background: #2c2926; color: #fff; border-color: #3d3935; }
@media (min-width: 960px) { .selbar { left: calc(248px + 28px); right: 28px; bottom: 20px; } }
.filters { display: flex; flex-direction: column; gap: 10px; }
.filters .row select { width: auto; flex: 1; min-width: 110px; }
.thumbrow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.thumbrow .t { flex: none; width: 74px; } .thumbrow img, .thumbrow .ph { width: 74px; height: 100px; object-fit: cover; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.preview-media { background: #000; border-radius: 14px; overflow: hidden; display: grid; place-items: center; max-height: 62vh; }
.preview-media video, .preview-media img { max-height: 62vh; width: auto; }

/* ---------- projects ---------- */
.pcard { display: flex; gap: 12px; align-items: stretch; }
.pcard .cover { width: 72px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; font-size: 26px; }
.project-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .project-layout { grid-template-columns: minmax(0, 1fr) 380px; } .project-layout .ptab { display: block !important; } .tabs-mobile { display: none; } }
.project-layout .ptab { display: none; } .project-layout .ptab.active { display: block; }
.iter { border-left: 4px solid var(--info); } .iter.approved { border-left-color: var(--ok); } .iter.changes_requested { border-left-color: var(--warn); }
.shot { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.shot img, .shot .ph { width: 54px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 13.5px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: 11px; font-weight: 750; color: var(--faint); text-align: center; padding: 4px 0; }
.cal .day { min-height: 64px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); padding: 4px; cursor: pointer; min-width: 0; overflow: hidden; }
.cal .day.out { opacity: .45; } .cal .day.today { border-color: var(--cherry); box-shadow: inset 0 0 0 1px var(--cherry); }
.cal .day.drop { background: var(--teal-soft); border-color: var(--teal); } .cal .day.sel { background: var(--cherry-soft); }
.cal .num { font-size: 12px; font-weight: 700; }
.cal .entry { display: block; font-size: 10.5px; line-height: 1.25; margin-top: 2px; padding: 2px 4px; border-radius: 6px; background: var(--info-soft); color: var(--info); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .entry.awaiting_approval, .cal .entry.publish_blocked { background: var(--warn-soft); color: var(--warn); }
@media (min-width: 760px) { .cal .day { min-height: 96px; padding: 6px; } .cal .entry { font-size: 12px; } }
.tray { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.tray .ready { flex: none; width: 220px; cursor: grab; display: flex; gap: 10px; align-items: center; padding: 10px; }
.tray .ready.picked { outline: 3px solid var(--cherry); }
.tray .ready img, .tray .ready .ph { width: 44px; height: 58px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; }

/* ---------- activity room ---------- */
.participants { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.participant { flex: none; width: 124px; text-align: center; padding: 12px 8px; }
.participant .avatar { margin: 0 auto 6px; }
.participant .name { font-weight: 700; font-size: 13px; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed .item { display: flex; gap: 10px; align-items: flex-start; }
.feed .body { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 10px 12px; min-width: 0; flex: 1; }
.feed .item.george { flex-direction: row-reverse; } .feed .item.george .body { border-radius: 16px 4px 16px 16px; background: #eef2f8; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 16, 12, .45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .scrim { align-items: center; } }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); position: relative; }
@media (min-width: 700px) { .sheet { border-radius: 22px; } }
.sheet.wide { max-width: 860px; }
.sheet .close { position: absolute; top: 12px; right: 12px; }
.sheet h2 { padding-right: 44px; }
.whatsnew .feature { display: flex; gap: 12px; align-items: flex-start; }
.whatsnew .feature .fi { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--cherry-soft); font-size: 19px; flex: none; }
.tour-hole { position: fixed; z-index: 90; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(20, 16, 12, .55); pointer-events: none; transition: all .2s ease; }
.tour-card { position: fixed; z-index: 91; width: min(340px, calc(100vw - 24px)); background: var(--surface); border-radius: 18px; padding: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.tour-card .who { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }

/* ---------- orchestrator bubble ---------- */
.fab { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 50; display: flex; align-items: center; gap: 8px; flex-direction: row-reverse; max-width: calc(100vw - 32px); }
@media (min-width: 960px) { .fab { bottom: 24px; right: 24px; } }
.fab .orb { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--cherry); color: #fff; font-size: 24px; box-shadow: 0 8px 24px rgba(215, 38, 61, .35); cursor: pointer; flex: none; }
.fab .resume { background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 650; font-size: 13px; cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.panel { position: fixed; z-index: 70; right: 0; left: 0; bottom: 0; height: min(78vh, 680px); background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.2);
  display: flex; flex-direction: column; border: 1px solid var(--line); }
@media (min-width: 700px) { .panel { left: auto; right: 24px; bottom: 24px; width: 400px; border-radius: 22px; } }
.panel header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel .ctx { font-size: 12px; color: var(--muted); }
.panel .thread { flex: 1; overflow-y: auto; padding: 14px; }
.panel .composer { margin: 10px; box-shadow: none; }

.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow); pointer-events: auto; }
.toast.bad { background: var(--bad); }

.login { max-width: 380px; margin: 12vh auto 0; }
.stars { color: var(--gold); letter-spacing: 1px; }
.browser-frame { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.browser-frame .bar { display: flex; gap: 6px; align-items: center; padding: 8px 10px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.browser-frame .bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.browser-frame .page { padding: 18px; white-space: pre-wrap; font-size: 14px; }
.conn { display: flex; flex-direction: column; gap: 10px; }
.conn ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat b { font-size: 24px; display: block; }
pre.code { white-space: pre-wrap; word-break: break-all; background: var(--surface-2); padding: 10px; border-radius: 10px; font-size: 12px; margin: 0; }
