:root {
  color-scheme: light;
  --ink: #132238;
  --muted: #5f6f82;
  --line: #d8e0e8;
  --surface: #ffffff;
  --page: #f3f6f8;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --brand-soft: #e7f6f2;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --warning: #b54708;
  --warning-soft: #fff4e5;
  --shadow: 0 1px 2px rgba(16, 34, 56, 0.07);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(243, 246, 248, 0.91), rgba(243, 246, 248, 0.91)),
    url("central-control-background.png") center center / cover fixed no-repeat;
}
a { color: #075ea8; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; letter-spacing: 0; }

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 26px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 18px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 34px; height: 34px; flex: 0 0 34px; }
.brand-logo-large { width: 40px; height: 40px; flex-basis: 40px; }
.brand-wordmark { display: inline-flex; align-items: baseline; color: inherit; letter-spacing: -0.02em; }
.brand-wordmark strong { font-weight: 800; }
.brand-wordmark > span { font-weight: 500; }
nav { display: flex; gap: 3px; align-items: stretch; }
nav a { color: #46576a; padding: 22px 11px 18px; border-bottom: 3px solid transparent; font-size: 14px; font-weight: 650; white-space: nowrap; }
nav a:hover, nav a.active { color: var(--ink); border-color: var(--brand); text-decoration: none; }
.account { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.account form { margin: 0; }
.live-indicator { display: inline-grid; justify-items: center; align-content: center; gap: 1px; min-width: 76px; min-height: 40px; padding: 3px 7px; border: 0; border-radius: 5px; background: transparent; color: #08705f; cursor: pointer; font-size: 12px; font-weight: 750; text-align: center; white-space: nowrap; }
.live-indicator-status { display: inline-grid; grid-template-columns: 8px auto 8px; align-items: center; justify-content: center; gap: 6px; }
.live-indicator-status::after { width: 8px; height: 8px; content: ""; }
.live-indicator:hover { background: var(--brand-soft); }
.live-indicator .live-indicator-dot { width: 8px; height: 8px; border-radius: 50%; background: #12a594; box-shadow: 0 0 0 3px rgba(18, 165, 148, 0.12); }
.live-indicator time { width: 100%; min-height: 14px; color: var(--muted); font-size: 10px; font-weight: 600; line-height: 14px; text-align: center; }
.account-identity { display: grid; justify-items: center; min-width: 118px; max-width: 176px; padding: 2px 5px; text-align: center; line-height: 1.2; }
.account-identity strong { max-width: 100%; overflow: hidden; color: #46576a; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-identity > span { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-actions { display: inline-flex; align-items: center; gap: 0; }
.account-actions .button.small { padding-inline: 8px; }
.live-indicator[data-state="updating"] .live-indicator-dot { animation: live-pulse 0.9s ease-in-out infinite alternate; }
.live-indicator[data-state="error"] { color: var(--danger); }
.live-indicator[data-state="error"] .live-indicator-dot, .live-indicator[data-state="offline"] .live-indicator-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12); }
.live-indicator[data-state="offline"] { color: var(--danger); }
[data-live-region].live-updated { animation: live-region-updated 0.8s ease-out; }
@keyframes live-pulse { to { opacity: 0.35; } }
@keyframes live-region-updated { from { box-shadow: 0 0 0 3px rgba(18, 165, 148, 0.18); } }

.page { max-width: 1500px; margin: 0 auto; padding: var(--space-8) 34px 60px; }
.auth-topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 32px;
  color: #fff;
  background: #101b2d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.auth-topbar-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.auth-brand-copy { display: grid; gap: 3px; min-width: 0; }
.auth-brand-copy .brand-wordmark { font-size: 24px; line-height: 1.1; }
.auth-brand-copy small { color: #eef5ff; font-size: 14px; }
.auth-online { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: #079447; color: #fff; font-size: 12px; font-weight: 750; white-space: nowrap; }
.auth-online > span { width: 7px; height: 7px; border-radius: 50%; background: #b7ffd5; }
.auth-page {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 84px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: var(--space-6);
  background:
    linear-gradient(rgba(9, 18, 33, 0.45), rgba(9, 18, 33, 0.58)),
    url("central-control-background.png") center center / cover no-repeat;
}
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: var(--space-6); margin-bottom: var(--space-6); }
.page-heading h1 { margin: 4px 0 5px; font-size: 30px; line-height: 1.2; }
.page-heading p, .panel-heading p { margin: 0; color: var(--muted); }
.title-row { display: flex; align-items: center; gap: 14px; }
.back-link { display: inline-block; margin-bottom: 3px; font-size: 14px; }
h2 { font-size: 18px; margin: 0 0 18px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.report-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 106px; padding: var(--space-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric span { display: block; color: var(--muted); margin-bottom: 7px; }
.metric strong { font-size: 31px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-6); margin-bottom: var(--space-6); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-4); }
.panel-heading h2 { margin-bottom: 4px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.detail-grid > .panel { min-width: 0; height: calc(100% - var(--space-6)); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
.events-table { min-width: 1500px; }
.plates-table { min-width: 1280px; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: #516174; font-size: 12px; text-transform: uppercase; font-weight: 750; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

.status { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 9px; border-radius: 999px; background: #eef2f6; color: #526170; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status.online, .status.authorized, .status.command-success { background: var(--brand-soft); color: #08705f; }
.status.offline, .status.command-failed, .status.command-expired { background: #eef1f4; color: #677585; }
.status.denied { background: var(--warning-soft); color: var(--warning); }
.status.command-pending, .status.command-delivered { background: #e9f2fb; color: #155b97; }
.status.compatibility-compatible { background: var(--brand-soft); color: #08705f; }
.status.compatibility-modified { background: var(--warning-soft); color: var(--warning); }
.status.compatibility-incompatible { background: var(--danger-soft); color: var(--danger); }
.status.compatibility-legacy { background: #e9f2fb; color: #155b97; }
.status.license-active, .status.license-unconfigured { background: var(--brand-soft); color: #08705f; }
.status.license-warning, .status.license-due_today { background: var(--warning-soft); color: var(--warning); }
.status.license-suspended { background: var(--danger-soft); color: var(--danger); }

.form-grid { display: grid; gap: var(--space-4); align-items: start; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-stack { display: grid; gap: 15px; }
label { display: grid; align-content: start; gap: 7px; min-width: 0; color: #34465a; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: 9px 12px; color: var(--ink); background: white; border: 1px solid #bac6d3; border-radius: 5px; }
input:focus, select:focus { outline: 3px solid rgba(15, 118, 110, 0.14); border-color: var(--brand); }
input[readonly] { background: #f1f5f8; color: #44566a; }
.check { display: flex; align-items: center; gap: 9px; min-height: 42px; }
.check input { width: 17px; min-height: 17px; }
.field-help { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.35; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 10px; min-height: 44px; }
.plate-form { row-gap: 18px; }
.filter-bar { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(180px, 280px) auto auto; gap: 12px; align-items: end; padding-bottom: 20px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 13px; }
.pagination-top { padding: 14px 0 8px; }
.pagination-controls { justify-content: flex-end; padding-top: 18px; }
.pagination-controls strong { color: var(--ink); }
.pagination-disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.inline-form, .action-bar { display: flex; align-items: center; gap: 10px; }
.inline-form select { min-width: 220px; }
.action-bar { flex-wrap: wrap; }
.action-bar form { margin: 0; }
.table-actions-column { width: 1%; white-space: nowrap; }
.table-actions { flex-wrap: nowrap; gap: 6px; }
.table-actions .button { width: 76px; min-width: 76px; flex: 0 0 76px; }
.clients-table { min-width: 1260px; }
.client-actions-column { min-width: 300px; width: 300px; }
.client-actions {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, 138px);
}
.client-actions form { margin: 0; min-width: 0; }
.client-actions .button {
    justify-content: center;
    min-width: 0;
    padding-left: 10px;
    padding-right: 10px;
    white-space: nowrap;
    width: 100%;
}
.user-status-form { margin-top: 18px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 16px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-weight: 750; font-size: 14px; white-space: nowrap; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--brand); color: white; }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { background: white; color: var(--ink); border-color: #aebccb; }
.button.secondary:hover, .button.ghost:hover { background: #f5f7f9; }
.button.ghost { color: #46576a; background: transparent; border-color: transparent; }
.button.danger { background: var(--danger); color: white; }
.button:disabled { cursor: not-allowed; opacity: 0.48; }
.button.small { min-height: 34px; padding: 5px 10px; font-size: 12px; }

.gate-site-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.gate-site-card { min-width: 0; }
.gate-help, .gate-unavailable { min-height: 42px; margin: 0 0 var(--space-4); color: var(--muted); font-size: 13px; line-height: 1.45; }
.gate-unavailable { color: var(--danger); }
.gate-control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gate-control-grid form { margin: 0; }
.gate-open-button { width: 100%; min-height: 50px; }

.auth-panel { width: min(460px, 100%); padding: var(--space-8); background: rgba(255, 255, 255, 0.96); border: 1px solid rgba(216, 224, 232, 0.92); border-radius: 8px; box-shadow: 0 18px 60px rgba(4, 13, 28, 0.30); backdrop-filter: blur(8px); }
.auth-panel h1 { margin: 0 0 7px; font-size: 29px; }
.auth-panel .button { width: 100%; margin-top: 5px; }
.turnstile-field { display: grid; gap: 6px; min-width: 0; overflow-x: auto; }
.turnstile-field .cf-turnstile { min-height: 65px; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.event-cell-stack { display: grid; gap: 3px; min-width: 120px; }
.event-meta { color: var(--muted); font-size: 12px; line-height: 1.35; }
.section-intro { margin: -8px 0 18px; }

.flash-stack { margin-bottom: var(--space-4); }
.license-alert-stack { display: grid; gap: 8px; margin-bottom: var(--space-4); }
.license-alert { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 16px; border: 1px solid #f3c58a; border-radius: var(--radius); background: rgba(255, 244, 229, 0.97); color: #7a3505; box-shadow: var(--shadow); }
.license-alert:hover { text-decoration: none; }
.license-alert.license-suspended { border-color: #efada7; background: rgba(255, 240, 237, 0.98); color: var(--danger); }
.license-alert span { font-size: 13px; }
.auth-page .flash-stack { width: min(430px, 100%); }
.flash { padding: 12px 15px; border: 1px solid var(--line); border-left-width: 4px; background: white; margin-bottom: 8px; border-radius: 4px; }
.flash.success { border-left-color: var(--brand); background: #f3fbf9; }
.flash.error { border-left-color: var(--danger); background: var(--danger-soft); }

.details { display: grid; grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr); margin: 0; }
.details dt, .details dd { padding: 9px 0; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.remote-configuration-panel { border-left: 4px solid var(--brand); }
.remote-configuration-panel .panel-heading { align-items: center; }
.remote-configuration-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.remote-configuration-grid article { display: grid; align-content: start; gap: 5px; min-height: 102px; padding: 16px; border-right: 1px solid var(--line); background: #fff; }
.remote-configuration-grid article:last-child { border-right: 0; }
.remote-configuration-grid span, .remote-configuration-grid small { color: var(--muted); font-size: 12px; }
.remote-configuration-grid strong { line-height: 1.35; overflow-wrap: anywhere; }
.remote-configuration-meta { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.compact-empty { padding: 22px; border: 1px dashed #b7c3cf; border-radius: var(--radius); color: var(--muted); text-align: center; }
.remote-settings-form { display: grid; gap: 0; }
.remote-camera-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.remote-camera-card { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: #f9fbfc; }
.remote-camera-card h3 { margin: 0 0 var(--space-4); font-size: 16px; }
.remote-section-details { margin-top: var(--space-4); padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.remote-section-details > summary, .remote-subdetails > summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.remote-section-details > p { margin: 8px 0 16px; color: var(--muted); font-size: 13px; }
.remote-subdetails { margin-top: var(--space-4); padding-top: 12px; border-top: 1px solid var(--line); }
.remote-subdetails .form-grid { margin-top: 14px; }
.remote-gate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.remote-control-card { align-self: start; border: 1px solid var(--line); border-radius: var(--radius); background: #f9fbfc; }
.remote-control-card > summary { cursor: pointer; padding: 14px 16px; font-weight: 700; }
.remote-control-body { padding: 4px 16px 16px; }
.remote-camera-checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: var(--space-4) 0 0; padding: 12px; border: 1px solid var(--line); }
.remote-camera-checks legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.remote-camera-checks label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.remote-camera-checks input { width: auto; }
.remote-settings-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0 4px; background: linear-gradient(to bottom, rgba(243, 246, 248, 0), var(--page) 22%); }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.status-grid > div { min-height: 78px; padding: 14px; background: white; }
.status-grid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.status-grid strong { overflow-wrap: anywhere; }
.compatibility-panel { border-left: 4px solid #8aa0b5; }
.compatibility-panel:has(.compatibility-compatible) { border-left-color: var(--brand); }
.compatibility-panel:has(.compatibility-modified) { border-left-color: var(--warning); }
.compatibility-panel:has(.compatibility-incompatible) { border-left-color: var(--danger); }
.compatibility-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); }
.compatibility-grid > div { display: grid; gap: 5px; min-height: 92px; padding: 14px; border-right: 1px solid var(--line); }
.compatibility-grid > div:last-child { border-right: 0; }
.compatibility-grid span, .compatibility-grid small { color: var(--muted); font-size: 12px; }
.compatibility-grid strong { font-size: 17px; overflow-wrap: anywhere; }
.compatibility-files { display: grid; gap: 8px; margin-top: 14px; color: var(--warning); font-size: 13px; }
.compatibility-files code { padding: 10px 12px; overflow-wrap: anywhere; color: #6f3106; background: var(--warning-soft); border-radius: 4px; }

.local-users-panel { border-left: 4px solid var(--brand); }
.local-user-create-grid { display: grid; grid-template-columns: 1.15fr .75fr .7fr 1fr auto; gap: 12px; align-items: end; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #f7fafb; }
.local-user-security-note { margin: 9px 0 18px; color: var(--muted); font-size: 12px; }
.local-user-list { display: grid; gap: 14px; }
.local-user-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.local-user-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.local-user-card-heading > div:first-child { display: grid; gap: 4px; }
.local-user-card-heading small, .local-user-meta { color: var(--muted); font-size: 12px; }
.local-user-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.local-user-edit-grid { display: grid; grid-template-columns: 1.15fr .75fr .7fr auto; gap: 12px; align-items: end; }
.local-user-card-footer { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.local-user-password-form { display: grid; grid-template-columns: minmax(220px, 360px) auto; align-items: end; gap: 10px; }
.local-user-card-footer form { margin: 0; }
.local-user-meta { margin: 12px 0 0; }

.token-panel { background: #ecf8f4; border: 1px solid #93cdbf; border-left: 5px solid var(--brand); padding: 20px; margin-bottom: 18px; border-radius: 5px; }
.token-panel p { margin: 5px 0 0; }
.token-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 15px; }
.token-row code, .command-line code { display: block; padding: 11px 12px; background: #102738; color: white; border-radius: 4px; overflow-wrap: anywhere; }
.command-line { margin-top: 10px !important; }
.update-targets { max-height: 250px; overflow-y: auto; margin-top: 10px; border: 1px solid var(--line); }
.update-target { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-weight: 500; }
.update-target:last-child { border-bottom: 0; }
.update-target input { width: 17px; min-height: 17px; flex: none; }
.update-target span { flex: 1; overflow-wrap: anywhere; }

.event-photo-link { display: block; width: 112px; border-radius: var(--radius); overflow: hidden; background: #e7edf2; }
.event-photo-link:hover { outline: 3px solid rgba(15, 118, 110, 0.18); text-decoration: none; }
.event-photo { display: block; width: 112px; height: 63px; object-fit: contain; background: #102738; }
.event-photo-empty { display: inline-grid; place-items: center; width: 112px; height: 63px; border: 1px dashed #b7c3cf; border-radius: var(--radius); color: var(--muted); font-size: 12px; text-align: center; }
.finance-table { min-width: 1080px; }
.finance-contract-panel { border-left: 4px solid var(--brand); }
.license-capacity { display: grid; grid-template-columns: minmax(190px, auto) minmax(180px, 1fr) auto; gap: 16px; align-items: center; margin: 4px 0 22px; padding: 14px 16px; background: #f5f8fa; border: 1px solid var(--border); border-radius: 8px; }
.license-capacity > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.license-capacity > div:first-child span { color: var(--muted); font-size: .9rem; }
.license-capacity-track { height: 10px; overflow: hidden; background: #dfe7ed; border-radius: 999px; }
.license-capacity-track span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.license-capacity-unlimited { color: var(--brand); font-size: .9rem; font-weight: 700; text-align: center; }
.license-capacity-attention .license-capacity-track span, .license-capacity-near_limit .license-capacity-track span { background: #d97706; }
.license-capacity-full .license-capacity-track span { background: #b42318; }
.currency-input { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: stretch; }
.currency-input > span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-right: 0; border-radius: 6px 0 0 6px; background: #f5f8fa; color: var(--muted); font-weight: 700; }
.currency-input input { border-radius: 0 6px 6px 0; }

.central-report-filters, .plate-registration-form { align-items: end; }
.central-report-scope, .plate-registration-scope { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 520px); align-items: end; gap: 24px; margin-bottom: 4px; padding: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f7f9fb; }
.central-report-scope-copy, .plate-registration-scope-copy { align-self: center; min-width: 0; }
.central-report-scope-copy h3, .plate-registration-scope-copy h3 { margin: 0 0 5px; font-size: 15px; line-height: 20px; }
.central-report-scope-copy p, .plate-registration-scope-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 19px; }
.central-report-scope-field, .plate-registration-scope-field { margin: 0; }
.central-report-scope-field select, .plate-registration-scope-field select { background: #fff; }
.central-report-snapshots { align-self: stretch; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #f7f9fb; }
.central-report-snapshots input { width: auto; min-height: 0; }
.central-report-actions { align-items: center; align-self: end; display: flex; flex-wrap: wrap; gap: 9px; }
.central-report-metrics { grid-template-columns: repeat(7, minmax(120px, 1fr)); }
body.central-modal-open { overflow: hidden; }
.central-report-modal[hidden], .central-pdf-modal[hidden] { display: none; }
.central-report-modal, .central-pdf-modal { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 18px; background: rgba(9, 18, 32, 0.74); }
.central-report-modal-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; width: min(1220px, 100%); max-height: calc(100vh - 36px); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 22px 70px rgba(7, 17, 31, 0.34); }
.central-report-modal-heading, .central-pdf-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.central-report-modal-heading h2, .central-pdf-heading h2 { margin: 0; font-size: 20px; }
.central-report-modal-heading p { margin: 4px 0 0; color: var(--muted); }
.central-report-modal-close { display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; padding: 0; border: 1px solid #b8c4cf; border-radius: 5px; background: #fff; color: var(--ink); cursor: pointer; font-size: 27px; font-weight: 700; line-height: 1; }
.central-report-modal-close:hover { background: #f3f6f8; }
.central-report-modal-body { min-height: 220px; padding: 18px 20px; overflow: auto; }
.central-report-modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 20px; border-top: 1px solid var(--line); }
.central-report-modal-footer p { max-width: 720px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.central-report-modal-actions, .central-pdf-actions { display: flex; align-items: center; gap: 10px; }
.central-report-delivery-status { padding: 11px 20px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.central-report-delivery-status.pending { color: #8a4b05; background: #fff7e8; }
.central-report-delivery-status.sent { color: #06725f; background: #ecf8f4; }
.central-report-delivery-status.failed { color: var(--danger); background: var(--danger-soft); }
.report-preview-meta { display: grid; gap: 5px; margin-bottom: 14px; }
.report-preview-meta p, .report-preview-limit { margin: 0; }
.report-preview-table-wrap { max-height: 470px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; }
.report-preview-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; }
.report-preview-table th { position: sticky; top: 0; z-index: 1; padding: 10px 12px; background: var(--brand); color: #fff; text-align: left; }
.report-preview-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report-preview-limit { padding-top: 12px; color: var(--muted); font-size: 12px; }
.central-pdf-modal { z-index: 120; }
.central-pdf-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(1180px, 100%); height: calc(100vh - 36px); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #eef2f5; box-shadow: 0 22px 70px rgba(7, 17, 31, 0.38); }
.central-pdf-heading { background: #fff; }
.central-pdf-status { padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fff; color: var(--muted); text-align: center; }
.central-pdf-status.failed { color: var(--danger); background: var(--danger-soft); }
.central-pdf-stage { min-height: 0; overflow: auto; padding: 20px; text-align: center; }
.central-pdf-stage canvas { display: inline-block; max-width: 100%; background: #fff; box-shadow: 0 5px 22px rgba(16, 39, 56, 0.18); }
.central-pdf-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.central-page-button { width: 42px; min-width: 42px; padding: 0; font-size: 25px; }

.user-metric-grid { margin-bottom: var(--space-5); }
.user-create-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; cursor: pointer; list-style: none; }
.user-create-panel > summary::-webkit-details-marker { display: none; }
.user-create-panel > summary::after { content: "+"; display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: #e8f4f1; color: var(--brand); font-size: 22px; }
.user-create-panel[open] > summary::after { content: "−"; }
.user-create-panel > summary span { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 500; }
.user-create-panel[open] > summary { margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.user-site-scope { grid-column: 1 / -1; margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fafb; }
.user-site-scope legend { padding: 0 7px; color: var(--ink); font-weight: 700; }
.user-site-scope > p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.user-site-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.user-site-options label { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-weight: 600; }
.user-site-options input { width: auto; min-height: 0; }
.profile-help { align-self: center; color: var(--muted); font-size: 13px; line-height: 1.45; }
.user-form-actions { justify-content: flex-end; }
.user-filter-bar { grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr)) auto; align-items: end; }
.users-table { min-width: 1180px; }
.users-table td { vertical-align: top; }
.users-table .table-actions { min-width: 328px; }
.user-security-details { max-width: 760px; margin-top: 22px; }
.narrow-panel { max-width: 620px; margin-inline: auto; }
[data-user-company][hidden], [data-user-sites][hidden], .user-site-options label[hidden] { display: none !important; }

@media (max-width: 1400px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 18px; }
  nav { grid-column: 1 / -1; order: 3; overflow-x: auto; }
  nav a { padding-top: 10px; }
}

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.three, .form-grid.four, .status-grid, .compatibility-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compatibility-grid > div:nth-child(2) { border-right: 0; }
  .compatibility-grid > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .remote-configuration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .remote-camera-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .remote-configuration-grid article:nth-child(2) { border-right: 0; }
  .remote-configuration-grid article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .central-report-metrics { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .user-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-site-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .local-user-create-grid, .local-user-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .license-capacity { grid-template-columns: 1fr; }
  .topbar { position: static; gap: 10px; }
  .account-identity, .live-indicator time { display: none; }
  .page { padding: 22px 14px 48px; }
  .page-heading, .panel-heading { align-items: start; flex-direction: column; }
  .metric-grid, .report-metrics, .detail-grid, .form-grid.two, .form-grid.three, .form-grid.four, .status-grid, .compatibility-grid, .remote-configuration-grid, .remote-camera-grid, .remote-gate-grid, .remote-camera-checks, .gate-site-grid, .gate-control-grid { grid-template-columns: 1fr; }
  .compatibility-grid > div, .compatibility-grid > div:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .compatibility-grid > div:last-child { border-bottom: 0; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination-controls { align-items: center; flex-direction: row; justify-content: space-between; }
  .panel { padding: 16px; }
  .token-row { grid-template-columns: 1fr; }
  .inline-form { width: 100%; flex-wrap: wrap; }
  .inline-form select { flex: 1; min-width: 180px; }
  .remote-configuration-grid article, .remote-configuration-grid article:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .remote-configuration-grid article:last-child { border-bottom: 0; }
  .remote-settings-actions { position: static; flex-direction: column-reverse; }
  .remote-settings-actions .button { width: 100%; }
  .auth-topbar { min-height: 76px; padding: 12px 16px; }
  .auth-brand-copy .brand-wordmark { font-size: 19px; }
  .auth-brand-copy small { display: none; }
  .auth-online { padding: 6px 9px; font-size: 0; }
  .auth-online > span { width: 8px; height: 8px; }
  .auth-page { min-height: calc(100vh - 76px); padding: 18px; background-position: 58% center; }
  .central-report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .central-report-scope, .plate-registration-scope { grid-template-columns: 1fr; gap: 12px; padding: 14px 0; background: transparent; }
  .central-report-modal, .central-pdf-modal { padding: 0; }
  .central-report-modal-panel, .central-pdf-panel { width: 100%; height: 100vh; max-height: none; border: 0; border-radius: 0; }
  .central-report-modal-heading, .central-pdf-heading, .central-report-modal-body, .central-report-modal-footer { padding-left: 14px; padding-right: 14px; }
  .central-report-modal-footer { align-items: stretch; flex-direction: column; }
  .central-report-modal-actions, .central-pdf-actions { flex-wrap: wrap; }
  .local-user-create-grid, .local-user-edit-grid, .local-user-password-form { grid-template-columns: 1fr; }
  .local-user-card-heading, .local-user-card-footer { align-items: stretch; flex-direction: column; }
  .local-user-badges { justify-content: flex-start; }
  .local-user-card-footer .button, .local-user-password-form .button { width: 100%; }
  .central-report-modal-actions .button { flex: 1; }
  .user-filter-bar, .user-site-options { grid-template-columns: 1fr; }
  .user-create-panel > summary { align-items: flex-start; }
  .user-create-panel > summary span { display: none; }
}
