/* ===== Soma — earthen: cream paper, sage, clay, teal ===== */

:root {
  --bg: #faf7f2;
  --bg-deep: #f3eee5;
  --surface: #ffffff;
  --surface-warm: #f7f2e9;
  --ink: #3d3833;
  --ink-soft: #6b635a;
  --ink-mute: #9c9388;
  --sage: #87a07b;
  --sage-dark: #6b8460;
  --sage-soft: #c8d5c0;
  --sage-bg: rgba(135, 160, 123, 0.10);
  --teal: #0f766e;
  --teal-dark: #0b5a54;
  --teal-bg: rgba(15, 118, 110, 0.10);
  --clay: #b0522f;
  --clay-deep: #8a3e22;
  --warm-red: #b86b5a;
  --gold: #b8941d;
  --border: rgba(61, 56, 51, 0.12);
  --border-strong: rgba(61, 56, 51, 0.22);
  --shadow-soft: 0 1px 4px rgba(61, 56, 51, 0.06);
  --shadow-card: 0 2px 14px rgba(61, 56, 51, 0.10);
  --shadow-modal: 0 24px 60px rgba(61, 56, 51, 0.28);
  --display: 'Fraunces', 'Georgia', serif;
  --body: 'Lora', 'Georgia', serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; }
body {
  font-family: var(--body);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(15, 118, 110, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(176, 82, 47, 0.045) 0%, transparent 50%);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  padding: 40px 28px 80px;
}
.hidden { display: none !important; }
.muted { color: var(--ink-mute); }
.big { font-size: 16px; padding: 26px 0; text-align: center; }
a { color: var(--teal); text-decoration: none; border-bottom: 1px solid var(--teal-bg); transition: all 0.2s; }
a:hover { color: var(--ink); border-color: var(--ink); }

/* ===== Login ===== */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 64px 56px 56px; max-width: 440px; width: 100%; text-align: center; box-shadow: var(--shadow-modal); }
.ornament { font-size: 30px; color: var(--teal); letter-spacing: 0.3em; margin-bottom: 14px; line-height: 1; }
.ornament-line { height: 1px; width: 100px; margin: 26px auto; background: linear-gradient(90deg, transparent, var(--teal), transparent); }
.brand-title { font-family: var(--display); font-size: 64px; font-weight: 600; color: var(--ink); letter-spacing: 0.04em; margin-bottom: 8px; line-height: 1; }
.brand-subtitle { font-style: italic; color: var(--ink-soft); font-size: 16px; letter-spacing: 0.04em; }
.btn-google { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 26px; font-family: var(--body); font-size: 15px; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 10px; transition: all 0.25s; }
.btn-google:hover { background: var(--teal-bg); border-color: var(--teal); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.login-error { color: var(--warm-red); margin-top: 16px; font-size: 14px; font-style: italic; min-height: 1.2em; }
.login-or { font-family: var(--display); font-style: italic; color: var(--ink-soft); font-size: 13px; margin: 18px 0 12px; position: relative; }
.login-or::before, .login-or::after { content: ''; position: absolute; top: 50%; width: 28%; height: 1px; background: var(--border); }
.login-or::before { left: 12%; } .login-or::after { right: 12%; }
.btn-readonly { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-soft); padding: 10px 22px; font-family: var(--body); font-size: 14px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s; }
.btn-readonly:hover { border-color: var(--teal); color: var(--ink); background: var(--teal-bg); transform: translateY(-1px); }

.readonly-banner { background: var(--teal-bg); border: 1px solid var(--teal); color: var(--ink); text-align: center; font-size: 13px; padding: 8px 14px; border-radius: var(--radius); margin-bottom: 18px; }
.readonly-banner a { color: var(--teal-dark); font-weight: 600; }
body.read-only .edit-only { display: none !important; }

