/* Zylvora OS command center */
:root { --side: 248px; --bg: #EDF2F3; }
:root[data-theme="dark"] {
  --bg: #061A20; --surface: #0C252D; --surface-2: #10303A; --ink: #E4F1F3; --ink-soft: #9CBBC1; --ink-faint: #6E8F95; --line: #1A3E48; --line-strong: #24515D;
  --info-bg: #123A44; --ok-bg: #0F3A2C; --warn-bg: #3A2A12; --danger-bg: #3E1A17; --accent: #2FA3B5; --teal-100: #123A44; --teal-700: #8FD3DC;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 24px 48px -24px rgba(0,0,0,.7);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #061A20; --surface: #0C252D; --surface-2: #10303A; --ink: #E4F1F3; --ink-soft: #9CBBC1; --ink-faint: #6E8F95; --line: #1A3E48; --line-strong: #24515D;
  --info-bg: #123A44; --ok-bg: #0F3A2C; --warn-bg: #3A2A12; --danger-bg: #3E1A17; --accent: #2FA3B5; --teal-100: #123A44; --teal-700: #8FD3DC;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 24px 48px -24px rgba(0,0,0,.7); } }

body { background: var(--bg); font-size: 14px; }
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; background: var(--teal-950); color: #CFE3E6; display: flex; flex-direction: column; padding: 18px 14px; gap: 18px; border-right: 1px solid rgba(255,255,255,.06); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: #fff; text-decoration: none; }
.side-brand img { width: 32px; }
.side-brand b { display: block; font-size: 15px; letter-spacing: -.01em; }
.side-brand small { display: block; font-size: 11.5px; color: #7FA5AB; font-weight: 600; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #B4CFD3; text-decoration: none; font-weight: 600; font-size: 14px; }
.side nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: rgba(7,122,140,.28); color: #fff; box-shadow: inset 3px 0 0 var(--ember); }
.side nav a .count { margin-left: auto; font-size: 11px; background: var(--ember); color: #fff; padding: 1px 7px; border-radius: 999px; }
.side-sec { font-size: 11.5px; color: #5F858B; font-weight: 700; padding: 8px 12px 2px; }
.side-foot { margin-top: auto; display: grid; gap: 8px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.04); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal-500); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.side-user b { display: block; color: #fff; font-size: 13px; }
.side-user small { display: block; font-size: 11.5px; color: #7FA5AB; }
.side-foot .links { display: flex; gap: 6px; flex-wrap: wrap; }
.side-foot .links a, .side-foot .links button { font-size: 12px; color: #9FC5CB; background: none; border: 0; cursor: pointer; padding: 4px 6px; text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 20px; letter-spacing: -.02em; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--ember); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.menu-btn { display: none; }
.view { padding: clamp(16px, 3vw, 32px); display: grid; gap: 20px; align-content: start; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow-1); min-width: 0; }
.panel > h2, .panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; font-size: 15px; letter-spacing: -.01em; }
.panel-h h2 { margin: 0; font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input { max-width: 280px; min-height: 38px; width: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--ink-soft); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* Overview */
.hello { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.hello h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.03em; }
.hello p { margin: 4px 0 0; color: var(--ink-soft); }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; text-decoration: none; color: inherit; display: grid; gap: 4px; transition: border-color .2s; }
.metric:hover { border-color: var(--accent); }
.metric b { font-size: 28px; letter-spacing: -.03em; line-height: 1.1; }
.metric span { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.metric small { font-size: 12px; color: var(--ink-faint); }
.metric.hot { background: var(--teal-950); color: #fff; border-color: var(--teal-950); }
.metric.hot span, .metric.hot small { color: #9FC5CB; }
.money-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.money-strip .metric b { font-size: 24px; }
.actions-list { display: grid; gap: 8px; }
.action { display: grid; grid-template-columns: 8px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.action::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); }
.action.p1::before { background: var(--ember); }
.action b { display: block; font-size: 13.5px; }
.action small { color: var(--ink-faint); font-size: 12px; }
.action span.go { font-size: 12px; font-weight: 700; color: var(--accent); }
.action:hover { border-color: var(--accent); }
.funnel { display: grid; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 28px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-row .bar { height: 10px; border-radius: 6px; background: var(--teal-100); overflow: hidden; }
.funnel-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal-500), var(--teal-700)); border-radius: 6px; transition: width .8s var(--ease); }
.feed { display: grid; gap: 0; }
.feed-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .ic { width: 30px; height: 30px; border-radius: 50%; background: var(--info-bg); color: var(--teal-700); display: grid; place-items: center; font-size: 13px; }
.feed-item small { display: block; color: var(--ink-faint); font-size: 11.5px; }
.deadline { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; text-decoration: none; color: inherit; }
.deadline:last-child { border-bottom: 0; }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px; min-height: 120px; }
.col-h { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 800; font-size: 13px; }
.col-h span { color: var(--ink-faint); font-weight: 700; }
.kcard { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; text-decoration: none; color: inherit; box-shadow: var(--shadow-1); transition: border-color .2s, transform .2s var(--ease); }
.kcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.kcard b { font-size: 14px; }
.kcard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--ink-soft); }
.kcard .row-b { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-faint); }
.progress { height: 6px; border-radius: 6px; background: var(--teal-100); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--teal-500); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 12px; color: var(--ink-faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t .r { text-align: right; }

/* Detail pages */
.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; flex-wrap: wrap; }
.detail-head h2 { margin: 0 0 6px; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.03em; }
.detail-head .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--ink-soft); font-size: 13px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.back:hover { color: var(--accent); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--ink-soft); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--ink-soft); cursor: pointer; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--ember); }
.stages { display: flex; gap: 4px; margin: 6px 0 2px; flex-wrap: wrap; }
.stages span { flex: 1; min-width: 86px; padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-faint); border: 1px solid var(--line); text-align: center; }
.stages span.done { background: var(--teal-100); color: var(--teal-700); border-color: transparent; }
.stages span.now { background: var(--teal-800); color: #fff; border-color: var(--teal-800); }
.tasks3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.task { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 6px; font-size: 13px; }
.task select { margin-left: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 2px 4px; font-size: 12px; }
.ms { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.ms button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: none; cursor: pointer; padding: 0; color: #fff; font-size: 12px; }
.ms.done button { background: var(--ok); border-color: var(--ok); }
.ms.done span { color: var(--ink-faint); text-decoration: line-through; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.asset { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); display: grid; }
.asset .thumb { aspect-ratio: 16 / 11; background: var(--surface-2); position: relative; cursor: zoom-in; border: 0; padding: 0; display: block; width: 100%; }
.asset .thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset .thumb .chip { position: absolute; left: 10px; top: 10px; }
.asset .a-body { padding: 12px 14px; display: grid; gap: 8px; }
.asset .a-body b { font-size: 14px; }
.versions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.versions-row a { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; color: var(--ink-soft); }
.upload-zone { border: 2px dashed var(--line-strong); border-radius: 16px; padding: 18px; display: grid; gap: 10px; }
.sample-files { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.msgs { display: grid; gap: 10px; max-height: 420px; overflow: auto; padding: 4px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.msg.me { margin-left: auto; background: var(--teal-800); color: #fff; border-color: var(--teal-800); }
.msg small { display: block; font-size: 11px; opacity: .7; margin-bottom: 2px; }
.msg-form { display: flex; gap: 8px; margin-top: 12px; }
.msg-form textarea { flex: 1; min-height: 44px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); padding: 10px 12px; resize: vertical; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.timeline li { position: relative; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--teal-500); }
.timeline li.money::before { border-color: var(--ok); }
.timeline li.client::before { border-color: var(--ember); }
.timeline small { display: block; color: var(--ink-faint); font-size: 12px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 110px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); font-size: 12px; }
.swatch i { display: block; height: 56px; }
.swatch span { display: block; padding: 6px 8px; }
.brief-answers dt { font-weight: 700; color: var(--ink); font-size: 12.5px; margin-top: 10px; }
.brief-answers dd { margin: 2px 0 0; color: var(--ink-soft); }
.ref-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ref-thumbs a { width: 120px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); font-size: 11.5px; text-decoration: none; color: var(--ink-soft); }
.ref-thumbs img { width: 100%; height: 80px; object-fit: cover; }
.ref-thumbs span { display: block; padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Proposal builder */
.pb { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.items-table input { min-height: 36px; padding: 6px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); width: 100%; }
.items-table td { padding: 6px 4px; }
.doc { background: #fff; color: #0B2E36; border-radius: 6px; padding: 34px; box-shadow: var(--shadow-2); font-size: 13px; position: sticky; top: 80px; }
.doc .doc-top { display: flex; justify-content: space-between; align-items: start; border-bottom: 3px solid #0F4250; padding-bottom: 14px; margin-bottom: 18px; }
.doc .doc-top img { width: 46px; }
.doc h3 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.doc table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.doc th, .doc td { text-align: left; padding: 7px 0; border-bottom: 1px solid #DCE6E8; }
.doc .r { text-align: right; }
.doc .tot { font-size: 16px; font-weight: 800; }
.doc .split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.doc .split div { background: #DCEDEF; padding: 10px 12px; border-radius: 10px; }
.doc .split b { display: block; font-size: 16px; }
.doc ul { padding-left: 18px; margin: 6px 0; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--line); gap: 1px; }
.cal-h { background: var(--surface-2); padding: 8px; font-size: 12px; font-weight: 700; color: var(--ink-faint); text-align: center; }
.cal-d { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-d.out { background: var(--surface-2); }
.cal-d.out .cal-n { opacity: .4; }
.cal-d.today .cal-n { background: var(--ember); color: #fff; }
.cal-n { align-self: flex-start; font-size: 12px; font-weight: 700; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.ci { display: flex; align-items: center; gap: 5px; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--c, var(--teal-500)); background: var(--surface-2); border-radius: 6px; padding: 3px 6px; font-size: 11.5px; font-weight: 600; cursor: pointer; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci:hover { background: var(--info-bg); }
.ci i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--s); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.week-d { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 260px; display: grid; gap: 8px; align-content: start; }
.week-d h3 { margin: 0; font-size: 13px; }
.wcard { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); text-align: left; padding: 0; width: 100%; }
.wcard img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.wcard span { display: block; padding: 6px 8px; font-size: 12px; font-weight: 600; }
.tracker { display: grid; gap: 14px; }
.trk h3 { margin: 0; font-size: 14px; }
.trk .bars { display: grid; gap: 8px; margin-top: 10px; }
.trk .bar-row { display: grid; grid-template-columns: 64px 1fr 90px; gap: 10px; align-items: center; font-size: 12.5px; }
.trk .bar { height: 12px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); position: relative; overflow: hidden; }
.trk .bar .pl { position: absolute; inset: 0 auto 0 0; background: var(--teal-100); }
.trk .bar .dn { position: absolute; inset: 0 auto 0 0; background: var(--teal-500); }
.camps { display: grid; gap: 6px; }
.camp { display: grid; grid-template-columns: 180px 1fr; gap: 10px; align-items: center; font-size: 12.5px; }
.camp-track { position: relative; height: 26px; background: var(--surface-2); border-radius: 8px; border: 1px solid var(--line); }
.camp-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 700; padding: 0 8px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; }

/* Finance */
.flow { display: flex; gap: 0; flex-wrap: wrap; margin: 8px 0; }
.flow span { position: relative; padding: 7px 14px 7px 20px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-faint); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -4px; }
.flow span:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); padding-left: 12px; }
.flow span.done { background: var(--teal-100); color: var(--teal-700); }
.flow span.now { background: var(--ember); color: #fff; }
.sim-note { padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 13px; }
.provider { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2, .pb { grid-template-columns: 1fr; }
  .doc { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; width: min(290px, 86vw); transform: translateX(-100%); transition: transform .35s var(--ease); }
  .side.open { transform: none; box-shadow: var(--shadow-2); }
  .menu-btn { display: grid; }
  .grid-3, .money-strip, .tasks3 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-d { min-height: 70px; }
  .ci { font-size: 0; padding: 4px; }
  .ci i { width: 8px; height: 8px; }
  .week { grid-template-columns: 1fr; }
  .week-d { min-height: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .camp { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 100px 1fr 24px; }
}

/* Sea Grape Labs demo bar sits above everything (52px) */
html.has-sglbar .shell { padding-top: 52px; }
html.has-sglbar .side { top: 52px; height: calc(100dvh - 52px); }
html.has-sglbar .top { top: 52px; }
html.has-sglbar .doc { top: 132px; }
