/* ---------- tokens ---------- */
:root {
  --paper:       #f1ede4;
  --paper-2:     #e9e3d4;
  --paper-3:     #ddd6c4;
  --ink:         #0d0d0d;
  --ink-2:       #2a2724;
  --muted:       #6e685c;
  --rule:        #b7ad97;
  --rule-soft:   #d6cfc0;

  /* accents */
  --red:         #b41818;
  --red-deep:    #7a0d0d;
  --amber:       #c97b00;
  --yellow:      #d4a829;
  --olive:       #686b1f;
  --critical:    #4a0808;

  /* severity */
  --sev-0:       #6e685c;  /*  <100  */
  --sev-1:       #c79522;  /* 100-119 */
  --sev-2:       #d9651a;  /* 120-139 */
  --sev-3:       #b41818;  /* 140-149 */
  --sev-4:       #4a0808;  /*  150+  */

  --shadow-card: 0 1px 0 var(--rule-soft);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'onum', 'tnum';
  -webkit-font-smoothing: antialiased;
}
.mono, code {
  font-family: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-feature-settings: 'tnum', 'zero';
}

/* ---------- structure ---------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 56px 120px;
}

/* faint paper texture using layered gradients */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0,0,0,0.04), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(0,0,0,0.05), transparent 60%);
  z-index: 0;
}
.page { position: relative; z-index: 1; }

hr.rule {
  border: 0; border-top: 1px solid var(--rule);
  margin: 32px 0;
}
hr.rule.double {
  border-top: 3px double var(--rule);
}
hr.rule.thin {
  border-top: 1px solid var(--rule-soft);
}

/* ---------- letterhead ---------- */
.letterhead {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  position: relative;
}
.letterhead .docmeta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.letterhead .docmeta b { color: var(--ink); font-weight: 500; }
.letterhead h1 {
  font-family: 'IBM Plex Serif', serif;
  font-weight: 500;
  font-size: 56px;
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.letterhead h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--red);
}
.letterhead .sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 16px;
}
.stamp {
  border: 2px solid var(--red);
  color: var(--red);
  padding: 10px 14px 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 600;
  text-align: center;
  transform: rotate(-4deg);
  background: rgba(241, 237, 228, 0.7);
  white-space: nowrap;
  align-self: start;
}
.stamp .big { font-size: 14px; letter-spacing: 0.28em; display: block; }
.stamp .small { font-size: 9px; letter-spacing: 0.18em; opacity: 0.8; display: block; margin-top: 4px; }

/* ---------- section headers ---------- */
.section-head {
  display: flex; align-items: baseline; gap: 16px;
  margin: 0 0 18px;
}
.section-head .num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 500;
}
.section-head h2 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}
.section-head .right {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- KPI strip ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.kpi {
  padding: 18px 16px;
  border-right: 1px solid var(--rule-soft);
}
.kpi:last-child { border-right: 0; }
.kpi .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.kpi .value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.kpi .value.danger { color: var(--red); }
.kpi .unit {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-left: 4px;
}
.kpi .sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--rule-soft); }
}

/* ---------- reference scale ---------- */
.ref-wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
}
.ref-scale {
  position: relative;
  border-left: 2px solid var(--ink);
  padding-left: 16px;
  min-height: 460px;
}
.ref-band {
  position: relative;
  padding: 6px 0;
  border-bottom: 1px dashed var(--rule-soft);
}
.ref-band:last-child { border-bottom: 0; }
.ref-band .lvl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
  width: 48px;
}
.ref-band .ex {
  font-family: 'IBM Plex Serif', serif;
  font-size: 13px;
  color: var(--ink-2);
}
.ref-band[data-tier="critical"] { background: rgba(180,24,24,0.06); }
.ref-band[data-tier="critical"] .lvl { color: var(--sev-4); }
.ref-band[data-tier="danger"]   { background: rgba(217,101,26,0.05); }
.ref-band[data-tier="danger"] .lvl { color: var(--sev-3); }
.ref-band[data-tier="loud"] .lvl    { color: var(--sev-2); }
.ref-band[data-tier="safe"]  { opacity: 0.62; }
.ref-band .tier {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-top: 2px;
  margin-left: 56px;
}