/* ===== Header / layout ===== */
.app { max-width: 960px; margin: 0 auto; }
.header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); margin-bottom: 36px; }
.header-title { font-family: var(--display); font-size: 32px; font-weight: 600; color: var(--ink); letter-spacing: 0.02em; line-height: 1; }
.header-subtitle { font-style: italic; color: var(--ink-soft); font-size: 12.5px; margin-top: 4px; }
.tabs { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.tab { background: transparent; border: none; color: var(--ink-soft); font-family: var(--body); font-size: 14px; letter-spacing: 0.04em; padding: 8px 16px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--teal-dark); background: var(--teal-bg); }
.header-right { display: flex; align-items: center; gap: 10px; justify-self: end; }
.btn-icon { background: transparent; border: 1px solid var(--border); color: var(--ink-soft); width: 34px; height: 34px; border-radius: var(--radius); cursor: pointer; font-size: 16px; transition: all 0.2s; }
.btn-icon:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-bg); }
.btn-logout { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-soft); font-family: var(--body); font-size: 12.5px; padding: 6px 12px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s; }
.btn-logout:hover { border-color: var(--warm-red); color: var(--warm-red); }
.sync-status { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-mute); transition: background 0.3s; }
.sync-status.synced { background: var(--sage); } .sync-status.connecting { background: var(--gold); }
.sync-status.syncing { background: var(--gold); } .sync-status.error { background: var(--warm-red); }

/* ===== Views / sections ===== */
.view { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-title { font-family: var(--display); font-size: 30px; font-weight: 500; color: var(--ink); letter-spacing: 0.02em; }
.section-sub { font-style: italic; color: var(--ink-soft); font-size: 14px; margin-top: 4px; }
.block { margin-top: 34px; }
.block-title { font-family: var(--display); font-size: 15px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 12px; }
.block-sub { font-style: italic; color: var(--ink-mute); font-size: 14px; margin: -6px 0 14px; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--ink-mute); font-style: italic; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ===== Today head + next reminder ===== */
.today-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.next-reminder { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--ink-soft); box-shadow: var(--shadow-soft); }
.next-reminder-dot { width: 9px; height: 9px; border-radius: 50%; }
.next-reminder-label { color: var(--ink); }
.next-reminder-when { font-family: var(--mono); font-size: 12px; color: var(--teal-dark); }

/* ===== Check-in slots ===== */
.checkin-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkin-slot-label { font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.checkin-body { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-warm); padding: 18px 20px; cursor: pointer; transition: all 0.25s; box-shadow: var(--shadow-soft); }
.checkin-body.filled:hover { border-color: var(--teal); box-shadow: var(--shadow-card); }
.checkin-body.empty { border-style: dashed; border-color: var(--border-strong); box-shadow: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 116px; color: var(--ink-soft); text-align: center; }
.checkin-body.empty:hover { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-bg); }
.checkin-glyph { font-size: 25px; color: var(--teal); line-height: 1; }
.checkin-prompt { font-style: italic; font-size: 14.5px; }
.checkin-summary-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.checkin-summary-edit { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-dark); font-weight: 600; }
.checkin-summary-sleep { font-size: 12px; color: var(--ink-mute); font-style: italic; }
.checkin-scales { display: flex; flex-direction: column; gap: 8px; }
.checkin-scale { display: grid; grid-template-columns: 150px 1fr 22px; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-soft); }
.checkin-scale-track { height: 5px; border-radius: 3px; background: rgba(61, 56, 51, 0.08); overflow: hidden; }
.checkin-scale-fill { display: block; height: 100%; border-radius: 3px; }
.checkin-scale-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); text-align: right; }

/* ===== Training sessions ===== */
.trigger-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.trigger-head .block-title { margin-bottom: 0; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.session { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--teal); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); transition: border-color 0.15s; }
.session:hover { border-color: var(--teal); }
.session.done { background: color-mix(in srgb, var(--surface) 82%, var(--sage) 18%); }
.session-check-btn { background: none; border: none; border-right: 1px solid var(--border); padding: 0 15px; cursor: pointer; display: flex; align-items: center; }
.session-check { width: 24px; height: 24px; border: 1.6px solid var(--border-strong); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; }
.session.done .session-check { background: var(--sage); border-color: var(--sage); }
.session-open { flex: 1; display: flex; align-items: center; gap: 13px; background: none; border: none; color: var(--ink); cursor: pointer; padding: 13px 15px; text-align: left; min-width: 0; }
.session-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.session-name { font-size: 15px; font-weight: 600; font-family: var(--display); }
.session.done .session-name { text-decoration: line-through; color: var(--ink-mute); }
.session-groups { font-size: 12.5px; color: var(--ink-mute); }
.session-meta { font-size: 13px; text-align: right; }

