/* Dashboard — Cloudflare Pages + Supabase */
:root {
  --bg: #04060a;
  --panel: rgba(8, 16, 28, 0.72);
  --line: rgba(77, 225, 255, 0.28);
  --cyan: #4de1ff;
  --gold: #e4c27a;
  --amber: #ffb020;
  --red: #ff5d5d;
  --ok: #3dffb0;
  --text: #e7f4ff;
  --muted: #7f97ad;
  --shadow: 0 0 40px rgba(77, 225, 255, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(77, 225, 255, 0.08), transparent 55%),
    radial-gradient(800px 500px at 10% 110%, rgba(228, 194, 122, 0.06), transparent 50%),
    var(--bg);
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(77, 225, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 225, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 80%);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.app { max-width: 1180px; margin: 0 auto; padding: 28px 22px 48px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.reactor {
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  box-shadow: 0 0 24px rgba(77, 225, 255, 0.25);
  position: relative;
}
.reactor span {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle, #fff, var(--cyan) 45%, transparent 70%);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}
.brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.42em;
  font-weight: 600;
}
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--cyan);
  padding: 8px 12px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-size: 12px;
  text-transform: uppercase;
}
.btn:hover { background: rgba(77, 225, 255, 0.08); }

.spoken {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
  min-height: 74px;
}
.spoken .label {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.spoken p { margin: 8px 0 0; font-size: 20px; line-height: 1.35; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi .k { color: var(--muted); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
}
.kpi .v { margin-top: 8px; font-size: 28px; font-variant-numeric: tabular-nums; }
.kpi .s { margin-top: 6px; color: var(--muted); font-size: 12px; }
.kpi.warn .v { color: var(--amber); }
.kpi.ok .v { color: var(--ok); }
.kpi.gold .v { color: var(--gold); }

.cols { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 12px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 600;
}
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(77, 225, 255, 0.1);
  font-size: 14px;
}
.row small { color: var(--muted); display: block; margin-top: 2px; }
.tag {
  align-self: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
}
.tag.hot { color: var(--amber); border-color: rgba(255, 176, 32, 0.5); }
.tag.done { color: var(--ok); border-color: rgba(61, 255, 176, 0.4); }

.gate {
  max-width: 460px;
  margin: 12vh auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.gate h1 { letter-spacing: 0.36em; font-size: 42px; margin: 0 0 8px; }
.gate p { color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; letter-spacing: 0.08em; }
input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.gate .btn { width: 100%; margin-top: 14px; }
.note { color: var(--muted); font-size: 12px; margin-top: 12px; line-height: 1.45; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .grid, .cols { grid-template-columns: 1fr; }
  .spoken p { font-size: 17px; }
  .top { align-items: flex-start; flex-direction: column; }
}
