/* ACOS — restrained municipal/nonprofit. Colour is reserved for status and urgency,
   so that when something IS red it means something (docs/UX.md §10).
   Self-hosted only: no web fonts, no CDN, no third-party requests. */

:root {
  --ink: #1b1f24;
  --ink-soft: #5b6570;
  --line: #dde3ea;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --brand: #14507a;
  --brand-dark: #0e3c5c;
  --ok: #1c6b3f;
  --ok-bg: #e6f4ec;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --danger: #a02020;
  --danger-bg: #fbecec;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
p { margin: 0 0 12px; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--brand); color: #fff; padding: 10px 20px;
}
.brand { color: #fff; font-weight: 700; letter-spacing: .06em; text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: .9rem; }
.agency { opacity: .85; }

.shell { display: flex; min-height: calc(100vh - 46px); align-items: flex-start; }

.sidebar {
  width: 220px; flex: 0 0 220px; padding: 18px 12px; background: var(--panel);
  border-right: 1px solid var(--line); min-height: calc(100vh - 46px);
}
.sidebar a {
  display: block; padding: 9px 12px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-size: .95rem;
}
.sidebar a:hover { background: var(--bg); }
.sidebar a.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-note {
  margin-top: 18px; padding: 10px 12px; font-size: .8rem;
  color: var(--ink-soft); border-top: 1px solid var(--line);
}

.content { flex: 1; padding: 26px 30px; max-width: 1080px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; flex-wrap: wrap;
}
.head-actions { display: flex; gap: 8px; }
.lead { color: var(--ink-soft); max-width: 70ch; margin-bottom: 18px; }

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-attention { border-left: 4px solid var(--warn); }
.panel-info { border-left: 4px solid var(--brand); }
.panel.empty { text-align: left; }

.card-narrow {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; width: 100%; max-width: 400px;
}

/* ---------------------------------------------------------------- tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: var(--ink); display: block;
}
.tile:hover { border-color: var(--brand); }
.tile-number { display: block; font-size: 2rem; font-weight: 700; line-height: 1.1; }
.tile-label { display: block; font-size: .85rem; color: var(--ink-soft); margin-top: 2px; }
.tile-warn { border-left: 4px solid var(--warn); }
.tile-muted { opacity: .75; }

/* ---------------------------------------------------------------- callouts */

.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--ink-soft);
  background: var(--panel); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; font-size: .93rem;
}
.callout-ok { border-left-color: var(--ok); background: var(--ok-bg); }
.callout-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout-locked { border-left-color: var(--danger); background: var(--danger-bg); }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: .95rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe0cd; }
.flash-warning { background: var(--warn-bg); color: var(--warn); border: 1px solid #ecd9b0; }
.flash-error   { background: var(--danger-bg); color: var(--danger); border: 1px solid #edc4c4; }

/* ---------------------------------------------------------------- forms */

.stack { display: flex; flex-direction: column; gap: 4px; }
.form-wide { max-width: 780px; }
label { font-weight: 600; font-size: .9rem; margin-top: 12px; }
.req { color: var(--danger); font-weight: 400; font-size: .78rem; }
.optional { color: var(--ink-soft); font-weight: 400; font-size: .78rem; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius); font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox input { width: auto; }
.hint { font-size: .84rem; color: var(--ink-soft); margin: 4px 0 0; max-width: 68ch; }
.actions { margin-top: 18px; }

button, .button {
  display: inline-block; padding: 9px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { border-color: var(--brand); }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.link-button {
  background: none; border: none; color: inherit; padding: 0;
  text-decoration: underline; font-weight: 400; cursor: pointer;
}
.inline { display: inline; }

/* ---------------------------------------------------------------- tables */

.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.table tbody tr:hover { background: var(--bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.detail { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; margin: 0; font-size: .93rem; }
.detail dt { font-weight: 600; color: var(--ink-soft); }
.detail dd { margin: 0; word-break: break-word; }

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 11px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
/* Status carries colour AND a word — colour is never the only signal (WCAG 1.4.1). */
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: #eef1f4; color: var(--ink-soft); }

/* ---------------------------------------------------------------- law text */

.lawtext {
  font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.7;
  white-space: pre-wrap; background: #fcfcfa; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; max-width: 76ch;
}
.extract {
  width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .8rem; line-height: 1.45; background: #fbfbfc;
}
.steps { padding-left: 20px; margin: 0 0 10px; }
.steps li { margin-bottom: 5px; }

.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.small { font-size: .82rem; }
.muted { color: var(--ink-soft); }

.logo { text-align: center; letter-spacing: .1em; margin-bottom: 0; }
.subtitle { text-align: center; color: var(--ink-soft); font-size: .9rem; margin-bottom: 20px; }
.error-status { font-size: 2.4rem; text-align: center; color: var(--ink-soft); margin: 8px 0; }
.error-message { text-align: center; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; min-height: 0; display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar a { flex: 1 1 auto; text-align: center; }
  .nav-note { display: none; }
  .content { padding: 18px 16px; }
  .detail { grid-template-columns: 1fr; }
  .detail dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- find a law
   Built for an officer on a phone, possibly one-handed, possibly in sunlight.
   Big search field, big tap targets, and status stated in words as well as colour. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.lawsearch {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}
.lawsearch input[type=search] {
  font-size: 1.1rem;        /* >=16px stops iOS zooming the page on focus */
  padding: 13px 14px;
}
.lawsearch button { padding: 13px 22px; }
.lawsearch-filters {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.lawsearch-filters select { padding: 10px 11px; }

.searchnote { margin: 0 0 14px; }
.resultcount { font-size: .88rem; color: var(--ink-soft); margin: 14px 0 8px; }

.lawlist { list-style: none; margin: 0 0 20px; padding: 0; }

.lawitem {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 8px;
}
.lawitem-unverified { border-left: 4px solid var(--warn); }

/* The whole card is the tap target, not just the title. */
.lawitem-link {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  min-height: 56px;
}
.lawitem-link:hover, .lawitem-link:focus-visible { background: var(--bg); }
.lawitem-link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.lawitem-head { display: block; margin-bottom: 3px; }
.lawitem-num {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: .84rem;
  margin-right: 7px;
}
.lawitem-title { font-weight: 600; }
.lawitem-meta { display: block; font-size: .82rem; color: var(--ink-soft); }
.lawitem-badges { display: block; margin-top: 7px; }
.lawitem-badges .badge { margin-right: 5px; }
.lawitem-snippet {
  display: block;
  margin-top: 9px;
  font-size: .88rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.lawitem-snippet mark {
  background: #fff3bf;
  color: var(--ink);
  padding: 0 1px;
  font-weight: 600;
}

.plainlist { margin: 0; padding-left: 20px; font-size: .92rem; }
.plainlist li { margin-bottom: 5px; }

@media (max-width: 560px) {
  .lawsearch { grid-template-columns: 1fr; }
  .lawsearch button { width: 100%; }
}