/* ===== Habit grid ===== */
.habit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.habit-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--pill, var(--teal)); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow-soft); }
.habit-card.done { background: color-mix(in srgb, var(--surface) 85%, var(--pill) 15%); }
.habit-tap { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; cursor: pointer; min-width: 56px; transition: all 0.15s; }
.habit-tap:hover { border-color: var(--pill); background: var(--teal-bg); }
.habit-icon { font-size: 16px; color: var(--pill, var(--teal)); }
.habit-count { font-family: var(--mono); font-weight: 600; font-size: 16px; color: var(--ink); }
.habit-target { color: var(--ink-mute); font-weight: 400; font-size: 12px; }
.habit-label { font-weight: 600; font-size: 14px; }
.habit-sub { font-size: 12px; color: var(--ink-mute); }
.habit-dec { background: transparent; border: 1px solid var(--border); color: var(--ink-mute); width: 28px; height: 28px; border-radius: var(--radius); cursor: pointer; font-size: 16px; }
.habit-dec:hover:not(:disabled) { border-color: var(--warm-red); color: var(--warm-red); }
.habit-dec:disabled { opacity: 0.35; cursor: default; }

/* ===== Quote ===== */
.quote { font-family: var(--display); font-style: italic; font-size: 22px; color: var(--ink); padding: 0 20px; border-left: 2px solid var(--teal); line-height: 1.5; }
.quote-attr { display: block; font-family: var(--body); font-style: normal; font-size: 12px; color: var(--ink-mute); letter-spacing: 0.08em; margin-top: 12px; text-transform: uppercase; }

/* ===== Week ===== */
.week-nav { display: flex; align-items: center; gap: 14px; }
.week-label { font-family: var(--display); font-size: 18px; color: var(--ink); min-width: 150px; text-align: center; }
.cal-nav-btn { background: transparent; border: 1px solid var(--border); color: var(--ink-soft); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.cal-nav-btn:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-bg); }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-height: 96px; }
.week-dow { font-size: 11px; color: var(--ink-mute); margin-bottom: 8px; text-align: center; letter-spacing: 0.04em; }
.week-dow.is-today { color: var(--teal-dark); font-weight: 700; }
.chip { display: block; width: 100%; text-align: left; font-size: 11px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: 5px; padding: 4px 6px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--ink); font-family: var(--body); }
.chip:hover { border-color: var(--teal); }
.chip.done { background: var(--sage-bg); border-color: transparent; color: var(--sage-dark); }
.chip.rest { color: var(--ink-mute); opacity: 0.6; border-style: dashed; cursor: default; }
@media (max-width: 640px) { .week-grid { grid-template-columns: repeat(4, 1fr); } }

/* ===== Manage list ===== */
.manage-list { display: flex; flex-direction: column; gap: 10px; }
.manage-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.manage-row .muted { font-size: 12px; grid-column: 1; }
.manage-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; }
.ghost { background: var(--surface-warm); border: 1px solid var(--border); color: var(--ink); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; font: inherit; font-size: 12.5px; }
.ghost:hover { border-color: var(--teal); color: var(--teal-dark); }

