:root {
  /* Brand */
  --gold: #C9A84C;
  --gold-glow: rgba(201, 168, 76, 0.45);
  --white: #FFFFFF;

  /* Liquid Glass surfaces */
  --glass-light:        rgba(255, 255, 255, 0.11);
  --glass-light-hover:  rgba(255, 255, 255, 0.18);
  --glass-medium:       rgba(255, 255, 255, 0.07);
  --glass-dark:         rgba(8,  16,  40,  0.58);
  --glass-dark-deep:    rgba(4,   9,  24,  0.74);
  --glass-border:       rgba(255, 255, 255, 0.24);
  --glass-border-sub:   rgba(255, 255, 255, 0.11);

  /* Blur */
  --blur:        blur(32px) saturate(180%);
  --blur-heavy:  blur(52px) saturate(200%);
  --blur-light:  blur(14px) saturate(140%);

  /* Shadows */
  --shadow-sm:   0 4px 20px rgba(0, 0, 0, 0.22);
  --shadow-md:   0 12px 48px rgba(0, 0, 0, 0.32);
  --shadow-lg:   0 24px 72px rgba(0, 0, 0, 0.44);
  --inset-hi:    0 1px 0 rgba(255, 255, 255, 0.22) inset;

  /* Text */
  --text-1: rgba(255, 255, 255, 0.97);
  --text-2: rgba(255, 255, 255, 0.68);
  --text-3: rgba(255, 255, 255, 0.42);

  /* Radius */
  --radius:      22px;
  --radius-sm:   14px;
  --radius-xs:   10px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ── Keyframes ───────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ambientDrift {
  0%, 100% { opacity: 0.6; transform: scale(1) translate(0, 0); }
  33%       { opacity: 0.9; transform: scale(1.06) translate(2%, -1%); }
  66%       { opacity: 0.7; transform: scale(0.97) translate(-1%, 2%); }
}

@keyframes shimmerBorder {
  0%, 100% { opacity: 0.24; }
  50%       { opacity: 0.45; }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 55% at 12% 0%,  rgba(201, 164, 76, 0.16) 0%, transparent 55%),
    radial-gradient(ellipse 70% 70% at 88% 100%, rgba(55, 78, 120, 0.24) 0%, transparent 55%),
    linear-gradient(140deg,
      #07101e 0%,
      #0d1b36 12%,
      #1a2b4a 26%,
      #223558 40%,
      #5c3e22 58%,
      #a86e2a 74%,
      #c9944c 86%,
      #e4c06a 100%
    );
  background-attachment: fixed;
  color: var(--text-1);
  font-family: Poppins, Avenir, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

/* Ambient drifting orb behind everything */
body::before {
  content: "";
  position: fixed;
  top: -10%; left: 55%;
  width: 55vw; height: 60vh;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(201,148,76,0.09) 0%, transparent 70%);
  animation: ambientDrift 14s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

/* Ensure all content sits above ambient layer */
.topbar, .shell { position: relative; z-index: 1; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* ── Logo ───────────────────────────────── */
.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: invert(1);
  mix-blend-mode: screen;
  flex-shrink: 0;
}

/* ── Topbar ─────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px clamp(18px, 4vw, 48px);
  background: var(--glass-dark-deep);
  backdrop-filter: var(--blur-heavy);
  -webkit-backdrop-filter: var(--blur-heavy);
  border-bottom: 1px solid var(--glass-border-sub);
  box-shadow: var(--shadow-sm), var(--inset-hi);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--white);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px; height: 42px;
  place-items: center;
  background: var(--glass-light);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  color: var(--gold);
  border: 1px solid rgba(201, 168, 76, 0.38);
  border-radius: 50%;
  font-size: 12px; font-weight: 600; letter-spacing: 2px;
  box-shadow: var(--inset-hi);
}

.brand strong { display: block; font-size: 17px; font-weight: 600; line-height: 1.1; color: var(--white); }

.eyebrow, .label {
  display: block;
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 10px; font-weight: 500; letter-spacing: 3px;
  line-height: 1.45; text-transform: uppercase;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.save-status { color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }

.ghost-btn {
  min-height: 38px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: 0 20px;
  font-size: 13px; font-weight: 600;
  background: var(--glass-light);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  color: var(--white);
  transition: background 0.2s, border-color 0.2s;
  box-shadow: var(--inset-hi);
}
.ghost-btn:hover { background: var(--glass-light-hover); }

/* ── Layout shell ────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  gap: 18px;
  width: min(1400px, calc(100% - 48px));
  margin: 22px auto 54px;
}

/* ── Summary panel ───────────────────────── */
.summary-panel {
  animation: fadeUp 0.55s ease both;
  position: sticky;
  top: 78px;
  align-self: start;
  min-height: calc(100vh - 108px);
  padding: 26px;
  background: var(--glass-dark);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border-sub);
  box-shadow: var(--shadow-md), var(--inset-hi);
  overflow: hidden;
}

