:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #152536;
  --muted: #66778a;
  --line: #d9e1e8;
  --primary: #1267b2;
  --primary-hover: #0d548f;
  --active: #9a6100;
  --ok: #147357;
  --bad: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 19px; line-height: 1.25; }
header { min-height: 96px; padding: 26px 48px; display: flex; justify-content: space-between; align-items: center; gap: 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
main { width: min(1180px, calc(100% - 40px)); margin: 34px auto 50px; display: grid; gap: 22px; }
.eyebrow { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.panel, .login-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 36px rgba(21, 37, 54, 0.05); }
.panel { padding: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.section-heading p { margin-top: 7px; max-width: 740px; color: var(--muted); line-height: 1.45; }
.section-heading.compact { align-items: center; margin-bottom: 18px; }
.history-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cache-summary { margin-top: 6px; color: var(--muted); font-size: 13px; }
.mode-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.mode-tab { min-height: 42px; padding: 0 16px; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 4px 4px 0 0; }
.mode-tab:hover { color: var(--text); background: #edf3f8; }
.mode-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); background: #f0f6fb; }
.mode-panel[hidden] { display: none; }
.job-form { display: grid; grid-template-columns: minmax(280px, 1.65fr) minmax(140px, .65fr) minmax(140px, .65fr) auto; gap: 16px; align-items: end; }
.single-address-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: end; }
.single-address-form > button { justify-self: start; }
.street-picker { position: relative; display: grid; gap: 8px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.street-suggestions { position: absolute; z-index: 5; top: calc(100% + 2px); right: 0; left: 0; max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 20px rgba(21, 37, 54, .14); }
.street-option { width: 100%; min-height: 42px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); background: #fff; cursor: pointer; font-size: 14px; }
.street-option:hover, .street-option.is-active { background: #edf3f8; }
.street-option small { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 650; }
.street-option-message { padding: 12px; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: none; }
.street-status { min-height: 0; margin: -2px 0 0; color: var(--ok); font-size: 11px; font-weight: 650; text-transform: none; }
label, .house-field { display: grid; gap: 8px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
input, select { width: 100%; min-height: 48px; padding: 0 13px; color: var(--text); background: #fbfdff; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-weight: 650; }
input:focus, select:focus { outline: 3px solid rgba(18, 103, 178, .14); border-color: var(--primary); }
select:disabled, input:disabled { color: #8493a1; background: #f1f4f6; cursor: not-allowed; }
.house-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; }
.house-inputs > span { color: var(--muted); font-size: 18px; font-weight: 700; }
input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-field { min-width: 0; }
.file-name { min-height: 48px; display: flex; align-items: center; overflow: hidden; padding: 0 13px; color: var(--text); background: #fbfdff; border: 1px dashed #a9bacb; border-radius: 6px; font-size: 14px; font-weight: 650; letter-spacing: 0; text-transform: none; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.file-field:focus-within .file-name { outline: 3px solid rgba(18, 103, 178, .14); border-color: var(--primary); }
button, .download { min-height: 48px; padding: 0 18px; border: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--primary); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
button:hover, .download:hover { background: var(--primary-hover); }
button:disabled { opacity: .65; cursor: not-allowed; }
.ghost { min-height: 40px; color: var(--text); background: transparent; border: 1px solid var(--line); }
.ghost:hover { background: #edf3f8; }
.danger-ghost { min-height: 40px; color: var(--bad); background: transparent; border: 1px solid #e8b4b1; }
.danger-ghost:hover { background: #fff1f0; }
.message { min-height: 20px; margin-top: 16px; font-weight: 650; }
.muted { color: var(--muted); }
.active { color: var(--active); }
.ok { color: var(--ok); }
.bad, .error { color: var(--bad); }
.hidden { display: none !important; }
.badge { min-width: 108px; padding: 8px 12px; border-radius: 999px; color: var(--muted); background: #edf2f6; font-size: 12px; font-weight: 850; text-align: center; }
.badge.ok { color: var(--ok); background: #dff4eb; }
.badge.bad { color: var(--bad); background: #fde8e7; }
.badge.active { color: #845600; background: #fff1d6; }
.badge.queued { color: #4a637b; background: #e7eff6; }
.job-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.job-meta > div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: #fbfdff; }
dt { margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
dd { margin: 0; overflow-wrap: anywhere; font-weight: 750; }
.job-heartbeat { display: inline-flex; align-items: center; gap: 7px; }
.job-heartbeat.live { color: var(--ok); }
.job-heartbeat.live::before { width: 8px; height: 8px; border-radius: 50%; content: ""; background: currentColor; animation: heartbeat-pulse 1.4s ease-in-out infinite; }
.job-heartbeat.pending { color: var(--active); }
.job-heartbeat.stale { color: var(--bad); }
@keyframes heartbeat-pulse { 50% { opacity: .35; } }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.download { width: max-content; }
.single-preview { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.preview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.preview-heading h3 { margin: 0; font-size: 16px; }
.preview-count { color: var(--muted); font-size: 12px; font-weight: 700; }
.preview-table { min-width: 920px; }
.single-preview .message { margin: 8px 0 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); background: #edf3f8; font-size: 11px; font-weight: 850; text-transform: uppercase; }
td { overflow-wrap: anywhere; }
td a { color: var(--primary); font-weight: 800; text-decoration: none; }
td a:hover { text-decoration: underline; }
.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; }
.icon-button { width: 34px; min-width: 34px; min-height: 34px; height: 34px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; }
.icon-button:hover { color: var(--bad); background: #fff1f0; border-color: #f1d0cd; }
.icon-button:disabled { color: #aab4bd; background: transparent; border-color: transparent; opacity: .65; }
.icon-button svg { width: 16px; height: 16px; }
.status { font-weight: 800; }
.preflight-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.preflight-row { padding: 12px; display: flex; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fbfdff; overflow: hidden; }
.preflight-row span, .preflight-row strong { overflow-wrap: anywhere; }
.login-view { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(244, 246, 248, .97); }
.login-panel { width: min(420px, 100%); padding: 26px; display: grid; gap: 16px; }
@media (max-width: 900px) {
  .job-form { grid-template-columns: 1fr 1fr; }
  .job-form button { grid-column: 1 / -1; }
  .single-address-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-meta, .preflight-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  header { padding: 22px 20px; align-items: flex-start; }
  main { width: min(100% - 28px, 1180px); margin-top: 20px; }
  h1 { font-size: 23px; }
  .panel { padding: 18px; }
  .section-heading { display: grid; gap: 14px; }
  .history-actions { display: grid; grid-template-columns: 1fr; }
  .job-form, .single-address-form, .job-meta, .preflight-list { grid-template-columns: 1fr; }
  .ghost { width: 100%; }
}
