/* Perseus light dashboard system. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --background: 220 14% 97%;
  --foreground: 220 15% 12%;
  --card: 0 0% 100%;
  --border: 220 10% 88%;
  --primary: 220 15% 12%;
  --primary-foreground: 220 14% 97%;
  --sidebar-background: 220 12% 96%;
  --muted-readable: 220 5% 42%;
  --page: hsl(var(--background));
  --surface: hsl(var(--card));
  --ink: hsl(var(--foreground));
  --line: hsl(var(--border));
  --accent: hsl(var(--primary));
  --font: "Inter", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 0.25rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--page); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
button { font: inherit; }
input, select { font: inherit; }
:focus-visible { outline: 2px solid hsl(var(--foreground)); outline-offset: 2px; border-radius: var(--radius); }
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: hsl(var(--primary-foreground)); transition: top .15s ease; }
.skip-link:focus { top: 8px; }
.app { min-height: 100%; }
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--line); background: hsl(var(--sidebar-background)); }
.appbar__brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: inline-grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: var(--surface); font: 600 13px var(--mono); }
.appbar__title { line-height: 1.1; }
.appbar__title strong { font-size: 1rem; letter-spacing: .02em; }
.workspace { width: 100%; max-width: 1396px; margin: 0 auto; padding: 24px 28px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head__title { margin: 0; font-size: 1.33rem; font-weight: 600; line-height: 1.25; }
.segmented { display: flex; gap: 0 4px; margin-bottom: 18px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.segmented__btn { padding: 8px 12px 7px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: hsl(var(--muted-readable)); cursor: pointer; font-size: .8rem; white-space: nowrap; }
.segmented__btn:hover { color: var(--ink); }
.segmented__btn.is-active { border-bottom-color: var(--ink); color: var(--ink); font-weight: 600; }
.coverage-note, .notice, .status { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); color: hsl(var(--muted-readable)); }
.notice h2 { margin: 0 0 4px; color: var(--ink); font-size: 1rem; }
.notice p { margin: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.summary-card { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); }
.summary-card span { color: hsl(var(--muted-readable)); font-size: .75rem; }
.summary-card strong { font: 600 1.2rem var(--mono); }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(9rem, 1fr)) minmax(16rem, 2fr); align-items: end; gap: 12px; margin-bottom: 14px; }
.filter-control { display: grid; gap: 3px; }
.filter-control label, .filter-grid .search-form label { font-size: .75rem; font-weight: 600; }
.filter-control select { width: 100%; min-height: 38px; padding: 7px 28px 7px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.jurisdiction-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); }
.jurisdiction-switch button, .pager button, .detail-head button, .search-form button { padding: 7px 10px; border: 0; background: var(--surface); cursor: pointer; }
.jurisdiction-switch button + button { border-left: 1px solid var(--line); }
.jurisdiction-switch button.is-active { background: var(--ink); color: var(--surface); }
.search-form label { display: block; margin-bottom: 3px; font-size: .75rem; font-weight: 600; }
.search-form > div { display: flex; }
.search-form input { min-width: 240px; padding: 7px 9px; border: 1px solid var(--line); background: var(--surface); }
.search-form button { border: 1px solid var(--ink); background: var(--ink); color: var(--surface); }
.city-typeahead { position: relative; max-width: 440px; margin: 16px 0; }
.city-typeahead label { display: grid; gap: 4px; font-size: .75rem; font-weight: 600; }
.city-typeahead input { padding: 8px 10px; border: 1px solid var(--line); background: var(--surface); }
.city-typeahead-dropdown { position: absolute; z-index: 2; width: 100%; background: var(--surface); box-shadow: 0 4px 12px rgb(0 0 0 / 15%); }
.city-typeahead-row, .city-typeahead-empty { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-top: 0; background: var(--surface); color: inherit; text-align: left; }
.city-typeahead-row { cursor: pointer; }
.city-typeahead-row:hover, .city-typeahead-row:focus { background: hsl(var(--sidebar-background)); }
.city-typeahead-badge { font-size: .75rem; white-space: nowrap; }
.city-typeahead-empty { flex-wrap: wrap; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { background: hsl(var(--sidebar-background)); font-size: .72rem; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { min-width: 180px; max-width: 420px; white-space: normal; overflow-wrap: anywhere; }
td.number { font-family: var(--mono); }
td.number, th.number { text-align: right; }
td small { display: block; color: hsl(var(--muted-readable)); font-family: var(--mono); }
.coverage-badges { display: flex; flex-wrap: wrap; gap: 4px; min-width: 230px; }
.coverage-badge { display: inline-flex; padding: 2px 6px; border: 1px solid var(--line); border-radius: 999px; background: hsl(var(--sidebar-background)); color: hsl(var(--muted-readable)); font-size: .68rem; white-space: normal; }
.coverage-available { border-color: #6c9672; color: #315f38; }
.coverage-partial { border-color: #b08a38; color: #745816; }
.coverage-not_collected, .coverage-not_published, .coverage-parse_failed { border-color: #a87672; color: #762f2b; }
.collection-note, .coverage-notes { color: hsl(var(--muted-readable)); font-size: .78rem; }
.coverage-notes { margin: 0 0 8px; padding-left: 20px; }
.document-list { margin: 0; padding-left: 20px; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; text-decoration: underline; }
.pager { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 20px; color: hsl(var(--muted-readable)); font-size: .78rem; }
.pager button { border: 1px solid var(--line); }
.pager button + button { margin-left: 6px; }
.pager button:disabled { cursor: default; opacity: .45; }
.contract-detail { scroll-margin-top: 20px; }
.contract-detail:not(:empty) { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.detail-head h2 { margin: 0 0 10px; max-width: 850px; overflow-wrap: anywhere; font-size: 1.1rem; }
.eyebrow { margin: 0 0 2px; color: hsl(var(--muted-readable)); font: .72rem var(--mono); }
.metadata { display: flex; gap: 28px; margin: 0 0 14px; }
.metadata div { display: grid; }
.metadata dt { color: hsl(var(--muted-readable)); font-size: .7rem; }
.metadata dd { margin: 0; }
.contract-detail h3 { margin: 18px 0 7px; font-size: .9rem; }
.status.error { border-color: #b34a45; color: #762f2b; }

.live-top-bar { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.live-top-bar > .summary-grid { flex: 1; margin-bottom: 0; }
.live-refresh-bar { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); min-width: 130px; text-align: center; }
.live-last-updated { color: hsl(var(--muted-readable)); font-size: .72rem; line-height: 1.3; }
.live-refresh-message { color: hsl(var(--muted-readable)); font-size: .72rem; line-height: 1.3; min-height: 1em; }
.live-refresh-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: background .15s, transform .15s; }
.live-refresh-button:hover:not(:disabled) { background: var(--line); }
.live-refresh-button:disabled { cursor: default; opacity: .45; }
.live-refresh-button.is-refreshing svg { animation: spin-refresh .8s linear infinite; }
@keyframes spin-refresh { to { transform: rotate(360deg); } }

@media (min-width: 901px) {
  .appbar { position: fixed; inset: 0 auto 0 0; width: 216px; height: 100vh; flex-direction: column; align-items: stretch; padding: 18px 12px; border-right: 1px solid var(--line); border-bottom: 0; }
  .appbar__brand { padding: 0 6px; }
  .app-content { margin-left: 216px; }
  .workspace { width: calc(100% - 56px); margin-left: max(28px, calc((100vw - 216px - 1396px) / 2)); margin-right: 0; }
}
@media (max-width: 1100px) { .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .workspace { padding: 14px; } .summary-grid { grid-template-columns: repeat(2, 1fr); } .toolbar { align-items: stretch; flex-direction: column; } .filter-grid { grid-template-columns: 1fr; } .search-form input { min-width: 0; width: 100%; } .table-scroll { max-width: calc(100vw - 28px); } .metadata { flex-wrap: wrap; gap: 12px 24px; } .live-top-bar { flex-direction: column; } .live-refresh-bar { flex-direction: row; width: 100%; min-width: 0; } }