.summary-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  pointer-events: none;
}

.summary-panel h1 {
  max-width: 10ch;
  margin: 0 0 14px;
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 700; line-height: 1.06; color: var(--white);
  text-shadow: 0 2px 16px rgba(0,0,0,0.5);
}

.lead {
  margin: 0 0 22px;
  color: var(--text-2);
  font-size: 14px; font-weight: 300; line-height: 1.78;
}

.hero-photo {
  position: relative;
  overflow: hidden;
  margin: 0 0 16px;
  height: clamp(160px, 24vh, 230px);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.28);
}

.hero-photo::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(7,16,30,0.04), rgba(7,16,30,0.54)),
    linear-gradient(90deg, rgba(7,16,30,0.15), transparent);
}

.hero-photo img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 42%;
  filter: saturate(0.8) contrast(1.03);
}

.hero-photo figcaption {
  position: absolute; z-index: 1;
  left: 14px; bottom: 12px;
  margin: 0; max-width: 18ch;
  color: rgba(255,255,255,0.82);
  font-size: 11px; font-weight: 500; line-height: 1.45;
}

/* Glass sub-cards inside sidebar */
.progress-card,
.routine-preview,
.note-box {
  border-radius: var(--radius-sm);
}

.progress-card {
  padding: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border-sub);
  box-shadow: var(--inset-hi);
}

.metric { display: block; color: var(--gold); font-size: 38px; font-weight: 700; line-height: 1; }
.metric-label { color: var(--text-2); font-size: 12px; }
.progress-help { margin: 8px 0 0; color: var(--text-3); font-size: 12px; line-height: 1.5; }

.progress-track {
  overflow: hidden;
  height: 5px; margin-top: 14px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-pill);
}

.progress-track span {
  display: block; width: 0; height: 100%;
  background: linear-gradient(90deg, var(--gold), #f0d068);
  border-radius: inherit;
  transition: width 0.3s ease;
  box-shadow: 0 0 14px var(--gold-glow);
}

.routine-preview {
  margin-top: 14px; padding: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border-sub);
  color: var(--white);
  box-shadow: var(--inset-hi);
}

.preview-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border-sub);
}
.preview-head .label { margin: 0; }
#durationBadge { color: var(--gold); font-size: 12px; font-weight: 600; }

.routine-preview ol {
  display: grid; gap: 9px;
  margin: 12px 0 0; padding: 0; list-style: none; counter-reset: steps;
}

.routine-preview li {
  display: grid; grid-template-columns: 26px 1fr auto;
  gap: 10px; align-items: start;
  font-size: 13px; line-height: 1.5; color: var(--text-1);
}

.routine-preview li::before {
  counter-increment: steps;
  content: counter(steps, decimal-leading-zero);
  color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: 1px;
}

.routine-preview small { color: var(--text-3); }

.note-box {
  margin-top: 14px; padding: 14px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border-sub);
  border-left: 2px solid var(--gold);
}

.note-box p:last-child { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.65; }

/* ── Workspace ───────────────────────────── */
.workspace {
  animation: fadeUp 0.55s 0.1s ease both;
  position: relative;
  min-width: 0;
  background: rgba(12, 22, 48, 0.55);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), var(--inset-hi);
  overflow: hidden;
}

.workspace::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.42), transparent);
  pointer-events: none; z-index: 1;
}

/* ── Tabs ────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px; padding: 7px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid var(--glass-border-sub);
  border-radius: var(--radius) var(--radius) 0 0;
}

.tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.tab:hover { background: rgba(255,255,255,0.08); color: var(--white); }

.tab.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border-color: var(--glass-border);
  box-shadow: 0 2px 14px rgba(0,0,0,0.2), var(--inset-hi);
}

/* ── How it works banner ─────────────────── */
.how-it-works {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(270px, 0.95fr);
  gap: 22px;
  padding: clamp(20px,3vw,32px) clamp(22px,4vw,46px);
  background: rgba(5,12,28,0.62);
  color: var(--white);
  border-bottom: 1px solid var(--glass-border-sub);
}

