:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f7fb;
  color-scheme: light;

  --spero-blue: #1769e8;
  --spero-blue-strong: #0d56ca;
  --spero-blue-soft: #eaf3ff;
  --spero-navy: #0b1630;
  --spero-navy-2: #101f3f;
  --spero-cyan: #35b9ef;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --line: #dde5f0;
  --line-strong: #cbd6e5;
  --text: #172033;
  --muted: #718096;
  --muted-2: #94a0b2;
  --success: #168c60;
  --success-bg: #e8f8f1;
  --warning: #b87408;
  --warning-bg: #fff4d9;
  --danger: #cf3d4d;
  --danger-bg: #fff0f2;
  --shadow-sm: 0 2px 8px rgba(19, 39, 74, .06);
  --shadow-md: 0 12px 32px rgba(19, 39, 74, .10);
  --shadow-lg: 0 30px 80px rgba(8, 25, 56, .18);
}

* { box-sizing: border-box; }

html { background: #f4f7fb; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0%, rgba(23, 105, 232, .06), transparent 28rem),
    #f4f7fb;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.85rem, 3vw, 2.7rem); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: clamp(1.45rem, 2.4vw, 2rem); letter-spacing: -.03em; }
h3 { margin-bottom: 0; font-size: 1.15rem; letter-spacing: -.02em; }

.hidden { display: none !important; }

.eyebrow {
  color: var(--spero-blue);
  font-size: .68rem;
  line-height: 1;
  letter-spacing: .16em;
  font-weight: 850;
  margin-bottom: 9px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 12px 12px 12px 4px;
  color: #fff;
  background:
    linear-gradient(145deg, var(--spero-cyan), var(--spero-blue) 62%, #0c4cb7);
  box-shadow: 0 8px 22px rgba(23, 105, 232, .28);
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  right: -21px;
  top: -18px;
}

.brand-mark span {
  position: relative;
  z-index: 1;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: -.04em;
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  color: #fff;
  font-size: 1.04rem;
  letter-spacing: -.02em;
}

.brand-copy span {
  margin-top: 4px;
  color: #9fb0cd;
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .04em;
}

.product-pill {
  margin-left: 7px;
  border-left: 1px solid rgba(255,255,255,.15);
  padding-left: 18px;
  color: #a9b8d1;
  font-size: .74rem;
  font-weight: 700;
}

.topbar {
  min-height: 74px;
  padding: 14px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 20% -100%, rgba(53, 185, 239, .24), transparent 29rem),
    linear-gradient(110deg, #08152e, #0d1d3b 62%, #10264c);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 26px rgba(8, 24, 50, .12);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

main {
  width: min(1460px, calc(100% - 40px));
  margin: 30px auto 72px;
}

.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
}

.page-hero p {
  max-width: 680px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.55;
}

.hero-status {
  min-width: 215px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 9px;
  row-gap: 2px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-dot {
  grid-row: 1 / 3;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f0a92d;
  box-shadow: 0 0 0 5px rgba(240,169,45,.12);
  transition: background .18s ease, box-shadow .18s ease;
}

.hero-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(22,140,96,.12);
}

.hero-status span:not(.hero-dot) {
  color: var(--muted);
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.hero-status strong {
  font-size: .84rem;
  color: var(--text);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric {
  position: relative;
  min-height: 120px;
  padding: 21px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 17px;
  box-shadow: var(--shadow-sm);
}

.metric::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  right: -28px;
  top: -28px;
  background: var(--spero-blue-soft);
}

.metric span,
.metric small {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--muted);
}

.metric span {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.metric strong {
  position: relative;
  z-index: 1;
  display: block;
  margin: 7px 0 4px;
  color: var(--spero-navy);
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.metric small {
  font-size: .8rem;
}

.tabs {
  display: inline-flex;
  gap: 5px;
  margin-bottom: 24px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #eef2f8;
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  color: #75839a;
  background: transparent;
  padding: 8px 16px;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 750;
  transition: .16s ease;
}

.tab:hover { color: var(--spero-navy); }

.tab.active {
  color: var(--spero-blue);
  background: #fff;
  box-shadow: 0 2px 8px rgba(19,39,74,.09);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 17px;
  gap: 16px;
}

.section-head h2 { color: var(--spero-navy); }

.button {
  min-height: 40px;
  border: 1px solid var(--spero-blue);
  color: #fff;
  background: linear-gradient(180deg, #2477ec, var(--spero-blue));
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 780;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(23,105,232,.14);
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(23,105,232,.2);
}

.button.secondary {
  color: #3b4b64;
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: none;
}

.button.secondary:hover {
  color: var(--spero-blue);
  border-color: #a9c7f4;
  background: #f8fbff;
}

.button.danger {
  color: var(--danger);
  background: #fff;
  border-color: #f0cbd1;
  box-shadow: none;
}

.button.danger:hover {
  color: #b52b3b;
  background: var(--danger-bg);
}

.button:disabled,
button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .72rem;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-off { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }

.topbar .badge-ok {
  background: rgba(51,205,146,.13);
  color: #72e2b5;
  border: 1px solid rgba(114,226,181,.16);
}

.topbar .badge-off {
  background: rgba(255,102,119,.11);
  color: #ff9eaa;
  border: 1px solid rgba(255,158,170,.15);
}

.topbar .badge-warn {
  background: rgba(255,198,83,.1);
  color: #ffd582;
  border: 1px solid rgba(255,213,130,.15);
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 5px 10px 5px 6px;
  color: #fff;
  background: rgba(255,255,255,.06);
  cursor: pointer;
  text-align: left;
  transition: background .14s ease, border-color .14s ease;
}

.account-chip:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.19);
}

.account-chip strong,
.account-chip small { display: block; }

.account-chip strong {
  color: #fff;
  font-size: .79rem;
}

.account-chip small {
  margin-top: 2px;
  color: #9fb0cb;
  font-size: .66rem;
}

.account-avatar,
.user-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 850;
  color: #fff;
  background: linear-gradient(145deg, var(--spero-cyan), var(--spero-blue));
}

.account-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.topbar .button.secondary {
  min-height: 42px;
  color: #c3cee1;
  background: transparent;
  border-color: rgba(255,255,255,.12);
}

.topbar .button.secondary:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.2);
}

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.camera-card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.camera-card:hover {
  transform: translateY(-2px);
  border-color: #bfd1e8;
  box-shadow: var(--shadow-md);
}

