/* ProjectFlow — design tokens and components.
   Default look follows Oprenzy "Signature" (navy + ember + cyan); tenants override --brand/--accent via /brand.css. */
:root {
  --brand: #f38103; --on-brand: #071f34; --accent: #22b8f0; --on-accent: #071f34;
  --navy: #071f34; --navy-2: #0c2b47; --nav-text: #c9d6e8; --nav-muted: #8fa5c0;
  --bg: #f4f7fb; --surface: #ffffff; --sunken: #eef3f8; --text: #0b1636; --muted: #56657f; --faint: #8a97ad;
  --border: #e1e8f0; --hairline: #edf1f6;
  --ok: #18802c; --ok-soft: #e3f6e5; --warn: #a15c00; --warn-soft: #fff3d6; --bad: #c8281e; --bad-soft: #fdeceb; --info: #0b6f93; --info-soft: #e0f4fc;
  --lantern: #ffc441;
  --radius: 14px; --radius-s: 8px; --shadow: 0 1px 2px rgba(7,31,52,.06), 0 8px 24px -12px rgba(7,31,52,.18);
  --font: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 264px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1424; --surface: #111d31; --sunken: #0e182a; --text: #e6edf7; --muted: #9fb0c8; --faint: #7385a0;
    --border: #22324b; --hairline: #1a273c; --ok-soft: #10301a; --warn-soft: #3a2a0c; --bad-soft: #3a1513; --info-soft: #0d2a3a;
    --ok: #5fd07a; --warn: #f5b74a; --bad: #ff7b6f; --info: #6fd3ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1424; --surface: #111d31; --sunken: #0e182a; --text: #e6edf7; --muted: #9fb0c8; --faint: #7385a0;
  --border: #22324b; --hairline: #1a273c; --ok-soft: #10301a; --warn-soft: #3a2a0c; --bad-soft: #3a1513; --info-soft: #0d2a3a;
  --ok: #5fd07a; --warn: #f5b74a; --bad: #ff7b6f; --info: #6fd3ff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); }
img, video { max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.45rem, 2.4vw, 1.9rem); font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
code, pre { font-family: var(--mono); font-size: .88em; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--sunken); padding: .75rem; border-radius: var(--radius-s); overflow: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--surface); padding: .5rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- App shell (Signature: navy rail, grouped accordion menu, context block, header row) ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--navy) var(--sidebar), transparent 0); }
.sidebar { background: var(--navy); color: var(--nav-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 1rem .75rem 1rem; z-index: 30; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sidebar a { text-decoration: none; }
.sidebar summary { list-style: none; cursor: pointer; }
.sidebar summary::-webkit-details-marker { display: none; }
.brandmark { display: flex; align-items: center; gap: .65rem; padding: .35rem .5rem .9rem; color: #fff; }
.brandmark img { max-height: 36px; width: auto; border-radius: 6px; background: #fff; padding: 2px; }
.brandmark .mono { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #ff9a2e); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; flex: none; }
.brandmark strong { display: block; font-size: .98rem; line-height: 1.2; }
.brandmark small { color: var(--nav-muted); font-size: .75rem; }
.chev { flex: none; margin-left: auto; transition: transform .15s ease; opacity: .7; }
details[open] > summary .chev { transform: rotate(180deg); }
/* context block */
.context { margin: 0 0 .75rem; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); position: relative; }
.context > summary { display: flex; align-items: center; gap: .6rem; padding: .65rem .7rem; color: #fff; }
.context > summary > svg:first-child { width: 18px; height: 18px; color: var(--accent); flex: none; }
.context > summary span { min-width: 0; }
.context strong { display: block; font-size: .92rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context small { display: block; color: var(--nav-muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-menu { padding: .25rem .35rem .45rem; border-top: 1px solid rgba(255,255,255,.08); max-height: 320px; overflow-y: auto; }
.context-menu a { display: block; padding: .45rem .5rem; border-radius: 8px; color: var(--nav-text); font-size: .86rem; font-weight: 600; }
.context-menu a small { font-weight: 500; }
.context-menu a:hover, .context-menu a[aria-current="page"] { background: rgba(255,255,255,.08); color: #fff; }
.context-menu a.all { color: var(--accent); }
/* grouped menu */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-single, .nav-group > summary { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 12px; color: var(--nav-text); font-weight: 600; font-size: .92rem; }
.nav-single:hover, .nav-group > summary:hover { background: var(--navy-2); color: #fff; }
.nav-single svg, .nav-group > summary > svg:first-child { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-single[aria-current="page"] { background: linear-gradient(135deg, var(--brand), #ff9a2e); color: var(--on-brand); box-shadow: 0 6px 18px -8px rgba(243,129,3,.7); }
.nav-group > summary[data-active] { color: #fff; }
.nav-group > summary[data-active] > svg:first-child { color: var(--brand); opacity: 1; }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 1.55rem; padding-left: .6rem; border-left: 1px solid rgba(255,255,255,.1); }
.nav-sub a { display: flex; align-items: center; gap: .5rem; padding: .42rem .6rem; border-radius: 10px; color: var(--nav-muted); font-size: .87rem; font-weight: 550; }
.nav-sub a:hover { color: #fff; background: var(--navy-2); }
.nav-sub a[aria-current="page"] { background: linear-gradient(135deg, var(--brand), #ff9a2e); color: var(--on-brand); font-weight: 700; }
.nav .count { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: .7rem; font-weight: 700; border-radius: 99px; padding: 0 .45rem; min-width: 1.4rem; text-align: center; line-height: 1.45; }
.nav-group > summary .count + .chev { margin-left: .35rem; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: var(--nav-muted); }
.theme-pill { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .5rem .75rem; border-radius: 99px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); color: var(--nav-text); font: inherit; font-weight: 600; cursor: pointer; }
.theme-pill:hover { color: #fff; background: rgba(255,255,255,.1); }
.theme-pill svg { width: 16px; height: 16px; }
.powered { margin-top: .8rem; display: flex; align-items: center; gap: .4rem; color: var(--nav-muted); font-size: .72rem; padding-left: .25rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(8px); position: sticky; top: 0; z-index: 20; }
.topbar .ctx { min-width: 0; }
.topbar .ctx strong { display: block; font-size: .95rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .ctx small { display: block; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar form.search { position: relative; }
.topbar form.search input { width: min(340px, 34vw); padding-left: 2.2rem; border-radius: 99px; background: var(--sunken); border-color: transparent; }
.topbar form.search input:focus { background: var(--surface); border-color: var(--border); }
.topbar form.search svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
.icon-btn .dot[hidden] { display: none; }
.menu-btn { display: none; }
.profile-chip { position: relative; }
.profile-chip > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .55rem; padding: .25rem .6rem .25rem .25rem; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); }
.profile-chip > summary::-webkit-details-marker { display: none; }
.profile-chip .avatar { width: 32px; height: 32px; font-size: .78rem; }
.profile-chip .who strong { display: block; font-size: .84rem; line-height: 1.15; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chip .who small { display: block; font-size: .72rem; line-height: 1.15; }
.profile-chip .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: .35rem; z-index: 50; }
.profile-chip .menu a, .profile-chip .menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .65rem; border-radius: 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; text-decoration: none; }
.profile-chip .menu a:hover, .profile-chip .menu button:hover { background: var(--sunken); }
.profile-chip .menu svg { width: 17px; height: 17px; color: var(--muted); }
.profile-chip .menu form { margin: .25rem 0 0; border-top: 1px solid var(--hairline); padding-top: .25rem; }
.content { padding: 1.25rem 1.5rem 1.5rem; width: 100%; max-width: 1440px; margin: 0 auto; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; font-size: .82rem; color: var(--muted); margin-bottom: .9rem; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs > * + *::before { content: '/'; margin-right: .5rem; color: var(--faint); }
.crumbs > .screen-id + *::before { content: none; }
.crumbs [aria-current="page"] { color: var(--text); font-weight: 600; }
.screen-id { font-family: var(--mono); font-size: .7rem; font-weight: 700; letter-spacing: .04em; color: var(--info); background: var(--info-soft); padding: .12rem .5rem; border-radius: 99px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head .grow { flex: 1 1 280px; min-width: 0; }
.page-head h1 { font-size: clamp(1.5rem, 2.4vw, 1.875rem); font-weight: 800; letter-spacing: -.02em; margin: 0; }
.page-head p { margin: .3rem 0 0; color: var(--muted); }
.tabbar { display: none; }

/* ---------- Signature dashboard blocks ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; padding: 1.35rem 1.5rem; border-radius: 20px; margin-bottom: 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--brand) 40%, transparent) 0%, transparent 45%), linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%); }
.hero .grow { flex: 1 1 320px; min-width: 0; }
.hero .eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--lantern); }
.hero h1 { color: #fff; font-size: clamp(1.5rem, 2.6vw, 1.875rem); font-weight: 800; margin: .2rem 0 .35rem; }
.hero p { color: var(--nav-text); margin: 0; }
.hero .btn:not(.primary) { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.25); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; margin-bottom: 18px; overflow: hidden; box-shadow: var(--shadow); }
.kpi { display: flex; gap: .65rem; align-items: flex-start; padding: 1rem .9rem; text-decoration: none; color: inherit; border-right: 1px solid var(--hairline); min-width: 0; }
.kpi:last-child { border-right: 0; }
a.kpi:hover { background: var(--sunken); }
.kpi .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: #d9f1fe; color: #0b6f93; }
.kpi .ic svg { width: 19px; height: 19px; }
.kpi .ic.violet { background: #ece2fe; color: #5b3fd6; } .kpi .ic.amber { background: #fff0c7; color: #8a5a00; } .kpi .ic.green { background: #dcf8da; color: #1d7a27; } .kpi .ic.teal { background: #cdf6ef; color: #0d7466; } .kpi .ic.ember { background: #ffe4c7; color: #a14f00; }
.kpi .lbl { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi .val { display: block; font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.kpi .delta { display: block; font-size: .75rem; color: var(--muted); }
.kpi .delta.up { color: var(--ok); } .kpi .delta.down { color: var(--bad); }
.panels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow); min-width: 0; grid-column: span 12; }
.panel.s3 { grid-column: span 3; } .panel.s4 { grid-column: span 4; } .panel.s5 { grid-column: span 5; } .panel.s6 { grid-column: span 6; } .panel.s7 { grid-column: span 7; } .panel.s8 { grid-column: span 8; } .panel.s9 { grid-column: span 9; }
.panel-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.panel-head h2 { margin: 0; font-size: 1.02rem; }
.panel-head .grow { flex: 1; }
.panel-head a.more { font-size: .82rem; font-weight: 600; text-decoration: none; color: var(--info); }
.needs { list-style: none; margin: 0; padding: 0; }
.needs li { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--hairline); }
.needs li:last-child { border-bottom: 0; }
.needs .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--warn-soft); color: var(--warn); }
.needs .ic svg { width: 16px; height: 16px; }
.needs .ic.bad { background: var(--bad-soft); color: var(--bad); } .needs .ic.info { background: var(--info-soft); color: var(--info); }
.needs .txt { flex: 1; min-width: 0; }
.needs .txt strong { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.needs .txt small { display: block; font-size: .78rem; }
.needs .btn { flex: none; }
.pipeline { display: flex; gap: 4px; margin-bottom: .9rem; overflow-x: auto; }
.pipeline > * { flex: 1 1 0; min-width: 96px; position: relative; padding: .55rem .9rem .55rem 1.3rem; text-decoration: none; color: #0b1636; font-size: .8rem; font-weight: 700; line-height: 1.2;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); background: #d9f1fe; }
.pipeline > :first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 10px 0 0 10px; padding-left: .9rem; }
.pipeline > :nth-child(5n+2) { background: #ece2fe; } .pipeline > :nth-child(5n+3) { background: #fff0c7; } .pipeline > :nth-child(5n+4) { background: #dcf8da; } .pipeline > :nth-child(5n+5) { background: #cdf6ef; }
.pipeline b { display: block; font-size: 1.15rem; font-weight: 800; }
.pipeline small { color: #3c4a63; font-weight: 600; }
.pipeline .is-current { box-shadow: inset 0 -3px 0 var(--brand); }
.donut-wrap { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; flex: none; }
.donut circle { fill: none; stroke-width: 16; }
.donut text { font: 800 22px var(--font); fill: var(--text); }
.donut text.sub { font: 600 9px var(--font); fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; font-size: .85rem; flex: 1; min-width: 150px; }
.legend a { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; padding-left: .75rem; }
.bars { display: grid; gap: .55rem; }
.bars > * { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; align-items: center; gap: .6rem; text-decoration: none; font-size: .84rem; }
.bars .track { height: 10px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bars .fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #7c5cfa); }
.bars .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt { display: grid; gap: .4rem; font-size: .82rem; }
.gantt .g-row { display: grid; grid-template-columns: minmax(110px, 24%) minmax(0, 1fr); align-items: center; gap: .6rem; text-decoration: none; }
.gantt .g-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gantt .g-track { position: relative; height: 18px; background: repeating-linear-gradient(90deg, var(--sunken) 0 calc(25% - 1px), var(--hairline) calc(25% - 1px) 25%); border-radius: 6px; }
.gantt .g-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 99px; background: linear-gradient(90deg, #22b8f0, #7c5cfa); min-width: 6px; }
.gantt .g-bar.done { background: #4cc764; } .gantt .g-bar.late { background: var(--bad); } .gantt .g-bar.blocked { background: #f5a524; }
.gantt .g-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--brand); }
.gantt .g-axis { display: grid; grid-template-columns: minmax(110px, 24%) minmax(0, 1fr); gap: .6rem; color: var(--faint); font-size: .72rem; }
.gantt .g-axis span:last-child { display: flex; justify-content: space-between; }
th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sort]::after { content: '↕'; opacity: .35; margin-left: .3rem; font-size: .8em; }
th[aria-sort="ascending"]::after { content: '↑'; opacity: .9; } th[aria-sort="descending"]::after { content: '↓'; opacity: .9; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--sunken); }
.empty-state { text-align: center; padding: 1.25rem .75rem; color: var(--muted); font-size: .9rem; }
.empty-state svg { width: 28px; height: 28px; color: var(--faint); display: block; margin: 0 auto .4rem; }

/* compact branded project header (no giant hero in operational views) */
.project-header { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.25rem;
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 60%, color-mix(in srgb, var(--brand) 35%, var(--navy-2)) 100%); color: #fff; }
.project-header h1 { color: #fff; margin: 0; }
.project-header p { color: var(--nav-text); margin: .25rem 0 0; font-size: .9rem; }
.project-header .ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: radial-gradient(closest-side, var(--navy) 79%, transparent 80% 100%), conic-gradient(var(--brand) calc(var(--p) * 1%), rgba(255,255,255,.14) 0); }
.project-header .ring small { display: block; font-size: .62rem; font-weight: 600; color: var(--nav-text); text-align: center; margin-top: -2px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card.raised { box-shadow: var(--shadow); border-color: transparent; }
.card > h2:first-child, .card > h3:first-child, .card-head h2, .card-head h3 { margin-bottom: .1rem; }
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.card-head .grow { flex: 1; min-width: 0; }
.card-head a.more { font-size: .85rem; color: var(--muted); }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); align-items: start; }
.stack > * + * { margin-top: 1rem; }
.stack-s > * + * { margin-top: .5rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.empty { text-align: center; padding: 1.6rem 1rem; color: var(--muted); border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--sunken); }
.empty svg { width: 34px; height: 34px; color: var(--faint); display: block; margin: 0 auto .4rem; }

.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat .v { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: .85rem; }

/* three-column client home */
.home-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.home-col h2 { display: flex; align-items: center; gap: .5rem; }
.home-col h2 .pill { font-size: .75rem; }
.attention-item { display: flex; gap: .7rem; padding: .7rem .75rem; border-radius: 12px; background: var(--warn-soft); text-decoration: none; align-items: flex-start; }
.attention-item + .attention-item { margin-top: .5rem; }
.attention-item .ico { width: 30px; height: 30px; border-radius: 9px; background: var(--lantern); color: #3a2a00; display: grid; place-items: center; flex: none; }
.attention-item .ico svg { width: 17px; height: 17px; }
.attention-item strong { display: block; font-size: .92rem; line-height: 1.3; }
.attention-item small { font-size: .78rem; }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: .65rem; padding: .55rem 0; border-bottom: 1px solid var(--hairline); }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--faint); font-size: .78rem; }
.feed.plain li { display: block; }
.feed li.unread { background: color-mix(in srgb, var(--info-soft) 50%, transparent); border-radius: 8px; padding-left: .5rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--text); display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: .9rem; }

/* ---------- Badges & pills ---------- */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; font-size: .76rem; font-weight: 650; background: var(--sunken); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.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.brand { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--text); }
.pill.outline { background: transparent; border-color: var(--border); }
.pill.lock::before { content: ''; width: .55rem; height: .55rem; border-radius: 2px; border: 1.5px solid currentColor; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 650 .92rem/1.2 var(--font); cursor: pointer; text-decoration: none; min-height: 40px; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.secondary { background: var(--navy); color: #fff; border-color: transparent; }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.btn.small { padding: .3rem .65rem; min-height: 32px; font-size: .83rem; border-radius: 9px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn svg { width: 17px; height: 17px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.field { margin-bottom: .9rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: 400 .95rem/1.4 var(--font); min-height: 42px; }
textarea { min-height: 96px; resize: vertical; }
input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); vertical-align: -3px; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 2px; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; flex: 1 1 160px; }
details.disclosure { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
details.disclosure > summary { cursor: pointer; padding: .8rem 1rem; font-weight: 650; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--sunken); font-weight: 700; }
details.disclosure[open] > summary::before { content: '–'; }
details.disclosure > .body { padding: 0 1rem 1rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters select, .filters input { width: auto; min-width: 140px; min-height: 38px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .35rem .75rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; font-size: .85rem; font-weight: 600; color: var(--muted); }
.chip[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Flash ---------- */
.flash { padding: .75rem 1rem; border-radius: 12px; margin-bottom: 1rem; border: 1px solid transparent; display: flex; gap: .6rem; align-items: flex-start; word-break: break-word; }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.warning { background: var(--warn-soft); color: var(--warn); }
.flash.info { background: var(--info-soft); color: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th { font-size: .78rem; color: var(--muted); font-weight: 650; background: var(--sunken); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Progress ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--accent))); border-radius: 99px; }

/* ---------- Phase cards & timeline ---------- */
.phase-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.phase-card { border: 1px solid var(--border); border-radius: 12px; padding: .8rem .9rem; background: var(--surface); text-decoration: none; display: block; }
.phase-card .top { display: flex; justify-content: space-between; gap: .5rem; align-items: center; margin-bottom: .45rem; }
.phase-card strong { font-size: .93rem; }
.phase-card small { display: block; margin-top: .35rem; }

.gantt { --cols: 12; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.gantt-inner { min-width: 860px; }
.gantt-head, .gantt-row { display: grid; grid-template-columns: 260px minmax(0,1fr); }
.gantt-head { position: sticky; top: 0; background: var(--sunken); border-bottom: 1px solid var(--border); font-size: .74rem; color: var(--muted); z-index: 2; }
.gantt-head .months { position: relative; height: 32px; }
.gantt-head .months span { position: absolute; top: 8px; transform: translateX(4px); white-space: nowrap; }
.gantt-row { border-bottom: 1px solid var(--hairline); min-height: 38px; }
.gantt-row:last-child { border-bottom: 0; }
.gantt-row .label { padding: .45rem .75rem; font-size: .86rem; border-right: 1px solid var(--hairline); display: flex; align-items: center; gap: .4rem; min-width: 0; }
.gantt-row .label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-row.phase .label { font-weight: 700; background: color-mix(in srgb, var(--sunken) 60%, transparent); }
.gantt-row .track { position: relative; background-image: linear-gradient(90deg, var(--hairline) 1px, transparent 1px); background-size: calc(100% / var(--cols)) 100%; }
.gantt-row .seg { position: absolute; top: 9px; height: 20px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 45%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent); }
.gantt-row.phase .seg { top: 12px; height: 14px; background: linear-gradient(90deg, #22b8f0, #7c5cfa); border: 0; border-radius: 99px; }
.gantt-row .seg.done { background: color-mix(in srgb, var(--ok) 40%, var(--surface)); border-color: var(--ok); }
.gantt-row .seg.blocked { background: var(--bad-soft); border-color: var(--bad); }
.gantt-row .seg.in_progress { background: color-mix(in srgb, var(--brand) 55%, var(--surface)); border-color: var(--brand); }
.gantt-row .diamond { position: absolute; top: 11px; width: 16px; height: 16px; transform: translateX(-8px) rotate(45deg); background: var(--lantern); border: 2px solid #a87400; border-radius: 3px; }
.gantt-row .diamond.done { background: var(--ok); border-color: var(--ok); }
.gantt .today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .7; z-index: 1; }

.ms-list { list-style: none; padding: 0; margin: 0; }
.ms-list > li { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; gap: .65rem; padding: .65rem .2rem; border-bottom: 1px solid var(--hairline); align-items: start; }
.ms-list > li:last-child { border-bottom: 0; }
.ms-list .status-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); margin-top: 2px; display: grid; place-items: center; }
.ms-list .status-dot.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.ms-list .status-dot.in_progress { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 25%, transparent); }
.ms-list .status-dot.blocked { border-color: var(--bad); background: var(--bad-soft); }
.ms-list .status-dot svg { width: 13px; height: 13px; }
.ms-meta { display: flex; flex-wrap: wrap; gap: .35rem .6rem; font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.ms-list :target, .target-flash:target { animation: flash 1.6s ease-out 1; border-radius: 10px; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--lantern) 55%, transparent); } 100% { background: transparent; } }

/* calendar */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.calendar .dow { background: var(--sunken); font-size: .75rem; color: var(--muted); padding: .4rem .5rem; font-weight: 650; }
.calendar .day { min-height: 92px; border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline); padding: .3rem .4rem; font-size: .78rem; }
.calendar .day:nth-child(7n+1) { border-left: 0; }
.calendar .day.other { background: color-mix(in srgb, var(--sunken) 55%, transparent); color: var(--faint); }
.calendar .day.today .n { background: var(--brand); color: var(--on-brand); border-radius: 99px; padding: 0 .4rem; }
.calendar .ev { display: block; margin-top: .2rem; padding: .1rem .35rem; border-radius: 6px; background: var(--info-soft); color: var(--info); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar .ev.meeting { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); color: var(--text); }
.calendar .ev.done { background: var(--ok-soft); color: var(--ok); }

/* kanban for decisions */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: .8rem; overflow-x: auto; padding-bottom: .4rem; }
.kanban .col { background: var(--sunken); border-radius: var(--radius); padding: .7rem; min-height: 120px; }
.kanban .col h3 { font-size: .85rem; display: flex; justify-content: space-between; color: var(--muted); }
.kanban .kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .75rem; margin-top: .6rem; }
.kanban .kcard strong { display: block; font-size: .9rem; line-height: 1.3; }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 300px minmax(0,1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); height: calc(100vh - 170px); min-height: 480px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
.chat-list .head { padding: .8rem; border-bottom: 1px solid var(--border); }
.chat-list a.conv { display: block; padding: .7rem .85rem; border-bottom: 1px solid var(--hairline); text-decoration: none; }
.chat-list a.conv[aria-current="page"] { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); box-shadow: inset 3px 0 0 var(--brand); }
.chat-list a.conv .t { display: flex; gap: .4rem; align-items: center; font-weight: 650; font-size: .92rem; }
.chat-list a.conv .t .count { margin-left: auto; background: var(--brand); color: var(--on-brand); border-radius: 99px; font-size: .7rem; padding: 0 .45rem; }
.chat-list a.conv small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-main .head { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: flex; gap: .6rem; align-items: center; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 1rem; background: var(--bg); }
.msg { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: .6rem; margin-bottom: .9rem; }
.msg .bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: .55rem .8rem; max-width: 720px; }
.msg.mine { grid-template-columns: minmax(0,1fr) 34px; }
.msg.mine .avatar { order: 2; }
.msg.mine .bubble { justify-self: end; background: color-mix(in srgb, var(--brand) 13%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); border-radius: 14px 4px 14px 14px; }
.msg .meta { font-size: .76rem; color: var(--muted); display: flex; gap: .5rem; align-items: center; margin-bottom: .15rem; flex-wrap: wrap; }
.msg .meta strong { color: var(--text); }
.msg .body { word-wrap: break-word; }
.msg.deleted .body { font-style: italic; color: var(--faint); }
.msg .atts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.msg .atts img { max-height: 160px; border-radius: 10px; border: 1px solid var(--border); }
.msg .atts a.file { display: inline-flex; gap: .35rem; align-items: center; padding: .35rem .6rem; border: 1px solid var(--border); border-radius: 9px; font-size: .82rem; text-decoration: none; background: var(--surface); }
.msg .atts audio { max-width: 260px; }
.msg .reactions { display: flex; gap: .25rem; flex-wrap: wrap; margin-top: .35rem; }
.msg .reactions form { display: inline; }
.msg .reactions button { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 0 .45rem; font-size: .8rem; cursor: pointer; min-height: 26px; }
.msg .reactions button.mine { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 15%, var(--surface)); }
.msg .tools { display: none; gap: .2rem; }
.msg:hover .tools, .msg:focus-within .tools { display: inline-flex; }
.mention { background: color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 5px; padding: 0 .15rem; font-weight: 600; }
.composer { border-top: 1px solid var(--border); padding: .7rem; display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; gap: .5rem; align-items: end; background: var(--surface); }
.composer textarea { min-height: 44px; max-height: 180px; }
.composer .attach input { display: none; }
.composer .files-preview { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
.day-sep { text-align: center; font-size: .75rem; color: var(--faint); margin: .6rem 0 1rem; }
.poll-status { font-size: .72rem; color: var(--faint); }

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; }
.tile { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); text-decoration: none; display: flex; flex-direction: column; }
.tile .thumb { aspect-ratio: 4 / 3; background: var(--sunken); display: grid; place-items: center; overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb svg { width: 36px; height: 36px; color: var(--faint); }
.tile .cap { padding: .5rem .6rem; font-size: .8rem; }
.tile .cap strong { display: block; font-size: .83rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.date-group { margin: 1.25rem 0 .6rem; font-size: .9rem; font-weight: 700; color: var(--muted); }

/* ---------- Design viewer ---------- */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
.stage { background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; }
.stage .canvas { position: relative; display: inline-block; max-width: 100%; cursor: crosshair; line-height: 0; }
.stage .canvas img { display: block; border-radius: 8px; max-width: 100%; }
.stage iframe.pdf { width: 100%; height: 78vh; border: 0; border-radius: 8px; background: #fff; }
.pin { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font: 700 .72rem/1 var(--font); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); text-decoration: none; line-height: 1; }
.pin span { transform: rotate(45deg); }
.pin.draft { background: var(--accent); }
.pin.resolved { background: var(--ok); }
.version-strip { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .3rem; }
.version-strip a { flex: none; text-decoration: none; padding: .45rem .7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: .83rem; }
.version-strip a[aria-current="page"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.compare .side { min-width: 0; }
.compare .side img { width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.compare iframe { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.overlay-compare { position: relative; display: none; }
.overlay-compare.on { display: block; }
.overlay-compare img { width: 100%; display: block; border-radius: 8px; }
.overlay-compare .top { position: absolute; inset: 0; overflow: hidden; }
.decision-box { border: 2px solid var(--brand); border-radius: var(--radius); padding: 1rem; background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.evidence { font-family: var(--mono); font-size: .72rem; color: var(--muted); word-break: break-all; }

/* ---------- Auth layout ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); }
.auth .visual { position: relative; background: var(--navy); color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth .visual::after { content: ''; position: absolute; inset: auto -20% -30% auto; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 55%, transparent), transparent 65%); opacity: .55; }
.auth .visual .lead { position: relative; z-index: 1; max-width: 520px; }
.auth .visual h1 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.6rem); }
.auth .visual p { color: var(--nav-text); font-size: 1.02rem; }
.auth .visual ul { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .6rem; color: var(--nav-text); }
.auth .visual li { display: flex; gap: .6rem; align-items: flex-start; }
.auth .visual li svg { width: 20px; height: 20px; color: var(--brand); flex: none; margin-top: 2px; }
.auth .panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--bg); }
.auth .panel .inner { width: 100%; max-width: 440px; }
.auth.wide { grid-template-columns: 1fr; }
.auth.wide .panel .inner { max-width: 880px; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--hairline); font-size: .9rem; }
.check-list .ok { color: var(--ok); }
.check-list .bad { color: var(--bad); }
.check-list .warn { color: var(--warn); }
.steps { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.steps span { font-size: .8rem; padding: .25rem .65rem; border-radius: 99px; background: var(--sunken); color: var(--muted); font-weight: 600; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: .35rem 1rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li { padding: .55rem 0; border-bottom: 1px solid var(--hairline); }
.list-plain > li:last-child { border-bottom: 0; }
.notice-lantern { border-left: 4px solid var(--lantern); background: var(--warn-soft); padding: .75rem 1rem; border-radius: 0 12px 12px 0; }
.secret { font-family: var(--mono); background: var(--sunken); padding: .6rem .75rem; border-radius: 10px; word-break: break-all; user-select: all; }
dialog.confirm { border: 0; border-radius: var(--radius); padding: 1.25rem; max-width: 420px; width: calc(100% - 2rem); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.confirm::backdrop { background: rgba(7,31,52,.55); }
.skeleton { background: linear-gradient(90deg, var(--sunken), var(--hairline), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; min-height: 1rem; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.offline-banner { display: none; position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .55rem 1rem; border-radius: 99px; z-index: 60; font-size: .85rem; box-shadow: var(--shadow); }
body.offline .offline-banner { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) and (min-width: 1024px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); background: linear-gradient(90deg, var(--navy) 76px, transparent 0); }
  .sidebar { padding: 1rem .5rem; }
  .brandmark span, .context, .nav-single span, .nav-group > summary span, .nav-group > summary .chev, .powered, .theme-pill span { display: none; }
  .nav-single, .nav-group > summary, .theme-pill { justify-content: center; padding: .65rem; }
  .brandmark { justify-content: center; }
  .nav-group[open] > .nav-sub { position: absolute; left: 70px; margin: 0; background: var(--navy); padding: .4rem; border-radius: 12px; box-shadow: var(--shadow); min-width: 210px; border: 1px solid rgba(255,255,255,.1); z-index: 40; }
  .nav-group { position: relative; }
  .nav .count { position: absolute; top: 2px; right: 6px; font-size: .62rem; }
  .nav-single { position: relative; }
  .panel.s3, .panel.s4, .panel.s5 { grid-column: span 6; } .panel.s7, .panel.s8, .panel.s9 { grid-column: span 12; } .panel.s6 { grid-column: span 6; }
}
@media (max-width: 1023px) {
  .panel.s3, .panel.s4, .panel.s5, .panel.s6, .panel.s7, .panel.s8, .panel.s9 { grid-column: span 12; }
  .profile-chip .who, .profile-chip > summary .chev { display: none; }
  .profile-chip > summary { padding: .2rem; }
}
@media (max-width: 1100px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .home-cols { grid-template-columns: 1fr 1fr; }
  .viewer { grid-template-columns: 1fr; }
  .grid.main-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .topbar { background: var(--navy); color: #fff; border-bottom-color: transparent; }
  .topbar .ctx small { color: var(--nav-muted); }
  .topbar .icon-btn { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #fff; }
  .kpi { border-bottom: 1px solid var(--hairline); }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(7,31,52,.5); z-index: 25; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: .6rem 1rem; }
  .topbar form.search { display: none; }
  .content { padding: 1rem 1rem 5.5rem; }
  .grid.two, .grid.three, .home-cols, .form-grid { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - 210px); }
  .chat.has-conv .chat-list { display: none; }
  .chat:not(.has-conv) .chat-main { display: none; }
  .compare { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth .visual { min-height: auto; padding: 1.5rem; }
  .auth .visual ul { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem .2rem .45rem; font-size: .7rem; font-weight: 600; text-decoration: none; color: var(--muted); position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
  .tabbar .count { position: absolute; top: 4px; left: 55%; background: var(--bad); color: #fff; border-radius: 99px; font-size: .62rem; padding: 0 .35rem; }
  .project-header { grid-template-columns: 1fr auto; padding: .9rem 1rem; }
  .project-header .ring { width: 60px; height: 60px; font-size: .85rem; }
  .kanban { grid-template-columns: repeat(4, 78vw); }
}
@media print {
  .sidebar, .topbar, .tabbar, .no-print { display: none !important; }
  .shell { display: block; }
  .card { break-inside: avoid; }
}
