:root {
  color-scheme: dark;
  --bg: #010202;
  --surface: rgba(4, 9, 8, 0.84);
  --surface-strong: rgba(7, 13, 12, 0.94);
  --line: rgba(104, 140, 126, 0.18);
  --line-strong: rgba(116, 230, 183, 0.26);
  --text: #f2f7f4;
  --muted: #8b9993;
  --faint: #53615c;
  --green: #65e8b0;
  --green-soft: rgba(101, 232, 176, 0.13);
  --amber: #d9a646;
  --red: #ff626b;
  --blue: #74b7ff;
  --brown: #3a1713;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
}

[hidden],
.sr-only {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.84), transparent 14%, transparent 86%, rgba(0, 0, 0, 0.88)),
    radial-gradient(circle at 72% 26%, rgba(70, 170, 125, 0.09), transparent 24rem),
    radial-gradient(circle at 54% 58%, rgba(101, 232, 176, 0.06), transparent 38rem),
    #010202;
  color: var(--text);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.app-chrome {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #411a15, #2b100d);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.32);
}

.chrome-left,
.chrome-right {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.chrome-left strong {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 700;
}

.chrome-right {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.window-dot,
.connection-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.window-dot.red {
  background: #ff5f58;
}

.window-dot.yellow {
  background: #ffbf2f;
}

.window-dot.green,
.connection-dot.live {
  background: #2ed96f;
}

.connection-dot {
  width: 9px;
  height: 9px;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(217, 166, 70, 0.12);
}

.connection-dot.live {
  box-shadow: 0 0 0 4px rgba(101, 232, 176, 0.14);
}

.chrome-icon,
.connect-button,
.secondary-button,
.quick-log button,
.stack-form button,
.password-row button {
  min-height: 36px;
  border-radius: 8px;
  cursor: pointer;
}

.chrome-icon {
  display: inline-grid;
  width: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.16);
  color: rgba(255, 255, 255, 0.74);
  font-size: 19px;
}

.connect-button {
  border: 1px solid rgba(101, 232, 176, 0.34);
  background: linear-gradient(180deg, rgba(101, 232, 176, 0.92), rgba(59, 178, 122, 0.86));
  color: #04120c;
  font-weight: 800;
  padding: 0 13px;
}

.connect-button:disabled {
  opacity: 0.68;
  cursor: default;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0 13px;
}

.workspace {
  width: min(100%, 1510px);
  margin: 0 auto;
  padding: 24px clamp(18px, 4.4vw, 66px) 90px;
}

.command-tabs {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 4px 0 28px;
}

.nav-item {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--line-strong);
  background: rgba(101, 232, 176, 0.07);
  color: var(--green);
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.peak-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  min-height: 210px;
  padding-top: 8px;
}

.overline,
.date-line,
.section-label,
.hero-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.overline,
.date-line,
.hero-subtitle {
  margin: 0;
}

.script-title,
.wordmark {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(70px, 9vw, 128px);
  font-style: italic;
  font-weight: 400;
  line-height: 0.88;
  color: #fffaf4;
  letter-spacing: 0;
  text-shadow: 0 0 36px rgba(101, 232, 176, 0.07);
}

.wordmark.compact {
  font-size: 42px;
}

.hero-subtitle {
  margin-top: 18px;
  font-size: clamp(14px, 2vw, 21px);
}

.date-line {
  margin-top: 28px;
  color: #757f7a;
}

.score-card {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  align-items: center;
  min-width: 254px;
  margin-top: 8px;
  padding: 22px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background:
    radial-gradient(circle at 20% 50%, rgba(101, 232, 176, 0.18), transparent 10rem),
    rgba(5, 14, 12, 0.84);
  box-shadow: 0 0 40px rgba(101, 232, 176, 0.08);
}

.score-card strong {
  grid-row: 1 / span 2;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 64px;
  font-weight: 400;
  line-height: 0.9;
}

.score-card span {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.score-card em {
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}

.signal-ticker,
.mini-ticker {
  display: flex;
  align-items: center;
  gap: 28px;
  overflow: hidden;
  min-height: 66px;
  margin: 12px 0 48px;
  padding: 0 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(101, 232, 176, 0.07), transparent 28%, rgba(101, 232, 176, 0.04)),
    rgba(3, 8, 7, 0.92);
  box-shadow: inset 0 0 28px rgba(101, 232, 176, 0.03);
}

.signal-pill,
.mini-ticker span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #bcc8c2;
  font-size: clamp(15px, 1.7vw, 22px);
  white-space: nowrap;
}

