:root {
  color-scheme: light dark;
  --background: #f3f5f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fa;
  --text: #172a35;
  --muted: #526572;
  --border: #d7e0e4;
  --accent: #176452;
  --accent-hover: #105240;
  --accent-text: #ffffff;
  --focus: #146bb2;
  --warning-bg: #fff5d7;
  --warning-text: #72520b;
  --success-bg: #e0f3e9;
  --success-text: #15583a;
  --error-bg: #fce8e7;
  --error-text: #922c2a;
  --neutral-bg: #eaf0f4;
  --neutral-text: #3c5669;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #111a20;
    --surface: #19252d;
    --surface-soft: #1c2b34;
    --text: #e6edf1;
    --muted: #a8bac5;
    --border: #34464f;
    --accent: #91d8bc;
    --accent-hover: #b1e5d0;
    --accent-text: #112c23;
    --focus: #8cc7ff;
    --warning-bg: #3b321d;
    --warning-text: #f3d286;
    --success-bg: #1c3c30;
    --success-text: #a0e1bb;
    --error-bg: #42292b;
    --error-text: #ffb5ad;
    --neutral-bg: #2b3b47;
    --neutral-text: #c0d4e3;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); }
button, input { font: inherit; }
button, input[type="checkbox"] { cursor: pointer; }
button {
  min-height: 44px;
  padding: 0.65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  line-height: 1.3;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { cursor: not-allowed; opacity: 0.55; }
.button-secondary { border-color: var(--border); background: var(--surface); color: var(--text); }
.button-secondary:hover:not(:disabled) { background: var(--surface-soft); border-color: var(--muted); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0.3rem; font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -0.04em; line-height: 1.15; }
h2 { font-size: 1.3rem; letter-spacing: -0.02em; margin-bottom: 0.6rem; }
h3 { font-size: 1.1rem; line-height: 1.4; margin-bottom: 0.8rem; }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 2.75rem 1.5rem 1.25rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.page-header p:last-child { margin-bottom: 0; }
.eyebrow { color: var(--muted); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.card { padding: 1.5rem; border: 1px solid var(--border); border-radius: 0.9rem; background: var(--surface); min-width: 0; }
.login-card { max-width: 540px; margin: 3rem auto 5rem; }
.login-card label { display: block; font-weight: 650; margin: 1.4rem 0 0.5rem; }
input:not([type="checkbox"]):not([type="hidden"]) { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--background); color: var(--text); padding: 0.65rem 0.8rem; }
#token-help { margin: 0.55rem 0 1.25rem; }
.section-toolbar, .card-heading, .pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.section-toolbar { margin: 1rem 0; }
.section-toolbar h2 { margin-bottom: 0.2rem; }
.section-toolbar p { margin-bottom: 0; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.parking-card { grid-column: 1 / -1; border-top: 3px solid var(--warning-text); }
.parking-active { border-top-color: var(--success-text); }
.parking-expired { border-top-color: var(--muted); }
.validity-details { margin-top: 0; }
.card-heading { align-items: flex-start; margin-bottom: 0.8rem; }
.card-heading h2, .card-heading h3 { margin-bottom: 0; }
.badge { display: inline-block; flex-shrink: 0; max-width: 100%; padding: 0.25rem 0.6rem; border-radius: 0.35rem; font-size: 0.7rem; font-weight: 750; letter-spacing: 0.035em; vertical-align: middle; overflow-wrap: anywhere; }
.badge-unknown, .badge-blocked { background: var(--warning-bg); color: var(--warning-text); }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-failed { background: var(--error-bg); color: var(--error-text); }
.badge-neutral, .badge-dry-run { background: var(--neutral-bg); color: var(--neutral-text); }
.details { margin: 1.3rem 0 0; }
.details > div { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 1.35fr); gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.details > div:last-child { border-bottom: 0; }
dt { color: var(--muted); font-size: 0.85rem; }
dd { margin: 0; overflow-wrap: anywhere; font-size: 0.9rem; }
.automation-details { margin-top: 0; }
.control-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1rem; border-top: 1px solid var(--border); padding-top: 1rem; margin: 0.75rem 0; }
.toggle-label { min-height: 44px; display: flex; align-items: center; gap: 0.65rem; font-size: 0.9rem; font-weight: 650; cursor: pointer; }
input[type="checkbox"] { width: 1.3rem; height: 1.3rem; margin: 0; accent-color: var(--accent); }
#start { margin: 0.25rem 0 0.7rem; }
.result-content { margin: 1.1rem 0; overflow-wrap: anywhere; }
.result-content p { margin-bottom: 0.6rem; }
.result-content time { display: block; margin: 0.6rem 0; font-weight: 600; }
.result-content .result-location { margin-bottom: 0.3rem; }
.result-detail { color: var(--muted); font-size: 0.85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.notification-detail { margin-top: 0.8rem; padding-top: 0.65rem; border-top: 1px solid var(--border); }
.notification-detail p { margin-top: 0.4rem; }
.message { margin-top: 1rem; }
.message:empty { display: none; }
.notice, .operation { padding: 1rem; margin: 1rem 0; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface-soft); overflow-wrap: anywhere; }
.error { color: var(--error-text); }
.notice.error { background: var(--error-bg); }
.operation p { margin-bottom: 0.55rem; }
.history-card { margin-top: 1.5rem; padding-bottom: 0.8rem; }
.history-heading p { margin: 0.5rem 0 0; }
.history-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; }
.zone-label { color: var(--muted); font-size: 0.75rem; flex-shrink: 0; padding-top: 0.2rem; }
.table-scroll { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: left; }
th { padding: 0.75rem 0.7rem; background: var(--surface-soft); color: var(--muted); font-size: 0.7rem; letter-spacing: 0.045em; text-transform: uppercase; white-space: nowrap; }
td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; max-width: 270px; min-width: 100px; }
td:first-child { min-width: 165px; font-variant-numeric: tabular-nums; }
td:last-child { min-width: 125px; }
.history-status-cell { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.info-button { display: inline-grid; place-items: center; width: 30px; min-height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 0.9rem; font-weight: 750; line-height: 1; flex-shrink: 0; }
.info-button:hover:not(:disabled) { background: var(--surface-soft); border-color: var(--muted); }
td p { margin: 0.4rem 0 0; }
dialog.details-dialog { width: min(560px, calc(100vw - 2rem)); max-height: min(80vh, 760px); overflow: auto; margin: auto; padding: 1.25rem; border: 1px solid var(--border); border-radius: 0.9rem; background: var(--surface); color: var(--text); }
dialog.details-dialog::backdrop { background: rgb(0 0 0 / 58%); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dialog-heading h2 { margin: 0; }
.dialog-close { width: 36px; min-height: 36px; padding: 0; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.25rem; }
.dialog-actions button { min-width: 7rem; }
.pagination { padding: 1rem 0 0.2rem; }
.pagination p { margin: 0; }
.pagination-buttons { display: flex; gap: 0.5rem; }
.page-footer { text-align: center; margin-top: 2rem; font-size: 0.75rem; color: var(--muted); }
.skip-link { position: absolute; left: 1rem; top: -10rem; z-index: 1; padding: 0.75rem 1rem; border-radius: 0.4rem; background: var(--surface); color: var(--text); }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .page { padding: 1.5rem 1rem 1rem; }
  .page-header { align-items: flex-start; gap: 0.75rem; }
  .page-header .muted { font-size: 0.85rem; }
  .page-header button { padding-inline: 0.8rem; white-space: nowrap; }
  .overview-grid { grid-template-columns: 1fr; }
  .card { padding: 1.15rem; }
  .login-card { margin: 2rem auto; }
  .history-heading { flex-direction: column; gap: 0.5rem; }
  .card-heading { flex-wrap: wrap; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .pagination-buttons { width: 100%; }
  .pagination-buttons button { flex: 1; }
  .table-scroll { overflow-x: visible; }
  table, tbody { display: block; width: 100%; }
  thead { display: none; }
  tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
  td, td:first-child, td:last-child { width: auto; max-width: none; min-width: 0; padding: 0.2rem 0; border: 0; }
  td::before { display: block; margin-bottom: 0.15rem; color: var(--muted); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; content: attr(data-label); }
  td:first-child { grid-column: 1 / -1; font-weight: 650; }
  td:first-child::before { display: none; }
  td:last-child { grid-column: 1 / -1; }
  .history-status-cell { flex-wrap: wrap; white-space: normal; }
  .history-status-cell::before { flex-basis: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 120ms ease, border-color 120ms ease; }
}
