/* AutoMaintain. Own design; no third-party or CiSMA assets. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #256abf;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0fc;
  --series: #2a78d6;
  --series-soft: #86b6ef;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --good-soft: #e8f6e8;
  --warning-soft: #fdf3d9;
  --critical-soft: #fbe9e9;
  --neutral-soft: #efeee9;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #5598e7;
    --accent-ink: #0b0b0b;
    --accent-soft: #14273f;
    --series: #3987e5;
    --series-soft: #1c5cab;
    --good-soft: #10260f;
    --warning-soft: #2f2508;
    --critical-soft: #331414;
    --neutral-soft: #242422;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.sub { color: var(--ink-2); margin: 0 0 1.25rem; }
.small { font-size: .875rem; color: var(--ink-2); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* layout */
.top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; display: flex; align-items: center; gap: .5rem; }
.brand svg { width: 22px; height: 22px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--ink-2); padding: .45rem .7rem; border-radius: 8px; min-height: 40px; display: inline-flex; align-items: center; }
.nav a:hover { background: var(--neutral-soft); text-decoration: none; }
.nav a.on { color: var(--ink); background: var(--neutral-soft); font-weight: 600; }
.who { display: flex; align-items: center; gap: .6rem; font-size: .875rem; color: var(--ink-2); }
main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
footer { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem 2rem; color: var(--muted); font-size: .8rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1rem; }
.grid > .card { margin-bottom: 0; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .6rem; }

/* stat tiles */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.tile .label { font-size: .8rem; color: var(--ink-2); }
.tile .value { font-size: 1.7rem; font-weight: 650; line-height: 1.2; }
.tile .note { font-size: .8rem; color: var(--muted); }

