:root {
  --navy: #0b1f3a;
  --navy-deep: #06172b;
  --navy-soft: #123a63;
  --cyan: #00aeef;
  --cyan-soft: #e5f8ff;
  --green: #10b84f;
  --green-soft: #e8f9ef;
  --amber: #f59e0b;
  --red: #dc2626;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d8e5f0;
  --soft: #f5f9fc;
  --white: #ffffff;
  --shadow: 0 22px 60px rgba(6, 23, 43, 0.14);
  --brand-glow: 0 18px 55px rgba(0, 174, 239, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--soft);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 12% 0, rgba(0, 174, 239, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(16, 184, 79, 0.06) 0, rgba(245, 249, 252, 0) 340px),
    var(--soft);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a,
input,
select,
textarea {
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 174, 239, 0.24);
  outline-offset: 2px;
}

.app-root {
  min-height: 100vh;
}

.app-loader-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(0, 174, 239, 0.08), rgba(248, 250, 252, 0) 38%),
    var(--soft);
}

.app-loader-card {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  border: 1px solid rgba(216, 229, 240, 0.86);
  border-radius: 8px;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 252, 0.96));
  box-shadow: var(--shadow);
}

.brand-logo {
  display: block;
  width: min(248px, 82%);
  height: auto;
}

.brand-logo.compact {
  width: min(214px, 88%);
}

.brand-symbol {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.24));
}

.app-loader-card strong {
  font-size: 15px;
}

.loader-track {
  overflow: hidden;
  height: 4px;
  border-radius: 999px;
  background: #e8edf4;
}

.loader-track span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: var(--brand-glow);
  animation: loader-sweep 1.2s ease-in-out infinite;
}

@keyframes loader-sweep {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(280%);
  }
}

.login-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 470px);
  gap: 0;
  background: var(--soft);
}

.login-brand {
  display: grid;
  align-content: center;
  padding: clamp(28px, 7vw, 88px);
  color: var(--white);
  background:
    linear-gradient(112deg, rgba(3, 12, 24, 0.97), rgba(7, 24, 45, 0.88) 46%, rgba(0, 174, 239, 0.48)),
    radial-gradient(circle at 72% 44%, rgba(0, 174, 239, 0.28), transparent 34%),
    linear-gradient(180deg, rgba(16, 184, 79, 0.12), rgba(6, 23, 43, 0.5)),
    url("https://unsplash.com/photos/8EYMcqG5GRU/download?force=true&w=2200"),
    linear-gradient(135deg, var(--navy-deep), var(--navy-soft) 56%, #007fb0);
  background-position: center;
  background-size: cover;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.brand-row.dark {
  margin: 0;
  color: var(--navy);
}

.login-brand h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(36px, 7vw, 76px);
  line-height: 0.96;
  letter-spacing: 0;
}

.login-brand p {
  max-width: 520px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
  line-height: 1.6;
}

.login-metrics {
  display: grid;
  max-width: 720px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 42px;
}

.login-metrics div {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.login-metrics strong {
  display: block;
  font-size: 28px;
}

.login-metrics span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.login-panel {
  display: grid;
  align-content: center;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 252, 0.98));
}

.login-card {
  width: 100%;
  border: 1px solid rgba(216, 229, 240, 0.9);
  border-radius: 8px;
  padding: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(6, 23, 43, 0.08);
}

.login-card-head h2 {
  margin: 0;
  font-size: 26px;
}

.login-card-logo {
  display: block;
  width: min(220px, 76%);
  height: auto;
  margin-bottom: 24px;
}

.login-card-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.login-card form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(0, 174, 239, 0.72);
  box-shadow: 0 0 0 4px rgba(0, 174, 239, 0.12);
}

