/* Silos project workspace - application styles */

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; color: var(--color-text); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-family: var(--font-serif); font-size: 28px; font-weight: 500; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-link); }
a:hover { color: var(--color-primary-hover); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.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; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--color-text-muted); }
.subtle { color: var(--color-text-subtle); }
.nowrap { white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--color-surface); color: var(--color-text); padding: 8px 12px; border-radius: var(--radius-md); }
.skip-link:focus { left: 8px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, #FAFBFD 0, #FAFBFD calc(var(--sidebar-w) - 1px), #E1E4EC calc(var(--sidebar-w) - 1px), #E1E4EC var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--color-surface-raised);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column; padding: var(--space-5) var(--space-4);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 2px 6px 18px; color: var(--color-text); min-width: 0; }
/* Silos Aerial mark + wordmark. Navy parts use --brand-navy; the accent roof and the roof-"o"
   use --accent only, so a tenant's colour re-tints both with one custom property. */
.silos-mark, .silos-wm { display: block; flex: none; }
.silos-mark .sm-base, .silos-wm .sm-base { fill: var(--brand-navy); }
.silos-mark .sm-acc, .silos-wm .sm-acc { fill: var(--accent); }
.brand-words { display: inline-flex; flex-direction: column; gap: 5px; min-width: 0; }
/* Endorsement is small text: muted #565D72 measures >= 6.3:1 on the raised sidebar and on white. */
.brand-endorse { font-size: 11.5px; font-weight: 500; letter-spacing: 0.01em; color: var(--color-text-muted); white-space: nowrap; line-height: 1.1; }
.brand-lg .brand-endorse { font-size: 13px; }
/* Client-led lockup: the tenant's logo or name leads; "workspace · powered by Silos" follows. */
.brand-client { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand-client .client-name { font-family: var(--font-serif); font-weight: 600; font-size: 20px; line-height: 1.15; letter-spacing: -0.01em; color: var(--color-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.brand-client .client-logo { display: block; max-height: 36px; max-width: 200px; width: auto; height: auto; }
.brand-client .powered { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--color-text-muted); white-space: nowrap; }
.brand-client .powered .silos-mark { margin-left: 1px; }
.brand-client .powered .silos-wm { margin-top: -1px; }
.brand-client.brand-lg .client-name { font-size: 30px; }
.brand-client.brand-lg .client-logo { max-height: 52px; max-width: 280px; }
.brand-client.brand-lg .powered { font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: var(--space-2); }
.nav-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-subtle); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-md);
  color: var(--color-text-muted); text-decoration: none; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.nav a[aria-current="page"] { background: var(--accent-tint); color: var(--accent-tint-ink); }
.nav a[aria-current="page"] svg { color: var(--color-primary); }
.nav .nav-project { font-size: 13px; padding: 7px 10px 7px 38px; }
.sidebar-foot { margin-top: auto; padding-top: var(--space-4); border-top: 1px solid var(--color-border); display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who span { display: block; font-size: 12px; color: var(--color-text-muted); }

.topbar { display: none; }
.main { min-width: 0; padding: var(--space-8) var(--space-8) var(--space-12); max-width: 1440px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.page-head .sub { color: var(--color-text-muted); margin: 6px 0 0; font-size: 14px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-text-subtle); margin-bottom: 6px; }
.drawer-backdrop { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--color-primary-fill); border-color: var(--color-primary-fill); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--color-on-primary); }
.btn-danger { background: var(--color-surface); border-color: #D9B3A8; color: var(--color-danger-ink); }
.btn-danger:hover { background: var(--color-danger-bg); color: var(--color-danger-ink); }
.btn-danger-fill { background: var(--color-danger); border-color: var(--color-danger); color: #FAFBFD; }
.btn-danger-fill:hover { background: #7A3223; color: #FAFBFD; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface-sunken); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-md); border: 1px solid transparent; background: transparent; color: var(--color-text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.icon-btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* ---------- Cards / panels ---------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--elevation-1); }
.card-pad { padding: var(--space-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.card-head h2 { font-size: 15px; }
.card-head .hint { font-size: 12px; color: var(--color-text-muted); }
.card-body { padding: var(--space-5); }
.grid { display: grid; gap: var(--space-5); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 304px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--space-5); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.kpi { padding: var(--space-5); position: relative; overflow: hidden; }
.kpi .kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-muted); font-weight: 500; }
.kpi .kpi-icon { width: 30px; height: 30px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; }
.kpi .kpi-icon svg { width: 16px; height: 16px; }
.kpi .kpi-value { font-family: var(--font-serif); font-size: 36px; font-weight: 500; line-height: 1.1; margin-top: 12px; color: var(--color-text); }
.kpi .kpi-value small { font-size: 18px; color: var(--color-text-muted); }
.kpi .kpi-sub { font-size: 12.5px; color: var(--color-text-muted); margin-top: 4px; }
.kpi .kpi-sub b { font-weight: 600; }
.tone-primary { background: var(--accent-tint); color: var(--accent-tint-ink); }
.tone-success { background: var(--color-success-bg); color: var(--color-success-ink); }
.tone-warning { background: var(--color-warning-bg); color: var(--color-warning-ink); }
.tone-danger  { background: var(--color-danger-bg); color: var(--color-danger-ink); }
.tone-info    { background: var(--color-info-bg); color: var(--color-info-ink); }
.tone-neutral { background: var(--color-neutral-bg); color: var(--color-neutral-ink); }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 20px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.no-dot::before { display: none; }
.badge { display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; line-height: 18px; }
.code-chip { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-muted); background: var(--color-surface-sunken); padding: 1px 6px; border-radius: var(--radius-sm); white-space: nowrap; }

/* ---------- Progress ---------- */
.progress { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.progress .bar { flex: 1; height: 6px; background: var(--color-surface-sunken); border-radius: var(--radius-full); overflow: hidden; }
.progress .bar > span { display: block; height: 100%; background: var(--color-primary); border-radius: var(--radius-full); }
.progress .bar > span.done { background: var(--color-success); }
.progress .pct { font-size: 13px; font-weight: 600; min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Avatars ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; border: 2px solid var(--color-surface); }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -8px; }
.av-0 { background: #F3E3DB; color: #7A3223; }
.av-1 { background: var(--color-info-bg); color: var(--color-info-ink); }
.av-2 { background: var(--color-success-bg); color: var(--color-success-ink); }
.av-3 { background: #DDE3EA; color: #41526A; }
.av-4 { background: var(--color-warning-bg); color: var(--color-warning-ink); }
.av-5 { background: var(--color-neutral-bg); color: var(--color-neutral-ink); }

/* ---------- Toolbar: chips + search ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); border-radius: var(--radius-full); padding: 5px 12px; font-size: 13px; font-weight: 500; cursor: pointer; }
.chip:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.chip[aria-pressed="true"] { background: var(--swat-ink); border-color: var(--swat-ink); color: #FAFBFD; }
.chip .count { font-variant-numeric: tabular-nums; opacity: 0.85; margin-left: 4px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--color-text-subtle); pointer-events: none; }
.search input[type="search"] { padding-left: 34px; width: 240px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.feed-side table.data th, .feed-side table.data td { padding-left: 10px; padding-right: 10px; }
.feed-side table.data .progress { min-width: 104px; }
.feed-side table.data td.cell-primary { min-width: 170px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-weight: 600; font-size: 12px; color: var(--color-text-muted); padding: 10px 14px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-raised); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: #F8F9FC; }
table.data td.cell-primary { min-width: 190px; }
table.data.compact td.cell-primary { min-width: 160px; }
table.data.compact td.owner { min-width: 120px; }
table.data.compact td.owner > span > span:last-child { overflow-wrap: anywhere; }
table.data.compact .cell-sub .code-chip { font-size: 11px; margin-right: 2px; }
table.data .proj-name { font-weight: 600; color: var(--color-text); text-decoration: none; }
table.data .proj-name:hover { color: var(--color-link); text-decoration: underline; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-sub { display: block; font-size: 12px; color: var(--color-text-muted); }
.overdue { color: var(--color-danger-ink); font-weight: 600; }

/* ---------- Activity feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.feed li:last-child { border-bottom: 0; }
.feed .txt { font-size: 13px; min-width: 0; color: var(--color-text); }
.feed .txt b { font-weight: 600; }
.feed .txt .obj { color: var(--color-text); font-weight: 500; }
.feed .txt .act { font-weight: 600; color: var(--color-text); }
.feed .txt .act + .obj { font-weight: 400; overflow-wrap: anywhere; }
.feed .meta .who { color: var(--color-text); font-weight: 500; }
.feed .meta { display: block; font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); min-width: 0; }
.field label, .field .label { font-size: 13px; font-weight: 600; color: var(--color-text); }
.field .help { font-size: 12px; color: var(--color-text-muted); }
.field .err { font-size: 12px; color: var(--color-danger-ink); font-weight: 600; }
.input, input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--color-focus); outline-offset: 0; border-color: var(--color-focus); }
input[aria-invalid="true"] { border-color: var(--color-danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--color-primary-fill); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-6); overflow-x: auto; scrollbar-width: thin; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--color-text-muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--color-text); }
.tabs a[aria-current="page"] { color: var(--color-text); border-bottom-color: var(--color-primary); }
.seg { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); overflow: hidden; }
.seg button { border: 0; background: var(--color-surface); padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--color-text-muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--color-border-strong); }
.seg button[aria-pressed="true"] { background: var(--swat-ink); color: #FAFBFD; }

/* ---------- Project header ---------- */
.proj-head { padding: var(--space-6); margin-bottom: var(--space-5); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-6); align-items: center; }
.proj-head .crumbs { font-size: 13px; color: var(--color-text-muted); margin-bottom: 8px; }
.proj-head .crumbs a { color: var(--color-text-muted); text-decoration: none; }
.proj-head .crumbs a:hover { color: var(--color-link); text-decoration: underline; }
.proj-head h1 { font-size: 30px; }
.proj-head .meta { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--color-text-muted); }
.proj-head .meta strong { color: var(--color-text); font-weight: 600; }
.proj-head .right { display: flex; align-items: center; gap: var(--space-6); }
.bigpct { text-align: right; }
.bigpct .v { font-family: var(--font-serif); font-size: 44px; line-height: 1; font-weight: 500; color: var(--color-text); }
.bigpct .v small { font-size: 22px; color: var(--color-text-muted); }
.bigpct .l { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.bigpct .bar { width: 160px; height: 6px; background: var(--color-surface-sunken); border-radius: 99px; margin-top: 8px; overflow: hidden; margin-left: auto; }
.bigpct .bar span { display: block; height: 100%; background: var(--color-primary); }

/* ---------- Timeline (Gantt) ---------- */
.timeline { --name-w: 210px; position: relative; }
.tl-scale { display: grid; grid-template-columns: var(--name-w) minmax(0, 1fr); font-size: 12px; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); }
.tl-scale .track { position: relative; height: 58px; }
.tl-month { position: absolute; top: 20px; font-weight: 600; color: var(--color-text); padding-left: 6px; border-left: 1px solid var(--color-border-strong); height: 18px; white-space: nowrap; }
.tl-week { position: absolute; top: 39px; padding-left: 4px; color: var(--color-text-muted); font-family: var(--font-mono); font-size: 10.5px; white-space: nowrap; }
.tl-rows { position: relative; }
.tl-row { display: grid; grid-template-columns: var(--name-w) minmax(0, 1fr); align-items: center; min-height: 48px; border-bottom: 1px dashed var(--color-border); }
.tl-row:last-child { border-bottom: 0; }
.tl-name { padding-right: 12px; font-size: 13px; font-weight: 600; min-width: 0; }
.tl-name span { display: block; font-weight: 400; font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 48px; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--color-border); }
.tl-bar { position: absolute; z-index: 3; top: 11px; height: 26px; border-radius: 6px; overflow: hidden; background: #F6E9E2; border: 1px solid #E3BFAF; border-left: 3px solid #C0573C; display: flex; align-items: center; min-width: 6px; }
.tl-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: #D49274; }
.tl-bar .lbl { position: relative; font-size: 12px; font-weight: 700; padding: 0 8px; white-space: nowrap; color: #1B2140; }
.tl-bar.st-done { background: #E8ECD6; border-color: #C9CFA8; border-left-color: #5E6B3A; }
.tl-bar.st-done .fill { background: #B6BC8E; }
.tl-bar.st-delayed { background: #F4DDD5; border-color: #E2B4A6; border-left-color: #8F3B2B; }
.tl-bar.st-delayed .fill { background: #D98F7A; }
.tl-bar.st-not_started { background: #ECEEF4; border-color: #C8CEDC; border-left-color: #A7ADBD; }
.tl-bar-outside { position: absolute; top: 15px; font-size: 12px; font-weight: 700; color: var(--color-text); white-space: nowrap; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--color-primary); z-index: 1; pointer-events: none; }
.tl-today-flag { position: absolute; top: 0; transform: translateX(-50%); background: var(--color-primary-fill); color: #FAFBFD; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; white-space: nowrap; font-family: var(--font-mono); letter-spacing: 0.04em; }
.tl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--color-text-muted); margin-top: 12px; }
.tl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Key-value list ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, 40%) minmax(0, 1fr); gap: 0; margin: 0; }
.kv dt, .kv dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.kv dt { color: var(--color-text-muted); padding-right: 12px; }
.kv dd { font-weight: 500; color: var(--color-text); overflow-wrap: anywhere; }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }

.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.people .nm { font-weight: 600; font-size: 13px; }
.people .rl { font-size: 12px; color: var(--color-text-muted); }
.people .grow { flex: 1; min-width: 0; }

/* ---------- Markdown content ---------- */
.prose { font-size: 14px; line-height: 1.6; color: var(--color-text); overflow-wrap: anywhere; }
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { font-family: var(--font-sans); margin: 1em 0 0.4em; }
.prose h1 { font-size: 20px; } .prose h2 { font-size: 17px; } .prose h3 { font-size: 15px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 0.8em; }
.prose p { margin: 0 0 0.8em; }
.prose code { font-family: var(--font-mono); font-size: 12.5px; background: var(--color-surface-sunken); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--color-surface-sunken); padding: 12px; border-radius: var(--radius-md); overflow-x: auto; }
.prose blockquote { margin: 0 0 0.8em; padding: 4px 14px; border-left: 3px solid var(--color-primary); color: var(--color-text-muted); }
.prose table { border-collapse: collapse; margin-bottom: 0.8em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--color-border); padding: 6px 10px; }
.md-editor .md-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.md-editor .md-tabs button { border: 0; background: transparent; padding: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); border-radius: var(--radius-sm); cursor: pointer; }
.md-editor .md-tabs button[aria-pressed="true"] { background: var(--color-surface-sunken); color: var(--color-text); }
.md-editor .md-preview { min-height: 120px; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 12px; background: var(--color-surface-raised); }

