:root {
  color-scheme: dark;
  --bg: #0c0f0e;
  --panel: #171d1b;
  --panel-strong: #202824;
  --text: #f4f1e8;
  --muted: #a6b4ad;
  --line: #31413b;
  --accent: #70f2c0;
  --accent-strong: #f2c15a;
  --bad: #ff766f;
  --good: #70f2c0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(112, 242, 192, 0.12), transparent 26rem),
    linear-gradient(135deg, #0c0f0e, #171412 58%, #0f1714);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.shutter-canvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.auth-stage {
  width: min(100%, 27rem);
}

.auth-card {
  border: 1px solid rgba(112, 242, 192, 0.22);
  border-radius: 8px;
  padding: 2rem;
  background: rgba(18, 23, 21, 0.9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.auth-card h1,
.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.auth-card h1 {
  font-size: 2rem;
}

.auth-copy,
.auth-footnote {
  color: var(--muted);
  line-height: 1.5;
}

.auth-footnote {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.auth-error {
  border: 1px solid rgba(255, 118, 111, 0.34);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  color: #ffd1ce;
  background: rgba(255, 118, 111, 0.12);
}

.auth-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.auth-form label {
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  color: var(--text);
  background: #0d1210;
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(112, 242, 192, 0.18);
}

.auth-form button,
.secondary-button {
  border: 0;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: #06110d;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

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

.dashboard-shell {
  padding: 1.25rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 74rem;
  margin: 0 auto 1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  max-width: 74rem;
  margin: 0 auto;
}

.panel {
  grid-column: span 6;
  min-height: 13rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: rgba(23, 29, 27, 0.88);
}

.status-panel,
.device-panel {
  grid-column: span 6;
}

.event-panel,
.live-panel,
.next-panel {
  grid-column: span 6;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0;
}

.metric-list div,
.item-card {
  border: 1px solid rgba(49, 65, 59, 0.88);
  border-radius: 8px;
  padding: 0.85rem;
  background: rgba(32, 40, 36, 0.78);
}

.metric-list dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-list dd {
  margin: 0.25rem 0 0;
  font-weight: 800;
}

.item-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.device-card {
  align-items: flex-start;
}

.device-main,
.device-actions {
  display: grid;
  gap: 0.45rem;
}

.device-main {
  min-width: 0;
}

.device-actions {
  justify-items: end;
}

.device-meta {
  font-size: 0.82rem;
}

.item-card .audio-state-line {
  color: var(--accent-strong);
  font-size: 0.82rem;
}

.item-card .runtime-state-line {
  color: var(--good);
  font-size: 0.82rem;
}

.item-card span,
.empty-state,
.next-panel li {
  color: var(--muted);
}

.empty-state {
  margin-top: 1rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.pill {
  border: 1px solid rgba(112, 242, 192, 0.34);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  color: var(--accent);
  background: rgba(112, 242, 192, 0.08);
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.requested {
  border-color: rgba(242, 193, 90, 0.42);
  color: var(--accent-strong);
  background: rgba(242, 193, 90, 0.1);
}

.pill.agent_accepted {
  border-color: rgba(112, 242, 192, 0.48);
  color: var(--good);
  background: rgba(112, 242, 192, 0.12);
}

.pill.expired {
  border-color: rgba(166, 180, 173, 0.36);
  color: var(--muted);
  background: rgba(166, 180, 173, 0.08);
}

.small-button {
  min-width: 7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  color: var(--text);
  background: var(--panel-strong);
  font-weight: 800;
  cursor: pointer;
}

.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.bad {
  color: var(--bad);
}

.good {
  color: var(--good);
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .panel,
  .status-panel,
  .device-panel,
  .event-panel,
  .live-panel,
  .next-panel {
    grid-column: 1;
  }

  .metric-list {
    grid-template-columns: 1fr;
  }

  .item-card,
  .device-card {
    align-items: stretch;
    flex-direction: column;
  }

  .device-actions {
    justify-items: start;
  }
}
