/* Verdano app — mockup stylesheet.
   Colour tokens are copied from the marketing site's styles.css (not linked),
   so the app and the site can change independently.
   Components use var(--token) only; no hard-coded colours below :root. */

:root {
  --cream: #F6F1E7;
  --cream-2: #FBF8F2;
  --ink: #22301F;
  --forest: #2E4632;
  --moss: #5C7A4E;
  --sage: #A8BC96;
  --sage-light: #E4EADC;
  --stone: #CDBFA0;
  /* Accessible variants: moss-text for small text (4.5:1 on cream),
     stone-deep for field borders and control outlines (3:1) */
  --moss-text: #52703F;
  --stone-deep: #8F8062;

  --radius: 16px;
  --col: 460px;
  --ease: cubic-bezier(.3, .7, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Karla', sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: 'Fraunces', serif;
  color: var(--forest);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 0.4em;
}
h1 { font-size: 1.9rem; font-weight: 600; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

a { color: var(--moss-text); }
a:hover { color: var(--forest); }

:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 20;
  background: var(--forest); color: var(--cream-2);
  padding: 10px 18px; border-radius: 999px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* ---------- App shell ---------- */

.screen {
  max-width: var(--col);
  margin: 0 auto;
  padding: 20px 20px 48px;
  padding-top: max(20px, env(safe-area-inset-top));
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; margin-bottom: 16px;
}
.topbar .mark { display: flex; align-items: center; gap: 8px; color: var(--forest);
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.15rem; text-decoration: none; }
.topbar .mark svg { width: 28px; height: 28px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: transparent; border: none; color: var(--forest);
  cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--sage-light); }
.icon-btn svg { width: 24px; height: 24px; }

.back {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding-right: 8px;
  color: var(--forest); text-decoration: none; font-weight: 600;
}
.back svg { width: 22px; height: 22px; }

.eyebrow {
  display: block;
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.78rem; font-weight: 700;
  color: var(--moss-text);
  margin: 0 0 6px;
}

.muted { color: var(--moss-text); font-size: 0.92rem; }

.section { margin-top: 32px; }
.section > h2 { margin-bottom: 12px; }

hr.rule { border: none; border-top: 1px solid var(--stone); margin: 28px 0; }

/* ---------- Buttons & fields ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 24px;
  font-family: 'Karla', sans-serif; font-weight: 700; font-size: 1rem;
  border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none;
}
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--forest); color: var(--cream-2); }
.btn-primary:hover { background: var(--ink); color: var(--cream-2); }
.btn-secondary { background: transparent; color: var(--forest); border-color: var(--forest); }
.btn-secondary:hover { background: var(--sage-light); color: var(--forest); }
.btn-quiet { background: transparent; color: var(--forest); padding: 12px 14px; }
.btn-quiet:hover { background: var(--sage-light); }
.btn-block { width: 100%; }

.link-btn {
  background: none; border: none; padding: 10px 6px; min-height: 44px;
  font: inherit; font-size: 0.92rem; font-weight: 600;
  color: var(--forest); text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

label, .label { display: block; font-weight: 700; font-size: 0.92rem; color: var(--forest); margin-bottom: 6px; }
.hint { display: block; font-size: 0.85rem; color: var(--moss-text); margin: -2px 0 8px; }

input[type=text], input[type=email], input[type=number], textarea, select {
  width: 100%;
  font: inherit; font-size: 1rem;
  padding: 12px 14px;
  border: 1.5px solid var(--stone-deep);
  border-radius: 12px;
  background: var(--cream-2);
  color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
.field { margin-bottom: 22px; }

fieldset { border: none; padding: 0; margin: 0 0 22px; }
legend { padding: 0; font-weight: 700; font-size: 0.92rem; color: var(--forest); margin-bottom: 8px; }

/* Segmented choice (radio buttons styled as pills) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding: 8px 16px;
  border: 1.5px solid var(--stone-deep); border-radius: 999px;
  background: var(--cream-2); color: var(--ink);
  font-weight: 600; font-size: 0.95rem;
}
.choice input:checked + span { background: var(--forest); border-color: var(--forest); color: var(--cream-2); }
.choice input:focus-visible + span { outline: 2px solid var(--forest); outline-offset: 3px; }
.choice.round span { padding: 8px 0; width: 44px; }

/* Icon picker */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.icon-grid .choice span { width: 100%; height: 52px; border-radius: 14px; padding: 0; }
.icon-grid svg { width: 24px; height: 24px; }

.card {
  background: var(--cream-2);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  padding: 20px;
}

.badge {
  display: inline-block;
  background: var(--sage-light); color: var(--forest);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 4px 12px; border-radius: 999px;
}

/* ---------- Today: habit tiles ---------- */

.today-head h1 { margin-bottom: 4px; }
.today-summary { color: var(--moss-text); font-weight: 600; margin: 0; min-height: 1.6em; }

.tiles {
  list-style: none; margin: 28px 0 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 12px;
}
@media (max-width: 340px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

.tile { display: flex; flex-direction: column; align-items: center; text-align: center; }

.ring-btn {
  position: relative;
  width: 96px; height: 96px;
  padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--forest);
  cursor: pointer;
  transition: transform .18s var(--ease);
}
.ring-btn:active { transform: scale(0.94); }
.ring-btn svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: var(--cream-2); stroke: var(--stone-deep); stroke-width: 1.5; }
.ring .progress {
  fill: none; stroke: var(--moss); stroke-width: 7; stroke-linecap: round;
  transition: stroke-dashoffset .6s var(--ease);
}
.ring .fill {
  fill: var(--forest);
  transform-origin: 50px 50px; transform: scale(0);
  transition: transform .45s var(--ease);
}
.ring-btn .glyph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: color .3s ease;
}
.ring-btn .glyph svg { width: 34px; height: 34px; }