.ref-readings {
  position: relative;
  border-left: 1px solid var(--rule);
  padding-left: 20px;
}
.ref-readings h3 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 10px;
}
.ref-readings p {
  margin: 0 0 14px;
  color: var(--ink-2);
  max-width: 52ch;
}
.ref-readings .compare {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px 14px;
  align-items: center;
  border-top: 1px solid var(--rule-soft);
  padding-top: 14px;
  margin-top: 10px;
}
.ref-readings .compare .l {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.ref-readings .compare .bar {
  height: 6px; background: var(--paper-3); position: relative;
}
.ref-readings .compare .bar > span {
  position: absolute; top: 0; bottom: 0; left: 0;
}
.ref-readings .compare .v {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- daily timeline ---------- */
.timeline {
  border: 1px solid var(--rule);
  background: var(--paper);
}
.timeline-axis {
  display: grid;
  grid-template-columns: 110px 1fr 80px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.timeline-axis .ticks {
  position: relative; height: 12px;
}
.timeline-axis .ticks span {
  position: absolute; top: 0; transform: translateX(-50%);
  font-size: 9.5px;
}
.timeline-row {
  display: grid;
  grid-template-columns: 110px 1fr 80px;
  align-items: center;
  padding: 4px 14px;
  border-bottom: 1px solid var(--rule-soft);
  min-height: 28px;
}
.timeline-row:last-child { border-bottom: 0; }
.timeline-row.empty { opacity: 0.5; }
.timeline-row:hover { background: var(--paper-2); }
.timeline-row .date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink);
}
.timeline-row .date .dow {
  color: var(--muted);
  margin-left: 6px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.timeline-row .strip {
  position: relative;
  height: 22px;
  background:
    linear-gradient(to right,
      transparent 0, transparent calc(25% - 1px),
      var(--rule-soft) calc(25% - 1px), var(--rule-soft) 25%,
      transparent 25%, transparent calc(50% - 1px),
      var(--rule) calc(50% - 1px), var(--rule) 50%,
      transparent 50%, transparent calc(75% - 1px),
      var(--rule-soft) calc(75% - 1px), var(--rule-soft) 75%,
      transparent 75%);
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
}
.timeline-row .strip .mark {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sev-0);
  border: 1.5px solid var(--paper);
  cursor: pointer;
  transition: transform 0.1s;
}
.timeline-row .strip .mark[data-sev="1"] { background: var(--sev-1); width: 9px; height: 9px; }
.timeline-row .strip .mark[data-sev="2"] { background: var(--sev-2); width: 10px; height: 10px; }
.timeline-row .strip .mark[data-sev="3"] { background: var(--sev-3); width: 11px; height: 11px; }
.timeline-row .strip .mark[data-sev="4"] { background: var(--sev-4); width: 13px; height: 13px; box-shadow: 0 0 0 2px rgba(74,8,8,0.15); }
.timeline-row .strip .mark:hover {
  transform: translate(-50%, -50%) scale(1.6);
  z-index: 5;
}
.timeline-row .count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.timeline-row .count b { color: var(--ink); font-weight: 600; }
.timeline-row .count .peak {
  font-size: 10px; display: block; line-height: 1.2;
}
.timeline-row .count .peak.danger { color: var(--red); font-weight: 600; }

/* ---------- filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
}
.filters .group {
  display: flex; flex-direction: column; gap: 4px;
}
.filters label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.filters input[type="date"],
.filters input[type="text"],
.filters input[type="number"],
.filters select {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 6px 10px;
  color: var(--ink);
  border-radius: 0;
}
.filters input:focus, .filters select:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}
.filters .spacer { flex: 1; }
.filters .actions { display: flex; gap: 8px; }

.btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 8px 14px;
  cursor: pointer;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.danger { background: var(--red); border-color: var(--red); }

/* chip group (time windows) */
.chips {
  display: flex; gap: 0;
  border: 1px solid var(--rule);
}
.chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  cursor: pointer;
  color: var(--ink-2);
  user-select: none;
}
.chip:last-child { border-right: 0; }
.chip.on { background: var(--ink); color: var(--paper); }

/* ---------- table ---------- */
.table-wrap {
  border: 1px solid var(--rule);
  border-top: 0;
}
table.log {
  width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
}
table.log thead th {
  text-align: left;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
table.log thead th:hover { color: var(--ink); }
table.log thead th .arr {
  display: inline-block;
  width: 10px;
  color: var(--muted);
}
table.log tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
table.log tbody tr:hover { background: var(--paper-2); }
table.log .num { text-align: right; }
table.log .id { color: var(--muted); width: 56px; }
table.log .date { white-space: nowrap; }
table.log .time { white-space: nowrap; }
table.log .win { color: var(--muted); }

.sev-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.sev-chip[data-sev="0"] { color: var(--sev-0); }
.sev-chip[data-sev="1"] { color: var(--sev-1); border-color: rgba(199,149,34,0.4); background: rgba(199,149,34,0.08); }
.sev-chip[data-sev="2"] { color: var(--sev-2); border-color: rgba(217,101,26,0.4); background: rgba(217,101,26,0.08); }
.sev-chip[data-sev="3"] { color: var(--paper); background: var(--sev-3); border-color: var(--sev-3); }
.sev-chip[data-sev="4"] { color: var(--paper); background: var(--sev-4); border-color: var(--sev-4); }
.sev-chip::before {
  content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%;
}
.sev-chip[data-sev="3"]::before,
.sev-chip[data-sev="4"]::before { background: var(--paper); }

.legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 14px 0 0;
}
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .dot {
  width: 10px; height: 10px; border-radius: 50%;
}

