:root {
  color-scheme: light;
  --paper: #fbfaf6;
  --paper-strong: #fffefb;
  --ink: #1f2523;
  --muted: #6f7974;
  --hairline: rgba(31, 37, 35, 0.1);
  --glass: rgba(255, 255, 255, 0.68);
  --blue: #5d9cec;
  --blue-deep: #2f6fba;
  --gold: #d99b32;
  --gold-soft: #f2cf7f;
  --green: #6da67a;
  --rose: #c86f6a;
  --shadow: 0 24px 80px rgba(67, 74, 71, 0.14);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 12%, rgba(93, 156, 236, 0.18), transparent 28%),
    radial-gradient(circle at 85% 2%, rgba(217, 155, 50, 0.2), transparent 26%),
    linear-gradient(180deg, #fffdf8 0%, var(--paper) 45%, #f4f1ea 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar,
.hero-grid,
.timeline-section,
.workbench,
.year-panel {
  margin-bottom: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 18px 4px 8px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2.45rem, 6vw, 6.1rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 2rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
}

.month-switcher,
.segmented-control,
.soft-pill {
  border: 1px solid var(--hairline);
  background: var(--glass);
  box-shadow: 0 10px 32px rgba(67, 74, 71, 0.08);
  backdrop-filter: blur(20px);
}

.month-switcher {
  display: grid;
  grid-template-columns: 42px minmax(132px, auto) 42px;
  align-items: center;
  min-height: 48px;
  border-radius: 24px;
  overflow: hidden;
}

.month-switcher p {
  margin: 0;
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}

.icon-button,
.quiet-button,
.primary-button,
.entry-item button {
  border: 0;
  color: var(--ink);
}

.icon-button {
  height: 48px;
  background: transparent;
  font-size: 1.8rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 20px;
  align-items: stretch;
}

.flow-stage,
.balance-panel,
.timeline-section,
.journal-panel,
.reflection-panel,
.year-panel {
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.flow-stage {
  position: relative;
  min-height: 520px;
  border-radius: 8px;
  overflow: hidden;
}

#flowCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
}

.flow-copy {
  position: absolute;
  inset: auto 28px 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  color: rgba(31, 37, 35, 0.72);
}

.flow-copy strong {
  max-width: 420px;
  text-align: center;
  color: var(--ink);
  font-size: clamp(1.2rem, 2vw, 2.2rem);
  line-height: 1.05;
}

.flow-copy span:last-child {
  text-align: right;
}

.balance-panel,
.timeline-section,
.journal-panel,
.reflection-panel,
.year-panel {
  border-radius: 8px;
  padding: 24px;
}

.balance-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.balance-lines {
  display: grid;
  gap: 22px;
}

.balance-line > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.balance-line span {
  color: var(--muted);
}

.meter {
  height: 16px;
  border-radius: 999px;
  background: rgba(93, 156, 236, 0.16);
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--blue-deep));
  transition: width 500ms ease;
}

.meter.gold {
  background: rgba(217, 155, 50, 0.16);
}

.meter.gold span {
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
}

.insight {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

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

.quiet-button,
.primary-button {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 750;
}

.quiet-button {
  background: rgba(31, 37, 35, 0.06);
}

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

.timeline {
  display: grid;
  grid-template-columns: repeat(var(--days), minmax(32px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-node {
  min-width: 34px;
  min-height: 92px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(31, 37, 35, 0.045);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

.day-node.active {
  border-color: rgba(31, 37, 35, 0.28);
  background: var(--paper-strong);
}

.day-node.today {
  box-shadow: inset 0 0 0 2px rgba(109, 166, 122, 0.45);
}

.day-node strong {
  font-size: 0.84rem;
}

.day-dots {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.dot.gold {
  background: var(--gold);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, 0.84fr);
  gap: 20px;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 999px;
  padding: 4px;
}

.segmented-control button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.segmented-control button.active {
  background: var(--ink);
  color: white;
}

.entry-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) auto;
  gap: 12px;
  margin-bottom: 24px;
  align-items: end;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(47, 111, 186, 0.42);
  box-shadow: 0 0 0 4px rgba(93, 156, 236, 0.12);
}

.journal-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.entry-list,
.question-stack {
  display: grid;
  gap: 10px;
}

.entry-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 30px;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px;
}

.entry-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(93, 156, 236, 0.13);
}

.entry-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.entry-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.entry-item button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(31, 37, 35, 0.06);
  font-size: 1.15rem;
}

.empty-state {
  min-height: 66px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--hairline);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.reflection-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.summary-card,
.question-card {
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.58);
}

.summary-card {
  padding: 20px;
  font-size: 1.08rem;
  line-height: 1.5;
}

.question-card {
  padding: 16px;
  color: var(--ink);
  line-height: 1.42;
}

.year-view {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
}

.month-cell {
  min-height: 118px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  padding: 12px;
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.month-cell strong {
  font-size: 0.85rem;
}

.mini-bars {
  display: grid;
  gap: 5px;
}

.mini-bars span {
  display: block;
  height: 7px;
  width: 0;
  border-radius: 99px;
  background: var(--blue);
}

.mini-bars span:last-child {
  background: var(--gold);
}

.soft-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 980px) {
  .topbar,
  .hero-grid,
  .workbench {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .month-switcher {
    width: min(100%, 320px);
  }

  .year-view {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
  }

  h1 {
    font-size: clamp(2.35rem, 13vw, 4rem);
  }

  .flow-stage,
  #flowCanvas {
    min-height: 420px;
  }

  .flow-copy {
    inset: auto 16px 18px;
    grid-template-columns: 1fr;
    text-align: center;
  }

  .flow-copy span:last-child {
    text-align: center;
  }

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

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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