/* ===== Routine viewer (animated exercises) ===== */
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
@media (max-width: 460px) { .ex-grid { grid-template-columns: 1fr; } }
.ex-card { background: var(--surface-warm); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; text-align: center; }
.ex-illo { background: var(--bg-deep); border-radius: var(--radius); margin-bottom: 8px; }
.ex-name { font-size: 13px; font-weight: 600; }
.ex-sets { font-size: 12px; color: var(--teal-dark); margin-top: 2px; font-family: var(--mono); }
.ex-anim { width: 100%; height: 92px; display: block; color: var(--teal); }
.ex-anim line, .ex-anim circle { stroke: currentColor; stroke-width: 3; stroke-linecap: round; fill: none; }
.ex-anim .ground, .ex-anim .bar { stroke: var(--border-strong); stroke-width: 2.5; }
.ex-anim g { transform-box: fill-box; }
.anim-pushup .mover { transform-origin: 92% 100%; animation: a-pushup 1.3s ease-in-out infinite; }
@keyframes a-pushup { 0%,100% { transform: rotate(0) } 50% { transform: rotate(-11deg) translateY(3px) } }
.anim-squat .mover { transform-origin: 50% 100%; animation: a-squat 1.4s ease-in-out infinite; }
@keyframes a-squat { 0%,100% { transform: translateY(0) scaleY(1) } 50% { transform: translateY(11px) scaleY(.8) } }
.anim-pullup .mover { transform-origin: 50% 0%; animation: a-pullup 1.5s ease-in-out infinite; }
@keyframes a-pullup { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-13px) } }
.anim-core .legs { transform-origin: 0% 50%; animation: a-core 1.6s ease-in-out infinite; }
@keyframes a-core { 0%,100% { transform: rotate(0) } 50% { transform: rotate(-52deg) } }
.anim-run .legA, .anim-run .armB { transform-origin: 50% 0%; animation: a-swingA .5s ease-in-out infinite; }
.anim-run .legB, .anim-run .armA { transform-origin: 50% 0%; animation: a-swingB .5s ease-in-out infinite; }
@keyframes a-swingA { 0%,100% { transform: rotate(24deg) } 50% { transform: rotate(-24deg) } }
@keyframes a-swingB { 0%,100% { transform: rotate(-24deg) } 50% { transform: rotate(24deg) } }
.anim-jump .mover { transform-origin: 50% 100%; animation: a-hop .8s ease-in-out infinite; }
.anim-jump .armA { transform-origin: 50% 0%; animation: a-jackA .8s ease-in-out infinite; }
.anim-jump .armB { transform-origin: 50% 0%; animation: a-jackB .8s ease-in-out infinite; }
@keyframes a-hop { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }
@keyframes a-jackA { 0%,100% { transform: rotate(0) } 50% { transform: rotate(-120deg) } }
@keyframes a-jackB { 0%,100% { transform: rotate(0) } 50% { transform: rotate(120deg) } }
@media (prefers-reduced-motion: reduce) { .ex-anim * { animation: none !important; } }

/* ===== Trends ===== */
.range-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; }
.range-toggle button { background: transparent; border: none; color: var(--ink-soft); font-family: var(--body); font-size: 12px; padding: 6px 14px; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.range-toggle button:hover { color: var(--ink); }
.range-toggle button.active { background: var(--teal-bg); color: var(--teal-dark); }
.trends-charts { display: flex; flex-direction: column; gap: 14px; }
.trend-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.trend-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.trend-row-name { font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--ink); }
.trend-row-avg { font-size: 12px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.trend-chart { width: 100%; height: 50px; }
.trend-chart-line { fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart-area { stroke: none; opacity: 0.16; }
.trends-sleep { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.sleep-bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-bottom: 8px; }
.sleep-bar { flex: 1; background: var(--sage-soft); border-radius: 2px 2px 0 0; min-width: 6px; transition: background 0.2s; }
.sleep-bar:hover { background: var(--sage); }
.sleep-bar.poor { background: var(--clay); opacity: 0.5; }
.sleep-bar.empty { background: var(--border); }
.sleep-summary { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); }
.trends-adherence .stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; text-align: center; }
.stat-num { font-family: var(--display); font-size: 34px; font-weight: 600; color: var(--teal-dark); line-height: 1; }
.stat-label { font-size: 12px; color: var(--ink-mute); margin-top: 6px; letter-spacing: 0.03em; }
.trends-insights { display: flex; flex-direction: column; gap: 10px; }
.insight { background: var(--teal-bg); border-left: 3px solid var(--teal); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; font-size: 14px; color: var(--ink); }
.insight strong { color: var(--teal-dark); font-weight: 600; }
.insight.empty { background: var(--surface); border-left-color: var(--ink-mute); font-style: italic; color: var(--ink-soft); }