.signal-pill::before,
.mini-ticker span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.signal-pill:first-child {
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.signal-pill strong,
.signal-pill .good {
  color: var(--green);
}

.signal-pill .warn {
  color: var(--amber);
}

.guidance-panel,
.page-section,
.stack-section,
.recommend-section,
.curve-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(101, 232, 176, 0.045), transparent 38%),
    rgba(2, 5, 5, 0.7);
  box-shadow: var(--shadow);
}

.guidance-panel {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 34px;
  align-items: center;
  min-height: 176px;
  padding: 24px 32px;
}

.section-index {
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  opacity: 0.78;
}

.plan-list {
  display: grid;
  gap: 14px;
}

.plan-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  column-gap: 12px;
  align-items: baseline;
}

.plan-item::before {
  content: "✦";
  color: var(--green);
  font-size: 24px;
  line-height: 1;
  text-shadow: 0 0 14px rgba(101, 232, 176, 0.8);
}

.plan-item strong {
  grid-column: 2;
  color: var(--text);
  font-size: clamp(16px, 1.7vw, 22px);
  line-height: 1.25;
  white-space: nowrap;
}

.plan-item span,
.plan-item small {
  grid-column: 3;
  color: #9fa9a5;
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.35;
}

.plan-item small {
  display: block;
  margin-top: 2px;
}

.curve-stage {
  position: relative;
  min-height: 650px;
  margin-top: 46px;
  padding: 34px 26px 24px;
  overflow: hidden;
}

.curve-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 41%, rgba(101, 232, 176, 0.09) 41% 58%, transparent 58% 100%),
    linear-gradient(90deg, transparent 0 72%, rgba(101, 232, 176, 0.09) 72% 95%, transparent 95% 100%);
  pointer-events: none;
}

.feel-panel {
  position: absolute;
  left: 24px;
  top: 28px;
  z-index: 2;
  width: min(680px, calc(100% - 48px));
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 7, 6, 0.84);
}

.script-kicker {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-style: italic;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #d9e0dc;
  cursor: pointer;
  font-weight: 750;
}

.segmented button.active {
  border-color: rgba(101, 232, 176, 0.7);
  background: rgba(101, 232, 176, 0.13);
  color: var(--text);
}

.segmented.compact {
  margin: 0 0 16px;
}