.how-copy h2 {
  margin: 0 0 9px; max-width: 14ch;
  color: var(--white);
  font-size: clamp(24px,3vw,36px); font-weight: 600; line-height: 1.13;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.how-copy p:not(.label) {
  margin: 0; max-width: 58ch;
  color: rgba(255,255,255,0.82); font-size: 14px; line-height: 1.72;
}

.how-steps {
  display: grid; gap: 8px;
  align-self: center;
  margin: 0; padding: 0; list-style: none;
}

.how-steps li {
  display: grid; grid-template-columns: 30px 1fr;
  gap: 12px; align-items: center;
  min-height: 44px; padding: 9px 13px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--inset-hi);
}

.how-steps strong {
  display: grid; width: 27px; height: 27px;
  place-items: center;
  background: var(--gold);
  color: #1a2b4a;
  border-radius: 50%;
  font-size: 12px; font-weight: 700;
}

.how-steps span { color: var(--text-1); font-size: 13px; font-weight: 500; line-height: 1.4; }

.how-save {
  grid-column: 1/-1;
  margin: -3px 0 0; padding-top: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--glass-border-sub);
  font-size: 12px; line-height: 1.55;
}

/* ── Panels ──────────────────────────────── */
.panel { display: none; padding: clamp(22px,4vw,46px); }
.panel.active {
  display: block;
  animation: fadeIn 0.28s ease both;
}

.section-head { max-width: 760px; margin-bottom: 26px; }

.section-head h2 {
  margin: 0 0 10px;
  color: var(--white);
  font-size: clamp(24px,3.6vw,40px); font-weight: 600; line-height: 1.14;
  text-shadow: 0 2px 12px rgba(0,0,0,0.45);
}

.section-head p:not(.label) {
  margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.77;
  text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* ── Editorial band ──────────────────────── */
.editorial-band {
  display: grid;
  grid-template-columns: minmax(190px,0.5fr) minmax(0,1fr);
  gap: 0; overflow: hidden;
  margin: 0 0 20px;
  background: rgba(7,16,32,0.5);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm), var(--inset-hi);
}

.editorial-band img {
  width: 100%; height: 100%;
  min-height: 230px;
  object-fit: cover; object-position: center;
  filter: saturate(0.7) contrast(1.05);
}

.editorial-band > div {
  display: flex; justify-content: center; flex-direction: column;
  padding: clamp(20px,3.5vw,38px); color: var(--white);
}

.editorial-band h3 {
  margin: 0 0 9px; max-width: 14ch;
  font-size: clamp(22px,3.2vw,36px); font-weight: 600; line-height: 1.13;
  color: var(--white);
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.editorial-band p:last-child {
  margin: 0; max-width: 48ch;
  color: var(--text-2); font-size: 14px; line-height: 1.77;
}

/* ── Form fields ─────────────────────────── */
.form-grid, .reflection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}

.field { display: grid; gap: 6px; }

.field span { color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: 0.4px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.08);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  color: var(--white);
  outline: 0;
  padding: 12px 14px;
  font-size: 14px;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.field textarea { min-height: 118px; resize: vertical; }

.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }

.field select option { background: #1a2b4a; color: var(--white); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(201,168,76,0.65);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.16);
}

/* ── Insight strip ───────────────────────── */
.insight-strip {
  display: grid;
  grid-template-columns: minmax(0,0.8fr) minmax(250px,1fr);
  gap: 22px; align-items: center;
  margin-top: 20px; padding: 20px;
  background: rgba(7,16,32,0.5);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm), var(--inset-hi);
  color: var(--white);
}

.insight-strip h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; color: var(--white); text-shadow: 0 1px 8px rgba(0,0,0,0.45); }
.insight-strip p:last-child { margin: 0; color: rgba(255,255,255,0.8); line-height: 1.72; }

/* ── Segment / duration control ──────────── */
.control-row {
  display: inline-grid;
  grid-template-columns: repeat(3,1fr);
  gap: 3px; padding: 4px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-pill);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  box-shadow: var(--inset-hi);
}

