:root {
  color-scheme: dark;
  --bg: #050914;
  --surface: rgba(12, 20, 34, 0.78);
  --surface-2: rgba(19, 31, 51, 0.86);
  --surface-3: rgba(30, 45, 70, 0.74);
  --text: #f7fbff;
  --muted: #9fb0c8;
  --line: rgba(148, 163, 184, 0.18);
  --accent: #22d3ee;
  --accent-2: #8b5cf6;
  --warning: #f59e0b;
  --danger: #fb7185;
  --ok: #34d399;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(34, 211, 238, 0.22), transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(139, 92, 246, 0.22), transparent 31%),
    linear-gradient(135deg, #050914 0%, #071120 48%, #0c1728 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 75%);
}

.ambient {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  filter: blur(54px);
  opacity: 0.18;
  pointer-events: none;
}

.ambient-one { left: 260px; top: 110px; background: #22d3ee; }
.ambient-two { right: -80px; bottom: 120px; background: #8b5cf6; }

.shell {
  position: relative;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(4, 9, 18, 0.72);
  backdrop-filter: blur(22px);
  padding: 28px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 18px;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-weight: 900; letter-spacing: -0.04em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }

.mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(139, 92, 246, 0.16));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 18px 42px rgba(34, 211, 238, 0.18);
}

.mark svg { width: 40px; height: 40px; }

nav {
  display: grid;
  gap: 7px;
  margin-top: 36px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 11px 13px;
  border-radius: 14px;
  font-weight: 760;
  border: 1px solid transparent;
}

nav a.active,
nav a:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(139, 92, 246, 0.12));
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--text);
}

main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 28px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(12, 20, 34, 0.92), rgba(15, 23, 42, 0.62)),
    radial-gradient(circle at 74% 24%, rgba(34, 211, 238, 0.18), transparent 38%);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -110px;
  width: 300px;
  height: 300px;
  border-radius: 999px;
  border: 55px solid rgba(34, 211, 238, 0.08);
}

.hero-copy,
.health-card { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 16px;
  padding: 7px 10px;
  border: 1px solid rgba(34, 211, 238, 0.24);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.09);
  color: #a5f3fc;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  max-width: 780px;
  font-size: clamp(38px, 5.2vw, 72px);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.topbar p,
.panel-title span,
.metrics span,
.privacy-list,
.rows small,
.health-card small { color: var(--muted); }

.hero p { margin-top: 16px; font-size: 16px; line-height: 1.55; }

.health-card {
  display: grid;
  align-content: end;
  justify-items: end;
  gap: 10px;
  min-width: 280px;
}

.health {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.5);
  font-weight: 800;
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 22px currentColor;
}
.dot.ok { background: var(--ok); }

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metrics article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.metrics article {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.metrics article::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.metrics article strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.06em;
}

.metrics article small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 740;
}

.primary-metric {
  background:
    radial-gradient(circle at 24% 10%, rgba(34, 211, 238, 0.32), transparent 36%),
    linear-gradient(135deg, rgba(14, 116, 144, 0.36), rgba(88, 28, 135, 0.24)),
    var(--surface);
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr) minmax(300px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.hero-panel { min-height: 250px; }

.timeline-viz {
  display: flex;
  align-items: end;
  gap: 10px;
  min-height: 168px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.25);
}

.viz-hour {
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 8px;
  flex: 1;
  min-width: 34px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
}

.viz-bar {
  position: relative;
  width: 100%;
  min-height: 18px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.98), rgba(139, 92, 246, 0.84));
  box-shadow: 0 14px 28px rgba(34, 211, 238, 0.14);
}

.viz-bar::after {
  content: attr(data-switches);
  position: absolute;
  left: 50%;
  top: -24px;
  transform: translateX(-50%);
  color: #e0f2fe;
  font-size: 11px;
}

.ring-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: center; justify-items: center; }

.app-ring {
  display: grid;
  place-items: center;
  width: 154px;
  height: 154px;
  border-radius: 999px;
  background: conic-gradient(var(--accent) 0deg, var(--accent-2) 0deg);
  box-shadow: 0 20px 60px rgba(34, 211, 238, 0.16);
}

.app-ring::before {
  content: "";
  position: absolute;
}

.app-ring span {
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  border-radius: 999px;
  background: #071120;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 24px;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.app-legend { display: grid; gap: 9px; width: 100%; }
.legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 9px; align-items: center; color: var(--muted); font-weight: 780; }
.legend-row span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 999px; }

.operator-read {
  color: #dbeafe;
  font-size: 18px;
  line-height: 1.55;
  font-weight: 720;
}

.signal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.signal-chip { padding: 8px 10px; border-radius: 999px; background: rgba(34, 211, 238, 0.10); border: 1px solid rgba(34,211,238,0.16); color: #a5f3fc; font-size: 12px; font-weight: 850; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.panel { min-height: 260px; padding: 18px; }
.manual-panel { min-height: 0; }
.timeline-panel { grid-row: span 2; }

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 18px;
}

.panel-title h2 { font-size: 18px; letter-spacing: -0.04em; }

.timeline { display: grid; gap: 10px; }
.hour { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; gap: 12px; }
.bar { position: relative; overflow: hidden; height: 20px; border-radius: 999px; background: rgba(148, 163, 184, 0.14); }
.bar span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); min-width: 2px; box-shadow: 0 0 24px rgba(34,211,238,0.3); }

.rows { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row strong, .input-counts strong { font-size: 18px; }

.input-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.input-counts div { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.input-counts span, .input-counts strong { display: block; }

.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 760; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.44);
  color: var(--text);
  font: inherit;
  font-weight: 560;
  padding: 10px 11px;
  outline: none;
}

input:focus, select:focus, textarea:focus { border-color: rgba(34, 211, 238, 0.58); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.09); }
textarea { resize: vertical; }

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font: inherit;
  font-weight: 880;
  cursor: pointer;
  padding: 9px 13px;
  box-shadow: 0 12px 30px rgba(34, 211, 238, 0.15);
}
button:hover { filter: brightness(1.08); transform: translateY(-1px); }
button.secondary { border-color: var(--line); background: var(--surface-2); color: var(--text); box-shadow: none; }
button.danger { background: linear-gradient(135deg, #fb7185, #be123c); }

.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.record-button { width: 100%; background: linear-gradient(135deg, #06b6d4, #2563eb); }
.record-button.recording { background: linear-gradient(135deg, #fb7185, #be123c); }

.rating-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rating-grid label:last-child { grid-column: 1 / -1; }
.body-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.checkline { display: flex; align-items: center; gap: 8px; }
.checkline input { width: auto; }
.form-status { color: var(--muted); line-height: 1.45; }
.privacy-list { display: grid; gap: 10px; padding-left: 18px; line-height: 1.5; }

@media (max-width: 1120px) {
  .manual-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .insight-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .health-card { justify-items: start; min-width: 0; }
}

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics, .manual-grid, .grid { grid-template-columns: 1fr; }
  .ring-wrap { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
}

@media (max-width: 560px) {
  main { padding: 16px; }
  .hero { padding: 20px; border-radius: 22px; }
  nav { grid-template-columns: 1fr 1fr; }
  .input-counts { grid-template-columns: 1fr; }
}
