:root {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: rgba(148, 163, 184, 0.14);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
}

.brand-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.auth-card h1 { margin: 0 0 8px; font-size: 22px; }
.auth-card label { display: block; font-size: 13px; margin: 18px 0 8px; color: var(--muted); }
.auth-card input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 14px;
}
.error-text { color: var(--red); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.eyebrow { font-size: 10px; letter-spacing: 0.1em; color: var(--accent); font-weight: 700; }
.app-title { margin: 2px 0 0; font-size: 18px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #0b1120; }
.btn-accent { background: rgba(56, 189, 248, 0.16); color: var(--accent); border-color: rgba(56, 189, 248, 0.35); }
.btn-accent.subscribed { background: rgba(34, 197, 94, 0.16); color: var(--green); border-color: rgba(34, 197, 94, 0.35); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-full { width: 100%; padding: 13px; font-size: 15px; }
.small-btn { padding: 7px 11px; font-size: 12px; }

.live-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.online .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-pill.sleep .dot { background: var(--amber); }
.status-pill.offline .dot { background: var(--red); }

.live-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.live-app { font-size: 24px; font-weight: 700; margin-top: 2px; }
.live-media { font-size: 13px; color: var(--accent); margin-top: 4px; max-width: 420px; }
.live-duration { text-align: right; }
.duration-val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.metric {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.metric strong { font-size: 13px; font-variant-numeric: tabular-nums; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.seg-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.seg {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}
.seg.active { background: var(--surface-2); color: var(--text); }

.breakdown-list, .sessions-list, .events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-item { display: flex; flex-direction: column; gap: 5px; }
.bar-row { display: flex; justify-content: space-between; font-size: 13px; }
.bar-track { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border-left: 3px solid var(--accent);
}
.session-title { font-size: 14px; font-weight: 600; }
.session-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.session-time { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.event-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; padding-bottom: 0; }

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.quick-apps { display: flex; flex-wrap: wrap; gap: 8px; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
}

@media (max-width: 560px) {
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .control-grid { grid-template-columns: repeat(2, 1fr); }
}
