/* ════════════════════════════════════════════════════════════════════════
   main.css: the one stylesheet. Same design system as my-portfolio, so every
   project shares the same look and class names. The reference page
   (app/templates/index.html) shows every component.

   Sections: font · tokens · reset · navbar · dark-mode switch · layout ·
   typography · buttons · cards · forms · alerts · badges · tables · tabs ·
   collapsible sections · icons · footer · login · utilities · responsive
   ════════════════════════════════════════════════════════════════════════ */

/* ─── Font: Inter (variable, self-hosted; SIL Open Font License, see
   app/static/fonts/inter/OFL.txt). No Google Fonts: visitor IPs stay here. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/inter/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/static/fonts/inter/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── Tokens: change these to re-theme the whole app ──────────────────── */
:root {
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;   /* one font for everything, code included */

  --max-w: 860px;          /* .page width */
  --max-w-narrow: 420px;   /* .page-narrow width (forms) */
  --nav-h: 58px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --pill: 980px;
  --ease: 150ms ease;
  --ease-md: 280ms ease;
}

:root, [data-theme="light"] {
  --bg:          #ffffff;
  --bg-alt:      #f3f6f5;               /* page background: a hint of green */
  --bg-card:     #ffffff;
  --bg-hover:    #eef2f0;
  --border:      #e3e8e6;
  --border-hi:   #cfd8d4;
  --text:        #17201d;
  --text-2:      #5b6762;
  --text-3:      #66716c;
  --nav-bg:      rgba(255,255,255,0.78);
  --shadow-sm:   0 1px 2px rgba(16,40,32,0.05);
  --shadow:      0 2px 12px rgba(16,40,32,0.06);
  --shadow-lg:   0 12px 40px rgba(16,40,32,0.12);
  --tag-bg:      #eef2f0;
  --tag-text:    #5b6762;
  --ok:          #1f7a50;
  --ok-bg:       #e6f5ed;
  --err:         #c0261b;
  --err-bg:      #fdecea;
  --warn:        #9a4a06;
  --warn-bg:     #fdf1e1;
  --accent:      #0f766e;               /* teal: links, focus, active states */
  --accent-btn:  #0f766e;               /* filled buttons */
  --accent-hi:   #115e59;               /* button hover */
  --accent-soft: rgba(15,118,110,0.10); /* tinted backgrounds */
  --on-accent:   #ffffff;               /* text on filled buttons */
  --points:      #9a4a06;               /* amber: everything about points */
  --points-bg:   #fdf1e1;
  --points-star: #d97706;
}

[data-theme="dark"] {
  --bg:          #0b0f0e;
  --bg-alt:      #0b0f0e;
  --bg-card:     #151b19;
  --bg-hover:    #1f2724;
  --border:      #26302d;
  --border-hi:   #3a4642;
  --text:        #eef3f1;
  --text-2:      #a3b0ab;
  --text-3:      #8a9792;
  --nav-bg:      rgba(11,15,14,0.75);
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.40);
  --shadow:      0 2px 12px rgba(0,0,0,0.35);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.55);
  --tag-bg:      #1f2724;
  --tag-text:    #a3b0ab;
  --ok:          #4cc38a;
  --ok-bg:       #10261b;
  --err:         #ff8a80;
  --err-bg:      #2a1412;
  --warn:        #fcd34d;
  --warn-bg:     #2a1f0c;
  --accent:      #2dd4bf;
  --accent-btn:  #14b8a6;
  --accent-hi:   #2dd4bf;
  --accent-soft: rgba(45,212,191,0.14);
  --on-accent:   #04201c;
  --points:      #fcd34d;
  --points-bg:   #2a1f0c;
  --points-star: #fbbf24;
}

/* ─── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font-body);
  background: var(--bg-alt);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  transition: background var(--ease-md), color var(--ease-md);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
ul { list-style: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Navbar (app/templates/_nav.html) ───────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  transition: background var(--ease-md), border-color var(--ease-md);
}
.nav-bar { height: 100%; display: flex; align-items: center; gap: 1.5rem; padding: 0 1.5rem; }
.nav-brand {
  font-size: .9rem; font-weight: 600; color: var(--text); letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--ease);
}
.nav-brand:hover { color: var(--accent); }
.nav-menu { display: flex; align-items: center; gap: 1.75rem; margin-left: auto; }
.nav-bar { gap: 1.1rem; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { font-size: .85rem; font-weight: 500; color: var(--text-2); transition: color var(--ease); }
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--text); }
.nav-links-extra a { color: var(--text-3); }
.nav-burger {
  display: none;
  width: 2.5rem; height: 2.5rem; margin-right: -.5rem;
  align-items: center; justify-content: center;
  border: none; background: none; color: var(--text-2);
}
.nav-burger .icon { width: 1.25rem; height: 1.25rem; }
.nav-burger:hover { color: var(--accent); }

/* ─── Dark-mode switch (app/templates/_theme_switch.html) ────────────── */
.theme-switch {
  position: relative; display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0;
  height: 1.15rem; line-height: 0;
  top: .1rem;   /* optical alignment with the link text next to it */
}
.theme-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-switch-track {
  width: 2.1rem; height: 1.15rem; border-radius: var(--pill);
  background: var(--border); position: relative;
  transition: background var(--ease);
}
.theme-switch-thumb {
  position: absolute; top: .15rem; left: .15rem;
  width: .85rem; height: .85rem; border-radius: 50%;
  background: var(--bg); color: var(--text-3); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--ease);
}
.theme-switch .theme-switch-thumb .icon { width: .6rem; height: .6rem; display: block; }
/* Calm on purpose: same greys in both states, only the knob moves */
/* Position from data-theme on <html> (set in <head> before the first paint), not
   :checked (set by JS later): otherwise the knob slides on every page load in dark mode. */
