/* Maynard Breach Tracker — design system.
   Ported verbatim from the design canvas. Fonts are self-hosted: this app
   makes no third-party requests of any kind (PRD §8). */

@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* Author display rules (.modal-back{display:flex} etc.) outrank the browser's
   built-in [hidden]{display:none}, which silently breaks every hidden element.
   This restores it for good. */
[hidden] { display: none !important; }

:root {
  --navy: #1e3a5f; --navy-dark: #14283f; --green: #2e7d32; --amber: #f9a825;
  --red: #c62828; --red-ink: #a11d1d; --amber-ink: #8a5200;
  --bg: #f5f5f5; --card: #ffffff; --line: #d8dde3; --line-soft: #e4e8ec;
  --ink: #1a1f26; --ink-2: #333c47; --muted: #4b5560; --muted-2: #5b6672;
  /* Control borders and small state marks must clear 3:1 against white
     (WCAG 1.4.11). The old --line (#c3ccd6, 1.62:1) is fine as a decorative
     divider but was also carrying every input edge and the "in progress" mark. */
  --line-strong: #8a95a3;
  --amber-mark: #b57400;
}

/* Visible only to assistive technology. Was referenced before it existed. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: #fff; color: var(--navy); border: 2px solid var(--navy);
  padding: 10px 16px; border-radius: 4px; font-weight: 600; text-decoration: none;
  transition: top .12s ease;
}
.skip:focus { top: 8px; }

/* One visible focus ring everywhere, not just on inputs. */
a:focus-visible, .btn:focus-visible, .chip:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 3px;
}
.topbar a:focus-visible, .topbar button:focus-visible,
.nav a:focus-visible, .btn.pri:focus-visible {
  outline: 2px solid #ffd24a; outline-offset: 2px;
}
.checklist-row:hover { background: #f7f9fb; }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: #f5f5f5; color: #1a1f26;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Helvetica, sans-serif;
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: #1e3a5f; text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: #c62828; }
button { font: inherit; color: inherit; cursor: pointer; }
select, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-feature-settings: "zero"; }