/* ===== Protocols ===== */
.protocols-list { display: grid; grid-template-columns: 1fr; gap: 4px; }
.protocol-group-title { font-family: var(--display); font-size: 15px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.protocol-group:first-child .protocol-group-title { margin-top: 0; }
.protocol-group-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.protocol-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; cursor: pointer; transition: all 0.25s; box-shadow: var(--shadow-soft); }
.protocol-card:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: var(--shadow-card); }
.protocol-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.protocol-card-icon { font-size: 22px; line-height: 1; }
.protocol-card-name { font-family: var(--display); font-size: 19px; font-weight: 600; color: var(--ink); }
.protocol-card-desc { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; margin-bottom: 10px; }
.protocol-card-meta { font-size: 11px; color: var(--ink-mute); letter-spacing: 0.05em; text-transform: uppercase; }
.protocol-view-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pv-icon { font-size: 34px; line-height: 1; }
.pv-meta { font-size: 12px; color: var(--ink-mute); letter-spacing: 0.05em; text-transform: uppercase; margin-top: 4px; }
.pv-description { font-style: italic; color: var(--ink-soft); margin-bottom: 16px; }
.pv-steps { list-style: none; counter-reset: step; }
.pv-steps li { position: relative; padding: 10px 0 12px 36px; border-bottom: 1px solid var(--border); counter-increment: step; color: var(--ink); }
.pv-steps li:last-child { border-bottom: none; }
.pv-steps li::before { content: counter(step); position: absolute; left: 0; top: 11px; width: 24px; height: 24px; border-radius: 50%; background: var(--teal-bg); color: var(--teal-dark); font-family: var(--display); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.pv-sources-title { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 10px; }
.pv-sources { list-style: none; font-size: 13.5px; }
.pv-sources li { padding: 6px 0; color: var(--ink-soft); font-style: italic; }

/* ===== Library ===== */
.library-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.library-filter { background: transparent; border: 1px solid var(--border); color: var(--ink-soft); font-family: var(--body); font-size: 12.5px; padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: all 0.2s; }
.library-filter:hover { border-color: var(--teal); color: var(--ink); }
.library-filter.active { background: var(--teal-bg); border-color: var(--teal); color: var(--teal-dark); }
.library-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.library-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-soft); transition: all 0.25s; display: flex; flex-direction: column; }
.library-card:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: var(--shadow-card); }
.library-card-topic { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.library-card-title { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--ink); margin-bottom: 8px; line-height: 1.25; }
.library-card-excerpt { font-size: 14px; color: var(--ink-soft); line-height: 1.55; margin-bottom: 14px; flex: 1; }
.library-card-actions { display: flex; align-items: center; gap: 8px; }
.library-card-meta { margin-left: auto; font-size: 11.5px; color: var(--ink-mute); font-style: italic; }
.study-btn { font-family: var(--body); font-size: 12px; padding: 6px 14px; border-radius: var(--radius); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s; border: 1px solid; white-space: nowrap; }
.study-btn-view { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.study-btn-view:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: var(--bg); }
.study-btn-download { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.study-btn-download:hover { background: var(--teal-bg); border-color: var(--teal); }

/* ===== Buttons ===== */
.btn-primary, .btn-secondary, .btn-danger { font-family: var(--body); font-size: 14px; padding: 9px 18px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s; border: 1px solid; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-secondary { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--teal-bg); border-color: var(--teal); }
.btn-secondary:disabled { opacity: 0.5; cursor: default; }
.btn-danger { background: transparent; border-color: var(--warm-red); color: var(--warm-red); }
.btn-danger:hover { background: rgba(184, 107, 90, 0.1); }

/* ===== Modals ===== */
.modal { position: fixed; inset: 0; background: rgba(61, 56, 51, 0.42); display: none; align-items: center; justify-content: center; padding: 24px; z-index: 100; animation: fadeIn 0.25s ease; }
.modal.open { display: flex; }
.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 34px 38px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-modal); position: relative; animation: slideUp 0.3s ease; }
.modal-content.modal-large { max-width: 680px; }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-close { position: absolute; top: 14px; right: 16px; background: transparent; border: none; font-size: 26px; color: var(--ink-mute); cursor: pointer; line-height: 1; padding: 6px 10px; border-radius: var(--radius); transition: all 0.2s; }
.modal-close:hover { color: var(--ink); background: var(--teal-bg); }
.modal-content h3 { font-family: var(--display); font-size: 26px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.modal-sub { color: var(--ink-soft); font-style: italic; font-size: 14px; margin-bottom: 18px; }

/* ===== Forms ===== */
.form { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.form label, .form fieldset legend, .field-label { font-size: 11.5px; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin-bottom: 6px; display: block; }
.form label { display: flex; flex-direction: column; gap: 6px; }
.form .hint { font-weight: 400; text-transform: none; letter-spacing: 0; font-style: italic; color: var(--ink-mute); }
.form input[type="text"], .form input[type="number"], .form input[type="time"], .form input[type="date"], .form select, .form textarea {
  font-family: var(--body); font-size: 15.5px; letter-spacing: 0; text-transform: none; color: var(--ink); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; outline: none; transition: border-color 0.2s; font-weight: 400; }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--teal); }
