:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #edf5f2;
  --ink: #1c2522;
  --muted: #69736f;
  --line: #d8ded9;
  --green: #2e7d65;
  --green-dark: #1f5d4b;
  --blue: #356c9b;
  --amber: #ad6a28;
  --red: #b23b3b;
  --shadow: 0 16px 42px rgba(35, 48, 42, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(227, 238, 234, 0.86), rgba(246, 244, 239, 0.92)),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

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

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  max-width: 680px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 1.1rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 22px;
  min-height: 330px;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 20%, rgba(46, 125, 101, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(236, 245, 240, 0.94));
  box-shadow: var(--shadow);
}

.setup-screen {
  display: none;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.7fr);
  gap: 22px;
  align-items: start;
  min-height: 70vh;
  padding: clamp(22px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 12%, rgba(53, 108, 155, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(237, 245, 242, 0.94));
  box-shadow: var(--shadow);
}

.setup-screen.is-active {
  display: grid;
}

.app-shell.needs-setup main,
.app-shell.needs-setup footer {
  display: none;
}

.setup-intro {
  align-self: center;
}

.setup-intro p:last-child {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.setup-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.setup-progress {
  display: grid;
  gap: 10px;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.setup-dots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.setup-dots span {
  height: 7px;
  border-radius: 999px;
  background: #dce5df;
}

.setup-dots span.is-active {
  background: var(--green);
}

.setup-step {
  display: none;
  gap: 14px;
}

.setup-step.is-active {
  display: grid;
}

.setup-step h3 {
  font-size: 1.5rem;
}

.setup-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--green-dark);
  font-weight: 800;
}

.choice-chip:hover,
.choice-chip:focus-visible {
  border-color: var(--green);
  background: #e0f0ea;
}

.hero-copy {
  align-self: end;
}

.hero-copy p:last-child {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-stats {
  display: grid;
  align-content: end;
  gap: 12px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.large-action {
  min-height: 52px;
  padding-inline: 22px;
  font-size: 1.05rem;
}

.hero-stats div,
.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.hero-stats div {
  padding: 18px;
}

.hero-stats .wide-stat {
  background: var(--green);
  color: white;
}

.hero-stats span,
.metric-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
}

.hero-stats small,
.metric-card small {
  color: var(--muted);
}

.hero-stats .wide-stat small {
  color: rgba(255, 255, 255, 0.82);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 800;
}

.tab.is-active {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.metric-card {
  padding: 20px;
}

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

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.2rem;
}

.primary-button,
.secondary-button,
.warning-button,
.danger-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  background: var(--green);
  color: white;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.warning-button {
  background: var(--amber);
  color: white;
}

.danger-button {
  background: var(--red);
  color: white;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.progress-list {
  display: grid;
  gap: 16px;
}

.progress-item {
  display: grid;
  gap: 7px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-top strong {
  color: var(--ink);
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e9e5;
}

.bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 240ms ease;
}

.bar.is-blue span {
  background: var(--blue);
}

.bar.is-amber span {
  background: var(--amber);
}

.bar.is-red span {
  background: var(--red);
}

.urge-box,
.breathing-tool,
.privacy-actions {
  display: grid;
  gap: 16px;
}

.timer {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 8px;
  background: var(--surface-soft);
  text-align: center;
}

.timer span {
  font-size: 2.4rem;
  font-weight: 900;
}

.metric-card {
  display: grid;
  gap: 8px;
}

.metric-label {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stacked-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

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

.range-value {
  color: var(--ink);
  font-weight: 900;
}

.breathing-tool {
  justify-items: center;
}

.breath-circle {
  display: grid;
  width: min(240px, 72vw);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(46, 125, 101, 0.28);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--green-dark);
  font-weight: 900;
  transition:
    transform 1200ms ease-in-out,
    background 1200ms ease-in-out;
}

.breath-circle.is-expanded {
  transform: scale(1.12);
  background: #e0f0ea;
}

blockquote {
  margin: 14px 0 0;
  padding: 16px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
}

.history-list {
  display: grid;
  gap: 10px;
}

.plan-list,
.supporter-list,
.insight-list,
.milestone-list {
  display: grid;
  gap: 10px;
}

.plan-step,
.supporter-item,
.insight-item,
.milestone-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(237, 245, 242, 0.62);
  color: var(--muted);
}

.plan-step strong,
.supporter-item strong,
.insight-item strong,
.milestone-item strong {
  display: block;
  margin-bottom: 4px;
}

.supporter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.supporter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(90px, 0.22fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-item time {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.history-item p {
  margin-bottom: 0;
}

.taper-output {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.taper-step {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.settings-drawer {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: flex-end;
  padding: 18px;
  background: rgba(20, 28, 25, 0.28);
  z-index: 10;
}

.settings-drawer.is-open {
  display: flex;
}

.drawer-card {
  width: min(380px, 100%);
  height: fit-content;
  padding: 20px;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

footer {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .setup-screen,
  .hero-panel,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .history-item,
  .form-row,
  .setup-actions {
    grid-template-columns: 1fr;
  }

  .setup-actions {
    display: grid;
  }
}

@media (max-width: 460px) {
  .topbar {
    align-items: flex-start;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel,
  .metric-card {
    padding: 16px;
  }

  h2 {
    font-size: 2rem;
  }
}