/* ---------- pagination ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.pager .controls { display: flex; gap: 6px; }
.pager .pg {
  background: transparent;
  border: 1px solid var(--rule);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink-2);
}
.pager .pg:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager .pg:disabled { opacity: 0.4; cursor: default; }
.pager .pg:disabled:hover { background: transparent; color: var(--ink-2); }

/* ---------- footer / instructions ---------- */
.instructions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 12px;
}
.instructions h3 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 10px;
}
.instructions p, .instructions li { color: var(--ink-2); }
.instructions ol { padding-left: 20px; }
.instructions code {
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  padding: 1px 5px;
  font-size: 12px;
}
.instructions pre {
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  padding: 10px 12px;
  font-size: 11.5px;
  overflow: auto;
  font-family: 'IBM Plex Mono', monospace;
}

/* ---------- quick-add panel ---------- */
.quickadd {
  border: 1px solid var(--rule);
  background: var(--paper);
}
.quickadd-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-2);
}
.quickadd-head h3 {
  margin: 0 0 6px;
  font-family: 'IBM Plex Serif', serif;
  font-size: 17px;
  font-weight: 500;
}
.quickadd-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-2);
  max-width: 80ch;
}
.quickadd-head kbd {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 1px 6px;
  border-bottom-width: 2px;
}

.quickadd-form {
  display: grid;
  grid-template-columns: 160px 130px 160px 1fr 1fr auto;
  gap: 14px;
  padding: 18px 20px;
  align-items: end;
  border-bottom: 1px solid var(--rule-soft);
}
.qa-field { display: flex; flex-direction: column; gap: 4px; }
.qa-field.grow { min-width: 0; }
.qa-field label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.qa-field input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  border-radius: 0;
}
.qa-field input:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}
.qa-field input.flash {
  animation: flash-ok 0.6s ease;
}
@keyframes flash-ok {
  0%   { background: rgba(104, 107, 31, 0.25); }
  100% { background: var(--paper); }
}
.qa-field button {
  padding: 9px 14px;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.qa-pending {
  padding: 14px 20px 18px;
  border-bottom: 1px solid var(--rule-soft);
}
.qa-pending-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.qa-pending-list {
  list-style: none;
  margin: 0; padding: 0;
  border: 1px solid var(--rule-soft);
  max-height: 240px;
  overflow-y: auto;
  background: var(--paper-2);
}
.qa-pending-list li {
  display: grid;
  grid-template-columns: 56px 1fr 1fr 90px 110px 1fr 32px;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--rule-soft);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
}
.qa-pending-list li:last-child { border-bottom: 0; }
.qa-pending-list li:nth-child(odd) { background: var(--paper); }
.qa-pending-list li .id { color: var(--muted); font-size: 11px; }
.qa-pending-list li .rm {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  width: 24px; height: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.qa-pending-list li .rm:hover {
  background: var(--red);
  color: var(--paper);
  border-color: var(--red);
}

.qa-bulk {
  padding: 0 20px;
  border-top: 0;
}
.qa-bulk summary {
  cursor: pointer;
  padding: 14px 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
  user-select: none;
}
.qa-bulk summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s;
  transform-origin: center;
  margin-right: 4px;
}
.qa-bulk[open] summary::before { content: '▾ '; }
.qa-bulk summary:hover { color: var(--ink); }
.qa-bulk-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  padding-bottom: 20px;
}
.qa-bulk-body p, .qa-bulk-body li { color: var(--ink-2); font-size: 13.5px; }

@media (max-width: 900px) {
  .quickadd-form { grid-template-columns: 1fr 1fr; }
  .quickadd-form .qa-field:last-child { grid-column: 1 / -1; }
  .qa-bulk-body { grid-template-columns: 1fr; }
  .qa-pending-list li {
    grid-template-columns: 50px 1fr 1fr 70px 1fr 28px;
  }
  .qa-pending-list li .notes-cell { display: none; }
}

