/* Ridgeline — calm, clean UI. One font family, one accent, generous spacing.
   Layout: fixed left sidebar (7 areas) + main column with page header, tabs and content. */
:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #f2eee9;
  --line: #e7e1da;
  --line-strong: #d6cec5;
  --text: #1e191b;
  --text-2: #5d5457;
  --muted: #8b8185;
  --accent: #7a1f3d;
  --accent-hover: #5f1830;
  --accent-soft: #f5e8ec;
  --accent-text: #ffffff;
  --gold: #a9802f;
  --gold-soft: #f6efdf;
  --ok: #2d7a4e; --ok-soft: #e5f2ea;
  --warn: #a8620d; --warn-soft: #fbefdf;
  --bad: #b42318; --bad-soft: #fbe7e5;
  --info: #2f5f8a; --info-soft: #e6eef6;
  --shadow: 0 1px 2px rgba(30, 20, 24, .05), 0 6px 20px rgba(30, 20, 24, .06);
  --shadow-lg: 0 18px 50px rgba(30, 20, 24, .18);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #151113; --surface: #1d181a; --surface-2: #262023; --line: #342c30; --line-strong: #463c41;
  --text: #f2ecee; --text-2: #c4b9bd; --muted: #93888d;
  --accent: #e0789a; --accent-hover: #ea93b0; --accent-soft: #3a2029; --accent-text: #1d181a;
  --gold: #d5b06a; --gold-soft: #33291a;
  --ok: #7fc79c; --ok-soft: #1d3326; --warn: #e3a35a; --warn-soft: #3a2a17; --bad: #f08a80; --bad-soft: #3d1f1c; --info: #8fb6dc; --info-soft: #1d2b39;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 18px 50px rgba(0,0,0,.5);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #151113; --surface: #1d181a; --surface-2: #262023; --line: #342c30; --line-strong: #463c41;
  --text: #f2ecee; --text-2: #c4b9bd; --muted: #93888d;
  --accent: #e0789a; --accent-hover: #ea93b0; --accent-soft: #3a2029; --accent-text: #1d181a;
  --gold: #d5b06a; --gold-soft: #33291a;
  --ok: #7fc79c; --ok-soft: #1d3326; --warn: #e3a35a; --warn-soft: #3a2a17; --bad: #f08a80; --bad-soft: #3d1f1c; --info: #8fb6dc; --info-soft: #1d2b39;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 18px 50px rgba(0,0,0,.5);
  color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; text-wrap: balance; }
