/*
 * Core PM — styles (dark, light and device-matched themes)
 * Version: 0.27
 * Modified: 2026-10-09
 */

:root, [data-theme="dark"] {
  --bg: #0e1116; --side: #13171e; --card: #1a1f28; --card-2: #212734; --line: #272d38; --line-2: #343b49;
  --tx: #e6e8ec; --mut: #8a919e; --acc: #4f9cf0; --acc-tx: #ffffff; --accbg: #16263b;
  --ok: #3fbf8a; --okbg: #122b22; --warn: #e5a83b; --warnbg: #33270f; --bad: #ef6b6b; --badbg: #361819;
  --focus: 0 0 0 2px #4f9cf0aa;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f6f9; --side: #ffffff; --card: #ffffff; --card-2: #f7f8fb; --line: #e1e5eb; --line-2: #cfd5de;
  --tx: #171b22; --mut: #5f6877; --acc: #1f6fd1; --acc-tx: #ffffff; --accbg: #e3eefc;
  --ok: #0f7a52; --okbg: #dcf5ea; --warn: #8a5a06; --warnbg: #fcefd4; --bad: #b42323; --badbg: #fde4e4;
  --focus: 0 0 0 2px #1f6fd166;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg: #f4f6f9; --side: #ffffff; --card: #ffffff; --card-2: #f7f8fb; --line: #e1e5eb; --line-2: #cfd5de;
    --tx: #171b22; --mut: #5f6877; --acc: #1f6fd1; --acc-tx: #ffffff; --accbg: #e3eefc;
    --ok: #0f7a52; --okbg: #dcf5ea; --warn: #8a5a06; --warnbg: #fcefd4; --bad: #b42323; --badbg: #fde4e4;
    --focus: 0 0 0 2px #1f6fd166;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--tx);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 13px; font-weight: 600; margin: 16px 0 4px; }
p { margin: 0 0 10px; }
.muted { color: var(--mut); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.t-green { color: var(--ok); } .t-amber { color: var(--warn); } .t-red { color: var(--bad); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[hidden] { display: none !important; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 200px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line);
  padding: 16px 10px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--tx); font-weight: 600; font-size: 15px; padding: 2px 8px 18px; }
.mark.mark-ico { width: auto; height: auto; background: none; display: inline-flex; flex-shrink: 0; border-radius: 0; }
.mark-ico svg { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 9.5px; font-weight: 500; color: var(--mut); margin-top: 2px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.mark { width: 24px; height: 24px; border-radius: 6px; background: var(--acc); color: var(--acc-tx); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: var(--mut); padding: 7px 10px; border-radius: 6px; }
.side nav a:hover { background: var(--card); color: var(--tx); text-decoration: none; }
.side nav a.on { background: var(--accbg); color: var(--acc); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 8px; font-size: 12.5px; }
.who span { display: block; color: var(--mut); }
.ver { color: var(--mut); font-size: 11.5px; }
.theme-toggle { background: var(--card); border: 1px solid var(--line); color: var(--tx); border-radius: 6px; padding: 6px 8px; font: inherit; cursor: pointer; text-align: left; }
.main { flex: 1; min-width: 0; padding: 10px 28px 48px; max-width: 1280px; }
.bare-main { margin: 0 auto; }

/* Pinned header: breadcrumbs, title, actions (and tabs on projects) stay visible while scrolling */
.topbar, .main > .page-head {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  margin-left: -28px; margin-right: -28px; padding: 12px 28px 0;
  border-bottom: 1px solid transparent;
}
.main > .page-head { padding-bottom: 12px; }
.topbar { margin-bottom: 18px; }
.topbar .page-head { margin-bottom: 12px; }
.topbar .tabs { margin-bottom: 0; border-bottom-color: transparent; }
.topbar.stuck, .main > .page-head.stuck { border-bottom-color: var(--line); box-shadow: 0 6px 12px -10px rgba(0, 0, 0, 0.5); }
.topbar.stuck .page-head p, .main > .page-head.stuck p { display: none; }
.topbar.stuck .crumbs { margin-bottom: 2px; }
.dirty { font-size: 12px; font-weight: 500; color: var(--warn); background: var(--warnbg); padding: 3px 9px; border-radius: 10px; white-space: nowrap; }

/* Page furniture */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--mut); margin-bottom: 6px; }
.crumbs a { color: var(--mut); }
.desc { color: var(--mut); max-width: 75ch; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 8px 14px; color: var(--mut); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--tx); text-decoration: none; }
.tabs a.on { color: var(--tx); border-bottom-color: var(--acc); }
.sec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sec-head h2 { margin: 0; }
.group-h { margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.count { font-size: 12px; color: var(--mut); background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; font-weight: 500; }

/* Cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card .pad { padding: 16px 18px 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.empty { text-align: center; padding: 36px 20px; }
.empty p { color: var(--mut); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat > span { font-size: 12px; color: var(--mut); }
.stat strong { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat strong.sm { font-size: 14.5px; font-weight: 600; }
.hsplit b { font-weight: 600; margin-right: 6px; }

/* Health: the coloured edge is the signature of the app */
.h-edge-green, .h-edge-amber, .h-edge-red { border-left-width: 4px; border-left-style: solid; }
.h-edge-green { border-left-color: var(--ok); }
.h-edge-amber { border-left-color: var(--warn); }
.h-edge-red { border-left-color: var(--bad); }

.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pf-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; color: var(--tx); }
.pf-card:hover { text-decoration: none; background: var(--card-2); }
.pf-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pf-top h2 { margin: 0 0 2px; }
.pf-card .bar { margin: 10px 0 8px; }
.pf-foot { display: flex; justify-content: space-between; gap: 10px; }