.segment {
  min-width: 88px; min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.segment.active {
  background: rgba(255,255,255,0.18);
  color: var(--white);
  border-color: var(--glass-border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.22), var(--inset-hi);
}

.segment:hover:not(.active) { background: rgba(255,255,255,0.1); color: var(--text-1); }

/* ── Method card ─────────────────────────── */
.method-card {
  display: grid;
  grid-template-columns: 136px minmax(0,1fr);
  gap: 16px; align-items: center;
  max-width: 680px;
  margin: -2px 0 20px; padding: 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--inset-hi);
}

.method-card img {
  width: 136px; height: 100px;
  object-fit: cover; object-position: center 38%;
  border-radius: var(--radius-xs);
  filter: saturate(0.8) contrast(1.04);
}

.method-card span { display: block; margin-bottom: 3px; color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase; }
.method-card strong { display: block; color: var(--white); font-size: 18px; font-weight: 600; line-height: 1.25; }
.method-card p { margin: 5px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.56; }

/* ── Habit list ──────────────────────────── */
.habit-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 11px; margin-top: 20px;
}

.habit-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 12px; align-items: start;
  min-height: 98px; padding: 16px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  transition: background 0.22s, border-color 0.22s, transform 0.22s, box-shadow 0.22s;
  box-shadow: var(--inset-hi);
  cursor: pointer;
}

.habit-item:hover {
  background: rgba(255,255,255,0.13);
  border-color: var(--glass-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.28), var(--inset-hi);
}

/* Staggered entrance for habit cards */
.habit-item:nth-child(1) { animation: fadeUp 0.38s 0.04s ease both; }
.habit-item:nth-child(2) { animation: fadeUp 0.38s 0.09s ease both; }
.habit-item:nth-child(3) { animation: fadeUp 0.38s 0.14s ease both; }
.habit-item:nth-child(4) { animation: fadeUp 0.38s 0.19s ease both; }
.habit-item:nth-child(5) { animation: fadeUp 0.38s 0.24s ease both; }
.habit-item:nth-child(6) { animation: fadeUp 0.38s 0.29s ease both; }
.habit-item:nth-child(7) { animation: fadeUp 0.38s 0.34s ease both; }
.habit-item:nth-child(8) { animation: fadeUp 0.38s 0.39s ease both; }

.habit-item input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--gold); }

.habit-copy strong { display: block; margin-bottom: 5px; color: var(--white); font-size: 14px; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,0.4); }
.habit-copy small { display: block; color: rgba(255,255,255,0.78); font-size: 12px; line-height: 1.56; }
.habit-time { color: var(--gold); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ── Intent card ─────────────────────────── */
.intent-card {
  display: grid;
  grid-template-columns: 0.64fr 1fr;
  gap: 20px; align-items: end;
  margin-top: 18px; padding: 20px;
  background: rgba(7,16,32,0.5);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm), var(--inset-hi);
  color: var(--white);
}

.intent-card h3 { margin: 0; font-size: 22px; font-weight: 600; color: var(--white); }
.intent-card .field span { color: rgba(255,255,255,0.6); }
.intent-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }

/* ── Day grid ────────────────────────────── */
.day-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 13px;
}

.day-card {
  padding: 19px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  box-shadow: var(--inset-hi);
  transition: background 0.22s, transform 0.22s, box-shadow 0.22s;
}

.day-card:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.26), var(--inset-hi);
}

.day-card header {
  display: flex; align-items: start; justify-content: space-between;
  gap: 14px; margin-bottom: 11px;
}

.day-card h3 { margin: 0; color: var(--white); font-size: 16px; }
.day-card p { margin: 0 0 11px; color: var(--text-2); font-size: 13px; line-height: 1.62; }

.day-card input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--gold); }

.day-card textarea {
  width: 100%; min-height: 78px;
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.06);
  color: var(--white);
  padding: 10px; resize: vertical;
}

/* ── Tracker ─────────────────────────────── */
.tracker-wrap {
  overflow-x: auto;
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
}

.tracker-table {
  width: 100%; min-width: 760px;
  border-collapse: collapse;
  background: rgba(255,255,255,0.04);
}

.tracker-table caption {
  padding: 13px 16px;
  background: rgba(255,255,255,0.06);
  color: var(--white);
  font-size: 13px; font-weight: 600; text-align: left;
}

.tracker-table th,
.tracker-table td {
  border-top: 1px solid var(--glass-border-sub);
  padding: 12px 10px;
  text-align: center; vertical-align: middle;
}