.form textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.flex-1 { flex: 1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.form-actions .btn-danger { margin-right: auto; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400; color: var(--ink); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--teal); }

/* Day picker */
.day-picks { display: flex; gap: 5px; flex-wrap: wrap; }
.day-pick { background: var(--surface-warm); border: 1px solid var(--border); color: var(--ink-mute); border-radius: var(--radius); padding: 6px 9px; cursor: pointer; font: inherit; font-size: 11px; }
.day-pick.on { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }

/* Scales */
.scales { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px 8px; background: var(--bg); }
.scales legend { padding: 0 8px; background: var(--surface); }
.scale-row { display: grid; grid-template-columns: 1fr 2fr 28px; gap: 12px; align-items: center; padding: 8px 0; }
.scale-label { font-size: 14px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 400; }
.scale-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-soft); text-align: right; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 3px; background: var(--border); border-radius: 999px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--clay); cursor: pointer; border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(61,56,51,0.2); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--clay); cursor: pointer; border: 2px solid var(--surface); }
.scale-row.positive input[type="range"]::-webkit-slider-thumb { background: var(--sage); }
.scale-row.positive input[type="range"]::-moz-range-thumb { background: var(--sage); }

/* Stars */
.stars-input { display: flex; gap: 4px; font-size: 22px; cursor: pointer; user-select: none; }
.stars-input .star { color: var(--border-strong); opacity: 0.45; transition: all 0.15s; }
.stars-input .star.active { color: var(--gold); opacity: 1; }

/* ===== Settings / reminders ===== */
.notif-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px; }
.notif-status-title { font-weight: 600; font-size: 14px; }
.notif-status-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 3px; max-width: 42ch; }
.settings-reminders-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.settings-reminders-actions { display: flex; gap: 8px; align-items: center; }
.reminders-list { display: flex; flex-direction: column; gap: 8px; }
.reminder-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.reminder-row.off { opacity: 0.5; }
.reminder-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.reminder-info { flex: 1; min-width: 0; }
.reminder-label { font-weight: 600; font-size: 14px; }
.reminder-when { font-size: 12px; color: var(--ink-mute); font-family: var(--mono); }

/* ===== Toast ===== */
.toast { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--bg); padding: 11px 22px; border-radius: var(--radius); font-family: var(--body); font-size: 14px; box-shadow: var(--shadow-modal); opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 200; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  body { padding: 24px 16px 80px; }
  .header { grid-template-columns: 1fr; gap: 14px; }
  .header-left { text-align: center; }
  .header-right { justify-self: center; }
  .brand-title { font-size: 48px; }
  .section-title { font-size: 24px; }
  .today-head { flex-direction: column; align-items: stretch; }
  .checkin-slots { grid-template-columns: 1fr; }
  .modal-content { padding: 28px 22px; }
  .scale-row { grid-template-columns: 1fr 1fr 28px; }
}