/* Badges, tags, bars */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 10px; white-space: nowrap; line-height: 1.5; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.h-green { background: var(--okbg); color: var(--ok); }
.h-amber { background: var(--warnbg); color: var(--warn); }
.h-red { background: var(--badbg); color: var(--bad); }
.s-todo, .s-planned, .s-on_hold, .s-archived { background: var(--card-2); color: var(--mut); border: 1px solid var(--line); }
.s-in_progress, .s-active { background: var(--accbg); color: var(--acc); }
.s-in_review { background: var(--warnbg); color: var(--warn); }
.s-done, .s-delivered, .s-accepted, .s-complete { background: var(--okbg); color: var(--ok); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--mut); white-space: nowrap; }
.tag.t-amber { border-color: var(--warn); color: var(--warn); }
.tag.p-high { border-color: var(--warn); color: var(--warn); }
.tag.p-urgent { border-color: var(--bad); color: var(--bad); }
.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > div { height: 100%; background: var(--acc); border-radius: 3px; }
.w-prog { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.w-prog .bar { flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--mut); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl thead + tbody tr:first-child td { border-top: 0; }
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover td { background: var(--card-2); }
.tbl tr.inactive td { opacity: 0.6; }
.sorthead { cursor: pointer; user-select: none; }
.sorthead[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
.sorthead[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
.w-check { width: 36px; }

/* Milestones and deliverables */
.milestone { padding: 14px 16px; }
.ms-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.ms-name { font-weight: 600; font-size: 14.5px; color: var(--tx); margin-right: 6px; }
.reason { color: var(--bad); margin: -2px 0 8px; }
.delivs { list-style: none; margin: 0; padding: 0; }
.deliv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.deliv-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deliv-meta { display: flex; align-items: center; gap: 10px; }
.deliv-meta .w-prog { min-width: 90px; }

/* Side lists */
.plain { list-style: none; margin: 0 0 10px; padding: 0; }
.deps li, .ext li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.deps li:first-child, .ext li:first-child { border-top: 0; }
.ext li.got span { text-decoration: line-through; color: var(--mut); }
.activity li { padding: 5px 0; border-top: 1px solid var(--line); }
.activity li:first-child { border-top: 0; }
.activity li > span:first-child { color: var(--tx); font-weight: 500; }
.hols li { display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px solid var(--line); }
.hols li:first-child { border-top: 0; }
.update { margin: 0 0 12px; padding: 10px 12px; background: var(--card-2); border-radius: 8px; border-left: 3px solid var(--acc); }
.update footer { margin-top: 6px; }
.update-body { white-space: normal; }
.comment { padding: 8px 0; border-top: 1px solid var(--line); }
.comment p { margin: 4px 0 0; }
.checklist li form { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.checklist li form span { flex: 1; }
.checklist li.done span { text-decoration: line-through; color: var(--mut); }
.box { width: 18px; height: 18px; border: 1.5px solid var(--line-2); border-radius: 4px; background: transparent; color: var(--ok); font-size: 12px; line-height: 1; cursor: pointer; padding: 0; }
.waiting { border-color: var(--warn); }

/* Type label in titles: Portfolio, Project, Milestone, Deliverable, Task */
.kind { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 4px; margin-right: 2px; vertical-align: 0.2em; letter-spacing: 0.01em; background: var(--card-2); color: var(--mut); border: 1px solid var(--line-2); }
.kind-task { background: var(--accbg); color: var(--acc); border-color: transparent; }
.kind-milestone { background: var(--warnbg); color: var(--warn); border-color: transparent; }
.kind-deliverable { background: var(--okbg); color: var(--ok); border-color: transparent; }
.crumbs .sep { color: var(--line-2); margin: 0 2px; }

/* Deliverable rows that expand to show their tasks */
.delivs > .deliv { display: block; padding: 0; }
.dtree > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; }
.dtree > summary::-webkit-details-marker { display: none; }
.dtree > summary:hover { background: var(--card-2); }
.chev { width: 0; height: 0; border-left: 5px solid var(--mut); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.12s; margin: 0 2px 0 4px; }
.dtree[open] > summary .chev { transform: rotate(90deg); }
.tlist { list-style: none; margin: 0 0 8px; padding: 0 0 0 22px; border-left: 2px solid var(--line); margin-left: 7px; }
.tlist.flat { border-left: 0; padding-left: 0; margin-left: 0; }
.tlist-empty { margin: 0 0 8px 31px; }
.tline { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 4px 6px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tline:first-child { border-top: 0; }
.tline > a { color: var(--tx); }
.tline.is-done > a { color: var(--mut); text-decoration: line-through; }
.tl-meta { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.tl-who { min-width: 90px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.tl-due { min-width: 46px; color: var(--mut); }
.tl-pct { min-width: 34px; }
.dot-h { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ok); }
.dot-h.h-amber { background: var(--warn); } .dot-h.h-red { background: var(--bad); }
.tlist.side .tl-who { display: none; }

/* Outline markers */
.ic-ms { display: inline-block; width: 9px; height: 9px; background: var(--acc); transform: rotate(45deg); border-radius: 1px; flex-shrink: 0; margin: 0 3px; }
.ic-flag { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 3px; font-size: 10px; font-weight: 700; border: 1px solid var(--line-2); color: var(--mut); flex-shrink: 0; }
.ic-d { background: var(--okbg); color: var(--ok); border-color: transparent; }
.ic-c { background: var(--accbg); color: var(--acc); border-color: transparent; }
.ms-list li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); }
.ms-list li:first-child { border-top: 0; }
.ms-list .ms-date { margin-left: auto; }
.checks-inline { display: flex; gap: 18px; flex-wrap: wrap; margin: -2px 0 12px; }
.checks-inline .check { margin: 0; }

/* Plan (task sheet) */
.plan-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tool-group { display: inline-flex; gap: 4px; padding-right: 10px; border-right: 1px solid var(--line); }
.tool-group:last-child { border-right: 0; }
.tbl.plan { table-layout: fixed; min-width: 1060px; }
.tbl.plan th, .tbl.plan td { padding: 0 6px; height: 34px; }
.tbl.plan th { height: 32px; }
.tbl.plan .c-drag { width: 26px; text-align: center; padding: 0; }
.tbl.plan .c-id { width: 38px; text-align: right; font-size: 12px; }
.tbl.plan .c-name { width: auto; }
.tbl.plan .c-start, .tbl.plan .c-finish, .tbl.plan .c-dl { width: 128px; }
.tbl.plan .c-resp { width: 130px; }
.tbl.plan .c-status { width: 118px; }
.tbl.plan .c-est, .tbl.plan .c-ah { width: 76px; }
.tbl.plan .c-cp, .tbl.plan .c-ca { width: 104px; }
.tbl.plan .c-bf, .tbl.plan .c-ps { width: 104px; }
.tbl.plan .c-as, .tbl.plan .c-ae { width: 128px; }
.tbl.plan .c-fv { width: 76px; }
.tbl.plan.hide-bf .c-bf, .tbl.plan.hide-fv .c-fv { display: none; }
.tbl.plan.hide-start .c-start,
.tbl.plan.hide-days .c-days,
.tbl.plan.hide-finish .c-finish,
.tbl.plan.hide-pred .c-pred,
.tbl.plan.hide-who .c-who,
.tbl.plan.hide-resp .c-resp,
.tbl.plan.hide-status .c-status,
.tbl.plan.hide-pct .c-pct,
.tbl.plan.hide-dl .c-dl,
.tbl.plan.hide-est .c-est,
.tbl.plan.hide-ah .c-ah,
.tbl.plan.hide-cp .c-cp,
.tbl.plan.hide-ca .c-ca { display: none; }
.tbl.plan select.cell { border: 1px solid transparent; background: transparent; padding: 3px 4px; height: 28px; font-size: 13px; border-radius: 4px; width: 100%; color: var(--tx); }
.tbl.plan select.cell:hover { border-color: var(--line-2); }
.tbl.plan select.cell:focus { border-color: var(--acc); background: var(--bg); box-shadow: none; }
.tbl.plan select.st-in_progress { color: var(--acc); }
.tbl.plan select.st-in_review { color: var(--warn); }
.tbl.plan select.st-done { color: var(--ok); }
.ro-status { font-size: 12.5px; color: var(--mut); padding-left: 6px; }
.tbl.plan tfoot td { border-top: 2px solid var(--line-2); font-weight: 600; height: 36px; background: var(--card-2); }
.tbl.plan tfoot .c-name { padding-left: 12px; }
.tag.due-soon { border-color: var(--warn); color: var(--warn); font-size: 10.5px; padding: 0 5px; }
.col-chooser { position: relative; }
.col-menu { position: absolute; top: 100%; left: 0; z-index: 30; margin-top: 4px; background: var(--card); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.col-menu .check { margin: 0; white-space: nowrap; }

/* Project facts row, hints, column chooser */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 10px; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.fact > span { font-size: 12px; color: var(--mut); }
.fact strong { font-size: 15px; font-weight: 600; }
.fact small { font-size: 12px; color: var(--mut); }
.fact small.t-red { color: var(--bad); } .fact small.t-green { color: var(--ok); }
.hint { display: block; font-size: 11.5px; color: var(--mut); margin-top: 3px; }
.table-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.col-menu { min-width: 250px; max-height: 70vh; overflow-y: auto; right: 0; left: auto; }
.plan-tools .col-menu { left: 0; right: auto; }
.col-item { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 6px; cursor: grab; }
.col-item .check { flex: 1; }
.col-grip { color: var(--mut); font-size: 11px; letter-spacing: -2px; user-select: none; }
.col-item.dragging { opacity: 0.45; }
.col-item.drop-before { box-shadow: 0 -2px 0 var(--acc); } .col-item.drop-after { box-shadow: 0 2px 0 var(--acc); }
.col-item:hover { background: var(--card-2); }
.col-move { display: inline-flex; gap: 2px; }
.col-move .btn { padding: 1px 7px; line-height: 1.2; }
.col-move .btn:disabled { opacity: 0.3; cursor: default; }
.col-reset { margin-top: 6px; }

/* Planned and actual dates on the task page */
.pa-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 6px; }
.pa-grid dt { font-size: 11.5px; color: var(--mut); }
.pa-grid dd { margin: 0; font-weight: 600; font-size: 13.5px; }
@media (max-width: 760px) { .pa-grid { grid-template-columns: 1fr 1fr; } }

/* Baselines and templates */
.kind-baseline { background: var(--accbg); color: var(--acc); border-color: transparent; }
.kv li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.kv li:first-child { border-top: 0; }
.kv span { color: var(--mut); }
.tbl.bl tr.is-sum td { font-weight: 600; }
.tbl.bl tr.is-added td { background: var(--warnbg); }
.g-bl { fill: var(--mut); opacity: 0.55; }
.g-blms { fill: none; stroke: var(--mut); stroke-width: 1.5; }
.lg-bl { height: 4px; background: var(--mut); opacity: 0.6; }
.tpl-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.tpl-head h2 { margin-bottom: 4px; }
.tpl-preview summary { cursor: pointer; color: var(--acc); font-size: 13px; margin-top: 6px; }
.tpl-preview table { margin-top: 8px; }
.strong { font-weight: 600; }

/* Risks and issues */
.kind-risk { background: var(--warnbg); color: var(--warn); border-color: transparent; }
.kind-issue { background: var(--badbg); color: var(--bad); border-color: transparent; }
.ref { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--mut); margin-right: 4px; white-space: nowrap; }
h1 .ref { color: var(--tx); }
.badge.rt-low { background: var(--okbg); color: var(--ok); }
.badge.rt-medium { background: var(--warnbg); color: var(--warn); }
.badge.rt-high { background: var(--badbg); color: var(--bad); }
.badge.rt-critical { background: var(--bad); color: #fff; }
.badge.rs-open { background: var(--accbg); color: var(--acc); }
.badge.rs-monitoring, .badge.rs-in_progress { background: var(--warnbg); color: var(--warn); }
.badge.rs-closed, .badge.rs-resolved { background: var(--card-2); color: var(--mut); border: 1px solid var(--line); }
.tbl.raid td.ref { width: 70px; }
.tbl.raid tr.is-closed td { opacity: 0.6; }
.raid-counts { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.score-out { display: flex; align-items: center; height: 36px; margin-top: 4px; }
.stack-top { margin-bottom: 12px; }
.heatmap { display: grid; grid-template-columns: 18px 1fr; grid-template-rows: auto auto; gap: 2px 4px; margin-bottom: 8px; }
.hm-ylabel { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; color: var(--mut); text-align: center; }
.hm-xlabel { grid-column: 2; text-align: center; font-size: 11px; color: var(--mut); }
.hm { border-collapse: separate; border-spacing: 3px; width: 100%; table-layout: fixed; }
.hm th { font-size: 9.5px; font-weight: 500; color: var(--mut); text-align: right; padding-right: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm th:first-child { width: 82px; }
.hm th.hm-x { text-align: center; padding: 2px 0 0; white-space: normal; overflow: visible; font-size: 9px; line-height: 1.15; }
.hm td { height: 30px; border-radius: 4px; text-align: center; font-weight: 700; font-size: 13px; opacity: 0.35; }
.hm td.has { opacity: 1; cursor: help; }
.hm-low { background: var(--okbg); color: var(--ok); }
.hm-medium { background: var(--warnbg); color: var(--warn); }
.hm-high { background: var(--badbg); color: var(--bad); }
.hm-critical { background: var(--bad); color: #fff; }

/* Status dials (Schedule, Cost, Scope) */
.gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.gauge { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; text-align: center; }
.gauge-title { font-size: 12px; color: var(--mut); font-weight: 600; letter-spacing: 0.02em; }
.gauge-svg { width: 130px; height: 76px; display: block; margin: 2px auto 0; }
.gz { fill: none; stroke-width: 10; stroke-linecap: butt; }
.gz-g { stroke: var(--ok); } .gz-a { stroke: var(--warn); } .gz-r { stroke: var(--bad); } .gz-n { stroke: var(--line-2); }
.gauge .gz { opacity: 0.35; }
.gauge.g-green .gz-g, .gauge.g-amber .gz-a, .gauge.g-red .gz-r { opacity: 1; }
.gz-needle { stroke: var(--tx); stroke-width: 3; stroke-linecap: round; }
.gz-hub { fill: var(--tx); }
.gauge-rag { font-weight: 700; font-size: 14px; margin-top: -2px; }
.gauge.g-green .gauge-rag { color: var(--ok); } .gauge.g-amber .gauge-rag { color: var(--warn); } .gauge.g-red .gauge-rag { color: var(--bad); } .gauge.g-none .gauge-rag { color: var(--mut); }
.gauge-note { font-size: 12px; color: var(--mut); margin-top: 2px; line-height: 1.35; }
.rag-dots { display: inline-flex; gap: 4px; }
.rd { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 9px; background: var(--card-2); color: var(--mut); border: 1px solid var(--line-2); }
.rd-green { background: var(--okbg); color: var(--ok); border-color: transparent; }
.rd-amber { background: var(--warnbg); color: var(--warn); border-color: transparent; }
.rd-red { background: var(--badbg); color: var(--bad); border-color: transparent; }
@media (max-width: 760px) { .gauges { grid-template-columns: 1fr; } }
.tbl.plan .c-days { width: 62px; }
.tbl.plan .c-pred { width: 92px; }
.tbl.plan .c-who { width: 140px; }
.tbl.plan .c-pct { width: 66px; }
.tbl.plan input.cell.num { -moz-appearance: textfield; appearance: textfield; }
.tbl.plan input.cell.num::-webkit-outer-spin-button, .tbl.plan input.cell.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tbl.plan .c-h { width: 40px; text-align: center; font-size: 11px; }
.tbl.plan .ro { color: var(--tx); font-weight: 600; font-size: 13px; padding-left: 10px; }
.tbl.plan tr.is-sum .nm-in { font-weight: 700; }
.tbl.plan tr.is-done .nm-in { color: var(--mut); text-decoration: line-through; }
.tbl.plan tr.sel td { background: var(--accbg); }
.tbl.plan tr.drop-target td { box-shadow: inset 0 -2px 0 var(--acc); }
.tbl.plan input.cell { border: 1px solid transparent; background: transparent; padding: 4px 6px; height: 28px; font-size: 13px; border-radius: 4px; width: 100%; color: var(--tx); }
.tbl.plan input.cell:hover { border-color: var(--line-2); }
.tbl.plan input.cell:focus { border-color: var(--acc); background: var(--bg); box-shadow: none; }
.tbl.plan input.cell.saving { opacity: 0.5; }
.tbl.plan input.cell.num { text-align: right; }
.nm { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nm .nm-in { flex: 1; min-width: 80px; }
.tog { width: 18px; height: 18px; border: 0; background: transparent; cursor: pointer; padding: 0; position: relative; flex-shrink: 0; }
.tog::before { content: ""; position: absolute; left: 6px; top: 5px; border-left: 6px solid var(--mut); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transform: rotate(90deg); transition: transform 0.12s; }
tr.collapsed .tog::before { transform: rotate(0deg); }
.tog-sp { width: 18px; flex-shrink: 0; }
.nm .open { color: var(--mut); font-size: 13px; padding: 0 4px; visibility: hidden; }
.tbl.plan tr:hover .open, .tbl.plan tr.sel .open { visibility: visible; }
.grip { cursor: grab; color: var(--line-2); font-size: 13px; letter-spacing: -2px; user-select: none; }
.tbl.plan tr:hover .grip { color: var(--mut); }
.ro-pct { display: block; text-align: right; padding-right: 6px; font-size: 13px; color: var(--mut); }
.empty-plan { padding: 20px !important; height: auto !important; }
.plan-help kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--line-2); border-radius: 3px; padding: 0 4px; background: var(--card-2); }

/* Client code tag */
.code { display: inline-block; font-size: 0.72em; font-weight: 700; letter-spacing: 0.03em; color: var(--acc); border: 1.5px solid var(--acc); border-radius: 4px; padding: 0 5px; line-height: 1.45; vertical-align: 0.12em; margin-right: 2px; }
h1 .code, h2 .code { font-size: 12px; }

/* Timeline (Gantt) */
.gantt-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.gb-actions { display: flex; gap: 6px; align-items: center; margin-right: auto; margin-left: 10px; }
.seg { display: inline-flex; }
.seg a { padding: 5px 12px; border: 1px solid var(--line-2); color: var(--mut); margin-left: -1px; font-size: 13px; }
.seg a:first-child { border-radius: 6px 0 0 6px; } .seg a:last-child { border-radius: 0 6px 6px 0; }
.seg a.on { background: var(--accbg); color: var(--acc); border-color: var(--acc); position: relative; }
.seg a:hover { text-decoration: none; color: var(--tx); }
.legend { display: flex; gap: 14px; color: var(--mut); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.lg-crit { background: transparent; border: 2px solid var(--tx); }
.lg-fixed { width: 2px; height: 12px; background: var(--tx); border-radius: 0; }
.lg-dl { width: 0; height: 0; border-left: 7px solid var(--warn); border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-radius: 0; }
.lg-ms { width: 9px; height: 9px; background: var(--acc); transform: rotate(45deg); border-radius: 1px; }
.gantt { display: flex; overflow: hidden; }
.g-labels { flex-shrink: 0; border-right: 1px solid var(--line); background: var(--card); max-width: 62%; overflow-x: auto; }
.g-ltable { border-collapse: collapse; border-spacing: 0; font-size: 13px; }
.g-ltable thead tr { height: var(--hh); }
.g-ltable th { background: var(--side); border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 500; color: var(--mut); text-align: left; vertical-align: bottom; padding: 0 8px 7px; white-space: nowrap; }
.g-ltable tbody tr { height: var(--rh); }
.g-ltable td { padding: 0 8px; white-space: nowrap; font-size: 12.5px; color: var(--mut); line-height: 1; }
.g-ltable td.c-name { padding: 0; color: var(--tx); }
.g-ltable .c-name { width: 260px; min-width: 260px; max-width: 260px; }
.g-ltable td.c-fv, .g-ltable td.c-pct, .g-ltable th.c-fv, .g-ltable th.c-pct { text-align: right; }
.g-ltable td.c-fv.t-red { color: var(--bad); } .g-ltable td.c-fv.t-green { color: var(--ok); }
.g-nm { display: flex; align-items: center; gap: 6px; padding-right: 8px; overflow: hidden; }
.g-row a { color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-row.d1 { padding-left: 22px; } .g-row.d2 { padding-left: 34px; }
.g-row.top td { background: var(--card-2); }
.g-row.g-sum a { font-weight: 600; }
.g-row.g-ms a { font-weight: 500; }
.g-group span { color: var(--mut); font-weight: 500; font-size: 12px; }
.g-deliv a { color: var(--mut); font-weight: 500; }
.crit-dot { width: 7px; height: 7px; border-radius: 50%; border: 2px solid var(--tx); flex-shrink: 0; }
.g-scroll { flex: 1; overflow-x: auto; }
.g-svg { display: block; font-family: inherit; }
.g-head { fill: var(--side); }
.g-off { fill: var(--line); opacity: 0.45; }
.g-band { fill: var(--card-2); }
.g-mline { stroke: var(--line-2); stroke-width: 1; }
.g-wline { stroke: var(--line); stroke-width: 1; }
.g-mtext { fill: var(--tx); font-size: 12px; font-weight: 600; }
.g-dtext { fill: var(--mut); font-size: 11px; }
.g-today { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 3 3; }
.g-task .g-track { opacity: 0.32; }
.g-task.h-green .g-track, .g-task.h-green .g-fill { fill: var(--acc); }
.g-task.h-amber .g-track, .g-task.h-amber .g-fill { fill: var(--warn); }
.g-task.h-red .g-track, .g-task.h-red .g-fill { fill: var(--bad); }
.g-task.done .g-track, .g-task.done .g-fill { fill: var(--ok); }
.g-task.crit .g-track { stroke: var(--tx); stroke-width: 2; opacity: 1; fill-opacity: 0.32; }
.g-task.conflict .g-track { stroke: var(--bad); stroke-width: 2; stroke-dasharray: 4 2; opacity: 1; fill-opacity: 0.32; }
.g-task:hover .g-track { fill-opacity: 0.5; }
.g-sum rect, .g-sum path { fill: var(--mut); }
.g-sum.h-amber rect, .g-sum.h-amber path { fill: var(--warn); }
.g-sum.h-red rect, .g-sum.h-red path { fill: var(--bad); }
.g-ms.h-green { fill: var(--acc); } .g-ms.h-amber { fill: var(--warn); } .g-ms.h-red { fill: var(--bad); }
.g-pin line, .g-pinline { stroke: var(--tx); stroke-width: 2; }
.g-pin circle { fill: var(--tx); }
.g-dl { stroke: var(--warn); stroke-width: 1.5; fill: var(--warn); }
.g-dl.miss { stroke: var(--bad); fill: var(--bad); }
.g-dep { fill: none; stroke: var(--mut); stroke-width: 1.2; }
.g-dep.crit { stroke: var(--tx); stroke-width: 1.8; }
.g-arrowhead { fill: var(--mut); }
.g-blabel { fill: var(--mut); font-size: 11px; }
@media (max-width: 760px) { .g-ltable .c-name { width: 150px; min-width: 150px; max-width: 150px; } }

/* Board */
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 180px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--side); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 300px; display: flex; flex-direction: column; }
.col.over { border-color: var(--acc); background: var(--accbg); }
.bc-grid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 24px; align-items: start; margin-bottom: 10px; }
.bc-pickers { display: flex; flex-direction: column; gap: 10px; }
.bc-row { display: grid; grid-template-columns: 100px 54px auto; align-items: center; gap: 12px; }
.bc-row .bc-name { font-size: 13.5px; }
.bc-row input[type=color] { width: 54px; height: 32px; padding: 2px; cursor: pointer; }
.bc-row input[type=color]:disabled { opacity: 0.35; cursor: default; }
.bc-row .check { margin: 0; }
.bc-preview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.bc-preview .col { min-height: 120px; }
.bc-preview .tcard { cursor: default; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .bc-grid { grid-template-columns: 1fr; } }
.col h2 { font-size: 13px; display: flex; align-items: center; gap: 8px; margin: 2px 4px 10px; }
.drop { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; cursor: grab; }
.tcard.dragging { opacity: 0.5; }
.tcard .tt { color: var(--tx); font-weight: 500; display: block; margin-bottom: 2px; }
.tmeta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; color: var(--mut); }
.tmeta .due { margin-right: auto; }
.av { width: 22px; height: 22px; border-radius: 50%; background: var(--accbg); color: var(--acc); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; }

/* Forms */
label { display: block; font-size: 12.5px; color: var(--mut); margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--tx); background: var(--bg);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 10px;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--acc); margin: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acc); box-shadow: var(--focus); }
/* Date fields: the browser's picker edits, the chosen display format shows on top */
.dwrap { position: relative; display: block; }
label > .dwrap { margin-top: 4px; }
.add-inline .dwrap { flex: 1; min-width: 140px; }
.add-inline .dwrap input { width: 100%; }
form.inline .dwrap { display: inline-block; }
.dwrap .dshow { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 14px; color: var(--tx); white-space: nowrap; }
.dwrap.in-cell .dshow { left: 7px; font-size: 13px; }
.dwrap input:not(:focus) { color: transparent; }
.dwrap input:not(:focus)::-webkit-datetime-edit { color: transparent; }
.dwrap input:focus + .dshow, .dwrap.in-cell:not(.has-date) .dshow { display: none; }
.dwrap:not(.has-date) .dshow { color: var(--mut); }
.fmt-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; margin-bottom: 8px; }
.fmt-choice { margin-bottom: 6px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--tx); font-size: 13.5px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px 10px; margin-bottom: 12px; }
.checks .check { margin-bottom: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
fieldset.sched { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 4px; margin: 4px 0 14px; }
fieldset.sched legend { font-size: 12px; color: var(--mut); padding: 0 6px; }
.add-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.add-inline input:not([type=checkbox]) { flex: 1; min-width: 120px; width: auto; }
.add-inline label { margin: 0; }
.add-inline.wrap select { width: auto; }
.stack { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.inline { display: inline-flex; gap: 4px; align-items: center; }
.form-foot { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.err { color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 500; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  background: var(--card-2); color: var(--tx); border: 1px solid var(--line-2); white-space: nowrap;
}
.btn:hover { border-color: var(--mut); text-decoration: none; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-tx); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.wide { width: 100%; }
button.link { background: none; border: 0; color: var(--mut); font: inherit; padding: 0; cursor: pointer; text-align: left; }
button.link:hover { color: var(--tx); }
.danger-card h2 { color: var(--bad); }
.danger-zone { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }

/* Dialogs */
dialog.modal { background: var(--card); color: var(--tx); border: 1px solid var(--line-2); border-radius: 12px; padding: 20px 22px; width: min(540px, 94vw); }
dialog.modal::backdrop { background: rgba(5, 8, 12, 0.6); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Messages */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash-ok { background: var(--okbg); color: var(--ok); border-color: transparent; }
.flash-err { background: var(--badbg); color: var(--bad); border-color: transparent; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 380px; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.notice.preview { background: var(--accbg); color: var(--acc); }

/* Login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.login-brand .brand-text small { font-size: 12px; }
.login-card h1 { margin-bottom: 14px; }

.report-foot { margin-top: 30px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Responsive */
@media (max-width: 1000px) {
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 6px; }
  .brand { padding: 0 8px 0 0; }
  .brand-text small { display: none; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { flex-direction: row; margin: 0; align-items: center; flex-wrap: wrap; }
  .who, .ver { display: none; }
  .main { padding: 8px 16px 16px; }
  .topbar, .main > .page-head { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 260px); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Print: client reports print clean on white */
@media print {
  :root, [data-theme] {
    --bg: #fff; --card: #fff; --card-2: #f5f5f5; --line: #ddd; --line-2: #ccc; --tx: #111; --mut: #555;
    --acc: #1f6fd1; --accbg: #e3eefc; --ok: #0f7a52; --okbg: #dcf5ea; --warn: #8a5a06; --warnbg: #fcefd4; --bad: #b42323; --badbg: #fde4e4;
  }
  .side, .no-print, .notice.preview, .btn, .flash, .dirty { display: none !important; }
  .topbar, .main > .page-head { position: static; box-shadow: none; border: 0; }
  .main { padding: 0; max-width: none; }
  .cols { grid-template-columns: 1fr 260px; }
  .card, .stat { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.nowrap { white-space: nowrap; }

/* Status cards (v0.14): overall status with 12-month history on top; schedule, cost and scope below */
.status-cards { margin-bottom: 20px; break-inside: avoid; }
.sc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; min-width: 0; }
.sc-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mut); }
.sc-label .linkish { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; margin-left: 8px; }
.sc-overall { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 36px; align-items: center; margin-bottom: 12px; }
.sc-ovrow { display: flex; align-items: center; gap: 28px; margin-top: 6px; }
.sc-pct { font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; white-space: nowrap; color: var(--tx); }
.sc-pct small { font-size: 15px; font-weight: 400; color: var(--mut); margin-left: 6px; letter-spacing: 0; }
.sc-ovbar { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 120px; }
.sc-pill { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; padding: 7px 18px; border-radius: 22px; width: fit-content; white-space: nowrap; }
.sc-pill::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: currentColor; }
.sp-green, .sp-complete { background: var(--okbg); color: var(--ok); } .sp-amber { background: var(--warnbg); color: var(--warn); }
.sp-red { background: var(--badbg); color: var(--bad); } .sp-hold { background: var(--line); color: var(--mut); }
.sc-bar { display: block; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.sc-bar > span { display: block; height: 100%; background: var(--acc); border-radius: 4px; }
.sc-counts { display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 13px; color: var(--mut); margin-top: 16px; }
.sc-counts b { display: block; font-size: 18px; font-weight: 600; color: var(--tx); }
.sc-counts b.t-red { color: var(--bad); } .sc-counts b.t-amber { color: var(--warn); }
.sc-hist { border-left: 1px solid var(--line); padding-left: 32px; }
.sc-hist .hist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; gap: 8px; }
.sc-hist .hm { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 30px; font-size: 12px; color: var(--mut); line-height: 1; }
.sc-hist .hm.now { color: var(--tx); font-weight: 600; }
.sc-hist .hm.jan::before { content: ""; position: absolute; left: -5px; top: -2px; bottom: -2px; width: 1px; background: var(--line-2); }
.sc-hist .hd { display: block; width: 18px; height: 18px; border-radius: 50%; box-sizing: border-box; }
.sc-hist .hm.now .hd { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--line-2); }
.hd-green { background: var(--ok); } .hd-amber { background: #e0a12a; } .hd-red { background: var(--bad); } .hd-hold { background: var(--mut); opacity: 0.55; }
.hd-complete { background: var(--ok); box-shadow: inset 0 0 0 4px var(--card); outline: 2px solid var(--ok); outline-offset: -2px; }
.hd-none { border: 1.5px dashed var(--line-2); }
.sc-hist .hd-out { width: 10px; height: 2px; border-radius: 1px; background: var(--line-2); margin: 8px 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sc-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sc-trio.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sc-rag { display: flex; flex-direction: column; }
.sc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sc-ragtxt { font-size: 20px; font-weight: 600; margin-top: 4px; }
.sc-rag.g-green .sc-ragtxt { color: var(--ok); } .sc-rag.g-amber .sc-ragtxt { color: var(--warn); } .sc-rag.g-red .sc-ragtxt { color: var(--bad); } .sc-rag.g-none .sc-ragtxt { color: var(--mut); }
.sc-rag .gauge-svg { width: 92px; height: 54px; margin: 0; flex: none; }
.sc-rag .gz { opacity: 0.25; } .sc-rag.g-green .gz-g, .sc-rag.g-amber .gz-a, .sc-rag.g-red .gz-r { opacity: 1; }
.sc-note { font-size: 12.5px; color: var(--mut); margin: 6px 0 0; line-height: 1.4; min-height: 1.4em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sc-note + .sc-figs { margin-top: 14px; }
.sc-fig { min-width: 0; }
.sc-fig.wide { grid-column: span 2; }
.sc-fig > span { display: block; font-size: 12px; color: var(--mut); }
.sc-fig b { display: block; font-size: 17px; font-weight: 600; margin-top: 2px; white-space: nowrap; color: var(--tx); }
.sc-fig b.t-red { color: var(--bad); }
.sc-fig em { display: block; font-style: normal; font-size: 12px; color: var(--mut); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-fig em.t-red { color: var(--bad); } .sc-fig em.t-green { color: var(--ok); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--acc); cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.hist-edit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 1250px) { .sc-overall { grid-template-columns: 1fr; gap: 18px; } .sc-hist { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; } }
@media (max-width: 1000px) { .sc-trio, .sc-trio.two, .sc-trio.four { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .sc-ovrow { flex-direction: column; align-items: stretch; gap: 14px; } .sc-hist .hist { gap: 2px; } .sc-hist .hm { width: auto; flex: 1; } .hist-edit { grid-template-columns: repeat(2, 1fr); } }

/* v0.18: project numbers, grouped project settings */
.projnum { font-variant-numeric: tabular-nums; }
.ccode { font-weight: 700; letter-spacing: 0.03em; }
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 6px 0 14px; }
.set-sec { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px 6px; margin: 0; min-width: 0; }
.set-sec legend { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mut); padding: 0 6px; }
.set-wide { grid-column: span 2; }
.row-num { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.fgrid { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; align-items: start; margin-bottom: 8px; }
.fgrid.fgrid-1 { grid-template-columns: 120px minmax(0, 1fr); }
.fgrid > label { margin-bottom: 8px; }
.fg-h { font-size: 12px; color: var(--mut); font-weight: 600; }
.fg-r { font-size: 13px; color: var(--mut); padding-top: 9px; }
.ro-val { display: flex; flex-direction: column; padding: 7px 0 10px; font-size: 14px; color: var(--tx); }
label .ro-val { margin-top: 4px; padding-top: 3px; }
.ro-val small { font-size: 11.5px; color: var(--mut); }
.settings-form .sec-head { margin-bottom: 4px; }
@media (max-width: 1100px) { .set-grid { grid-template-columns: 1fr; } .set-wide { grid-column: auto; } }

/* v0.19: Excel export picker */
.modal.modal-wide { width: min(1040px, calc(100vw - 32px)); max-width: none; }
.exp-scope { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 12px; }
.exp-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.exp-tools > span { margin-right: auto; }
.exp-body { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; }
.exp-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 56vh; overflow: auto; padding-right: 4px; align-content: start; }
.exp-order { border: 1px solid var(--line); border-radius: 8px; background: var(--card-2); display: flex; flex-direction: column; max-height: 56vh; min-height: 0; }
.exp-order-head { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mut); padding: 9px 12px; border-bottom: 1px solid var(--line); }
.exp-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.exp-list li { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 6px; font-size: 13px; background: var(--card); border: 1px solid var(--line); margin-bottom: 4px; cursor: grab; }
.exp-list li.dragging { opacity: 0.45; }
.exp-list li.drop-before { box-shadow: 0 -2px 0 var(--acc); } .exp-list li.drop-after { box-shadow: 0 2px 0 var(--acc); }
.exp-list .drag { color: var(--mut); font-size: 11px; letter-spacing: -2px; }
.exp-list .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-list .ib { background: none; border: 0; color: var(--mut); cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }
.exp-list .ib:hover:not(:disabled) { color: var(--tx); } .exp-list .ib:disabled { opacity: 0.25; cursor: default; }
.exp-empty { padding: 0 12px; }
.exp-group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 6px; margin: 0; min-width: 0; }
.exp-group legend { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mut); padding: 0 6px; }
.exp-group .check { margin-bottom: 5px; font-size: 13px; }
.exp-count { margin-right: auto; align-self: center; }
@media (max-width: 820px) { .exp-body { grid-template-columns: 1fr; } .exp-groups { grid-template-columns: 1fr 1fr; max-height: 34vh; } .exp-order { max-height: 30vh; } }
.baseline-due { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--warnbg); color: var(--warn); }
.baseline-due .btn { margin-left: auto; }

/* v0.25: project Lifecycle Status */
.badge.lc { white-space: nowrap; }
.lc-pipeline { background: var(--card-2); color: var(--mut); border: 1px dashed var(--line-2); }
.lc-initiate { background: color-mix(in srgb, #9b7be0 16%, transparent); color: #9b7be0; }
.lc-in_progress { background: var(--accbg); color: var(--acc); }
.lc-in_close { background: color-mix(in srgb, #2bb3a3 16%, transparent); color: #2bb3a3; }
.lc-completed { background: var(--okbg); color: var(--ok); }
.lc-on_hold { background: var(--warnbg); color: var(--warn); }
.lc-cancelled { background: var(--card-2); color: var(--mut); border: 1px solid var(--line); text-decoration: line-through; }
.sp-cancelled { background: var(--line); color: var(--mut); }
table[data-cols="pf-projects"] td.c-name { min-width: 230px; }
table[data-cols="pf-projects"] td.c-start, table[data-cols="pf-projects"] td.c-planned, table[data-cols="pf-projects"] td.c-forecast,
table[data-cols="pf-projects"] td.c-actual, table[data-cols="pf-projects"] td.c-status { white-space: nowrap; }

/* v0.26: wide tables scroll sideways inside their card instead of being cut off */
.card.flush.table-wrap { overflow-x: auto; overflow-y: visible; }
.table-wrap > table[data-cols="pf-projects"] { min-width: 100%; width: max-content; }
table[data-cols="pf-projects"] th { white-space: nowrap; }

/* v0.26: four status cards (schedule, cost, effort, scope) */
.sc-trio.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sc-trio.four .sc-rag .gauge-svg { width: 80px; height: 47px; }
.sc-trio.four .sc-ragtxt { font-size: 18px; }
.sc-trio.four .sc-fig b { font-size: 16px; }
@media (max-width: 1300px) and (min-width: 1001px) { .sc-trio.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
