:root {
  color-scheme: light;
  font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --navy-950: #07152d;
  --navy-900: #0b2147;
  --navy-800: #0b2d6f;
  --blue-700: #134fc1;
  --blue-600: #1c63de;
  --blue-100: #eaf2ff;
  --cyan: #27c2ee;
  --gold: #f6b91a;
  --text: #102044;
  --muted: #677490;
  --line: #dce6f5;
  --panel: rgba(255,255,255,.97);
  --shadow: 0 18px 45px rgba(8, 34, 87, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #edf3fb; color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell[hidden], .login-screen[hidden], .admin-only[hidden] { display: none !important; }
.watch-page[hidden] { display: none; }
.watch-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: auto; color: #edf4ff; background: #030b19; }
.watch-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 24px; border-bottom: 1px solid #203451; background: #0a1c38; }
.watch-brand { display: flex; align-items: center; gap: 12px; color: #ecf6ff; text-decoration: none; font-weight: 900; }
.watch-navigation { display: flex; align-items: center; gap: 20px; min-width: 0; }
.watch-back-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; flex-shrink: 0; min-height: 48px; padding: 10px 18px; border: 1px solid #65d9fb; border-radius: 12px; color: #062448; background: #65d9fb; box-shadow: 0 4px 14px rgba(39,194,238,.14); text-decoration: none; font-size: .88rem; font-weight: 900; transition: background .15s, box-shadow .15s; }
.watch-back-button > span { font-size: 1.35rem; line-height: 1; }
.watch-back-button:hover { background: #a1ecff; box-shadow: 0 5px 20px rgba(39,194,238,.25); }
.watch-back-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.watch-brand img { width: 38px; height: 48px; object-fit: contain; }
.watch-brand small { display: block; margin-top: 4px; color: #82b9e5; font-size: .68rem; font-weight: 700; }
.watch-account { display: flex; align-items: center; gap: 12px; font-size: .75rem; color: #a9bfda; }
.watch-account button, .watch-controls button { min-height: 40px; border: 1px solid #31547c; border-radius: 9px; padding: 8px 13px; color: #dbedff; background: #112a4b; font-size: .75rem; font-weight: 800; }
.watch-content { display: flex; flex: 1; flex-direction: column; min-height: 0; width: 100%; max-width: 1800px; margin: 0 auto; padding: 18px 24px; }
.watch-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.watch-heading h1 { margin: 5px 0; font-size: clamp(1.1rem, 2vw, 1.6rem); overflow-wrap: anywhere; }
.watch-heading p { margin: 0; color: #8ca7c8; font-size: .78rem; }
.watch-video { position: relative; display: grid; place-items: center; flex: 1; min-height: 220px; overflow: hidden; border: 1px solid #233d61; border-radius: 14px; background: #000; }
.watch-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.watch-video video[hidden], .watch-placeholder[hidden] { display: none; }
.watch-placeholder { position: relative; display: grid; gap: 12px; justify-items: center; padding: 25px; text-align: center; color: #e0edff; pointer-events: none; }
.watch-placeholder-icon { color: #43ccf4; font-size: 2.3rem; }
.watch-placeholder p { margin: 0; color: #89a2c3; font-size: .8rem; }
.watch-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; color: #87a2c3; font-size: .7rem; }
.watch-controls > div { display: flex; gap: 8px; }
#watchFullscreen { border-color: #318fb1; background: #0c3b51; color: #8fe8ff; }
.watch-video:fullscreen { border: 0; border-radius: 0; width: 100%; height: 100%; }
@media (max-width: 760px) {
  .watch-header { padding: 10px 12px; }
  .watch-navigation { gap: 10px; }
  .watch-back-button { min-height: 48px; padding: 10px 12px; font-size: .8rem; }
  .watch-navigation .watch-brand span { display: none; }
  .watch-account > span { display: none; }
  .watch-content { padding: 14px 10px; }
  .watch-heading { align-items: start; gap: 8px; }
  .watch-video { min-height: 240px; }
  .watch-controls { flex-wrap: wrap; }
  .watch-controls > div { width: 100%; }
  .watch-controls button { flex: 1; min-height: 44px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .watch-header { padding: 5px 12px; }
  .watch-back-button { min-height: 44px; padding: 7px 13px; }
  .watch-brand img { height: 30px; width: 25px; }
  .watch-brand small, .watch-heading .live-kicker, .watch-heading p, .watch-controls > span { display: none; }
  .watch-content { padding: 6px 12px; }
  .watch-heading { margin-bottom: 5px; }
  .watch-heading h1 { margin: 0; font-size: .9rem; }
  .watch-video { min-height: 150px; }
  .watch-controls { padding-top: 5px; justify-content: flex-end; }
  .watch-controls > div { width: auto; }
  .watch-controls button { min-height: 32px; padding: 5px 10px; }
}

.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(39,194,238,.18), transparent 30%),
    radial-gradient(circle at 82% 78%, rgba(28,99,222,.26), transparent 34%),
    linear-gradient(145deg, #041126, #092a63 58%, #0f4ba9);
}
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid rgba(126,208,255,.28); border-radius: 22px; color: #fff; background: rgba(4,20,48,.9); box-shadow: 0 30px 80px rgba(0,0,0,.42); backdrop-filter: blur(18px); }
.login-brand { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 22px; border: 2px solid #72dcff; border-radius: 16px; color: var(--gold); background: rgba(0,0,0,.2); font-size: 1.25rem; font-weight: 900; letter-spacing: -.08em; }
.login-heading h1 { margin: 5px 0 4px; font-size: 1.55rem; }
.login-brand { width: 110px; height: 130px; border: 0; border-radius: 0; background: transparent; margin: 0 auto 18px; }
.login-brand img, .brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.login-heading p { margin: 0; color: #9eb5d8; font-size: .9rem; }
.login-kicker { color: #58ddff; font-size: .68rem; font-weight: 900; letter-spacing: .16em; }
.login-form { display: grid; gap: 15px; margin-top: 28px; }
.login-form label { display: grid; gap: 7px; color: #cbdcf4; font-size: .82rem; font-weight: 800; }
.login-form input { width: 100%; border: 1px solid #2d4d7a; border-radius: 11px; outline: 0; padding: 13px 14px; color: #fff; background: #071a36; }
.login-form input:focus { border-color: #4dd6ff; box-shadow: 0 0 0 3px rgba(77,214,255,.14); }
.login-form button { margin-top: 3px; border: 0; border-radius: 11px; padding: 13px 16px; color: #082351; background: var(--gold); font-weight: 900; }
.login-form button:disabled { cursor: wait; opacity: .68; }
.login-error { margin: 0; padding: 10px 12px; border: 1px solid rgba(255,94,111,.3); border-radius: 9px; color: #ffc8ce; background: rgba(232,60,78,.13); font-size: .8rem; }
.login-footnote { margin: 20px 0 0; color: #758eaf; text-align: center; font-size: .72rem; }

.app-shell { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.topbar {
  z-index: 1001; display: flex; align-items: center; flex-wrap: wrap; gap: 14px; min-height: 74px; padding: 12px 22px;
  color: #fff; background: linear-gradient(112deg, #081d48 0%, #0c3e9b 55%, #165cc9 100%);
  border-bottom: 3px solid var(--gold); box-shadow: 0 7px 24px rgba(4, 29, 81, .22);
}
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 2px solid #72dcff; border-radius: 12px; font-weight: 900; letter-spacing: -.08em; color: var(--gold); background: rgba(0,0,0,.2); }
.brand-copy { min-width: 0; }
.brand-mark { flex-shrink: 0; width: 48px; height: 58px; border: 0; border-radius: 0; background: transparent; }
.brand-copy h1 { margin: 0; font-size: 1.15rem; line-height: 1.2; }
.brand-copy p { margin: 3px 0 0; opacity: .72; font-size: .75rem; white-space: nowrap; }
.topbar-status { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 999px; font-size: .8rem; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.14); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #38e89b; box-shadow: 0 0 0 5px rgba(56,232,155,.15); }
.multi-button { border: 1px solid rgba(255,255,255,.28); border-radius: 10px; padding: 10px 14px; color: #fff; background: rgba(255,255,255,.11); font-weight: 800; }
.multi-button:hover { background: rgba(255,255,255,.2); }
.primary-button { border: 0; border-radius: 10px; padding: 11px 16px; color: #09245a; background: var(--gold); font-weight: 800; box-shadow: 0 6px 16px rgba(0,0,0,.16); }
.account-menu { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.18); }
.account-menu div { display: grid; line-height: 1.2; }
.account-menu strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; white-space: nowrap; }
.account-menu span { margin-top: 3px; color: #9edbff; font-size: .65rem; }
.account-menu button { border: 1px solid rgba(255,255,255,.22); border-radius: 8px; padding: 7px 9px; color: #fff; background: rgba(255,255,255,.08); font-size: .68rem; font-weight: 800; }
.topbar-actions { display: contents; }
.mobile-menu-toggle, .panel-toggle-short { display: none; }

.dashboard { min-height: 0; display: grid; grid-template-columns: 330px minmax(420px, 1fr) 300px; }
.dashboard.left-hidden { grid-template-columns: minmax(420px, 1fr) 300px; }
.dashboard.right-hidden { grid-template-columns: 330px minmax(420px, 1fr); }
.dashboard.left-hidden.right-hidden { grid-template-columns: minmax(0, 1fr); }
.dashboard.left-hidden .sidebar, .dashboard.right-hidden .inspector { display: none; }
.panel { min-height: 0; background: var(--panel); box-shadow: var(--shadow); z-index: 500; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); overflow: auto; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 15px; }
.panel-heading h2 { margin: 2px 0 0; font-size: 1.22rem; }
.eyebrow { display: block; color: var(--blue-600); font-size: .64rem; font-weight: 900; letter-spacing: .18em; }
.count-badge { padding: 5px 9px; border-radius: 999px; color: var(--blue-700); background: var(--blue-100); border: 1px solid #c8daf9; font-size: .75rem; font-weight: 800; }
.search-box { margin: 0 16px 12px; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #c8d8f2; border-radius: 10px; color: var(--blue-600); background: #fff; }
.search-box:focus-within { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(28,99,222,.12); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 14px; border-bottom: 1px solid var(--line); }
.filter-row .filter { flex: 1 0 auto; }
.source-icon.mobile, .type-icon.mobile { background: #176b82; }
.map-pin.mobile { background: #125468; }
.picker-source-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.filter { border: 1px solid #d8e3f4; border-radius: 8px; padding: 8px; color: #52617b; background: #f6f9fd; font-weight: 700; font-size: .78rem; }
.filter.active { color: #fff; border-color: var(--blue-600); background: var(--blue-600); }
.source-list { min-height: 0; overflow: auto; }
.source-item { width: 100%; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; padding: 14px 16px; border: 0; border-bottom: 1px solid #e6edf8; text-align: left; background: transparent; transition: .18s ease; }
.source-item:hover, .source-item.active { background: #eef5ff; box-shadow: inset 3px 0 var(--blue-600); }
.source-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; font-size: 1.12rem; color: #fff; background: linear-gradient(145deg, #134fc1, #2d91f0); }
.source-icon.camera { background: linear-gradient(145deg, #182b50, #415b83); }
.source-icon.lpr { font-size: .62rem; letter-spacing: .04em; background: linear-gradient(145deg, #805208, #e7a51a); }
.source-copy { min-width: 0; }
.source-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.source-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; }
.source-copy .list-plate { display: block; margin-top: 5px; overflow: hidden; color: #9b6509; font-size: .68rem; font-style: normal; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { align-self: start; display: flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; font-size: .65rem; font-weight: 900; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-pill.live { color: #a31621; background: #ffeaec; }.status-pill.live::before { background: #ed3346; box-shadow: 0 0 0 3px rgba(237,51,70,.12); }
.status-pill.ready { color: #087451; background: #e2f9ef; }.status-pill.ready::before { background: #18b77d; }
.status-pill.offline { color: #647087; background: #eef1f5; }.status-pill.offline::before { background: #98a3b5; }

.map-stage { position: relative; min-width: 0; min-height: 0; background: #cbd8e8; }
.workspace-toolbar { z-index: 900; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 18px; border-bottom: 1px solid #d8e3f4; background: #f8fbff; }
.workspace-toolbar-title { display: flex; align-items: center; gap: 8px; color: #61738f; font-size: .74rem; font-weight: 800; }
.workspace-toolbar-title > span { color: #1c63de; font-size: 1.1rem; }
.workspace-toolbar-actions { display: flex; gap: 8px; }
.panel-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid #ceddf3; border-radius: 10px; padding: 8px 13px; color: #164687; background: #fff; box-shadow: 0 2px 5px rgba(19,48,93,.04); font-size: .74rem; font-weight: 800; transition: background .18s, border-color .18s; }
.panel-toggle > span:first-child { font-size: 1.05rem; }
.panel-toggle:hover { border-color: #75a5ef; background: #edf5ff; }
.panel-toggle.is-hidden { border-color: #abc8f3; color: #fff; background: #185aca; }
.panel-toggle:focus-visible, .panel-collapse:focus-visible { outline: 3px solid #58c9ef; outline-offset: 2px; }
.panel-collapse { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border: 1px solid #d7e4f6; border-radius: 10px; color: #24538b; background: #f1f6fd; font-size: 1.4rem; }
.panel-collapse:hover { color: #fff; background: #1c63de; }
#map { width: 100%; height: 100%; }
.map-overlay, .map-mode-switch, .legend { z-index: 600; position: absolute; border: 1px solid rgba(197,216,244,.95); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); box-shadow: 0 12px 30px rgba(10,42,95,.18); }
.map-overlay { top: 18px; left: 18px; min-width: 255px; padding: 12px 14px; border-radius: 11px; }
.map-overlay strong { display: block; margin-top: 4px; font-size: .84rem; }
.map-mode-switch { top: 18px; right: 18px; display: flex; gap: 4px; padding: 4px; border-radius: 11px; }
.map-mode { border: 0; border-radius: 8px; padding: 9px 12px; color: #5f6d87; background: transparent; font-weight: 800; font-size: .75rem; }
.map-mode.active { color: #fff; background: var(--blue-600); box-shadow: 0 5px 14px rgba(28,99,222,.25); }
.legend { left: 18px; bottom: 18px; display: flex; gap: 14px; padding: 10px 12px; border-radius: 10px; font-size: .68rem; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }.legend-dot.live { background: #ed3346; }.legend-dot.ready { background: #18b77d; }.legend-dot.offline { background: #98a3b5; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 10px 22px rgba(10,42,95,.2) !important; }
.leaflet-control-zoom a { color: var(--blue-700) !important; border-color: #d8e4f6 !important; }
.leaflet-popup-content-wrapper { border-radius: 13px; box-shadow: 0 18px 38px rgba(7,25,61,.25); }
.leaflet-popup-content { margin: 15px 17px; min-width: 210px; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 18px; }
.metrics article { padding: 14px; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #0a2a67, #1759bd); }
.metrics article:first-child { background: linear-gradient(145deg, #be2334, #f24f5f); }
.metrics span, .metrics small { display: block; opacity: .76; font-size: .68rem; }.metrics strong { display: block; margin: 3px 0; font-size: 1.75rem; }
.inspector-section { margin: 0 16px 16px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }.section-title h3 { margin: 0; font-size: .9rem; }.section-title span { color: var(--muted); font-size: .68rem; }
.source-stat { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #edf1f7; font-size: .8rem; }.source-stat:last-child { border-bottom: 0; }.source-stat span { display: flex; align-items: center; gap: 8px; }
.type-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; font-style: normal; color: #fff; background: var(--blue-600); }.type-icon.camera { background: #334a70; }
.type-icon.lpr { background: #b5780e; font-size: .52rem; font-weight: 900; }
.type-icon { width: 34px; height: 34px; border-radius: 10px; }
.type-icon svg, .source-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.boundary-control { position: absolute; z-index: 650; top: 78px; right: 18px; width: 235px; border: 1px solid #cedcf2; border-radius: 12px; color: #163763; background: rgba(255,255,255,.97); box-shadow: 0 7px 22px rgba(10,42,95,.15); }
.boundary-control summary { cursor: pointer; padding: 12px 14px; font-size: .78rem; font-weight: 900; }
.boundary-options { display: grid; gap: 7px; padding: 0 13px 13px; }
.boundary-options label { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: .76rem; cursor: pointer; }
.boundary-options input { width: 17px; height: 17px; accent-color: #1c63de; }
.boundary-line { width: 22px; border-top: 3px solid; }.boundary-line.province { color: #a855f7; }.boundary-line.district { color: #0891b2; }.boundary-line.subdistrict { color: #d97706; border-top-style: dashed; }
.boundary-options p { margin: 4px 0; color: #687891; font-size: .67rem; line-height: 1.5; }
.boundary-options { max-height: min(65dvh, 540px); overflow-y: auto; overscroll-behavior: contain; }
.boundary-filters { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid #e1e9f6; border-bottom: 1px solid #e1e9f6; }
.boundary-filters[hidden] { display: none; }
.boundary-filters label { min-height: auto; font-weight: 800; color: #59708e; font-size: .68rem; }
.boundary-filters select { width: 100%; min-width: 0; min-height: 39px; border: 1px solid #cdddf3; border-radius: 8px; padding: 7px 9px; color: #173a6b; background: #f7faff; font-size: .74rem; }
.boundary-filters select:disabled { opacity: .5; }
.boundary-filters button { border: 0; border-radius: 8px; padding: 8px; color: #3763a0; background: #eaf2ff; font-size: .69rem; font-weight: 800; }
.boundary-options small { color: #7a879d; font-size: .58rem; }.boundary-options a { color: #34699d; }
.boundary-label { border: 0; border-radius: 5px; padding: 3px 6px; background: rgba(255,255,255,.85); box-shadow: 0 1px 4px rgba(0,0,0,.12); font-size: .65rem; font-weight: 800; pointer-events: none; }
.boundary-label-1 { color: #7e22ce; }.boundary-label-2 { color: #0e7490; }.boundary-label-3 { color: #92400e; }
.selected-card { background: linear-gradient(160deg, #f5f9ff, #fff); }
.selected-card h3 { margin: 8px 0 5px; font-size: 1rem; }.selected-card p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.selected-card .selected-meta { display: grid; gap: 7px; margin-top: 12px; color: #55637d; font-size: .75rem; }
.watch-button { width: 100%; margin-top: 14px; padding: 10px; border: 0; border-radius: 9px; color: #fff; background: var(--blue-600); font-weight: 900; }
.selected-lpr { display: grid; gap: 3px; margin-top: 13px; padding: 12px; border: 1px solid #e8c46e; border-radius: 10px; background: linear-gradient(145deg, #fffaf0, #fff3cf); }
.selected-lpr span { color: #8c661a; font-size: .67rem; font-weight: 800; text-transform: uppercase; }
.selected-lpr strong { color: #162844; font-size: 1.2rem; letter-spacing: .06em; }
.selected-lpr small { color: #796e59; font-size: .68rem; }
.selected-lpr.empty { border-color: #dce5f2; background: #f7f9fc; }.selected-lpr.empty strong { color: #71809a; font-size: .88rem; letter-spacing: 0; }
.lpr-history-button { width: 100%; margin-top: 8px; padding: 9px; border: 1px solid #e0b84e; border-radius: 9px; color: #805708; background: #fff8e5; font-weight: 900; }

.map-pin { width: 44px; height: 44px; display: grid; place-items: center; border: 4px solid #98a3b5; border-radius: 50% 50% 50% 10%; transform: rotate(-45deg); color: #fff; background: #0a2b63; box-shadow: 0 0 0 5px rgba(124,137,156,.16), 0 9px 20px rgba(5,37,90,.38); }
.map-pin > span { width: 25px; height: 25px; display: grid; place-items: center; transform: rotate(45deg); }
.map-pin svg { width: 25px; height: 25px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.map-pin.drone svg rect { fill: rgba(255,255,255,.16); }
.map-pin.camera .cctv-body { fill: rgba(255,255,255,.16); }
.map-pin.camera svg circle { fill: #fff; stroke-width: 0; }
.map-pin.lpr { color: #fff8dc; background: #6c4604; }.map-pin.lpr svg rect { fill: rgba(255,255,255,.13); }
.map-pin.live { border-color: #ed3346; box-shadow: 0 0 0 6px rgba(237,51,70,.2), 0 9px 20px rgba(5,37,90,.38); }
.map-pin.ready { border-color: #18b77d; box-shadow: 0 0 0 6px rgba(24,183,125,.2), 0 9px 20px rgba(5,37,90,.38); }
.map-pin.offline { border-color: #8a96a9; color: #d6deea; background: #46546b; box-shadow: 0 0 0 5px rgba(124,137,156,.16), 0 9px 20px rgba(5,37,90,.28); }
#map.picking-location, #map.picking-location .leaflet-grab, #map.picking-location .leaflet-interactive { cursor: crosshair !important; }
.popup-title { font-weight: 900; color: var(--navy-800); font-size: .9rem; }.popup-meta { margin: 8px 0 12px; color: var(--muted); font-size: .72rem; line-height: 1.6; }.popup-button { width: 100%; border: 0; border-radius: 8px; padding: 9px; color: #fff; background: var(--blue-600); font-weight: 800; }
.popup-manage { width: 100%; margin-top: 6px; border: 1px solid #c8d8f2; border-radius: 8px; padding: 8px; color: var(--blue-700); background: #f4f8ff; font-weight: 800; }
.popup-lpr { width: 100%; margin-top: 6px; border: 1px solid #dfba58; border-radius: 8px; padding: 8px; color: #7e570b; background: #fff7e3; font-weight: 800; }
.popup-plate { display: grid; gap: 2px; margin: 0 0 10px; padding: 9px 10px; border: 1px solid #e8c46e; border-radius: 8px; background: #fff8e5; }
.popup-plate span, .popup-plate small { color: #87714b; font-size: .63rem; }.popup-plate strong { color: #142849; font-size: 1rem; letter-spacing: .05em; }.popup-plate.empty { color: #78869c; border-color: #dce5f2; background: #f7f9fc; font-size: .7rem; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px; background: rgba(3,11,28,.72); backdrop-filter: blur(7px); }
.dialog-backdrop[hidden] { display: none; }
.stream-dialog { width: min(820px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(93,157,255,.35); border-radius: 18px; color: #fff; background: #08172f; box-shadow: 0 35px 90px rgba(0,0,0,.48); }
.stream-dialog > header, .stream-dialog > footer { flex: 0 0 auto; }
.stream-dialog > header > div { min-width: 0; }
.stream-dialog h2 { overflow-wrap: anywhere; }
.stream-dialog .icon-button { flex-shrink: 0; }
.stream-dialog header { display: flex; justify-content: space-between; align-items: start; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }.stream-dialog h2 { margin: 4px 0 0; font-size: 1.1rem; }.live-kicker { color: #58ddff; font-size: .65rem; font-weight: 900; letter-spacing: .16em; }.live-kicker i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #ff4054; box-shadow: 0 0 0 5px rgba(255,64,84,.13); }
.icon-button { border: 0; color: #d5e5ff; background: transparent; font-size: 1.7rem; }
.video-surface { position: relative; flex: 0 1 auto; min-width: 0; min-height: 0; width: 100%; aspect-ratio: 16/9; overflow: hidden; display: grid; place-items: center; text-align: center; background: radial-gradient(circle at 50% 40%, #173b72, #030a17 72%); }.video-surface strong { margin-top: 18px; }.video-surface p { margin: 5px 0 0; color: #8fa7ca; font-size: .8rem; }
.video-surface video { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; background: #000; }
.video-surface video[hidden] { display: none; }
.video-surface video:fullscreen { width: 100%; height: 100%; object-fit: contain; }
.video-placeholder { display: grid; place-content: center; justify-items: center; }
.video-placeholder[hidden] { display: none; }
.audio-toggle { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 10px; border: 1px solid #2ddd9e; border-radius: 9px; color: #a4ffdb; background: rgba(4,21,28,.92); font-size: .72rem; font-weight: 800; cursor: pointer; }
.audio-toggle.is-muted { color: #ff9aaa; border-color: #ff536e; background: rgba(48,10,23,.92); }
.audio-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
video[hidden] ~ .audio-toggle { display: none; }
.signal-animation { display: flex; align-items: end; gap: 5px; height: 38px; }.signal-animation span { width: 7px; border-radius: 5px; background: var(--cyan); animation: signal 1s ease-in-out infinite; }.signal-animation span:nth-child(1) { height: 14px; }.signal-animation span:nth-child(2) { height: 34px; animation-delay: .14s; }.signal-animation span:nth-child(3) { height: 22px; animation-delay: .28s; }
@keyframes signal { 50% { transform: scaleY(.45); opacity: .45; } }
.stream-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 20px; color: #7890b4; font-size: .68rem; }
.open-stream-tab { border: 1px solid rgba(88,221,255,.35); border-radius: 8px; padding: 8px 11px; color: #8ceaff; background: rgba(39,194,238,.09); font-weight: 900; }

.multi-backdrop { padding: 14px; }
.multi-dialog { width: min(1180px, 100%); height: min(820px, calc(100vh - 28px)); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border: 1px solid rgba(93,157,255,.35); border-radius: 18px; color: #fff; background: #061329; box-shadow: 0 35px 90px rgba(0,0,0,.55); }
.multi-header { display: flex; align-items: center; gap: 18px; padding: 15px 18px; border-bottom: 1px solid rgba(255,255,255,.1); background: linear-gradient(90deg, #091a38, #0c2e67); }
.multi-header h2 { margin: 4px 0 0; font-size: 1.08rem; }
.multi-summary { margin-left: auto; padding: 7px 11px; border: 1px solid rgba(78,216,255,.28); border-radius: 999px; color: #95e8ff; background: rgba(39,194,238,.09); font-size: .72rem; font-weight: 800; }
.multi-summary span { color: #fff; }
.multi-layout-switch { display: flex; gap: 5px; }
.multi-layout-switch button { border: 1px solid rgba(255,255,255,.18); border-radius: 7px; padding: 7px 9px; color: #bcd2f2; background: rgba(255,255,255,.05); font-size: .68rem; font-weight: 900; }
.multi-layout-switch button.active { border-color: #4ed8ff; color: #06234c; background: #59dfff; }
.multi-grid { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; padding: 8px; background: #030a17; }
.multi-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 1fr; }
.multi-grid[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: 1fr; }
.multi-grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.multi-empty { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-content: center; gap: 7px; padding: 30px; color: #dceaff; text-align: center; }
.multi-empty span { color: #7890b4; font-size: .78rem; }
.multi-tile { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr; overflow: hidden; border: 1px solid #19335e; border-radius: 10px; background: #08172f; }
.multi-tile.expanded { grid-column: 1 / -1; grid-row: 1 / -1; }
.multi-grid:has(.multi-tile.expanded) .multi-tile:not(.expanded) { display: none; }
.tile-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.08); background: #0a1d3b; }
.channel-number { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: #8fe7ff; background: rgba(39,194,238,.1); font-size: .7rem; font-weight: 900; }
.tile-source-button { display: flex; align-items: center; gap: 9px; min-width: 0; width: 100%; min-height: 36px; padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; color: #eef6ff; background: transparent; text-align: left; font-size: .76rem; }
.tile-source-button:hover { border-color: #355b88; background: #123158; }
.tile-source-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.source-status { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; padding: 5px 8px; border: 1px solid; border-radius: 999px; font-size: .6rem; font-weight: 900; letter-spacing: .03em; }
.source-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.source-status.live { color: #ff7b88; border-color: #783147; background: #3e1b2d; }
.source-status.ready { color: #5fe4b0; border-color: #24614f; background: #0d352f; }
.source-status.offline { color: #9aa9bf; border-color: #3a4861; background: #202c41; }
.source-picker-backdrop { z-index: 2300; background: rgba(2,9,22,.65); }
.source-picker { display: flex; flex-direction: column; width: min(540px, 100%); max-height: min(680px, calc(100dvh - 40px)); overflow: hidden; border: 1px solid #345580; border-radius: 18px; color: #ecf4ff; background: #081a35; box-shadow: 0 30px 90px rgba(0,0,0,.5); }
.source-picker header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 12px; }
.source-picker h2 { margin: 5px 0 0; font-size: 1.02rem; }
.source-picker .icon-button { min-width: 40px; min-height: 40px; border-radius: 9px; background: rgba(255,255,255,.04); }
.source-picker-search { display: flex; align-items: center; gap: 10px; margin: 0 16px; padding: 10px 13px; border: 1px solid #2d4e77; border-radius: 11px; color: #67cffa; background: #041127; }
.source-picker-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: #eef6ff; background: transparent; font-size: .82rem; }
.source-picker-search:focus-within { border-color: #51c9f4; }
.source-picker-legend { display: flex; gap: 7px; padding: 12px 18px; border-bottom: 1px solid #203653; }
.source-picker-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.source-picker-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 65px; margin-bottom: 4px; padding: 10px; border: 1px solid transparent; border-radius: 11px; color: #e4eeff; background: transparent; text-align: left; }
.source-picker-option:hover { background: #112d50; }
.source-picker-option.selected { border-color: #3679b5; background: #123253; }
.picker-source-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; color: #6edbff; background: #173555; }
.picker-source-copy { display: grid; flex: 1; min-width: 0; gap: 4px; }
.picker-source-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .81rem; }
.picker-source-copy small { color: #8da7c9; font-size: .67rem; }
.picker-check { width: 16px; color: #65dcff; font-weight: 900; }
.picker-empty { padding: 25px; color: #9aafcb; text-align: center; font-size: .8rem; }
.tile-source-button:focus-visible, .source-picker-option:focus-visible { outline: 2px solid #5dd7ff; outline-offset: -2px; }
.expand-tile { width: 28px; height: 28px; border: 1px solid rgba(255,255,255,.16); border-radius: 7px; color: #b9d5ff; background: rgba(255,255,255,.05); }
.tile-video { position: relative; min-height: 0; display: grid; place-content: center; justify-items: center; text-align: center; background: radial-gradient(circle at 50% 45%, #153a70, #020710 75%); }
.tile-video::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(59,130,246,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(59,130,246,.035) 1px, transparent 1px); background-size: 34px 34px; }
.tile-video strong { z-index: 1; margin-top: 12px; font-size: .82rem; }.tile-video small { z-index: 1; margin-top: 4px; color: #7890b4; font-size: .66rem; }
.tile-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile-video.has-stream { place-content: stretch; }
.tile-video .signal-animation { z-index: 1; transform: scale(.75); }
.tile-video.ready .signal-animation span { background: #f6b91a; animation: none; opacity: .65; }.tile-video.offline .signal-animation span { background: #68758b; animation: none; height: 8px; opacity: .5; }
.tile-status { position: absolute; z-index: 2; top: 10px; left: 10px; display: flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; color: #fff; background: rgba(5,12,25,.7); font-size: .6rem; font-weight: 900; }
.tile-status i { width: 6px; height: 6px; border-radius: 50%; background: #ed3346; box-shadow: 0 0 0 3px rgba(237,51,70,.14); }.tile-status.ready i { background: #2ddd9e; box-shadow: 0 0 0 3px rgba(45,221,158,.14); }.tile-status.offline i { background: #7c899c; }
.multi-footer { display: flex; justify-content: space-between; gap: 20px; padding: 9px 14px; color: #7187aa; background: #07142b; font-size: .65rem; }

.lpr-dialog { width: min(720px, 100%); max-height: min(760px, calc(100vh - 32px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid rgba(243,190,62,.42); border-radius: 18px; color: #fff; background: #08172f; box-shadow: 0 35px 90px rgba(0,0,0,.5); }
.lpr-dialog > header { display: flex; align-items: start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); background: linear-gradient(90deg, #171d2a, #59400c); }
.lpr-dialog h2 { margin: 4px 0 0; font-size: 1.08rem; }
.lpr-dialog > footer { display: flex; justify-content: space-between; gap: 12px; padding: 11px 16px; color: #8fa1bd; background: #07142b; font-size: .65rem; }
.lpr-history { min-height: 260px; overflow-y: auto; padding: 12px; background: #061126; }
.lpr-event { display: grid; grid-template-columns: 112px 1fr; gap: 13px; padding: 11px; border-bottom: 1px solid #172c4d; border-radius: 10px; background: rgba(255,255,255,.025); }
.lpr-event + .lpr-event { margin-top: 7px; }
.lpr-thumb { width: 112px; aspect-ratio: 16/10; display: grid; place-items: center; overflow: hidden; border: 1px solid #294163; border-radius: 8px; color: #657b9e; background: #030a16; font-size: .66rem; }
.lpr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lpr-thumb.missing::after { content: "ไม่มีภาพ"; }
.lpr-event-copy { min-width: 0; display: grid; align-content: center; gap: 4px; }
.lpr-event-copy strong { color: #ffe39b; font-size: 1.1rem; letter-spacing: .06em; }
.lpr-event-copy span { color: #cfdbec; font-size: .74rem; }
.lpr-event-copy small { overflow: hidden; color: #7f93b3; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.lpr-loading, .lpr-empty-state { min-height: 250px; display: grid; place-content: center; gap: 5px; color: #8ea3c2; text-align: center; }
.lpr-empty-state strong { color: #d9e6f8; }.lpr-empty-state span { font-size: .73rem; }.lpr-empty-state.error strong { color: #ffadb7; }

.key-dialog { width: min(720px, 100%); max-height: calc(100vh - 32px); display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; border: 1px solid rgba(93,157,255,.35); border-radius: 18px; color: #fff; background: #08172f; box-shadow: 0 35px 90px rgba(0,0,0,.5); }
.key-dialog > header { display: flex; align-items: start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); background: linear-gradient(90deg, #091a38, #0c2e67); }
.key-dialog h2 { margin: 4px 0 0; font-size: 1.08rem; }
.key-form, .key-result { min-height: 0; display: grid; gap: 14px; padding: 20px; overflow-y: auto; }
.key-form[hidden], .key-result[hidden] { display: none; }
.push-credentials[hidden] { display: none; }
.key-form label, .key-result label { display: grid; gap: 6px; }
.key-form label > span, .key-result label > span { color: #9fb6d7; font-size: .75rem; font-weight: 800; }
.key-form input:not([type="radio"]):not([type="checkbox"]), .key-form select, .key-form textarea { width: 100%; border: 1px solid #27436f; border-radius: 9px; outline: 0; padding: 11px 12px; color: #eef6ff; background: #0b203f; }
.key-form select option { color: #102044; background: #fff; }
.key-form textarea { resize: vertical; line-height: 1.5; }
.key-form input:focus, .key-form select:focus, .key-form textarea:focus { border-color: #3dcbed; box-shadow: 0 0 0 3px rgba(39,194,238,.12); }
.form-section { display: grid; gap: 12px; padding: 15px; border: 1px solid #1d3a65; border-radius: 12px; background: rgba(8,32,67,.72); }
.form-section h3 { display: flex; align-items: center; gap: 9px; margin: 0; color: #dceaff; font-size: .86rem; }
.form-section h3 > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; color: #78e2ff; background: rgba(39,194,238,.1); font-size: .68rem; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.time-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 11px; border: 1px solid #27436f; border-radius: 9px; }
.time-slots legend { padding: 0 6px; color: #9fb6d7; font-size: .75rem; font-weight: 800; }
.time-slots label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; padding: 7px 8px; border-radius: 7px; color: #dceaff; background: rgba(255,255,255,.035); font-size: .72rem; }
.time-slots input, .form-confirm input { accent-color: #27c2ee; }
.form-confirm { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid #27436f; border-radius: 9px; color: #c6d8f2; background: rgba(255,255,255,.035); font-size: .76rem; }
.form-confirm label { display: block; }
.map-pick-button { border: 1px dashed #3981c8; border-radius: 9px; padding: 10px; color: #7be1ff; background: rgba(39,194,238,.07); font-weight: 800; }
.form-note { margin: 0; color: #7890b4; font-size: .72rem; line-height: 1.5; }
.form-error { margin: 0; padding: 9px 11px; border-radius: 8px; color: #ffc1c7; background: rgba(232,60,78,.13); font-size: .75rem; }
.create-key-button, .done-button { border: 0; border-radius: 9px; padding: 11px 14px; color: #06245a; background: var(--gold); font-weight: 900; }
.key-success { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid rgba(56,232,155,.25); border-radius: 11px; background: rgba(56,232,155,.08); }
.key-success > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #052b20; background: #38e89b; font-weight: 900; }
.key-success strong, .key-success small { display: block; }.key-success small { margin-top: 3px; color: #8ebcae; font-size: .7rem; }
.copy-row { display: grid; grid-template-columns: minmax(0,1fr) auto; overflow: hidden; border: 1px solid #27436f; border-radius: 9px; background: #030b19; }
.copy-row code { min-width: 0; overflow: auto; padding: 11px 12px; color: #58ddff; white-space: nowrap; font-size: .72rem; }
.copy-row button { border: 0; border-left: 1px solid #27436f; padding: 0 12px; color: #d6e8ff; background: #12315d; font-size: .72rem; font-weight: 800; }
.key-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px; }
.revoke-button { border: 1px solid #814052; border-radius: 9px; padding: 11px; color: #ffbec6; background: rgba(232,60,78,.12); font-weight: 900; }
.revoke-button.activate { border-color: #16745b; color: #8df1cc; background: rgba(56,232,155,.1); }
.delete-point-button { border: 1px solid #a92f48; border-radius: 9px; padding: 11px; color: #fff; background: #8e2038; font-weight: 900; }
.users-dialog { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; border: 1px solid rgba(93,157,255,.35); border-radius: 18px; color: #fff; background: #08172f; box-shadow: 0 35px 90px rgba(0,0,0,.5); }
.users-dialog > header { position: sticky; top: 0; z-index: 2; display: flex; align-items: start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); background: linear-gradient(90deg, #091a38, #0c2e67); }
.users-dialog h2 { margin: 4px 0 0; font-size: 1.08rem; }
.user-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 10px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.user-form label { display: grid; gap: 6px; color: #b9cae6; font-size: .76rem; font-weight: 800; }
.user-form input, .user-form select { width: 100%; border: 1px solid #294c7e; border-radius: 8px; padding: 10px; color: #fff; background: #061328; }
.user-form .form-error { grid-column: 1 / -1; }
.user-list { display: grid; gap: 8px; padding: 16px 20px 22px; }
.user-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid rgba(120,166,230,.18); border-radius: 10px; background: rgba(255,255,255,.035); }
.user-row strong { display: block; }
.user-row small { color: #91a9ca; }
.role-badge { border-radius: 999px; padding: 5px 9px; color: #bcecff; background: rgba(39,194,238,.12); font-size: .7rem; font-weight: 900; }
.user-status-button { border: 1px solid #365a89; border-radius: 8px; padding: 7px 10px; color: #fff; background: #15355f; font-weight: 800; }
.user-status-button.inactive { border-color: #287259; color: #9ef0d0; background: rgba(39,144,104,.15); }
.manage-key-button { width: 100%; margin-top: 8px; padding: 9px; border: 1px solid #c5d8f5; border-radius: 9px; color: var(--blue-700); background: #fff; font-weight: 800; }
.map-pick-hint { position: fixed; z-index: 1900; top: 92px; left: 50%; transform: translateX(-50%); padding: 10px 15px; border-radius: 999px; color: #fff; background: #0b2d6f; box-shadow: var(--shadow); font-size: .8rem; font-weight: 800; }

@media (max-width: 1100px) {
  .dashboard { grid-template-columns: 240px minmax(0, 1fr) 230px; }
  .dashboard.left-hidden { grid-template-columns: minmax(0, 1fr) 230px; }
  .dashboard.right-hidden { grid-template-columns: 240px minmax(0, 1fr); }
  .dashboard.left-hidden.right-hidden { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .boundary-control { top: 92px; right: 12px; width: min(235px, calc(100% - 24px)); }
  .source-picker-backdrop { align-items: end; padding: 10px; }
  .source-picker { max-height: calc(85dvh - 20px); border-radius: 20px; }
  .tile-header { gap: 5px; padding: 7px; }
  .tile-source-button { gap: 5px; min-height: 44px; padding: 4px; }
  .source-picker-option { min-height: 70px; }
  html, body { overflow: auto; }.login-screen { padding: 16px; }.login-card { padding: 26px 22px; border-radius: 18px; }.app-shell { min-height: 100vh; height: auto; grid-template-rows: auto auto; }.topbar { flex-wrap: wrap; padding: 12px 14px; }.brand-copy p, .topbar-status { display: none; }#multiViewButton { margin-left: auto; }.multi-button { padding: 9px 10px; font-size: .72rem; }.primary-button { padding: 9px 10px; font-size: .72rem; }.account-menu { width: 100%; justify-content: flex-end; padding: 8px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.14); }.dashboard { display: flex; flex-direction: column; }.map-stage { order: -1; height: 56vh; min-height: 420px; }.sidebar { height: 44vh; min-height: 390px; }.inspector { display: block; }.map-overlay { left: 12px; top: 12px; min-width: 0; max-width: calc(100% - 24px); }.map-mode-switch { top: auto; right: 12px; bottom: 12px; }.panel-toggle { top: auto; bottom: 68px; transform: none; padding: 8px; }.legend { display: none; }.stream-dialog footer { align-items: stretch; flex-direction: column; }.multi-dialog { height: calc(100vh - 16px); }.multi-header { flex-wrap: wrap; gap: 8px; }.multi-layout-switch { order: 3; width: 100%; }.multi-layout-switch button { flex: 1; }.multi-grid[data-count] { grid-template-columns: 1fr; grid-template-rows: repeat(var(--mobile-screen-count, 4), minmax(180px, 1fr)); overflow: auto; }.multi-grid[data-count="2"] { --mobile-screen-count: 2; }.multi-grid[data-count="3"] { --mobile-screen-count: 3; }.multi-grid[data-count="4"] { --mobile-screen-count: 4; }.multi-tile.expanded { grid-column: 1; grid-row: 1; min-height: calc(100vh - 150px); }.multi-summary { display: none; }.multi-footer { display: none; }.coordinate-grid, .key-actions { grid-template-columns: 1fr; }
  .lpr-dialog { max-height: calc(100vh - 16px); }.lpr-event { grid-template-columns: 86px 1fr; }.lpr-thumb { width: 86px; }.lpr-dialog > footer { flex-direction: column; }
}
@media (max-width: 760px) { .user-form { grid-template-columns: 1fr; }.user-row { grid-template-columns: 1fr auto; }.user-row .role-badge { grid-column: 2; grid-row: 1; } }
@media (max-width: 760px), (max-width: 1024px) and (max-height: 500px) {
  body:has(.app-shell:not([hidden])) { overflow: hidden; }
  .app-shell { height: 100vh; height: 100dvh; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); }
  .topbar { position: relative; min-height: 52px; flex-wrap: nowrap; gap: 7px; padding: 6px 10px; }
  .brand-copy p, .topbar-status { display: none; }
  .brand-mark { width: 27px; height: 36px; }
  .brand-copy { flex: 1; }
  .brand-copy h1 { font-size: .85rem; white-space: nowrap; }
  #multiViewButton { margin-left: 0; flex-shrink: 0; min-height: 32px; padding: 6px 8px; font-size: .66rem; border-radius: 8px; }
  .mobile-menu-toggle { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: #fff; background: rgba(255,255,255,.1); font-size: 1.15rem; }
  .topbar-actions { position: absolute; z-index: 1100; display: none; top: calc(100% + 5px); right: 10px; width: min(260px, calc(100vw - 20px)); padding: 10px; border: 1px solid #3468ac; border-radius: 12px; background: #092451; box-shadow: 0 12px 35px rgba(3,16,42,.35); }
  .topbar-actions.mobile-open { display: grid; gap: 8px; }
  .topbar-actions > button { width: 100%; min-height: 38px; text-align: left; }
  .topbar-actions .account-menu { justify-content: space-between; gap: 8px; margin-top: 2px; }
  .topbar-actions .account-menu { width: 100%; padding: 8px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.14); }
  .workspace-toolbar { position: static; padding: 4px 10px; gap: 6px; }
  .workspace-toolbar-title { display: none; }
  .workspace-toolbar-actions { width: auto; gap: 6px; }
  .panel-toggle { position: static; transform: none; flex: none; min-height: 30px; padding: 4px 9px; gap: 5px; border-radius: 7px; font-size: .65rem; box-shadow: none; }
  .panel-toggle > span:first-child { font-size: .85rem; }
  .panel-toggle-label { display: none; }
  .panel-toggle-short { display: inline; }
  .panel-toggle-short::after { content: " −"; opacity: .7; }
  .panel-toggle.is-hidden .panel-toggle-short::after { content: " +"; }
  .panel-collapse { width: 32px; height: 32px; }
  .dashboard { position: relative; display: block; min-height: 0; overflow: hidden; }
  .map-stage, .dashboard.left-hidden.right-hidden .map-stage { position: absolute; inset: 0; height: 100%; min-height: 0; }
  .dashboard .sidebar, .dashboard .inspector { position: absolute; z-index: 800; bottom: 8px; left: 8px; right: 8px; width: auto; height: min(55dvh, 420px); min-height: 0; border: 1px solid #cbdcf5; border-radius: 16px; box-shadow: 0 -8px 32px rgba(10,42,95,.22); overflow: auto; }
  .dashboard .sidebar { display: flex; overflow: hidden; }
  .dashboard .inspector { display: block; }
  .dashboard.left-hidden .sidebar, .dashboard.right-hidden .inspector { display: none; }
  .dashboard .panel-heading { padding: 12px 14px 9px; }
  .dashboard .panel-heading h2 { font-size: 1rem; }
  .dashboard .search-box { height: 38px; margin-bottom: 8px; }
  .dashboard .filter-row { padding-bottom: 8px; }
  .dashboard .source-item { padding: 10px 12px; }
  .map-overlay { display: none; }
  .map-mode-switch { top: auto; bottom: 10px; left: 10px; right: auto; padding: 3px; border-radius: 9px; }
  .map-mode { min-height: 30px; padding: 5px 8px; font-size: .65rem; }
  .boundary-control { top: 10px; right: 10px; width: auto; max-width: calc(100% - 20px); border-radius: 9px; }
  .boundary-control summary { padding: 8px 10px; min-height: 32px; font-size: .68rem; }
  .boundary-control[open] { width: min(235px, calc(100% - 20px)); }
  .boundary-options { max-height: min(50dvh, 350px); padding: 0 10px 10px; gap: 5px; }
  .key-dialog > header { padding: 14px 16px; }
  #closeKeyDialog { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.07); }
}