.ring-btn.is-done .ring .fill { transform: scale(1); }
.ring-btn.is-done .glyph { color: var(--cream-2); }
.ring-btn.is-done .ring .progress { stroke: var(--forest); }
.ring-btn.pop { animation: pop .5s var(--ease); }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.tile-name {
  margin-top: 10px;
  font-weight: 700; font-size: 0.95rem; line-height: 1.25;
  color: var(--forest); text-decoration: none;
}
.tile-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.tile-meta { font-size: 0.82rem; color: var(--moss-text); margin-top: 2px; }

.minus-btn {
  margin-top: 2px;
  min-height: 32px; min-width: 44px; padding: 2px 10px;
  border: 1.5px solid var(--stone-deep); border-radius: 999px;
  background: var(--cream-2); color: var(--forest);
  font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer;
}
.minus-btn[hidden] { display: none; }

.closing {
  margin-top: 40px; text-align: center;
  font-family: 'Fraunces', serif; font-style: italic; font-size: 1.1rem;
  color: var(--forest);
}
.closing:empty { display: none; }

.later { margin-top: 36px; }
.later h2 { font-family: 'Karla', sans-serif; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--moss-text); font-weight: 700; }
.later ul { list-style: none; padding: 0; margin: 0; }
.later li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--sage-light); }
.later li svg { width: 22px; height: 22px; color: var(--moss-text); flex: none; }
.later a { color: var(--forest); font-weight: 600; text-decoration: none; }
.later a:hover { text-decoration: underline; }
.later .when { margin-left: auto; font-size: 0.85rem; color: var(--moss-text); }