.field .password-wrap {
  position: relative;
  display: block;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.password-wrap input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle.active {
  color: var(--navy);
  background: var(--cyan-soft);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.error-line {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
}

.success-line {
  min-height: 18px;
  color: var(--green);
  font-size: 13px;
}

.login-submit {
  width: 100%;
}

.login-footnote,
.login-support {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-support {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.login-support strong {
  color: var(--navy);
}

.login-support a {
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--navy);
  background: transparent;
  font-weight: 800;
}

.link-button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  height: 100vh;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 22px;
  color: var(--white);
  background:
    linear-gradient(180deg, var(--navy-deep), var(--navy) 58%, #08243f);
}

.side-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.side-logo img {
  width: 42px;
  height: 42px;
}

.side-logo-mark {
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 174, 239, 0.18));
}

.side-logo strong {
  display: block;
  font-size: 17px;
}

.side-logo span,
.side-foot {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.nav-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item,
.bottom-nav button {
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.76);
  text-align: left;
}

.nav-item.active {
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(0, 174, 239, 0.2), rgba(16, 184, 79, 0.1));
  box-shadow: inset 3px 0 0 var(--cyan);
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.nav-glyph {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  color: var(--navy);
  background: linear-gradient(135deg, var(--cyan), var(--green));
  font-size: 12px;
  font-weight: 900;
}

.main {
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 96px;
}

.mobile-header {
  display: none;
}

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

.mobile-brand img {
  display: block;
  width: min(168px, 48vw);
  height: auto;
}

.mobile-brand span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-menu-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.mobile-menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--navy);
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  background: rgba(6, 23, 43, 0.44);
}

.mobile-drawer {
  display: grid;
  height: 100%;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  overflow: auto;
  padding: 20px;
  color: var(--white);
  background:
    linear-gradient(180deg, var(--navy-deep), var(--navy) 58%, #08243f);
  box-shadow: 18px 0 48px rgba(6, 23, 43, 0.26);
}

.mobile-drawer-scrim {
  border: 0;
  background: transparent;
}

.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-drawer .button.ghost {
  color: rgba(255, 255, 255, 0.76);
}

.mobile-drawer-foot {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar h1,
.view-title h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--white);
  background: var(--navy);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.button.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--white);
}

.button.cyan {
  color: var(--navy-deep);
  background: linear-gradient(135deg, var(--cyan), #6ee7ff);
  box-shadow: 0 12px 26px rgba(0, 174, 239, 0.24);
}

.button.warn {
  background: var(--amber);
}

.button.ghost {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.button:hover {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 18px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: 18px;
  align-items: start;
}

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

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

.metric-card,
.camera-card,
.incident-card,
.invoice-row,
.notification-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.metric-card {
  min-height: 122px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(6, 23, 43, 0.06);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 27px;
  line-height: 1.05;
  color: var(--navy);
}

.metric-card em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 253, 255, 0.94));
  box-shadow: 0 10px 28px rgba(6, 23, 43, 0.06);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}

.panel-head h2,
.section-title {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 16px;
}

.health-stack {
  display: grid;
  gap: 12px;
}

.health-line {
  display: grid;
  grid-template-columns: 92px 1fr 34px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar {
  overflow: hidden;
  height: 9px;
  border-radius: 8px;
  background: #e8edf4;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar .healthy {
  background: var(--green);
}

.bar .delayed {
  background: var(--amber);
}

.bar .offline {
  background: var(--red);
}

.bar .waiting {
  background: var(--muted);
}

.timeline {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: start;
  min-height: 42px;
}

.timeline-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-clips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.clip-dot {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--ink);
  background: var(--white);
  font-size: 12px;
  font-weight: 800;
}

.clip-dot.active {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0, 174, 239, 0.16), rgba(16, 184, 79, 0.09));
}

.clip-dot.incident {
  border-color: rgba(22, 163, 74, 0.45);
}

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

.camera-mosaic-page {
  display: grid;
  gap: 16px;
}

.camera-view-panel .panel-head {
  padding-bottom: 16px;
}

.camera-view-toggle {
  min-width: 170px;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
}

.camera-group-panel .panel-head {
  padding-bottom: 0;
}

.camera-mosaic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mosaic-tile {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--white);
  box-shadow: 0 8px 24px rgba(6, 23, 43, 0.06);
}

.mosaic-tile:hover {
  border-color: rgba(0, 174, 239, 0.5);
  box-shadow: 0 16px 34px rgba(6, 23, 43, 0.12);
}