/* ---------- lock screen ---------- */
.lock-screen {
  position: fixed; inset: 0;
  background: var(--ink);
  color: var(--paper);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lock-screen[hidden] { display: none; }
.lock-screen::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(800px 400px at 50% 30%, rgba(180,24,24,0.18), transparent 60%),
    radial-gradient(600px 400px at 80% 90%, rgba(217,101,26,0.10), transparent 60%);
  pointer-events: none;
}
.lock-card {
  position: relative;
  max-width: 460px;
  width: 100%;
  text-align: center;
  z-index: 1;
}
.lock-card .stamp {
  margin: 0 auto 28px;
  display: inline-block;
  border-color: var(--red);
  color: var(--red);
  background: rgba(13, 13, 13, 0.5);
}
.lock-card h1 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 8px;
  color: var(--paper);
}
.lock-card p {
  font-family: 'IBM Plex Serif', serif;
  font-size: 15px;
  margin: 0 0 24px;
  color: rgba(241, 237, 228, 0.7);
}
.lock-card form { display: flex; gap: 8px; }
.lock-card input[type="password"] {
  flex: 1;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  background: transparent;
  border: 1px solid rgba(241, 237, 228, 0.3);
  color: var(--paper);
  padding: 12px 14px;
  border-radius: 0;
  letter-spacing: 0.1em;
}
.lock-card input[type="password"]:focus {
  outline: 2px solid var(--paper);
  outline-offset: -1px;
}
.lock-card .btn {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
  padding: 12px 20px;
}
.lock-card .btn:hover {
  background: var(--red);
  color: var(--paper);
  border-color: var(--red);
}
.lock-card .btn:disabled {
  opacity: 0.5; cursor: wait;
}
.lock-error {
  margin-top: 14px;
  color: var(--red);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-height: 18px;
}
.lock-meta {
  margin-top: 36px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(241, 237, 228, 0.4);
  display: flex; flex-direction: column; gap: 4px;
}

body.locked { overflow: hidden; }

/* ---------- encryption banner ---------- */
.enc-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  margin-bottom: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  border: 1px solid var(--rule);
  border-bottom: 0;
  background: var(--paper-2);
}
.enc-banner.unencrypted {
  background: rgba(180, 24, 24, 0.08);
  border-color: rgba(180, 24, 24, 0.4);
}
.enc-banner.encrypted {
  background: rgba(104, 107, 31, 0.10);
  border-color: rgba(104, 107, 31, 0.4);
}
.enc-banner .icon {
  font-size: 16px;
  width: 24px; text-align: center;
}
.enc-banner .label { font-weight: 600; color: var(--ink); letter-spacing: 0.08em; text-transform: uppercase; }
.enc-banner .desc { color: var(--ink-2); flex: 1; letter-spacing: 0; font-size: 12.5px; }
.enc-banner .actions { display: flex; gap: 6px; }
.enc-banner .btn {
  padding: 6px 12px;
  font-size: 11px;
}

/* ---------- pw modal ---------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(13, 13, 13, 0.75);
  z-index: 150;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-bg[hidden] { display: none; }
.modal {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 24px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.modal h3 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 6px;
}
.modal p {
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: 14px;
}
.modal label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  margin-top: 10px;
}
.modal input[type="password"] {
  width: 100%;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  padding: 10px 12px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  letter-spacing: 0.06em;
}
.modal input[type="password"]:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}
.modal .warn {
  background: rgba(180, 24, 24, 0.08);
  border-left: 3px solid var(--red);
  padding: 10px 12px;
  font-size: 12.5px;
  margin: 16px 0 0;
  color: var(--ink-2);
}
.modal .warn b { color: var(--red); }
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 20px;
}
.modal-error {
  margin-top: 10px;
  color: var(--red);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-height: 16px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; letter-spacing: 0.08em;
  padding: 10px 18px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* drop indicator */
body.dragging::after {
  content: 'DROP CSV TO LOAD';
  position: fixed; inset: 0;
  background: rgba(13,13,13,0.85); color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 28px; letter-spacing: 0.3em;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  pointer-events: none;
}

/* small hour-of-day histogram */
.hod {
  display: grid;
  grid-template-columns: 100px 1fr 60px;
  gap: 14px;
  align-items: center;
  padding: 4px 0;
}
.hod .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.hod .bar {
  height: 14px;
  background: var(--paper-3);
  position: relative;
}
.hod .bar > span {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--sev-3);
}
.hod .v {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  text-align: right;
  color: var(--ink);
}

/* tooltip */
.tt {
  position: fixed;
  background: var(--ink);
  color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 6px 9px;
  pointer-events: none;
  z-index: 60;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s;
}
.tt.show { opacity: 1; }

/* responsive */
@media (max-width: 900px) {
  .page { padding: 32px 20px 80px; }
  .letterhead h1 { font-size: 36px; }
  .ref-wrap { grid-template-columns: 1fr; }
  .instructions { grid-template-columns: 1fr; }
  .timeline-axis, .timeline-row { grid-template-columns: 90px 1fr 60px; }
}

/* row delete button */
.btn-del-row {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 12px; padding: 2px 5px;
  border-radius: 3px; line-height: 1; opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}
.btn-del-row:hover { color: #c0392b; opacity: 1; }