/* ---------- Updates ---------- */
.update { padding: var(--space-5); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
.update + .update { border-top: 1px solid var(--color-border); }
.update .u-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.update .u-head .when { color: var(--color-text-muted); font-size: 12px; }
.update .u-actions { margin-left: auto; display: flex; gap: 2px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.attach { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background: var(--color-surface-raised); color: var(--color-text); text-decoration: none; }
.attach svg { width: 14px; height: 14px; }

/* ---------- Tasks ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.col { background: var(--color-surface-sunken); border-radius: var(--radius-lg); padding: 10px; min-height: 120px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 700; font-size: 13px; }
.col-head .n { font-weight: 600; color: var(--color-text-muted); font-size: 12px; }
.tcard { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px; margin-bottom: 8px; box-shadow: var(--elevation-1); cursor: pointer; }
.tcard:hover { border-color: var(--color-border-strong); }
.tcard .tt { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; color: var(--color-text); }
.tcard .tm { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--color-text-muted); }
.task-title { font-weight: 600; }
.status-select { min-height: 30px; padding: 3px 8px; font-size: 13px; width: auto; }

/* ---------- Stat cards / reports ---------- */
.stat { padding: var(--space-5); }
.stat .l { font-size: 13px; color: var(--color-text-muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .v { font-family: var(--font-serif); font-size: 32px; font-weight: 500; margin-top: 8px; line-height: 1.1; }
.stat .s { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.ring-wrap { position: relative; width: 190px; height: 190px; margin: 0 auto; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.ring-center .v { font-family: var(--font-serif); font-size: 34px; font-weight: 500; line-height: 1; }
.ring-center .l { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 190px; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--color-text-muted); justify-content: center; margin-top: 10px; }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.prio-stack { display: flex; height: 28px; border-radius: 6px; overflow: hidden; background: var(--color-surface-sunken); }
.prio-stack span { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; min-width: 0; }
.prio-rows { margin-top: 14px; display: grid; gap: 8px; }
.prio-rows div { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.prio-rows i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.heatmap { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 4px; }
.heatmap span { width: 14px; height: 14px; border-radius: 3px; background: var(--color-surface-sunken); }
.heatmap .h1 { background: #EAD4B6; } .heatmap .h2 { background: #D49274; } .heatmap .h3 { background: #C0573C; } .heatmap .h4 { background: #8F3B2B; }
.heat-wrap { display: flex; gap: 8px; }
.heat-days { display: grid; grid-template-rows: repeat(7, 14px); gap: 4px; font-size: 10.5px; color: var(--color-text-muted); font-family: var(--font-mono); }
.heat-scale { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--color-text-muted); margin-top: 10px; }
.heat-scale span { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.rcard { padding: var(--space-5); display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.rcard:hover { border-color: var(--color-border-strong); box-shadow: var(--elevation-2); }
.rcard h3 { font-size: 15px; }
.rcard .per { font-size: 12px; color: var(--color-text-muted); }
.rcard .sum { font-size: 13px; color: var(--color-text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rcard .foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--color-text-muted); margin-top: auto; }

/* ---------- Chart builder ---------- */
.dgrid { width: 100%; border-collapse: collapse; font-size: 13px; }
.dgrid th, .dgrid td { border: 1px solid var(--color-border); padding: 0; }
.dgrid th { background: var(--color-surface-raised); }
.dgrid input { border: 0; border-radius: 0; min-height: 34px; padding: 6px 8px; background: transparent; }
.dgrid input:focus { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.dgrid .rowx { width: 34px; text-align: center; }
.dgrid-wrap { overflow-x: auto; max-width: 100%; border-radius: var(--radius-md); }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); }
.chart-tile .chart-box { height: 230px; }
.chart-tile .card-head h3 { font-size: 14px; }

/* ---------- Files ---------- */
.dropzone { border: 2px dashed var(--color-border-strong); border-radius: var(--radius-lg); padding: var(--space-8) var(--space-4); text-align: center; background: var(--color-surface-raised); color: var(--color-text-muted); cursor: pointer; }
.dropzone.drag { border-color: var(--color-primary); background: var(--accent-tint); }
.dropzone strong { color: var(--color-text); }
.dropzone svg { width: 28px; height: 28px; color: var(--color-primary); }

/* ---------- Empty / skeleton ---------- */
.empty { text-align: center; padding: var(--space-12) var(--space-6); color: var(--color-text-muted); }
.empty .empty-mark { width: 44px; height: 44px; margin: 0 auto 12px; }
.empty .empty-mark .sm-base { fill: #DCE2F0; }
.empty h3 { font-size: 16px; color: var(--color-text); margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 16px; }
.skel { background: linear-gradient(90deg, #ECEEF4 0%, #F4F6FA 50%, #ECEEF4 100%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; border-radius: var(--radius-md); }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ---------- Modal / toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14,18,36,0.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: var(--elevation-3); }
.modal.wide { max-width: 920px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--color-border); }
.modal-head h2 { font-size: 18px; font-family: var(--font-serif); font-weight: 600; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--color-border); background: var(--color-surface-raised); border-radius: 0 0 var(--radius-xl) var(--radius-xl); flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--swat-black); color: #FAFBFD; padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--elevation-3); font-size: 13.5px; display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 420px; border-left: 4px solid var(--swat-sage); }
.toast.error { border-left-color: var(--swat-adobe); }
.callout { padding: 12px 14px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: var(--space-4); }
.callout.danger { background: var(--color-danger-bg); color: var(--color-danger-ink); }
.callout.warning { background: var(--color-warning-bg); color: var(--color-warning-ink); }
.callout.info { background: var(--color-info-bg); color: var(--color-info-ink); }
.secret { display: flex; gap: 8px; align-items: center; }
.secret code { flex: 1; font-family: var(--font-mono); font-size: 16px; background: var(--color-surface-sunken); padding: 10px 12px; border-radius: var(--radius-md); letter-spacing: 0.04em; overflow-wrap: anywhere; }

/* ---------- Auth screens ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art {
  background-color: var(--color-bg);
  background-image: linear-gradient(#E6E9F0 1px, transparent 1px), linear-gradient(90deg, #E6E9F0 1px, transparent 1px);
  background-size: 24px 24px; position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--color-border); overflow: hidden;
}
.auth-art .brand { padding: 0; }
.auth-art .pitch { max-width: 460px; position: relative; z-index: 1; }
.auth-art .pitch .eyebrow { color: var(--color-primary-fill); }
.auth-art .pitch h1 { font-size: 42px; line-height: 1.12; letter-spacing: -0.02em; }
.auth-art .pitch p { font-size: 16px; color: var(--color-text-muted); margin-top: 14px; }
.auth-art .roof { position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--vent) 0 22%, transparent 23%), var(--roof); }
.auth-art .roof-haze  { --roof: #DCE2F0; --vent: #F6F7FA; }
.auth-art .roof-haze2 { --roof: #C8CEDC; --vent: #F6F7FA; }
.auth-art .roof-acc   { --roof: var(--accent); --vent: #F6F7FA; }
.auth-art .foot { font-size: 12px; color: var(--color-text-muted); position: relative; z-index: 1; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--color-surface); }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { font-family: var(--font-serif); font-size: 28px; font-weight: 500; margin-bottom: 6px; }
.auth-form .sub { color: var(--color-text-muted); margin-bottom: 24px; }
.auth-form .btn { width: 100%; min-height: 44px; }
.auth-mobile-brand { display: none; }

/* ---------- Misc ---------- */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 var(--space-3); flex-wrap: wrap; }
.divider { height: 1px; background: var(--color-border); margin: var(--space-5) 0; border: 0; }
.list-reset { list-style: none; margin: 0; padding: 0; }
.instr { padding: var(--space-5); }
.instr + .instr { border-top: 1px solid var(--color-border); }
.instr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.instr-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-tint-ink); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.instr-head h3 { flex: 1; min-width: 0; }
.instr-meta { font-size: 12px; color: var(--color-text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1399px) {
  .grid-main-side.feed-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr) 300px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  /* tables become stacked cards */
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr, table.stack-sm td { display: block; width: 100%; }
  table.stack-sm thead { display: none; }
  table.stack-sm tr { padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
  table.stack-sm tr:last-child { border-bottom: 0; }
  table.stack-sm td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  table.stack-sm td::before { content: attr(data-label); font-size: 12px; color: var(--color-text-muted); font-weight: 600; text-align: left; flex: none; }
  table.stack-sm td.cell-primary { display: block; text-align: left; padding-bottom: 6px; }
  table.stack-sm td.cell-primary::before { display: none; }
  table.stack-sm td .progress { min-width: 0; width: 60%; }
  table.stack-sm td.num { text-align: right; }
}
@media (max-width: 1024px) {
  .grid-main-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder { grid-template-columns: minmax(0, 1fr); }
  .proj-head { grid-template-columns: minmax(0, 1fr); }
  .proj-head .right { justify-content: space-between; }
  .bigpct { text-align: left; }
  .bigpct .bar { margin-left: 0; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--elevation-3); }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(14,18,36,0.4); z-index: 35; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--color-surface-raised); border-bottom: 1px solid var(--color-border); padding: 8px 12px; }
  .topbar .brand { padding: 0; }
  .topbar .brand-silos > .silos-mark { width: 32px; height: 32px; }
  .topbar .brand-client .client-name { font-size: 17px; -webkit-line-clamp: 1; }
  .topbar .brand-client { gap: 3px; min-width: 0; }
  .main { padding: var(--space-5) var(--space-4) var(--space-12); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-mobile-brand { display: flex; margin-bottom: 28px; }
}
@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .kpis { gap: var(--space-3); }
  .kpi { padding: var(--space-4); }
  .kpi .kpi-value { font-size: 28px; }
  .search input[type="search"] { width: 100%; }
  .search { flex: 1 1 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: minmax(0, 1fr); }
  .proj-head { padding: var(--space-5); }
  .proj-head h1 { font-size: 24px; }
  .proj-head .right { flex-wrap: wrap; gap: var(--space-4); }
  .bigpct .v { font-size: 34px; }
  .timeline { --name-w: 0px; }
  .tl-row { grid-template-columns: minmax(0, 1fr); padding-top: 8px; }
  .tl-scale { grid-template-columns: minmax(0, 1fr); }
  .tl-scale > div:first-child { display: none; }
  .tl-name { padding: 0; }
  .tl-name span { display: inline; margin-left: 6px; }
  .tl-wk { display: none; }
  .update { padding: var(--space-4); }
  .modal-backdrop { padding: 12px 8px; }
  .modal-body { padding: 16px; }
  .heatmap { grid-auto-columns: 12px; grid-template-rows: repeat(7, 12px); gap: 3px; }
  .heatmap span { width: 12px; height: 12px; }
  .heat-days { grid-template-rows: repeat(7, 12px); gap: 3px; }
}
@media print {
  .sidebar, .topbar, .tabs, .btn, .toasts { display: none !important; }
  .shell { display: block; }
}

/* Phone: card-head toolbars (filter chips + search) take their own full-width row. */
@media (max-width: 560px) {
  .card-head .toolbar { flex: 1 1 100% !important; justify-content: flex-start !important; }
  .card-head .toolbar .search { flex: 1 1 100%; }
  .card-head .toolbar .search input { width: 100%; }
  .tl-bar .lbl { padding: 0 5px; }
}
/* Buttons with an icon keep text and icon on one optical centre line. */
.btn { vertical-align: middle; }
td .btn-row, td.num { vertical-align: middle; }
.icon-btn { vertical-align: middle; }
.tl-bar-outside { z-index: 4; background: var(--color-surface); padding: 0 4px; border-radius: 3px; }

/* ---------- Live updates (v1.2): header indicator, notice stack, dialog conflict note ---------- */
.sidebar-head .brand { padding-bottom: 10px; }
.sidebar-live { display: block; padding: 0 6px 14px; }
.sidebar-live .live-tip { left: 0; right: auto; }
.topbar-live { margin-left: auto; }
.live-ind { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: var(--radius-full); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); font-size: 12px; font-weight: 600; line-height: 1.4; cursor: default; white-space: nowrap; }
.live-ind:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #7D8497; flex: none; }
.live-ind[data-live-state="ok"] .live-dot { background: var(--color-success); }
.live-ind[data-live-state="ok"] .live-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--color-success); opacity: 0; animation: live-ping 2.4s ease-out infinite; }
.live-ind[data-live-state="offline"] { color: var(--color-text-subtle); }
.live-ind[data-live-state="offline"] .live-dot { background: transparent; box-shadow: inset 0 0 0 2px #7D8497; }
@keyframes live-ping { 0% { transform: scale(.6); opacity: .7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
.live-tip { position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; width: max-content; max-width: 220px; white-space: normal; padding: 7px 10px; border-radius: var(--radius-md); background: var(--swat-black); color: #FAFBFD; font-weight: 400; font-size: 12px; box-shadow: var(--elevation-2); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s ease; }
.live-ind:hover .live-tip, .live-ind:focus-visible .live-tip { opacity: 1; visibility: visible; }
.live-tip:empty { display: none; }

.toast.live { align-items: flex-start; border-left-color: var(--swat-terracotta); padding: 12px 10px 12px 14px; max-width: 380px; width: 380px; transform: translateY(8px); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.toast.live.in { transform: none; opacity: 1; }
.toast.live.out { transform: translateX(16px); opacity: 0; }
.toast.live.still { transition: none; }
.toast.live .avatar { flex: none; margin-top: 1px; }
.toast .lt-mark { width: 24px; height: 24px; flex: none; margin-top: 1px;
  /* the Aerial mark in miniature: three pale roofs and one accent roof */
  background: radial-gradient(circle at 26% 26%, #DCE2F0 0 21%, transparent 23%), radial-gradient(circle at 74% 26%, var(--accent) 0 21%, transparent 23%),
    radial-gradient(circle at 26% 74%, #DCE2F0 0 21%, transparent 23%), radial-gradient(circle at 74% 74%, #DCE2F0 0 21%, transparent 23%); }
.toast .lt-body { flex: 1; min-width: 0; }
.toast .lt-msg { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
.toast .lt-msg strong { font-weight: 600; color: #FFFFFF; }
.toast .lt-meta { margin: 3px 0 0; font-size: 12px; color: #C8CEDC; }
.toast .lt-meta a { color: #EAD4B6; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.toast .lt-meta a:hover { color: #FFFFFF; }
.toast .lt-meta a:focus-visible, .toast .lt-close:focus-visible { outline: 2px solid #EAD4B6; outline-offset: 2px; border-radius: 3px; }
.toast .lt-close { flex: none; width: 28px; height: 28px; margin: -4px -2px 0 0; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: #C8CEDC; cursor: pointer; }
.toast .lt-close:hover { background: rgba(250,251,253,0.12); color: #FFFFFF; }
.toast .lt-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.live-conflict { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.live-conflict .btn { flex: none; }

/* Phones: notices dock at the bottom edge (clear of the top bar and the page title) and are
   compact; at most the two newest are shown, older ones stay in the DOM until they time out. */
@media (max-width: 720px) {
  .toasts { top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: 8px; right: 8px; max-width: none; align-items: stretch; gap: 6px; }
  .toast, .toast.live { width: auto; max-width: none; min-width: 0; }
  .toast.live { padding: 8px 6px 8px 12px; gap: 8px; font-size: 13px; transform: translateY(8px); }
  .toast.live.out { transform: translateY(8px); }
  .toast.live .lt-msg { line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .toast.live:focus-within .lt-msg, .toast.live:hover .lt-msg { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
  .toast .lt-meta { margin-top: 2px; }
  .toast .lt-close { width: 32px; height: 32px; margin: -4px 0 0 0; }
  .toasts > .toast.live:nth-last-child(n+3) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .live-ind[data-live-state="ok"] .live-dot::after { animation: none; }
  .toast.live, .toast.live.in, .toast.live.out { transition: none; transform: none; }
}

/* ---------- v1.4: tag chips, chip pickers, stages, markets, pipeline, organisation ---------- */
.tagchip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; margin: 2px 4px 2px 0; border-radius: var(--radius-full); border: 1px solid var(--color-border); background: var(--color-surface); font-size: 12px; font-weight: 600; color: var(--color-text); line-height: 20px; white-space: nowrap; }
.tagchip i, .chip-opt i, .stage-name i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tagchip.archived { color: var(--color-text-muted); border-style: dashed; }
.chip-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-opt { position: relative; cursor: pointer; }
.chip-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-opt span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--radius-full); border: 1px solid var(--color-border-strong); background: var(--color-surface); font-size: 13px; font-weight: 500; color: var(--color-text); }
.chip-opt:hover span { background: var(--color-surface-sunken); }
.chip-opt input:checked + span { background: var(--swat-ink); border-color: var(--swat-ink); color: #FAFBFD; font-weight: 600; }
.chip-opt input:focus-visible + span { outline: 2px solid var(--color-focus, var(--color-primary)); outline-offset: 2px; }
.field .help.legacy { color: var(--color-text); background: var(--color-surface-sunken); border-radius: var(--radius-sm); padding: 4px 8px; }
details.more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--color-link); padding: 4px 0; }
details.more[open] > summary { margin-bottom: 4px; }
.stage-name { display: inline-flex; align-items: center; gap: 8px; }
.stage-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr); gap: 10px; overflow-x: auto; }
.stage-strip li { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stage-strip .bar, .stage-bars .bar { display: block; height: 8px; border-radius: var(--radius-full); background: var(--color-surface-sunken); overflow: hidden; }
.stage-strip .bar > span, .stage-bars .bar > span { display: block; height: 100%; border-radius: inherit; }
.stage-strip .nm { font-size: 13px; font-weight: 600; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-strip .pc { font-size: 12px; color: var(--color-text-muted); }
.stage-strip li.late .pc { color: var(--color-danger-ink); font-weight: 600; }
.stage-strip li.late .bar { box-shadow: inset 0 0 0 1px var(--color-danger); }
.stage-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.stage-bars li { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) 28px; align-items: center; gap: 10px; font-size: 13px; }
.stage-bars .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-bars b { text-align: right; font-weight: 600; }
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pulse-kpis .pk .v.warn { color: var(--color-danger-ink); }
.grid-1 { grid-template-columns: minmax(0, 1fr); }
.board.pipeline-board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); overflow-x: auto; padding-bottom: 6px; }
.pipeline-board .tcard:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.proposals { list-style: none; margin: 0; padding: 0; }
.proposals li { padding: 12px 0; border-bottom: 1px solid var(--color-border); font-size: 13.5px; }
.proposals li:last-child { border-bottom: 0; }
.proposals li:not(.latest) { color: var(--color-text-muted); }
.proposals .ph { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proposals .grow { flex: 1; }
.sample-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 90px 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
tr.muted-row td { color: var(--color-text-muted); }
@media (max-width: 860px) {
  .kpis.kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .sample-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .board.pipeline-board { grid-auto-columns: minmax(78vw, 1fr); }
}
.ov-v14 .people .grow > .nm, .ov-v14 .people .grow > .rl { display: block; }
.proposals svg { width: 15px; height: 15px; vertical-align: -3px; }
#brief-page .people .grow > .nm, #brief-page .people .grow > .rl { display: block; }
.status-history { list-style: none; margin: 0; padding: 0; }
.status-history li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.status-history li:last-child { border-bottom: 0; }
.status-history li > .muted { margin-left: auto; font-size: 12px; }
