:root {
  --ink: #18211b;
  --muted: #667269;
  --paper: #f4f6f1;
  --surface: #ffffff;
  --line: #dfe5dc;
  --brand: #1f6f50;
  --brand-dark: #15533b;
  --within: #2f7d4c;
  --warning: #b77513;
  --overdue: #b4472f;
  --critical: #8f2635;
  --shadow: 0 14px 36px rgba(31, 47, 36, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 90% 0, #e4eee6 0, transparent 32rem), var(--paper); }
button, input, select { font: inherit; }
.topbar { min-height: 62px; padding: 10px clamp(16px, 3vw, 42px); display: flex; align-items: center; justify-content: space-between; background: #172820; color: white; }
.topbar h1 { margin: 1px 0 0; font-size: clamp(21px, 2.5vw, 27px); letter-spacing: -.04em; }
.eyebrow { margin: 0; font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: #80af95; }
.live { display: flex; align-items: center; gap: 7px; font-size: 11px; color: #d9e9df; }
.live span { width: 7px; height: 7px; border-radius: 50%; background: #55cf83; box-shadow: 0 0 0 4px rgba(85,207,131,.12); }
.tabs { display: flex; gap: 6px; padding: 7px clamp(16px, 3vw, 42px) 0; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.72); backdrop-filter: blur(10px); }
.tab { border: 0; background: transparent; padding: 8px 12px 9px; color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand-dark); border-color: var(--brand); }
main { max-width: 1480px; margin: 0 auto; padding: 18px clamp(14px, 3vw, 38px) 40px; }
.view { display: none; }
.view.active { display: block; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 13px; }
h2 { margin: 3px 0 0; font-size: clamp(23px, 3vw, 31px); letter-spacing: -.04em; }
h3 { margin: 0 0 5px; font-size: 15px; }
.muted { color: var(--muted); font-size: 11px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 7px; margin-bottom: 11px; }
.metrics article { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid #79837c; border-radius: 10px; padding: 8px 11px; box-shadow: 0 5px 16px rgba(31, 47, 36, .05); }
.metrics span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.metrics strong { display: block; margin-top: 2px; font-size: 22px; line-height: 1.08; letter-spacing: -.035em; }
.metrics .within { border-top-color: var(--within); }
.metrics .warning { border-top-color: var(--warning); }
.metrics .overdue { border-top-color: var(--overdue); }
.metrics .critical { border-top-color: var(--critical); }
.filters { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 7px; background: #eaf0e8; padding: 8px; border: 1px solid #d8e2d7; border-radius: 10px 10px 0 0; }
.report-filters { grid-template-columns: repeat(4, minmax(125px, 1fr)) auto; border-radius: 10px; margin-bottom: 11px; }
.report-filters .button { align-self: end; white-space: nowrap; }
label { display: grid; gap: 4px; color: #4d5b51; font-size: 10px; font-weight: 750; }
input, select { width: 100%; border: 1px solid #cbd5cc; border-radius: 7px; background: white; min-height: 33px; padding: 5px 8px; color: var(--ink); font-size: 12px; }
input:focus, select:focus, button:focus-visible { outline: 3px solid rgba(31,111,80,.2); border-color: var(--brand); }
.table-shell { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; box-shadow: 0 7px 20px rgba(31, 47, 36, .06); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 8px 10px; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; color: #6b756e; background: #f7f9f6; white-space: nowrap; }
td { padding: 8px 10px; border-top: 1px solid #edf0ec; font-size: 11px; vertical-align: middle; }
.identity strong, .identity span { display: block; }
.identity span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.identity-copy { border: 0; padding: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: copy; }
.identity-copy:hover strong { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.identity-copy:focus-visible { border-radius: 4px; outline: 3px solid rgba(31,111,80,.2); }
.clipboard-helper { position: fixed; left: -9999px; top: 0; opacity: 0; }
.timer { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 800; letter-spacing: .015em; }
.badge { display: inline-flex; border-radius: 999px; padding: 3px 7px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; background: #edf0ed; color: #4f5c53; }
.badge.within { background: #e4f3e7; color: var(--within); }
.badge.warning { background: #fff1cf; color: #96600c; }
.badge.overdue { background: #fbe4df; color: var(--overdue); }
.badge.critical { background: #f7dce2; color: var(--critical); }
.badge.scheduled { background: #e8ecf5; color: #4e6088; }
.empty { min-height: 145px; display: grid; place-content: center; text-align: center; gap: 5px; color: var(--muted); }
.empty[hidden] { display: none; }
.empty strong { color: var(--ink); font-size: 15px; }
.report-metrics { margin-top: 0; }
.report-metrics strong { font-size: clamp(18px, 2vw, 22px); }
.insight { margin: 0 0 11px; padding: 9px 12px; border: 1px solid #cfe0d2; border-left: 3px solid var(--brand); border-radius: 8px; background: #eef5ef; color: #3d5345; font-size: 11px; }
.insight:empty { display: none; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-heading h3, .panel-heading p { margin-top: 0; }
.panel-heading > strong { color: var(--brand-dark); font-size: 11px; white-space: nowrap; }
.report-comparisons td:nth-child(n+2), .report-comparisons th:nth-child(n+2) { text-align: right; }
.history-panel .timer { font-size: 15px; }
.metric-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-bottom: 11px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 13px; box-shadow: 0 7px 20px rgba(31, 47, 36, .06); }
.panel.full { margin-bottom: 11px; }
.form-grid { display: grid; gap: 8px; margin-top: 10px; }
.button { border: 0; border-radius: 7px; min-height: 33px; padding: 6px 10px; background: var(--brand); color: white; font-size: 11px; font-weight: 800; cursor: pointer; }
.button:hover { background: var(--brand-dark); }
.button.secondary { color: var(--brand-dark); background: #e4eee7; }
.button.danger { color: #8a2633; background: #f7dce2; }
.button.danger:hover { color: white; background: var(--critical); }
.button.small { min-height: 29px; padding: 4px 8px; font-size: 10px; }
.form-actions, .row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.auth-shell { min-height: 58vh; display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: min(100%, 390px); }
.auth-card h2 { margin-bottom: 7px; }
.auth-card .form-grid { margin-top: 16px; }
.settings-session { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.switch-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.switch-row input { width: 16px; min-height: 16px; accent-color: var(--brand); }
.compact-table { overflow-x: auto; margin: 8px -13px -13px; border-radius: 0 0 10px 10px; }
.compact-table select { min-width: 155px; }
.compact-table .topic-title { min-width: 190px; }
.group-tree { display: grid; gap: 8px; margin-top: 10px; }
.group-card { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfa; }
.group-summary { display: grid; grid-template-columns: minmax(250px, 1.6fr) minmax(180px, .8fr) minmax(170px, .8fr) auto; gap: 8px; align-items: end; padding: 9px; }
.group-toggle { display: flex; align-items: center; gap: 11px; align-self: stretch; border: 0; border-radius: 9px; padding: 7px 9px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.group-toggle:hover { background: #edf3ed; }
.chevron { display: inline-grid; place-content: center; width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: #e4eee7; color: var(--brand-dark); font-size: 24px; line-height: 1; transition: transform .16s ease; }
.group-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.group-identity strong, .group-identity small { display: block; }
.group-identity strong { font-size: 15px; }
.group-identity small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.group-topics { overflow-x: auto; border-top: 1px solid var(--line); background: white; }
.group-topics[hidden] { display: none; }
.group-topics table { min-width: 760px; }
.group-topics .topic-title { min-width: 200px; }
.group-topics .topic-status { min-width: 210px; }
.inherit-note { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 600; }
.stack-list { display: grid; gap: 6px; margin-top: 9px; }
.stack-item { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.schedule-form { display: grid; gap: 10px; margin-top: 10px; }
.schedule-controls { display: grid; grid-template-columns: repeat(3, minmax(150px, 220px)); gap: 8px; }
.schedule-form > .button { justify-self: start; min-width: 160px; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: 340px; padding: 9px 12px; border-radius: 8px; color: white; background: #172820; font-size: 11px; box-shadow: var(--shadow); transform: translateY(120px); opacity: 0; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--critical); }
@media (max-width: 850px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .filters, .settings-grid, .report-filters { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .group-summary { grid-template-columns: 1fr; }
  th, td { padding: 8px; }
}
@media (max-width: 520px) {
  .live { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article:first-child { grid-column: 1 / -1; }
  .schedule-controls { grid-template-columns: 1fr; }
}
