:root {
  --forest: #0b2f2a;
  --forest-2: #145246;
  --emerald: #1d7a63;
  --gold: #d7b86a;
  --gold-light: #f2e3b7;
  --red: #d71920;
  --red-dark: #a90f14;
  --paper: #f7f5ef;
  --white: #fff;
  --ink: #17312d;
  --muted: #657570;
  --line: #d9e1de;
  --empty: #edf1ef;
  --shadow: 0 18px 48px rgba(11,47,42,.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 0 0, rgba(215,184,106,.13), transparent 28rem), var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.brandbar { background: linear-gradient(118deg, #082923, #10493f 62%, #1a6d59); color: white; position: relative; overflow: hidden; }
.brandbar::after { content: ""; position: absolute; width: 34rem; height: 14rem; border-radius: 50%; right: -8rem; bottom: -12rem; background: rgba(255,255,255,.08); }
.brandbar__inner { width: min(1420px, calc(100% - 32px)); min-height: 84px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; position: relative; z-index: 1; }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand img { width: 44px; height: 44px; border-radius: 13px; object-fit: contain; }
.brand span { display: grid; gap: 3px; }
.brand strong { letter-spacing: .15em; font-size: .98rem; }
.brand small { color: #dcebe7; font-size: .78rem; }
.privacy-pill { font-size: .84rem; color: #eef6f3; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 9px 13px; background: rgba(255,255,255,.07); white-space: nowrap; }
.privacy-pill span { color: #72deb4; margin-right: 5px; }

.page-shell { width: min(1420px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0 58px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.eyebrow, .micro-label { margin: 0 0 7px; color: var(--emerald); font-size: .78rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.2rem, 5vw, 4.1rem); line-height: 1; letter-spacing: -.04em; margin: 0 0 12px; color: var(--forest); }
.lede { max-width: 780px; margin: 0; color: var(--muted); font-size: 1.03rem; line-height: 1.6; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.button { min-height: 47px; border-radius: 13px; padding: 12px 17px; border: 1px solid transparent; font-weight: 800; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(29,122,99,.25); outline-offset: 2px; }
.button--gold { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #2f2918; box-shadow: 0 9px 24px rgba(183,143,47,.18); }
.button--ghost { background: white; border-color: #cdd8d4; color: var(--forest); }

.dashboard { display: grid; grid-template-columns: minmax(250px, .72fr) minmax(520px, 1.55fr) minmax(250px, .72fr); gap: 18px; align-items: start; }
.panel { background: var(--white); border: 1px solid rgba(11,47,42,.1); border-radius: 22px; box-shadow: var(--shadow); }
.habits-panel, .notes-panel { padding: 24px; position: sticky; top: 18px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.panel h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.65rem; color: var(--forest); line-height: 1.15; margin: 0; }
.helper { color: var(--muted); line-height: 1.48; font-size: .84rem; margin: 12px 0 18px; }
.small-count { font-size: .75rem; font-weight: 850; color: var(--muted); background: #eef3f1; border-radius: 999px; padding: 6px 9px; white-space: nowrap; }
.habit-inputs { display: grid; gap: 10px; }
.habit-field { display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: center; gap: 9px; }
.habit-number { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--forest); color: var(--gold-light); font-weight: 900; font-size: .82rem; }
.habit-field.is-selected .habit-number { background: var(--gold); color: var(--forest); }
.habit-field input { width: 100%; min-height: 43px; border: 1px solid #d7dfdc; border-radius: 11px; padding: 9px 11px; color: var(--ink); background: #fbfcfb; }
.habit-field input::placeholder { color: #99a6a2; }

.tracker-panel { padding: 18px; min-width: 0; }
.tracker-topline { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 9px 14px; color: var(--muted); font-size: .79rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(11,47,42,.17); }
.swatch--done { background: var(--emerald); }.swatch--missed { background: var(--red); }.swatch--empty { background: var(--empty); }
.save-status { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.wheel-wrap { position: relative; width: min(100%, 720px); margin: 0 auto; aspect-ratio: 1; }
.habit-wheel { width: 100%; height: 100%; display: block; overflow: visible; }
.wheel-cell { stroke: #fff; stroke-width: 1.25; cursor: pointer; transition: opacity .12s ease, filter .12s ease; }
.wheel-cell:hover { filter: brightness(.92); }
.wheel-cell:focus { outline: none; filter: drop-shadow(0 0 5px rgba(215,184,106,.9)); }
.wheel-cell.state-empty { fill: var(--empty); }
.wheel-cell.state-done { fill: var(--emerald); }
.wheel-cell.state-missed { fill: var(--red); }
.wheel-cell.is-selected-ring { stroke: var(--gold); stroke-width: 2.4; }
.wheel-cell.is-disabled { fill: #f5f6f5; cursor: not-allowed; opacity: .5; }
.day-label { fill: #3b504b; font-size: 13px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.day-label.is-disabled { fill: #b9c0bd; }
.wheel-center-bg { fill: #fff; stroke: var(--forest); stroke-width: 3; }
.center-controls { position: absolute; left: 50%; top: 50%; width: 22%; min-width: 125px; transform: translate(-50%,-50%); text-align: center; display: grid; gap: 4px; place-items: center; }
.center-controls label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.center-controls select, .center-controls input { width: 100%; max-width: 145px; border: 0; border-bottom: 2px solid #cad4d0; background: transparent; color: var(--forest); text-align: center; padding: 5px 2px; font-weight: 800; font-size: clamp(.75rem, 1.7vw, 1rem); }
.center-controls input { appearance: textfield; }
.center-controls strong { color: var(--emerald); font-size: clamp(1.2rem, 3vw, 2rem); line-height: 1; margin-top: 5px; }
.center-controls span { color: var(--muted); font-size: clamp(.58rem, 1.2vw, .75rem); }

.mobile-editor { border-top: 1px solid #e2e8e5; padding: 18px 5px 2px; }
.mobile-editor__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.mobile-editor h3 { margin: 0; color: var(--forest); font-size: 1rem; }
.mobile-editor select { min-height: 40px; border: 1px solid #d3ddda; border-radius: 10px; background: white; color: var(--forest); padding: 7px 10px; max-width: 160px; }
.day-buttons { display: grid; grid-template-columns: repeat(16, minmax(28px, 1fr)); gap: 5px; }
.day-button { aspect-ratio: 1; min-width: 0; border-radius: 7px; border: 1px solid #d8e0dd; background: var(--empty); color: var(--forest); font-size: .73rem; font-weight: 850; padding: 0; }
.day-button.state-done { background: var(--emerald); border-color: var(--emerald); color: white; }
.day-button.state-missed { background: var(--red); border-color: var(--red-dark); color: white; }
.day-button:disabled { opacity: .35; cursor: not-allowed; }

.notes-panel textarea { width: 100%; height: 280px; margin: 18px 0; resize: vertical; border: 1px solid #d6dfdc; border-radius: 14px; padding: 14px; color: var(--ink); background: repeating-linear-gradient(to bottom, #fff 0, #fff 34px, #e3e8e6 35px); line-height: 35px; }
.monthly-summary { padding-top: 4px; }
.summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.summary-grid div { text-align: center; border-radius: 12px; background: #f3f6f5; padding: 12px 4px; }
.summary-grid strong { display: block; font-size: 1.35rem; color: var(--forest); }
.summary-grid span { color: var(--muted); font-size: .7rem; }
.consistency { margin-top: 18px; padding-top: 16px; border-top: 1px solid #e2e8e5; }
.consistency > div:first-child { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .82rem; }
.consistency strong { color: var(--emerald); font-size: 1rem; }
.progress-track { height: 8px; background: #e7ecea; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--gold), var(--emerald)); transition: width .2s ease; }

.reflection-card { margin-top: 20px; padding: 28px 32px; border-radius: 22px; background: linear-gradient(120deg, #092d27, #145c4e); color: white; display: grid; grid-template-columns: auto 1fr; gap: 25px; align-items: center; }
.reflection-mark { width: 78px; height: 78px; border: 2px solid var(--gold); border-radius: 50%; display: grid; place-items: center; color: var(--gold-light); font-family: Georgia, serif; font-size: 2.1rem; }
.reflection-card .micro-label { color: var(--gold-light); }
.reflection-card h2 { margin: 0 0 7px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 3vw, 2rem); }
.reflection-card p:last-child { color: #dcebe7; margin: 0; line-height: 1.55; }

footer { width: min(1420px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 36px; border-top: 1px solid #dbe2df; color: #76827e; font-size: .78rem; display: flex; justify-content: space-between; gap: 24px; }
footer p { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 10; transform: translate(-50%,20px); opacity: 0; pointer-events: none; background: var(--forest); color: white; padding: 12px 16px; border-radius: 12px; box-shadow: 0 13px 30px rgba(0,0,0,.2); transition: .2s ease; font-weight: 750; }
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1120px) {
  .dashboard { grid-template-columns: minmax(230px,.75fr) minmax(500px,1.5fr); }
  .notes-panel { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: minmax(260px,1fr) minmax(380px,2fr); gap: 0 24px; }
  .notes-panel textarea { grid-column: 2; grid-row: 1 / span 4; margin: 0; height: 260px; }
}
@media (max-width: 800px) {
  .intro { align-items: flex-start; flex-direction: column; }
  .toolbar { width: 100%; justify-content: flex-start; }
  .dashboard { grid-template-columns: 1fr; }
  .habits-panel, .notes-panel { position: static; }
  .tracker-panel { grid-row: 1; }
  .habits-panel { grid-row: 2; }
  .notes-panel { grid-row: 3; display: block; }
  .notes-panel textarea { margin: 18px 0; height: 220px; }
  .day-buttons { grid-template-columns: repeat(8, minmax(32px,1fr)); }
}
@media (max-width: 560px) {
  .brandbar__inner { min-height: 72px; }
  .brand small { display: none; }
  .privacy-pill { font-size: 0; padding: 9px 11px; }
  .privacy-pill span { font-size: .85rem; margin: 0; }
  .page-shell { width: min(100% - 20px,1420px); padding-top: 28px; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .button { padding: 10px; font-size: .84rem; }
  .tracker-panel { padding: 12px 6px 14px; border-radius: 17px; }
  .tracker-topline { align-items: flex-start; }
  .save-status { display: none; }
  .legend { gap: 6px 10px; font-size: .72rem; }
  .wheel-wrap { width: 100%; }
  .center-controls { min-width: 90px; gap: 1px; }
  .center-controls select, .center-controls input { font-size: .7rem; padding: 2px 0; }
  .mobile-editor { padding-inline: 6px; }
  .day-buttons { grid-template-columns: repeat(8, minmax(28px,1fr)); }
  .habit-inputs { gap: 8px; }
  .reflection-card { grid-template-columns: 1fr; padding: 25px; }
  .reflection-mark { width: 60px; height: 60px; }
  footer { flex-direction: column; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
