:root {
  --ink: #17212b;
  --muted: #65717d;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --line: #dce2dc;
  --brand: #155b4b;
  --brand-dark: #0d4035;
  --accent: #f0b44d;
  --danger: #a73535;
  --success: #287a50;
  --shadow: 0 12px 32px rgb(23 33 43 / 8%);
}

* { box-sizing: border-box; }
html { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-width: 320px; }
a { color: var(--brand-dark); }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 20; background: var(--surface); padding: .75rem; }
.skip-link:focus { top: 1rem; }
.site-header { display: flex; justify-content: space-between; gap: 2rem; padding: 1rem clamp(1rem, 4vw, 3rem); background: var(--brand-dark); color: white; }
.brand-block, .identity { display: flex; flex-direction: column; gap: .2rem; }
.brand { color: white; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.environment-label, .identity span { color: #c6ddd7; font-size: .8rem; }
.user-tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
.compact-form { display: flex; gap: .45rem; align-items: center; }
.compact-form label { font-size: .8rem; }
.compact-form select { width: auto; }
.main-nav { display: flex; gap: .25rem; padding: 0 clamp(1rem, 4vw, 3rem); overflow-x: auto; background: #123c34; }
.main-nav a { color: #d9e9e5; text-decoration: none; padding: .85rem 1rem; white-space: nowrap; border-bottom: 3px solid transparent; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: white; border-color: var(--accent); }
.page-shell { max-width: 1500px; margin: 0 auto; padding: 1.25rem clamp(1rem, 3vw, 2.25rem) 3rem; }
.page-meta, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-meta { color: var(--muted); font-size: .82rem; margin-bottom: 1rem; }
.page-meta p { margin: 0; }
.page-heading { margin-bottom: 1.25rem; }
.page-heading h1 { margin: .15rem 0; font-size: clamp(1.8rem, 3vw, 2.55rem); letter-spacing: -.03em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--brand) !important; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: .72rem; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .8rem; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; box-shadow: var(--shadow); }
.metric-card { padding: 1rem; min-height: 8rem; display: flex; flex-direction: column; gap: .45rem; }
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card strong { font-size: clamp(1.35rem, 2vw, 1.9rem); }
.compact-metrics { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 1rem 0; }
.context-note { color: var(--muted); font-size: .88rem; line-height: 1.55; }
.overview-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-top: 1rem; }
.panel { padding: 1rem; }
.panel-wide { grid-column: 1 / -1; }
.panel h2 { margin-top: 0; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.chart-grid figure { margin: 0; height: 340px; display: flex; flex-direction: column; min-width: 0; }
.chart-grid canvas { flex: 1; min-height: 0; width: 100% !important; height: 295px !important; }
.chart-grid figcaption, table caption { text-align: left; font-weight: 750; margin-bottom: .6rem; }
.chart-summary { margin-top: 1rem; }
.status-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.status-counts div { background: var(--paper); padding: .75rem; border-radius: .6rem; display: flex; flex-direction: column; }
.status-counts strong, .large-number { font-size: 1.8rem; font-weight: 800; margin: .2rem 0; }
.status-counts span { color: var(--muted); font-size: .78rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: .55rem 0; }
.filter-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .85rem; background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; padding: 1rem; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.field-help { color: var(--muted); font-size: .75rem; }
input, select { width: 100%; min-height: 2.55rem; border: 1px solid #aeb9b2; border-radius: .45rem; background: white; padding: .48rem .6rem; color: var(--ink); }
.filter-actions { display: flex; align-items: end; gap: .5rem; flex-wrap: wrap; }
.button { appearance: none; display: inline-flex; min-height: 2.45rem; align-items: center; justify-content: center; border-radius: .45rem; border: 1px solid transparent; padding: .48rem .85rem; text-decoration: none; cursor: pointer; }
.button-primary { background: var(--brand); color: white; }
.button-primary:hover { background: var(--brand-dark); }
.button-quiet { background: transparent; color: inherit; border-color: currentColor; }
.table-scroll { width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .72rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #edf1ed; color: #39443f; white-space: nowrap; }
tbody tr:hover { background: #f8faf8; }
code { font-size: .78rem; overflow-wrap: anywhere; }
.badge { display: inline-block; border-radius: 999px; padding: .2rem .48rem; background: #e5e8e6; white-space: nowrap; font-size: .72rem; }
.badge-success, .badge-recent { color: #155535; background: #dff1e7; }
.badge-warning, .badge-stale { color: #725112; background: #fff0cf; }
.badge-unknown { color: #53606d; background: #e9edf0; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: .65rem; margin: 1rem 0; }
.empty-state { text-align: center; background: var(--surface); border: 1px dashed #aeb9b2; border-radius: .8rem; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state h2 { color: var(--ink); }
.alert { grid-column: 1 / -1; padding: .75rem; border-radius: .5rem; background: #fff3d7; }
.alert-error, .field-error { color: var(--danger); }
.alert-error { background: #fbe5e5; }
.field-error { font-size: .78rem; }
.report-meta { display: flex; flex-wrap: wrap; gap: .6rem; }
.report-meta span { background: #e8eeeb; padding: .4rem .65rem; border-radius: 999px; font-size: .8rem; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.refresh-indicator { opacity: 0; color: var(--muted); font-size: .82rem; transition: opacity .15s; }
.htmx-request .refresh-indicator, .refresh-indicator.htmx-request { opacity: 1; }
.htmx-error { border-left: 3px solid var(--danger); }
.muted { color: var(--muted); }
.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; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(145deg, #0d4035 0 38%, var(--paper) 38%); }
.login-card { width: min(440px, 100%); background: var(--surface); border-radius: 1rem; box-shadow: 0 24px 60px rgb(0 0 0 / 20%); padding: clamp(1.5rem, 5vw, 2.7rem); }
.login-card h1 { margin-top: .3rem; }
.stack-form { display: grid; gap: 1rem; }
.export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.export-panel { display: flex; flex-direction: column; gap: 1rem; }
.export-panel h2 { margin-bottom: .35rem; }
.export-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.export-form .alert, .export-actions, .export-progress { grid-column: 1 / -1; }
.export-actions { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
.table-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; margin: 0 0 .7rem; }
.inline-export-form { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; flex-wrap: wrap; }
.inline-export-form .export-progress { font-size: .78rem; }
.export-progress { margin: 0; color: var(--muted); }
.export-guidance { margin-top: 1rem; }
.export-guidance ul { margin-bottom: 0; padding-left: 1.2rem; }
.export-guidance li + li { margin-top: .45rem; }
.button:disabled { cursor: wait; opacity: .62; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .user-tools { justify-content: flex-start; }
  .metric-grid, .chart-grid, .overview-grid, .two-column, .export-grid, .export-form { grid-template-columns: 1fr; }
  .panel-wide { grid-column: auto; }
  .filter-form { grid-template-columns: 1fr; }
  .table-scroll { max-height: 70vh; }
  .pagination { justify-content: space-between; }
  .table-toolbar, .inline-export-form { align-items: stretch; justify-content: flex-start; width: 100%; }
  .inline-export-form .export-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
}