/* Toast (undo) */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px;
  background: var(--forest); color: var(--cream-2);
  padding: 8px 8px 8px 18px; border-radius: 999px;
  font-weight: 600; font-size: 0.92rem;
  white-space: nowrap; max-width: calc(100vw - 32px);
  transition: opacity .25s ease, transform .25s var(--ease);
}
.toast span { overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button {
  background: var(--cream-2); color: var(--forest);
  border: none; border-radius: 999px; min-height: 36px; padding: 6px 14px;
  font: inherit; font-weight: 700; cursor: pointer;
}

/* ---------- Habit detail ---------- */

.habit-hero { display: flex; align-items: center; gap: 16px; margin: 8px 0 16px; }
.habit-hero .disc {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  background: var(--sage-light); color: var(--forest);
  display: flex; align-items: center; justify-content: center;
}
.habit-hero .disc svg { width: 30px; height: 30px; }
.habit-hero h1 { margin: 0; font-size: 1.7rem; }

.coach-note {
  font-family: 'Fraunces', serif; font-style: italic; font-size: 1.1rem;
  color: var(--forest);
  border-left: 3px solid var(--sage);
  padding: 2px 0 2px 16px; margin: 20px 0 0;
}
.coach-note cite { display: block; font-family: 'Karla', sans-serif; font-style: normal; font-size: 0.85rem; font-weight: 700; color: var(--moss-text); margin-top: 6px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 24px; }
.stat { background: var(--cream-2); border: 1px solid var(--stone); border-radius: 14px; padding: 14px 12px; }
.stat .num { font-family: 'Fraunces', serif; font-size: 1.8rem; font-weight: 600; color: var(--forest); line-height: 1.1; }
.stat .lbl { font-size: 0.8rem; color: var(--moss-text); font-weight: 600; margin-top: 4px; }

/* Calendar */
.cal { width: 100%; border-collapse: separate; border-spacing: 6px; margin: 0 -6px; table-layout: fixed; }
.cal th { font-size: 0.75rem; font-weight: 700; color: var(--moss-text); text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: 2px; }
.cal td { padding: 0; }
.day {
  aspect-ratio: 1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 600;
}
.day.done { background: var(--forest); color: var(--cream-2); }
.day.part { background: var(--sage); color: var(--ink); }
.day.miss { border: 1.5px solid var(--stone-deep); color: var(--ink); }
.day.off { color: var(--moss-text); }
.day.paused { background: repeating-linear-gradient(45deg, var(--sage) 0 2px, transparent 2px 5px); color: var(--ink); }
.day.future { color: var(--stone-deep); }
.day.today { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--moss); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 0.82rem; color: var(--moss-text); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.legend .l-done { background: var(--forest); }
.legend .l-part { background: var(--sage); }
.legend .l-miss { border: 1.5px solid var(--stone-deep); }
.legend .l-off { width: 10px; height: 2px; border-radius: 1px; background: var(--stone-deep); }
.legend .l-paused { background: repeating-linear-gradient(45deg, var(--sage) 0 2px, transparent 2px 4px); border: 1px solid var(--stone-deep); }

/* ---------- Coach ---------- */

.client-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.client-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 16px 16px 18px;
  background: var(--cream-2); border: 1px solid var(--stone); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.client-card:hover { border-color: var(--stone-deep); color: var(--ink); }
.client-card .who { flex: 1; min-width: 0; }
.client-card .name { font-family: 'Fraunces', serif; font-size: 1.15rem; font-weight: 500; color: var(--forest); }
.client-card .sub { font-size: 0.85rem; color: var(--moss-text); }
.client-card .chev { width: 20px; height: 20px; color: var(--moss-text); flex: none; }

.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--sage-light); color: var(--forest);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.05rem;
}

/* 7-day dot strip */
.week-dots { display: flex; gap: 4px; margin-top: 8px; }
.week-dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--stone-deep); }
.week-dots i.full { background: var(--forest); border-color: var(--forest); }
.week-dots i.half { background: var(--sage); border-color: var(--moss); }
.week-dots i.none { border: none; height: 2px; margin-top: 4px; background: var(--stone-deep); border-radius: 1px; }