.num, td.n { font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; gap: 4px; overflow-y: auto; z-index: 30; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.logo-mark svg { display: block; width: 100%; height: 100%; }
.logo-name { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: -.01em; line-height: 1; }
.logo-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.winery-switch { display: flex; flex-direction: column; padding: 9px 10px; margin: 0 0 10px; border-radius: 8px; background: var(--surface-2); text-align: left; border: 0; cursor: default; }
.winery-switch b { font-size: 13.5px; }
.winery-switch span { font-size: 11.5px; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--text-2); font-weight: 550; font-size: 14px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; text-decoration: none !important; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 700; background: var(--accent); color: var(--accent-text); border-radius: 99px; padding: 0 7px; line-height: 18px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.side-foot { margin-top: auto; padding: 10px 8px 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.side-foot a { color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.banner { background: var(--text); color: var(--bg); padding: 8px 28px; font-size: 13px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.banner a { color: var(--bg); text-decoration: underline; }
.banner .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.menu-btn { display: none; }
.search-btn { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 460px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; color: var(--muted); cursor: pointer; text-align: left; }
.search-btn kbd { margin-left: auto; font-size: 11px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 0; cursor: pointer; }

.page { padding: 24px 28px 64px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Basics ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ai { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 40%, transparent); color: var(--gold); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { padding: 11px 18px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .end { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 650; }
.mt { margin-top: 16px; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

.stat .label { margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .detail { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }
.up { color: var(--ok); font-weight: 650; }
.down { color: var(--bad); font-weight: 650; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { color: var(--muted); font-weight: 500; margin-left: 4px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.input, .select, .textarea { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 11px; width: 100%; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.toolbar .input { max-width: 280px; }
.toolbar .select { width: auto; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; cursor: pointer; user-select: none; }
table.t th.nosort { cursor: default; }
table.t th .arrow { opacity: .6; margin-left: 3px; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t td.n, table.t th.n { text-align: right; }
table.t .title-cell { font-weight: 600; }
table.t .sub-cell { color: var(--muted); font-size: 12px; }

/* ---------- Board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.lane.drop { outline: 2px dashed var(--accent); }
.lane-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; padding: 2px 4px 10px; }
.lane-head .muted { font-weight: 500; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.tile:hover { border-color: var(--line-strong); }
.tile .t { font-weight: 650; }
.tile .m { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .lead { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); flex-shrink: 0; font-size: 16px; }
.list .lead.bad { background: var(--bad-soft); } .list .lead.warn { background: var(--warn-soft); } .list .lead.ok { background: var(--ok-soft); } .list .lead.info { background: var(--info-soft); }
.list .t { font-weight: 600; }
.list .m { color: var(--muted); font-size: 12.5px; }
.list .click { cursor: pointer; }
.list .click:hover .t { color: var(--accent); }

.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty .ico { font-size: 30px; margin-bottom: 6px; }
.empty h3 { font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0 auto 14px; max-width: 44ch; color: var(--muted); }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); } .bar.accent > span { background: var(--accent); }

/* ---------- Drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 12, 16, .38); z-index: 50; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 51; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .18s ease-out; }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 19px; }
.drawer-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); align-items: center; }
.modal { position: fixed; z-index: 52; left: 50%; top: 10vh; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); max-height: 80vh; overflow-y: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 20px; animation: pop .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } }
@keyframes pop { from { transform: translate(-50%, 8px); opacity: 0; } }

.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .req { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.rating button { border: 0; background: none; font-size: 20px; color: var(--line-strong); cursor: pointer; padding: 0 2px; }
.rating button.on { color: var(--gold); }
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 8px 10px; font-size: 13px; width: 100%; }
.related { margin-top: 22px; }
.related h3 { font-size: 14px; margin-bottom: 8px; }

/* ---------- AI ---------- */
.ai-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.ai-box { background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.ai-box .ai-label { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.ai-tools { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.source-note { margin-top: 10px; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--gold) 35%, transparent); font-size: 11.5px; color: var(--muted); }
.source-note.live { color: var(--ok); }
.thinking { color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-right: 3px; animation: bounce 1s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-3px); opacity: .5; } }
.cursor::after { content: '▍'; color: var(--gold); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h2 { font-size: 15.5px; margin: 16px 0 6px; }
.md h3 { font-size: 14px; margin: 12px 0 4px; }
.md p { margin: 6px 0 10px; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md table { border-collapse: collapse; width: 100%; margin: 8px 0 12px; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent); padding: 6px 9px; text-align: left; vertical-align: top; }
.md th { font-weight: 700; white-space: nowrap; }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--gold); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 460px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 14px; }
.msg { max-width: 760px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); padding: 10px 14px; border-radius: 14px 14px 4px 14px; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); padding: 12px 16px; border-radius: 14px 14px 14px 4px; width: 100%; }
.composer { display: flex; gap: 8px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px 6px 6px 12px; background: var(--surface); align-items: flex-end; }
.composer textarea { border: 0; background: none; resize: none; flex: 1; padding: 6px 0; min-height: 24px; max-height: 160px; outline: none; }

/* ---------- Posting & connections ---------- */
.pub-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.pub-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.pub-row.off { color: var(--muted); cursor: default; }
.pub-when { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.pub-results { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; display: grid; gap: 4px; }
.conn-group { font-size: 16px; margin: 22px 0 10px; }
.conn-group:first-of-type { margin-top: 4px; }
.conn-card .conn-ico { font-size: 20px; }
.attach { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attach .pill { cursor: default; }

/* ---------- Assistant (agent) ---------- */
.msg.agent .act { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.msg.agent .act li { font-size: 12.5px; color: var(--muted); padding-left: 18px; position: relative; }
.msg.agent .act li::before { content: '✓'; position: absolute; left: 2px; color: var(--ok); font-weight: 700; }
.msg.agent > .thinking { margin: 2px 0 6px; }
.props { margin-top: 12px; border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); border-radius: 12px; overflow: hidden; background: var(--surface); }
.props-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--gold-soft); color: var(--text); font-size: 13.5px; }
.prop { padding: 11px 12px; border-top: 1px solid var(--line); }
.prop:first-of-type { border-top: 0; }
.prop.done { background: color-mix(in srgb, var(--ok-soft) 45%, transparent); }
.prop.skipped { opacity: .6; }
.prop-row { display: flex; gap: 10px; align-items: flex-start; }
.prop-ico { font-size: 17px; line-height: 1.3; }
.prop-meta { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.prop-fields { font-size: 12.5px; display: grid; gap: 2px; }
.prop .textarea, .prop .input { font-size: 13px; margin-top: 4px; }
.msg.user { white-space: pre-line; }
.next { margin-top: 12px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.next-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13.5px; }
.next-head .btn { margin-left: auto; }
.next-item { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.next-item:hover { background: var(--surface); }
.next-item input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.next-go { display: flex; gap: 8px; margin-top: 8px; }
.next-go .input { flex: 1; }
.next-old { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.prop-needs { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--info-soft); display: grid; gap: 4px; }
.need { display: grid; gap: 4px; padding: 6px 0; border-top: 1px dashed color-mix(in srgb, var(--info) 30%, transparent); }
.need:first-of-type { border-top: 0; }
.need-q { font-size: 13px; font-weight: 600; }
.need-go { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 4px; }
.contact-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.contact-row .input { flex: 1 1 220px; margin-top: 0; }
.ok-text { color: var(--ok); }
.prop-block { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; display: grid; gap: 3px; }
.prop-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Command palette ---------- */
.cmdk { padding: 0; top: 12vh; }
.cmdk input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; width: 100%; background: transparent; outline: none; }
.cmdk ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.cmdk li { padding: 9px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.cmdk li.on, .cmdk li:hover { background: var(--surface-2); }
.cmdk li .k { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.chart .grid-line { stroke: var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Schedule ---------- */
.week { display: grid; grid-template-columns: 140px repeat(7, minmax(110px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); min-width: 900px; }
.week > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; min-height: 52px; font-size: 12.5px; }
.week .wh { background: var(--surface-2); font-weight: 700; font-size: 12px; text-align: center; }
.week .wh.today { color: var(--accent); }
.week .who { font-weight: 650; background: var(--surface-2); }
.shift { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 3px 6px; margin-bottom: 4px; cursor: pointer; font-weight: 600; font-size: 11.5px; }

/* ---------- Auth / landing ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: #6e1b37; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-family: var(--serif); font-size: 40px; line-height: 1.08; max-width: 14ch; }
.auth-art p { color: rgba(255,255,255,.85); max-width: 44ch; font-size: 15.5px; }
.auth-art ul { padding: 0; list-style: none; display: grid; gap: 10px; font-size: 14.5px; }
.auth-art li::before { content: '✓  '; color: #f2d48b; font-weight: 800; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form form, .auth-form .box { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.auth-form h2 { font-size: 22px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.notice { padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--info-soft); color: var(--info); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 80; box-shadow: var(--shadow-lg); animation: pop .15s; }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }

/* ---------- Marketing studio ---------- */
.studio-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 16px; }
.studio-title { flex: 1 1 260px; max-width: 420px; font-weight: 650; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.studio-previews { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding-bottom: 8px; }
.step { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 750; font-size: 12.5px; flex-shrink: 0; }
.step h2 { font-size: 16px; font-weight: 700; }
.step .sub { color: var(--muted); font-size: 12.5px; }
.brief { display: flex; gap: 8px; }
.brief .input { flex: 1; }
.brief-more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.brief-more .select { font-size: 13px; padding: 6px 9px; color: var(--text-2); }
.studio-body { min-height: 200px; resize: vertical; font-size: 15px; line-height: 1.55; }
[data-drop].dropping { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; align-items: start; }
.media-tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; min-height: 132px; }
.media-tile .thumb { position: relative; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.media-tile .thumb img, .media-tile .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .badge { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.media-tile .badge.main { left: auto; right: 6px; background: var(--accent); }
.media-tile .missing { position: absolute; inset: 0; display: grid; place-items: center; }
.media-tile .tile-actions { display: flex; align-items: center; gap: 2px; padding: 3px 4px; background: var(--surface); border-top: 1px solid var(--line); }
.media-tile .tile-actions .btn { padding: 3px 6px; font-size: 11.5px; margin-right: auto; }
.media-tile .icon-btn { width: 26px; height: 26px; font-size: 13px; }
.media-tile.add { aspect-ratio: 1 / 1.22; border-style: dashed; border-color: var(--line-strong); background: var(--surface); cursor: pointer; align-items: center; justify-content: center; gap: 4px; color: var(--text-2); font-weight: 600; font-size: 12.5px; text-align: center; padding: 10px; }
.media-tile.add:hover { border-color: var(--accent); color: var(--accent); }
.media-tile.add .big { font-size: 26px; line-height: 1; }
.media-tile.busy { align-items: center; justify-content: center; gap: 6px; }

.pv-tabs { margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.pv-tabs .seg button { white-space: nowrap; }
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 14px; align-items: start; }
.pv-grid > .pv-card { max-width: 480px; width: 100%; justify-self: center; }
.pv-single .pv-card { max-width: 520px; margin: 0 auto; }
.pv-card { padding: 12px; }
.pv-head { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; flex-wrap: wrap; }
.pv-head .count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pv-head .count.warn { color: var(--warn); font-weight: 700; }
.pv-head .count.bad { color: var(--bad); font-weight: 700; }
.pv-warn { margin: 10px 0 0; padding: 8px 10px 8px 26px; background: var(--warn-soft); color: var(--warn); border-radius: 8px; font-size: 12.5px; }
.pv-edit { margin-top: 10px; }
.pv-edit .textarea { font-size: 13.5px; resize: vertical; margin-bottom: 4px; }
.pv-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

/* Platform look-alikes: light like the real apps (TikTok dark). */
.mk { background: #fff; color: #111; border: 1px solid #e3e3e3; border-radius: 10px; overflow: hidden; font-size: 13.5px; line-height: 1.42; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.mk .tiny { font-size: 11.5px; color: #737373; }
.mk .av { width: 30px; height: 30px; border-radius: 50%; background: #6e1b37; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.mk .av.g { background: #1a73e8; }
.mk-bar { display: flex; gap: 9px; align-items: center; padding: 9px 11px; }
.mk-media { position: relative; background: #f1f1f1; overflow: hidden; }
.mk-media img, .mk-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mk-media.empty { display: grid; place-items: center; color: #8a8a8a; font-size: 12.5px; background: repeating-linear-gradient(45deg, #f3f3f3 0 12px, #ececec 12px 24px); }
.mk-icons { display: flex; gap: 4px; padding: 8px 11px 4px; font-size: 17px; }
.mk-cap, .mk-text { padding: 2px 11px 11px; overflow-wrap: anywhere; }
.mk .tag { color: #00376b; }
.mk .more { border: 0; background: none; color: #737373; padding: 0; cursor: pointer; font: inherit; }
.mk .full { display: none; }
.mk.expanded .short { display: none; }
.mk.expanded .full { display: inline; }
.mk.fb .mk-text { padding-top: 0; }
.mk.fb .tag { color: #0064d1; }
.mk .fbbar { justify-content: space-around; font-size: 12.5px; color: #65676b; font-weight: 600; border-top: 1px solid #e4e6eb; margin: 0 11px; padding: 8px 0; }
.mk.gb .gb-btn { margin: 0 11px 12px; border: 1px solid #dadce0; color: #1a73e8; border-radius: 18px; padding: 6px 14px; display: inline-block; font-weight: 600; font-size: 13px; }
.mk.tt { position: relative; background: #000; color: #fff; border-color: #000; max-width: 300px; margin: 0 auto; }
.mk.tt .mk-media { background: #111; }
.mk.tt .mk-media.empty { background: #161616; color: #888; }
.mk.tt .tt-cap { position: absolute; left: 0; right: 48px; bottom: 0; padding: 40px 12px 12px; background: linear-gradient(transparent, rgba(0,0,0,.7)); font-size: 12.5px; }
.mk.tt .tt-cap .tiny, .mk.tt .more { color: #ddd; }
.mk.tt .tag { color: #fff; font-weight: 700; }
.mk.tt .tt-side { position: absolute; right: 8px; bottom: 70px; display: flex; flex-direction: column; gap: 14px; align-items: center; font-size: 20px; }
.mk.tt .tt-side small { display: block; font-size: 10px; text-align: center; }
.mk.yt .yt-title { font-weight: 650; font-size: 15px; padding: 10px 11px 0; }
.mk.yt .yt-desc { margin: 0 11px 11px; background: #f2f2f2; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; overflow-wrap: anywhere; }
.mk.yt .tag { color: #065fd4; }
.mk.em .em-inbox { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #eee; background: #fafafa; }
.mk.em .em-inbox > .grow { min-width: 0; }
.mk.em .em-subj { font-weight: 650; }
.mk.em .em-prev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk.em .em-body { padding: 12px; }
.mk.em .em-body .mk-media { border-radius: 6px; margin-bottom: 10px; }
.mk.em .em-body .mk-text { padding: 0; }
.mk.sms { padding: 12px; }
.mk.sms .sms-head { text-align: center; font-size: 11.5px; color: #737373; margin-bottom: 10px; font-weight: 600; }
.mk.sms .bubble { background: #e9e9eb; border-radius: 16px 16px 16px 4px; padding: 8px 12px; max-width: 85%; overflow-wrap: anywhere; }
.mk.sms .sms-img { max-width: 60%; border-radius: 14px; overflow: hidden; margin-bottom: 6px; }
.mk.sms .tag { color: #0a66c2; text-decoration: underline; }
.mk.web .web-in { padding: 14px 16px; }
.mk.web h3 { font-family: var(--serif); font-size: 21px; margin: 4px 0 8px; color: #1e191b; }
.mk.web .mk-text { padding: 0; }

/* Designer (full-screen editor) */
.modal.editor { left: 0; top: 0; transform: none; width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; padding: 0; display: flex; flex-direction: column; overflow: hidden; animation: fade .15s; }
.ed-loading { display: grid; place-items: center; height: 100%; }
.ed-top { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ed-title { font-family: var(--serif); font-size: 18px; margin-right: 6px; }
.ed-size { width: auto; padding: 5px 9px; font-size: 13px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.ed-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 74px 300px minmax(0, 1fr); }
.ed-rail { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.ed-rail button { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; color: var(--text-2); font-size: 11px; font-weight: 600; padding: 9px 2px; border-radius: 8px; cursor: pointer; }
.ed-rail button span { font-size: 19px; line-height: 1; }
.ed-rail button:hover { background: var(--surface-2); color: var(--text); }
.ed-rail button.on { background: var(--accent-soft); color: var(--accent); }
.ed-panel { overflow-y: auto; padding: 12px 14px 24px; border-right: 1px solid var(--line); background: var(--surface); }
.ed-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 16px 0 8px; }
.ed-h:first-child { margin-top: 2px; }
.ed-seg { display: flex; margin-bottom: 10px; }
.ed-seg button { flex: 1; }
.ed-work { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); }
.ed-toolbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 7px 12px; min-height: 48px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.tb-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tb-row.extra { padding-top: 6px; border-top: 1px dashed var(--line); }
.tb-row .btn.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tb-row .seg button { padding: 4px 8px; }
.tb-font { width: 168px; padding: 5px 8px; font-size: 13px; }
.tb-num { width: 60px; padding: 5px 6px; text-align: center; }
.tb-lock { width: 220px; min-height: 38px; padding: 5px 8px; font-size: 13px; resize: vertical; }
.tb-color input { width: 30px; height: 28px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 1px; background: var(--surface); cursor: pointer; }
.tb-range { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.tb-range input { width: 92px; accent-color: var(--accent); }
.tb-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.icon-btn.danger { color: var(--bad); }
.ed-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 16px; }
.ed-stage .canvas-container { box-shadow: var(--shadow-lg); background: #fff; }

.ed-swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.ed-swatches .pal { display: flex; border: 2px solid var(--line); border-radius: 9px; overflow: hidden; padding: 0; cursor: pointer; background: none; }
.ed-swatches .pal i { width: 15px; height: 26px; display: block; }
.ed-swatches .pal.on { border-color: var(--text); }
.ed-swatches .sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.ed-swatches .sw.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.ed-swatches .sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ed-tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.ed-tpl { border: 2px solid transparent; border-radius: 9px; padding: 0; background: var(--surface-2); cursor: pointer; overflow: hidden; text-align: left; }
.ed-tpl img { width: 100%; display: block; background: var(--surface-2); object-fit: cover; }
.ed-tpl span { display: block; font-size: 11.5px; font-weight: 600; padding: 4px 6px; color: var(--text-2); }
.ed-tpl:hover, .ed-tpl.on { border-color: var(--accent); }
.ed-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.ed-grid.stock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ed-ph { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.ed-ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.ed-ph:hover img { transform: scale(1.04); }
.ed-ph .cred { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-size: 10px; padding: 12px 6px 4px; opacity: 0; transition: opacity .15s; text-align: left; }
.ed-ph:hover .cred { opacity: 1; }
.ed-ph.busy { opacity: .5; pointer-events: none; }
.ed-ph.logo { background: repeating-conic-gradient(#e9e4de 0 25%, #fbfaf8 0 50%) 0 0 / 14px 14px; }
.ed-ph.logo img { object-fit: contain; padding: 8px; }
.ed-ph.add { display: grid; place-items: center; font-size: 24px; color: var(--muted); border: 1px dashed var(--line-strong); background: var(--surface); }
.ed-text { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 10px 12px; margin-bottom: 7px; cursor: pointer; color: var(--text); }
.ed-text:hover { border-color: var(--accent); }
.ed-text.h { font-size: 24px; font-weight: 700; }
.ed-text.s { font-size: 16px; font-weight: 600; }
.ed-text.b { font-size: 13px; }
.ed-combos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.ed-combos button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 10px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text); min-height: 86px; justify-content: center; }
.ed-combos button:hover { border-color: var(--accent); }
.ed-combos b { font-size: 20px; line-height: .95; text-align: center; font-weight: 400; }
.ed-combos b em { font-style: normal; }
.ed-combos span { font-size: 10.5px; color: var(--muted); text-align: center; }
.ed-combos .badge-demo { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 800; }
.ed-combos .btn-demo { border-radius: 99px; padding: 6px 12px; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.ed-els { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ed-els button { aspect-ratio: 1; border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; cursor: pointer; display: grid; place-items: center; color: var(--accent); padding: 8px; }
.ed-els button svg { width: 100%; height: 100%; }
.ed-els button:hover { border-color: var(--accent); }
.ed-els.emoji button { font-size: 26px; padding: 0; }
.tiny { font-size: 11px; }
.kit-tile img { object-fit: contain; padding: 6px; }
.kit-tile .thumb { background: repeating-conic-gradient(#e9e4de 0 25%, #fbfaf8 0 50%) 0 0 / 14px 14px; }
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.kit-tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.kit-tile .thumb { aspect-ratio: 4 / 3; position: relative; }
.kit-tile .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; }
.kit-tile .row { padding: 5px 6px 5px 10px; font-size: 12.5px; }

@media (max-width: 1100px) {
  .ed-main { grid-template-columns: 64px 250px minmax(0, 1fr); }
  .studio { grid-template-columns: minmax(0, 1fr); }
  .studio-previews { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 860px) {
  .brief { flex-direction: column; }
  .brief-more { grid-template-columns: minmax(0, 1fr); }
  .studio-title { max-width: none; }
  .ed-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; }
  .ed-work { grid-row: 1; }
  .ed-panel { grid-row: 2; max-height: 34vh; border-right: 0; border-top: 1px solid var(--line); }
  .ed-rail { grid-row: 3; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 4px; }
  .ed-rail button { flex: 1; padding: 6px 2px; }
  .ed-toolbar { overflow-x: auto; }
  .tb-row { flex-wrap: nowrap; }
  .ed-top .ed-title { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
  .topbar, .page, .banner { padding-left: 16px; padding-right: 16px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 28px 20px; }
  .auth-art h1 { font-size: 30px; }
  .search-btn kbd { display: none; }
  .toolbar .input { max-width: none; flex: 1 1 100%; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: minmax(0, 1fr); } .page-head h1 { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Pixel Bear edition: the same system in Pixel Bear's clay accent. */
html[data-edition="studio"] .auth-art { background: #8f4a27; }
html[data-edition="studio"] { --accent: #b26239; --accent-hover: #955029; --accent-soft: #f7ebe2; }
@media (prefers-color-scheme: dark) { html[data-edition="studio"]:not([data-theme="light"]) { --accent: #e09a6d; --accent-hover: #eab08a; --accent-soft: #3a2a20; } }
html[data-edition="studio"][data-theme="dark"] { --accent: #e09a6d; --accent-hover: #eab08a; --accent-soft: #3a2a20; }
.finder-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.4fr) auto; gap: 10px; align-items: end; }
@media (max-width: 640px) { .finder-form { grid-template-columns: 1fr; } }
.msg-body { white-space: pre-wrap; font-size: 14px; line-height: 1.5; background: var(--surface-2); border-radius: 8px; padding: 12px; margin: 8px 0 0;  }

/* AI answers, split into readable parts */
.sections { display: flex; flex-direction: column; gap: 10px; }
.ai-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ai-sec > summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 700; font-size: 15px; cursor: pointer; list-style: none; }
.ai-sec > summary::-webkit-details-marker { display: none; }
.ai-sec > summary::before { content: '›'; color: var(--muted); font-size: 18px; line-height: 1; transition: transform .15s; }
.ai-sec[open] > summary::before { transform: rotate(90deg); }
.ai-sec > .md { padding: 0 16px 14px 30px; line-height: 1.6; max-width: 78ch; }
.ai-intro { padding: 0 2px; }
.ai-actions.with-hints { flex-direction: column; gap: 8px; }
.ai-action { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tab-done { color: var(--ok); font-weight: 800; }
.tab-busy { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: job-spin .8s linear infinite; vertical-align: -1px; }
@keyframes job-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tab-busy { animation: none; } }

/* One job, on its own page */
.job-back { display: inline-block; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
.job-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.job-head .grow { min-width: min(320px, 100%); }
.job-head h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.015em; margin: 2px 0 8px; text-wrap: balance; }
.job-co { font-weight: 700; color: var(--accent); }
.job-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.job-head-side { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.job-head-side .field { margin: 0; min-width: 140px; }
.next-step { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.next-step .grow { min-width: min(260px, 100%); }
.next-step .label { color: var(--accent); margin-bottom: 2px; }
.job-why { margin-bottom: 12px; }
.job-why p { margin: 4px 0 0; max-width: 78ch; }
.find-bar { position: sticky; top: 62px; z-index: 5; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--bg); padding: 8px 0; margin-bottom: 8px; }
.find-bar .input { flex: 1 1 240px; min-width: 0; }
.posting { padding: 24px 28px; font-size: 15.5px; line-height: 1.65; overflow-wrap: anywhere; }
.posting > * { max-width: 74ch; }
.posting h3 { font-size: 16px; margin: 22px 0 6px; }
.posting h3:first-child { margin-top: 0; }
.posting p { margin: 0 0 14px; }
.posting ul { margin: 0 0 14px; padding-left: 22px; }
.posting li { margin: 5px 0; }
.posting mark { background: var(--gold-soft); color: inherit; border-radius: 3px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 45%, transparent); }
.posting mark.on { background: var(--gold); color: var(--surface); }
.doc-text { width: 100%; font-size: 14.5px; line-height: 1.6; resize: vertical; }
.doc-bar { margin-bottom: 12px; }
.helper { padding: 28px; }
.helper h2 { font-size: 18px; margin: 0 0 6px; }
.helper p { max-width: 62ch; margin: 0 0 12px; }

/* Morning page */
.today-top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.today-top .grow { min-width: min(280px, 100%); }
.today-top p { margin: 2px 0 0; font-size: 16px; }
.today-date { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.today-plan-btn { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.today-page { container-type: inline-size; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.progress-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.progress-chips span { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; }
.progress-chips span.on { color: var(--ok); background: var(--ok-soft); border-color: transparent; font-weight: 600; }
.goal-track { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.goal-track span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.agenda { list-style: none; margin: 0; padding: 0; }
.link-row { display: flex; gap: 10px; width: 100%; padding: 7px 0; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.agenda li:last-child .link-row { border-bottom: 0; }
.link-row:hover .grow { color: var(--accent); }
.fact-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.fact-row:last-child { border-bottom: 0; }
.fact-row b { font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) { .today-plan-btn { align-items: flex-start; } }
@media (max-width: 600px) { .posting { padding: 16px; font-size: 15px; } .job-head h1 { font-size: 22px; } .find-bar { top: 54px; } .ai-sec > .md { padding-left: 16px; } }

/* The side chat in your own desktop copy */
.shell.with-chat { grid-template-columns: 236px minmax(0, 1fr) 400px; }
.shell.with-chat.chat-closed { grid-template-columns: 236px minmax(0, 1fr); }
.shell.chat-closed .sidekick { display: none; }
.sidekick { position: sticky; top: 0; z-index: 52; height: 100vh; display: flex; flex-direction: column; min-width: 0; background: var(--surface); border-left: 1px solid var(--line); }
body:has(.with-chat:not(.chat-closed)) .drawer { right: 400px; }
.sk-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sk-session { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.sk-empty { padding: 8px 2px; line-height: 1.55; }
.sk-empty p { margin: 0 0 10px; }
.sk-msg { min-width: 0; overflow-wrap: anywhere; line-height: 1.55; font-size: 14.5px; }
.sk-msg.me { align-self: flex-end; max-width: 92%; background: var(--accent-soft); border-radius: var(--radius); padding: 8px 12px; white-space: pre-wrap; }
.sk-msg.claude .md > :first-child { margin-top: 0; }
.sk-msg.claude .md > :last-child { margin-bottom: 0; }
.sk-where { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; white-space: normal; }
.sk-msg.me blockquote { margin: 0 0 5px; padding-left: 8px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 13px; }
.sk-edit { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 7px; font-size: 13px; font-weight: 600; color: var(--ok); }
.sk-foot { border-top: 1px solid var(--line); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 7px; }
.sk-place { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-quote { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 8px; }
.sk-quote span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-foot textarea { width: 100%; resize: none; font-size: 14.5px; line-height: 1.45; max-height: 180px; }
.sk-actions { margin-top: 6px; gap: 6px; align-items: center; }
.just-changed { animation: just-changed 1.6s ease-out; }
@keyframes just-changed { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 3px transparent; } }
@media (max-width: 1100px) {
  .shell.with-chat, .shell.with-chat.chat-closed { grid-template-columns: 236px minmax(0, 1fr); }
  .sidekick { position: fixed; right: 0; bottom: 0; width: min(400px, 100%); box-shadow: var(--shadow-lg); }
  body:has(.with-chat:not(.chat-closed)) .drawer { right: 0; }
}
@media (prefers-reduced-motion: reduce) { .just-changed { animation: none; } }

/* Today lays itself out from the room it actually has, with or without the side chat */
.week-card { margin-bottom: 16px; }
.week-goals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; }
.week-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.week-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.week-fact span:first-child { font-size: 12.5px; color: var(--muted); }
.week-fact b { font-size: 17px; font-variant-numeric: tabular-nums; }
.today-coming { order: 1; }
.today-grid > :not(.today-first, .today-coming) { order: 2; }
.agenda-day + .agenda-day { margin-top: 14px; }
.agenda-day h3 { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 2px; }
@container (min-width: 1040px) {
  .today-grid { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
  .today-coming { grid-column: 2; grid-row: 1 / span 3; order: 0; }
  .today-grid > :not(.today-first, .today-coming) { order: 0; grid-column: 1; }
}
@container (max-width: 560px) { .week-goals { grid-template-columns: minmax(0, 1fr); } }

/* Status buttons above a list */
.status-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.status-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 99px; background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.status-tabs button:hover { color: var(--text); }
.status-tabs button.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.status-tabs button span { font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.status-tabs button.on span { color: inherit; }

/* Text boxes are as tall as what's in them, so the page is the only thing that scrolls */
@supports (field-sizing: content) {
  .textarea { field-sizing: content; min-height: 4.5em; overflow: hidden; resize: none; }
  .doc-text, .pv-edit .textarea { resize: none; }
}

/* Dictation in the chat */
.sk-mic { width: 28px; height: 28px; }
.sk-mic.on { background: var(--bad-soft); color: var(--bad); animation: sk-listening 1.4s ease-in-out infinite; }
@keyframes sk-listening { 50% { box-shadow: 0 0 0 4px var(--bad-soft); } }
@media (prefers-reduced-motion: reduce) { .sk-mic.on { animation: none; } }

/* A lead's page: the fix at full width, with what was found around it. */
.lead-fix { display: flex; flex-direction: column; gap: 16px; }
.lead-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 28px; }
.lead-fact p { margin: 3px 0 0; }
.lead-fact ul { margin: 4px 0 0; padding-left: 18px; }
.lead-fact li + li { margin-top: 4px; }
.lead-fact:empty { display: none; }
.lead-preview { overflow: hidden; }
.lead-preview-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lead-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.lead-summary { display: flex; flex-direction: column; gap: 14px; }
.lead-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #fff; }
.lead-thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; transform-origin: 0 0; pointer-events: none; }
@media (max-width: 900px) { .lead-top { grid-template-columns: minmax(0, 1fr); } }
.lead-swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); }
.lead-fix-cell { display: flex; align-items: center; gap: 10px; }
.lead-fix-cell .btn { flex: none; }
.lead-fix-text { max-width: 46ch; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lead-fix-cell .lead-fix-text { flex: 1; }

.layout-card .seg button { font-size: 12px; }
.doc-preview { position: relative; margin-top: 10px; }
.doc-preview iframe { display: block; width: 100%; height: min(78vh, 980px); border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.doc-preview [data-preview-note] { display: block; padding: 18px 0; }
.layout-raw { margin-top: 12px; }
.layout-raw summary { cursor: pointer; color: var(--text-2); }
.layout-raw p { margin: 6px 0; }
.layout-raw textarea { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
