:root {
  --ink: #17212b;
  --muted: #64717d;
  --line: #d9e0e5;
  --surface: #ffffff;
  --canvas: #f4f6f7;
  --green: #18794e;
  --green-dark: #105c3a;
  --blue: #2463a7;
  --orange: #b65e09;
  --red: #b42318;
  --radius: 6px;
}
* { box-sizing: border-box; }
html { font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-width: 320px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
.topbar { height: 58px; background: #162b24; color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.brand { color: white; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 4px; background: #f0b429; color: #162b24; font-weight: 800; }
.brand-mark.large { width: 46px; height: 46px; font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.language-switch { display: flex; border: 1px solid #6f827a; border-radius: 4px; overflow: hidden; }
.language-switch a { color: #dbe6e0; padding: 5px 8px; }
.language-switch a.active { color: #152a23; background: white; font-weight: 700; }
.link-button { border: 0; background: none; color: white; cursor: pointer; padding: 5px; }
.nav { height: 44px; display: flex; align-items: stretch; gap: 4px; background: white; border-bottom: 1px solid var(--line); padding: 0 24px; }
.nav a { color: #34434f; display: flex; align-items: center; padding: 0 14px; border-bottom: 3px solid transparent; font-size: 14px; font-weight: 600; }
.nav a:hover { text-decoration: none; background: #f7f9fa; }
.nav a.active { color: var(--green); border-bottom-color: var(--green); }
.page { max-width: 1440px; margin: 0 auto; padding: 24px; }
.page-header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 20px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 26px; margin-bottom: 5px; }
h2 { font-size: 17px; margin-bottom: 0; }
.page-header p { color: var(--muted); margin-bottom: 0; font-size: 14px; }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); padding: 8px 14px; border: 1px solid transparent; font-weight: 700; font-size: 14px; cursor: pointer; }
.button:hover { text-decoration: none; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--ink); border-color: #acb7bf; background: white; }
.button.full { width: 100%; }
.command-row { display: flex; gap: 8px; flex-wrap: wrap; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #77838c; border-radius: var(--radius); padding: 15px; min-height: 90px; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font-size: 28px; }
.metric.success { border-left-color: var(--green); }
.metric.warning { border-left-color: var(--orange); }
.metric.info { border-left-color: var(--blue); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(230px, 1fr); gap: 18px; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section-header { min-height: 50px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.district-summary ul { list-style: none; padding: 0; margin: 0; }
.district-summary li { display: flex; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: #53616c; background: #f7f9fa; font-size: 12px; text-transform: uppercase; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: #fafcfc; }
td small { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.filterbar { display: flex; gap: 10px; align-items: end; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.field.grow { flex: 1; min-width: 220px; }
.field label { font-size: 12px; color: #46545f; font-weight: 700; }
.control, .login-panel input { min-height: 40px; width: 100%; border: 1px solid #abb6be; border-radius: 4px; background: white; color: var(--ink); padding: 8px 10px; }
textarea.control { min-height: 90px; resize: vertical; }
.control:focus, .login-panel input:focus { border-color: var(--blue); outline: 2px solid #d9e9f8; }
.filter-submit { margin-bottom: 0; }
.registry-table { background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.status { display: inline-flex; padding: 3px 7px; border-radius: 4px; background: #e8edf0; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status.active { background: #dff3e8; color: #12623e; }
.status.out { background: #fde8e6; color: var(--red); }
.status.review { background: #fff0d9; color: #8a4b08; }
.record-form { max-width: 1080px; }
.record-form.compact { max-width: 850px; }
fieldset { background: white; border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 16px; padding: 18px; }
legend { padding: 0 8px; font-weight: 800; color: #293944; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: span 2; }
.field-error { color: var(--red); font-size: 12px; }
.form-alert { border-left: 4px solid var(--red); background: #fff0ef; padding: 12px; margin-bottom: 14px; }
.form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0; background: var(--canvas); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.details-list { margin: 0; }
.details-list div { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.details-list dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.details-list dd { margin: 0; overflow-wrap: anywhere; }
.visits-section { margin-top: 18px; }
.messages { margin-bottom: 14px; }
.message { background: #dff3e8; color: #125a3b; border-left: 4px solid var(--green); padding: 10px 12px; }
.login-page { min-height: calc(100vh - 58px); display: grid; place-items: center; }
.login-panel { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.login-heading { display: flex; gap: 13px; align-items: center; margin-bottom: 24px; }
.login-logo { width: 72px; height: 56px; object-fit: contain; background: white; }
.login-heading h1 { font-size: 22px; margin-bottom: 2px; }
.login-heading p { color: var(--muted); margin: 0; }
.stack-form { display: flex; flex-direction: column; gap: 8px; }
.stack-form label { margin-top: 6px; font-size: 13px; font-weight: 700; }
.stack-form .button { margin-top: 12px; }
@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbar { flex-wrap: wrap; }
  .filterbar .field { flex: 1 1 180px; }
}
@media (max-width: 620px) {
  .topbar { padding: 0 12px; }
  .user-name { display: none; }
  .nav { padding: 0 8px; overflow-x: auto; }
  .nav a { padding: 0 10px; white-space: nowrap; }
  .page { padding: 16px 12px; }
  .page-header { flex-direction: column; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 82px; padding: 12px; }
  .metric strong { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: span 1; }
  fieldset { padding: 14px 12px; }
  .details-list div { grid-template-columns: 120px 1fr; }
}
