/* Figtree, a variable font (400 to 700), self-hosted. See fonts/LICENSE.txt. */
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/figtree.woff2') format('woff2');
}
/* Butterfly. Tokens are from the Design Spec "Global look"; the dark set is in the Design Spec
   section "Dark colour set" (PRD Decision #23). Order matters: light on :root, then dark when the
   phone is dark (unless she chose Light), then dark when she chose Dark. No data-theme = Match iPhone. */
:root {
  --bg: #F3F5F7;
  --card: #FFFFFF;
  --ink: #1F2A37;
  --ink-soft: #3D4855;
  --muted: #5B6675;
  --line: #E3E7EC;
  --field: #D5DBE2;
  --teal: #2F6F73;
  --teal-hover: #235457;
  --teal-tint: #DCEDEE;
  --lilac: #4B3D86;
  --lilac-tint: #EDE9F7;
  --lilac-page: #F5F3FA;
  --danger: #9B2C1F;
  --danger-line: #E6C3BE;
  /* Added so the dark set has something to flip. Light values are what the CSS used before. */
  --info: #2F5FA8;
  --info-bg: #E6EEF7;
  --chip-bg: #EEF1F4;
  --on-fill: #FFFFFF;
  /* Mood colours, same values the charts and check-in swatches hardcode in JS. */
  --low-1: #A9BFE0;
  --low-2: #5B82C0;
  --low-3: #2F5FA8;
  --steady: #D9DEE4;
  --high-1: #F2C79A;
  --high-2: #DE8A3C;
  --high-3: #B45309;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

/* Phone is dark and she has not chosen Light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1E2430;
    --card: #272F3D;
    --ink: #EEF1F6;
    --ink-soft: #D5DCE6;
    --muted: #AEB8C7;
    --line: #353E4E;
    --field: #7D8AA0;
    --teal: #9ED8D6;
    --teal-hover: #B8E6E4;
    --teal-tint: #24413F;
    --lilac: #CFC4F7;
    --lilac-tint: #34305A;
    --lilac-page: #242036;
    --danger: #FFB3A7;
    --danger-line: #7A3A33;
    --info: #B5D1F5;
    --info-bg: #22334D;
    --chip-bg: #323B4A;
    /* Fills (teal, lilac, ink) turn light in dark, so the text on them turns dark. */
    --on-fill: #1B2230;
    /* Mood: same lightness order as light, darkest to lightest: low-3, high-3, low-2, high-2, low-1, high-1, steady. */
    --low-1: #B5CCEE;
    --low-2: #8FB0E3;
    --low-3: #6A8FD3;
    --steady: #E4E9F0;
    --high-1: #F6D5B0;
    --high-2: #EFAE72;
    --high-3: #E0894A;
    color-scheme: dark;
  }
}
/* She chose Dark. Keep identical to the block above. */
:root[data-theme="dark"] {
  --bg: #1E2430;
  --card: #272F3D;
  --ink: #EEF1F6;
  --ink-soft: #D5DCE6;
  --muted: #AEB8C7;
  --line: #353E4E;
  --field: #7D8AA0;
  --teal: #9ED8D6;
  --teal-hover: #B8E6E4;
  --teal-tint: #24413F;
  --lilac: #CFC4F7;
  --lilac-tint: #34305A;
  --lilac-page: #242036;
  --danger: #FFB3A7;
  --danger-line: #7A3A33;
  --info: #B5D1F5;
  --info-bg: #22334D;
  --chip-bg: #323B4A;
  /* Fills (teal, lilac, ink) turn light in dark, so the text on them turns dark. */
  --on-fill: #1B2230;
  /* Mood: same lightness order as light, darkest to lightest: low-3, high-3, low-2, high-2, low-1, high-1, steady. */
  --low-1: #B5CCEE;
  --low-2: #8FB0E3;
  --low-3: #6A8FD3;
  --steady: #E4E9F0;
  --high-1: #F6D5B0;
  --high-2: #EFAE72;
  --high-3: #E0894A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
/* App-like touch: no double-tap zoom, and no bounce past the edges. */
html, body { touch-action: manipulation; overscroll-behavior: none; -webkit-touch-callout: none; }
/* body states its own background and colour so nothing flips unexpectedly. */
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
p { margin: 0 0 10px; }
a { color: var(--teal); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.screen { padding: 22px 16px 16px; max-width: 560px; margin: 0 auto; }
.screen.narrow { padding-top: 48px; }
.lilac-page { background: var(--lilac-page); min-height: 100vh; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row > label, .row > div { flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.head-actions { display: flex; gap: 8px; align-items: center; }

label { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; color: var(--ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="time"], input[type="tel"], input[type="text"], textarea, input[inputmode] {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--field); border-radius: 12px; padding: 12px 14px; min-height: 46px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

button { font: inherit; cursor: pointer; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--field); background: var(--card); color: var(--ink);
  font-weight: 600; text-decoration: none;
}
.pill.teal { background: var(--teal); border-color: var(--teal); color: var(--on-fill); }
.pill.teal:hover { background: var(--teal-hover); }
.pill.lilac { background: var(--lilac); border-color: var(--lilac); color: var(--on-fill); }
.pill.lilac-tint { background: var(--lilac-tint); border-color: transparent; color: var(--lilac); }
.pill.white { background: var(--on-fill); border-color: var(--on-fill); color: var(--teal); }
.pill.wide { width: 100%; }
.pill:disabled { opacity: .45; }
.link { background: none; border: 0; padding: 8px 0; color: var(--teal); font-weight: 600; }
.link.light { color: var(--on-fill); opacity: .9; text-decoration: underline; }
.link.danger { color: var(--danger); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; background: var(--card); border: 1px solid var(--field);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.back { display: inline-block; margin-bottom: 8px; font-weight: 600; text-decoration: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.hero { background: var(--teal); color: var(--on-fill); border-radius: 22px; padding: 20px; margin-bottom: 14px; }
.hero-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.hero-sub { margin: 0 0 12px; opacity: .92; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.teal-card { background: var(--teal); color: var(--on-fill); }

.capture { display: block; text-align: center; background: var(--lilac); color: var(--on-fill); border-radius: 16px; padding: 16px; font-weight: 700; text-decoration: none; }

/* Mood swatches */
.mood-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.swatch { aspect-ratio: 1; border-radius: 999px; border: 0; background: var(--c); min-height: 40px; }
.swatch.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--ink); }
.scale-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Choice pills and segments */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-choice, .seg, .chip-btn {
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--field);
  background: var(--card); color: var(--ink); font-weight: 600;
}
.pill-choice.on, .seg.on, .chip-btn.on { background: var(--teal); border-color: var(--teal); color: var(--on-fill); }
.segs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.seg { padding: 0 6px; font-size: 13px; }
.chip-btn { min-height: 36px; font-size: 13px; padding: 0 12px; }
.chip { display: inline-block; font-size: 12px; background: var(--chip-bg); color: var(--muted); border-radius: 10px; padding: 2px 8px; }
.sticky { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); background: var(--bg); padding: 10px 0; }

/* Thoughts */
.capture-row { display: flex; gap: 8px; margin-bottom: 12px; }
.capture-row input { flex: 1; }
.add-btn { width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--lilac); color: var(--on-fill); font-size: 24px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--field); background: var(--card); font-weight: 600; font-size: 13px; }
.filter.on { background: var(--ink); border-color: var(--ink); color: var(--on-fill); }
.cards .thought { padding: 0; overflow: hidden; }
.card-open { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 16px; color: inherit; }
.thought-text { display: block; font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.faded .thought-text { color: var(--ink-soft); font-weight: 500; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.card-actions { border-top: 1px solid var(--line); padding: 12px 16px 16px; }
.card-actions p { margin: 10px 0 6px; }
.weight { letter-spacing: 1px; }

/* Lists and misc */
.row-link { display: flex; justify-content: space-between; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; text-decoration: none; color: var(--ink); font-weight: 600; }
.plan-text { white-space: pre-wrap; }

/* Locked cupboard */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 24px 0 8px; }
.dot { width: 14px; height: 14px; border-radius: 999px; border: 2px solid var(--lilac); }
.dot.on { background: var(--lilac); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 16px auto 0; }
.key { min-height: 64px; border-radius: 999px; border: 1px solid var(--field); background: var(--card); font-size: 24px; font-weight: 600; color: var(--ink); }
.key:disabled { opacity: .4; }
.secret { font: 22px ui-monospace, Menlo, monospace; background: var(--card); border-radius: 14px; padding: 16px; word-break: break-word; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding: 8px 0 calc(26px + env(safe-area-inset-bottom, 0px));
}
.tabbar a { flex: 1; text-align: center; min-height: 44px; line-height: 44px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; }
.tabbar a.on { color: var(--teal); font-weight: 700; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  max-width: 520px; margin: 0 auto; background: var(--ink); color: var(--on-fill); border-radius: 14px;
  padding: 12px 16px; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.toast-undo { background: none; border: 0; color: var(--on-fill); font-weight: 700; text-decoration: underline; min-height: 44px; }
[hidden] { display: none !important; }

/* Steady times and tasks (Design Spec §1, §4). */
.row.between { justify-content: space-between; }
.steady h2, .card h2 { font-size: 17px; margin: 0 0 8px; }
.steady-list, .task-list { list-style: none; margin: 0; padding: 0; }
.steady-row, .task-row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; border-top: 1px solid var(--line); }
.steady-row:first-child, .task-row:first-child { border-top: 0; }
.steady-time { font-weight: 600; min-width: 46px; }
.steady-label, .task-title { flex: 1; }
.steady-row.done .steady-label, .task-row.done .task-title { color: var(--muted); text-decoration: line-through; }
.steady-row.next .steady-label { font-weight: 700; color: var(--teal); }
.tick { width: 32px; height: 32px; min-width: 32px; border-radius: 50%; border: 2px solid var(--field); background: var(--card); color: var(--on-fill); font-weight: 700; padding: 0; }
.tick[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); }
.steady-row.next .tick { border-color: var(--teal); }
.banner { background: var(--info-bg); color: var(--info); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.banner p { margin: 4px 0; }
.banner-title { font-weight: 700; }
.banner .link { color: var(--info); }
.essentials { font-size: 15px; }
details.card summary { font-weight: 700; cursor: pointer; min-height: 44px; display: flex; align-items: center; }

/* Patterns and the summary (Design Spec §5). */
.segments { display: flex; gap: 8px; margin: 8px 0 12px; }
.segments .seg { flex: 1; text-align: center; min-height: 40px; line-height: 40px; border-radius: 12px; border: 1px solid var(--field); color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 14px; }
.segments .seg.on { background: var(--ink); border-color: var(--ink); color: var(--on-fill); }
.chart { display: block; width: 100%; height: auto; margin: 8px 0; }
.notes { padding-left: 18px; margin: 0 0 8px; }
.notes li { margin: 6px 0; }
@media print {
  .tabbar, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .screen { max-width: none; padding: 0; }
}

/* Layout from the concept mockup (2026-10-27). Colours and styling are the app's own. */
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabbar a svg { display: block; }
.capture { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; }
.tick { display: inline-flex; align-items: center; justify-content: center; }
.steady-time { margin-left: auto; min-width: 0; }
.segments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