.camera-image-wrap {
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, #12223e, #071124);
  position: relative;
  overflow: hidden;
}

.camera-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  background: linear-gradient(transparent 55%, rgba(5, 16, 36, .6));
}

.camera-body {
  padding: 15px 16px 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.camera-name {
  color: var(--spero-navy);
  font-weight: 820;
  font-size: 1rem;
}

.camera-model {
  color: var(--muted);
  font-size: .77rem;
  margin-top: 4px;
}

.recording-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

label {
  display: grid;
  gap: 7px;
  color: #526178;
  font-size: .79rem;
  font-weight: 750;
}

select,
input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

select:focus,
input:focus {
  border-color: #7eacef;
  box-shadow: 0 0 0 3px rgba(23,105,232,.10);
}

input::placeholder { color: #a3adbc; }

.archive-note {
  padding: 12px 14px;
  color: #60708a;
  margin-bottom: 14px;
  border-left: 3px solid var(--spero-blue);
  border-radius: 0 9px 9px 0;
  background: var(--spero-blue-soft);
  font-size: .82rem;
  line-height: 1.5;
}

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

.recording-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.recording-time {
  color: var(--spero-navy);
  font-weight: 820;
  font-size: .9rem;
}

.recording-meta {
  color: var(--muted);
  font-size: .76rem;
  margin-top: 4px;
}

.recording-buttons {
  display: flex;
  gap: 7px;
}

.empty {
  min-height: 150px;
  border: 1px dashed #cbd6e4;
  border-radius: 15px;
  background: rgba(255,255,255,.55);
  display: grid;
  place-items: center;
  color: #8491a5;
  padding: 30px;
  text-align: center;
  font-size: .85rem;
}

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

.user-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(120px, .7fr) minmax(200px, 1.3fr) minmax(150px, .9fr) auto auto;
  align-items: center;
  gap: 17px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.user-identity strong,
.user-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity strong {
  color: var(--spero-navy);
  font-size: .86rem;
}

.user-identity span {
  color: #8793a5;
  font-size: .73rem;
  margin-top: 3px;
}

.user-detail { min-width: 0; }
.user-detail span,
.user-detail strong { display: block; }

.user-detail span {
  color: #8a96a8;
  font-size: .65rem;
  text-transform: uppercase;
  font-weight: 750;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.user-detail strong {
  color: #3d4c63;
  font-size: .78rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

dialog {
  width: min(1180px, calc(100% - 30px));
  border: 1px solid #cbd7e6;
  border-radius: 18px;
  color: var(--text);
  background: #fff;
  padding: 0;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(7, 19, 42, .68);
  backdrop-filter: blur(4px);
}

.player-head,
.dialog-head {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.player-head h3,
.dialog-head h3 { color: var(--spero-navy); }

.player-actions {
  display: flex;
  gap: 8px;
}

.video-wrap {
  background: #02050b;
  aspect-ratio: 16 / 9;
  position: relative;
}

#videoPlayer {
  width: 100%;
  height: 100%;
  display: block;
}

.player-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(5, 13, 29, .82);
  color: #ffc0c7;
  text-align: center;
}

.hint {
  color: #748198;
  font-size: .77rem;
  margin: 0;
  padding: 12px 17px 14px;
  background: #fbfcfe;
  border-top: 1px solid var(--line);
}

.form-dialog {
  width: min(720px, calc(100% - 30px));
  max-height: min(90vh, 900px);
  overflow: auto;
}

.small-dialog {
  width: min(520px, calc(100% - 30px));
}

.form-dialog form { margin: 0; }

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.dialog-body { padding: 18px; }

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: #66758a;
  font-size: 1.2rem;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--spero-blue);
  border-color: #b7cdf0;
  background: #f8fbff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-span { grid-column: 1 / -1; }

.form-stack {
  display: grid;
  gap: 14px;
}

.field-help {
  color: #8b97a9;
  font-size: .71rem;
  font-weight: 500;
}

.form-error {
  border: 1px solid #f2c5cb;
  background: var(--danger-bg);
  color: #b93343;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: .78rem;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-self: end;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 11px;
  background: #fff;
}

.check-row input,
.permission-item input {
  width: auto;
  min-height: auto;
  margin: 0;
  accent-color: var(--spero-blue);
}

.permission-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #f8fafe;
}

.permission-title {
  color: #516078;
  font-size: .77rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.camera-permissions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.permission-item {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.permission-item:hover { border-color: #b6c9e5; }
.permission-item strong,
.permission-item small { display: block; }

.permission-item strong {
  color: var(--spero-navy);
  font-size: .78rem;
}

.permission-item small {
  color: #8a96a8;
  margin-top: 2px;
  font-size: .67rem;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: min(420px, calc(100% - 44px));
  padding: 12px 15px;
  border-radius: 11px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  font-weight: 720;
  font-size: .8rem;
}

.toast-ok {
  background: #effbf6;
  color: #147c58;
  border-color: #bfe7d6;
}

.toast-error {
  background: #fff3f4;
  color: #b93343;
  border-color: #efc8cd;
}

/* Login */
.login-page {
  min-height: 100vh;
  background: #eef3f9;
}

.login-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(430px, .95fr) minmax(460px, 1.05fr);
}

.login-brand-panel {
  min-height: 100vh;
  padding: clamp(34px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(circle at 110% 10%, rgba(53,185,239,.24), transparent 30rem),
    radial-gradient(circle at 0% 100%, rgba(23,105,232,.22), transparent 28rem),
    linear-gradient(145deg, #07142d, #0d2144 58%, #123263);
  overflow: hidden;
  position: relative;
}

.login-brand-panel::after {
  content: "";
  width: 480px;
  height: 480px;
  position: absolute;
  right: -280px;
  bottom: -250px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 50px rgba(255,255,255,.02),
    0 0 0 100px rgba(255,255,255,.018);
}

.login-brand { position: relative; z-index: 1; }

.login-brand-content {
  position: relative;
  z-index: 1;
  margin: auto 0;
  max-width: 590px;
  padding: 55px 0;
}

.login-brand-content .eyebrow { color: #7dccf2; }

.login-brand-content h1 {
  margin-bottom: 20px;
  font-size: clamp(2.8rem, 5vw, 5.2rem);
  line-height: .98;
  letter-spacing: -.065em;
  color: #fff;
}

.login-brand-content h1 span {
  color: #6ec9f4;
}

.login-brand-content p {
  max-width: 520px;
  margin: 0;
  color: #a9bad4;
  font-size: 1rem;
  line-height: 1.65;
}

.login-feature-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.login-feature-row > div {
  padding-top: 13px;
  border-top: 1px solid rgba(255,255,255,.13);
}

.feature-icon {
  display: block;
  color: #60c2f1;
  font-size: .65rem;
  font-weight: 850;
  letter-spacing: .09em;
  margin-bottom: 7px;
}

.login-feature-row strong,
.login-feature-row small { display: block; }

.login-feature-row strong {
  font-size: .82rem;
  color: #fff;
}

.login-feature-row small {
  margin-top: 3px;
  color: #8398b9;
  font-size: .68rem;
}

.login-form-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    radial-gradient(circle at 100% 0%, rgba(23,105,232,.08), transparent 25rem),
    #f5f8fc;
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid #dce4ef;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(14,40,78,.12);
}

.login-card h2 {
  margin-bottom: 10px;
  color: var(--spero-navy);
  font-size: 2rem;
}

.login-copy {
  color: #748198;
  line-height: 1.55;
  margin-bottom: 23px;
  font-size: .86rem;
}

.button-wide {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
}

.login-security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 20px;
  color: #8a96a8;
  font-size: .68rem;
}

.security-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22,140,96,.1);
}

.mobile-brand { display: none; }

@media (max-width: 1150px) {
  .user-row {
    grid-template-columns: minmax(190px, 1fr) minmax(120px, .6fr) minmax(220px, 1.2fr) auto auto;
  }
  .user-row .user-detail:nth-of-type(4) { display: none; }
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { min-height: 100vh; }
  .mobile-brand {
    display: flex;
    margin-bottom: 30px;
  }
  .mobile-brand .brand-copy strong { color: var(--spero-navy); }
  .mobile-brand .brand-copy span { color: #7f8da1; }
}

@media (max-width: 820px) {
  main { width: min(100% - 24px, 1460px); margin-top: 22px; }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .hero-status { width: 100%; }

  .metrics { grid-template-columns: 1fr; }

  .tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
  }

  .tab { flex: 1 0 auto; }

  .recording-controls { grid-template-columns: 1fr; }
  .recording-item { grid-template-columns: 1fr; }
  .recording-buttons { flex-wrap: wrap; }

  .user-row { grid-template-columns: 1fr auto; }
  .user-detail,
  .user-access { grid-column: 1 / -1; }
  .user-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .form-grid { grid-template-columns: 1fr; }
  .form-span { grid-column: auto; }
  .camera-permissions { grid-template-columns: 1fr; }

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

  .product-pill { display: none; }
}

@media (max-width: 560px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .connection-badge-wrap { display: none; }

  .topbar .badge { display: none; }

  .account-chip { flex: 1; }

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

  .section-head .button { width: 100%; }

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

  .login-form-panel { padding: 18px; }
  .login-card {
    padding: 24px 20px;
    border-radius: 17px;
  }

  dialog {
    width: calc(100% - 16px);
    border-radius: 14px;
  }
}


/* Dependency diagnostics */
.diagnostic-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 0%, rgba(23,105,232,.10), transparent 28rem),
    #eef3f9;
}