.segmented.compact button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.mood {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.mood.red {
  background: var(--red);
}

.mood.amber {
  background: var(--amber);
}

.mood.pale {
  background: #d6dfdc;
}

.mood.green {
  background: var(--green);
}

.quick-log {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

input::placeholder {
  color: #717c77;
}

input:focus {
  border-color: rgba(101, 232, 176, 0.58);
}

.quick-log button,
.stack-form button,
.password-row button {
  border: 1px solid rgba(101, 232, 176, 0.48);
  background: rgba(101, 232, 176, 0.16);
  color: var(--green);
  font-weight: 850;
  padding: 0 17px;
}

.zoom-pill {
  position: absolute;
  right: 28px;
  top: 74px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.zoom-pill span,
.zoom-pill strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.zoom-pill span:first-of-type {
  border-radius: 999px 0 0 999px;
}

.zoom-pill strong {
  border-radius: 0 999px 999px 0;
  background: var(--green);
  color: #06120d;
}

.chart-shell {
  position: relative;
  min-height: 360px;
}

.hero-chart {
  position: absolute;
  inset: 120px 18px 18px;
  min-height: 500px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  filter: drop-shadow(0 0 16px rgba(101, 232, 176, 0.2));
}

.chart-label {
  fill: #6f7b75;
  font-size: 12px;
  font-weight: 700;
}

.stack-section,
.recommend-section,
.page-section {
  margin-top: 74px;
  padding: 28px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  color: #c1cbc6;
}

.section-label span {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.section-label p {
  margin: 0;
}

.stack-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 240px 190px;
  gap: 14px;
  align-items: end;
}

.stack-form label,
.journal-form label {
  display: grid;
  gap: 8px;
}

.stack-form label span,
.journal-form label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.stack-form .wide input {
  min-height: 68px;
  border-radius: 999px;
  padding: 0 30px;
  font-size: 22px;
  font-weight: 800;
}

.stack-form button {
  min-height: 56px;
  background: rgba(101, 232, 176, 0.55);
  color: #05110d;
}

.journal-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.journal-form .wide {
  grid-column: 1 / -1;
}

.journal-form button {
  min-height: 44px;
  border: 1px solid rgba(101, 232, 176, 0.48);
  border-radius: 8px;
  background: rgba(101, 232, 176, 0.18);
  color: var(--green);
  cursor: pointer;
  font-weight: 850;
}

.mini-ticker {
  min-height: 54px;
  margin: 0 0 22px;
  padding: 0 18px;
}

.mini-ticker span {
  font-size: 17px;
}

.mini-ticker span:first-child {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.supplement-list,
.workout-list,
.entry-list,
.insight-list,
.settings-list {
  display: grid;
  gap: 0;
}

.supplement-row,
.workout-row,
.entry-row,
.insight-row,
.settings-row {
  border-bottom: 1px solid rgba(104, 140, 126, 0.1);
}

.supplement-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 130px;
  gap: 18px;
  align-items: center;
  min-height: 118px;
}

.supplement-row > strong {
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
}

.supplement-row h3 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-style: italic;
  font-weight: 400;
}

.supplement-row p,
.supplement-row span {
  margin: 0;
  color: #88958f;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.supplement-row span {
  display: inline-block;
  margin-top: 9px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.supplement-row a {
  color: #bdc6c0;
  text-align: right;
  text-decoration: none;
  line-height: 1.65;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.compact-grid .detail-tile strong {
  font-size: 30px;
}

.detail-tile,
.workout-row,
.entry-row,
.insight-row,
.settings-row {
  padding: 18px 0;
}

.detail-tile {
  border-top: 1px solid var(--line);
}

.detail-tile span,
.settings-row span,
.workout-row span,
.entry-row span,
.insight-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-tile strong {
  display: block;
  margin-top: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  font-weight: 400;
}

.sleep-stage {
  margin: 24px 0;
}

.stage-track {
  display: flex;
  height: 32px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.stage-track span {
  min-width: 2px;
}

.stage-light {
  background: var(--green);
}

.stage-deep {
  background: var(--blue);
}

.stage-rem {
  background: #b88cff;
}

.stage-awake {
  background: var(--amber);
}

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

.stage-legend b {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 2px;
}

.workout-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
}

.workout-row strong,
.entry-row strong,
.insight-row strong {
  display: block;
  color: var(--text);
  font-size: 20px;
}

.workout-row .strain-badge {
  color: var(--amber);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
}

.zone-bar {
  display: flex;
  width: min(100%, 520px);
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.zone-bar span {
  min-width: 3px;
}

.zone-0 {
  background: #4e5b56;
}

.zone-1 {
  background: #477a67;
}

.zone-2 {
  background: var(--green);
}

.zone-3 {
  background: var(--amber);
}

.zone-4,
.zone-5 {
  background: var(--red);
}

.zone-labels {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.coverage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.coverage-item {
  min-height: 100px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.coverage-item strong,
.coverage-item span,
.coverage-item small {
  display: block;
}

.coverage-item strong {
  font-size: 18px;
}

.coverage-item span {
  margin-top: 8px;
  color: var(--green);
}

.coverage-item.warn span,
.coverage-item.warn small {
  color: var(--amber);
}

.coverage-item small {
  margin-top: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.settings-row code {
  color: var(--text);
  overflow-wrap: anywhere;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.metric-grid {
  display: none;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(18px);
}

.login-panel {
  width: min(100%, 420px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.login-panel label {
  display: block;
  margin: 24px 0 8px;
  color: var(--muted);
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.form-error {
  color: var(--red);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(3, 9, 8, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-chrome {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
  }

  .chrome-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .peak-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .score-card {
    width: min(100%, 340px);
  }

  .signal-ticker {
    margin-bottom: 52px;
  }

  .guidance-panel {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 24px;
  }

  .curve-stage {
    min-height: 610px;
    margin-top: 52px;
  }

  .zoom-pill {
    left: 24px;
    right: auto;
    top: 212px;
  }

  .hero-chart {
    inset: 270px 12px 12px;
    min-height: 320px;
  }

  .stack-form {
    grid-template-columns: 1fr;
  }

  .journal-form {
    grid-template-columns: 1fr;
  }

  .trend-grid,
  .detail-grid,
  .coverage-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding-inline: 14px;
  }

  .script-title {
    font-size: 72px;
  }

  .hero-subtitle,
  .overline,
  .date-line,
  .section-label {
    letter-spacing: 0.14em;
  }

  .score-card {
    min-width: 0;
  }

  .signal-ticker,
  .mini-ticker {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    border-radius: 18px;
    padding: 16px;
  }

  .feel-panel {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
  }

  .curve-stage {
    min-height: 720px;
    padding: 14px;
  }

  .zoom-pill {
    position: relative;
    left: auto;
    top: auto;
    margin: 16px 0;
    flex-wrap: wrap;
  }

  .hero-chart {
    inset: auto 10px 10px;
    top: 350px;
  }

  .supplement-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .supplement-row a {
    grid-column: 2;
    text-align: left;
  }

  .settings-row {
    grid-template-columns: 1fr;
  }
}