.tracker-table th:first-child,
.tracker-table td:first-child {
  width: 200px; color: var(--white);
  font-size: 13px; font-weight: 600; text-align: left;
}

.tracker-table th { color: var(--text-2); font-size: 12px; font-weight: 600; }
.tracker-table input { width: 17px; height: 17px; accent-color: var(--gold); }

.reflection-grid { grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 20px; }

/* ── Statistikk ──────────────────────────── */
.stat-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 18px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--inset-hi);
  text-align: center;
}

.stat-chip--gold {
  background: rgba(201,168,76,0.12);
  border-color: rgba(201,168,76,0.28);
}

.stat-chip-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-chip--gold .stat-chip-value {
  color: var(--gold);
}

.stat-chip-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.stat-section {
  margin-bottom: 28px;
}

.stat-section-title {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Day bars */
.day-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: flex-end;
  height: 130px;
}

.day-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 5px;
}

.day-bar-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1;
}

.day-bar-track {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: rgba(255,255,255,0.06);
  border-radius: 6px 6px 4px 4px;
  overflow: hidden;
}

.day-bar-fill {
  width: 100%;
  border-radius: 6px 6px 4px 4px;
  transition: height 0.5s cubic-bezier(.34,1.56,.64,1);
  background: linear-gradient(180deg, rgba(201,168,76,0.9) 0%, rgba(180,120,40,0.75) 100%);
}

.day-bar-fill.locked {
  background: linear-gradient(180deg, rgba(201,168,76,1) 0%, rgba(180,120,40,0.9) 100%);
  box-shadow: 0 0 10px rgba(201,168,76,0.3);
}

.day-bar-fill.dim {
  background: rgba(255,255,255,0.15);
}

.day-bar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.day-bar-col.best .day-bar-label {
  color: var(--gold);
}

/* Habit bars */
.habit-bars {
  display: grid;
  gap: 10px;
}

.habit-bar-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 52px;
  gap: 10px;
  align-items: center;
}

.habit-bar-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.habit-bar-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-bar-track {
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  overflow: hidden;
}

.habit-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(201,168,76,0.7), rgba(201,168,76,1));
  transition: width 0.4s ease;
}

.habit-bar-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-align: right;
}

/* Insight box */
.stat-insight {
  padding: 18px 20px;
  background: rgba(7,16,32,0.5);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--inset-hi);
}

.stat-insight .label {
  margin-bottom: 6px;
}

.stat-insight p:last-child {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
}

/* ── Lock Day (Bug 2) ────────────────────── */
#lockDayArea {
  margin: 20px 0;
}

.lock-day-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.22);
  border-radius: var(--radius-sm);
  box-shadow: var(--inset-hi);
}

.lock-day-card .label { margin-bottom: 4px; }
.lock-day-card p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.55; }

.lock-day-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  background: var(--gold);
  color: #1a2b4a;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.18s;
  white-space: nowrap;
}

.lock-day-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.lock-day-btn:active { transform: scale(0.97); }

.lock-day-locked {
  background: rgba(255,255,255,0.05);
  border-color: var(--glass-border-sub);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  gap: 10px;
}

.lock-icon { font-size: 18px; }

.lock-day-done {
  background: rgba(255,255,255,0.05);
  border-color: var(--glass-border-sub);
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.lock-day-done strong { color: var(--white); }

/* ── Tracker dim rows (Bug 8) ────────────── */
.tracker-row-dim td,
.tracker-row-dim th {
  opacity: 0.38;
}

.tracker-not-in-plan {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ── Sequential day locking ─────────────── */
.col-future {
  opacity: 0.38;
  pointer-events: none;
}

.col-locked {
  color: var(--gold);
  font-weight: 700;
}

.cell-future {
  opacity: 0.25;
  pointer-events: none;
}

.cell-future input[type="checkbox"],
.cell-locked input[type="checkbox"] {
  cursor: not-allowed;
  pointer-events: none;
}

.cell-locked input[type="checkbox"] {
  accent-color: var(--gold);
  opacity: 0.72;
}

/* ── Toast undo button (Bug 7) ───────────── */
.toast-undo {
  margin-left: 12px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.26);
  border-radius: var(--radius-pill);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.toast-undo:hover { background: rgba(255,255,255,0.28); }

/* ── Week complete card (Bug 4) ──────────── */
.week-complete {
  margin-top: 24px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(201,168,76,0.12) 0%, rgba(201,120,40,0.08) 100%);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius-sm);
  box-shadow: var(--inset-hi), 0 0 40px rgba(201,168,76,0.06);
}

