/* NCT Bot dashboard styles.
   Deliberately self hosted, no CDN. The Report Fixer lost its styling twice when
   a Tailwind CDN was blocked or served over the wrong scheme, so this app carries
   its own stylesheet and has no external asset dependency at all. */

:root {
  --ink: #16232e;
  --ink-soft: #4a5b6a;
  --line: #dde4ea;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --teal: #12707a;
  --teal-dark: #0b4f56;
  --teal-soft: #e6f2f3;
  --amber: #8a5a00;
  --amber-soft: #fdf4e3;
  --focus: #0b6bb5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--teal); }
a:hover { color: var(--teal-dark); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Visible to screen readers only. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- header ---------- */
header.site {
  background: var(--teal-dark);
  color: #fff;
  padding: 14px 24px;
}
header.site .row {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
header.site h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 600;
}
header.site .sub {
  font-size: 0.8rem;
  opacity: 0.85;
  display: block;
  font-weight: 400;
}
header.site a { color: #d8ecee; }

nav.main {
  background: var(--teal);
  padding: 0 24px;
}
nav.main ul {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
nav.main a {
  display: block;
  padding: 10px 14px;
  color: #eaf5f6;
  text-decoration: none;
  font-size: 0.9rem;
}
nav.main a:hover { background: var(--teal-dark); color: #fff; }
nav.main a[aria-current="page"] {
  background: var(--bg);
  color: var(--teal-dark);
  font-weight: 600;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* ---------- filters ---------- */
form.filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 20px;
}
form.filters label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
select, input[type="password"], input[type="number"], input[type="search"] {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  min-width: 170px;
}
button, .btn {
  font: inherit;
  padding: 8px 16px;
  border: 1px solid var(--teal);
  border-radius: 4px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
button.secondary, .btn.secondary {
  background: #fff;
  color: var(--teal-dark);
}
button.secondary:hover, .btn.secondary:hover { background: var(--teal-soft); color: var(--teal-dark); }

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  padding: 14px 16px;
}
.card .n { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.card .k {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ---------- panels ---------- */
section.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 22px;
}
section.panel > h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
section.panel > p.hint {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 22px;
}

/* ---------- tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: 8px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
thead th {
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f8fbfb; }

.scroll {
  max-height: 640px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

/* Proportion bar inside a table cell. Width carries the meaning, the number is
   always printed next to it, so this is never the only way to read the value. */
.bar {
  display: block;
  height: 8px;
  background: var(--teal);
  border-radius: 4px;
  min-width: 2px;
}
.bar-cell { width: 30%; }

/* ---------- notes ---------- */
.note {
  border: 1px solid var(--line);
  border-left: 4px solid var(--focus);
  background: #eef6fc;
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.note.amber {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}
.note h3 { margin: 0 0 6px; font-size: 0.95rem; }
.note p { margin: 0 0 6px; }
.note p:last-child { margin-bottom: 0; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f1f5f7;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tag.derived { background: var(--amber-soft); border-color: #e6d2a8; color: var(--amber); }

.flash { list-style: none; padding: 0; margin: 0 0 18px; }
.flash li {
  padding: 11px 16px;
  border-radius: 4px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.flash li.error { background: #fdecec; border-color: #e9b8b8; color: #7d1c1c; }
.flash li.success { background: #e9f6ec; border-color: #b6ddc0; color: #1c5c2c; }

footer.site {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 24px 40px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

/* ---------- login ---------- */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  padding: 30px 32px;
  width: 100%;
  max-width: 420px;
}
.login-box h1 { margin: 0 0 4px; font-size: 1.25rem; }
.login-box p.sub { margin: 0 0 22px; color: var(--ink-soft); font-size: 0.9rem; }
.login-box label { display: block; margin-bottom: 6px; font-size: 0.85rem; }
.login-box input { width: 100%; margin-bottom: 16px; }
.login-box button { width: 100%; }

@media (max-width: 640px) {
  main { padding: 14px; }
  .bar-cell { display: none; }
}

/* ---------- charts ----------
   Inline SVG, no library. Colours are distinguishable in greyscale as well as in
   colour, and every chart prints its numbers too, so nothing depends on hue. */
svg.chart {
  width: 100%;
  height: auto;
  display: block;
  margin: 4px 0 6px;
  overflow: visible;
}
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { font-size: 11px; fill: var(--ink-soft); }
svg.chart .bar-opened { fill: #9fbfd4; }
svg.chart .bar-closed { fill: var(--teal); }
svg.chart .line-backlog { fill: none; stroke: var(--amber); stroke-width: 2.5; }
svg.chart .dot-backlog { fill: var(--amber); }
svg.chart .seg-0 { fill: #0b4f56; }
svg.chart .seg-1 { fill: #12707a; }
svg.chart .seg-2 { fill: #3f9aa3; }
svg.chart .seg-3 { fill: #7fbcc2; }
svg.chart .seg-4 { fill: #b5d8db; }
svg.chart .seg-5 { fill: #8a5a00; }
svg.chart .seg-6 { fill: #c08a2e; }
svg.chart .seg-7 { fill: #e0c48a; }

.legend {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 2px 0 12px;
  line-height: 1.9;
}
.key {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  vertical-align: -1px;
  margin: 0 4px 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.legend .key:first-child { margin-left: 0; }
.key-opened { background: #9fbfd4; }
.key-closed { background: var(--teal); }
.key-backlog { background: var(--amber); }
.key-seg-0 { background: #0b4f56; }
.key-seg-1 { background: #12707a; }
.key-seg-2 { background: #3f9aa3; }
.key-seg-3 { background: #7fbcc2; }
.key-seg-4 { background: #b5d8db; }
.key-seg-5 { background: #8a5a00; }
.key-seg-6 { background: #c08a2e; }
.key-seg-7 { background: #e0c48a; }

.chart-caption { font-weight: 600; margin: 0 0 8px; }

table.hbar-table th[scope="row"] { font-weight: 400; width: 34%; }
table.hbar-table .hbar-cell { width: 42%; }
.hbar {
  display: block;
  height: 14px;
  background: var(--teal);
  border-radius: 3px;
  min-width: 2px;
}
td.muted { color: var(--ink-soft); }

/* Period statement under the headline figures. Rachel could not tell whether
   "resolved" meant today, this month or ever, so it is now always stated. */
.period {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: -8px 0 18px;
}
.period strong { color: var(--ink); }

.callout {
  background: var(--teal-soft);
  border: 1px solid #cfe3e5;
  border-left: 4px solid var(--teal);
  border-radius: 4px;
  padding: 12px 16px;
  margin: 0 0 16px;
  font-size: 0.92rem;
}
.callout p { margin: 0 0 6px; }
.callout p:last-child { margin: 0; }

@media print {
  header.site, nav.main, form.filters, footer.site { display: none; }
  section.panel { break-inside: avoid; }
}
