:root {
  color-scheme: light;
  --bg: #eef3f0;
  --surface: #ffffff;
  --surface-2: #f3f7f4;
  --ink: #071713;
  --text: #13251f;
  --muted: #63736c;
  --border: #d6e0db;
  --accent: #146b51;
  --accent-2: #0e4f43;
  --accent-soft: #dff1e9;
  --amber: #d8912b;
  --warning: #9b6415;
  --ready: #0d7a4f;
  --danger: #ad3b32;
  --shadow: 0 14px 38px rgba(12, 32, 25, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(20, 107, 81, 0.12), transparent 28rem),
    linear-gradient(90deg, rgba(19, 37, 31, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(19, 37, 31, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 42px 42px, 42px 42px, auto;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

body:not(.authenticated) {
  min-height: 100vh;
}

body:not(.authenticated) .app-shell {
  display: none;
}

body.authenticated .login-view {
  display: none;
}

html.has-saved-session:not(.session-ready) .login-view {
  display: none;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(7, 23, 19, 0.94), rgba(14, 79, 67, 0.88)),
    radial-gradient(circle at 72% 20%, rgba(216, 145, 43, 0.28), transparent 22rem);
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.login-dev-banner {
  display: none;
}

html.dev-environment .login-dev-banner {
  display: grid;
  min-height: 82px;
  place-items: center;
  border: 2px solid rgba(173, 59, 50, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(173, 59, 50, 0.16), rgba(216, 145, 43, 0.18));
  color: #ad3b32;
  font-size: 58px;
  font-weight: 950;
  line-height: 1;
}

.login-panel h1,
.login-panel p {
  margin: 0;
}

.login-panel h1 {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.brand-kicker {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
}

.login-panel p,
.login-panel label span,
.login-error {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.login-panel label {
  display: grid;
  gap: 6px;
}

.login-panel input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
}

.login-panel input:focus {
  border-color: #95cfd4;
  box-shadow: 0 0 0 3px rgba(8, 123, 131, 0.12);
}

.login-error {
  min-height: 16px;
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 200px minmax(320px, 0.85fr) minmax(360px, 1.15fr);
  grid-template-rows: 72px calc(100vh - 72px);
  min-height: 100vh;
}

.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(280px, 0.8fr) minmax(360px, 1.2fr);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(90deg, #071713, #0e2b24 68%, #15352c);
  color: #f5fbf7;
  backdrop-filter: blur(10px);
}

.topbar h1,
.topbar p,
.panel-head h2,
.panel-head p,
.sidebar h2 {
  margin: 0;
}

.brand-block {
  display: grid;
  grid-template-columns: 38px max-content;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  min-width: 250px;
}

.brand-mark {
  display: grid;
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(216, 145, 43, 0.55);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(216, 145, 43, 0.22), rgba(255, 255, 255, 0.05));
  color: #ffd58f;
  font-size: 12px;
  font-weight: 950;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.05;
}

.topbar p {
  margin-top: 3px;
  color: rgba(245, 251, 247, 0.62);
  font-size: 12px;
}

.topbar p:empty {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-switch {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 270px;
}

.login-switch select {
  width: 45%;
  height: 32px;
  font-size: 12px;
  font-weight: 750;
}

.login-user-label {
  min-width: 74px;
  color: rgba(245, 251, 247, 0.78);
  font-size: 12px;
  font-weight: 850;
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.view-tab {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(245, 251, 247, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.view-tab.active {
  background: #f5fbf7;
  color: var(--accent-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.status-pill {
  min-width: 86px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 251, 247, 0.78);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.status-pill.ready {
  border-color: rgba(116, 221, 165, 0.4);
  background: rgba(20, 107, 81, 0.34);
  color: #aef1ca;
}

.status-pill.busy {
  border-color: #ead9a8;
  background: #fff7df;
  color: var(--warning);
}

.sidebar,
.detail,
.content {
  min-height: 0;
}

.sidebar {
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: #fbfdfd;
  overflow: auto;
}

.sidebar-collapsed .sidebar {
  padding: 0;
  border-right: 0;
  overflow: hidden;
}

.sidebar-collapsed .sidebar > * {
  display: none;
}

.sidebar section + section {
  margin-top: 24px;
}

.sidebar h2 {
  padding: 0 8px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.nav-item.active {
  border-color: #b9dbdf;
  background: var(--accent-soft);
  color: #075e65;
  font-weight: 700;
}

.nav-item span:last-child {
  color: var(--muted);
  font-size: 11px;
}

.content {
  display: flex;
  flex-direction: column;
  padding: 14px;
  overflow: hidden;
}

.dashboard-view,
.admin-view,
.data-ops-view,
.ai-model-view,
.alert-view,
.signage-view {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

body.view-cameras .dashboard-view,
body.view-cameras .admin-view,
body.view-cameras .data-ops-view,
body.view-cameras .ai-model-view,
body.view-cameras .alert-view,
body.view-cameras .signage-view,
body.view-alerts .sidebar,
body.view-alerts .content,
body.view-alerts .detail,
body.view-alerts .dashboard-view,
body.view-alerts .admin-view,
body.view-alerts .data-ops-view,
body.view-alerts .ai-model-view,
body.view-alerts .signage-view,
body.view-signage .sidebar,
body.view-signage .content,
body.view-signage .detail,
body.view-signage .dashboard-view,
body.view-signage .admin-view,
body.view-signage .data-ops-view,
body.view-signage .ai-model-view,
body.view-signage .alert-view,
body.view-dashboard .sidebar,
body.view-dashboard .content,
body.view-dashboard .detail,
body.view-dashboard .admin-view,
body.view-dashboard .data-ops-view,
body.view-dashboard .ai-model-view,
body.view-dashboard .alert-view,
body.view-dashboard .signage-view,
body.view-customers .sidebar,
body.view-customers .content,
body.view-customers .detail,
body.view-customers .dashboard-view,
body.view-customers .data-ops-view,
body.view-customers .ai-model-view,
body.view-customers .alert-view,
body.view-customers .signage-view,
body.view-inventory .sidebar,
body.view-inventory .content,
body.view-inventory .detail,
body.view-inventory .dashboard-view,
body.view-inventory .data-ops-view,
body.view-inventory .ai-model-view,
body.view-inventory .alert-view,
body.view-inventory .signage-view,
body.view-data .sidebar,
body.view-data .content,
body.view-data .detail,
body.view-data .dashboard-view,
body.view-data .admin-view,
body.view-data .ai-model-view,
body.view-data .alert-view,
body.view-data .signage-view,
body.view-ai-model .sidebar,
body.view-ai-model .content,
body.view-ai-model .detail,
body.view-ai-model .dashboard-view,
body.view-ai-model .admin-view,
body.view-ai-model .data-ops-view,
body.view-ai-model .alert-view,
body.view-ai-model .signage-view {
  display: none;
}

body.view-dashboard .app-shell,
body.view-alerts .app-shell,
body.view-signage .app-shell,
body.view-customers .app-shell,
body.view-inventory .app-shell,
body.view-data .app-shell,
body.view-ai-model .app-shell {
  grid-template-columns: 1fr;
}

body.view-customers .device-registration-section,
body.view-customers .notification-card,
body.view-customers #saveAdminButton,
body.view-inventory .customer-registration-section,
body.view-inventory .customer-camera-section,
body.view-inventory .customer-management-section {
  display: none;
}

body.view-customers .customer-registration-section {
  grid-template-columns: minmax(320px, 760px);
}

.dashboard-hero,
.map-panel,
.events-panel,
.camera-tile-panel,
.admin-panel,
.data-ops-panel,
.data-ops-card,
.signage-panel,
.alert-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.signage-view {
  display: grid;
  padding: 14px;
  overflow: auto;
}

.signage-panel {
  width: min(1360px, 100%);
  margin: 0 auto;
  overflow: hidden;
}

.signage-url-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fbf8;
}

.signage-url-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.signage-url-box input {
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.signage-preview-wrap {
  padding: 14px;
  background: #071713;
}

.signage-preview-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #071713;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 116px;
  padding: 18px;
}

.dashboard-hero h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.dashboard-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
  min-width: min(660px, 58vw);
}

.summary-card {
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfb;
  color: var(--text);
}

.summary-card strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.summary-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.summary-card.alert {
  border-color: #efb8b8;
  background: #fff2f2;
  color: var(--danger);
}

.data-ops-panel {
  display: grid;
  gap: 14px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

.ai-model-panel {
  display: grid;
  gap: 14px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

.ai-model-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(320px, 0.7fr);
  gap: 14px;
  align-items: start;
}

.ai-model-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.ai-model-side-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.ai-model-card textarea {
  min-height: 130px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  resize: vertical;
}

.ai-model-wide-field {
  display: grid;
  gap: 6px;
}

.ai-model-live-status,
.ai-model-test-mode {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.55;
}

.ai-model-live-status.ready {
  color: var(--accent-2);
}

.ai-model-live-status.error {
  color: var(--danger);
}

.ai-model-help {
  display: grid;
  gap: 10px;
}

.ai-model-help h3,
.ai-model-help p {
  margin: 0;
}

.ai-model-help p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.6;
}

.ai-model-help pre {
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f5f8f7;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.data-ops-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.data-ops-kpi {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.data-ops-kpi.ready {
  border-color: #b8ddd1;
  background: #effaf5;
}

.data-ops-kpi.warn {
  border-color: #eed2a4;
  background: #fff8ed;
}

.data-ops-kpi span,
.data-ops-kpi small,
.data-ops-load-note,
.data-ops-tenant-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.data-ops-kpi strong {
  font-size: 24px;
  line-height: 1;
}

.data-ops-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.data-ops-card {
  padding: 14px;
}

.data-ops-bars,
.data-ops-load,
.data-ops-tenant-rows,
.data-ops-camera-rows {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.data-ops-bar-row {
  display: grid;
  grid-template-columns: 92px minmax(120px, 1fr) 42px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  font-weight: 820;
}

.data-ops-bar,
.data-ops-meter,
.data-ops-mini-bars {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #edf3f0;
}

.data-ops-bar i,
.data-ops-meter i,
.data-ops-mini-bars i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.data-ops-bar i.error,
.data-ops-mini-bars i.error {
  background: var(--danger);
}

.data-ops-bar i.skipped,
.data-ops-mini-bars i.skipped {
  background: var(--amber);
}

.data-ops-bar i.processing {
  background: #2c7a95;
}

.data-ops-bar i.none {
  background: #9aa7a1;
}

.data-ops-load-row {
  display: grid;
  gap: 8px;
}

.data-ops-load-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 820;
}

.data-ops-load-note {
  display: grid;
  gap: 4px;
  padding-top: 4px;
}

.data-ops-tenant-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.7fr) minmax(220px, 0.85fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.data-ops-camera-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr) minmax(220px, 0.8fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.data-ops-tenant-row > div:first-child,
.data-ops-tenant-metrics,
.data-ops-camera-row > div:first-child,
.data-ops-camera-status {
  display: grid;
  gap: 4px;
}

.data-ops-camera-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.data-ops-detection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.data-ops-detection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #cfe3da;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
}

.data-ops-detection-chip strong {
  color: var(--text);
  font-size: 13px;
}

.data-ops-detection-chip.alert {
  border-color: #efb8b8;
  background: #fff2f2;
  color: var(--danger);
}

.data-ops-detection-chip.muted {
  color: var(--muted);
}

.data-ops-line-code {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.data-ops-line-code code {
  padding: 2px 7px;
  border: 1px solid #b9ded0;
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.data-ops-mini-bars {
  display: flex;
}

.data-ops-mini-bars i {
  border-radius: 0;
}

.ai-test-card {
  display: grid;
  gap: 12px;
}

.ai-test-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ai-test-controls input {
  min-height: 36px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.ai-test-paste-zone {
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px dashed #9bb7ae;
  border-radius: 8px;
  background: #f7fbf9;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  outline: 0;
}

.ai-test-paste-zone:focus {
  border-color: #95cfd4;
  box-shadow: 0 0 0 3px rgba(8, 123, 131, 0.12);
}

.ai-test-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 8px;
}

.ai-test-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: cover;
  background: #edf3f0;
}

.ai-test-result {
  display: grid;
  gap: 5px;
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.ai-test-result strong {
  color: var(--text);
  font-size: 20px;
}

.alert-panel {
  display: grid;
  gap: 14px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

.alert-section-head h3,
.alert-section-head p {
  margin: 0;
}

.alert-section-head h3 {
  font-size: 15px;
}

.alert-section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.notification-rule-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.notification-rule-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fbfdfd;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.notification-rule-pill.alert {
  border-color: #efb8b8;
  background: #fff2f2;
  color: var(--danger);
}

.notification-rule-pill.muted {
  color: var(--muted);
}

.alert-history-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.alert-history-list {
  display: grid;
  gap: 8px;
}

.alert-history-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.alert-history-row:hover {
  border-color: #b9ded0;
  background: #f6fbf8;
}

.alert-history-row div {
  display: grid;
  gap: 4px;
}

.alert-history-row span,
.alert-history-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.notification-settings-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.alert-panel .notification-settings-panel {
  margin-top: 0;
}

.notification-settings-panel[hidden] {
  display: none;
}

.notification-target-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notification-target-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 850;
}

.notification-settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 180px);
  gap: 10px;
}

.notification-settings-grid.alert-settings-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.notification-settings-grid.notification-rule-grid {
  grid-template-columns: minmax(128px, 1fr) minmax(168px, 1.2fr) 92px 116px 116px minmax(116px, 140px);
  align-items: end;
}

.notification-settings-grid.line-channel-grid {
  grid-template-columns: minmax(220px, 0.85fr) minmax(260px, 1fr);
}

.notification-settings-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.notification-settings-grid input,
.notification-settings-grid select,
.notification-settings-grid textarea {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.notification-settings-grid textarea {
  height: auto;
  min-height: 74px;
  padding: 9px;
  resize: vertical;
  font: inherit;
}

.notification-comment-field {
  grid-column: 1 / -1;
}

.notification-settings-grid input:disabled,
.notification-settings-grid .muted-input {
  background: #eef2f1;
  color: #8b9692;
  cursor: not-allowed;
}

.notification-all-day-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
  gap: 6px;
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
}

.notification-channel-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.notification-channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notification-channel-head h4,
.notification-channel-head p {
  margin: 0;
}

.notification-channel-head h4 {
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 950;
}

.notification-channel-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.line-channel-card {
  border-color: #b9ded0;
  background: linear-gradient(180deg, #f8fffb, #f2fbf5);
}

.line-registration-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #b9ded0;
  border-radius: 8px;
  background: #f0faf4;
}

.line-registration-box div {
  display: grid;
  gap: 4px;
}

.line-registration-box span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.line-registration-box strong {
  font-size: 18px;
  letter-spacing: 0;
}

.line-registration-box p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
}

.line-registration-command {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  width: min(360px, 100%);
}

.line-registration-command span {
  grid-column: 1 / -1;
}

.line-registration-command code {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid #b9ded0;
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.line-recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.line-recipient-chip button {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #cfe3da;
  border-radius: 999px;
  background: #ffffff;
  color: #7a2e2e;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
}

.line-recipient-chip button:hover {
  border-color: #d9a9a9;
  background: #fff2f2;
}

.line-registration-command .secondary-button {
  min-height: 34px;
  padding-inline: 12px;
}

.line-registration-steps {
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  font-size: 13px;
  font-weight: 820;
  line-height: 1.7;
  min-width: 0;
}

.line-registration-steps li {
  margin: 2px 0;
  padding-left: 4px;
}

.line-guide-links {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.line-guide-links a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #b9ded0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.notification-time-field input {
  width: 116px;
}

.line-friend-link {
  min-height: 34px;
  justify-content: center;
}

.line-friend-link.disabled {
  pointer-events: none;
  opacity: 0.55;
}

.line-test-box {
  display: grid;
  gap: 6px;
  align-content: start;
}

.line-test-box > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.line-test-box .secondary-button {
  width: 100%;
  height: 38px;
}

.line-test-box small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  max-width: 64ch;
  overflow-wrap: normal;
}

.line-test-box small.error {
  color: #b42318;
}

.line-test-box small.success {
  color: #187459;
}

.line-recipient-list {
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.line-recipient-list span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eaf4ef;
  color: #0b4b3e;
  font-size: 11px;
  font-weight: 850;
}

.line-recipient-list .muted {
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.notification-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.map-and-events {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(280px, 0.38fr);
  gap: 14px;
  margin-top: 14px;
}

.map-panel,
.events-panel,
.camera-tile-panel,
.admin-panel {
  padding: 14px;
}

.map-frame {
  position: relative;
  margin-top: 12px;
}

.map-canvas {
  position: relative;
  min-height: 430px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 123, 131, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(8, 123, 131, 0.08) 1px, transparent 1px),
    #edf5f6;
  background-size: 42px 42px;
}

.map-locate-button {
  position: absolute;
  z-index: 500;
  top: 12px;
  right: 12px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #b8d9dd;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 4px 10px rgba(24, 50, 56, 0.14);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.map-locate-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.map-locate-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.current-location-dot {
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #1d74ff;
  box-shadow: 0 0 0 7px rgba(29, 116, 255, 0.18), 0 4px 10px rgba(24, 50, 56, 0.22);
}

.map-pin {
  position: absolute;
  min-width: 112px;
  max-width: 170px;
  transform: translate(-50%, -50%);
  padding: 8px 10px;
  border: 1px solid #b8d9dd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 16px rgba(24, 50, 56, 0.13);
  font-size: 12px;
}

.map-pin::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid #b8d9dd;
  border-bottom: 1px solid #b8d9dd;
  background: inherit;
}

.map-pin strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-pin span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.camera-map-label {
  padding: 4px 8px;
  border: 1px solid #b8d9dd;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 4px 10px rgba(24, 50, 56, 0.14);
  font-size: 12px;
  font-weight: 900;
}

.leaflet-tooltip.camera-map-label::before {
  border-right-color: #b8d9dd;
}

.camera-marker-wrapper {
  border: 0;
  background: transparent;
}

.camera-map-icon {
  position: relative;
  width: 64px;
  height: 64px;
  transform: rotate(var(--camera-heading, 0deg));
  transform-origin: 50% 68%;
  filter: drop-shadow(0 6px 10px rgba(93, 21, 54, 0.2));
}

.camera-map-cone {
  position: absolute;
  left: 6px;
  top: -3px;
  width: 52px;
  height: 48px;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background: rgba(236, 83, 152, 0.58);
  border: 2px solid rgba(191, 30, 98, 0.34);
  border-bottom: 0;
  border-radius: 40px 40px 8px 8px;
}

.camera-map-body {
  position: absolute;
  left: 20px;
  top: 39px;
  width: 24px;
  height: 24px;
  border: 3px solid #ffffff;
  border-radius: 5px;
  background: #bf1e62;
  box-shadow: 0 2px 0 rgba(93, 21, 54, 0.18);
}

.camera-map-body::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: #bf1e62;
  transform: translateX(-50%);
}

.camera-map-body::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 2px;
  background: #ffffff;
  opacity: 0.9;
}

.camera-map-mount {
  display: none;
}

.camera-map-lens {
  display: none;
}

.camera-map-popup {
  display: grid;
  gap: 7px;
  min-width: 190px;
  color: var(--text);
  pointer-events: auto;
}

.camera-map-popup strong,
.camera-map-popup span,
.camera-map-popup small,
.camera-map-popup em {
  display: block;
}

.camera-map-popup small,
.camera-map-popup em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.camera-map-popup label {
  display: grid;
  gap: 4px;
  margin-top: 2px;
  font-weight: 800;
}

.camera-map-popup input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.camera-map-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 5px;
}

.camera-map-popup-actions button {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
}

.camera-map-popup-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.event-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 310px;
  overflow: auto;
}

.detection-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.detection-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fbfdfd;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.detection-filter.active {
  border-color: #87c9ce;
  background: var(--accent-soft);
  color: #075e65;
}

.detection-filter span {
  color: var(--muted);
  font-size: 11px;
}

.event-item {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
  font-size: 12px;
  text-align: left;
}

.event-item strong {
  font-size: 14px;
}

.event-item span,
.event-item small {
  color: var(--muted);
}

.camera-tile-panel {
  margin-top: 14px;
}

.camera-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 260px));
  gap: 12px;
  align-items: start;
  justify-content: start;
  margin-top: 12px;
}

.camera-tile {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
  text-align: left;
}

.camera-tile-image {
  cursor: pointer;
}

.camera-tile-image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.camera-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.camera-tile-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-name-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.camera-name-edit-button {
  display: inline-grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f6fbf8;
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
}

.camera-name-edit-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.camera-tile-meta {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.editable-camera-name {
  cursor: text;
}

.camera-name-input {
  min-width: 0;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #87c9ce;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.admin-view {
  display: grid;
  align-items: start;
}

.admin-panel {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.admin-status {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.customer-registration-section {
  display: grid;
  gap: 12px;
}

.customer-site-card {
  max-width: 760px;
}

.tenant-detection-field {
  display: grid;
  gap: 8px;
}

.tenant-auth-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(14, 79, 67, 0.14);
  border-radius: 8px;
  background: rgba(14, 79, 67, 0.035);
}

.tenant-auth-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.tenant-cognito-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.tenant-auth-status {
  min-height: 28px;
  padding: 7px 9px;
  border: 1px solid rgba(14, 79, 67, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cognito-import-card {
  margin: 0 14px 14px;
}

.cognito-import-card > p {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.55;
}

.tenant-detection-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tenant-detection-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tenant-detection-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 850;
}

.customer-management-section {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.customer-management-list {
  display: grid;
  gap: 9px;
}

.customer-management-toolbar {
  display: flex;
  justify-content: flex-end;
}

.customer-management-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.admin-card h3 {
  margin: 0;
  font-size: 14px;
}

.admin-card label,
.admin-inventory-row label,
.admin-camera-row label,
.rule-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-card input,
.admin-card select,
.assign-camera-control select,
.admin-inventory-row input,
.admin-inventory-row select,
.admin-camera-row input,
.admin-camera-row select,
.rule-row input,
.rule-row select {
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.admin-card input[readonly],
.admin-card input.cognito-owned-field {
  border-color: rgba(99, 116, 113, 0.22);
  background: #eef3f2;
  color: #667573;
  cursor: not-allowed;
}

.admin-card label.hidden {
  display: none;
}

.assign-camera-control {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.assign-camera-control select {
  width: min(420px, 48vw);
}

.assign-camera-control .secondary-button {
  width: 42px;
  padding: 0;
  font-size: 17px;
}

.customer-create-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.customer-create-actions .primary-action {
  min-width: 180px;
}

.customer-create-feedback {
  min-height: 28px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(14, 79, 67, 0.12);
  border-radius: 7px;
  background: #f8fbf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.customer-create-feedback:empty {
  display: none;
}

.customer-create-feedback[data-kind="error"] {
  border-color: rgba(173, 59, 50, 0.28);
  background: #fff5f4;
  color: var(--danger);
}

.customer-create-feedback[data-kind="success"] {
  border-color: rgba(13, 122, 79, 0.24);
  background: #f0faf5;
  color: var(--ready);
}

.admin-camera-section {
  margin-top: 16px;
}

.admin-inventory-head,
.admin-inventory-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.55fr) minmax(150px, 0.75fr) minmax(260px, 1.5fr) minmax(120px, 0.55fr) minmax(120px, 0.55fr) minmax(92px, 0.45fr);
  gap: 8px;
  align-items: center;
}

.admin-camera-head,
.admin-camera-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(115px, 0.65fr) minmax(210px, 1.2fr) minmax(220px, 1.1fr) 64px;
  gap: 8px;
  align-items: center;
}

.admin-inventory-head,
.admin-camera-head {
  margin-top: 10px;
  padding: 0 8px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-inventory-rows,
.admin-camera-rows,
.rule-rows {
  display: grid;
  gap: 8px;
}

.admin-inventory-row,
.admin-camera-row {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.admin-inventory-row.rented {
  background: #f5fbf8;
  border-color: #b9ded0;
}

.inventory-stack,
.inventory-actions,
.inventory-status {
  display: grid;
  gap: 6px;
}

.inventory-actions {
  grid-template-columns: 1fr;
}

.inventory-actions .secondary-button {
  min-width: 0;
  padding-inline: 8px;
}

.danger-button {
  border-color: #e5c3c3;
  color: #8d2323;
}

.ready-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #b8ddd1;
  border-radius: 999px;
  background: #e8f8f2;
  color: var(--ready);
  font-size: 12px;
  font-weight: 900;
}

.inventory-status strong {
  font-size: 13px;
}

.inventory-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ftp-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.customer-result-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.rental-overview-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}

.rental-overview-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.rental-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.rental-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.rental-card h3,
.rental-card p {
  margin: 0;
}

.rental-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.rental-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rental-spec-grid div {
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fbfdfd;
}

.rental-spec-grid span,
.rental-device-list small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.rental-spec-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.rental-device-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rental-device-list li {
  display: grid;
  grid-template-columns: minmax(90px, 0.5fr) minmax(120px, 0.7fr) minmax(220px, 1.2fr) minmax(130px, 0.7fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fbfdfd;
}

.rental-device-list strong,
.rental-device-list span {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 900;
}

.rental-card-actions {
  display: flex;
  justify-content: flex-end;
}

.customer-site-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.customer-site-summary div,
.operation {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.customer-site-summary span,
.operation span,
.operation small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.customer-site-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.operation-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rule-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.search-wrap span {
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

select {
  height: 38px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.video-list {
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.list-head,
.video-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 68px 92px 62px;
  align-items: center;
  gap: 8px;
}

.list-head {
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fbfb;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.rows {
  height: calc(100vh - 132px);
  overflow: auto;
}

.video-row {
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.video-row:hover {
  background: #f9fcfc;
}

.video-row.has-preview {
  background: #f3fbf7;
}

.video-row.has-preview:hover {
  background: #edf8f3;
}

.video-row.active {
  background: #eaf6f7;
  box-shadow: inset 3px 0 0 var(--accent);
}

.video-row.has-preview.active {
  background: #e5f5ef;
  box-shadow: inset 3px 0 0 var(--ready);
}

.file-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sequence-number {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.file-sub {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.status.ready {
  background: #e8f8f2;
  color: var(--ready);
}

.status.processing {
  background: #fff4d6;
  color: var(--warning);
}

.status.partial {
  background: #eaf0ff;
  color: #315ca8;
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.preview-badge:hover {
  filter: brightness(0.96);
}

.preview-badge.ready {
  background: #dff5eb;
  color: var(--ready);
}

.preview-badge.pending {
  background: var(--surface-2);
  color: var(--muted);
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 70px;
  padding: 5px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-badge.ready {
  background: #e8f8f2;
  color: var(--ready);
}

.ai-badge.busy {
  background: #fff4d6;
  color: var(--warning);
}

.ai-badge.error {
  background: #fff1f1;
  color: var(--danger);
}

.ai-badge.unknown {
  background: #eaf0ff;
  color: #315ca8;
}

.ai-badge.skipped {
  background: #f2f6f7;
  color: var(--muted);
}

.secondary-button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.secondary-button {
  height: 32px;
  padding: 0 10px;
}

.secondary-button:disabled {
  opacity: 0.62;
}

.secondary-button.is-busy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.secondary-button.is-busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.75s linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.detail {
  display: grid;
  grid-template-rows: minmax(520px, 1fr) minmax(170px, 28vh);
  gap: 12px;
  padding: 14px 14px 14px 0;
  overflow: hidden;
}

.player-panel,
.thumb-panel {
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.panel-head.compact {
  min-height: 38px;
  padding: 7px 10px;
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.output-actions .secondary-button {
  height: 28px;
  padding: 0 8px;
}

.output-actions .secondary-button:disabled {
  cursor: default;
  opacity: 0.58;
}

.classification-panel {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fbfb;
  color: var(--muted);
  font-size: 13px;
}

.classification-panel strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
}

.classification-panel span,
.classification-panel small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.classification-panel small {
  display: -webkit-box;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.classification-panel.ready {
  background: #effaf5;
}

.classification-panel.error {
  background: #fff1f1;
  color: var(--danger);
}

.classification-panel.busy {
  background: #fff7df;
  color: var(--warning);
}

.classification-panel.skipped {
  background: #f2f6f7;
  color: var(--muted);
}

.panel-head h2 {
  overflow: hidden;
  font-size: 14px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.image-preview {
  display: grid;
  grid-template-rows: 1fr 46px;
  height: calc(100% - 55px);
  min-height: 420px;
}

.preview-video {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 420px;
  background: #0e181b;
  object-fit: contain;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  background: #111b1f;
}

#previewImage {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.empty-frame {
  color: #aebdc2;
  font-size: 12px;
}

.preview-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 7px 10px;
  border-top: 1px solid var(--border);
}

.preview-controls span {
  min-width: 54px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.preview-controls button:disabled {
  cursor: default;
  opacity: 0.45;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 7px;
  height: calc(100% - 111px);
  padding: 9px;
  overflow: auto;
}

.output-item {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}

.output-item span {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-video {
  grid-column: span 2;
}

.output-video-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #101b1f;
  overflow: hidden;
}

.output-video-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.output-file-badge {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 7px;
  margin: 0;
  border-radius: 4px;
  background: rgba(8, 20, 24, 0.78);
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.priority-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  padding: 0 6px;
  margin: 0;
  border-radius: 4px;
  background: rgba(8, 20, 24, 0.78);
  color: #ffffff;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.priority-badge.primary {
  background: rgba(8, 123, 131, 0.9);
}

.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid transparent;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
}

.thumb.active {
  border-color: var(--accent);
}

.settings-dialog {
  display: grid;
  gap: 14px;
  width: min(460px, 100%);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-settings-card {
  width: min(620px, 100%);
  box-shadow: none;
}

.settings-head,
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-head div {
  display: grid;
  gap: 3px;
}

.settings-head strong {
  font-size: 15px;
}

.settings-head span,
.settings-dialog label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-dialog label {
  display: grid;
  gap: 6px;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-check input {
  width: 16px;
  height: 16px;
}

.settings-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-dialog input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
}

.settings-dialog input:focus {
  border-color: #95cfd4;
  box-shadow: 0 0 0 3px rgba(8, 123, 131, 0.12);
}

.settings-dialog .settings-check input {
  width: 16px;
  height: 16px;
}

.primary-action {
  border-color: #0f5c48;
  background: linear-gradient(180deg, #187459, #0e5545);
  color: #f5fbf7;
  box-shadow: 0 8px 18px rgba(14, 85, 69, 0.16);
}

.primary-action:hover {
  border-color: #0a4438;
  background: linear-gradient(180deg, #1b8061, #0b4b3e);
}

.primary-action:disabled,
.primary-action:disabled:hover {
  border-color: #4b8172;
  background: linear-gradient(180deg, #6d988c, #557f75);
  box-shadow: none;
}

.admin-home-button {
  border-color: rgba(216, 145, 43, 0.55);
  background: rgba(216, 145, 43, 0.16);
  color: #ffe2ab;
}

.topbar .secondary-button:not(.primary-action) {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 251, 247, 0.86);
}

.admin-view {
  background:
    linear-gradient(180deg, rgba(7, 23, 19, 0.045), transparent 220px),
    transparent;
}

.admin-panel {
  overflow: hidden;
  border-color: rgba(14, 79, 67, 0.16);
}

.admin-panel > .panel-head {
  min-height: 68px;
  border-bottom-color: rgba(14, 79, 67, 0.14);
  background:
    linear-gradient(90deg, rgba(7, 23, 19, 0.97), rgba(14, 79, 67, 0.92)),
    var(--ink);
  color: #f5fbf7;
}

.admin-panel > .panel-head p {
  color: rgba(245, 251, 247, 0.62);
}

.admin-panel > .panel-head h2 {
  font-size: 18px;
  font-weight: 900;
}

.admin-status {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(14, 79, 67, 0.12);
  background: #f8fbf8;
}

.customer-registration-section {
  grid-template-columns: minmax(360px, 0.72fr) minmax(300px, 0.42fr);
  padding: 14px;
}

.customer-site-card {
  max-width: none;
}

.admin-card {
  border-color: rgba(14, 79, 67, 0.14);
  background: linear-gradient(180deg, #ffffff, #f8fbf8);
}

.admin-card h3 {
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 900;
}

.admin-camera-section {
  margin: 0;
  padding: 14px;
  border-top: 1px solid rgba(14, 79, 67, 0.1);
}

.admin-camera-section > .panel-head {
  margin: -2px 0 10px;
  padding: 0;
  border: 0;
}

.admin-camera-section > .panel-head h2 {
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 900;
}

.admin-inventory-row,
.admin-camera-row {
  border-color: rgba(14, 79, 67, 0.13);
  background: #fbfdfb;
}

.admin-inventory-row.rented {
  border-color: rgba(20, 107, 81, 0.28);
  background: #f0faf4;
}

.admin-card input:focus,
.admin-card select:focus,
.admin-inventory-row input:focus,
.admin-camera-row input:focus,
.rule-row input:focus,
.rule-row select:focus {
  border-color: rgba(20, 107, 81, 0.58);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(20, 107, 81, 0.12);
}

.customer-create-actions {
  padding-top: 6px;
}

.rental-overview-panel {
  margin-top: 16px;
  padding: 0;
  border-color: rgba(14, 79, 67, 0.16);
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(12, 32, 25, 0.07);
}

.rental-overview-panel > .panel-head {
  border-bottom-color: rgba(14, 79, 67, 0.12);
  background: #f4faf6;
}

.rental-overview-panel > .panel-head h2 {
  color: var(--accent-2);
  font-size: 16px;
}

#rentalOverviewCount {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(216, 145, 43, 0.32);
  border-radius: 999px;
  background: #fff8ea;
  color: #87520f;
  font-size: 12px;
  font-weight: 900;
}

.rental-overview-list {
  gap: 12px;
  margin: 0;
  padding: 12px;
}

.rental-card {
  gap: 12px;
  border-color: rgba(14, 79, 67, 0.16);
  background:
    linear-gradient(90deg, rgba(20, 107, 81, 0.08), transparent 42%),
    var(--surface);
}

.rental-card header {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(14, 79, 67, 0.1);
}

.rental-card h3 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 950;
}

.rental-spec-grid div,
.rental-device-list li {
  border-color: rgba(14, 79, 67, 0.12);
  background: #f8fbf8;
}

.rental-device-list li {
  grid-template-columns: minmax(92px, 0.5fr) minmax(120px, 0.65fr) minmax(220px, 1.15fr) minmax(120px, 0.64fr);
}

.rental-card-actions {
  gap: 8px;
}

.ready-badge {
  border-color: rgba(20, 107, 81, 0.24);
  background: #e9f8ef;
  color: var(--ready);
}

.dashboard-hero,
.map-panel,
.events-panel,
.camera-tile-panel {
  border-color: rgba(14, 79, 67, 0.14);
}

.dashboard-hero {
  background:
    linear-gradient(90deg, rgba(7, 23, 19, 0.96), rgba(14, 79, 67, 0.88)),
    var(--ink);
  color: #f5fbf7;
}

.dashboard-hero p {
  color: rgba(245, 251, 247, 0.66);
}

.empty-list {
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1080px) {
  .topbar {
    gap: 12px;
  }

  .view-tabs {
    order: 3;
  }

  .login-switch {
    order: 2;
    min-width: 220px;
  }

  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-counts {
    width: 100%;
    min-width: 0;
  }

  .map-and-events {
    grid-template-columns: 1fr;
  }

  .admin-inventory-head,
  .admin-camera-head {
    display: none;
  }

  .admin-inventory-row,
  .admin-camera-row {
    grid-template-columns: 1fr 1fr;
  }

  .app-shell {
    grid-template-columns: 170px minmax(260px, 0.8fr) minmax(330px, 1.2fr);
  }

  .sidebar-collapsed .app-shell {
    grid-template-columns: 0 minmax(240px, 0.75fr) minmax(330px, 1.25fr);
  }

  .content {
    padding-right: 12px;
  }

  .detail {
    grid-column: auto;
    grid-template-rows: minmax(430px, 1fr) minmax(150px, 24vh);
    padding: 14px 14px 14px 0;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 160px minmax(230px, 0.72fr) minmax(310px, 1.28fr);
  }

  .sidebar-collapsed .app-shell {
    grid-template-columns: 0 minmax(230px, 0.72fr) minmax(310px, 1.28fr);
  }

  .sidebar-collapsed .sidebar {
    padding: 0;
    border-right: 0;
    overflow: hidden;
  }

  .sidebar-collapsed .sidebar > * {
    display: none;
  }

  .list-head,
  .video-row {
    grid-template-columns: minmax(130px, 1fr) 76px 54px;
  }

  .list-head > span:nth-child(2),
  .video-row > span:nth-child(2) {
    display: none;
  }

  .status,
  .ai-badge,
  .preview-badge {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    min-height: 104px;
    padding: 10px 12px;
  }

  .view-tabs {
    width: 100%;
    order: 2;
  }

  .login-switch {
    width: 100%;
    order: 3;
  }

  .view-tab {
    flex: 1;
  }

  .topbar-actions {
    order: 1;
  }

  .app-shell {
    display: block;
    grid-template-rows: auto;
  }

  .dashboard-view,
  .admin-view {
    padding: 12px;
  }

  .summary-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-canvas {
    min-height: 340px;
  }

  .data-ops-kpis,
  .data-ops-grid,
  .ai-model-grid,
  .data-ops-tenant-row,
  .data-ops-camera-row,
  .alert-history-row {
    grid-template-columns: 1fr;
  }

  .notification-settings-grid {
    grid-template-columns: 1fr;
  }

  .notification-settings-grid.alert-settings-grid,
  .notification-settings-grid.notification-rule-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .notification-settings-grid.line-channel-grid {
    grid-template-columns: 1fr;
  }

  .notification-time-field input {
    width: 100%;
  }

  .line-registration-box {
    grid-template-columns: 1fr;
  }

  .line-guide-links {
    grid-column: 1;
  }

  .notification-channel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .rental-spec-grid,
  .rental-device-list li {
    grid-template-columns: 1fr;
  }

  .camera-tiles {
    grid-template-columns: 1fr;
  }

  .admin-inventory-row,
  .admin-camera-row,
  .rule-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 64px;
  }

  .sidebar {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  body:not(.sidebar-collapsed) .sidebar {
    display: grid;
    padding: 12px;
  }

  body.view-cameras.sidebar-collapsed .sidebar {
    display: grid;
    padding: 12px;
    overflow: visible;
  }

  body.view-cameras.sidebar-collapsed .sidebar > * {
    display: block;
  }

  body.view-cameras .sidebar section {
    min-width: 0;
  }

  body.view-cameras .sidebar section + section {
    margin-top: 0;
  }

  body.view-cameras .nav-list {
    max-height: 176px;
    overflow: auto;
  }

  .content,
  .detail {
    padding: 12px;
    overflow: visible;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .search-wrap {
    flex-basis: 100%;
    min-width: 0;
  }

  .toolbar select {
    width: 100%;
  }

  .list-head {
    display: none;
  }

  .video-row {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 6px;
  }

  .video-row > span:nth-child(2),
  .video-row > span:nth-child(4) {
    display: none;
  }

  .rows {
    height: 420px;
  }

  .detail {
    grid-template-rows: auto auto;
    gap: 10px;
  }

  .image-preview {
    min-height: 300px;
  }

  .preview-video {
    min-height: 300px;
  }
}