.week-complete .label { margin-bottom: 8px; }

.week-complete h3 {
  margin: 0 0 10px;
  color: var(--white);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.week-complete p {
  margin: 0 0 18px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}

.week2-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background: var(--gold);
  color: #1a2b4a;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.18s;
}

.week2-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.week2-btn:active { transform: scale(0.97); }

/* ── Research / Kilder ───────────────────── */
.research-list { display: grid; gap: 11px; }

.research-list article {
  display: grid; grid-template-columns: 46px 1fr;
  gap: 16px; padding: 17px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  backdrop-filter: var(--blur-light);
  -webkit-backdrop-filter: var(--blur-light);
  box-shadow: var(--inset-hi);
  transition: background 0.22s, transform 0.22s, box-shadow 0.22s;
}

.research-list article:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.24), var(--inset-hi);
}

.research-list article > span { color: var(--gold); font-size: 18px; font-weight: 700; }
.research-list h3 { margin: 0 0 5px; color: var(--white); font-size: 17px; text-shadow: 0 1px 6px rgba(0,0,0,0.4); }
.research-list p { margin: 0 0 8px; color: rgba(255,255,255,0.78); font-size: 13px; line-height: 1.66; }
.research-list a { font-size: 13px; font-weight: 600; }

/* ── Credits ─────────────────────────────── */
.credits-box {
  margin-top: 14px; padding: 16px;
  background: rgba(7,16,32,0.48);
  border: 1px solid var(--glass-border-sub);
  border-radius: var(--radius-sm);
  box-shadow: var(--inset-hi);
}

.credits-box p:last-child { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.66; }

/* ── Toast ───────────────────────────────── */
.toast:not([hidden]) {
  animation: toastSlide 0.3s ease both;
}

.toast {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 200;
  max-width: min(360px, calc(100vw - 48px));
  padding: 14px 18px;
  background: var(--glass-dark-deep);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--white);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-lg), var(--inset-hi);
  font-size: 13px; line-height: 1.56;
}

.toast[hidden] { display: none; }

/* ── Mobile progress strip ───────────────── */
.mobile-progress {
  display: none; /* shown only on mobile via media query */
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(5,12,28,0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border-sub);
  position: sticky;
  top: 56px;
  z-index: 90;
}

.mp-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-shrink: 0;
}

.mp-score {
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.mp-label {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.mp-bar-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.mp-bar {
  height: 100%;
  background: rgba(255,255,255,0.1);
  border-radius: inherit;
}

.mp-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #f0d068);
  border-radius: inherit;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--gold-glow);
}

.mp-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  background: rgba(201,168,76,0.18);
  border: 1px solid rgba(201,168,76,0.35);
  border-radius: var(--radius-pill);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
}

/* ── Mobile bottom nav ───────────────────── */
.mobile-nav {
  display: none; /* shown only on mobile */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  flex-direction: row;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(5,12,28,0.86);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border-top: 1px solid var(--glass-border-sub);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4), 0 -1px 0 rgba(255,255,255,0.06) inset;
}

.mnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px 11px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: color 0.18s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.mnav-item svg {
  width: 22px;
  height: 22px;
  transition: stroke 0.18s, transform 0.18s;
}

.mnav-item.active {
  color: var(--gold);
}

.mnav-item.active svg {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

.mnav-item:active svg {
  transform: scale(0.88);
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100% - 28px, 760px);
  }

  .workspace { order: -1; }
  .summary-panel { position: static; min-height: 0; }
  .summary-panel h1 { max-width: 12ch; }

  .habit-list,
  .day-grid,
  .intent-card,
  .insight-strip,
  .editorial-band,
  .how-it-works,
  .form-grid,
  .reflection-grid {
    grid-template-columns: 1fr;
  }

  .editorial-band img { max-height: 270px; }
}