.diagnostic-shell {
  width: min(720px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 36px 0;
}

.diagnostic-card {
  width: 100%;
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid #d9e3ef;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 75px rgba(14,40,78,.13);
}

.diagnostic-brand {
  width: fit-content;
  margin-bottom: 34px;
}

.diagnostic-brand .brand-copy strong { color: var(--spero-navy); }
.diagnostic-brand .brand-copy span { color: #7d8ba0; }

.diagnostic-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 14px;
  color: #b87408;
  background: #fff4d9;
  font-size: 1.35rem;
  font-weight: 900;
}

.diagnostic-card h1 {
  max-width: 580px;
  margin-bottom: 12px;
  color: var(--spero-navy);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.diagnostic-copy {
  max-width: 620px;
  margin-bottom: 25px;
  color: #708097;
  line-height: 1.6;
}

.diagnostic-grid {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.diagnostic-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfd;
}

.diagnostic-row small,
.diagnostic-row strong { display: block; }

.diagnostic-row small {
  margin-bottom: 3px;
  color: #8b98aa;
  font-size: .68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.diagnostic-row strong {
  color: #34445d;
  font-size: .84rem;
  line-height: 1.4;
}

.diag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.diag-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(22,140,96,.10);
}

.diag-dot.warn {
  background: #e1a12b;
  box-shadow: 0 0 0 5px rgba(225,161,43,.10);
}

.diag-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(207,61,77,.10);
}

.diagnostic-hint {
  padding: 12px 14px;
  border-left: 3px solid #e2a134;
  border-radius: 0 9px 9px 0;
  background: #fff8e8;
  color: #7e642b;
  font-size: .78rem;
  line-height: 1.5;
}

.diagnostic-hint.success {
  border-left-color: var(--success);
  background: var(--success-bg);
  color: #176c50;
}

.diagnostic-hint.error {
  border-left-color: var(--danger);
  background: var(--danger-bg);
  color: #a53442;
}

.diagnostic-actions {
  display: flex;
  gap: 9px;
  margin-top: 20px;
}

.diagnostic-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 27px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: #8a96a8;
  font-size: .68rem;
}

