:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #21252e;
  --text: #e7e9ee;
  --muted: #8b94a3;
  --accent: #7c5cff;
  --accent-2: #5a8cff;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
}

/* ── Login ─────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, #2a1d52 0%, var(--bg) 60%);
}
.login-card {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(360px, 90vw);
  display: flex; flex-direction: column; gap: 14px;
  text-align: center;
}
.login-card .logo { font-size: 48px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.login-card input {
  background: var(--surface-2);
  border: 1px solid #2c313c;
  color: var(--text);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: border-color .15s;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  background: var(--accent);
  color: white;
  border: 0;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s, opacity .15s;
}
.login-card button:active { transform: scale(.98); }

/* ── App layout ────────────────────────────────── */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #20242d;
  position: sticky; top: 0;
  background: rgba(15,17,21,.85);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.brand { font-size: 18px; font-weight: 600; }
.brand span { margin-left: 6px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 8px currentColor;
  transition: background .25s;
}
.dot.online { background: var(--good); color: var(--good); }
.dot.idle { background: var(--warn); color: var(--warn); }

main { padding: 16px 16px 80px; max-width: 760px; margin: 0 auto; }

/* ── Live card ─────────────────────────────────── */
.live-card {
  background: linear-gradient(135deg, #1c1f29 0%, #1a1d29 100%);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.live-row { display: flex; align-items: center; gap: 14px; }
.live-btn {
  background: var(--accent);
  color: white; border: 0;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: transform .05s, background .15s;
  white-space: nowrap;
}
.live-btn:active { transform: scale(.97); }
.live-btn.active { background: var(--bad); }

.meter {
  flex: 1;
  height: 10px;
  background: #2a2f3a;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--good) 0%, var(--warn) 70%, var(--bad) 100%);
  transition: width .08s linear;
}

.live-meta {
  margin-top: 12px;
  display: flex; flex-wrap: wrap; gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Recordings ────────────────────────────────── */
.rec-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.rec-header h2 { margin: 0; font-size: 17px; font-weight: 600; }
#date-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid #2c313c;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.rec-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rec-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.rec-row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rec-time { font-weight: 600; font-size: 15px; }
.rec-mode {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.rec-mode.vad { background: #3b2c5e; color: #c4b5fd; }
.rec-mode.continuous { background: #1e3a5f; color: #93c5fd; }
.rec-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.rec-actions { display: flex; gap: 8px; align-items: center; }
.rec-wave {
  height: 36px;
  background: #11141b;
  border-radius: 6px;
  overflow: hidden;
}
.rec-wave svg { width: 100%; height: 100%; display: block; }
.rec-actions audio { flex: 1; height: 32px; }
.rec-del {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 16px;
}
.rec-del:hover { background: #2a2f3a; color: var(--bad); }

.rec-empty {
  text-align: center; color: var(--muted); padding: 40px 0;
}

/* ── Footer ────────────────────────────────────── */
footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 12px 20px;
  background: rgba(15,17,21,.85);
  backdrop-filter: blur(8px);
  border-top: 1px solid #20242d;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
#apk-link {
  color: var(--accent-2);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
#apk-link:hover { text-decoration: underline; }
.logout button {
  background: transparent; border: 0; color: var(--muted);
  cursor: pointer; font-size: 13px;
}
.logout button:hover { color: var(--text); }

/* ── Mobile tweaks ─────────────────────────────── */
@media (max-width: 480px) {
  .live-row { flex-direction: column; align-items: stretch; }
  .live-btn { width: 100%; }
  .rec-meta { font-size: 11px; }
}