.mosaic-video {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #020617;
}

.mosaic-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #020617;
}

.mosaic-placeholder {
  display: grid;
  height: 100%;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(11, 31, 58, 0.96), rgba(18, 58, 99, 0.92));
  font-size: 13px;
  font-weight: 800;
}

.mosaic-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 3px;
  padding: 28px 10px 10px;
  color: var(--white);
  background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.86));
}

.mosaic-overlay strong,
.mosaic-overlay span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mosaic-overlay strong {
  font-size: 13px;
}

.mosaic-overlay span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 11px;
}

.mosaic-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.camera-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.camera-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.camera-head h3 {
  margin: 0;
  font-size: 17px;
}

.camera-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 9px;
  color: var(--white);
  font-size: 12px;
  font-weight: 900;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-pill.healthy,
.status-pill.available,
.status-pill.paid,
.status-pill.open {
  background: var(--green);
}

.status-pill.delayed,
.status-pill.warning,
.status-pill.expiring,
.status-pill.due_soon,
.status-pill.medium {
  background: var(--amber);
}

.status-pill.offline,
.status-pill.critical,
.status-pill.overdue,
.status-pill.high {
  background: var(--red);
}

.status-pill.disabled,
.status-pill.closed,
.status-pill.waiting {
  background: var(--muted);
}

.search-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  gap: 18px;
  align-items: start;
}

.search-layout.mode-wide,
.search-layout.mode-focus {
  grid-template-columns: 1fr;
}

.search-layout.mode-wide .player,
.search-layout.mode-focus .player {
  order: -1;
  position: static;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 12px;
}

.archive-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.results-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.results-table tr.active {
  background: linear-gradient(90deg, rgba(0, 174, 239, 0.09), rgba(16, 184, 79, 0.05));
}

.table-scroll {
  overflow: auto;
}

.team-user-list {
  display: none;
}

.team-user-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--white);
}

.team-user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.team-user-head strong,
.team-user-head span {
  display: block;
}

.team-user-head strong {
  color: var(--navy);
  font-size: 15px;
}

.team-user-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.team-user-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.team-user-meta span {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.team-user-meta b {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.player {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}

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

.player-head-actions,
.player-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-group {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  overflow: hidden;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.mode-button {
  min-width: 58px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.mode-button:last-child {
  border-right: 0;
}

.mode-button.active {
  color: var(--navy-deep);
  background: linear-gradient(135deg, rgba(0, 174, 239, 0.18), rgba(16, 184, 79, 0.12));
}

.video-shell {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(11, 31, 58, 0.96), rgba(18, 74, 104, 0.96)),
    #0b1f3a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.search-layout.mode-wide .video-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.search-layout.mode-focus .video-shell {
  height: min(72vh, 760px);
  aspect-ratio: auto;
  border-radius: 8px;
  box-shadow: 0 20px 54px rgba(6, 23, 43, 0.18);
}

.video-shell video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #020617;
}

.stream-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  color: var(--white);
  text-align: center;
}

.stream-fallback.visible {
  display: grid;
}

.scan-frame {
  width: min(280px, 70%);
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0, 174, 239, 0.15), rgba(22, 163, 74, 0.16)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 14px);
}

.player-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.player-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.action-cluster,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.player-actions .button {
  min-width: 106px;
}

.primary-actions {
  justify-content: flex-end;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.incident-card,
.notification-row,
.invoice-row {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.invoice-row {
  grid-template-columns: 1fr auto auto;
  align-items: center;
}

.notification-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 31, 58, 0.42);
}

.modal {
  width: min(520px, 100%);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.onboarding-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 31, 58, 0.54);
}

