:root {
  color-scheme: dark;
  --bg: #10130f;
  --panel: #191f1a;
  --panel-strong: #212920;
  --line: #344034;
  --text: #f1f4eb;
  --muted: #9aa592;
  --green: #89d27c;
  --amber: #e4b75f;
  --red: #ff6d66;
  --blue: #74a8ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(120deg, rgba(116, 168, 255, 0.12), transparent 38%),
    radial-gradient(circle at 80% 0%, rgba(137, 210, 124, 0.14), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

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

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 9vw, 68px);
  line-height: 0.95;
}

h2 {
  font-size: 18px;
}

.pill {
  min-width: 96px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  color: var(--muted);
  background: rgba(25, 31, 26, 0.72);
}

.pill-live {
  color: var(--green);
  border-color: rgba(137, 210, 124, 0.5);
}

.control-band,
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.quick-actions button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.primary-btn {
  background: var(--green);
  color: #10130f;
  font-weight: 700;
}

.ghost-btn:disabled {
  opacity: 0.45;
}

.warning {
  padding: 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid rgba(228, 183, 95, 0.5);
  color: #ffe0a3;
  background: rgba(228, 183, 95, 0.1);
}

.hidden {
  display: none !important;
}

.live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.7fr);
  gap: 14px;
}

.video-panel,
.status-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 31, 26, 0.84);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.video-panel {
  position: relative;
  overflow: hidden;
  min-height: 320px;
}

video {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  display: block;
  background: #050805;
}

.video-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
}

.risk {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 800;
  background: rgba(16, 19, 15, 0.84);
  border: 1px solid var(--line);
}

.risk.safe {
  color: var(--green);
}

.risk.attention {
  color: var(--amber);
}

.risk.emergency {
  color: var(--red);
}

.status-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0e0b;
}

.meter div {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
  transition: width 80ms linear;
}

.quick-actions {
  margin-top: 14px;
}

.quick-actions button {
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 16px;
  min-height: 280px;
}

.panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.transcripts,
.events {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.bubble,
.event {
  border-radius: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: rgba(33, 41, 32, 0.62);
}

.bubble.user {
  border-color: rgba(116, 168, 255, 0.45);
}

.bubble.assistant {
  border-color: rgba(137, 210, 124, 0.45);
}

.meta {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.event.emergency {
  border-color: rgba(255, 109, 102, 0.65);
}

.event.attention {
  border-color: rgba(228, 183, 95, 0.65);
}

@media (max-width: 820px) {
  .app-shell {
    padding: 14px;
  }

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

  .live-grid,
  .cards {
    grid-template-columns: 1fr;
  }

  .video-panel,
  video {
    min-height: 58vh;
  }

  .primary-btn,
  .ghost-btn,
  .icon-btn,
  .quick-actions button {
    flex: 1 1 auto;
  }
}