/* status: always an icon and a word, never colour alone */
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem .15rem .45rem;
  border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--ink); background: var(--neutral-soft);
  border: 1px solid var(--ring); white-space: nowrap;
}
.chip i { font-style: normal; width: 1.05rem; height: 1.05rem; border-radius: 50%; display: inline-grid; place-items: center; font-size: .7rem; font-weight: 800; color: #fff; background: var(--muted); }
.chip.ok { background: var(--good-soft); } .chip.ok i { background: var(--good); }
.chip.watch { background: var(--warning-soft); } .chip.watch i { background: var(--warning); color: #0b0b0b; }
.chip.act { background: var(--critical-soft); } .chip.act i { background: var(--critical); }
.chip.approved { background: var(--good-soft); } .chip.approved i { background: var(--good); }
.chip.done { background: var(--good-soft); } .chip.done i { background: var(--good); }
.chip.rejected i { background: var(--muted); }
.chip.proposed { background: var(--accent-soft); } .chip.proposed i { background: var(--accent); color: var(--accent-ink); }

.meter { display: block; width: 100%; height: 8px; }
.meter .track { fill: var(--neutral-soft); }
.meter .fill { fill: var(--muted); }
.meter .fill.ok { fill: var(--good); } .meter .fill.watch { fill: var(--warning); } .meter .fill.act { fill: var(--critical); }
.health { display: flex; align-items: baseline; gap: .4rem; }
.health b { font-size: 1.7rem; font-weight: 650; line-height: 1.1; }

.toolcard { display: block; color: inherit; }
.toolcard:hover { text-decoration: none; border-color: var(--axis); }
.toolcard h3 { font-size: 1.1rem; margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .15rem .9rem; font-size: .9rem; margin: .7rem 0 0; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; }

/* forms */
label { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: .55rem .65rem; min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.fields { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.check { display: flex; gap: .5rem; align-items: flex-start; color: var(--ink); font-size: .95rem; }
.check input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; flex: none; }
.checks { display: flex; gap: .4rem 1.1rem; flex-wrap: wrap; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: .5rem .95rem; min-height: 44px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; gap: .4rem;
}
button:hover, .btn:hover { filter: brightness(1.07); text-decoration: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--axis); }
button.sm, .btn.sm { min-height: 36px; padding: .3rem .7rem; font-size: .875rem; }
button.danger { background: transparent; color: var(--critical); border-color: var(--critical); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; }
form.inline { display: inline; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: .35rem 0; }
details[open] > summary { margin-bottom: .7rem; }
.field-error { color: var(--critical); font-size: .875rem; margin: .3rem 0 0; }
.banner { border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; border: 1px solid var(--ring); background: var(--neutral-soft); font-size: .93rem; }
.banner.warning { background: var(--warning-soft); }
.banner.error { background: var(--critical-soft); }
.banner.info { background: var(--accent-soft); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .8rem; padding: .45rem .6rem; border-bottom: 1px solid var(--axis); white-space: nowrap; }
td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td:first-child { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* guided set-up */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin: 0 0 1.25rem; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; }
.steps a, .steps span.locked {
  display: block; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: .9rem; min-height: 62px;
}
.steps a:hover { text-decoration: none; border-color: var(--axis); }
.steps .n { display: block; font-size: .75rem; color: var(--ink-2); }
.steps .n::before { content: "Step " counter(step) " "; }
.steps .current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.steps .done .n::after { content: "- done \2713"; }
.steps span.locked { color: var(--muted); background: transparent; border-style: dashed; }
.steps span.locked .n::after { content: "- locked"; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr 1fr; } }

/* actions */
.action { border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; background: var(--surface); }
.action + .action { margin-top: .6rem; }
.action h3 { margin: 0 0 .2rem; font-size: 1rem; }
.action .why { color: var(--ink-2); font-size: .9rem; margin: 0 0 .6rem; }
.action form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.action form input[type=text] { flex: 1 1 220px; min-height: 40px; }

/* causes */
.causes { list-style: none; margin: 0; padding: 0; }
.causes li { padding: .6rem 0; border-top: 1px solid var(--line); }
.causes li:first-child { border-top: 0; padding-top: 0; }
.causes b { display: inline-block; min-width: 9rem; }
.headline { font-size: 1.05rem; font-weight: 550; }

/* charts */
.chart { display: block; width: 100%; height: auto; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick, .chart .axis-label, .chart .limit-label, .chart .event-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-label { fill: var(--ink-2); }
.chart .limit { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 5 4; }
.chart .limit.soft { stroke: var(--muted); stroke-dasharray: 2 4; }
.chart .limit-label { fill: var(--ink-2); }
.chart .event { stroke: var(--axis); stroke-width: 1; }
.chart .event.stop { stroke-dasharray: 2 3; }
.chart .event-label { fill: var(--ink-2); }
.chart .dot { fill: var(--series-soft); }
.chart .fit { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .fit.thin { stroke-width: 1.5; }
.chart .projection { fill: none; stroke: var(--series); stroke-width: 2; stroke-dasharray: 6 5; stroke-linecap: round; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--series); fill-opacity: .25; }
.chart .bar { fill: var(--series); }
.chart .bar.muted { fill: var(--axis); }
.chart .bar-label { fill: var(--ink); font-size: 13px; }
.chart .bar-value { fill: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin: 0 0 .4rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend svg { width: 26px; height: 10px; }
.legend .dot { fill: var(--series-soft); } .legend .fit { stroke: var(--series); stroke-width: 2; }
.legend .projection { stroke: var(--series); stroke-width: 2; stroke-dasharray: 5 4; }
.legend .limit { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 5 4; }
#tip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--page);
  font-size: .8rem; padding: .3rem .55rem; border-radius: 6px; max-width: 280px; display: none;
}

/* toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: .6rem; align-items: flex-start; background: var(--surface); color: var(--ink);
  border: 1px solid var(--ring); border-left: 4px solid var(--muted); border-radius: 10px; padding: .65rem .8rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14); font-size: .93rem;
}
.toast i { font-style: normal; font-weight: 800; }
.toast.success { border-left-color: var(--good); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--critical); }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--ink-2); min-height: 0; padding: 0 .2rem; font-size: 1.1rem; line-height: 1; }

/* sign-in */
.center { max-width: 420px; margin: 8vh auto 0; }

/* report */
.report h2 { border-bottom: 1px solid var(--axis); padding-bottom: .3rem; margin-top: 1.6rem; }
.report .tool-section { margin-top: 1.4rem; }
.report-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.signoff { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-top: 2.2rem; }
.signoff div { border-top: 1px solid var(--ink); padding-top: .35rem; font-size: .85rem; color: var(--ink-2); }

@media print {
  :root {
    color-scheme: light;
    --page: #fff; --surface: #fff; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781; --line: #e1e0d9; --axis: #c3c2b7;
    --series: #2a78d6; --series-soft: #86b6ef; --accent: #256abf; --accent-soft: #e6f0fc;
    --good-soft: #e8f6e8; --warning-soft: #fdf3d9; --critical-soft: #fbe9e9; --neutral-soft: #efeee9;
  }
  .top, footer, .toasts, .no-print, #tip { display: none !important; }
  body { font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; }
  .tool-section { break-before: page; }
  .tool-section:first-of-type { break-before: auto; }
  h2, h3 { break-after: avoid; }
  .chart, tr, .action, .causes li { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { font-size: 9pt; }
  th { white-space: normal; }
  td, th { padding: .3rem .4rem; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 16mm 14mm; }
}