[data-theme="dark"] .theme-switch-thumb { transform: translateX(.95rem); }
.theme-switch-input:focus-visible + .theme-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-switch:hover .theme-switch-track { background: var(--border-hi); }
.theme-switch:hover .theme-switch-thumb { color: var(--text-2); }
/* One icon in the knob: sun in light mode, moon in dark mode */
.theme-switch .theme-switch-thumb .theme-switch-moon { display: none; }
[data-theme="dark"] .theme-switch .theme-switch-thumb .theme-switch-sun { display: none; }
[data-theme="dark"] .theme-switch .theme-switch-thumb .theme-switch-moon { display: block; }

/* ─── Layout ──────────────────────────────────────────────────────────── */
main { flex: 1; padding-top: var(--nav-h); }
.page { max-width: var(--max-w); margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }
.page-narrow { max-width: var(--max-w-narrow); margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.page-header { margin-bottom: 2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }

/* ─── Typography ──────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: .95rem; font-weight: 600; }
.lede { font-size: 1rem; color: var(--text-2); margin-top: .5rem; max-width: 560px; }
.label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-3); margin-bottom: .6rem; }
code {
  font-family: var(--font-body);   /* same font as the text */
  font-size: .88em; background: var(--bg-alt); color: var(--text);
  padding: .1rem .4rem; border-radius: 6px;
}
pre {
  font-family: var(--font-body); font-size: .82rem; line-height: 1.6;
  background: var(--bg-alt); border-radius: var(--radius); padding: 1rem 1.25rem;
  overflow-x: auto; white-space: pre;
}
pre code { background: none; padding: 0; font-size: inherit; }
.prose { color: var(--text-2); font-size: .92rem; line-height: 1.75; }
.prose > * + * { margin-top: .9rem; }
.prose h2, .prose h3 { color: var(--text); margin-top: 1.6rem; }
.prose ul { list-style: disc; padding-left: 1.25rem; }
.prose ol { list-style: decimal; padding-left: 1.25rem; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: var(--text); font-weight: 600; }
.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
/* .btn-primary / .btn-secondary: pill buttons for actions on public pages */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .6rem 1.3rem; border-radius: var(--pill);
  font-size: .88rem; font-weight: 500; line-height: 1.2;
  transition: all var(--ease);
}
.btn-primary { background: var(--accent-btn); color: var(--on-accent); border: 1px solid var(--accent-btn); }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }

/* .btn-submit: form buttons; add .secondary for the grey variant */
.btn-submit {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .55rem 1.25rem; line-height: 1.2;
  background: var(--accent-btn); color: var(--on-accent);
  border: 1px solid transparent; border-radius: var(--pill);
  font-size: .88rem; font-weight: 500;
  transition: background var(--ease);
}
.btn-submit:hover { background: var(--accent-hi); }
.btn-submit.secondary { background: var(--bg-alt); color: var(--text); border-color: var(--border-hi); box-shadow: var(--shadow-sm); }
.btn-submit.secondary:hover { background: var(--bg-hover); border-color: var(--text-3); }
.btn-submit.danger { background: var(--err); }
.btn-submit.danger:hover { filter: brightness(1.08); }
.btn-full { width: 100%; }