.onboarding-panel {
  display: grid;
  width: min(760px, 100%);
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.onboarding-copy {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 26px;
  background: linear-gradient(180deg, rgba(0, 174, 239, 0.08), rgba(22, 163, 74, 0.06));
}

.onboarding-copy h2 {
  margin: 10px 0 0;
  font-size: 28px;
  line-height: 1.05;
}

.onboarding-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.onboarding-steps {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.onboarding-steps span {
  display: flex;
  align-items: center;
  min-height: 34px;
  border-left: 3px solid var(--line);
  padding-left: 12px;
  color: var(--muted);
  font-weight: 800;
}

.onboarding-steps span.active {
  border-color: var(--cyan);
  color: var(--navy);
}

.onboarding-form {
  display: grid;
  align-content: start;
  gap: 15px;
  padding: 26px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: var(--muted);
}

.toggle-row.compact {
  min-height: 0;
  font-size: 13px;
}

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

.support-link {
  display: flex;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--navy);
  background: var(--white);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 10;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid rgba(0, 174, 239, 0.22);
  border-radius: 8px;
  padding: 6px;
  background:
    linear-gradient(180deg, rgba(18, 58, 99, 0.98), rgba(6, 23, 43, 0.98));
  box-shadow: 0 18px 46px rgba(6, 23, 43, 0.28);
}

.bottom-nav button {
  min-height: 44px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 800;
}

.bottom-nav button.active {
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(0, 174, 239, 0.28), rgba(16, 184, 79, 0.16));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.bottom-nav button:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.offline-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.offline-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  background: var(--white);
}

.public-share-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(16px, 4vw, 42px);
  background:
    linear-gradient(180deg, rgba(0, 174, 239, 0.09), rgba(245, 249, 252, 0) 42%),
    var(--soft);
}

.public-share-panel {
  display: grid;
  width: min(1120px, 100%);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 28px);
  background: var(--white);
  box-shadow: var(--shadow);
}

.public-share-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.public-share-head h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 46px);
  line-height: 1.05;
}

.public-share-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.public-video {
  width: 100%;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .bottom-nav {
    display: grid;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    margin: -6px 0 18px;
    border: 1px solid rgba(216, 229, 240, 0.88);
    border-radius: 8px;
    padding: 8px 10px 8px 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 28px rgba(6, 23, 43, 0.08);
    backdrop-filter: blur(14px);
  }

  .dashboard-grid,
  .profile-layout,
  .search-layout {
    grid-template-columns: 1fr;
  }

  .player {
    order: -1;
    position: static;
  }

  .search-layout.mode-focus .video-shell {
    height: min(58vh, 620px);
  }
}

@media (max-width: 820px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 42vh;
  }

  .login-metrics,
  .metric-grid,
  .camera-grid,
  .camera-mosaic-grid,
  .incident-grid,
  .billing-summary,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-panel {
    grid-template-columns: 1fr;
  }

  .onboarding-copy {
    padding: 22px;
  }

  .onboarding-form {
    padding: 22px;
  }

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

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

  .camera-view-panel .panel-head,
  .camera-group-panel .panel-head,
  .mosaic-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .camera-view-toggle,
  .mosaic-foot .button {
    width: 100%;
  }

  .team-table-wrap {
    display: none;
  }

  .team-user-list {
    display: grid;
    gap: 12px;
  }

  .public-share-head {
    flex-direction: column;
  }

  .player-head,
  .player-head-actions,
  .player-toolbar,
  .player-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .player-head-actions,
  .player-toolbar {
    width: 100%;
  }

  .mode-group {
    width: 100%;
  }

  .player-toolbar > .button {
    width: 100%;
  }

  .player-actions .button,
  .action-cluster,
  .primary-actions {
    width: 100%;
  }

  .action-cluster {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 560px) {
  .main {
    padding: 16px 12px 92px;
  }

  .mobile-drawer-backdrop {
    grid-template-columns: minmax(0, 86vw) 1fr;
  }

  .mobile-brand img {
    width: min(150px, 52vw);
  }

  .camera-mosaic-grid {
    gap: 10px;
  }

  .filters,
  .player-meta,
  .team-user-meta,
  .invoice-row,
  .notification-row {
    grid-template-columns: 1fr;
  }

  .team-user-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search-layout.mode-focus .video-shell {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .action-cluster {
    grid-template-columns: 1fr;
  }

  .login-brand {
    padding: 28px;
  }

  .login-brand h1 {
    font-size: 38px;
  }

  .login-metrics {
    display: none;
  }
}