/* Week matrix on client detail */
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { padding: 8px 0; text-align: center; }
.matrix thead th { font-size: 0.72rem; font-weight: 700; color: var(--moss-text); text-transform: uppercase; letter-spacing: 0.05em; }
.matrix tbody th { text-align: left; font-weight: 600; font-size: 0.9rem; color: var(--forest); padding-right: 8px; }
.matrix tbody tr + tr { border-top: 1px solid var(--sage-light); }
.m { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; }
.m.done { background: var(--forest); }
.m.part { background: var(--sage); }
.m.miss { border: 1.5px solid var(--stone-deep); }
.m.off { width: 8px; height: 2px; border-radius: 1px; background: var(--stone); }

.habit-rows { list-style: none; margin: 0; padding: 0; }
.habit-row { display: flex; align-items: flex-start; gap: 14px; padding: 16px 0; border-top: 1px solid var(--sage-light); }
.habit-row:first-child { border-top: none; }
.habit-row .disc {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--sage-light); color: var(--forest);
  display: flex; align-items: center; justify-content: center;
}
.habit-row .disc svg { width: 22px; height: 22px; }
.habit-row .info { flex: 1; min-width: 0; }
.habit-row .title { font-weight: 700; color: var(--forest); }
.habit-row .sched { font-size: 0.85rem; color: var(--moss-text); }
.habit-row .actions { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 2px 0 -8px -6px; }
.habit-row.is-paused .disc { background: transparent; border: 1.5px dashed var(--stone-deep); }
.habit-row.is-paused .title::after { content: " · paused"; font-weight: 600; color: var(--moss-text); font-size: 0.85rem; }

.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-head h2 { margin: 0; }

/* Dialog */
dialog {
  border: none; border-radius: 20px; padding: 24px;
  width: min(420px, calc(100vw - 32px));
  background: var(--cream-2); color: var(--ink);
}
dialog::backdrop { background: rgba(34, 48, 31, 0.45); }
dialog h2 { margin-bottom: 8px; }
.dialog-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }

/* Sign-in */
.signin { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.signin .leaf { width: 64px; height: 64px; margin-bottom: 20px; }
.code-input { letter-spacing: 0.5em; font-size: 1.4rem !important; text-align: center; font-weight: 700; }

/* Mockup-only banner */
.mock-note {
  margin: 36px 0 0; padding: 12px 14px;
  border: 1px dashed var(--stone-deep); border-radius: 12px;
  font-size: 0.85rem; color: var(--moss-text);
}
.mock-note a { font-weight: 700; }

/* Settings list */
.settings-list { list-style: none; padding: 0; margin: 0; }
.settings-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--sage-light); }
.settings-list li:first-child { border-top: none; }
.settings-list .k { font-weight: 700; color: var(--forest); }
.settings-list .v { color: var(--moss-text); font-size: 0.95rem; text-align: right; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Real app additions ---------- */
.form-error { color: var(--forest); background: var(--sage-light); border-left: 3px solid var(--forest);
  padding: 10px 14px; border-radius: 8px; font-size: 0.92rem; margin: 0 0 16px; }
.form-error:empty { display: none; }
.loading { color: var(--moss-text); padding: 40px 0; text-align: center; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* Archived habits (coach client detail) */
details.archived { margin-top: 20px; border-top: 1px solid var(--stone); padding-top: 8px; }
details.archived summary { cursor: pointer; min-height: 44px; display: flex; align-items: center;
  font-weight: 700; color: var(--forest); }
details.archived .habit-row .disc { background: transparent; border: 1.5px solid var(--stone); }
.soft-note { background: var(--sage-light); border-radius: 12px; padding: 12px 14px; font-size: 0.92rem; color: var(--forest); margin: 0 0 20px; }

/* Today: choose which day you're checking off (today, yesterday, day before) */
.day-picker { margin: 18px 0 0; }
.day-picker .choice span { min-height: 40px; padding: 6px 14px; font-size: 0.9rem; }
.ring-btn[disabled] { cursor: progress; }
.empty-today { margin-top: 32px; text-align: center; }
.empty-today .leafmark { width: 56px; height: 56px; margin: 0 auto 16px; opacity: .9; }
