:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 16px;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", "Noto Sans Mono", Consolas, monospace;
  --bg: #101010;
  --sidebar: #111113;
  --surface: #151519;
  --surface-raised: #19191e;
  --surface-soft: #1d1d22;
  --line: #303037;
  --line-strong: #424149;
  --text: #edeaf3;
  --muted: #aaa7b0;
  --muted-2: #77757d;
  --accent: #71b1ff;
  --accent-soft: #17283d;
  --green: #35d28a;
  --green-soft: #102c22;
  --red: #ff606d;
  --red-soft: #32171c;
  --amber: #ffbf5b;
  --sidebar-width: 208px;
  --topbar-height: 72px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 82% -8%, rgb(113 177 255 / 10%), transparent 34rem),
    linear-gradient(rgb(255 255 255 / 1.6%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 1.6%) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 32px 32px, 32px 32px, auto;
}
button, input, select, textarea { font: inherit; }
button { border: 0; }

.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; min-height: 100vh; place-items: center; overflow: auto; padding: 28px; background: #0b0b0d; }
.login-atmosphere { position: absolute; inset: 0; background: radial-gradient(circle at 50% 20%, rgb(30 81 145 / 26%), transparent 34rem), linear-gradient(rgb(255 255 255 / 1.5%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 1.5%) 1px, transparent 1px); background-size: auto, 34px 34px, 34px 34px; mask-image: linear-gradient(to bottom, #000, transparent 92%); pointer-events: none; }
.login-card { position: relative; width: min(100%, 460px); padding: 28px; border: 1px solid #3a3941; border-radius: 16px; background: linear-gradient(145deg, rgb(28 28 33 / 97%), rgb(20 20 24 / 98%)); box-shadow: inset 0 1px rgb(255 255 255 / 4%), 0 30px 90px rgb(0 0 0 / 48%); }
.login-brand { width: min(100%, 310px); margin: 0 auto 20px; }
.login-brand img { display: block; width: 100%; height: auto; object-fit: contain; }
.login-copy { margin-bottom: 24px; text-align: center; }
.login-copy h1 { font-size: 30px; }
.login-copy p:last-child { margin: 10px auto 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.login-form { display: grid; gap: 14px; }
.login-form input { min-height: 48px; font-size: 14px; }
.login-error { padding: 10px 12px; border: 1px solid #65303a; border-radius: 8px; color: #ffabb2; background: #281419; font-size: 12px; }
.login-alarm-status { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid rgb(255 101 111 / 72%); border-radius: 8px; color: #fff1f2; background: linear-gradient(90deg, rgb(159 31 44 / 88%), rgb(214 51 64 / 72%)); box-shadow: 0 0 22px rgb(255 64 78 / 14%); }
.login-alarm-status[hidden] { display: none; }
.login-alarm-status strong { font-size: 13px; font-weight: 850; }
.login-alarm-status span { font-size: 11px; opacity: .82; }
.login-button { display: flex; min-height: 48px; align-items: center; justify-content: space-between; margin-top: 3px; padding-inline: 17px; font-size: 13px; }
.login-footer { display: flex; align-items: center; gap: 9px; margin-top: 22px; padding-top: 16px; border-top: 1px solid #34333a; color: #aaa7b0; font-size: 11px; }
.login-footer small { margin-left: auto; color: #77757d; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid #18222b;
}
.brand { display: flex; height: var(--topbar-height); align-items: center; gap: 11px; padding: 0 16px; border-bottom: 1px solid #18222b; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid #28637c; border-radius: 7px; color: var(--accent); background: #0b1d26; font-size: 15px; font-weight: 900; box-shadow: inset 0 0 18px #35bdf21a; }
.brand-copy { display: flex; min-width: 0; flex-direction: column; }
.brand-copy strong { color: #f5fbfd; font-size: 17px; letter-spacing: .14em; line-height: 1; }
.brand-copy small { margin-top: 5px; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .2em; }

.main-nav { display: grid; gap: 3px; padding: 14px 10px 10px; }
.sidebar-brand { display: grid; min-height: 66px; place-items: center; margin: 0 12px 10px; padding: 10px; border: 1px solid #2f2e35; border-radius: 9px; background: #17171b; }
.sidebar-brand { text-decoration: none; cursor: pointer; transition: border-color .16s, background .16s; }
.sidebar-brand:hover { border-color: #527eaf; background: #1b1b21; }
.sidebar-brand-wordmark { display: block; width: min(100%, 154px); max-height: 42px; object-fit: contain; }
.sidebar-brand-mark { display: none; width: 36px; height: 36px; object-fit: contain; }
.nav-button { display: flex; width: 100%; align-items: center; gap: 11px; padding: 10px 9px; border-radius: 7px; color: #81929e; background: transparent; font-size: 12px; font-weight: 650; text-align: left; cursor: pointer; transition: background .16s, color .16s; }
.nav-button:hover { color: #cbd7dd; background: #111820; }
.nav-button.active { color: #f2f8fa; background: #13232d; box-shadow: inset 2px 0 var(--accent); }
.nav-icon { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border: 1px solid #26343e; border-radius: 6px; color: #647783; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .06em; }
.nav-button.active .nav-icon { border-color: #28617a; color: var(--accent); background: #0c2633; }
.sidebar-footer { display: flex; align-items: center; gap: 9px; margin: auto 10px 12px; padding: 11px; border: 1px solid #1b282f; border-radius: 8px; background: #0c1318; }
.sidebar-footer > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.sidebar-footer strong { color: #aebdc5; font-size: 10px; font-weight: 650; }
.sidebar-footer small { margin-top: 2px; color: var(--muted-2); font-size: 8px; }
.health-dot, .signal-pulse { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #35d28a10, 0 0 13px #35d28a75; }

.main-column { min-width: 0; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: var(--topbar-height); align-items: center; justify-content: space-between; gap: 20px; padding: 0 20px; border-bottom: 1px solid #1a252d; background: #090e13eF; backdrop-filter: blur(14px); }
.page-context { display: flex; min-width: 0; flex-direction: column; }
.page-context span { color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .18em; }
.page-context strong { margin-top: 3px; overflow: hidden; color: #eaf1f4; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.clock { display: flex; min-width: 98px; flex-direction: column; align-items: flex-end; padding-right: 11px; border-right: 1px solid var(--line); }
.clock span { color: var(--muted-2); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.clock strong { margin-top: 2px; color: #c7d3d9; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 600; }
.db-badge, .status { display: inline-flex; min-height: 30px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; color: #899aa5; background: #0d141a; font-size: 9px; font-weight: 750; white-space: nowrap; }
.db-badge::before, .status::before { width: 5px; height: 5px; border-radius: 50%; background: #60727d; content: ""; }
.db-badge { color: #7da7b9; }
.db-badge::before { background: var(--accent); box-shadow: 0 0 8px #4ac8ff80; }
.status.running { border-color: #214d3b; color: #7ee4b2; background: var(--green-soft); }
.status.running::before { background: var(--green); box-shadow: 0 0 8px #35d28a90; }
.status.paused { border-color: #5b4726; color: #ffd18a; background: #281f12; }
.status.paused::before { background: var(--amber); }
.status.error { border-color: #6a2d35; color: #ff9ea6; background: var(--red-soft); }
.status.error::before { background: var(--red); box-shadow: 0 0 8px #ff606d90; }

.shell { width: 100%; padding: 18px 20px 30px; }
.page { display: none; }
.page.active { display: block; }
.dashboard-heading, .page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.dashboard-overview { margin-bottom: 12px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.red-text { color: var(--red); }
h1 { margin: 0; color: #f0f5f7; font-size: clamp(22px, 2.1vw, 30px); font-weight: 590; letter-spacing: -.035em; }
h2 { margin: 0; color: #e7eef1; font-size: 14px; font-weight: 650; }
h3 { margin: 18px 0 10px; color: #dce6ea; font-size: 12px; }
.page-description { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.operation-state { display: flex; min-width: 190px; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.operation-state div { display: flex; min-width: 0; flex-direction: column; }
.operation-state small { color: var(--muted-2); font-size: 7px; font-weight: 850; letter-spacing: .14em; }
.operation-state strong { margin-top: 3px; color: #bdcbd2; font-size: 10px; font-weight: 650; }

.panel, .control-card, .stat { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 14px 35px #00000024; }
.panel { border-radius: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.stat { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; }
.stat-code { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border: 1px solid #254251; border-radius: 6px; color: #65bddd; background: #0d2029; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; font-weight: 800; }
.stat > div { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 8px; flex: 1; }
.stat div span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.stat div strong { color: #edf4f6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 19px; font-weight: 650; }
.danger-stat .stat-code { border-color: #563038; color: #ff8b94; background: #261318; }
.danger-stat div strong { color: #ff8992; }

.control-card { display: grid; grid-template-columns: 138px 190px minmax(210px, 1fr) auto; align-items: end; gap: 10px; margin-bottom: 10px; padding: 11px; border-radius: 9px; }
.control-title { display: flex; align-self: center; flex-direction: column; }
.control-title span { color: #b8c6cc; font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.control-title small { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.stream-actions, .button-row, .form-actions, .inline-form { display: flex; align-items: center; gap: 7px; }
.source-field:not([hidden]) + .stream-actions { grid-column: 1 / -1; justify-content: flex-end; }
.advanced { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid #1b252d; }
.advanced summary { display: flex; align-items: center; gap: 8px; color: #81939e; font-size: 9px; font-weight: 750; cursor: pointer; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { color: var(--accent); content: "+"; font-family: ui-monospace, monospace; font-size: 12px; }
.advanced[open] summary::before { content: "-"; }
.advanced summary small { color: var(--muted-2); font-size: 8px; font-weight: 500; }
.advanced-grid { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)) minmax(220px, 1.4fr) auto; align-items: end; gap: 9px; padding-top: 10px; }

label span, .zone-field > span, .field-label { display: block; margin-bottom: 5px; color: #7e909b; font-size: 9px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid #26343e; border-radius: 6px; outline: none; color: #dce6ea; background: #090f14; font-size: 11px; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 76px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #485963; }
input:focus, select:focus, textarea:focus { border-color: #34718a; box-shadow: 0 0 0 3px #4ac8ff10; }
button { min-height: 34px; padding: 8px 12px; border-radius: 6px; color: #dce8ed; background: #17222a; font-size: 10px; font-weight: 750; cursor: pointer; transition: filter .15s, transform .1s, background .15s; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .35; cursor: not-allowed; }
.primary { color: #06130d; background: var(--green); }
.secondary { color: #b8d9e7; background: #142a35; }
.danger { color: #ffd6d9; background: #56232b; }
.check { display: flex; min-height: 36px; align-items: center; gap: 7px; }
.check input { width: 16px; min-height: 16px; height: 16px; padding: 0; accent-color: var(--green); }
.check span { margin: 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 10px; }
.video-card, .history-card { height: calc(100vh - 295px); min-height: 520px; overflow: hidden; }
.video-card { display: flex; min-width: 0; flex-direction: column; background: #06090c; }
.history-card { background: #0b1117; }
.card-title { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #0d141a; }
.card-title > div { display: flex; flex-direction: column; }
.panel-kicker { margin-bottom: 3px; color: var(--muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7px; font-weight: 800; letter-spacing: .16em; }
.card-title > span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 8px; }
.backend-label { padding: 4px 6px; border: 1px solid #23333d; border-radius: 4px; color: #7196a6; background: #0a1116; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mobile-camera-chooser { display: none; padding: 9px 10px; border-bottom: 1px solid #2d2c32; background: #111116; }
.mobile-camera-chooser:not([hidden]) { display: block; }
.mobile-camera-chooser label { display: grid; gap: 5px; }
.mobile-camera-chooser span { color: #85828b; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.mobile-camera-chooser select { min-height: 42px; border-color: #45444c; color: #f0edf4; background: #1b1b21; font-size: 13px; }

.camera-grid { --camera-columns: 2; display: flex; flex: 1; min-height: 0; flex-wrap: wrap; align-content: stretch; align-items: stretch; gap: 6px; padding: 6px; overflow: auto; background: #030507; }
.camera-grid > .camera-tile { display: flex; min-width: 0; min-height: 0; flex: 1 1 var(--camera-basis, 100%); flex-direction: column; overflow: hidden; border: 1px solid #263641; border-radius: 6px; background: #05090c; }
.camera-tile-title { display: flex; min-height: 28px; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 8px; border-bottom: 1px solid #17232b; color: #657985; background: #091016; font-size: 8px; }
.camera-tile-title strong { overflow: hidden; color: #b9c8cf; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.camera-tile-title strong::before { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: #536671; content: ""; }
.camera-stage { position: relative; display: grid; min-height: 110px; flex: 1; place-items: center; overflow: hidden; background: #010304; }
.camera-frame { display: none; width: 100%; height: 100%; object-fit: contain; }
.camera-placeholder { display: flex; position: absolute; inset: 0; align-items: center; justify-content: center; color: #4c606c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; text-align: center; }
.camera-empty { display: grid; min-height: 130px; flex: 1 1 100%; place-items: center; color: #52636d; font-size: 10px; }
.camera-session-status { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.grid-status-running { color: var(--green); }
.grid-status-running::before { background: var(--green) !important; }
.grid-status-error { color: var(--red); }
.grid-status-reconnecting { color: var(--amber); }
.manual-grid { display: block; padding: 0; }
.manual-camera-tile { height: 100%; border: 0 !important; border-radius: 0 !important; }
.video-stage { position: relative; display: grid; min-height: 430px; height: 100%; place-items: center; overflow: hidden; background: #010304; }
#frame { display: none; width: 100%; height: 100%; object-fit: contain; }
#zoneCanvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
#zoneCanvas.drawing { pointer-events: auto; cursor: crosshair; }
.zone-hint { position: absolute; z-index: 3; top: 12px; left: 50%; padding: 7px 10px; transform: translateX(-50%); border-radius: 4px; color: #06130d; background: var(--green); font-size: 9px; font-weight: 800; }
.placeholder { display: flex; flex-direction: column; align-items: center; gap: 5px; color: #50626d; font-size: 10px; }
.placeholder strong { color: #83949d; font-size: 13px; font-weight: 600; }

.empty-history { display: flex; min-height: 180px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 20px; color: var(--muted-2); text-align: center; }
.empty-history::before { display: grid; width: 32px; height: 32px; margin-bottom: 4px; place-items: center; border: 1px solid #26343e; border-radius: 50%; color: #607580; content: "--"; font-family: ui-monospace, monospace; font-size: 9px; }
.empty-history strong { color: #8798a1; font-size: 11px; font-weight: 600; }
.empty-history span { font-size: 9px; }
.plate-list { display: grid; max-height: calc(100% - 52px); gap: 5px; padding: 6px; overflow: auto; }
.plate-entry { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 8px; padding: 7px; border: 1px solid #1d2931; border-radius: 6px; background: #0f171e; }
.plate-entry:hover { border-color: #2e4552; background: #111c24; }
.plate-crop { width: 92px; height: 52px; object-fit: contain; border: 1px solid #202e37; border-radius: 4px; background: #030506; }
.plate-meta { display: grid; min-width: 0; justify-items: end; gap: 2px; }
.plate-number { padding: 2px 6px; border: 2px solid #151a1d; border-radius: 3px; color: #111719; background: #eff1e8; font-family: "Arial Narrow", Arial, sans-serif; font-size: 15px; font-weight: 900; letter-spacing: .06em; }
.plate-time, .plate-detail { max-width: 100%; overflow: hidden; color: #647783; font-size: 8px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.type-ABONE { color: var(--green); }
.type-KAYITSIZ { color: var(--red); }

.page-title { align-items: center; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid #18232b; }
.management-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); gap: 10px; }
.management-grid.equal { grid-template-columns: 1fr 1fr; }
.table-panel { overflow: hidden; }
.table-wrap { max-height: calc(100vh - 180px); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th, td { padding: 10px 11px; border-bottom: 1px solid #1b262e; text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: #61747f; background: #0e161c; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
td { color: #aab9c0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #111c23; }
.editor-panel, .section-panel { padding: 14px; }
.editor-panel > h2 { margin-bottom: 14px; }
.section-panel { margin-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { margin-top: 3px; }
.compact-list, .selection-list { display: grid; gap: 5px; margin-top: 10px; }
.selection-list { padding: 6px; }
.compact-item, .selection-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid #1f2c35; border-radius: 6px; background: #101820; }
.selection-item { cursor: pointer; }
.selection-item:hover { border-color: #355264; background: #12202a; }
.compact-item strong, .selection-item strong { color: #c5d1d7; font-size: 10px; font-weight: 650; }
.compact-item small, .selection-item small { color: #667984; font-size: 8px; }
.compact-item button { min-height: 27px; padding: 5px 8px; }
.inline-form { flex-wrap: wrap; }
.inline-form input, .inline-form select { min-width: 145px; flex: 1; }
.inline-form button { flex: 0 0 auto; }
.table-thumb { width: 112px; height: 63px; object-fit: contain; border-radius: 4px; background: #030506; }
.badge { display: inline-flex; padding: 3px 6px; border: 1px solid #2a3c47; border-radius: 4px; color: #9eafb7; background: #15212a; font-size: 8px; font-weight: 750; }
.badge.good { border-color: #24523f; color: #70dda8; background: #10281e; }
.badge.bad { border-color: #5b2a31; color: #ff8e97; background: #2a1519; }
.settings-panel { max-width: 760px; }
.error { margin: 0 0 10px; padding: 9px 11px; border: 1px solid #65303a; border-radius: 6px; color: #ffabb2; background: #281419; font-size: 10px; }
.video-card > .error { margin: 6px; }
.relay-choice { flex-wrap: wrap; }
.relay-choice .check { min-height: auto; }
hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }

.sidebar { background: linear-gradient(180deg, #121215 0%, #101012 100%); border-right-color: #2a292f; }
.brand { position: relative; height: var(--topbar-height); justify-content: center; gap: 13px; padding: 8px; border-bottom-color: #2a292f; }
.brand-mark { width: 36px; height: 36px; border-color: #4d78ab; border-radius: 9px; color: #b8d8ff; background: linear-gradient(145deg, #1e3550, #172438); font-size: 17px; box-shadow: inset 0 1px rgb(255 255 255 / 8%), 0 8px 24px rgb(0 0 0 / 25%); }
.brand-logo-mark { display: block; width: 52px; height: auto; object-fit: contain; }
.brand-copy strong { font-size: 18px; letter-spacing: .12em; }
.brand-copy small { margin-top: 6px; color: #8a8790; font-size: 11px; letter-spacing: .14em; }
.sidebar-toggle { display: flex; width: auto; min-height: 40px; align-items: center; justify-content: center; gap: 9px; margin: auto 12px 8px; padding: 8px 10px; border: 1px solid #3b3a42; border-radius: 8px; color: #c7c4cd; background: #1a1a1f; box-shadow: inset 0 1px rgb(255 255 255 / 3%); font-size: 12px; }
.sidebar-toggle:hover:not(:disabled) { border-color: #5784b6; color: #e1efff; background: #1c2633; }
.sidebar-toggle-icon { color: var(--accent); font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: -.12em; }
.sidebar-toggle-label { white-space: nowrap; }
.main-nav { gap: 5px; padding: 14px 12px 10px; }
.main-nav { min-height: 0; overflow-y: auto; }
.nav-button { gap: 12px; min-height: 44px; padding: 10px 11px; border-radius: 8px; color: #aaa7b0; font-size: 13px; font-weight: 550; }
.nav-button:hover { color: #edeaf3; background: rgb(237 234 243 / 5%); }
.nav-button.active { color: #f4f1f8; background: linear-gradient(90deg, rgb(113 177 255 / 16%), rgb(113 177 255 / 6%)); box-shadow: inset 2px 0 var(--accent); }
.nav-button.modal-active { color: #dcf6e9; background: linear-gradient(90deg, rgb(53 210 138 / 18%), rgb(53 210 138 / 5%)); box-shadow: inset 2px 0 var(--green); }
.nav-button.modal-active .nav-icon { border-color: #327a5c; color: #a4f0ca; background: #153126; }
.nav-icon { width: 28px; height: 28px; flex-basis: 28px; border-color: #3b3a41; border-radius: 7px; color: #8f8c96; font-family: var(--mono); font-size: 10px; }
.nav-button.active .nav-icon { border-color: #527eaf; color: #c5e0ff; background: #182a40; }
.sidebar-footer { gap: 11px; margin: 0 12px 14px; padding: 13px; border-color: #302f35; border-radius: 9px; background: #17171b; }
.sidebar-footer strong { color: #d3d0d9; font-size: 12px; }
.sidebar-footer small { margin-top: 3px; color: #817f87; font-size: 11px; }

.main-column { transition: none; }
.topbar { padding-inline: 24px; border-bottom-color: #2a292f; background: rgb(16 16 16 / 88%); }
.topbar-left { display: flex; min-width: 0; align-items: center; gap: 18px; }
.page-context { padding-left: 0; border-left: 0; }
.page-context span { color: #85828b; font-size: 11px; letter-spacing: .13em; }
.page-context strong { margin-top: 5px; font-size: 16px; font-weight: 580; }
.clock { min-width: 116px; padding-right: 14px; border-right-color: #35343b; }
.clock span { color: #85828b; font-size: 11px; }
.clock strong { margin-top: 3px; font-family: var(--mono); font-size: 13px; }
.db-badge, .status { min-height: 36px; padding-inline: 12px; border-color: #35343b; border-radius: 8px; color: #aaa7b0; background: #17171b; font-size: 11px; }
.db-badge { color: #b8d8ff; }
.user-chip { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 4px 9px 4px 5px; border: 1px solid #35343b; border-radius: 9px; background: #17171b; }
.user-chip > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 7px; color: #cce3ff; background: #21354d; font-size: 12px; font-weight: 750; }
.user-chip div { display: flex; min-width: 72px; flex-direction: column; }
.user-chip strong { overflow: hidden; max-width: 120px; color: #dedbe4; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { margin-top: 1px; color: #85828b; font-size: 10px; }
.logout-button { min-height: 36px; padding-inline: 11px; border: 1px solid #44353a; color: #e8b7bc; background: #24181b; font-size: 11px; }

.shell { padding: 14px 18px 18px; }
.dashboard-heading, .page-title { margin-bottom: 18px; }
.eyebrow { margin-bottom: 7px; font-size: 11px; letter-spacing: .16em; }
h1 { font-size: clamp(27px, 2.1vw, 36px); font-weight: 520; line-height: 1.08; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; }
.page-description { margin-top: 9px; color: #aaa7b0; font-size: 13px; line-height: 1.55; }
.operation-state { min-width: 220px; gap: 13px; padding: 12px 15px; border-color: #38373e; border-radius: 10px; background: linear-gradient(145deg, #1a1a1f, #151519); box-shadow: inset 0 1px rgb(255 255 255 / 3%); }
.operation-state small { color: #89868f; font-size: 11px; }
.operation-state strong { margin-top: 5px; color: #dedbe4; font-size: 13px; }

.panel, .control-card, .stat { border-color: #34333a; background: linear-gradient(145deg, #18181d 0%, #151519 72%); box-shadow: inset 0 1px rgb(255 255 255 / 3%), 0 16px 40px rgb(0 0 0 / 18%); }
.panel { border-radius: 12px; }
.stats-grid { gap: 12px; margin-bottom: 14px; }
.stat { gap: 14px; min-height: 68px; padding: 13px 16px; border-radius: 10px; }
.stat-code { width: 38px; height: 38px; flex-basis: 38px; border-color: #47688e; border-radius: 8px; color: #b9d9ff; background: #192a3e; font-family: var(--mono); font-size: 11px; }
.stat div span { color: #aaa7b0; font-size: 12px; }
.stat div strong { color: #f3f0f7; font-family: var(--mono); font-size: 24px; }
.danger-stat .stat-code { border-color: #70404a; color: #ffadb5; background: #321b21; }

.control-card { grid-template-columns: 160px 220px minmax(230px, 1fr) auto; gap: 12px; margin-bottom: 14px; padding: 14px; border-radius: 11px; }
.control-title span { color: #d0cdd6; font-size: 11px; letter-spacing: .1em; }
.control-title small { margin-top: 5px; color: #8b8891; font-size: 11px; }
.stream-actions, .button-row, .form-actions, .inline-form { gap: 9px; }
.advanced { padding-top: 11px; border-top-color: #302f35; }
.advanced summary { gap: 9px; color: #b5b2bb; font-size: 12px; }
.advanced summary::before { font-size: 15px; }
.advanced summary small { color: #85828b; font-size: 11px; }
.advanced-grid { gap: 11px; padding-top: 13px; }

label span, .zone-field > span, .field-label { margin-bottom: 7px; color: #aaa7b0; font-size: 12px; font-weight: 550; }
input, select, textarea { min-height: 42px; padding: 9px 12px; border-color: #3b3a42; border-radius: 8px; color: #edeaf3; background: #101014; font-size: 13px; }
textarea { min-height: 90px; }
input::placeholder, textarea::placeholder { color: #74717a; }
input:focus, select:focus, textarea:focus { border-color: #71b1ff; box-shadow: 0 0 0 3px rgb(113 177 255 / 12%); }
button { min-height: 40px; padding: 9px 15px; border-radius: 8px; color: #e2dfe9; background: #25252b; font-size: 12px; font-weight: 650; }
.primary { color: #101010; background: var(--accent); }
.control-card #startButton { color: #07130e; background: var(--green); }
.secondary { color: #d8d5de; background: #25252b; }
.danger { color: #ffdadd; background: #54242c; }
.check { min-height: 42px; gap: 9px; }
.check input { width: 18px; height: 18px; min-height: 18px; }

.dashboard-overview { display: grid; grid-template-columns: minmax(270px, 1.45fr) minmax(155px, .75fr) repeat(4, minmax(125px, .8fr)); align-items: stretch; gap: 10px; margin-bottom: 10px; }
.dashboard-overview .dashboard-heading, .dashboard-overview .stats-grid { display: contents; }
.dashboard-overview .dashboard-heading > div:first-child { align-self: center; min-width: 0; }
.dashboard-overview .dashboard-heading h1 { font-size: clamp(25px, 1.8vw, 33px); white-space: nowrap; }
.dashboard-overview .page-description { overflow: hidden; margin-top: 5px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-overview .operation-state { min-width: 0; min-height: 66px; align-self: stretch; padding: 10px 12px; }
.dashboard-overview .stat { min-height: 66px; padding: 10px 11px; }
.dashboard-overview .stat-code { width: 34px; height: 34px; flex-basis: 34px; }
.dashboard-overview .stat > div { align-items: flex-start; flex-direction: column; gap: 2px; }
.dashboard-overview .stat div span { font-size: 10px; }
.dashboard-overview .stat div strong { font-size: 20px; line-height: 1; }
.workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
#page-dashboard.active { display: flex; height: calc(100vh - var(--topbar-height) - 32px); min-height: 560px; flex-direction: column; }
#page-dashboard .workspace { min-height: 0; flex: 1; }
.video-card, .history-card { height: 100%; min-height: 0; }
.video-card { background: #0b0b0d; }
.history-card { background: #151519; }
.card-title { min-height: 56px; padding: 9px 14px; border-bottom-color: #34333a; background: linear-gradient(180deg, #1a1a1f, #17171b); }
.panel-kicker { margin-bottom: 5px; color: #8c8992; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; }
.card-title > span { gap: 10px; color: #aaa7b0; font-size: 11px; }
.compact-select { width: auto; min-width: 58px; min-height: 30px; height: 30px; padding: 4px 24px 4px 8px; border-radius: 6px; font-size: 11px; }
.backend-label { padding: 5px 8px; border-color: #3c3b43; border-radius: 6px; color: #b3cce9; background: #121820; font-family: var(--mono); font-size: 11px; }

.camera-grid { gap: 8px; padding: 8px; background: #09090b; }
.camera-grid { display: grid; grid-template-columns: repeat(var(--camera-columns, 1), minmax(0, 1fr)); grid-auto-rows: var(--camera-row-height, 340px); align-content: flex-start; overflow-x: hidden; overflow-y: auto; }
.camera-grid > .camera-tile { width: 100%; height: 100%; min-height: 0; border-color: #3a3940; border-radius: 8px; background: #0d0d10; }
.camera-stage { min-height: 280px; }
.camera-frame { max-width: 100%; max-height: 100%; object-fit: contain; }
.camera-tile { position: relative; cursor: zoom-in; }
.camera-tile:fullscreen { display: flex; width: 100vw; height: 100vh; max-width: none; max-height: none; flex-direction: column; border: 0; border-radius: 0; background: #000; cursor: zoom-out; }
.camera-tile:fullscreen .camera-tile-title { min-height: 50px; padding-inline: 16px; font-size: 13px; }
.camera-tile:fullscreen .camera-tile-title strong { font-size: 14px; }
.camera-tile:fullscreen .camera-stage,
.camera-tile:fullscreen .video-stage { min-height: 0; flex: 1; }
.camera-tile:fullscreen .camera-frame,
.camera-tile:fullscreen #frame { width: 100%; height: 100%; object-fit: contain; }
.camera-tile-title { min-height: 38px; padding: 7px 11px; border-bottom-color: #2d2c32; color: #aaa7b0; background: #17171b; font-size: 11px; }
.camera-tile-title > strong { min-width: 0; flex: 1; color: #dedbe4; font-family: var(--mono); font-size: 12px; }
.camera-tile-title strong::before { width: 6px; height: 6px; margin-right: 8px; }
.camera-title-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 6px; }
.camera-zone-button { min-height: 27px; padding: 4px 8px; border: 1px solid #45444c; border-radius: 6px; color: #bbb8c1; background: #202027; font-family: var(--mono); font-size: 9px; white-space: nowrap; }
.camera-zone-button:hover, .camera-zone-button.active { border-color: #35d28a; color: #73e8b2; background: #123126; }
.camera-context-menu { position: fixed; z-index: 1000; display: grid; width: min(310px, calc(100vw - 20px)); gap: 6px; padding: 9px; border: 1px solid #3a3940; border-radius: 10px; background: rgb(16 16 20 / 98%); box-shadow: 0 18px 48px rgb(0 0 0 / 48%), 0 0 0 1px rgb(255 255 255 / 3%) inset; backdrop-filter: blur(14px); }
.camera-context-menu[hidden] { display: none; }
.camera-context-title { display: flex; min-width: 0; flex-direction: column; gap: 3px; padding: 4px 5px 7px; }
.camera-context-title span { color: #78b7ff; font-family: var(--mono); font-size: 9px; font-weight: 850; letter-spacing: .18em; }
.camera-context-title strong { overflow: hidden; color: #f0edf4; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.camera-context-menu button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 39px; padding: 8px 9px; border: 1px solid #34333a; border-radius: 8px; color: #dedbe4; background: #1b1b21; text-align: left; }
.camera-context-menu button:hover { border-color: #4e7fb6; background: #222631; }
.camera-context-menu button span { color: #9c99a3; font-size: 10px; }
.camera-context-menu button strong { color: #f2eff7; font-size: 11px; font-weight: 700; }
.camera-context-menu button.is-on strong, .camera-context-menu button.selected strong { color: #75ebb5; }
.camera-context-menu button.is-off strong { color: #ff8f9a; }
.camera-context-menu button.selected { border-color: rgb(53 210 138 / 68%); background: #10251d; }
.camera-context-separator { height: 1px; margin: 2px 3px; background: #2c2b31; }
.camera-context-menu small { padding: 4px 5px 1px; color: #aaa7b0; font-size: 10px; }
.camera-placeholder { color: #8d8a93; font-family: var(--mono); font-size: 12px; }
.camera-empty { color: #918e97; font-size: 13px; }
.camera-session-status { font-family: var(--mono); font-size: 11px; }
.camera-tile-zone-canvas { position: absolute; inset: 0; z-index: 7; width: 100%; height: 100%; pointer-events: none; }
.camera-zone-editor-bar { z-index: 8; display: none; min-height: 46px; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border-bottom: 1px solid rgb(53 210 138 / 55%); background: #10251d; }
.camera-zone-editor-label { color: #e5e2ea; font-size: 11px; font-weight: 650; }
.camera-zone-editor-actions { display: flex; gap: 6px; }
.camera-zone-editor-actions button { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.camera-tile.zone-editing { cursor: default; }
.camera-tile.zone-editing .camera-tile-zone-canvas { pointer-events: auto; cursor: crosshair; touch-action: none; }
.camera-tile.zone-editing .camera-zone-editor-bar { display: flex; }
.camera-tile.zone-editing .camera-placeholder, .camera-tile.zone-editing .camera-plate-alert, .camera-tile.zone-editing .camera-security-alert { display: none !important; }
.camera-plate-alert { position: absolute; z-index: 5; right: 10px; bottom: 10px; left: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 42px; padding: 8px 11px; border: 1px solid rgb(93 235 166 / 72%); border-radius: 8px; color: #07170f; background: linear-gradient(90deg, rgb(53 210 138 / 96%), rgb(101 231 168 / 92%)); box-shadow: 0 10px 28px rgb(0 0 0 / 42%), 0 0 24px rgb(53 210 138 / 16%); cursor: default; animation: plate-alert-in .18s ease-out; }
.camera-plate-alert span { font-size: 10px; font-weight: 850; letter-spacing: .08em; white-space: nowrap; }
.camera-plate-alert strong { overflow: hidden; font-family: var(--mono); font-size: 18px; font-weight: 850; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.camera-plate-alert small { font-size: 10px; font-weight: 750; opacity: .75; }
.camera-security-alert { position: absolute; z-index: 6; right: 10px; bottom: 62px; left: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 46px; padding: 8px 11px; border: 1px solid rgb(255 101 111 / 82%); border-radius: 8px; color: #fff1f2; background: linear-gradient(90deg, rgb(159 31 44 / 97%), rgb(214 51 64 / 94%)); box-shadow: 0 12px 30px rgb(0 0 0 / 52%), 0 0 28px rgb(255 64 78 / 20%); cursor: default; animation: plate-alert-in .18s ease-out; }
.camera-security-alert.has-image { cursor: pointer; }
.camera-security-alert span { font-size: 10px; font-weight: 850; letter-spacing: .09em; white-space: nowrap; }
.camera-security-alert strong { overflow: hidden; font-size: 12px; font-weight: 850; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.camera-security-alert small { font-family: var(--mono); font-size: 10px; font-weight: 700; white-space: nowrap; }
@keyframes plate-alert-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.video-stage { background: #09090b; }
.zone-hint { padding: 8px 12px; border-radius: 6px; font-size: 12px; }
.placeholder { gap: 7px; color: #918e97; font-size: 13px; }
.placeholder strong { color: #d0cdd6; font-size: 16px; }

.empty-history { gap: 7px; color: #8f8c95; }
.empty-history::before { width: 40px; height: 40px; border-color: #3b3a42; color: #aaa7b0; font-size: 11px; }
.empty-history strong { color: #d0cdd6; font-size: 14px; }
.empty-history span { font-size: 12px; line-height: 1.45; }
.plate-list { max-height: calc(100% - 66px); gap: 8px; padding: 8px; }
.plate-entry { grid-template-columns: 104px minmax(0, 1fr); gap: 10px; padding: 9px; border-color: #34333a; border-radius: 8px; background: #1a1a1f; }
.plate-entry:hover { border-color: #52515a; background: #1e1e24; }
.plate-crop { width: 104px; height: 59px; border-color: #3c3b42; border-radius: 6px; }
.recent-photo-button { display: block; min-height: 0; padding: 0; overflow: hidden; border: 0; background: transparent; cursor: zoom-in; }
.recent-photo-button .plate-crop { display: block; }
.security-entry { border-color: #63313a; background: linear-gradient(135deg, #261519, #1a1a1f); }
.security-entry:hover { border-color: #a34858; background: linear-gradient(135deg, #32191f, #201e23); }
.security-event-label { color: #ff8995; font-family: var(--mono); font-size: 13px; font-weight: 850; letter-spacing: .06em; }
.security-clip-link, .security-clip-status { max-width: 100%; color: #86bfff; font-size: 10px; text-align: right; text-decoration: none; }
.security-clip-link:hover { color: #c2deff; text-decoration: underline; }
.security-clip-status { color: #ffc66e; }
.security-clip-status.failed { color: #ff8995; }
.alarm-toggle-button { min-height: 30px; padding: 5px 9px; border: 1px solid #24523f; color: #9cf0c6; background: #10281e; font-size: 10px; }
.alarm-toggle-button.off { border-color: #5b2a31; color: #ffb7be; background: #2a1519; }
.alarm-sound-button { min-height: 30px; padding: 5px 9px; border: 1px solid #5b4726; color: #ffd18a; background: #281f12; font-size: 10px; }
.alarm-silence-button { min-height: 34px; padding: 6px 12px; border: 1px solid #ff6a75; color: #fff; background: #a51f2d; font-size: 11px; font-weight: 800; animation: alarm-silence-pulse 1s ease-in-out infinite; }
@keyframes alarm-silence-pulse { 50% { box-shadow: 0 0 18px rgb(255 65 78 / 55%); } }
.plate-meta { gap: 4px; }
.plate-number { padding: 3px 7px; font-size: 17px; }
.plate-time, .plate-detail { color: #aaa7b0; font-size: 11px; }

.page-title { margin-bottom: 20px; padding-bottom: 18px; border-bottom-color: #302f35; }
.management-grid { gap: 14px; }
.table-wrap { max-height: calc(100vh - 200px); }
table { font-size: 13px; }
th, td { padding: 13px 14px; border-bottom-color: #302f35; }
th { color: #aaa7b0; background: #19191e; font-size: 11px; letter-spacing: .07em; }
td { color: #d0cdd6; }
tbody tr:hover { background: rgb(113 177 255 / 5%); }
.editor-panel, .section-panel { padding: 18px; }
.editor-panel > h2 { margin-bottom: 18px; }
.form-grid { gap: 13px; }
.compact-list, .selection-list { gap: 8px; margin-top: 13px; }
.security-config, .engine-switches, .alarm-schedule, .camera-source-builder { padding: 14px; border: 1px solid #3a3941; border-radius: 9px; background: #18181d; }
.camera-source-builder { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 10px; }
.camera-source-builder .field-help { grid-column: 1 / -1; margin: 0; }
.camera-zone-config { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 14px; border: 1px solid #3a3941; border-radius: 9px; background: #18181d; }
.camera-zone-config > div { min-width: 0; }
.camera-zone-config .field-help { grid-column: 1 / -1; margin: 0; }
.security-config-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.security-config-title > div { display: grid; gap: 4px; }
.security-config-title > div > span { color: #ece8f0; font-size: 13px; font-weight: 700; }
.security-config-title small, .field-help { color: #92909a; font-size: 11px; line-height: 1.5; }
.security-config-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.security-config .field-help, .engine-switches .field-help { margin: 11px 0 0; }
.engine-switches { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; }
.engine-switches .field-help { grid-column: 1 / -1; }
.selection-list { padding: 8px; }
.compact-item, .selection-item { padding: 12px 13px; border-color: #36353c; border-radius: 8px; background: #1a1a1f; }
.selection-item:hover { border-color: #577da9; background: #1c222c; }
.compact-item strong, .selection-item strong { color: #e0dde6; font-size: 13px; }
.compact-item small, .selection-item small { color: #96939c; font-size: 11px; line-height: 1.5; }
.compact-item button { min-height: 32px; padding: 6px 10px; }
.inline-form input, .inline-form select { min-width: 160px; }
.table-thumb { width: 112px; height: 63px; border-radius: 6px; }
.history-photo-button { display: block; min-height: 0; padding: 0; border: 1px solid #3c3b42; overflow: hidden; background: #08080a; }
.history-photo-button .table-thumb { display: block; border: 0; }
.muted-cell { color: #77757d; font-size: 11px; }
.empty-table-cell { height: 120px; color: #8f8c95; text-align: center; }
.badge { padding: 4px 8px; border-color: #45444c; border-radius: 6px; color: #d0cdd6; background: #222228; font-size: 11px; }
.error { padding: 11px 13px; border-radius: 8px; font-size: 12px; }

.app-shell.sidebar-collapsed { --sidebar-width: 76px; }
.sidebar-collapsed .sidebar { width: 76px; }
.sidebar-collapsed .main-column { margin-left: 76px; }
.sidebar-collapsed .nav-button > span:last-child,
.sidebar-collapsed .sidebar-toggle-label,
.sidebar-collapsed .sidebar-footer > span:last-child { display: none; }
.sidebar-collapsed .main-nav { padding-inline: 10px; }
.sidebar-collapsed .nav-button { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .nav-icon { width: 32px; height: 32px; flex-basis: 32px; }
.sidebar-collapsed .sidebar-footer { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .sidebar-toggle { width: 44px; margin-inline: auto; padding-inline: 0; }
.sidebar-collapsed .sidebar-brand { min-height: 54px; margin-inline: 10px; padding: 7px; }
.sidebar-collapsed .sidebar-brand-wordmark { display: none; }
.sidebar-collapsed .sidebar-brand-mark { display: block; }

.operation-modal { width: min(760px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; overflow: hidden; border: 1px solid #45444c; border-radius: 14px; color: var(--text); background: #151519; box-shadow: 0 30px 100px rgb(0 0 0 / 62%); }
.operation-modal::backdrop { background: rgb(4 4 6 / 76%); backdrop-filter: blur(7px); }
.operation-modal-card { display: flex; max-height: min(760px, calc(100vh - 32px)); flex-direction: column; }
.operation-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid #35343b; background: linear-gradient(145deg, #1d1d22, #17171b); }
.operation-modal-header h2 { font-size: 21px; }
.operation-modal-header p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { display: grid; width: 38px; height: 38px; min-height: 38px; flex: 0 0 38px; place-items: center; padding: 0; border: 1px solid #43424a; color: #c9c6cf; background: #24242a; font-size: 22px; font-weight: 400; }
.stream-control-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); align-items: end; gap: 15px; padding: 20px 22px 22px; overflow-y: auto; }
.stream-control-panel .source-field { grid-column: 1 / -1; }
.stream-control-panel .stream-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 2px; }
.stream-control-panel #startButton { color: #07130e; background: var(--green); }
.reading-settings { grid-column: 1 / -1; margin-top: 3px; padding-top: 17px; border-top: 1px solid #35343b; }
.modal-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal-section-title span { color: #d7d4dd; font-size: 13px; font-weight: 650; }
.modal-section-title small { color: #85828b; font-size: 11px; }
.operation-modal .advanced-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 0; }
.operation-modal .zone-field { grid-column: span 2; }
.operation-modal .zone-field .button-row button { flex: 1; }
.operation-modal .check { align-self: end; }

.history-filter-panel { padding: 16px; }
.compute-settings { padding: 14px; border: 1px solid #35343b; border-radius: 8px; background: #111115; }
.compute-settings .security-config-grid { margin-top: 12px; }
.history-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 26px 0 12px; }
.history-section-heading h2 { font-size: 18px; }
.history-section-heading small { color: var(--muted-2); font-size: 11px; text-align: right; }
.security-history-table { margin-top: 12px; }
.history-video-link { color: #86bfff; font-size: 12px; text-decoration: none; }
.history-video-link:hover { color: #c2deff; text-decoration: underline; }
.history-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); align-items: end; gap: 12px; }
.history-filter-actions { display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 9px; padding-top: 3px; }
.history-result-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #35343b; }
.history-result-bar span { color: #d5d2db; font-family: var(--mono); font-size: 12px; }
.history-result-bar small { color: #85828b; font-size: 10px; text-align: right; }

.photo-modal { width: min(940px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid #45444c; border-radius: 14px; color: var(--text); background: #0b0b0d; box-shadow: 0 30px 100px rgb(0 0 0 / 70%); }
.photo-modal::backdrop { background: rgb(2 2 3 / 84%); backdrop-filter: blur(8px); }
.photo-modal-card { display: flex; max-height: calc(100vh - 32px); flex-direction: column; }
.photo-modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 17px 20px; border-bottom: 1px solid #35343b; background: #17171b; }
.photo-modal header p:last-child { margin: 6px 0 0; color: #aaa7b0; font-size: 12px; }
.photo-modal-stage { display: grid; min-height: 260px; flex: 1; place-items: center; padding: 18px; overflow: auto; background: #050507; }
.photo-modal-stage img { display: block; max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; image-rendering: auto; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #080d11; }
::-webkit-scrollbar-thumb { border: 2px solid #080d11; border-radius: 8px; background: #263640; }
::-webkit-scrollbar-thumb:hover { background: #344a57; }

@media (max-width: 1180px) {
  .dashboard-overview { grid-template-columns: minmax(260px, 1fr) minmax(170px, .55fr) repeat(4, minmax(115px, .65fr)); gap: 8px; }
  .dashboard-overview .stat-code { display: none; }
  .control-card { grid-template-columns: 125px 180px minmax(180px, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1fr) 285px; }
  .history-filter-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}

@media (max-width: 900px) {
  .dashboard-overview { display: block; }
  .dashboard-overview .dashboard-heading { display: flex; }
  .dashboard-overview .stats-grid { display: grid; }
  .workspace { grid-template-columns: 1fr; }
  #page-dashboard.active { height: auto; min-height: 0; }
  .video-card { height: 62vh; min-height: 420px; }
  .history-card { height: auto; min-height: 320px; }
  .plate-list { max-height: 360px; }
  .management-grid, .management-grid.equal { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .advanced-grid { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
  .history-filter-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

@media (max-width: 650px) {
  :root { --sidebar-width: 0px; }
  .app-shell.sidebar-collapsed { --sidebar-width: 0px; }
  .sidebar { position: fixed; inset: auto 0 0; width: 100%; height: 56px; border-top: 1px solid var(--line); border-right: 0; }
  .sidebar-collapsed .sidebar { width: 100%; }
  .brand, .sidebar-brand, .sidebar-footer { display: none; }
  .sidebar-toggle { display: none; }
  .main-nav { display: flex; height: 100%; align-items: center; gap: 2px; padding: 5px; overflow-x: auto; }
  .nav-button { min-width: 48px; flex: 1; }
  .nav-icon { width: 28px; height: 28px; flex-basis: 28px; }
  .main-column { margin-left: 0; padding-bottom: 56px; }
  .sidebar-collapsed .main-column { margin-left: 0; }
  .topbar { padding: 0 10px; }
  .page-context span, .clock, .db-badge { display: none; }
  .user-chip div, .logout-button { display: none; }
  .user-chip { padding-right: 5px; }
  .login-screen { padding: 14px; }
  .login-card { padding: 22px 18px; }
  .login-brand { width: 250px; }
  .shell { padding: 12px 9px 20px; }
  .dashboard-heading, .page-title { align-items: flex-start; flex-direction: column; }
  .operation-state { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 8px; }
  .stat > div { align-items: flex-end; flex-direction: column; }
  .control-card { grid-template-columns: 1fr; }
  .control-title, .stream-actions, .advanced { grid-column: 1; }
  .stream-actions { flex-wrap: wrap; justify-content: stretch; }
  .stream-actions button { flex: 1; }
  .advanced-grid, .form-grid { grid-template-columns: 1fr; }
  .security-config-grid, .engine-switches { grid-template-columns: 1fr; }
  .camera-source-builder { grid-template-columns: 1fr; }
  .camera-source-builder .field-help { grid-column: auto; }
  .security-config-title { align-items: flex-start; flex-direction: column; }
  .engine-switches .field-help { grid-column: auto; }
  .span-2 { grid-column: auto; }
  .video-card { height: 68vh; min-height: 430px; }
  .card-title > span { align-items: flex-end; flex-direction: column; gap: 3px; }
  .camera-grid { grid-template-columns: 1fr !important; grid-auto-rows: minmax(340px, 1fr); overflow: hidden; }
  .camera-grid > .camera-tile { min-height: 340px; }
  .camera-tile-title { align-items: flex-start; flex-direction: column; }
  .camera-title-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .camera-session-status { margin-left: auto; }
  .camera-zone-editor-bar { align-items: stretch; flex-direction: column; }
  .camera-zone-editor-actions button { flex: 1; }
  .camera-zone-config { grid-template-columns: 1fr; }
  .camera-zone-config .field-help { grid-column: auto; }
  .operation-modal { width: calc(100vw - 18px); max-height: calc(100vh - 18px); }
  .operation-modal-card { max-height: calc(100vh - 18px); }
  .operation-modal-header { padding: 17px; }
  .stream-control-panel { grid-template-columns: 1fr; padding: 17px; }
  .operation-modal .advanced-grid { grid-template-columns: 1fr 1fr; }
  .operation-modal .zone-field { grid-column: 1 / -1; }
  .camera-plate-alert { grid-template-columns: 1fr auto; }
  .camera-plate-alert span { grid-column: 1 / -1; }
  .camera-security-alert { grid-template-columns: 1fr; }
  .camera-security-alert span { display: none; }
  .history-filter-grid { grid-template-columns: 1fr; }
  .history-filter-actions { flex-wrap: wrap; }
  .history-filter-actions button { flex: 1; }
  .history-result-bar { align-items: flex-start; flex-direction: column; gap: 5px; }
  .history-result-bar small { text-align: left; }
  .photo-modal { width: calc(100vw - 18px); max-height: calc(100vh - 18px); }
  .page-title .button-row { width: 100%; flex-wrap: wrap; }
}