/* ---- app shell ---- */
.app { min-height: 100%; display: flex; flex-direction: column; background: #f5f5f5; }
.topbar { background: #1e3a5f; color: #fff; padding: 13px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.topbar .brandline { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.topbar .sub { font-size: 12px; color: #bacbdf; letter-spacing: 0.02em; margin-top: 2px; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cfdcea; }
.avatar { width: 30px; height: 30px; border-radius: 3px; background: #35577f; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; letter-spacing: 0.03em; }
.nav { background: #14283f; padding: 0 28px; display: flex; gap: 2px; }
.tab { display: flex; align-items: center; gap: 7px; padding: 11px 15px 10px; font-size: 13.5px; font-weight: 500; color: #9fb6d0; background: transparent; border: 0; border-bottom: 3px solid transparent; }
.tab:hover { color: #e6eef7; }
.tab.on { background: #f5f5f5; color: #1e3a5f; font-weight: 600; border-bottom-color: #f9a825; }
.page { flex-grow: 1; padding: 20px 28px 28px; display: flex; flex-direction: column; gap: 18px; }

/* ---- cards ---- */
.card { background: #fff; border: 1px solid #d8dde3; border-radius: 4px; display: flex; flex-direction: column; }
.card > .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-bottom: 1px solid #e4e8ec; background: #fafbfc; border-radius: 4px 4px 0 0; }
.card > .hd h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: #1e3a5f; }
.card > .hd .meta { font-size: 12px; color: #5b6672; }
.card > .bd { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ---- badges + pills ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border: 1px solid transparent; white-space: nowrap; }
.badge svg { flex-shrink: 0; }
.b-crit { background: #fdeaea; color: #a11d1d; border-color: #f0bcbc; }
.b-high { background: #fdf1e0; color: #8a5200; border-color: #eccfa0; }
.b-med  { background: #eef2f7; color: #33507a; border-color: #c9d6e6; }
.b-low  { background: #f0f2f4; color: #5b6672; border-color: #d8dde3; }
.b-done { background: #e7f2e8; color: #1f5d23; border-color: #b8d9bb; }
.b-prog { background: #fdf6e0; color: #7a5c00; border-color: #e8d391; }
.b-todo { background: #f0f2f4; color: #4b5560; border-color: #d3d9df; }
.b-red  { background: #c62828; color: #fff; border-color: #a11d1d; }
.b-amber{ background: #f9a825; color: #3d2a00; border-color: #d99100; }
.b-green{ background: #2e7d32; color: #fff; border-color: #24632a; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 3px; font-size: 13.5px; font-weight: 500; border: 1px solid #c3ccd6; background: #fff; color: #1e3a5f; }
.btn:hover { background: #eef2f7; border-color: #9fb2c6; }
.btn.pri { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
.btn.pri:hover { background: #14283f; border-color: #14283f; }
.btn.icon { padding: 6px; }
.chip { padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; border: 1px solid #c3ccd6; background: #fff; color: #3c4652; }
.chip:hover { border-color: #1e3a5f; }
.chip.on { background: #1e3a5f; border-color: #1e3a5f; color: #fff; font-weight: 600; }

/* ---- form controls ---- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #5b6672; }
.ctl { padding: 7px 9px; border: 1px solid #c3ccd6; border-radius: 3px; background: #fff; font-size: 13.5px; }
.ctl:focus { outline: 2px solid #1e3a5f; outline-offset: -1px; }
.search { display: flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid #c3ccd6; border-radius: 3px; background: #fff; color: #5b6672; }
.search input { border: 0; outline: 0; padding: 7px 0; font-size: 13.5px; width: 100%; background: transparent; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 14px; background: #fff; border: 1px solid #d8dde3; border-radius: 4px; }
.toolbar .lbl { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #5b6672; }

/* ---- tables ---- */
.tw { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #5b6672; padding: 9px 12px; background: #fafbfc; border-bottom: 1px solid #d8dde3; white-space: nowrap; }
table.grid td { padding: 11px 12px; border-bottom: 1px solid #eaeef2; vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
.rowmark { border-left: 4px solid transparent; }

/* ---- progress ---- */
.track { height: 10px; border-radius: 999px; background: #e2e6ea; overflow: hidden; }
.track > i { display: block; height: 100%; background: #2e7d32; border-radius: 999px; }
.track.sm { height: 6px; }

/* ---- misc ---- */
.k { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #5b6672; }
.muted { color: #5b6672; }
.divider { height: 1px; background: #e4e8ec; }
.empty { padding: 40px 16px; text-align: center; color: #4b5560; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
[hidden] { display: none !important; }
.modal-back { position: fixed; inset: 0; overflow-y: auto; background: rgba(20, 40, 63, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; z-index: 50; }
.modal-back[hidden] { display: none !important; }
.modal { width: 620px; max-width: 100%; background: #fff; border-radius: 5px; box-shadow: 0 18px 48px rgba(10, 22, 38, 0.35); display: flex; flex-direction: column; }

/* ---- links inside the app shell ---- */
.tab { text-decoration: none; }
.tab.on { text-decoration: none; }
a.btn, a.chip { text-decoration: none; }

/* ---- flash + inline feedback ---- */
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: 4px; font-size: 13.5px; border: 1px solid; }
.flash.ok { background: #e7f2e8; border-color: #b8d9bb; color: #1f5d23; }
.flash.err { background: #fdeaea; border-color: #f0bcbc; color: #8f1a1a; }
.saving { font-size: 12px; color: var(--muted-2); }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--navy-dark); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 5px; overflow: hidden; box-shadow: 0 22px 60px rgba(6, 16, 28, .45); }

/* Reference hub card columns. A phone gets one column — two overflow. */
.card-columns { columns: 2; column-gap: 18px; }
.card-columns > * { break-inside: avoid; }
@media (max-width: 900px) { .card-columns { columns: 1; } }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .split { flex-direction: column !important; }
  .split > * { width: 100% !important; max-width: none !important; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar { padding: 11px 14px; flex-wrap: wrap; gap: 10px; }
  .nav { padding: 0 8px; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .page { padding: 14px 14px 22px; }
  .toolbar { padding: 11px; }
  .search { width: 100% !important; }
  .grid-2 { grid-template-columns: minmax(0, 1fr) !important; }
  .row-desktop .desktop-date { display: none; }
  .modal-back { padding: 20px 12px; }
  .checklist-row { flex-wrap: wrap; }
  .checklist-row .grow { flex-basis: 100%; }
}

/* Touch targets stay at 44px on small screens (PRD §7). */
@media (max-width: 720px) {
  .btn, .chip, .tab, select.ctl, input.ctl { min-height: 44px; }
  .btn.icon { min-width: 44px; }
}

/* ---- print summary (PRD §4.7) ---- */
@media print {
  @page { size: letter portrait; margin: 12mm; }
  body { background: #fff; font-size: 10.5pt; }
  .no-print, .topbar, .nav, .toolbar, .flash { display: none !important; }
  .card { border-color: #999; break-inside: avoid; }
  .page { padding: 0; gap: 12px; }
  a { color: #000; text-decoration: none; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