@media (max-width: 560px) {
  .diagnostic-actions { flex-direction: column; }
  .diagnostic-actions .button { width: 100%; }
}


/* --------------------------------------------------------------------------
   Spero Ticket look & camera workflow
   -------------------------------------------------------------------------- */
:root {
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
  --ticket-bg: #0f172a;
  --ticket-card: #0b1220;
  --ticket-text: #e5e7eb;
  --ticket-muted: #a7b0c0;
  --ticket-line: rgba(255,255,255,.10);
  --ticket-primary: #3F34F7;
  --ticket-primary-2: #1C14B2;
  --ticket-pink: #FA2E79;
  --ticket-shadow: 0 20px 60px rgba(0,0,0,.42);
}

html {
  background: #0b1220;
}

body {
  color: var(--ticket-text);
  background:
    radial-gradient(1100px 700px at 15% 15%, rgba(63,52,247,.34), transparent 60%),
    radial-gradient(900px 600px at 85% 25%, rgba(250,46,121,.20), transparent 55%),
    radial-gradient(900px 700px at 60% 90%, rgba(26,145,207,.16), transparent 55%),
    linear-gradient(180deg, #0b1220, #0f172a 45%, #0b1220);
}

h1, h2, h3 {
  font-family: "Prompt", "Open Sans", system-ui, sans-serif;
  color: #fff;
}

.topbar {
  min-height: 68px;
  background: linear-gradient(90deg, #3b82f6 0%, #9333ea 50%, #ec4899 100%);
  border-bottom: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
}

.brand-mark {
  background: rgba(255,255,255,.94);
  color: #111827;
  box-shadow: none;
}

.brand-mark::before { display:none; }
.brand-copy span, .product-pill { color: rgba(255,255,255,.78); }

main {
  width: min(1500px, calc(100% - 40px));
}

.page-hero p,
.hero-status span:not(.hero-dot),
.metric span,
.metric small,
.camera-model,
.recording-meta,
.user-detail span,
.user-identity span,
.field-help,
.hint {
  color: var(--ticket-muted);
}

.hero-status,
.metric,
.camera-card,
.recording-controls,
.recording-item,
.user-row,
.permission-box,
.permission-item,
.empty {
  border-color: var(--ticket-line);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  box-shadow: var(--ticket-shadow);
}

.metric strong,
.camera-name,
.recording-time,
.user-identity strong,
.user-detail strong,
.permission-item strong,
.hero-status strong {
  color: #fff;
}

.metric::after {
  background: rgba(63,52,247,.15);
}

.tabs {
  border-color: var(--ticket-line);
  background: rgba(11,18,32,.70);
}

.tab {
  color: rgba(255,255,255,.66);
}

.tab:hover { color:#fff; }
.tab.active {
  color:#fff;
  background: rgba(255,255,255,.10);
  box-shadow: none;
}

.button {
  border-color: rgba(255,255,255,.15);
  border-radius: 999px;
  background: var(--ticket-primary);
  box-shadow: none;
}

.button:hover {
  background: var(--ticket-primary-2);
  box-shadow:none;
}

.button.secondary {
  color: rgba(255,255,255,.92);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.16);
}

.button.secondary:hover,
.button.secondary.active-view {
  color:#fff;
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.28);
}

.button.danger {
  color:#fff;
  background: rgb(239,68,68);
  border-color: rgb(239,68,68);
}

.badge-ok {
  background: rgba(34,197,94,.15);
  color:#86efac;
}
.badge-off {
  background: rgba(239,68,68,.15);
  color:#fca5a5;
}
.badge-warn {
  background: rgba(245,158,11,.15);
  color:#ffd76a;
}
.badge-battery {
  background: rgba(59,130,246,.15);
  color:#93c5fd;
}

.camera-card {
  position:relative;
  overflow:hidden;
}

.camera-card::before {
  content:"";
  position:absolute;
  inset:-2px;
  background: linear-gradient(90deg, rgba(63,52,247,.45), rgba(250,46,121,.34), rgba(26,145,207,.28));
  filter: blur(22px);
  opacity:.22;
  pointer-events:none;
}

.camera-card > * { position:relative; z-index:1; }

.camera-image-wrap.camera-idle {
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:10px;
  min-height:220px;
  text-align:center;
  background:
    radial-gradient(circle at 50% 40%, rgba(63,52,247,.28), transparent 38%),
    linear-gradient(145deg, #111827, #0b1220);
}

.camera-idle-icon {
  width:54px;
  height:54px;
  display:grid;
  place-items:center;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:#fff;
  font-size:1.35rem;
  box-shadow:0 12px 35px rgba(0,0,0,.25);
}

.camera-idle-copy strong,
.camera-idle-copy span {
  display:block;
}
.camera-idle-copy strong {
  color:#fff;
  font-size:.9rem;
}
.camera-idle-copy span {
  margin-top:4px;
  color:var(--ticket-muted);
  font-size:.75rem;
}

.camera-overlay {
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  background:linear-gradient(rgba(5,16,36,.45), transparent 45%);
}

.camera-body {
  background:rgba(11,18,32,.72);
}

.camera-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

dialog {
  color:var(--ticket-text);
  background:#0b1220;
  border-color:rgba(255,255,255,.14);
  box-shadow:0 30px 90px rgba(0,0,0,.65);
}

dialog::backdrop {
  background:rgba(2,6,23,.78);
}

.player-head,
.dialog-head,
.dialog-footer,
.hint {
  background:rgba(11,18,32,.96);
  border-color:var(--ticket-line);
}

.player-head h3,
.dialog-head h3 {
  color:#fff;
}

.camera-dialog {
  width:min(1380px, calc(100% - 24px));
  max-height:94vh;
}

.camera-recordings-shell {
  padding:18px;
  background:rgba(11,18,32,.82);
}

.recording-controls-inline {
  grid-template-columns:minmax(180px, 280px) auto;
  justify-content:start;
}

select,
input {
  color:#fff;
  background:rgba(11,18,32,.78);
  border-color:rgba(255,255,255,.14);
}

select:focus,
input:focus {
  color:#fff;
  background:rgba(11,18,32,.92);
  border-color:rgba(255,255,255,.30);
  box-shadow:0 0 0 .2rem rgba(59,130,246,.12);
}

select option { background:#111827; color:#fff; }
label { color:rgba(255,255,255,.82); }

.archive-note {
  border-left-color:var(--ticket-primary);
  background:rgba(63,52,247,.12);
  color:rgba(255,255,255,.78);
}

.empty {
  color:var(--ticket-muted);
  border-style:dashed;
}

.form-error {
  color:#fecaca;
  background:rgba(127,29,29,.26);
  border-color:rgba(248,113,113,.28);
}

.check-row {
  color:#fff;
  background:rgba(11,18,32,.72);
  border-color:var(--ticket-line);
}

.permission-title { color:#fff; }

.toast-ok {
  color:#bbf7d0;
  background:#123126;
  border-color:rgba(34,197,94,.30);
}

.toast-error {
  color:#fecaca;
  background:#3b171d;
  border-color:rgba(239,68,68,.30);
}

/* Login in the same visual language as the ticket system. */
.login-page,
.login-form-panel {
  background:
    radial-gradient(900px 600px at 85% 25%, rgba(250,46,121,.18), transparent 55%),
    #0b1220;
}

.login-brand-panel {
  background:
    radial-gradient(1100px 700px at 15% 15%, rgba(63,52,247,.38), transparent 60%),
    linear-gradient(145deg, #0b1220, #0f172a);
}

.login-card,
.diagnostic-card {
  color:#fff;
  background:linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035));
  border-color:var(--ticket-line);
  box-shadow:var(--ticket-shadow);
}

.login-card h2,
.diagnostic-card h1 {
  color:#fff;
}

.login-copy,
.login-security-note,
.diagnostic-copy,
.diagnostic-foot {
  color:var(--ticket-muted);
}

.mobile-brand .brand-copy strong { color:#fff; }
.mobile-brand .brand-copy span { color:var(--ticket-muted); }

@media (max-width: 820px) {
  .camera-actions {
    width:100%;
    justify-content:flex-start;
  }
  .camera-body {
    align-items:flex-start;
    flex-direction:column;
  }
  .player-actions {
    width:100%;
    overflow-x:auto;
    padding-bottom:2px;
  }
  .player-actions .button {
    flex:0 0 auto;
  }
}

@media (max-width: 560px) {
  .recording-controls-inline { grid-template-columns:1fr; }
}


/* Exact Spero-Ticketsystem inspired shell */
.ticket-navbar{
  min-height:54px;
  padding:0;
  background:linear-gradient(90deg,#3b82f6 0%,#7c3aed 52%,#ec4899 100%);
  border-bottom:1px solid rgba(255,255,255,.18);
  box-shadow:0 10px 30px rgba(0,0,0,.28);
}
.nav-inner{
  width:min(1180px,calc(100% - 24px));
  margin:0 auto;
  min-height:54px;
  display:flex;
  align-items:center;
  gap:16px;
}
.ticket-navbar .brand-lockup{gap:8px;flex:0 0 auto;}
.ticket-navbar .brand-mark{
  width:28px;height:28px;border-radius:8px;
  display:grid;place-items:center;
  background:rgba(255,255,255,.92);
  color:#111827;
  font-size:.75rem;
}
.ticket-navbar .brand-copy strong{font-size:1rem;color:#fff;}
.ticket-navbar .brand-copy span{display:none;}
.nav-center{margin-right:auto;min-width:0;}
.nav-context{
  color:rgba(255,255,255,.9);
  font-size:.78rem;
  font-weight:700;
  white-space:nowrap;
}
.nav-links{display:flex;align-items:center;gap:2px;flex-wrap:wrap;justify-content:flex-end;}
.nav-link-button{
  appearance:none;border:0;background:transparent;color:#fff;
  padding:17px 9px 16px;
  cursor:pointer;font:inherit;font-size:.78rem;
  border-bottom:2px solid transparent;
}
.nav-link-button:hover,.nav-link-button.active{
  background:rgba(255,255,255,.08);
  border-bottom-color:rgba(255,255,255,.85);
}

main{
  width:min(1180px,calc(100% - 24px));
  margin:30px auto 70px;
}
.page-heading{
  display:flex;align-items:center;justify-content:space-between;
  gap:18px;margin-bottom:20px;
}
.page-heading h1{
  margin:0;font-size:2rem;font-weight:700;letter-spacing:-.03em;
}
.heading-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.page-heading .eyebrow{display:none;}

.metrics{
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;margin-bottom:20px;
}
.metric{
  min-height:84px;
  padding:14px 16px;
  border-radius:14px;
  background:rgba(17,24,39,.86);
  border:1px solid rgba(255,255,255,.08);
  box-shadow:none;
}
.metric::after{display:none;}
.metric span{font-size:.72rem;text-transform:none;letter-spacing:0;color:#a7b0c0;}
.metric strong{font-size:1.45rem;margin:4px 0 2px;color:#fff;}
.metric small{font-size:.75rem;color:#8f9bad;}

.section-head{
  margin-bottom:12px;align-items:center;
}
.section-head .eyebrow{display:none;}
.section-head h2{font-size:1.05rem;color:#fff;}
.camera-grid{
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:12px;
}
.camera-card{
  border-radius:14px;
  background:rgba(17,24,39,.86);
  border:1px solid rgba(255,255,255,.08);
  box-shadow:none;
}
.camera-card::before{opacity:.12;}
.camera-image-wrap.camera-idle{min-height:170px;}
.camera-body{padding:13px 14px;background:rgba(11,18,32,.72);}
.camera-name{font-size:.9rem;}
.camera-model{font-size:.72rem;}
.camera-actions .button{min-height:34px;padding:7px 12px;font-size:.76rem;}

.badge{padding:.35rem .55rem;font-size:.68rem;}
.button{min-height:36px;padding:7px 13px;font-size:.78rem;}

.user-row{
  border-radius:14px;
  background:rgba(17,24,39,.86);
  border:1px solid rgba(255,255,255,.08);
  box-shadow:none;
}
dialog{
  border-radius:16px;
  background:#111827;
}
.player-head,.dialog-head{
  background:#111827;
}
.camera-recordings-shell{background:#0f172a;}

@media(max-width:900px){
  .nav-inner{align-items:flex-start;flex-wrap:wrap;padding:8px 0;}
  .nav-center{order:3;width:100%;margin:0;}
  .nav-links{margin-left:auto;}
  .nav-link-button{padding:8px 7px;}
  .metrics{grid-template-columns:1fr;}
  main{margin-top:22px;}
}


/* Unified camera experience */
html, body {
  min-height: 100%;
  background: #0b1220 !important;
  overscroll-behavior-y: none;
}

body::after {
  content: none !important;
}

.brand-mark {
  width: 30px !important;
  height: 30px !important;
  border-radius: 9px !important;
  background: rgba(255,255,255,.96) !important;
  color: #312e81 !important;
  box-shadow: none !important;
  font-weight: 900;
}
.brand-mark span {
  color: #312e81 !important;
  font-size: .95rem !important;
}

.camera-card {
  cursor: pointer;
  outline: none;
}
.camera-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(99,102,241,.45) !important;
}
.camera-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.18) !important;
}

.camera-image-wrap {
  aspect-ratio: 16 / 9;
  min-height: 0 !important;
  background:
    radial-gradient(circle at 50% 40%, rgba(63,52,247,.20), transparent 42%),
    #070c17 !important;
}
.camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.camera-battery-placeholder,
.camera-image-wrap.preview-error::before {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  text-align: center;
  padding: 20px;
}
.camera-battery-placeholder span {
  color: #a7b0c0;
  font-size: .72rem;
}
.camera-idle-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  font-weight: 900;
  margin-bottom: 3px;
}
.camera-overlay {
  align-items: flex-start !important;
  justify-content: space-between !important;
  background: linear-gradient(180deg, rgba(2,6,23,.58), transparent 46%) !important;
}
.camera-body {
  align-items: center !important;
}
.camera-chevron {
  width: 21px;
  height: 21px;
  fill: rgba(255,255,255,.6);
  flex: 0 0 auto;
}

.camera-dialog {
  width: min(1450px, calc(100vw - 24px)) !important;
  max-width: none !important;
  height: min(94vh, 980px);
  max-height: 94vh;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 16px !important;
  overflow: hidden;
  background: #080d19 !important;
}
.camera-dialog::backdrop {
  background: rgba(2,6,23,.82) !important;
  backdrop-filter: blur(5px);
}

.camera-view-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #080d19;
  color: #fff;
}
.camera-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  padding: 11px 14px 11px 18px;
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.camera-view-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.camera-view-title .eyebrow {
  display: none;
}
.camera-view-title h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
}
.player-state-label {
  color: #9ca3af;
  font-size: .74rem;
  white-space: nowrap;
}
.camera-view-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(255,255,255,.055);
  color: #fff;
  cursor: pointer;
}
.player-icon-button:hover,
.player-icon-button.is-active {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.22);
}
.player-icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}
.player-icon-button.small {
  width: 34px;
  height: 34px;
}
.quality-button {
  font-weight: 800;
  font-size: .72rem;
}
.quality-button #qualityLabel {
  letter-spacing: .04em;
}

.player-stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #020408;
}
#videoPlayer {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #020408;
  display: block;
}
.custom-player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: linear-gradient(transparent, rgba(2,6,23,.88));
  opacity: 0;
  transition: opacity .18s ease;
}
.player-stage:hover .custom-player-controls,
.player-stage:focus-within .custom-player-controls {
  opacity: 1;
}
.player-time {
  color: #e5e7eb;
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
}
.player-spacer {
  flex: 1;
}
.live-pill {
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  color: #fff;
  background: rgba(239,68,68,.82);
  padding: 7px 11px;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 800;
}
.center-play {
  position: absolute;
  width: 66px;
  height: 66px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: rgba(2,6,23,.68);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.center-play svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
  margin-left: 3px;
}
.player-message {
  z-index: 4;
  background: rgba(2,6,23,.86) !important;
}

