/* The same typefaces are available offline and on devices without these fonts. */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('assets/dm-sans.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Serif Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/dm-serif-display.woff2') format('woff2');
}

/* Shared foundation and secondary screens. Shell and dialogs extend these. */
:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --surface: #fffefa;
  --ink: #233b32;
  --muted: #52645b;
  --border: #d9dfd5;
  --green: #275441;
  --sage: #e8eee3;
  --terracotta: #955b42;
  --bg: var(--paper);
  --text: var(--ink);
  --accent: var(--green);
  --line: var(--border);
  --radius: 18px;
  --serif: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--green); text-underline-offset: 3px; overflow-wrap: anywhere; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #a56336; outline-offset: 4px; }
button, input, select, textarea { max-width: 100%; }
img, svg { max-width: 100%; }
svg.icon { width: 22px; height: 22px; flex: 0 0 auto; vertical-align: middle; }
svg.icon.small, .icon.small { width: 18px; height: 18px; }
h1, h2, h3, p { margin: 0; }
h1 { font: 400 clamp(36px, 4.5vw, 54px)/1.12 var(--serif); letter-spacing: -.035em; }
h2 { font: 400 27px/1.25 var(--serif); letter-spacing: -.02em; }
h3 { font-size: 17px; line-height: 1.4; font-weight: 600; }
p { overflow-wrap: anywhere; }
small, .small, .muted-note, .data-note { font-size: 14px; }
.muted, .small.muted { color: var(--muted); }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 12px 20px; background: var(--surface); border: 2px solid var(--green); }
.skip-link:focus { top: 12px; }
.button, .icon-btn, .text-btn, .close { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 10px 16px; font-size: 14px; line-height: 1.45; font-weight: 600; text-decoration: none; }
.button:hover, .icon-btn:hover, .close:hover { background: var(--sage); border-color: #a9b8a5; }
.button.primary { background: var(--green); border-color: var(--green); color: #fff; }
.button.primary:hover { background: #1c4232; }
.button.small { min-height: 44px; padding: 8px 12px; }
.button.danger, .danger { color: #9b392c; }
.text-btn { padding: 8px 4px; border-color: transparent; background: transparent; color: var(--green); }
.text-btn:hover { text-decoration: underline; text-underline-offset: 4px; }
.icon-btn, .close { width: 44px; flex: 0 0 44px; padding: 10px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 4px 0 30px; }
.page-heading p { color: var(--muted); max-width: 620px; margin-top: 12px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; flex-shrink: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 30px 0 18px; }
.section-title p { margin-top: 6px; color: var(--muted); font-size: 14px; }
.section-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; min-width: 0; }
.section-panel > h2 + p, .section-panel > p { color: var(--muted); margin-top: 8px; margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.two-col > div { min-width: 0; }
.two-col > div > section + section { margin-top: 22px; }
.wide-panel { margin-bottom: 24px; }
.empty { padding: 36px 20px; text-align: center; max-width: 650px; margin-inline: auto; }
.empty > .icon { width: 32px; height: 32px; color: var(--muted); margin-bottom: 12px; }
.empty h3 { font-size: 19px; }
.empty p { color: var(--muted); max-width: 480px; margin: 8px auto 0; }
.empty .button { margin-top: 20px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.tabs button { min-height: 44px; border: 1px solid var(--border); background: transparent; padding: 9px 14px; border-radius: 8px; font-size: 14px; }
.tabs button.active { color: var(--green); background: var(--sage); border-color: #aabca4; font-weight: 600; }
.tabs button span { margin-left: 5px; }
.pill, .value-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sage); color: var(--green); border-radius: 6px; padding: 4px 9px; font-size: 12px; line-height: 1.6; font-weight: 600; }
.pill.peach { background: #f3eae0; color: #794a32; }
.area-icon { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: var(--green); background: var(--sage); flex: 0 0 40px; }
.goal-grid, .area-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.goal-card, .area-card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 22px; }
.goal-card { display: flex; flex-direction: column; }
.goal-top, .goal-bottom, .progress-meta, .area-card-top, .area-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.goal-top { margin-bottom: 18px; flex-wrap: wrap; }
.area-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.goal-title { text-align: left; font: 400 25px/1.3 var(--serif); border: 0; background: none; padding: 3px 0 8px; min-height: 44px; overflow-wrap: anywhere; }
.goal-title:hover { text-decoration: underline; text-underline-offset: 4px; }
.goal-card > p { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.goal-card > p:empty { display: none; }
.progress-meta { font-size: 14px; margin-top: auto; margin-bottom: 9px; }
.progress-meta strong { white-space: nowrap; }
.progress-track { height: 8px; border-radius: 8px; background: #e5eadd; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: inherit; }
.goal-bottom { margin-top: 17px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.goal-bottom > span { display: inline-flex; align-items: center; gap: 6px; }
.area-card-top { justify-content: flex-start; margin-bottom: 14px; }
.area-card p { color: var(--muted); font-size: 14px; }
.area-card-bottom { margin-top: 20px; align-items: flex-end; flex-wrap: wrap; }
.area-score { font: 30px/1.2 var(--serif); }
.area-score small { font: 12px var(--sans); color: var(--muted); display: block; margin-top: 5px; }
.review-row { display: flex; align-items: center; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.review-row:last-of-type { border-bottom: 0; }
.review-title { flex: 1; min-width: 0; font-size: 15px; }
.review-title p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.score-badge { font-size: 20px; white-space: nowrap; }
.score-badge small { font-size: 12px; color: var(--muted); }
.delta { font-size: 14px; }
.muted-note, .data-note { color: var(--muted); margin-top: 18px; }
.muted-note { padding: 14px 16px; background: var(--sage); border-radius: 9px; }
.data-note { font-size: 12px; line-height: 1.6; }
.insight-strip { display: flex; gap: 14px; align-items: flex-start; margin-top: 26px; padding: 20px; background: var(--sage); border-radius: 12px; font-size: 14px; }
.insight-strip > .icon { flex-shrink: 0; }
.assessment-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.radar { display: block; width: 100%; max-width: 360px; height: auto; }
.assessment-summary > div { padding: 10px 0; }
.stat-number { font: 400 36px/1.2 var(--serif); }
.stat-number small { font: 14px var(--sans); color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; margin-bottom: 24px; }
.stat { display: flex; align-items: center; gap: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.stat-icon { color: var(--green); }
.stat-label { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.history-chart { width: 100%; height: auto; display: block; margin-top: 20px; }
.history-values { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.timeline-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.week-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 8px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 12px 4px; min-height: 104px; font-size: 14px; }
.week-day strong { font-size: 22px; font-weight: 500; }
.week-day.today { background: var(--sage); border-color: #aabca4; }
.week-dot { min-width: 22px; border-radius: 20px; font-size: 12px; color: var(--muted); }
.week-dot.filled { background: var(--green); color: #fff; }
.practice-row, .practice-full { display: flex; align-items: center; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.practice-row:last-child, .practice-full:last-child { border-bottom: 0; }
.check { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid #9cac9d; background: var(--surface); border-radius: 50%; padding: 10px; }
.check.checked { background: var(--green); border-color: var(--green); color: #fff; }
.practice-info { flex: 1; min-width: 0; }
.practice-info h3 { overflow-wrap: anywhere; }
.practice-info p { color: var(--muted); font-size: 14px; margin-top: 4px; white-space: pre-line; }
.mini-area { display: flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 12px; color: var(--muted) !important; }
.time-tag { color: var(--muted); font-size: 12px; white-space: nowrap; }
.north-star { background: #eaf0e6; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 24px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 12px; }
blockquote { margin: 0; font: 400 28px/1.4 var(--serif); overflow-wrap: anywhere; }
.journal-list { display: grid; gap: 20px; }
.journal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.journal-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.mood { font-size: 12px; color: var(--muted); }
.journal-body { white-space: pre-wrap; font-size: 17px; line-height: 1.75; }
.journal-body:empty { display: none; }
.journal-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 26px; margin-top: 22px; }
.journal-details > div { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.journal-details strong { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.about-data { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.source-card { display: flex; gap: 15px; margin: 24px 0; }
.source-card > div { min-width: 0; }
.source-number { color: var(--muted); font: 22px var(--serif); }
.source-card h3 { margin-bottom: 7px; }
.source-card p { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.source-card a { font-size: 14px; display: inline-flex; align-items: center; min-height: 44px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
th, td { padding: 14px 12px; vertical-align: top; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { padding-left: 0; }
tr:last-child td { border-bottom: 0; }
.field { margin: 20px 0; }
.field label, .field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.field small { display: block; font-size: 14px; color: var(--muted); margin: 7px 0; }
input, select, textarea { width: 100%; border: 1px solid #aebbae; background: #fffefa; color: var(--ink); border-radius: 8px; min-height: 46px; padding: 10px 12px; }
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #66756c; opacity: 1; }
.field-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; min-height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14px; }
.chip.selected { background: var(--sage); border-color: #94a58d; color: var(--green); }
.chip .icon { width: 16px; height: 16px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 26px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%,20px); max-width: min(90vw,520px); border-radius: 10px; padding: 14px 20px; background: var(--ink); color: white; box-shadow: 0 8px 30px #233b3226; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 1000; font-size: 14px; }
#toast.show { opacity: 1; transform: translate(-50%,0); }
@media (max-width: 1100px) {
  .goal-grid, .area-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .stats { gap: 12px; }
  .stat { padding: 18px; }
  .stat-icon { display: none; }
}
@media (max-width: 640px) {
  .page-heading { flex-direction: column; gap: 14px; margin-bottom: 24px; }
  .heading-actions { padding: 0; width: 100%; }
  .heading-actions .button { width: 100%; }
  h1 { font-size: 38px; }
  h2 { font-size: 25px; }
  .section-panel, .goal-card, .area-card, .journal-card, .north-star { padding: 20px; border-radius: 14px; }
  .goal-grid, .area-grid, .stats, .journal-details { grid-template-columns: 1fr; }
  .stats { gap: 10px; }
  .stat { padding: 16px 20px; }
  .stat-icon { display: block; }
  .stat-number { font-size: 30px; }
  .timeline-title { align-items: flex-start; flex-wrap: wrap; }
  .week-grid { gap: 0; margin-inline: -12px; }
  .week-day { font-size: 12px; padding: 10px 0; }
  .week-day strong { font-size: 20px; }
  .practice-full { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 10px; align-items: start; }
  .practice-full .time-tag { grid-column: 2; margin-top: -5px; }
  .practice-full .icon-btn { grid-column: 3; grid-row: 1; }
  .practice-row { gap: 10px; flex-wrap: wrap; }
  .practice-row .time-tag { margin-left: 54px; }
  .practice-row .practice-info { flex-basis: calc(100% - 54px); }
  .tabs { gap: 6px; }
  .tabs button { padding: 8px 11px; }
  blockquote { font-size: 25px; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .responsive-table tr { padding: 14px 0; border-bottom: 1px solid var(--border); }
  .responsive-table tr:last-child { border-bottom: 0; }
  .responsive-table td { border: 0; padding: 5px 0; }
  .responsive-table td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  #toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Compact week selection keeps the selected checklist within easy reach. */
.practice-week { padding-block: 16px; margin-bottom: 18px; }
.practice-week .timeline-title { margin-bottom: 6px; }
.practice-week h2 { font: 600 14px/1.4 var(--sans); letter-spacing: 0; }
.practice-week .week-day { min-height: 80px; padding: 6px 4px; gap: 2px; }
.practice-week .week-day strong { font-size: 20px; }
.practice-unavailable { color: var(--muted); font-size: 14px; }
svg.icon { stroke-width: 1.6; }
/* The hit target stays 44px; the visible mark is 24px. */
.check, .today-checklist .practice-row .check,
.check.checked, .today-checklist .practice-row .check.checked {
  position: relative; border: 0; background: transparent; color: #fff; padding: 10px;
}
.check::before { content: ''; position: absolute; width: 24px; height: 24px; border: 1.5px solid #859780; border-radius: 50%; background: var(--surface); }
.check.checked::before { background: var(--green); border-color: var(--green); }
.check > .icon { position: relative; width: 18px; height: 18px; z-index: 1; }
.check:focus-visible { outline: 3px solid #a56336; outline-offset: 1px; border-radius: 9px; }
.check:disabled { opacity: .5; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend i { width: 22px; height: 0; border-top: 2px solid var(--green); }
.chart-legend .previous { border-top: 2px dashed #805b43; }
.goal-title, h2, h3, .review-title, .pill, .value-chip, td, .chip { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .practice-week { padding: 12px 16px; }
  .practice-week .week-day { min-height: 78px; }
}

.compass-chart { width: 100%; max-width: 400px; min-width: 0; }
.assessment-summary .compass-chart { flex: 1 1 260px; }

/* Date fields: iOS gives them a wide intrinsic width that pushes forms past the screen edge. */
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; width: 100%; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.icon.flip { transform: scaleX(-1); }
