:root {
  --primary: #0f766e;
  --secondary: #164e63;
  --accent: #d97706;
  --on-primary: #ffffff;
  --on-secondary: #ffffff;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #5d6b69;
  --line: #d9e1df;
  --success: #16734b;
  --warning: #a95708;
  --danger: #b42318;
  --shadow: 0 8px 24px rgba(25, 46, 43, 0.08);
}

* { box-sizing: border-box; letter-spacing: 0; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--canvas); font-family: Inter, "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif; font-size: 16px; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .button, a { transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, opacity 180ms ease; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 72%, white); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.workspace { min-height: 100vh; }

.site-header { position: sticky; top: 0; z-index: 10; min-height: 72px; display: grid; grid-template-columns: minmax(240px, 1fr) auto minmax(180px, 1fr); align-items: center; gap: 24px; padding: 10px max(24px, calc((100vw - 1440px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px); }
.brand { width: fit-content; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 6px; background: var(--primary); color: var(--on-primary); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 12px; }
.primary-nav { display: flex; align-items: stretch; gap: 4px; }
.primary-nav a { min-height: 44px; display: grid; place-items: center; padding: 0 14px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; }
.primary-nav a:hover, .primary-nav a.active { border-color: var(--primary); color: var(--secondary); }
.header-status { justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(22, 115, 75, 0.12); }

main, footer { width: min(100% - 48px, 1440px); margin-inline: auto; }
main { padding-block: 28px 48px; }
.flash { margin: 0 0 16px; padding: 12px 14px; border-left: 4px solid var(--success); background: #eaf7f0; color: #145c3e; }
.flash-error { border-left-color: var(--danger); background: #fff1f0; color: #7a271a; }
.overview-band { min-height: 190px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px; padding: 30px 32px; border-radius: 8px; background: var(--secondary); color: var(--on-secondary); box-shadow: var(--shadow); }
.eyebrow, .section-kicker { margin: 0 0 6px; color: var(--primary); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.overview-band .eyebrow { color: color-mix(in srgb, var(--on-secondary) 74%, var(--accent)); }
.overview-band h1 { max-width: 800px; margin: 0; font-size: 38px; line-height: 1.18; overflow-wrap: anywhere; }
.lead { max-width: 780px; margin: 12px 0 0; color: color-mix(in srgb, var(--on-secondary) 78%, transparent); font-size: 16px; }
.overview-meta { min-width: 230px; padding-left: 24px; border-left: 1px solid color-mix(in srgb, var(--on-secondary) 24%, transparent); }
.overview-meta span, .overview-meta strong, .overview-meta small { display: block; }
.overview-meta span, .overview-meta small { color: color-mix(in srgb, var(--on-secondary) 68%, transparent); font-size: 12px; }
.overview-meta strong { margin: 7px 0 18px; font-size: 17px; }
.announcement { display: grid; grid-template-columns: 100px 1fr; gap: 16px; margin-top: 16px; padding: 14px 18px; border: 1px solid #e9d4ad; border-left: 4px solid var(--accent); background: #fffaf0; }
.announcement strong, .announcement p { margin: 0; }
.announcement strong { color: #79430c; font-size: 13px; }
.announcement p { color: #594b3a; font-size: 14px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.metric, .panel { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric { min-height: 132px; padding: 18px; border-top: 4px solid var(--primary); }
.metric.warning { border-top-color: var(--accent); }
.metric span, .metric small, .metric strong { display: block; }
.metric span, .metric small { color: var(--muted); font-size: 12px; }
.metric strong { margin: 7px 0 5px; color: var(--secondary); font-size: 30px; line-height: 1.15; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.5fr); gap: 16px; margin-top: 16px; }
.panel { min-width: 0; padding: 20px; }
.panel-header { min-height: 54px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-header h2 { margin: 0; font-size: 18px; }
.unit { color: var(--muted); font-size: 12px; }
.chart { height: 260px; display: flex; align-items: flex-end; gap: 8px; padding: 30px 4px 26px; border-bottom: 1px solid var(--line); }
.chart-column { position: relative; height: 100%; min-width: 20px; flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar { width: min(44px, 72%); min-height: 4px; border-radius: 4px 4px 0 0; background: var(--primary); }
.chart-column:nth-child(3n) .chart-bar { background: var(--secondary); }
.chart-column small, .chart-value { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; }
.chart-column small { top: calc(100% + 7px); color: var(--muted); }
.chart-value { bottom: calc(100% + 4px); color: var(--ink); }
.quality-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.quality-list div { min-height: 82px; padding: 13px; border-left: 3px solid var(--primary); background: color-mix(in srgb, var(--primary) 6%, white); }
.quality-list dt { color: var(--muted); font-size: 12px; }
.quality-list dd { margin: 7px 0 0; color: var(--secondary); font-size: 20px; font-weight: 800; }
.empty-state { min-height: 240px; display: grid; place-content: center; text-align: center; }
.empty-state p { max-width: 360px; margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.table-panel { margin-top: 16px; padding: 0; overflow: hidden; }
.table-panel .panel-header { margin: 0; padding: 20px 20px 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 13px 20px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
th { color: var(--muted); background: #f8faf9; font-size: 12px; font-weight: 700; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 3%, white); }
.state { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 9px; border: 1px solid currentColor; border-radius: 999px; font-size: 12px; font-weight: 700; }
.state-stable { color: var(--success); background: #edf8f2; }
.state-attention { color: var(--warning); background: #fff6e8; }
.state-offline { color: #5d6b69; background: #f3f6f5; }
.table-empty { height: 100px; color: var(--muted); text-align: center; }
footer { display: flex; justify-content: space-between; padding-block: 20px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.settings-shell { width: min(100% - 48px, 1040px); }
.settings-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.settings-header h1, .error-shell h1 { margin: 0; font-size: 32px; }
.settings-header p:not(.section-kicker), .error-shell p:not(.section-kicker) { color: var(--muted); }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 9px 16px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; text-decoration: none; font-weight: 750; }
.primary-button { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.secondary-button { border-color: var(--line); background: white; color: var(--secondary); }
.button:hover { opacity: 0.84; }
.settings-form { display: grid; gap: 16px; }
.settings-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; padding: 24px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.settings-intro h2 { margin: 0; font-size: 18px; }
.settings-intro p { color: var(--muted); font-size: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field { min-width: 0; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 7px 8px; color: #35413f; font-size: 13px; font-weight: 700; }
.field input:not([type="color"]), .field textarea, .field select { grid-column: 1 / -1; width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #bdc9c6; border-radius: 5px; color: var(--ink); background: white; font-weight: 400; }
.field textarea { resize: vertical; }
.field input[type="color"] { grid-row: 2; width: 46px; height: 44px; padding: 3px; border: 1px solid #bdc9c6; border-radius: 5px; background: white; }
.color-field span { grid-column: 2; grid-row: 2; align-self: center; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 500; }
.full-field { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; }
.form-errors { margin-bottom: 16px; padding: 14px 18px; border-left: 4px solid var(--danger); background: #fff1f0; color: #7a271a; }
.form-errors ul { margin-bottom: 0; }
.error-shell { min-height: 70vh; display: grid; place-content: center; text-align: center; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding-block: 32px; }
.login-panel { width: min(100%, 430px); padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); }
.login-brand { margin-bottom: 36px; }
.login-heading { margin-bottom: 24px; }
.login-heading h1 { margin: 0; font-size: 28px; }
.login-heading p:not(.section-kicker) { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.stack-form { display: grid; gap: 16px; }
.full-button { width: 100%; margin-top: 4px; }
.login-alternate { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.login-alternate a { min-height: 44px; display: inline-flex; align-items: center; color: var(--secondary); font-weight: 750; text-decoration: none; }
.login-alternate a:hover { color: var(--primary); }

.admin-header { grid-template-columns: minmax(220px, 1fr) auto minmax(230px, 1fr); }
.system-admin-header { grid-template-columns: minmax(220px, 1fr) auto minmax(230px, 1fr); }
.system-admin-header .brand, .system-admin-header .text-button { min-height: 44px; }
.system-admin-header .text-button { min-width: 44px; }
.system-brand-mark { background: #263b3a; color: white; }
.account-menu { justify-self: end; display: flex; align-items: center; gap: 14px; }
.account-menu span, .account-menu strong, .account-menu small { display: block; }
.account-menu span { text-align: right; }
.account-menu strong { font-size: 13px; }
.account-menu small { color: var(--muted); font-size: 11px; }
.text-button { min-height: 36px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--secondary); background: white; cursor: pointer; font-size: 12px; font-weight: 700; }
.admin-shell { width: min(100% - 48px, 1320px); }
.narrow-admin-shell { max-width: 1040px; }
.page-heading { min-height: 90px; display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 20px; }
.page-heading h1 { margin: 0; font-size: 30px; line-height: 1.25; overflow-wrap: anywhere; }
.page-heading p:not(.section-kicker) { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.heading-actions, .row-actions { display: flex; align-items: center; gap: 12px; }
.process-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 7px; background: white; overflow: hidden; }
.process-strip span { min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-right: 1px solid var(--line); color: #394745; font-size: 13px; font-weight: 700; }
.process-strip span:last-child { border-right: 0; }
.process-strip strong { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--primary) 12%, white); color: var(--primary); font-size: 12px; }
.admin-table-panel { margin-top: 0; }
.table-link { color: var(--primary); font-size: 13px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.tenant-table { min-width: 940px; }
.tenant-identity { min-width: 180px; display: flex; align-items: center; gap: 11px; }
.tenant-identity img, .tenant-fallback { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 5px; flex: 0 0 auto; object-fit: contain; }
.tenant-fallback { display: grid; place-items: center; color: var(--tenant-on-color); background: var(--tenant-color); font-weight: 800; }
.tenant-table code { padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; color: #35413f; background: #f8faf9; font-size: 12px; }
.theme-swatches { min-width: 78px; display: inline-flex; gap: 5px; }
.theme-swatches i { width: 22px; height: 22px; display: block; border: 1px solid rgba(23, 32, 42, 0.18); border-radius: 4px; background: var(--swatch); }
.tenant-resource-list { display: grid; gap: 16px; }
.tenant-resource-panel { margin-top: 0; }
.tenant-resource-table { min-width: 760px; }
.panel-header-actions { display: flex; align-items: center; gap: 14px; }
.panel-header-actions .button { min-height: 44px; padding-block: 7px; font-size: 13px; }
.tenant-fields { grid-template-columns: 1fr; }
.system-project-form .field > label { grid-column: 1 / -1; }
.tenant-fields .field-help, .tenant-fields .field-error, .favicon-field .field-help, .favicon-field .field-error { grid-column: 1 / -1; }
.favicon-field { margin-top: 4px; }
.favicon-input-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.favicon-input-row img { width: 48px; height: 48px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: white; object-fit: contain; }
.favicon-input-row input[type="file"] { min-width: 0; flex: 1 1 auto; }
.table-link:hover { text-decoration: underline; }
.station-form-page-heading { margin-bottom: 24px; }
.guided-station-form { max-width: 820px; margin-inline: auto; }
.guided-progress { margin-bottom: 20px; }
.guided-progress ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.guided-progress li { position: relative; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px 24px 16px 0; color: var(--muted); }
.guided-progress li::after { content: ""; position: absolute; right: 16px; bottom: 0; left: 0; height: 3px; border-radius: 3px; background: var(--line); }
.guided-progress li:last-child { padding-right: 0; }
.guided-progress li:last-child::after { right: 0; }
.guided-progress li.is-current, .guided-progress li.is-complete { color: var(--secondary); }
.guided-progress li.is-current::after, .guided-progress li.is-complete::after { background: var(--primary); }
.guided-step-number { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 13px; font-weight: 800; }
.guided-progress li.is-current .guided-step-number { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.guided-progress li.is-complete .guided-step-number { border-color: var(--primary); color: var(--primary); }
.guided-progress strong, .guided-progress small { display: block; }
.guided-progress strong { color: inherit; font-size: 14px; }
.guided-progress small { margin-top: 2px; font-size: 12px; font-weight: 500; }
.guided-progress-label { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: right; }
.guided-form-errors { max-width: 820px; margin-inline: auto; }
.guided-form-errors p { margin: 4px 0 0; font-size: 13px; }
.guided-step-panel { scroll-margin-top: 100px; padding: 32px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.guided-station-form:not(.is-enhanced) .guided-step-panel + .guided-step-panel { margin-top: 16px; }
.guided-step-heading { max-width: 600px; margin-bottom: 30px; }
.guided-step-heading h2 { margin: 0; color: var(--secondary); font-size: 24px; line-height: 1.3; }
.guided-step-heading h2:focus { outline: 0; }
.guided-step-heading p:not(.section-kicker) { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.guided-fields { display: grid; gap: 24px; }
.guided-field { min-width: 0; }
.guided-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.guided-label-row label, .status-choice-group legend { color: #35413f; font-size: 14px; font-weight: 750; }
.guided-label-row span, .status-choice-group legend span { color: var(--muted); font-size: 11px; font-weight: 600; }
.guided-field input { width: 100%; min-height: 50px; padding: 11px 13px; border: 1px solid #aebcb8; border-radius: 6px; color: var(--ink); background: white; }
.guided-field input::placeholder { color: #7b8986; }
.guided-field input:hover { border-color: #82918d; }
.guided-field input:focus { border-color: var(--primary); outline: 3px solid color-mix(in srgb, var(--primary) 18%, transparent); outline-offset: 0; }
.guided-field input[aria-invalid="true"] { border-color: var(--danger); }
.field-help, .field-error { margin: 7px 0 0; font-size: 12px; }
.field-help { color: var(--muted); }
.field-error { color: var(--danger); font-weight: 650; }
.status-choice-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.status-choice-group legend { width: 100%; margin-bottom: 10px; }
.status-choices { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.status-choice { position: relative; min-height: 72px; display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: white; cursor: pointer; touch-action: manipulation; }
.status-choice:last-child { border-bottom: 0; }
.status-choice:hover { background: color-mix(in srgb, var(--primary) 4%, white); }
.status-choice:has(input:checked) { background: color-mix(in srgb, var(--primary) 7%, white); box-shadow: inset 3px 0 var(--primary); }
.status-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.status-choice-control { width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid #84938f; border-radius: 50%; background: white; }
.status-choice-control::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); transform: scale(0); transition: transform 180ms ease; }
.status-choice input:checked + .status-choice-control { border-color: var(--primary); }
.status-choice input:checked + .status-choice-control::after { transform: scale(1); }
.status-choice input:focus-visible + .status-choice-control { outline: 3px solid color-mix(in srgb, var(--accent) 72%, white); outline-offset: 3px; }
.status-choice strong, .status-choice small { display: block; }
.status-choice strong { color: var(--secondary); font-size: 14px; }
.status-choice small { margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.station-review { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.station-review h3 { margin: 0; color: var(--secondary); font-size: 16px; }
.station-review dl { margin: 0; }
.station-review dl div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, white); }
.station-review dl div:last-child { border-bottom: 0; }
.station-review dt { color: var(--muted); font-size: 12px; }
.station-review dd { min-width: 0; margin: 0; color: var(--ink); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.guided-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.guided-actions .button { min-width: 116px; }
.guided-actions .button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.guided-next-button { gap: 6px; }
.import-state-queued { color: #4b5d59; background: #f3f6f5; }
.import-state-processing { color: #075985; background: #eff8ff; }
.import-state-ocr_processing { color: #075985; background: #eff8ff; }
.import-state-awaiting_ai { color: var(--warning); background: #fff6e8; }
.import-state-ai_processing { color: #5b21b6; background: #f5f3ff; }
.import-state-paused { color: #4b5d59; background: #f3f6f5; }
.import-state-awaiting_confirmation { color: var(--warning); background: #fff6e8; }
.import-state-completed { color: var(--success); background: #edf8f2; }
.import-state-excluded { color: #4b5d59; background: #f3f6f5; }
.import-state-failed { color: var(--danger); background: #fff1f0; }
.upload-form { min-width: 0; display: grid; gap: 16px; }
.upload-section { width: 100%; min-width: 0; align-items: start; }
.upload-section > * { min-width: 0; }
.file-drop { min-height: 170px; display: grid; place-content: center; gap: 5px; padding: 22px; border: 2px dashed #aebdb9; border-radius: 6px; color: var(--muted); background: #f8faf9; text-align: center; cursor: pointer; }
.file-drop:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 4%, white); }
.file-drop-title { color: var(--secondary); font-weight: 800; }
.file-drop input { width: 100%; min-width: 0; max-width: 100%; margin-top: 12px; }
.import-summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 7px; background: white; }
.import-summary div { min-height: 92px; padding: 17px; border-right: 1px solid var(--line); }
.import-summary div:last-child { border-right: 0; }
.import-summary span, .import-summary strong { display: block; }
.import-summary span { color: var(--muted); font-size: 12px; }
.import-summary strong { margin-top: 6px; color: var(--secondary); font-size: 23px; }
.progress-track { height: 8px; margin: 10px 0 18px; border-radius: 4px; background: #dfe7e5; overflow: hidden; }
.progress-track span { height: 100%; display: block; background: var(--primary); transition: width 250ms ease; }
.page-list { display: grid; gap: 12px; }
.import-page { min-width: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 7px; background: white; overflow: hidden; }
.page-preview { aspect-ratio: 4 / 3; display: grid; place-items: center; background: #e9efed; overflow: hidden; }
.page-preview img { width: 100%; height: 100%; object-fit: contain; }
.page-preview-button { width: 100%; height: 100%; min-width: 44px; min-height: 44px; position: relative; display: block; padding: 0; border: 0; color: white; background: transparent; cursor: zoom-in; }
.page-preview-button:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.preview-open-indicator { width: 36px; height: 36px; position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.65); border-radius: 5px; background: rgba(23, 32, 42, 0.72); opacity: 0; transition: opacity 180ms ease; }
.preview-open-indicator svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-preview-button:hover .preview-open-indicator, .page-preview-button:focus-visible .preview-open-indicator { opacity: 1; }
.page-detail { min-width: 0; padding: 17px 20px; }
.page-title { display: flex; justify-content: space-between; gap: 18px; }
.page-title-actions { display: flex; align-items: center; gap: 8px; }
.page-title strong, .page-title small { display: block; overflow-wrap: anywhere; }
.page-title small { margin-top: 2px; color: var(--muted); }
.page-state { flex: 0 0 auto; gap: 6px; }
.page-state::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.page-detail dl { display: flex; gap: 32px; margin: 20px 0 0; }
.page-detail dt { color: var(--muted); font-size: 11px; }
.page-detail dd { margin: 3px 0 0; font-size: 13px; font-weight: 750; }
.page-error { margin: 14px 0 0; padding: 9px 11px; color: #7a271a; background: #fff1f0; font-size: 12px; overflow-wrap: anywhere; }
.page-note { margin: 14px 0 0; padding: 9px 11px; border-left: 3px solid #82918d; color: #35413f; background: #f3f6f5; font-size: 12px; }
.exclude-page-button { min-height: 44px; color: var(--danger); }
.saved-records { margin-top: 18px; border-top: 1px solid var(--line); }
.saved-records summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--secondary); cursor: pointer; touch-action: manipulation; font-size: 13px; font-weight: 800; list-style-position: inside; }
.saved-records summary:hover { background: color-mix(in srgb, var(--primary) 4%, white); }
.saved-records summary small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 650; }
.saved-record-table-wrap { max-width: 100%; border: 1px solid var(--line); overflow-x: auto; }
.saved-record-table { min-width: max(760px, 100%); }
.saved-record-table th, .saved-record-table td { padding: 10px 12px; white-space: nowrap; }
.saved-record-table td:last-child { max-width: 360px; white-space: normal; overflow-wrap: anywhere; }
.saved-record-empty { margin: 0; padding: 18px; border: 1px solid var(--line); color: var(--muted); background: #f8faf9; font-size: 13px; text-align: center; }
.import-heading { min-height: 74px; }
.import-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 14px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: white; list-style: none; overflow: hidden; }
.import-steps li { min-height: 54px; display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-right: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }
.import-steps li:last-child { border-right: 0; }
.import-steps li > span { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #aebdb9; border-radius: 50%; font-size: 12px; }
.import-steps li.is-complete { color: var(--secondary); }
.import-steps li.is-complete > span { border-color: var(--primary); color: var(--on-primary); background: var(--primary); }
.import-steps li.is-current { background: color-mix(in srgb, var(--primary) 7%, white); }
.import-task-status { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.import-task-status > div { min-height: 54px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 14px; }
.import-task-status > div + div { border-left: 1px solid var(--line); }
.import-task-status span:not(.task-status-indicator) { color: var(--muted); font-size: 12px; }
.import-task-status strong { color: var(--secondary); font-size: 13px; }
.ai-countdown { min-width: 98px; font-variant-numeric: tabular-nums; text-align: right; }
.task-status-indicator { width: 9px; height: 9px; border-radius: 50%; background: #aebdb9; }
.task-status-indicator.is-active { background: var(--primary); animation: task-status-pulse 1.4s ease-in-out infinite; }
.import-task-error { margin: -4px 0 14px; }
@keyframes task-status-pulse { 50% { opacity: 0.35; } }
.review-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 26px 0 12px; }
.ocr-review-list { margin: 24px 0; }
.review-intro h2 { margin: 0; color: var(--secondary); font-size: 22px; }
.review-intro p:not(.section-kicker) { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.review-total { min-width: 150px; text-align: right; }
.review-total span, .review-total strong { display: block; }
.review-total > span { color: var(--muted); font-size: 12px; }
.review-total strong { margin-top: 2px; color: var(--secondary); font-size: 22px; }
.review-total strong span { display: inline; }
.review-total .review-breakdown { font-size: 16px; white-space: nowrap; }
.review-empty-error { margin: 0 0 12px; }
.review-pages { display: grid; gap: 14px; }
.review-page { min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: white; overflow: hidden; }
.review-page-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.review-page-header h3 { margin: 3px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.document-type { color: var(--primary); font-size: 11px; font-weight: 800; }
.review-page-actions { display: flex; align-items: center; gap: 14px; }
.review-page-actions > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.review-page-actions > span strong { color: var(--secondary); }
.review-page-actions .draft-save-status { min-width: 52px; color: var(--success); text-align: right; }
.review-page-actions .draft-save-status.is-saving { color: var(--muted); }
.review-page-actions .draft-save-status.is-error { color: var(--danger); }
.review-page-actions .text-button { min-height: 44px; }
.review-source { min-width: 0; display: grid; grid-template-columns: 128px minmax(0, 1fr); }
.compact-page-preview { min-height: 132px; aspect-ratio: auto; border-right: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.editable-record-groups { min-width: 0; }
.editable-record-group + .editable-record-group { border-top: 1px solid var(--line); }
.editable-record-group-header { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 3px 10px 3px 14px; background: #f8faf9; }
.editable-record-group-header strong { color: var(--secondary); font-size: 13px; }
.editable-record-group-header .text-button { min-height: 44px; }
.editable-record-table-wrap { min-width: 0; overflow-x: auto; }
.editable-record-table { min-width: max(900px, 100%); }
.editable-record-table th, .editable-record-table td { padding: 8px; }
.editable-record-table th:first-child, .editable-record-table td:first-child { width: 58px; min-width: 58px; text-align: center; }
.editable-record-table th:nth-child(2), .editable-record-table td:nth-child(2) { width: 138px; min-width: 138px; }
.editable-record-table td { background: white; }
.editable-record-table tr.is-excluded td { background: #f3f6f5; }
.editable-record-table tr.is-excluded td:not(.include-cell) { opacity: 0.5; }
.editable-record-table input:not([type="checkbox"]) { width: 100%; min-width: 118px; min-height: 44px; padding: 7px 9px; border: 1px solid #bdc9c6; border-radius: 5px; color: var(--ink); background: white; }
.editable-record-table input[data-date-input="record_date"] { min-width: 138px; font-variant-numeric: tabular-nums; }
.editable-record-table input[data-date-input="recorded_at"] { min-width: 178px; font-variant-numeric: tabular-nums; }
.editable-record-table input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.include-cell label { min-width: 44px; min-height: 44px; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.source-cell strong, .source-cell small { display: block; }
.source-cell small { margin-top: 2px; color: var(--muted); font-size: 10px; white-space: normal; overflow-wrap: anywhere; }
.summary-review { min-width: 0; padding: 16px; border-top: 1px solid var(--line); }
.review-source > .summary-review { border-top: 0; }
.summary-review-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.summary-review-heading strong, .summary-review-heading span { display: block; }
.summary-review-heading strong { margin-top: 3px; color: var(--secondary); font-size: 15px; }
.summary-include { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; color: var(--secondary); font-size: 13px; font-weight: 750; cursor: pointer; }
.summary-include input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); }
.summary-fields { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; }
.summary-field { min-width: 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.summary-field span { display: block; margin-bottom: 5px; }
.summary-field input { width: 100%; min-width: 0; min-height: 44px; padding: 7px 9px; border: 1px solid #bdc9c6; border-radius: 5px; color: var(--ink); background: white; }
.summary-review.is-excluded { background: #f3f6f5; }
.summary-review.is-excluded .summary-fields { opacity: 0.5; }
.page-detail .saved-summary-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; border: 1px solid var(--line); }
.saved-summary-fields div { min-width: 0; padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.saved-summary-fields dt { color: var(--muted); font-size: 11px; }
.saved-summary-fields dd { margin: 3px 0 0; color: var(--secondary); font-size: 13px; font-weight: 750; overflow-wrap: anywhere; }
.review-submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 16px; padding: 18px 20px; border: 1px solid #c5d3d0; border-left: 4px solid var(--primary); background: white; }
.review-submit-bar strong { color: var(--secondary); }
.review-submit-bar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.review-submit-bar .button { flex: 0 0 auto; }
.confirm-dialog { width: min(calc(100% - 32px), 480px); padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; box-shadow: 0 24px 64px rgba(23, 32, 42, 0.22); }
.confirm-dialog::backdrop { background: rgba(23, 32, 42, 0.56); }
.confirm-dialog-body { padding: 24px; }
.confirm-dialog h2 { margin: 0; font-size: 22px; }
.confirm-dialog-body > p:not(.section-kicker) { margin: 9px 0 0; color: var(--muted); }
.confirm-dialog dl { display: grid; grid-template-columns: 1fr 1fr; margin: 20px 0 0; border: 1px solid var(--line); }
.confirm-dialog dl div { padding: 11px 13px; }
.confirm-dialog dl div + div { border-left: 1px solid var(--line); }
.confirm-dialog dt { color: var(--muted); font-size: 11px; }
.confirm-dialog dd { margin: 3px 0 0; font-size: 13px; font-weight: 750; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: #f8faf9; }
.confirm-dialog button:disabled { cursor: wait; opacity: 0.65; }
.image-preview-dialog { width: min(calc(100% - 24px), 1200px); height: min(calc(100% - 24px), 900px); max-width: none; max-height: none; position: fixed; inset: 0; z-index: 1000; padding: 0; border: 1px solid #52615e; border-radius: 8px; color: var(--ink); background: #18211f; box-shadow: 0 24px 64px rgba(23, 32, 42, 0.28); overflow: hidden; transform: translate(var(--dialog-translate-x, 0), var(--dialog-translate-y, 0)); }
.image-preview-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.image-preview-toolbar { min-width: 0; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 8px 10px 8px 18px; border-bottom: 1px solid #42504d; color: white; background: #24302e; cursor: grab; touch-action: none; user-select: none; }
.image-preview-dialog.is-dragging .image-preview-toolbar { cursor: grabbing; }
.image-preview-toolbar > strong { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-actions { display: flex; gap: 8px; cursor: default; touch-action: manipulation; }
.image-preview-text-button { min-height: 44px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid #5b6b67; border-radius: 5px; color: white; background: #2d3a37; cursor: pointer; touch-action: manipulation; font-weight: 700; }
.image-preview-text-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.image-preview-text-button:hover, .image-preview-text-button[aria-pressed="true"] { border-color: #92b7ae; background: #394844; }
.image-preview-text-button:disabled { border-color: #46534f; color: #899692; background: #293330; cursor: not-allowed; }
.image-preview-actions .icon-button { border-color: #5b6b67; color: white; background: #2d3a37; }
.image-preview-actions .icon-button:hover { border-color: #92b7ae; color: white; background: #394844; }
.image-preview-actions .icon-button:disabled { border-color: #46534f; color: #899692; background: #293330; }
.image-preview-stage { min-width: 0; min-height: 0; container-type: size; position: relative; padding: 16px; overflow: hidden; }
.image-preview-stage img { width: auto; height: auto; max-width: calc(100cqw - 32px); max-height: calc(100cqh - 32px); position: absolute; top: 50%; left: 50%; object-fit: contain; transform: translate(-50%, -50%) rotate(var(--image-rotation, 0deg)); transition: transform 180ms ease; }
.image-preview-stage img.is-sideways { max-width: calc(100cqh - 32px); max-height: calc(100cqw - 32px); }
.image-preview-text { min-width: 0; min-height: 0; padding: 24px; color: #e9efed; background: #18211f; font-size: 15px; line-height: 1.7; overflow: auto; }
.image-preview-text > :first-child { margin-top: 0; }
.image-preview-text > :last-child { margin-bottom: 0; }
.image-preview-text h1, .image-preview-text h2, .image-preview-text h3, .image-preview-text h4 { margin: 1.4em 0 0.55em; color: white; line-height: 1.3; }
.image-preview-text h1 { font-size: 24px; }
.image-preview-text h2 { font-size: 20px; }
.image-preview-text h3 { font-size: 17px; }
.image-preview-text h4 { font-size: 15px; }
.image-preview-text p, .image-preview-text ul, .image-preview-text ol, .image-preview-text blockquote, .image-preview-text pre, .image-preview-text table { margin: 0 0 1em; }
.image-preview-text ul, .image-preview-text ol { padding-left: 24px; }
.image-preview-text blockquote { padding: 8px 14px; border-left: 3px solid #92b7ae; color: #c5d3d0; background: #202c29; }
.image-preview-text code { padding: 2px 5px; border-radius: 4px; color: #f3f6f5; background: #2d3a37; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.image-preview-text pre { padding: 14px; background: #101816; overflow-x: auto; }
.image-preview-text pre code { padding: 0; background: transparent; }
.image-preview-text table { width: 100%; border-collapse: collapse; background: #202c29; }
.image-preview-text th, .image-preview-text td { min-width: 96px; padding: 8px 10px; border: 1px solid #52615e; text-align: left; vertical-align: top; }
.image-preview-text th { color: white; background: #2d3a37; }
.image-preview-text a { color: #9fd8ca; }
.image-preview-text hr { margin: 20px 0; border: 0; border-top: 1px solid #52615e; }

.camera-station { margin-top: 22px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading h2 { font-size: 18px; }
.section-heading p, .section-heading span { color: var(--muted); font-size: 12px; }
.camera-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.camera-card { min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: white; overflow: hidden; }
.camera-feed { aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--muted); background: #111918; overflow: hidden; text-decoration: none; }
.camera-feed iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.camera-card-footer { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; }
.camera-card-footer strong, .camera-card-footer small { display: block; }
.camera-card-footer small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.camera-empty { min-height: 270px; display: grid; place-content: center; gap: 7px; border: 1px dashed #aebdb9; border-radius: 7px; color: var(--muted); background: #f8faf9; text-align: center; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-field { min-height: 44px; display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; }
.check-field input { width: 18px; height: 18px; accent-color: var(--primary); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 26px; padding-top: 20px; border-top: 1px solid #e6b8b2; }
.danger-zone p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.danger-button { border-color: #d92d20; color: #b42318; background: white; }
.video-detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 0.7fr); gap: 16px; }
.video-panel, .endpoint-panel { align-self: start; }
.video-frame { aspect-ratio: 16 / 9; display: grid; place-items: center; color: #cbd5d1; background: #111918; overflow: hidden; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.endpoint-panel > p { color: var(--muted); font-size: 13px; }
.endpoint-panel dl { margin: 22px 0 0; border-top: 1px solid var(--line); }
.endpoint-panel dl div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.endpoint-panel dt { color: var(--muted); font-size: 11px; }
.endpoint-panel dd { margin: 3px 0 0; font-size: 13px; font-weight: 700; }

[hidden] { display: none !important; }
.dashboard-overview { min-height: 0; display: block; padding: 0; border-radius: 0; color: var(--ink); background: transparent; box-shadow: none; }
.overview-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; }
.dashboard-overview .eyebrow { color: var(--primary); }
.dashboard-overview h1 { max-width: 860px; color: var(--secondary); font-size: 34px; }
.dashboard-overview .lead { max-width: 820px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.overview-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 24px 0 0; border: 1px solid var(--line); border-radius: 7px; background: white; overflow: hidden; }
.overview-facts div { min-height: 82px; padding: 15px 18px; border-right: 1px solid var(--line); }
.overview-facts div:last-child { border-right: 0; }
.overview-facts dt { color: var(--muted); font-size: 11px; }
.overview-facts dd { margin: 6px 0 0; color: var(--secondary); font-size: 17px; font-weight: 750; }
.month-navigator { min-width: 300px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 5px 12px; }
.month-navigator-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.month-navigator-controls { grid-column: 1 / -1; display: grid; grid-template-columns: 44px minmax(170px, 1fr) 44px; border: 1px solid var(--line); border-radius: 6px; background: white; overflow: hidden; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 1px solid var(--line); border-radius: 5px; color: var(--secondary); background: white; cursor: pointer; touch-action: manipulation; }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, white); }
.icon-button:active { background: color-mix(in srgb, var(--primary) 10%, white); }
.icon-button:disabled { border-color: transparent; color: #98a6a3; background: #f3f6f5; cursor: not-allowed; }
.month-step { border: 0; border-radius: 0; }
.month-step:first-child { border-right: 1px solid var(--line); }
.month-step:last-child { border-left: 1px solid var(--line); }
.month-field { min-width: 0; position: relative; display: flex; align-items: center; }
.month-field input { min-width: 0; width: 100%; height: 44px; padding: 0 12px; border: 0; color: var(--secondary); background: transparent; cursor: pointer; font-weight: 750; }
.month-field input:focus { outline: 0; }
.current-month-link { justify-self: end; color: var(--primary); font-size: 12px; font-weight: 700; text-decoration: none; }
.current-month-link:hover { text-decoration: underline; }

.monthly-intelligence { margin-top: 28px; }
.monthly-heading { margin-bottom: 12px; }
.monthly-heading h2 { color: var(--secondary); font-size: 22px; }
.monthly-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: white; overflow: hidden; }
.monthly-kpi { min-width: 0; min-height: 126px; padding: 17px 18px; border-right: 1px solid var(--line); }
.monthly-kpi:last-child { border-right: 0; }
.monthly-kpi span, .monthly-kpi strong, .monthly-kpi em { display: block; }
.monthly-kpi span { color: var(--muted); font-size: 12px; font-weight: 700; }
.monthly-kpi strong { margin: 8px 0 7px; color: var(--secondary); font-size: 27px; line-height: 1.1; overflow-wrap: anywhere; }
.monthly-kpi strong small { font-size: 12px; }
.monthly-kpi em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 650; }
.monthly-kpi-warning { background: #fff9ed; box-shadow: inset 0 3px var(--accent); }
.monthly-kpi-warning strong { color: var(--warning); }
.monthly-insight-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.72fr) minmax(290px, 0.72fr); gap: 14px; margin-top: 14px; }
.monthly-insight-grid .panel-header h3 { margin: 0; font-size: 18px; }
.environment-chart { width: 100%; height: 280px; }
.station-volume-chart { height: 292px; }
.compliance-bars { display: grid; gap: 8px; }
.compliance-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.compliance-row > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compliance-row span { color: var(--muted); font-size: 11px; font-weight: 700; }
.compliance-row strong { color: var(--secondary); font-size: 16px; }
.compliance-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.compliance-track { height: 6px; margin-top: 5px; border-radius: 3px; background: #e8eeec; overflow: hidden; }
.compliance-track i { width: var(--compliance-rate); height: 100%; display: block; border-radius: inherit; background: var(--primary); }
.station-quality-list { min-height: 0; margin-top: 8px; overflow-y: auto; }
.station-quality-list > div { min-height: 28px; display: grid; grid-template-columns: minmax(90px, 1fr) auto auto auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); font-size: 11px; }
.station-quality-list > div:last-child { border-bottom: 0; }
.station-quality-list > div > strong { min-width: 0; overflow: hidden; color: var(--secondary); text-overflow: ellipsis; white-space: nowrap; }
.station-quality-list span { color: var(--muted); white-space: nowrap; }
.station-quality-list b { color: var(--ink); font-weight: 750; }
.station-quality-list em { min-width: max-content; font-size: 10px; font-style: normal; font-weight: 750; }
.quality-normal { color: var(--success); }
.quality-alert { color: var(--warning); }
.governance-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.governance-list div { min-width: 0; min-height: 82px; padding: 13px; border-left: 3px solid var(--secondary); background: color-mix(in srgb, var(--secondary) 5%, white); }
.governance-list dt { color: var(--muted); font-size: 11px; }
.governance-list dd { margin: 6px 0 0; color: var(--secondary); font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.reference-note { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.station-workspace { margin-top: 28px; scroll-margin-top: 92px; }
.station-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.station-toolbar h2 { margin: 0; font-size: 22px; }
.station-toolbar-actions { min-width: 0; display: flex; align-items: flex-end; gap: 18px; }
.station-tabs { min-width: 0; display: flex; border: 1px solid var(--line); border-radius: 6px; background: white; overflow-x: auto; }
.station-tab { min-width: max-content; min-height: 44px; padding: 8px 15px; border: 0; border-right: 1px solid var(--line); color: var(--muted); background: white; cursor: pointer; touch-action: manipulation; font-size: 13px; font-weight: 700; }
.station-tab:last-child { border-right: 0; }
.station-tab:hover { color: var(--secondary); background: color-mix(in srgb, var(--primary) 5%, white); }
.station-tab[aria-selected="true"] { color: var(--on-primary); background: var(--primary); }
.rotation-control { min-width: 176px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.rotation-control span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rotation-button { border-color: var(--line); }
.rotation-button .rotation-icon-play { display: none; }
.rotation-button[data-state="paused"] .rotation-icon-pause { display: none; }
.rotation-button[data-state="paused"] .rotation-icon-play { display: block; }

.station-summary-header { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 22px; border: 1px solid var(--line); border-bottom: 0; border-radius: 7px 7px 0 0; background: white; }
.station-title-line { display: flex; align-items: center; gap: 12px; }
.station-title-line h3 { margin: 0; color: var(--secondary); font-size: 24px; }
.station-summary-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.station-updated { text-align: right; }
.station-updated span, .station-updated strong { display: block; }
.station-updated span { color: var(--muted); font-size: 11px; }
.station-updated strong { margin-top: 4px; font-size: 13px; }

.station-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: white; }
.station-metric { min-width: 0; min-height: 138px; padding: 18px 20px; border: 0; border-right: 1px solid var(--line); color: var(--ink); background: white; text-align: left; cursor: pointer; touch-action: manipulation; }
.station-metric:last-child { border-right: 0; }
.station-metric:hover { background: color-mix(in srgb, var(--primary) 5%, white); }
.station-metric:active { background: color-mix(in srgb, var(--primary) 9%, white); }
.station-metric span, .station-metric strong, .station-metric em { display: block; }
.station-metric span { color: var(--muted); font-size: 12px; font-weight: 650; }
.station-metric strong { margin: 8px 0 7px; color: var(--secondary); font-size: 28px; line-height: 1.1; }
.station-metric strong small { font-size: 13px; }
.station-metric em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 650; }

.station-analysis-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.65fr); gap: 14px; margin-top: 14px; }
.station-analysis-grid .panel-header h3 { margin: 0; font-size: 18px; }
.station-trend-chart, .quality-trend-chart { height: 264px; }
.compact-empty-state { min-height: 244px; display: grid; place-content: center; padding: 24px; text-align: center; }
.compact-empty-state p { max-width: 390px; margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.quality-snapshot .quality-list div { min-height: 76px; }

.detail-section { margin-top: 14px; padding: 0; overflow: hidden; scroll-margin-top: 20px; }
.detail-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 20px; }
.detail-header h3 { margin: 0; font-size: 18px; }
.detail-tabs { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; }
.detail-tabs button { min-width: max-content; min-height: 44px; padding: 7px 13px; border: 0; border-right: 1px solid var(--line); color: var(--muted); background: #f8faf9; cursor: pointer; touch-action: manipulation; font-size: 12px; font-weight: 700; }
.detail-tabs button:last-child { border-right: 0; }
.detail-tabs button:hover { color: var(--secondary); background: white; }
.detail-tabs button[aria-selected="true"] { color: var(--primary); background: white; box-shadow: inset 0 -3px var(--primary); }
.detail-panel { border-top: 1px solid var(--line); }
.detail-panel table { min-width: 760px; }
.empty-dashboard { min-height: 260px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-dashboard p { margin: 7px 0 18px; color: var(--muted); }

@media (max-width: 980px) {
  .site-header { position: static; grid-template-columns: 1fr auto; }
  .primary-nav { grid-column: 1 / -1; order: 3; overflow-x: auto; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .settings-section { grid-template-columns: 1fr; }
  .overview-heading-row { align-items: flex-start; }
  .overview-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-facts div:nth-child(2) { border-right: 0; }
  .overview-facts div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .monthly-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .monthly-kpi { border-bottom: 1px solid var(--line); }
  .monthly-kpi:nth-child(3) { border-right: 0; }
  .monthly-kpi:nth-child(n+4) { border-bottom: 0; }
  .monthly-insight-grid { grid-template-columns: 1fr; }
  .station-toolbar { align-items: flex-start; }
  .station-toolbar-actions { max-width: 70%; align-items: flex-start; }
  .station-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .station-metric:nth-child(2) { border-right: 0; }
  .station-metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .station-analysis-grid { grid-template-columns: 1fr; }
  .admin-header { grid-template-columns: 1fr auto; }
  .system-admin-header { grid-template-columns: 1fr auto; }
  .account-menu { align-self: center; }
  .camera-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .site-header { padding-inline: 16px; }
  .header-status { display: none; }
  .primary-nav { width: calc(100vw - 32px); }
  .primary-nav a { flex: 0 0 auto; }
  main, footer, .settings-shell { width: min(100% - 32px, 1440px); }
  .admin-shell { width: min(100% - 32px, 1320px); }
  main { padding-top: 16px; }
  .overview-band { min-height: 0; grid-template-columns: 1fr; align-items: start; padding: 24px 20px; }
  .overview-band h1 { font-size: 28px; }
  .overview-meta { min-width: 0; padding: 18px 0 0; border-top: 1px solid color-mix(in srgb, var(--on-secondary) 24%, transparent); border-left: 0; }
  .overview-meta strong { margin-bottom: 8px; }
  .dashboard-overview { padding: 0; }
  .overview-heading-row { display: grid; gap: 18px; }
  .month-navigator { width: 100%; min-width: 0; }
  .overview-facts { margin-top: 18px; }
  .overview-facts div { min-height: 72px; padding: 12px; }
  .announcement, .metric-grid, .quality-list, .field-grid { grid-template-columns: 1fr; }
  .announcement { gap: 4px; }
  .monthly-heading { align-items: flex-start; }
  .monthly-kpis { grid-template-columns: 1fr; }
  .monthly-kpi { min-height: 104px; border-right: 0; border-bottom: 1px solid var(--line); }
  .monthly-kpi:nth-child(3), .monthly-kpi:nth-child(n+4) { border-bottom: 1px solid var(--line); }
  .monthly-kpi:last-child { border-bottom: 0; }
  .governance-list { grid-template-columns: 1fr; }
  .monthly-chart-panel, .governance-panel { padding: 16px; }
  .station-volume-chart { height: 260px; }
  .metric-grid { gap: 10px; }
  .metric { min-height: 112px; }
  .chart { gap: 3px; }
  .chart-value { display: none; }
  .station-toolbar { display: grid; }
  .station-toolbar-actions { width: 100%; max-width: none; display: grid; gap: 9px; }
  .station-tabs { width: 100%; }
  .rotation-control { min-width: 0; justify-content: space-between; }
  .station-summary-header { align-items: flex-start; padding: 16px; }
  .station-title-line { align-items: flex-start; }
  .station-title-line h3 { font-size: 20px; }
  .station-updated { text-align: right; }
  .station-metrics { grid-template-columns: 1fr; }
  .station-metric { min-height: 112px; border-right: 0; border-bottom: 1px solid var(--line); }
  .station-metric:nth-child(2) { border-right: 0; }
  .station-metric:last-child { border-bottom: 0; }
  .detail-header { align-items: flex-start; display: grid; }
  .detail-tabs { width: 100%; }
  .detail-tabs button { flex: 1 0 auto; }
  .settings-header { display: grid; }
  .page-heading { min-height: 0; display: grid; gap: 16px; }
  .page-heading h1 { font-size: 26px; }
  .heading-actions { flex-wrap: wrap; }
  .panel-header-actions { align-items: flex-end; flex-direction: column; gap: 8px; }
  .process-strip, .import-summary { grid-template-columns: repeat(2, 1fr); }
  .process-strip span:nth-child(2), .import-summary div:nth-child(2) { border-right: 0; }
  .process-strip span:nth-child(-n+2), .import-summary div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .import-page { grid-template-columns: 1fr; }
  .page-preview { max-height: 200px; aspect-ratio: 16 / 7; }
  .page-detail { padding: 13px; }
  .page-detail dl { display: grid; gap: 10px; margin-top: 13px; }
  .import-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-steps li:not(:last-child) { border-bottom: 1px solid var(--line); }
  .import-steps li:nth-child(even) { border-right: 0; }
  .import-task-status { grid-template-columns: 1fr; }
  .import-task-status > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .review-intro, .review-page-header, .review-submit-bar { align-items: flex-start; display: grid; }
  .review-total { text-align: left; }
  .review-page-actions { justify-content: space-between; }
  .review-source { grid-template-columns: 1fr; }
  .summary-review-heading { align-items: flex-start; display: grid; }
  .summary-fields, .page-detail .saved-summary-fields { grid-template-columns: 1fr; }
  .compact-page-preview { max-height: 160px; min-height: 120px; aspect-ratio: 16 / 6; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-open-indicator { opacity: 1; }
  .image-preview-dialog { width: calc(100% - 16px); height: calc(100% - 16px); }
  .image-preview-toolbar { min-height: 56px; gap: 8px; padding-left: 12px; }
  .image-preview-toolbar > strong { display: none; }
  .image-preview-actions { width: 100%; gap: 8px; }
  .image-preview-text-button { min-width: 0; flex: 1; justify-content: center; padding-inline: 8px; }
  .image-preview-text { padding: 16px; font-size: 16px; }
  .review-submit-bar .button { width: 100%; }
  .camera-grid, .two-columns { grid-template-columns: 1fr; }
  .guided-progress li { padding-right: 12px; }
  .guided-progress li::after { right: 8px; }
  .guided-progress small { display: none; }
  .guided-step-panel { padding: 24px 18px; }
  .guided-step-heading { margin-bottom: 24px; }
  .guided-step-heading h2 { font-size: 21px; }
  .station-review { grid-template-columns: 1fr; gap: 14px; }
  .guided-actions { align-items: stretch; }
  .guided-actions .button { min-width: 0; flex: 1 1 0; padding-inline: 10px; }
  .account-menu span { display: none; }
  .login-panel { padding: 24px 20px; }
  .login-alternate { align-items: flex-start; display: grid; gap: 4px; }
  .settings-section { gap: 18px; padding: 18px; }
  .full-field { grid-column: auto; }
  .form-actions { align-items: stretch; }
  .form-actions .button { min-width: 0; flex: 1 1 0; padding-inline: 10px; }
  .favicon-input-row { align-items: stretch; display: grid; }
  footer { display: grid; gap: 5px; }
}

/* Tenant dashboard: keep the browser page fixed and switch full-screen views in place. */
.tenant-dashboard-page { height: 100dvh; min-height: 0; overflow: hidden; }
.tenant-dashboard-workspace { width: 100%; height: 100dvh; min-height: 0; display: grid; grid-template-rows: 64px minmax(0, 1fr); overflow: hidden; }
.tenant-dashboard-workspace .site-header { position: relative; min-height: 64px; padding: 8px 16px; }
.tenant-dashboard-workspace .primary-nav,
.tenant-dashboard-workspace .dashboard-view-tabs { min-width: 0; display: flex; align-items: stretch; gap: 4px; }
.tenant-dashboard-workspace .primary-nav button { min-height: 44px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; cursor: pointer; font-size: 14px; font-weight: 650; }
.tenant-dashboard-workspace .primary-nav button:hover,
.tenant-dashboard-workspace .primary-nav button.active { border-color: var(--primary); color: var(--secondary); }
.tenant-dashboard-main { position: relative; width: calc(100% - 32px); height: 100%; min-height: 0; padding-block: 14px 16px; overflow: hidden; }
.tenant-dashboard-main > .flash { position: absolute; top: 14px; left: 0; right: 0; z-index: 5; margin: 0; box-shadow: var(--shadow); }
.tenant-dashboard-main > .dashboard-view { width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; }

.dashboard-view-overview { display: flex; flex-direction: column; gap: 10px; }
.dashboard-view-overview .dashboard-overview { flex: 0 0 auto; }
.dashboard-view-overview .overview-heading-row { align-items: center; }
.dashboard-view-overview .dashboard-overview h1 { font-size: 26px; }
.dashboard-view-overview .dashboard-overview .lead { margin-top: 3px; font-size: 13px; }
.dashboard-view-overview .overview-facts { margin-top: 10px; }
.dashboard-view-overview .overview-facts div { min-height: 58px; padding: 9px 14px; }
.dashboard-view-overview .overview-facts dd { margin-top: 2px; font-size: 15px; }
.dashboard-view-overview .announcement { flex: 0 0 auto; margin-top: 0; padding-block: 9px; }
.dashboard-view-overview .monthly-intelligence { min-height: 0; flex: 1 1 auto; display: grid; grid-template-rows: auto auto minmax(0, 1fr); margin-top: 0; }
.dashboard-view-overview .monthly-heading { min-height: 32px; margin-bottom: 6px; }
.dashboard-view-overview .monthly-heading h2 { font-size: 18px; }
.dashboard-view-overview .monthly-kpi { min-height: 82px; padding: 11px 14px; }
.dashboard-view-overview .monthly-kpi strong { margin: 4px 0; font-size: 22px; }
.dashboard-view-overview .monthly-insight-grid { min-height: 0; margin-top: 10px; }
.dashboard-view-overview .monthly-insight-grid > .panel { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 14px; overflow: hidden; }
.dashboard-view-overview .monthly-insight-grid .panel-header { min-height: 38px; margin-bottom: 6px; }
.dashboard-view-overview .monthly-insight-grid .environment-chart { height: 100%; min-height: 150px; }
.dashboard-view-overview .monthly-insight-grid > .quality-compliance-panel { grid-template-rows: auto auto minmax(0, 1fr); }
.dashboard-view-overview .monthly-insight-grid > .governance-panel { grid-template-rows: auto minmax(0, 1fr) auto; }
.dashboard-view-overview .governance-list { align-content: stretch; }
.dashboard-view-overview .governance-list div { min-height: 0; padding: 9px 11px; }
.dashboard-view-overview .reference-note { margin-top: 8px; padding-top: 7px; }

.tenant-dashboard-workspace .station-workspace { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); margin-top: 0; }
.tenant-dashboard-workspace .station-toolbar { min-height: 46px; margin-bottom: 8px; }
.tenant-dashboard-workspace .station-toolbar h2 { font-size: 18px; }
.tenant-dashboard-workspace .station-dashboard { height: 100%; min-height: 0; display: grid; grid-template-rows: 72px 98px minmax(0, 1fr); overflow: hidden; }
.tenant-dashboard-workspace .station-summary-header { min-height: 72px; padding: 10px 16px; }
.tenant-dashboard-workspace .station-title-line h3 { font-size: 20px; }
.tenant-dashboard-workspace .station-metric { min-height: 98px; padding: 11px 16px; }
.tenant-dashboard-workspace .station-metric strong { margin: 4px 0; font-size: 23px; }
.tenant-dashboard-workspace .station-analysis-grid { min-height: 0; margin-top: 8px; }
.tenant-dashboard-workspace .station-analysis-grid > .panel { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 14px; overflow: hidden; }
.tenant-dashboard-workspace .station-analysis-grid .panel-header { min-height: 38px; margin-bottom: 6px; }
.tenant-dashboard-workspace .station-analysis-grid .environment-chart { height: 100%; min-height: 150px; }
.tenant-dashboard-workspace[data-dashboard-view-active="station"] .detail-section { display: none; }

.tenant-dashboard-workspace[data-dashboard-view-active="details"] .station-dashboard { grid-template-rows: minmax(0, 1fr); }
.tenant-dashboard-workspace[data-dashboard-view-active="details"] .station-summary-header,
.tenant-dashboard-workspace[data-dashboard-view-active="details"] .station-metrics,
.tenant-dashboard-workspace[data-dashboard-view-active="details"] .station-analysis-grid { display: none; }
.tenant-dashboard-workspace[data-dashboard-view-active="details"] .detail-section { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); margin-top: 0; }
.tenant-dashboard-workspace[data-dashboard-view-active="details"] .detail-panel { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.tenant-dashboard-workspace[data-dashboard-view-active="details"] .table-wrap { max-height: 100%; overflow: auto; }
.tenant-dashboard-workspace[data-dashboard-view-active="details"] .detail-panel thead { position: sticky; top: 0; z-index: 1; }

@media (max-width: 980px) {
  .tenant-dashboard-workspace { grid-template-rows: auto minmax(0, 1fr); }
  .tenant-dashboard-workspace .site-header { position: relative; }
  .tenant-dashboard-workspace .primary-nav { width: 100%; }
  .tenant-dashboard-workspace .dashboard-view-tabs { flex: 1 1 auto; overflow-x: auto; }
  .tenant-dashboard-main { width: min(100% - 24px, 1600px); padding-block: 10px 12px; }
  .tenant-dashboard-main > .dashboard-view { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
  .dashboard-view-overview .monthly-intelligence { display: block; }
  .dashboard-view-overview .monthly-insight-grid > .panel { min-height: 300px; }
  .tenant-dashboard-workspace .station-workspace { display: block; }
  .tenant-dashboard-workspace .station-toolbar { min-height: 0; }
  .tenant-dashboard-workspace .station-dashboard { height: auto; display: block; overflow: visible; }
  .tenant-dashboard-workspace[data-dashboard-view-active="details"] .station-dashboard,
  .tenant-dashboard-workspace[data-dashboard-view-active="details"] .detail-section { height: 100%; }
}

@media (max-width: 620px) {
  .tenant-dashboard-workspace .site-header { gap: 8px 14px; padding: 8px 16px; }
  .tenant-dashboard-workspace .primary-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; overflow: visible; }
  .tenant-dashboard-workspace .dashboard-view-tabs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 6px; background: white; overflow: hidden; }
  .tenant-dashboard-workspace .primary-nav a { min-height: 44px; border: 1px solid var(--line); border-radius: 5px; background: white; }
  .tenant-dashboard-workspace .primary-nav button { min-width: 0; padding-inline: 8px; border-right: 1px solid var(--line); border-bottom: 0; white-space: nowrap; }
  .tenant-dashboard-workspace .primary-nav button:last-child { border-right: 0; }
  .tenant-dashboard-workspace .primary-nav button.active { color: var(--on-primary); background: var(--primary); }
  .tenant-dashboard-main { width: calc(100% - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .task-status-indicator.is-active { animation: none; }
}

/* Manual entry: one compact work surface for all operational ledgers. */
.manual-entry-heading { min-height: 76px; margin-bottom: 14px; }
.manual-entry-empty { min-height: 280px; }
.manual-entry-empty h2 { margin: 0; font-size: 20px; }
.manual-entry-empty .button { width: fit-content; margin: 16px auto 0; }
.manual-entry-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.manual-type-panel, .manual-entry-panel { border: 1px solid var(--line); border-radius: 7px; background: white; }
.manual-type-panel { position: sticky; top: 88px; overflow: hidden; }
.manual-type-heading { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.manual-type-heading h2 { margin: 0; font-size: 17px; }
.manual-type-list { display: grid; padding: 6px; }
.manual-type-link { min-height: 44px; display: flex; align-items: center; padding: 8px 11px; border-left: 3px solid transparent; border-radius: 4px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.manual-type-link:hover { color: var(--secondary); background: #f5f8f7; }
.manual-type-link.active { border-left-color: var(--primary); color: var(--secondary); background: color-mix(in srgb, var(--primary) 7%, white); }
.manual-entry-panel { min-width: 0; overflow: hidden; }
.manual-form-heading { min-height: 92px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.manual-form-heading h2 { margin: 0; font-size: 21px; }
.manual-form-heading p:not(.section-kicker) { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.overwrite-badge { min-height: 30px; display: inline-flex; align-items: center; flex: 0 0 auto; padding: 3px 9px; border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--line)); border-radius: 999px; color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, white); font-size: 12px; font-weight: 750; }
.manual-entry-form { display: grid; }
.manual-key-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: #f8faf9; }
.manual-data-fields { min-width: 0; margin: 0; padding: 18px 20px 22px; border: 0; }
.manual-data-fields legend { width: 100%; padding: 0 0 12px; color: var(--secondary); font-size: 14px; font-weight: 800; }
.manual-data-fields legend span { margin-left: 7px; color: var(--muted); font-size: 11px; font-weight: 500; }
.manual-field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.manual-field { min-width: 0; display: grid; align-content: start; gap: 6px; color: #35413f; font-size: 13px; font-weight: 700; }
.manual-field > span, .manual-field > label { min-height: 20px; }
.manual-field > label { color: inherit; font: inherit; }
.manual-field em { margin-left: 5px; color: var(--danger); font-size: 11px; font-style: normal; font-weight: 650; }
.manual-field input, .manual-field select, .manual-field textarea { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid #aebcb8; border-radius: 5px; color: var(--ink); background: white; font-weight: 400; }
.manual-field textarea { min-height: 86px; resize: vertical; }
.manual-field input:hover, .manual-field select:hover, .manual-field textarea:hover { border-color: #82918d; }
.manual-field input:focus, .manual-field select:focus, .manual-field textarea:focus { border-color: var(--primary); outline: 3px solid color-mix(in srgb, var(--primary) 18%, transparent); outline-offset: 0; }
.manual-field-wide { grid-column: span 2; }
.manual-date-control { display: grid; grid-template-columns: 44px minmax(150px, 1fr) auto 44px; gap: 6px; align-items: center; }
.manual-date-input-wrap { min-width: 0; position: relative; }
.manual-field .manual-date-input { padding-right: 43px; font-variant-numeric: tabular-nums; }
.manual-date-open { width: 42px; min-height: 42px; position: absolute; top: 1px; right: 1px; display: grid; place-items: center; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0 4px 4px 0; color: var(--muted); background: white; cursor: pointer; touch-action: manipulation; }
.manual-date-open:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, white); }
.manual-date-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.manual-date-step { color: var(--primary); }
.manual-date-current { min-height: 44px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--secondary); background: white; cursor: pointer; touch-action: manipulation; font-size: 12px; font-weight: 750; }
.manual-date-current:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, white); }
.manual-form-actions { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 20px; border-top: 1px solid var(--line); background: #f8faf9; }
.manual-form-actions p { margin: 0; color: var(--muted); font-size: 12px; }
.manual-form-actions .button { min-width: 120px; }
.manual-action-buttons { display: flex; justify-content: flex-end; gap: 10px; }

/* Flatpickr is used only on manual entry pages and follows the admin color tokens. */
.flatpickr-calendar { z-index: 20; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: white; box-shadow: var(--shadow); font-family: inherit; }
.flatpickr-calendar.arrowTop::before { border-bottom-color: var(--line); }
.flatpickr-calendar.arrowTop::after { border-bottom-color: white; }
.flatpickr-current-month { color: var(--secondary); font-size: 15px; }
.flatpickr-current-month .flatpickr-monthDropdown-months, .flatpickr-current-month input.cur-year { font-weight: 750; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 0; color: var(--secondary); }
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { color: var(--primary); }
.flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.flatpickr-weekday { color: var(--muted); font-weight: 700; }
.flatpickr-day { border-radius: 4px; color: var(--ink); }
.flatpickr-day:hover, .flatpickr-day:focus { border-color: color-mix(in srgb, var(--primary) 18%, white); background: color-mix(in srgb, var(--primary) 9%, white); }
.flatpickr-day.today { border-color: var(--accent); color: #79430c; }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus { border-color: var(--primary); color: var(--on-primary); background: var(--primary); }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: #8a9794; }
.flatpickr-time { border-top-color: var(--line); }
.flatpickr-time input:hover, .flatpickr-time .flatpickr-am-pm:hover, .flatpickr-time input:focus { background: color-mix(in srgb, var(--primary) 6%, white); }
.flatpickr-calendar .flatpickr-monthSelect-month { width: calc(33.333% - 1px); min-height: 48px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--ink); white-space: nowrap; }
.flatpickr-calendar .flatpickr-monthSelect-month:hover, .flatpickr-calendar .flatpickr-monthSelect-month:focus { background: color-mix(in srgb, var(--primary) 9%, white); }
.flatpickr-calendar .flatpickr-monthSelect-month.selected { color: var(--on-primary); background: var(--primary); }

@media (max-width: 980px) {
  .manual-entry-layout { grid-template-columns: 1fr; }
  .manual-type-panel { position: static; }
  .manual-type-heading { padding-bottom: 8px; }
  .manual-type-list { display: flex; gap: 4px; overflow-x: auto; }
  .manual-type-link { flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .manual-type-link.active { border-bottom-color: var(--primary); }
}

@media (max-width: 620px) {
  .manual-entry-heading { margin-bottom: 12px; }
  .manual-type-heading { display: none; }
  .manual-form-heading { min-height: 0; padding: 16px; }
  .manual-form-heading h2 { font-size: 19px; }
  .manual-key-fields, .manual-field-grid { grid-template-columns: 1fr; }
  .manual-key-fields { gap: 12px; padding: 16px; }
  .manual-data-fields { padding: 16px; }
  .manual-field-wide { grid-column: auto; }
  .manual-form-actions { grid-template-columns: 1fr; align-items: stretch; justify-content: stretch; display: grid; padding: 14px 16px 16px; }
  .manual-action-buttons { width: 100%; display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); justify-content: stretch; }
  .manual-form-actions .button { width: 100%; min-width: 0; }
  .manual-date-control { grid-template-columns: 44px minmax(0, 1fr) auto 44px; }
}

@media (max-width: 420px) {
  .manual-date-control { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .manual-date-current { grid-column: 1 / -1; grid-row: 2; }
}