.timeline-panel {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255,255,255,.09);
  background: #0f172a;
}
.timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}
.date-nav {
  display: flex;
  align-items: center;
  gap: 7px;
}
.date-nav input {
  width: auto;
  min-height: 34px;
  height: 34px;
  padding: 5px 9px;
  border-radius: 9px;
  font-size: .76rem;
}
.timeline-legend {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
  color: #9ca3af;
  font-size: .68rem;
}
.timeline-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.event-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
}
.event-dot.motion { background: #64748b; }
.event-dot.person { background: #3b82f6; }
.event-dot.vehicle { background: #ec4899; }
.event-dot.animal { background: #22c55e; }

.timeline-status {
  margin-bottom: 5px;
  color: #9ca3af;
  font-size: .68rem;
}
.timeline-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  padding-top: 20px;
  scrollbar-width: thin;
}
.timeline-hours,
.recording-timeline {
  position: relative;
  min-width: 1100px;
}
.timeline-hours {
  height: 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.timeline-hours span {
  position: absolute;
  bottom: 4px;
  transform: translateX(-50%);
  color: #778399;
  font-size: .62rem;
  font-variant-numeric: tabular-nums;
}
.recording-timeline {
  height: 54px;
  margin-top: 3px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(4.166666% - 1px),
      rgba(255,255,255,.045) calc(4.166666% - 1px),
      rgba(255,255,255,.045) 4.166666%
    ),
    rgba(255,255,255,.025);
  border-radius: 7px;
  overflow: hidden;
}
.timeline-segment {
  position: absolute;
  top: 9px;
  height: 36px;
  min-width: 4px;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  opacity: .92;
}
.timeline-segment:hover {
  opacity: 1;
  filter: brightness(1.18);
  z-index: 2;
}
.event-recording { background: #64748b; }
.event-motion { background: #64748b; }
.event-person { background: #3b82f6; }
.event-vehicle { background: #ec4899; }
.event-animal { background: #22c55e; }
.event-package { background: #f59e0b; }
.timeline-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #778399;
  font-size: .72rem;
}
.selected-recording-info {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #dbe3f0;
  font-size: .72rem;
}
.selected-recording-info strong,
.selected-recording-info span {
  display: block;
}
.selected-recording-info span {
  color: #8e9bad;
  margin-top: 2px;
}
.selected-events {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.selected-events span {
  margin: 0;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 4px 8px;
  color: #cbd5e1;
  background: rgba(255,255,255,.05);
}

.recording-context-menu {
  position: fixed;
  z-index: 99999;
  width: 180px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: #111827;
  box-shadow: 0 18px 50px rgba(0,0,0,.48);
}
.recording-context-menu button {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #e5e7eb;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  font-size: .76rem;
}
.recording-context-menu button:hover {
  background: rgba(255,255,255,.08);
}

.camera-view-shell:fullscreen {
  background: #020408;
}
.camera-view-shell:fullscreen .player-stage {
  min-height: 0;
}
.camera-view-shell:fullscreen .timeline-panel {
  max-height: 180px;
}

@media (max-width: 800px) {
  .camera-dialog {
    width: calc(100vw - 10px) !important;
    height: 96vh;
    max-height: 96vh;
  }
  .camera-view-head {
    align-items: flex-start;
  }
  .camera-view-title {
    flex-direction: column;
    gap: 2px;
  }
  .timeline-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .timeline-legend {
    display: none;
  }
  .selected-recording-info {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* Raster view, account page and timeline scrubbing */
.section-copy {
  margin: 5px 0 0;
  color: #9ca3af;
  font-size: .78rem;
}

.multi-camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.grid-camera-tile {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  background: rgba(17,24,39,.86);
  cursor: pointer;
  min-width: 0;
}
.grid-camera-media {
  position: relative;
  aspect-ratio: 16/9;
  background: #020408;
  overflow: hidden;
}
.grid-snapshot,
.grid-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.grid-battery-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 40%, rgba(63,52,247,.22), transparent 42%),
    #080d19;
}
.grid-battery-placeholder span {
  color: #9ca3af;
  font-size: .72rem;
}
.grid-tile-badges {
  position: absolute;
  left: 10px;
  top: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.grid-live-indicator {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(220,38,38,.9);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .08em;
}
.grid-camera-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
}
.grid-camera-caption strong {
  color: #fff;
  font-size: .84rem;
}
.grid-camera-caption span {
  color: #7f8a9d;
  font-size: .66rem;
  text-align: right;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}
.settings-panel {
  padding: 16px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  background: rgba(17,24,39,.86);
}
.settings-panel h3 {
  margin-bottom: 14px;
  font-size: .95rem;
}
.settings-panel label + label {
  margin-top: 13px;
}
.settings-help {
  margin: 10px 0 0;
  color: #8f9bad;
  font-size: .72rem;
  line-height: 1.5;
}
.battery-override-list {
  display: grid;
  gap: 8px;
}
.battery-override-row {
  grid-template-columns: minmax(0,1fr) 150px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.battery-override-row:last-child {
  border-bottom: 0;
}
.battery-override-row strong,
.battery-override-row small {
  display: block;
}
.battery-override-row strong {
  color: #fff;
  font-size: .78rem;
}
.battery-override-row small {
  margin-top: 2px;
  color: #8f9bad;
  font-size: .66rem;
}
.battery-override-row select {
  min-height: 36px;
  height: 36px;
  padding: 6px 9px;
  font-size: .72rem;
}

.recording-timeline-wrap {
  position: relative;
  min-width: 1100px;
}
.recording-timeline-wrap .recording-timeline {
  min-width: 0;
}
.timeline-scrubber {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 54px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  appearance: none;
  cursor: ew-resize;
  pointer-events: auto;
}
.timeline-scrubber:focus {
  box-shadow: none;
}
.timeline-scrubber::-webkit-slider-runnable-track {
  height: 54px;
  background: transparent;
}
.timeline-scrubber::-webkit-slider-thumb {
  appearance: none;
  width: 3px;
  height: 54px;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.timeline-scrubber::-moz-range-track {
  height: 54px;
  background: transparent;
}
.timeline-scrubber::-moz-range-thumb {
  width: 3px;
  height: 54px;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.timeline-segment {
  pointer-events: auto;
  z-index: 2;
}
.timeline-scrubber {
  z-index: 3;
  opacity: .82;
}
.recording-timeline-wrap:hover .timeline-scrubber {
  opacity: 1;
}

@media (max-width: 900px) {
  .multi-camera-grid {
    grid-template-columns: 1fr;
  }
  .account-settings-grid {
    grid-template-columns: 1fr;
  }
  .grid-camera-caption {
    align-items: flex-start;
    flex-direction: column;
  }
  .grid-camera-caption span {
    text-align: left;
  }
}


/* Keep timeline segments clickable/right-clickable while the time selector stays draggable. */
.recording-timeline-wrap {
  padding-bottom: 17px;
}
.timeline-scrubber {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 14px;
  min-height: 0;
  z-index: 4;
}
.timeline-scrubber::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
}
.timeline-scrubber::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
}
.timeline-scrubber::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
}
.timeline-scrubber::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
}


/* Raster/Kiosk mode: navbar + cameras only */
body.grid-mode {
  background: #020408 !important;
  overflow: hidden;
}
body.grid-mode main {
  width: 100%;
  height: calc(100vh - 54px);
  margin: 0;
  max-width: none;
}
body.grid-mode .page-heading,
body.grid-mode .metrics,
body.grid-mode #camerasTab,
body.grid-mode #accountTab,
body.grid-mode #usersTab {
  display: none !important;
}
body.grid-mode #gridTab {
  display: block !important;
  height: 100%;
}
body.grid-mode #gridTab .section-head {
  display: none !important;
}
body.grid-mode .multi-camera-grid {
  width: 100%;
  height: 100%;
  padding: 4px;
  gap: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  grid-auto-rows: minmax(0, 1fr);
  background: #020408;
}
body.grid-mode .grid-camera-tile {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}
body.grid-mode .grid-camera-media {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  background: #000;
}
body.grid-mode .grid-snapshot,
body.grid-mode .grid-video {
  object-fit: contain;
  background: #000;
}
body.grid-mode .grid-name-overlay {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 70px);
  padding: 5px 8px;
  border-radius: 7px;
  color: #fff;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(5px);
  font-size: .72rem;
  font-weight: 700;
  pointer-events: none;
}
body.grid-mode .grid-live-indicator {
  right: 10px;
  top: 10px;
  bottom: auto;
}

.player-error-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  max-width: 520px;
  padding: 18px;
}
.player-error-card strong {
  color: #fff;
}
.player-error-card span {
  color: #cbd5e1;
  font-size: .78rem;
}
.recording-error-download,
.recording-download-button {
  text-decoration: none;
}

.selected-recording-info {
  align-items: center;
}
.selected-recording-info .recording-download-button {
  margin-left: auto;
}

@media (max-width: 900px) {
  body.grid-mode {
    overflow: auto;
  }
  body.grid-mode main {
    height: auto;
    min-height: calc(100vh - 54px);
  }
  body.grid-mode .multi-camera-grid {
    height: auto;
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(230px, 45vh);
  }
}