@media (max-width: 680px) {
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; flex-wrap: wrap; }
  .ghost-btn { flex: 1; }
  .save-status { width: 100%; }

  .tabs {
    grid-template-columns: repeat(6, minmax(74px,1fr));
    overflow-x: auto;
  }
  .tab { white-space: nowrap; }

  .how-it-works { padding: 20px; }
  .how-copy h2 { max-width: none; }

  .panel, .summary-panel { padding: 18px; }

  .routine-preview li { grid-template-columns: 26px 1fr; }
  .routine-preview li small { grid-column: 2; }

  .method-card { grid-template-columns: 1fr; }
  .method-card img { width: 100%; height: 155px; }
}

/* ── Site footer ─────────────────────────── */
.site-footer {
  width: 100%;
  padding: 32px 24px 28px;
  text-align: center;
  position: relative;
}

.site-footer::before {
  content: "";
  display: block;
  width: 120px;
  height: 1px;
  margin: 0 auto 24px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold) 30%,
    var(--gold) 70%,
    transparent
  );
  opacity: 0.45;
}

.site-footer span {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
}

/* ── MOBILE APP LAYOUT ≤768px ────────────── */
@media (max-width: 768px) {
  /* Show mobile-only UI */
  .mobile-progress { display: flex; }
  .mobile-nav      { display: flex; }

  /* Compact topbar */
  .topbar {
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    padding: 10px 16px;
    flex-wrap: nowrap;
  }

  .brand { gap: 10px; }
  .brand-logo { width: 32px; height: 32px; }
  .eyebrow { display: none; }
  .brand-text strong { font-size: 15px; }

  .top-actions { width: auto; flex-wrap: nowrap; }
  .save-status { display: none; }
  .ghost-btn {
    flex: none;
    padding: 0 14px;
    min-height: 34px;
    font-size: 12px;
  }

  /* Single full-width column, no side panel */
  .shell {
    display: block;
    width: 100%;
    margin: 0;
    gap: 0;
  }

  .summary-panel { display: none; }

  .workspace {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    animation: none;
    min-height: calc(100dvh - 56px - 48px);
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 16px));
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
  }

  /* Hide desktop tab bar; mobile nav replaces it */
  .tabs { display: none; }

  /* Hide "how it works" on mobile — tabs are self-evident */
  .how-it-works { display: none; }

  /* Panels: generous mobile padding */
  .panel { padding: 24px 18px 16px; }

  /* Section headings tighter on mobile */
  .section-head { margin-bottom: 20px; }
  .section-head h2 { font-size: clamp(22px, 6vw, 30px); }

  /* Editorial band: stack vertically */
  .editorial-band {
    grid-template-columns: 1fr;
  }
  .editorial-band img {
    min-height: 180px;
    max-height: 220px;
  }

  /* Form grid: 1 col on mobile */
  .form-grid { grid-template-columns: 1fr; }

  /* Insight strip: stack */
  .insight-strip { grid-template-columns: 1fr; gap: 14px; }

  /* Habit list: 1 col, bigger touch target */
  .habit-list { grid-template-columns: 1fr; gap: 10px; }
  .habit-item {
    min-height: 72px;
    padding: 14px 16px;
  }
  .habit-item:hover { transform: none; box-shadow: var(--inset-hi); }

  /* Duration control: full width */
  .control-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }
  .segment { min-width: 0; }

  /* Intent card: stack */
  .intent-card { grid-template-columns: 1fr; gap: 16px; }
  .intent-grid  { grid-template-columns: 1fr; }

  /* Day grid: 1 col on mobile */
  .day-grid { grid-template-columns: 1fr; }
  .day-card:hover { transform: none; }

  /* Tracker: keep horizontal scroll */
  .tracker-wrap { border-radius: var(--radius-xs); }

  /* Reflection: 1 col */
  .reflection-grid { grid-template-columns: 1fr; margin-top: 16px; }

  /* Method card: stack */
  .method-card { grid-template-columns: 1fr; }
  .method-card img { width: 100%; height: 140px; }

  /* Research: tighter */
  .research-list article { padding: 14px; }

  /* Statistikk: mobile layout */
  .stat-chips { grid-template-columns: repeat(3,1fr); gap: 8px; }
  .stat-chip { padding: 14px 8px; }
  .stat-chip-value { font-size: 22px; }
  .day-bars { height: 100px; gap: 5px; }
  .day-bar-pct { font-size: 10px; }
  .day-bar-label { font-size: 9px; }

  /* Toast: bottom-safe */
  .toast {
    right: 16px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    max-width: none;
  }

  /* Footer: hide on mobile (nav bar takes that space) */
  .site-footer { display: none; }
}
