:root {
  --bg: #07111f;
  --bg-soft: #102038;
  --card: rgba(9, 22, 40, 0.82);
  --line: rgba(156, 179, 207, 0.18);
  --text: #f2f7fb;
  --muted: #9db0c4;
  --accent: #4fd1c5;
  --accent-strong: #14b8a6;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(79, 209, 197, 0.18), transparent 30%),
    linear-gradient(135deg, #040814, #0b1930 60%, #06111e);
  color: var(--text);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.shell-wide {
  width: min(1480px, calc(100% - 24px));
}

.shell-device {
  width: min(900px, calc(100% - 24px));
}

.hero-card,
.panel-card,
.device-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.narrow {
  width: min(480px, 100%);
  margin: 8vh auto 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
}

h1,
h2,
p {
  margin-top: 0;
}

.lead,
.muted {
  color: var(--muted);
}

.actions,
.panel-header,
.grid-two,
.header-actions,
.inline-actions,
.section-head,
.session-head {
  display: flex;
  gap: 16px;
}

.grid-two,
.ops-layout {
  align-items: flex-start;
}

.grid-two > article {
  flex: 1;
}

.panel-header,
.section-head,
.session-head {
  justify-content: space-between;
}

.header-actions {
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04111f;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

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

.button-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.button-sound-on {
  background: rgba(79, 209, 197, 0.18);
  color: var(--text);
  border: 1px solid rgba(79, 209, 197, 0.32);
}

.button-sound-off {
  background: rgba(251, 113, 133, 0.16);
  color: #ffd7df;
  border: 1px solid rgba(251, 113, 133, 0.32);
}

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

label span {
  display: block;
  margin-bottom: 8px;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.list {
  display: grid;
  gap: 12px;
}

.item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.sub-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.025);
}

.wall-card {
  min-height: calc(100vh - 48px);
}

.panel-dashboard-full {
  overflow: hidden;
}

.shell-wall-full {
  width: 100vw;
  max-width: 100vw;
  margin: 0;
  padding: 0;
}

.wall-card-full {
  min-height: 100vh;
  border-radius: 0;
  border: 0;
  padding: 0;
  background: #06111e;
  box-shadow: none;
  backdrop-filter: none;
}

.panel-dashboard-full .panel-header,
.panel-dashboard-full #summary-cards {
  display: none;
}

.panel-dashboard-full .monitor-wall {
  height: 100vh;
  margin: 0;
  padding: 10px;
  align-content: stretch;
}

.panel-dashboard-full .monitor-tile {
  position: relative;
  min-height: 0;
  height: 100%;
  border-radius: 16px;
}

.panel-dashboard-full .monitor-video-shell,
.panel-dashboard-full .monitor-frame-video {
  height: 100%;
  min-height: 0;
}

.panel-dashboard-full .monitor-video-shell {
  position: absolute;
  inset: 0;
}

.panel-dashboard-full .monitor-meta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  padding: 0;
  background: transparent;
  border: 0;
}

.panel-dashboard-full .monitor-meta .muted {
  margin-bottom: 6px;
  color: #dbe7f5;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
}

.panel-dashboard-full .inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-dashboard-full .tile-tools {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-dashboard-full .button-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}

.panel-dashboard-full .monitor-overlay {
  z-index: 3;
}

.ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-top: 20px;
}

.ops-main,
.ops-side,
.timeline-note {
  display: grid;
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0 18px;
}

.compact-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(79, 209, 197, 0.08), rgba(255, 255, 255, 0.02));
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 28px;
}

.compact-list .item p:last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
}

.badge-normal {
  background: rgba(79, 209, 197, 0.14);
}

.badge-urgent {
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}

.badge-emergency {
  background: rgba(251, 113, 133, 0.18);
  color: #fecdd3;
}

.monitor-wall {
  display: grid;
  grid-template-columns: repeat(var(--wall-columns, 2), minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.monitor-tile {
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}

.monitor-tile-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
}

.monitor-placeholder {
  color: var(--muted);
}

.monitor-video-shell {
  position: relative;
  min-height: 320px;
  background: #06111e;
}

.monitor-frame {
  width: 100%;
  height: 320px;
  border: 0;
  display: block;
  background: #06111e;
}

.monitor-frame-video {
  width: 100%;
  height: 320px;
  display: block;
  object-fit: cover;
  background:
    linear-gradient(145deg, rgba(79, 209, 197, 0.12), rgba(255, 255, 255, 0.02)),
    #091628;
}

.monitor-overlay {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(4, 8, 20, 0.78), rgba(4, 8, 20, 0));
}

.monitor-building {
  margin-bottom: 6px;
  color: var(--accent);
}

.monitor-meta {
  padding: 16px;
}

.tile-tools {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.monitor-live {
  box-shadow: 0 0 0 1px rgba(79, 209, 197, 0.22);
}

.device-screen {
  display: grid;
  gap: 18px;
}

.device-meta {
  display: grid;
  gap: 12px;
}

.device-stage {
  position: relative;
}

.device-pip {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(240px, 32%);
  padding: 12px;
  border-radius: 18px;
  background: rgba(4, 8, 20, 0.8);
  border: 1px solid var(--line);
}

.media-card {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.video-frame {
  width: 100%;
  min-height: 360px;
  border-radius: 18px;
  object-fit: cover;
  background:
    linear-gradient(145deg, rgba(79, 209, 197, 0.12), rgba(255, 255, 255, 0.02)),
    #091628;
}

.video-frame-small {
  min-height: 140px;
}

#device-local-video {
  transform: scaleX(-1);
}

.device-screen-only {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

.device-remote-fullscreen {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.device-resident-strip {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 4px;
  width: min(32vw, 260px);
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
}

.device-resident-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d2dde9;
}

.device-resident-video {
  width: 100%;
  height: min(18vh, 150px);
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #091628;
}

@media (max-width: 640px) {
  .device-resident-strip {
    right: 10px;
    bottom: 10px;
    width: min(44vw, 190px);
    min-width: 130px;
  }

  .device-resident-video {
    height: min(14vh, 110px);
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.device-hidden-actions {
  display: none;
}

.device-embed .shell-device,
.device-embed .shell {
  width: 100%;
  padding: 0;
}

.device-embed .device-card {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.device-embed .eyebrow,
.device-embed .device-meta,
.device-embed .device-pip {
  display: none;
}

.device-embed .video-frame {
  min-height: 320px;
  border-radius: 0;
}

.camera-placeholder {
  min-height: 360px;
  border-radius: 24px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(79, 209, 197, 0.12), rgba(255, 255, 255, 0.02)),
    #091628;
  color: var(--muted);
}

@media (max-width: 768px) {
  .actions,
  .panel-header,
  .grid-two,
  .header-actions,
  .inline-actions,
  .section-head,
  .session-head {
    flex-direction: column;
  }

  .ops-layout,
  .stats-grid,
  .compact-stats,
  .monitor-wall {
    grid-template-columns: 1fr;
  }
}