/* .btn-sm: small outlined buttons in tables and card headers */
.btn-sm {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; padding: .25rem .75rem;
  border: 1px solid var(--border); border-radius: var(--pill);
  background: var(--bg-card); color: var(--text-2);
  white-space: nowrap; transition: all var(--ease);
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.danger:hover { border-color: var(--err); color: var(--err); }

/* One primary + identical secondary buttons, same height, room to wrap */
.editor-actions { display: flex; align-items: center; gap: 1rem .9rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ─── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transition: box-shadow var(--ease-md);
}
.card-title { font-size: .8rem; font-weight: 600; color: var(--text-3); margin-bottom: 1rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-header .card-title { margin-bottom: 0; }
/* A table that runs edge to edge at the bottom of a .card (form above, list below) */
.card-table { margin: 1.5rem -1.5rem -1.5rem; border-top: 1px solid var(--border); overflow-x: auto; }
.card-table:first-child { margin-top: -1.5rem; border-top: none; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
/* A row of cards: same height, and the usual space below like a single card */
.grid-cards { align-items: stretch; margin-bottom: 1rem; }

/* ─── Forms ───────────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: .75rem; font-weight: 500; color: var(--text-2); }
.field-input, .field-textarea, .field-select {
  width: 100%;
  padding: .65rem .9rem;
  background: var(--bg-alt);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .875rem;
  outline: none;
  transition: all var(--ease);
}
.field-input:focus, .field-textarea:focus, .field-select:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field-input::placeholder, .field-textarea::placeholder { color: var(--text-3); }
.field-textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.field-input.sm { padding: .35rem .6rem; font-size: .8rem; }
.field-check { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-2); cursor: pointer; }
.field-hint { font-size: .72rem; color: var(--text-3); }
.inline-form { display: flex; gap: .4rem; align-items: center; }

/* ─── Alerts and status messages ──────────────────────────────────────── */
.alert {
  font-size: .85rem; padding: .7rem 1rem; margin-bottom: 1rem;
  border-radius: var(--radius-sm); border: 1px solid currentColor;
}
.alert-success { color: var(--ok); background: var(--ok-bg); }
.alert-error { color: var(--err); background: var(--err-bg); }
.alert-info { color: var(--accent); background: var(--accent-soft); }

@keyframes status-pop {
  0%   { opacity: 0; transform: translateY(2px); }
  15%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
/* Short "Saved" message next to a button; fades out by itself */
.save-status { font-size: .78rem; animation: status-pop 2.8s ease forwards; }
.save-status.success { color: var(--ok); }
.save-status.error { color: var(--err); }

/* ─── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: .65rem; font-weight: 600; letter-spacing: .02em;
  padding: .15rem .6rem; border-radius: var(--pill); white-space: nowrap;
  background: var(--tag-bg); color: var(--text-3);
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge-count {
  font-size: .62rem; font-weight: 600;
  background: var(--accent-btn); color: var(--on-accent);
  border-radius: var(--pill); padding: .1rem .45rem;
}
.tag {
  font-size: .7rem; font-weight: 500;
  background: var(--tag-bg); color: var(--tag-text);
  padding: .2rem .65rem; border-radius: var(--pill);
}

/* ─── Tables ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: .72rem; font-weight: 600; color: var(--text-3);
  text-align: left; padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
}
.table td { padding: .75rem; border-bottom: 1px solid var(--border); font-size: .84rem; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
/* Outer columns keep the same breathing room as the card padding */
.table th:first-child, .table td:first-child { padding-left: 1.5rem; }
.table th:last-child, .table td:last-child { padding-right: 1.5rem; }
.table tr.muted td { opacity: .5; }

/* ─── Tabs (data-tab on .tab-btn, id="panel-<name>" on .tab-panel) ────── */
.tabs {
  display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;   /* swipe on mobile */
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: .55rem 1rem;
  font-size: .8rem; font-weight: 500; color: var(--text-3);
  background: transparent; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex; align-items: center; gap: .4rem;
  flex-shrink: 0; white-space: nowrap;
  transition: all var(--ease);
}
.tab-btn:hover { color: var(--text-2); background: var(--bg-hover); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Collapsible sections (.section > .section-header + .section-body) ─ */
.section {
  background: var(--bg-card); border-radius: var(--radius-lg);
  margin-bottom: 1rem; overflow: hidden;
  box-shadow: var(--shadow); transition: box-shadow var(--ease-md);
}
.section.open { box-shadow: var(--shadow-lg); }
.section-header {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: 1.1rem 1.5rem; background: none; border: none; text-align: left;
  font-size: .875rem; font-weight: 600; color: var(--text);
  cursor: pointer; user-select: none; transition: background var(--ease);
}
.section-header:hover { background: var(--bg-hover); }
.section.open .section-header { border-bottom: 1px solid var(--border); }
.section-subtitle { font-size: .72rem; color: var(--text-3); font-weight: 400; }
.section-chevron { display: inline-flex; margin-left: auto; color: var(--text-3); transition: transform var(--ease); }
.section-chevron .icon { width: 1rem; height: 1rem; }
.section.open .section-chevron { transform: rotate(90deg); }
.section-body { display: none; padding: 1.5rem; }
.section.open .section-body { display: block; }

/* ─── Icons (Heroicons via icon() in app/templating.py) ──────────────── */
.icon { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -.2em; flex-shrink: 0; }

/* ─── Footer ──────────────────────────────────────────────────────────── */
.footer { padding: 1.5rem; border-top: 1px solid var(--border); text-align: center; }
.footer-text { font-size: .72rem; color: var(--text-3); }

/* ─── Login ───────────────────────────────────────────────────────────── */
.login-card {
  max-width: 360px; margin: 4rem auto 0; padding: 2.25rem;
  background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.login-title { font-size: 1.5rem; font-weight: 600; letter-spacing: -.025em; margin-bottom: .2rem; }
.login-sub { font-size: .85rem; color: var(--text-3); margin-bottom: 1.5rem; }

/* ─── Dialogs (native <dialog>) ───────────────────────────────────────── */
/* margin: auto centres it: the reset at the top sets margin: 0 on everything */
.app-dialog {
  margin: auto; width: min(32rem, calc(100vw - 2rem)); max-height: calc(100vh - 4rem);
  padding: 1.5rem; border: none; border-radius: var(--radius-lg);
  background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-lg);
}
.app-dialog::backdrop { background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.app-dialog-sm { width: min(24rem, calc(100vw - 2rem)); }
.dialog-title { font-size: 1.1rem; font-weight: 600; letter-spacing: -.01em; }
.dialog-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.dialog-actions-end { justify-content: flex-end; }

/* ─── Utilities ───────────────────────────────────────────────────────── */
.text-muted { color: var(--text-2); }
.text-faint { color: var(--text-3); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.text-ok { color: var(--ok); }
.text-err { color: var(--err); }
.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }  .mt-3 { margin-top: 1.5rem; }  .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }  .mb-2 { margin-bottom: 1rem; }  .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }  .items-center { align-items: center; }  .justify-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }  .gap-1 { gap: .5rem; }  .gap-2 { gap: 1rem; }

/* ════════════════════════════════════════════════════════════════════════
   My Chores: the app's own building blocks, on top of the design system.
   Navbar extras · task list · points · categories · avatars · calendar ·
   rewards · stats · task form
   ════════════════════════════════════════════════════════════════════════ */

.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;
}
.text-accent { color: var(--accent); }
.page-wide { max-width: 1180px; }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.empty { font-size: .85rem; color: var(--text-3); padding: .25rem 0; }
.empty a, .empty-state a:not([class]) { color: var(--accent); }
.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.flash-wrap { max-width: 1180px; margin: 0 auto; padding: 1rem 1.5rem 0; }
.flash { margin-bottom: 0; }

/* ─── Navbar extras: brand mark, language switch ────────── */
.nav-brand { display: inline-flex; align-items: center; gap: .5rem; }
.brand-mark {
  width: 1.6rem; height: 1.6rem; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-btn); color: var(--on-accent);
}
.brand-mark .icon { width: 1rem; height: 1rem; stroke-width: 2.5; }
.brand-mark-lg { width: 2.6rem; height: 2.6rem; border-radius: 12px; margin-bottom: 1rem; }
.brand-mark-lg .icon { width: 1.5rem; height: 1.5rem; }
.lang-switch {
  display: inline-flex; flex-shrink: 0; padding: 2px; gap: 2px;
  border: 1px solid var(--border-hi); border-radius: var(--pill);
}
.lang-switch button {
  border: 0; background: transparent; color: var(--text-2);
  font-size: .68rem; font-weight: 600; letter-spacing: .02em;
  padding: .12rem .5rem; border-radius: var(--pill); transition: all var(--ease);
}
.lang-switch button:hover { color: var(--accent); }
.lang-switch button[aria-pressed="true"] { background: var(--accent-btn); color: var(--on-accent); }

/* ─── Pills (filters) and segmented controls ─────────────────────────── */
.pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.pill {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 .95rem;
  border: 1px solid var(--border-hi); border-radius: var(--pill);
  background: var(--bg-card); color: var(--text); font-size: .82rem; font-weight: 500;
  transition: all var(--ease);
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.seg { display: inline-flex; background: var(--bg-hover); border-radius: var(--pill); padding: 3px; gap: 2px; }
.seg > a, .seg > button, .seg-option span {
  display: inline-flex; align-items: center; padding: .35rem .95rem; border-radius: var(--pill);
  font-size: .82rem; font-weight: 500; color: var(--text-2); cursor: pointer; transition: all var(--ease);
}
.seg > button { border: 0; background: none; }
.seg > a:hover, .seg > button:hover, .seg-option:hover span { color: var(--text); }
.seg > a.active, .seg > button.active, .seg-option input:checked + span { background: var(--bg-card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.seg-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg-wrap { flex-wrap: wrap; border-radius: var(--radius-sm); }
.round-btn {
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-hi); background: var(--bg-card); color: var(--text);
  transition: all var(--ease);
}
.round-btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.accent { border-color: var(--accent); color: var(--accent); }
.btn-sm.accent:hover { background: var(--accent-soft); }
.field-select.sm { padding: .4rem .7rem; font-size: .82rem; width: auto; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* ─── Categories: .cat-<color> sets --cat-fg / --cat-bg ─────────────── */
.cat-teal   { --cat-fg: #0f6b63; --cat-bg: #e3f3f0; }
.cat-blue   { --cat-fg: #1d4ed8; --cat-bg: #e8eefe; }
.cat-orange { --cat-fg: #b4400b; --cat-bg: #fdeee3; }
.cat-green  { --cat-fg: #166534; --cat-bg: #e6f4ea; }
.cat-purple { --cat-fg: #7e22ce; --cat-bg: #f3eafc; }
.cat-pink   { --cat-fg: #be185d; --cat-bg: #fce7f1; }
.cat-slate  { --cat-fg: #475569; --cat-bg: #eef1f4; }
[data-theme="dark"] .cat-teal   { --cat-fg: #5eead4; --cat-bg: rgba(94,234,212,.12); }
[data-theme="dark"] .cat-blue   { --cat-fg: #93b4ff; --cat-bg: rgba(147,180,255,.13); }
[data-theme="dark"] .cat-orange { --cat-fg: #fdba8c; --cat-bg: rgba(253,186,140,.13); }
[data-theme="dark"] .cat-green  { --cat-fg: #86efac; --cat-bg: rgba(134,239,172,.12); }
[data-theme="dark"] .cat-purple { --cat-fg: #d8b4fe; --cat-bg: rgba(216,180,254,.13); }
[data-theme="dark"] .cat-pink   { --cat-fg: #f9a8d4; --cat-bg: rgba(249,168,212,.13); }
[data-theme="dark"] .cat-slate  { --cat-fg: #cbd5e1; --cat-bg: rgba(203,213,225,.12); }
.cat-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .05rem .55rem; border-radius: var(--pill);
  background: var(--cat-bg); color: var(--cat-fg); font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.cat-chip .icon { width: .85rem; height: .85rem; }
.cat-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--cat-fg); flex-shrink: 0; display: inline-block; }
.cat-heading { display: inline-flex; align-items: center; gap: .45rem; color: var(--cat-fg); font-size: .95rem; }
.cat-heading .icon { width: 1.6rem; height: 1.6rem; padding: .3rem; border-radius: 8px; background: var(--cat-bg); }

/* ─── Avatars: initials in a circle, one color per person ────────────── */
.avatar-0 { --av-bg: #cdeee8; --av-strong: #0f766e; }
.avatar-1 { --av-bg: #fde3c4; --av-strong: #d97706; }
.avatar-2 { --av-bg: #e2dcfb; --av-strong: #7c3aed; }
.avatar-3 { --av-bg: #d6e6fd; --av-strong: #2563eb; }
.avatar-4 { --av-bg: #fbd5e5; --av-strong: #db2777; }
.avatar-5 { --av-bg: #d3f0dc; --av-strong: #16a34a; }
.avatar-any { --av-bg: var(--tag-bg); --av-strong: var(--text-3); }
[data-theme="dark"] .avatar-0 { --av-bg: #134e48; --av-strong: #2dd4bf; }
[data-theme="dark"] .avatar-1 { --av-bg: #5a3510; --av-strong: #fbbf24; }
[data-theme="dark"] .avatar-2 { --av-bg: #3b2a6b; --av-strong: #a78bfa; }
[data-theme="dark"] .avatar-3 { --av-bg: #1e3a6b; --av-strong: #60a5fa; }
[data-theme="dark"] .avatar-4 { --av-bg: #5e1f3c; --av-strong: #f472b6; }
[data-theme="dark"] .avatar-5 { --av-bg: #1a4a2b; --av-strong: #4ade80; }
.avatar {
  width: 1.9rem; height: 1.9rem; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--av-bg); color: var(--text); font-size: .7rem; font-weight: 600;
}
.person { display: inline-flex; align-items: center; gap: .5rem; }
.person .avatar { width: 1.6rem; height: 1.6rem; font-size: .65rem; }
.points-text { color: var(--points); font-weight: 700; }

/* ─── Task list (Today) ──────────────────────────────────────────────── */
/* One card with small group headings; each chore is one line */
.task-groups { margin-bottom: 1.25rem; }
.group-title { font-size: .75rem; font-weight: 600; color: var(--text-3); margin: 1.25rem 0 .25rem; }
.group-title:first-child { margin-top: 0; }
.group-overdue { color: var(--err); }
.task-row { display: flex; align-items: center; gap: .75rem; padding: .35rem 0; border-top: 1px solid var(--border); }
.task-row:first-child { border-top: none; }
.task-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .55rem; }
.task-title { font-weight: 500; font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.task-note { font-size: .78rem; color: var(--text-3); white-space: nowrap; }
.task-note.late { color: var(--err); }
.task-row .avatar { width: 1.6rem; height: 1.6rem; font-size: .62rem; }
.task-points { flex-shrink: 0; min-width: 2.5rem; text-align: right; font-weight: 600; font-size: .85rem; color: var(--text-2); }
.task-row.is-done .task-title { color: var(--text-3); text-decoration: line-through; }
.task-row.is-done .task-points { color: var(--text-3); }
.task-who { flex-shrink: 1; min-width: 0; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; color: var(--text-3); }
/* Round check button: a 44px target around a 24px circle */
.check-btn {
  position: relative; flex-shrink: 0; width: 2.75rem; height: 2.75rem; margin: -.25rem -.25rem -.25rem -.5rem;
  border: 0; background: none; padding: 0; color: transparent;
  display: inline-flex; align-items: center; justify-content: center;
}
.check-btn::before {
  content: ""; position: absolute; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  border: 2px solid var(--border-hi); background: var(--bg-card); transition: all var(--ease);
}
.check-btn .icon { position: relative; width: .9rem; height: .9rem; stroke-width: 3; }
.check-btn:hover::before { border-color: var(--accent); background: var(--accent-soft); }
.check-btn:hover .icon { color: var(--accent); }
.check-btn.late::before { border-color: var(--err); }
.check-btn.done::before { background: var(--accent-btn); border-color: var(--accent-btn); }
.check-btn.done .icon { color: var(--on-accent); }
.check-btn.done:hover::before { filter: brightness(1.1); }
.check-btn.locked::before { border-style: dashed; background: transparent; }
.check-btn.static, .check-btn.locked { cursor: default; }
/* Admin on an 'anyone' chore: the check opens "Who did it?" (people without a login) */
.who-pick { position: relative; flex-shrink: 0; }
.who-pick > summary { list-style: none; cursor: pointer; }
.who-pick > summary::-webkit-details-marker { display: none; }
.who-pick[open] > summary::before { border-color: var(--accent); background: var(--accent-soft); }
.who-pick-menu {
  position: absolute; z-index: 50; top: 100%; left: -.5rem; min-width: 11rem;
  display: flex; flex-direction: column; padding: .35rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.who-pick-title { padding: .3rem .6rem .2rem; font-size: .72rem; font-weight: 600; color: var(--text-3); }
.who-pick-menu button {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); font-size: .88rem; text-align: left;
}
.who-pick-menu button:hover { background: var(--bg-hover); color: var(--accent); }
.who-pick-menu .avatar { width: 1.4rem; height: 1.4rem; font-size: .6rem; }
/* Chores with subtasks: progress in place of the check, subtasks indented below */
.sub-progress {
  flex-shrink: 0; width: 2.75rem; height: 2.75rem; margin: -.25rem -.25rem -.25rem -.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.task-row.subtask { border-top: none; padding: .05rem 0 .05rem 2.25rem; }
.task-row.subtask .task-title { font-weight: 500; font-size: .88rem; }
.avatar-spacer { visibility: hidden; }
.sub-toggle {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 1.75rem; height: 1.75rem; margin: -.3rem 0 -.3rem .15rem; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--text-2); cursor: pointer;
}
.sub-toggle:hover { background: var(--bg-hover); color: var(--accent); }
.sub-toggle .icon { width: 1rem; height: 1rem; transition: transform var(--ease); }
.sub-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.subtask-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; font-size: .78rem; color: var(--text-2); }
.subtask-list li { display: flex; align-items: center; gap: .4rem; }
.subtask-list .is-done { text-decoration: line-through; color: var(--text-3); }
.subtask-list .sep { color: var(--text-3); }
.subtask-list .icon { width: .8rem; height: .8rem; flex-shrink: 0; color: var(--accent); }
.subtask-rows { display: grid; gap: .5rem; }
.subtask-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 10rem) 5.5rem; gap: .5rem; }
@media (max-width: 560px) { .subtask-row { grid-template-columns: minmax(0, 1fr) 5rem; } .subtask-row select { grid-column: 1 / -1; grid-row: 2; } }

/* ─── Today layout: list + side column ───────────────────────────────── */
.layout-side { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.layout-main { flex: 999 1 560px; min-width: 0; }
.layout-aside { flex: 1 1 290px; min-width: 0; }
.layout-aside > * { margin-bottom: 1.25rem; }
.points-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--points); }
.points-goal { display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; color: var(--text-2); margin: 1rem 0 .4rem; }
.points-goal span:last-child, .lede .points-text { white-space: nowrap; }
.progress { height: .45rem; border-radius: var(--pill); background: var(--bg-hover); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--pill); background: var(--accent-btn); }
.progress-bar.short { background: var(--points-star); }
.leaderboard li { display: flex; align-items: center; gap: .7rem; padding: .45rem 0; border-top: 1px solid var(--border); font-size: .88rem; }
.leaderboard li:first-child { border-top: none; padding-top: 0; }
.rank { width: 1rem; font-size: .78rem; font-weight: 600; color: var(--text-3); }
.lb-name { flex: 1; font-weight: 500; }

/* ─── Calendar ───────────────────────────────────────────────────────── */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.25rem; margin-bottom: 1.25rem; }
.cal-nav, .cal-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cal-actions { margin-left: auto; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .78rem; color: var(--text-2); margin-bottom: .9rem; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.legend-item .cat-dot { width: .6rem; height: .6rem; border-radius: 3px; }
.legend-done { text-decoration: line-through; color: var(--text-3); }
.legend-late { color: var(--err); cursor: help; }
.legend-planned { width: .9rem; height: .6rem; border-radius: 3px; border: 1px dashed var(--text-3); }
.legend-swatch { width: .7rem; height: .7rem; border-radius: 3px; background: var(--av-strong); }
.cal-card { padding: 0; overflow: hidden; }
.cal-scroll { overflow-x: auto; position: relative; }   /* keeps the .sr-only day labels inside, or Android widens the page */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 720px; }
.cal-head { background: var(--bg-hover); border-bottom: 1px solid var(--border); }
.cal-head div { padding: .5rem .75rem; font-size: .72rem; font-weight: 600; color: var(--text-2); }
.cal-day { min-height: 7.5rem; padding: .45rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-width: 0; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.out { background: var(--bg-alt); }
.cal-day.out .cal-num { color: var(--text-3); }
.cal-day.today { background: var(--accent-soft); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; gap: .25rem; margin-bottom: .2rem; }
.cal-num {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .3rem;
  border-radius: var(--pill); font-size: .8rem; font-weight: 600; color: var(--text);
}
a.cal-num:hover { background: var(--bg-hover); color: var(--accent); }
.cal-day.today .cal-num { background: var(--accent-btn); color: var(--on-accent); }
.cal-pts { font-size: .65rem; font-weight: 600; color: var(--points); }
.cal-items { display: flex; flex-direction: column; gap: 3px; }
.cal-item {
  font-size: .72rem; font-weight: 600; line-height: 1.35; padding: .1rem .45rem; border-radius: 6px;
  background: var(--cat-bg); color: var(--cat-fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-item.cal-planned { background: transparent; border: 1px dashed var(--cat-fg); opacity: .8; padding: calc(.1rem - 1px) calc(.45rem - 1px); }
.cal-item.cal-done { background: var(--bg-hover); color: var(--text-3); text-decoration: line-through; }
.cal-item.cal-late { background: var(--err-bg); color: var(--err); }
.cal-more { display: inline-block; margin-top: 2px; padding-left: .45rem; font-size: .72rem; color: var(--text-2); }
.cal-more:hover { color: var(--accent); }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .75rem; }
.week-grid .card { padding: 1rem; margin-bottom: 0; }
.week-grid .card-header { margin-bottom: .6rem; }
.week-day-title { font-size: .85rem; }
.week-day.today { box-shadow: 0 0 0 2px var(--accent); }
.week-day .cal-item { white-space: normal; }

/* ─── Rewards ────────────────────────────────────────────────────────── */
.stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.stat { background: var(--bg-card); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-label { font-size: .75rem; font-weight: 600; color: var(--text-2); }
.stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat-note { font-size: .75rem; color: var(--text-3); }
.reward-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.reward-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .75rem; }
.reward-icon { width: 2.75rem; height: 2.75rem; border-radius: 14px; background: var(--points-bg); color: var(--points-star); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.reward-icon .icon { width: 1.4rem; height: 1.4rem; }
.reward-name { font-size: 1rem; }
.reward-btn { margin-left: auto; }
.btn-submit:disabled { cursor: not-allowed; opacity: .75; }
.request-list li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.request-list li:first-child { border-top: none; padding-top: 0; }
.request-main { flex: 1; min-width: 10rem; display: flex; flex-direction: column; font-size: .9rem; }

/* ─── Stats ──────────────────────────────────────────────────────────── */
.chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: clamp(.2rem, 1.2vw, .75rem); height: 14rem; align-items: end; }
.chart-col { display: flex; flex-direction: column; height: 100%; gap: .4rem; min-width: 0; }
.chart-bars { flex: 1; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border); }
.chart-bar { flex: 1; min-height: 2px; background: var(--av-strong); border-radius: 4px 4px 0 0; }
.chart-label { font-size: .68rem; color: var(--text-3); text-align: center; white-space: nowrap; overflow: hidden; }
.hbar-row { display: flex; align-items: center; gap: .75rem; padding: .3rem 0; font-size: .85rem; }
.hbar-label { width: 6.5rem; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; height: .7rem; border-radius: var(--pill); background: var(--bg-hover); overflow: hidden; }
.hbar { height: 100%; border-radius: var(--pill); background: var(--cat-fg); }
.hbar-value { width: 2rem; text-align: right; font-weight: 600; }
.hbar.on-time { background: var(--accent); }
.hbar-row .hbar-value.wide { width: 3rem; }
.stats-num { text-align: right; font-weight: 600; white-space: nowrap; }
.ledger li { display: flex; align-items: center; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--border); font-size: .85rem; }
.ledger li:first-child { border-top: none; padding-top: 0; }
.ledger-note { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ledger-amount { font-weight: 700; min-width: 3rem; text-align: right; }
.ledger-amount.plus { color: var(--ok); }
.ledger-amount.minus { color: var(--err); }

/* ─── Task form and admin rows ───────────────────────────────────────── */
.fieldset { border: 0; display: flex; flex-direction: column; gap: .75rem; }
.fieldset legend { margin-bottom: .4rem; }
.repeat-detail { display: flex; flex-direction: column; gap: .35rem; }
.day-picks { display: flex; flex-wrap: wrap; gap: .4rem; }
.day-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-pick span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; height: 2.75rem; padding: 0 .5rem;
  border-radius: var(--pill); border: 1px solid var(--border-hi); font-size: .8rem; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all var(--ease);
}
.day-pick input:checked + span { background: var(--accent-btn); border-color: var(--accent-btn); color: var(--on-accent); }
.day-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-form { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.row-form .field-input.sm { width: auto; flex: 1 1 8rem; }
.row-form .cat-heading .icon { width: 1.9rem; height: 1.9rem; }

@media (max-width: 960px) {
  .reward-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .nav-brand-text { display: none; }   /* phone: the mark alone, so points and switches fit */
}
@media (max-width: 760px) {
  .stat-tiles, .reward-grid, .week-grid { grid-template-columns: 1fr; }
  .cal-actions { margin-left: 0; }
  .chart { gap: .35rem; }
}

/* ─── Bottom tab bar (phones): one tap to each main page ─────────────── */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    padding: 0 .25rem env(safe-area-inset-bottom);
    background: var(--nav-bg); border-top: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .tabbar a {
    flex: 1; min-width: 0; min-height: 3.5rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    font-size: .68rem; font-weight: 500; color: var(--text-2); transition: color var(--ease);
  }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .icon { width: 1.4rem; height: 1.4rem; }
  .tabbar a:hover { color: var(--accent); }
  .tabbar a.active { color: var(--accent); font-weight: 600; }
  body:has(.tabbar) { padding-bottom: calc(3.5rem + env(safe-area-inset-bottom)); }
  .nav-links.in-tabbar { display: none; }      /* the hamburger keeps only the other links */
  .nav-links.in-tabbar + .nav-links-extra a { color: var(--text-2); }
}

/* ─── Small screens: hamburger menu ──────────────────────────────────── */
@media (max-width: 860px) {
  .nav-burger { display: flex; }
  /* menu is folded away: switch sits right, centred next to the hamburger */
  .nav-bar .nav-brand { margin-right: auto; }   /* menu folded away: switches sit right */
  .nav-bar .theme-switch { top: 0; }
  .nav-bar .nav-burger { margin-left: -1rem; }   /* hamburger close to the switch */
  .nav-menu {
    display: none;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: .15rem;
    padding: .5rem .75rem .75rem;   /* link text lines up with the brand */
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--nav-h)); overflow-y: auto;
  }
  .nav.open .nav-menu { display: flex; }
  /* compact list: no dividers, the current page gets a soft background */
  .nav-links { flex-direction: column; align-items: stretch; gap: .15rem; }
  .nav-links a { display: block; padding: .6rem .75rem; font-size: .9rem; border-radius: var(--radius-sm); }
  .nav-links a:hover { background: var(--bg-hover); }
  .nav-links a.active { background: var(--bg-hover); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page { padding: 2rem 1rem 4rem; }
  .card { padding: 1.25rem; }
  .card-table { margin: 1.25rem -1.25rem -1.25rem; }
  .card-table:first-child { margin-top: -1.25rem; }
  .table th:first-child, .table td:first-child { padding-left: 1.25rem; }
  .table th:last-child, .table td:last-child { padding-right: 1.25rem; }
  .table .hide-sm { display: none; }
  .login-card { margin-top: 2rem; padding: 1.75rem; }
}

/* ─── Landing page (landing.html): hero, screenshots, feature rows, FAQ ─ */
.hero { text-align: center; padding: 1rem 0 2.5rem; }
.hero .lede { margin-left: auto; margin-right: auto; }
.hero-title { font-size: clamp(1.9rem, 5vw, 2.8rem); letter-spacing: -.03em; max-width: 720px; margin: 0 auto; }
.hero-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; margin-top: 1.75rem; }
/* A screenshot: rounded, framed and lifted off the page */
.shot {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); box-shadow: var(--shadow-lg);
}
.landing-block { margin-top: 5rem; }
.landing-title { font-size: clamp(1.35rem, 3vw, 1.75rem); letter-spacing: -.02em; line-height: 1.25; }
.landing-block > .landing-title { text-align: center; margin-bottom: 1.75rem; }
/* Text beside a screenshot; .reverse puts the screenshot on the left */
.feature-row { display: grid; grid-template-columns: 2fr 3fr; gap: 3rem; align-items: center; margin-top: 5rem; }
.feature-row.reverse > :first-child { order: 2; }
.check-list { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.25rem; font-size: .9rem; color: var(--text-2); }
.check-list li { display: flex; gap: .55rem; line-height: 1.5; }
/* Centred on the first line: (line height − icon height) / 2 */
.check-list .icon { color: var(--accent); margin-top: calc((1.5em - 1.05em) / 2); }
.landing-narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.card.landing-narrow > .landing-title { text-align: left; margin-bottom: 0; }
@media (max-width: 760px) {
  .feature-row { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 3.5rem; }
  .feature-row.reverse > :first-child { order: 0; }
  .landing-block { margin-top: 3.5rem; }
}

/* ─── Reduced motion (keep this last) ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
