/* Campars: tokens (the Organic palette) and components, shared by the Next frontend and Django's base.html. Mobile-first; @media (min-width: 960px) is the computer. */
:root {
  --font: 'Onest', system-ui, sans-serif;
  --display: 'Rubik', 'Onest', system-ui, sans-serif;
  /* light: a clean warm-white page and white cards; the sand lives in the soft fills only */
  --bg: #f7f3ec; --surface: #ffffff; --surface-2: #efe8dc; --text: #1f1c19; --muted: #5c5448;
  --line: rgba(32, 30, 29, .08); --line-strong: rgba(32, 30, 29, .16);
  --accent: #c67139; --primary: #a85a27; --primary-press: #8c491a; --on-primary: #fff; --accent-soft: #fbe6d8; --accent-ink: #8c491a;
  --sage: #7a8a5e; --sage-soft: #e6f0d6; --sage-ink: #3d472b; --bad-soft: #fde0d7; --bad-ink: #8c2a12;
  --shadow: 0 1px 2px rgba(46, 43, 37, .05), 0 6px 18px rgba(46, 43, 37, .06);
  --shadow-lg: 0 14px 36px rgba(46, 43, 37, .14);
  --spring: cubic-bezier(.34, 1.56, .64, 1); --ease: cubic-bezier(.22, 1, .36, 1);
  --pad: 18px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1d1b18; --surface: #2a2722; --surface-2: #36322b; --text: #f5ead8; --muted: #c0b6a5;
  --line: rgba(245, 234, 216, .08); --line-strong: rgba(245, 234, 216, .2);
  --accent: #f6a06b; --primary: #f6a06b; --primary-press: #ffc6a5; --on-primary: #2b1709; --accent-soft: #402310; --accent-ink: #ffc6a5;
  --sage: #aebf92; --sage-soft: #272e1b; --sage-ink: #ccdbb2; --bad-soft: #3d1a12; --bad-ink: #ffb7a3;
  --shadow: 0 0 0 1px rgba(245, 234, 216, .05), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-lg: 0 0 0 1px rgba(245, 234, 216, .06), 0 14px 34px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; transition: background .3s; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; line-height: 1.08; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--primary-press); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary-press); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }

/* — type — */
.h1 { font-size: 30px; line-height: 1.05; letter-spacing: -0.035em; }
.display { font-size: clamp(34px, 9vw, 72px); line-height: 1; letter-spacing: -0.045em; }
.h3 { font-size: 20px; letter-spacing: -0.02em; }
.lead { font-size: 15px; line-height: 1.45; color: var(--muted); max-width: 52ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.label { font: 600 13px var(--font); color: var(--muted); letter-spacing: .02em; }
.tabular { font-variant-numeric: tabular-nums; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); min-width: 0; }
.between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.center-mobile { text-align: center; }

/* — shell — */
.app { display: flex; min-height: 100dvh; }
.main { flex: 1; min-width: 0; padding: max(14px, env(safe-area-inset-top)) var(--pad) calc(112px + env(safe-area-inset-bottom)); }
.page { max-width: 1080px; display: flex; flex-direction: column; gap: 20px; }
.wordmark { font: 700 23px/1 var(--display); letter-spacing: -0.04em; color: var(--text); text-decoration: none; }
.wordmark:hover { color: var(--text); }
.mhead { display: flex; align-items: center; gap: 10px; height: 48px; }
.mhead .wordmark { margin-right: auto; }

.sidebar { display: none; }
.side-brand { font-size: 26px; padding: 0 0 0 10px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-search-btn { width: 40px; height: 40px; flex: none; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s; }
.side-search-btn:hover { background: var(--accent-soft); color: var(--text); }
.side-search { height: 42px; border: 0; border-radius: 999px; background: var(--surface-2); display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--muted); font-size: 14px; cursor: pointer; }
.side-search span { flex: 1; text-align: left; }
.side-search kbd { font: 600 11px var(--font); padding: 3px 7px; border-radius: 8px; background: var(--surface); }
/* the list scrolls under a thin quiet bar (no native arrows) and only when the window is really short */
.side-nav { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 8px; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.side-nav:hover { scrollbar-color: var(--line-strong) transparent; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.side-nav:hover::-webkit-scrollbar-thumb { background: var(--line-strong); }
.side-group { display: flex; flex-direction: column; gap: 1px; }
.side-group + .side-group { padding-top: 8px; box-shadow: inset 0 1px 0 var(--line); }
.side-group:first-child { margin-top: 2px; }
.side-group-title { font: 600 12px var(--font); color: var(--muted); padding: 0 12px 4px; letter-spacing: .04em; text-transform: uppercase; }
.side-link { height: 36px; border-radius: 999px; display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--text); font: 500 15px var(--font); text-decoration: none; transition: background .15s; }
.side-link svg { color: var(--muted); }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-link[aria-current="page"] svg { color: currentColor; }
.side-create { position: relative; z-index: 20; }
.side-create > summary { list-style: none; cursor: pointer; justify-content: center; }
.side-create > summary::-webkit-details-marker { display: none; }
.side-create > summary::after { content: ''; width: 7px; height: 7px; margin: -4px 0 0 auto; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.side-create[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.side-create-menu { position: absolute; top: calc(100% + 8px); left: 0; right: 0; display: grid; gap: 4px; max-height: min(560px, calc(100dvh - 130px)); overflow-y: auto; padding: 8px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-lg); }
.create-menu-link { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 9px 10px; border-radius: 16px; color: var(--text); text-decoration: none; }
.create-menu-link svg { flex: none; margin-top: 2px; color: var(--muted); }
.create-menu-link span { display: grid; gap: 2px; min-width: 0; }
.create-menu-link b { font-size: 14px; line-height: 1.25; }
.create-menu-link small { color: var(--muted); font-size: 12px; line-height: 1.25; }
.create-menu-link:hover, .create-menu-link:focus-visible { background: var(--accent-soft); color: var(--text); }
.create-menu-link:hover svg, .create-menu-link:focus-visible svg { color: var(--accent-ink); }
.create-menu-main { padding: 11px 10px; background: var(--surface-2); }
.create-menu-group { display: grid; gap: 2px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.create-menu-group > strong { padding: 2px 10px 4px; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 22px; background: var(--surface-2); }
.side-user-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); text-decoration: none; }
.side-user-link:hover { color: var(--text); }
.side-user-text { flex: 1; min-width: 0; line-height: 1.2; display: flex; flex-direction: column; }
.side-user-text b { font: 600 14px var(--font); }
.side-user-text span { font-size: 12px; color: var(--muted); }

.tabbar {
  position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom));
  height: 66px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: center; padding: 0 6px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-lg);
}
.tab { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: none; transition: color .15s; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
.tab-ai {
  justify-self: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 999px; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 6px var(--bg), var(--shadow-lg); transition: transform .2s var(--spring), background .15s;
}
.tab-ai:hover { color: var(--on-primary); transform: scale(1.06); }
.tab-ai:active { transform: scale(.94); background: var(--primary-press); }

.subnav { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 999px; background: var(--surface-2); }
.subnav a { flex: 1; height: 38px; border-radius: 999px; display: grid; place-items: center; font: 500 14px var(--font); color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.subnav a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); color: var(--text); font-weight: 600; }

.topnav { display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 var(--pad); padding-top: env(safe-area-inset-top); }
.topnav .wordmark { margin-right: auto; }
.topnav-links { display: none; }
.landing { padding: 8px var(--pad) calc(112px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 28px; }

/* — buttons, chips, tags — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text); font: 600 15px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .15s var(--ease), box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-press); color: var(--on-primary); }
.btn-outline { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn-outline:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.btn-ink { background: var(--text); color: var(--bg); }
.btn-ink:hover { background: color-mix(in srgb, var(--text) 85%, var(--bg)); color: var(--bg); }
.btn-paper { background: var(--bg); color: var(--text); }
.btn-paper:hover { color: var(--text); background: var(--surface); }
.btn-soft { background: var(--surface-2); }
.btn-soft:hover { background: var(--accent-soft); color: var(--text); }
.btn-surface { background: var(--surface); box-shadow: var(--shadow); }
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; height: 44px; padding: 0; flex: none; }

.chip {
  flex: none; height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text);
  font: 500 14px var(--font); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; transition: background .15s;
}
.chip:hover { background: var(--accent-soft); color: var(--text); }
.chip-static { height: 32px; padding: 0 12px; font-size: 13px; cursor: default; }
.chip-static:hover { background: var(--surface-2); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-inline { display: none; }
.tag { display: inline-flex; align-items: center; align-self: flex-start; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); font: 600 12px var(--font); white-space: nowrap; }
.tag-accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag-sage { background: var(--sage-soft); color: var(--sage-ink); }
.tag-bad { background: var(--bad-soft); color: var(--bad-ink); }
.btn .tag { align-self: center; } /* a badge inside a button sits on its line, not at the top corner */
.tag-ink { height: 22px; padding: 0 8px; font-size: 11px; font-weight: 700; background: var(--text); color: var(--bg); }

/* — surfaces — */
.card { background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-list { padding: 4px 16px; }
.card.ink { background: var(--text); color: var(--bg); box-shadow: none; }
.card.ink .muted, .card.ink .label { color: inherit; opacity: .75; }
.card.sage { background: var(--sage-soft); box-shadow: none; }
.card.accent { background: var(--accent-soft); box-shadow: none; }
.card.sand { background: var(--surface-2); box-shadow: none; }
.card.empty { text-align: center; padding: 28px 18px; display: flex; flex-direction: column; gap: 4px; }
a.card { color: inherit; text-decoration: none; transition: transform .25s var(--ease); }
a.card:hover { transform: translateY(-3px); color: inherit; box-shadow: var(--shadow-lg); }
a.card:active { transform: scale(.98); }

.rows > * + * { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: inherit; text-decoration: none; min-width: 0; }
a.row:hover { color: inherit; }
a.row:hover .row-title { color: var(--accent-ink); }
.row-main { flex: 1; min-width: 0; }
.row-title { font: 600 15px/1.3 var(--font); display: flex; align-items: center; gap: 6px; }
.row-sub { font-size: 14px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 999px; flex: none; background: var(--sage); }
.dot.bad { background: var(--accent); }

.icon-tile { width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text); }
.icon-tile.accent, .icon-circle.accent { background: var(--accent-soft); color: var(--accent-ink); }
.icon-tile.sage { background: var(--sage-soft); color: var(--sage-ink); }
.icon-circle { width: 56px; height: 56px; border-radius: 999px; display: grid; place-items: center; flex: none; }
.avatar { text-decoration: none; width: 42px; height: 42px; border-radius: 999px; display: grid; place-items: center; flex: none; background: var(--sage-soft); color: var(--sage-ink); font: 600 17px var(--display); }
.avatar.sm { width: 38px; height: 38px; font-size: 16px; }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; }
.avatars { display: flex; }
.avatars > * { width: 34px; height: 34px; font-size: 13px; box-shadow: 0 0 0 3px var(--bg); }
.avatars > * + * { margin-left: -8px; }

.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service { border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.home-services { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.service-text { display: flex; flex-direction: column; gap: 2px; }
.service-text b { font: 600 15px/1.25 var(--font); }
.service-text small { font-size: 13px; line-height: 1.35; color: var(--muted); }

.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; font: 500 12px/1.2 var(--font); color: var(--text); text-decoration: none; text-align: center; }
.quick a > span { width: 60px; height: 60px; border-radius: 999px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); transition: transform .2s var(--spring); }
.quick a:hover > span { transform: scale(1.06); }
.quick a.primary > span { background: var(--primary); color: var(--on-primary); box-shadow: none; }

/* — ask — */
.ask { background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); padding: 16px 14px 12px 18px; display: flex; flex-direction: column; gap: 12px; }
.ask textarea { border: 0; background: transparent; resize: none; font: 400 16px/1.4 var(--font); min-height: 24px; field-sizing: content; max-height: 160px; padding: 0; box-shadow: none; }
/* the question box and the pill are fields of their own: no outline of the form controls further down */
.ask textarea:focus, .ask-pill input:focus { box-shadow: none; }
.ask textarea::placeholder, .ask-pill input::placeholder { color: var(--muted); }
.ask-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ask-pill { height: 56px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; padding: 0 6px 0 20px; }
.ask-pill input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; }

/* — forms — */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.seg button { flex: 1; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 500 14px var(--font); cursor: pointer; transition: background .15s, color .15s; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }
.switch { width: 48px; height: 28px; border: 0; border-radius: 999px; background: var(--surface-2); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); transition: transform .25s var(--spring), background .2s; }
.switch::before { content: ""; position: absolute; inset: -8px -2px; } /* a 44px tap target around the 28px switch */
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--on-primary); }
.dropzone { position: relative; border-radius: 28px; padding: 32px 20px; background: var(--surface); border: 2px dashed var(--line-strong); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone[data-over] { background: var(--accent-soft); border-color: var(--accent); }
.dropzone .icon-circle { width: 64px; height: 64px; transition: transform .25s var(--spring); }
.dropzone:hover .icon-circle { transform: translateY(-3px) scale(1.05); }
.select-pill { position: relative; height: 58px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); display: flex; align-items: center; padding: 0 20px; gap: 10px; }
.select-pill select { position: absolute; inset: 0; padding: 22px 20px 0; border: 0; border-radius: inherit; background: transparent; font: 600 15px var(--font); appearance: none; cursor: pointer; }
.select-label { position: absolute; top: 9px; left: 20px; font-size: 12px; color: var(--muted); }
.select-pill svg { margin-left: auto; pointer-events: none; }
.check-actions { display: flex; flex-direction: column; gap: 8px; }

/* — schedule — */
.days { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.day { height: 64px; border: 0; border-radius: 20px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; transition: background .15s; }
.day:hover { background: var(--surface-2); }
.day span { font-size: 12px; color: var(--muted); }
.day b { font-size: 18px; font-weight: 600; }
.day[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.day[aria-selected="true"] span { color: inherit; opacity: .85; }
.lesson { display: flex; gap: 14px; padding: 16px; border-radius: 24px; }
.lesson-time { width: 48px; flex: none; font-variant-numeric: tabular-nums; }
.lesson-time b { display: block; font: 600 16px var(--font); }
.lesson-time span { font-size: 14px; color: var(--muted); }
.lesson-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lesson-title { font: 600 16px/1.25 var(--font); }
.lesson-mini { padding: 14px; border-radius: 20px; display: flex; flex-direction: column; gap: 6px; }
.lesson-mini .lesson-title { font-size: 15px; }
.lesson-now { display: flex; gap: 16px; padding: 16px; margin: 0 -16px; border-radius: 22px; background: var(--accent-soft); }
.note { margin-top: 6px; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); font-size: 13px; }
.lesson-flat { padding: 0; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.week { display: none; }
.week-head { height: 56px; border-radius: 20px; background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; color: var(--muted); }
.week-head b { font: 600 22px var(--display); color: var(--text); }
.week-head.today { background: var(--primary); color: var(--on-primary); }
.week-head.today b { color: inherit; }
.week-empty { border-radius: 20px; padding: 22px 14px; text-align: center; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); font-size: 14px; }

/* — form controls (Django forms and the schedule pickers) — */
label, legend { font-weight: 600; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="date"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%; min-height: 48px; font: 400 16px var(--font); color: var(--text);
  background: var(--surface); border: 0; border-radius: 16px; padding: 12px 16px; box-shadow: inset 0 0 0 1.5px var(--line-strong);
  transition: box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:disabled { opacity: 0.6; }
textarea { resize: vertical; }
input[type="file"] { font: 400 14px var(--font); color: var(--muted); width: 100%; padding: 12px; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-strong); }
input[type="file"]::file-selector-button { font: 600 14px var(--font); margin-right: 12px; height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--primary); color: var(--on-primary); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 20px; height: 20px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; min-width: 0; }

/* — schedule page (static/schedule.js and static/combo.js draw into it) — */
.sch-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sch-top > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sch-top .h1 { overflow-wrap: anywhere; }
.pickers { display: grid; gap: 12px; }
.pickers label, .pickers .combo-field { display: grid; gap: 6px; }
.sch-steps { display: grid; gap: 12px; }
.sch-steps:empty { display: none; }
.pickers input:disabled { opacity: .5; cursor: not-allowed; }
.pickers input:not(:focus):not(:placeholder-shown):invalid { box-shadow: inset 0 0 0 2px var(--bad-ink); }
.pickers input.ready { animation: ready .9s var(--ease); }
@keyframes ready { 0% { box-shadow: inset 0 0 0 2px var(--accent); } 100% { box-shadow: inset 0 0 0 1.5px var(--line-strong); } }
.sch-seg { max-width: 320px; }
.day.today b::after { content: ""; display: block; width: 5px; height: 5px; margin: 2px auto 0; border-radius: 50%; background: var(--accent); }
.day[aria-selected="true"].today b::after { background: currentColor; }
.sch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.sch-list .lesson { animation: lesson-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.sch-list[data-dir="prev"] .lesson { animation-name: lesson-in-prev; }
.sch-list.no-anim .lesson { animation: none; }
@keyframes lesson-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes lesson-in-prev { from { opacity: 0; transform: translateX(-16px); } }
.lesson-where { font-size: 14px; color: var(--muted); }
.lesson.cancelled .lesson-title { text-decoration: line-through; color: var(--muted); }
.lesson.cancelled, .lesson.past { opacity: .55; }
.lesson.now { background: var(--accent-soft); box-shadow: none; }
.lesson.now .progress { background: var(--surface); margin-top: 6px; }
.l-status { margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.lesson.next .l-status { color: var(--muted); }
.note { white-space: pre-wrap; overflow-wrap: anywhere; }
.l-note-btn { align-self: flex-start; min-height: 32px; padding: 0; border: 0; background: none; color: var(--muted); font: 600 13px var(--font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.l-note-btn:hover { color: var(--text); }
.l-note-edit { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.l-note-edit textarea { flex-basis: 100%; }
.sch-empty { display: grid; gap: 10px; padding: 24px 18px; text-align: center; color: var(--muted); border-radius: 24px; box-shadow: inset 0 0 0 1.5px var(--line); }
.sch-empty span { height: 58px; border-radius: 20px; background: var(--surface-2); }
.sch-empty span:nth-child(3) { opacity: .6; }
.sch-empty span:nth-child(4) { opacity: .3; }
.sch-error { justify-items: center; }
.sch-loading span { background: linear-gradient(90deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.sch-off { padding: 40px 18px; }
.sch-col { min-width: 0; }
.sch-col > ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.sch-col .lesson { flex-direction: column; gap: 8px; padding: 14px; border-radius: 20px; }
.sch-col .lesson-time { width: auto; display: flex; gap: 6px; font-size: 13px; }
.sch-col .lesson-time b { font-size: 13px; font-weight: 500; color: var(--muted); }
.sch-col .lesson-time span::before { content: "– "; }
.sch-col .lesson-title { font-size: 15px; }
.uni-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.uni-chips .chip { height: 40px; }
.uni-chips small { color: var(--muted); font-size: 12px; }
.uni-chips .chip[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }

/* the dropdown of a text field (static/combo.js) */
.combo { position: relative; }
.combo input { padding-right: 44px; scroll-margin-top: 24px; }
.combo-clear { position: absolute; top: 50%; right: 6px; width: 36px; height: 36px; transform: translateY(-50%); border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.combo-clear:hover { background: var(--surface-2); color: var(--text); }
.combo-list { position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; right: 0; max-height: min(320px, 45vh); overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
.combo-list[hidden], .combo-list.empty { display: none; }
.combo-option { display: grid; gap: 2px; min-height: 44px; align-content: center; padding: 8px 14px; border-radius: 16px; cursor: pointer; }
.combo-option:hover, .combo-option[aria-selected="true"] { background: var(--accent-soft); }
.combo-value { font-weight: 600; }
.combo-value mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.combo-label { font-size: 13px; color: var(--muted); }
.combo-note { padding: 10px 14px; font-size: 14px; color: var(--muted); }

/* — messages and form errors — */
.ok-msg { font-size: 14px; color: var(--sage-ink); background: var(--sage-soft); padding: 12px 16px; border-radius: 16px; }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--bad-ink); font-size: 13px; font-weight: 600; }

/* — check and report — */
.select-pill select { width: 100%; min-height: 0; box-shadow: none; background: transparent; }
.dropzone-title { font-size: 17px; overflow-wrap: anywhere; }
.chip.on-surface { background: var(--surface); }
.howto summary { min-height: 32px; display: flex; align-items: center; gap: 12px; cursor: pointer; font: 600 13px var(--font); color: var(--accent-ink); }
.howto summary::after { content: ''; flex: none; width: 7px; height: 7px; margin: -3px 4px 0 auto; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); } /* shows that the line opens */
.howto[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.fold-ok > summary { padding: 8px 0; min-height: 44px; }
.howto p, .howto li { font-size: 14px; color: var(--text); }
.plain-list { margin: 6px 0 10px; padding-left: 18px; display: grid; gap: 6px; }
.report-row { align-items: flex-start; }
.report-row .dot { margin-top: 6px; }
.ai-explain { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 14px; }
.pre-line { white-space: pre-line; }
.bad-ink { color: var(--bad-ink); }
.break-anywhere { overflow-wrap: anywhere; }
.inline-form { display: contents; }
.plain-fieldset { display: contents; border: 0; margin: 0; padding: 0; min-width: 0; }
.dropzone:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.link-button { min-height: 32px; }
/* fingers: every control at least 44px tall, whatever the design's smaller sizes (38px chips and small buttons) */
@media (pointer: coarse) {
  .btn-sm, .chip, .seg button, .poll-option, .link-button, .l-note-btn, .howto summary, .ai-rate button, .ai-link { min-height: 44px; }
  .chip-x, .combo-clear { min-width: 44px; min-height: 44px; }
  .subnav a, .kind-seg label { min-height: 44px; }
  .site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
  a.label.link-accent { padding: 14px 0; margin: -14px 0; }
  .link-button, .l-note-btn { display: inline-flex; align-items: center; }
}

/* — «Помощник» (static/assistant.js draws the messages) — */
.chat-page { max-width: 820px; }
.chat-head { display: flex; gap: 12px; align-items: flex-start; }
.chat-head .icon-circle { width: 44px; height: 44px; }
.ai-chat { display: flex; flex-direction: column; gap: 12px; }
/* the log scrolls by itself above the fixed composer, so a streaming answer can keep its end in view */
/* the log is part of the page, which scrolls; the page keeps the fixed composer's height free at its end (components/ComposerSpace.tsx) */
.ai-log { display: flex; flex-direction: column; gap: 16px; overflow: visible; }
.main:has(.chat-page .composer) { padding-bottom: calc(var(--composer-h, 260px) + 16px); }
.main:has(.chat-page .composer) .site-footer { display: none; } /* a chat ends with its answer, not with the legal links */
/* no entrance animation on the chat: an animated transform makes it the frame of position: fixed, and the composer would scroll away */
.page > .ai-chat { animation: none !important; }
.chat-message { max-width: 64ch; font-size: 15px; line-height: 1.55; }
.chat-message.staff { align-self: flex-end; max-width: 80%; padding: 12px 16px; border-radius: 22px 22px 6px 22px; background: var(--text); color: var(--bg); line-height: 1.4; }
.chat-text { overflow-wrap: anywhere; }
.chat-text p + p, .chat-text p + ul, .chat-text ul + p, .chat-text p + ol, .chat-text ol + p, .chat-text .ai-table + p { margin-top: 8px; }
.chat-text ol { margin: 6px 0 0; padding-left: 24px; display: grid; gap: 4px; }
.ai-table { max-width: 100%; margin: 8px 0; overflow-x: auto; overflow-wrap: normal; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line-strong); }
.ai-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.4; }
.ai-table td { padding: 8px 12px; text-align: left; vertical-align: top; box-shadow: inset 0 -1px 0 var(--line); }
.ai-table tr:last-child td { box-shadow: none; }
.ai-table tr.head td { font-weight: 600; background: var(--surface-2); }
.chat-text ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
@keyframes ai-dots { 50% { opacity: .3; } }
.chat-text .ai-h { margin-top: 14px; font: 600 16px/1.35 var(--display); }
.chat-text .ai-h:first-child { margin-top: 0; }
.chat-text blockquote { margin: 10px 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.chat-text blockquote p + p { margin-top: 6px; }
.chat-text code { padding: 1px 6px; border-radius: 8px; background: var(--surface-2); font: 0.92em ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.chat-message.staff .chat-text code { background: color-mix(in srgb, var(--bg) 18%, transparent); }
/* the quiet row under the last answer: copy, again, change the question, rate; chips of follow-up questions below it */
.ai-act { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 0 0 0 -10px; font-size: 13px; color: var(--muted); }
.ai-act > button, .ai-act .ai-rate button { min-height: 44px; padding: 0 9px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 500 13px var(--font); cursor: pointer; }
.ai-act > button:hover, .ai-act .ai-rate button:hover { background: var(--accent-soft); color: var(--text); }
.ai-act .ai-rate { margin: 0; gap: 4px; }
.ai-act .ai-rate:not(:has(button)) { padding: 0 12px; }
.ai-follow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ai-follow .chip { min-height: 44px; height: auto; padding: 8px 16px; text-align: left; }
.ai-down { position: absolute; right: 14px; bottom: calc(100% + 6px); z-index: 2; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); font: 600 14px var(--font); cursor: pointer; }
.ai-down[hidden] { display: none; }
.ai-chat { position: relative; }
.ai-status { display: flex; align-items: center; gap: 8px; }
.ai-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: ai-dots 1s ease-in-out infinite; }
.ai-form .btn.is-stop { background: var(--text); color: var(--bg); }
.ai-link { display: inline-flex; align-items: center; min-height: 32px; margin: 2px 0; padding: 0 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.ai-error { margin-top: 6px; color: var(--muted); font-size: 14px; }
.ai-spent { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.ai-rate { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); }
.ai-rate button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text); font: 500 13px var(--font); cursor: pointer; }
.ai-rate button:hover { background: var(--accent-soft); }
.ai-offer { margin-top: 10px; }
.ai-form.ask-pill { height: auto; min-height: 54px; padding: 6px 6px 6px 20px; align-items: flex-end; }
.ai-form textarea { flex: 1; min-width: 0; min-height: 42px; max-height: 140px; padding: 10px 0; border: 0; box-shadow: none; background: transparent; resize: none; overflow-y: hidden; font-size: 16px; } /* 16px: no zoom on iPhone; assistant.js grows it */
.ai-form textarea:focus { box-shadow: none; }
.ai-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; }
.ai-model { display: inline-flex; align-items: center; gap: 6px; }
.ai-model select { min-height: 44px; max-width: 100%; padding: 6px 14px; border-radius: 99px; font: inherit; font-size: 14px; }
.ai-foot .link-button { white-space: nowrap; flex: none; min-height: 44px; }
@media (max-width: 959px) { /* one line on a phone: the model, the balance, a new chat */
  .ai-foot { flex-wrap: nowrap; gap: 6px; }
  .ai-model { flex: 0 1 auto; min-width: 0; font-size: 0; } /* the word «Модель» is in the select's label */
  .ai-model select { max-width: 150px; font-size: 14px; }
  .ai-foot [data-ai-left] { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) { .ai-status::before { animation: none; } }

/* — group, deadlines, tools — */
.new-post { padding: 0; box-shadow: none; background: none; }
.new-post > summary { list-style: none; display: inline-flex; }
.new-post > summary::-webkit-details-marker { display: none; }
.new-post[open] { padding: 18px; background: var(--surface); box-shadow: var(--shadow); }
.new-post[open] > summary { margin-bottom: 14px; }
.new-post fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.kind-seg { flex-wrap: wrap; }
.kind-seg label { flex: 1; min-height: 38px; display: grid; place-items: center; padding: 0 12px; border-radius: 999px; font: 500 14px var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 100; padding: 12px 20px; border-radius: 999px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); font-weight: 600; }
.skip:focus { top: 12px; }
.kind-seg label.on { background: var(--surface); box-shadow: var(--shadow); color: var(--text); font-weight: 600; }
.kind-seg label:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-foot { align-items: center; flex-wrap: wrap; }
.is-hidden { opacity: .6; }
.avatar.more { background: var(--surface-2); color: var(--text); font-size: 12px; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; min-width: 0; }
.push-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.timeline { margin: 0; padding: 0; list-style: none; }
.step-card { flex: 1; padding: 14px; border-radius: 20px; --gap: 8px; }
.step-actions { align-items: center; }
.tool-row { padding: 14px 0; }
.tool-row .row-title { font-size: 16px; }

/* — cabinet and plans — */
.cabinet-head { display: flex; align-items: center; gap: 16px; }
.avatar.xl { width: 64px; height: 64px; font-size: 26px; }
.plan-name { font: 600 24px/1.15 var(--display); letter-spacing: -0.02em; }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; box-shadow: inset 0 -1px 0 var(--line); }
.setting-row.column { flex-direction: column; align-items: stretch; gap: 8px; }
.setting-row:last-of-type { box-shadow: none; }
.btn-danger { box-shadow: inset 0 0 0 1.5px var(--bad-ink); color: var(--bad-ink); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad-ink); }
.danger-zone { box-shadow: inset 0 0 0 1.5px var(--bad-soft); }
.plan { gap: 12px; }
.plan .plan-features { list-style: none; padding: 0; margin: 0; flex: 1; gap: 10px; }
.plan .plan-features li { position: relative; padding-left: 26px; font-size: 14px; line-height: 1.4; font-weight: 400; }
.plan .plan-features li::before { content: ""; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--sage-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.4 2.4 4.6-5' fill='none' stroke='%233d472b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat; }
.plan.ink .plan-features li::before { background-color: rgba(255, 255, 255, .18); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.4 2.4 4.6-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.plan .plan-features li.plan-tokens { padding: 9px 12px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.plan .plan-features li.plan-tokens::before { content: none; }
.plan.ink .plan-features li.plan-tokens { background: rgba(255, 255, 255, .14); color: inherit; }
.plan.ink { box-shadow: var(--shadow-lg); }
.plan-price small { display: block; margin-top: 4px; font: 400 14px var(--font); color: var(--muted); }
.plan.ink .plan-price small { color: inherit; opacity: .75; }
.pay-form .check { gap: 8px; line-height: 1.35; }
.compare-card { padding: 0; background: none; box-shadow: none; }
.compare-card > summary { list-style: none; display: inline-flex; }
.compare-card > summary::-webkit-details-marker { display: none; }
.compare-wrap { margin-top: 12px; overflow-x: auto; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.compare { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { padding: 12px 14px; text-align: center; box-shadow: inset 0 -1px 0 var(--line); }
.compare th[scope="row"] { text-align: left; font-weight: 500; }
.compare thead th { font-weight: 600; }

/* — «Справка»: the «Было / Стало» sheet (components/GostDemo.tsx), steps, guides, survey — */
.gost-hero { display: grid; gap: 24px; align-items: center; }
.demo { position: relative; width: 100%; max-width: 480px; justify-self: center; padding: 56px 0 8px; }
.demo .seg { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 3; }
/* paddings are % of the width: 30/15/20 mm of a 210 mm page */
.sheet { position: relative; width: min(340px, 76%); margin: 0 auto; aspect-ratio: 210 / 297; background: #fff; color: #1b1b1b; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-lg); rotate: -2deg; container-type: inline-size; }
.sheet-page { height: 100%; padding: 7.14%; font-family: Calibri, Carlito, Arial, sans-serif; font-size: 2cqw; line-height: 1.15; transition: padding .9s var(--ease), font-size .6s var(--ease), line-height .6s var(--ease); }
.sheet-page h4 { font: 400 1em/1.15 inherit; letter-spacing: 0; margin: 0 0 .6em; text-align: left; transition: margin .5s; }
.sheet-page p { margin: 0 0 .7em; text-indent: 0; text-align: left; transition: text-indent .6s var(--ease), margin .6s var(--ease); }
.demo.s1 .sheet-page { padding: 9.52% 4.76% 9.52% 14.29%; }
.demo.s2 .sheet-page { font-family: "Times New Roman", Times, "Liberation Serif", serif; font-size: 2.35cqw; line-height: 1.5; }
.demo.s3 .sheet-page p { margin: 0; text-indent: 5.95cqw; text-align: justify; }
.demo.s3 .sheet-page h4 { font-weight: 700; text-transform: uppercase; text-align: center; margin-bottom: 1.5em; }
.sheet-guides { position: absolute; left: 14.29%; right: 4.76%; top: 6.73%; bottom: 6.73%; border: 1px dashed var(--accent); opacity: 0; transition: opacity .6s .4s; pointer-events: none; }
.demo.s1 .sheet-guides { opacity: .8; }
.pg { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); font: 2.35cqw "Times New Roman", Times, serif; opacity: 0; transition: opacity .5s; }
.demo.s4 .pg { opacity: 1; }
.stamp { position: absolute; right: 7%; top: 3.2%; font: 600 3.2cqw var(--display); color: #fff; background: #b2622d; border-radius: 999px; padding: .35em .9em; rotate: 6deg; opacity: 0; transform: scale(1.6); transition: opacity .3s, transform .5s var(--spring); }
.demo.s4 .stamp { opacity: 1; transform: none; }
.demo-chips { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; pointer-events: none; }
.demo-chips li { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface-2); font: 600 12px var(--font); white-space: nowrap; opacity: .35; transition: opacity .3s, background .3s; }
.demo-chips li::before { content: "✓"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); font-size: 12px; }
.demo.s1 .demo-chips li:nth-child(1), .demo.s2 .demo-chips li:nth-child(2), .demo.s2 .demo-chips li:nth-child(3),
.demo.s3 .demo-chips li:nth-child(4), .demo.s4 .demo-chips li:nth-child(5) { opacity: 1; background: var(--sage-soft); color: var(--sage-ink); }
.steps-row { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps-row li { --gap: 6px; }
.step-no { font: 600 36px/1 var(--display); letter-spacing: -0.04em; }
.guide-grid { display: grid; gap: 12px; }
.guide-card { --gap: 6px; transition: transform .25s var(--ease); }
.guide-card:hover { transform: translateY(-3px); }
.survey-card { display: grid; gap: 20px; }
.survey-card input, .survey-card select, .survey-card textarea { background: var(--bg); color: var(--text); }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { position: relative; min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; background: var(--surface-2); color: var(--text); font: 500 14px var(--font); cursor: pointer; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice label:has(input:checked) { background: var(--primary); color: var(--on-primary); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.plain-fieldset-block { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
/* an article's body is our own HTML from pages/guides.py */
.article { max-width: 820px; display: flex; flex-direction: column; gap: 14px; }
.article-body h2 { font-size: 21px; margin: 28px 0 8px; }
.article-body p, .article-body li { line-height: 1.65; }
.article-body p + p, .article-body ul, .article-body ol { margin-top: 10px; }
.article-body ul, .article-body ol { padding-left: 22px; }
/* «Поддержка»: one's own messages on the right in ink, the other side's on the left */
.support-chat { max-width: 760px; }
.support-msg { align-self: flex-start; max-width: 85%; padding: 12px 16px; border-radius: 22px 22px 22px 6px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.support-msg.mine { align-self: flex-end; border-radius: 22px 22px 6px 22px; background: var(--text); color: var(--bg); }
.support-msg .small { opacity: .7; }

/* — timeline (дедлайны, пары) — */
.timeline { display: flex; flex-direction: column; }
.step { display: flex; gap: 14px; padding-bottom: 18px; }
.step:last-child { padding-bottom: 0; }
.step-rail { width: 24px; display: flex; flex-direction: column; align-items: center; flex: none; }
.step-rail::after { content: ""; flex: 1; width: 2px; margin-top: 4px; background: var(--line); }
.step:last-child .step-rail::after { display: none; }
.step-dot { width: 24px; height: 24px; border-radius: 999px; box-shadow: inset 0 0 0 2px var(--line-strong); display: grid; place-items: center; flex: none; }
.step-dot.done { background: var(--sage-soft); color: var(--sage-ink); box-shadow: none; }
.step-dot.current { background: var(--primary); box-shadow: 0 0 0 5px var(--accent-soft); }
.step-body { flex: 1; min-width: 0; padding-top: 2px; }
.step-body.done .row-title { color: var(--muted); text-decoration: line-through; }
.segments { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.segments i { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 25%, transparent); }
.segments i.on { background: var(--accent); }

/* — group — */
.post-title { font: 600 17px/1.25 var(--font); letter-spacing: 0; }
.poll-option { position: relative; width: 100%; height: 42px; padding: 0; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; cursor: pointer; text-align: left; }
.poll-option > i { position: absolute; inset: 0 auto 0 0; background: var(--line-strong); transition: width .5s var(--ease); }
.poll-option[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.poll-option[aria-pressed="true"] > i { background: var(--accent-soft); }
.poll-option > span { position: relative; display: flex; justify-content: space-between; align-items: center; height: 100%; padding: 0 16px; font-size: 14px; }

/* — assistant — */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - 220px); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 16px; padding-bottom: 150px; }
.bubble-me { align-self: flex-end; max-width: 80%; padding: 12px 16px; border-radius: 22px 22px 6px 22px; background: var(--text); color: var(--bg); font-size: 15px; line-height: 1.4; }
.bubble-ai { display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.55; max-width: 64ch; }
.quote-card { padding: 12px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; }
.composer { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 12px 14px calc(100px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; background: linear-gradient(to bottom, transparent, var(--bg) 22%); }
.composer .chips { margin: 0; padding: 0; }

/* — landing / home — */
.hero { display: grid; gap: 24px; }
.hero-text { display: flex; flex-direction: column; gap: 16px; }
.features { display: flex; gap: 12px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 4px var(--pad) 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.feature { flex: none; width: 272px; min-height: 200px; scroll-snap-align: start; border-radius: 32px; padding: 22px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); transition: transform .25s var(--ease); }
.feature:hover { color: var(--text); transform: translateY(-4px); }
.feature p { font: 600 24px/1.1 var(--display); letter-spacing: -0.03em; text-wrap: balance; }
.feature .foot { margin-top: auto; font-size: 15px; }
.feature.accent { background: var(--accent-soft); } .feature.accent .label, .feature.accent .foot { color: var(--accent-ink); }
.feature.sage { background: var(--sage-soft); } .feature.sage .label, .feature.sage .foot { color: var(--sage-ink); }
.feature.sand { background: var(--surface-2); } .feature.sand .label, .feature.sand .foot { color: var(--muted); }
.price-strip { display: flex; align-items: center; gap: 14px; }
.price-strip b { display: block; font: 600 24px/1 var(--display); letter-spacing: -0.03em; }
.home-grid, .halves { display: grid; gap: 16px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plans { display: grid; gap: 12px; }
.plan-features { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.plan-price { font: 600 38px/1 var(--display); letter-spacing: -0.03em; white-space: nowrap; }

.link-accent { color: var(--accent-ink); text-decoration: none; }
.accent-ink { color: var(--accent-ink); }
.sage-ink { color: var(--sage-ink); }
.display-font { font-family: var(--display); font-weight: 600; }
.plain-link, .plain-link:hover { color: inherit; text-decoration: none; }
.progress.on-surface { background: var(--surface); margin-top: 6px; }
.lesson-now .lesson-time span { color: var(--accent-ink); }

/* — shell extras: notice, messages, footer, search, cookies — */
.badge-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--primary); flex: none; }
.tab { position: relative; }
.tab .badge-dot { position: absolute; top: 8px; left: calc(50% + 8px); }
.notice, .flash p { display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 16px; margin-bottom: 14px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; line-height: 1.4; }
.card.ink a:not(.btn) { color: inherit; text-decoration-color: currentColor; } /* a link on the dark card is light, not terracotta on black */
.token-pill { height: 36px; padding: 0 14px; font-size: 14px; text-decoration: none; align-self: center; }
@media (pointer: coarse) { .token-pill { height: 44px; } }
.notice p { flex: 1; }
.notice a { color: inherit; font-weight: 600; }
.flash { display: flex; flex-direction: column; }
.flash p { padding-right: 18px; background: var(--sage-soft); color: var(--sage-ink); font-weight: 500; }
.flash p.error { background: var(--bad-soft); color: var(--bad-ink); }
.site-footer { margin-top: 56px; padding-top: 20px; box-shadow: inset 0 1px 0 var(--line); display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--muted); max-width: 1080px; }
.site-footer nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.site-footer .legal { font-size: 12px; line-height: 1.5; opacity: .85; max-width: 80ch; }
.site-footer a, .link-button { color: var(--muted); text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible, .link-button:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.site-footer .legal a { text-decoration: underline; text-underline-offset: 3px; } /* a link inside a sentence must not rely on colour alone */
.link-button { border: 0; padding: 0; background: none; font: inherit; cursor: pointer; }
.palette { width: min(560px, calc(100vw - 24px)); max-height: min(560px, 80dvh); margin: 12vh auto auto; padding: 8px; border: 0; border-radius: 28px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.palette::backdrop { background: rgba(32, 30, 29, .35); }
.palette input { width: 100%; height: 52px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--surface-2); font-size: 16px; }
.palette ul { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; max-height: calc(min(560px, 80dvh) - 110px); }
.palette li a { display: flex; flex-direction: column; min-height: 44px; padding: 10px 14px; border-radius: 18px; color: var(--text); text-decoration: none; }
.palette li a span { font-size: 13px; color: var(--muted); }
.palette li a[aria-selected="true"], .palette li a:hover { background: var(--accent-soft); color: var(--text); }
.palette-empty { padding: 14px; color: var(--muted); }
.palette-hint { margin: 6px 14px 4px; font-size: 12px; color: var(--muted); }
.cookie-banner { position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(92px + env(safe-area-inset-bottom)); max-width: 520px; padding: 18px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Printing (the report's «Распечатать или сохранить в PDF»): black on white, no site chrome */
.print-only { display: none; }
@media print {
  :root, [data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #f2f2f2; --text: #000; --muted: #444; --line: #ccc; --line-strong: #000;
    --sage-ink: #0a6b33; --sage-soft: #fff; --bad-ink: #b0101c; --bad-soft: #fff; --accent-ink: #7a4300; --accent-soft: #fff; color-scheme: light; }
  body { background: #fff; }
  .sidebar, .tabbar, .subnav, .site-footer, .cta, .flash, .notice, .cookie-banner, .no-print { display: none !important; }
  .print-only { display: block; margin-top: 12px; font-size: 12px; color: var(--muted); }
  .main { padding: 0; }
  .tile, .panel { padding: 0; box-shadow: none; }
  .report { display: block; }
  .rows > div { break-inside: avoid; border: 1px solid var(--line); }
  .pill { border: 1px solid currentColor; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
/* — motion: умеренно, и только если пользователь не просил меньше — */
@media (prefers-reduced-motion: no-preference) {
  .page > *, .landing > * { animation: rise .5s var(--ease) both; }
  .page > :nth-child(2), .landing > :nth-child(2) { animation-delay: .04s; }
  .page > :nth-child(3), .landing > :nth-child(3) { animation-delay: .08s; }
  .page > :nth-child(4), .landing > :nth-child(4) { animation-delay: .12s; }
  .page > :nth-child(n + 5), .landing > :nth-child(n + 5) { animation-delay: .16s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* — polish: one look for the controls the browser would draw itself, quiet loading, the document panel's menu — */
select:not([multiple]) { appearance: none; padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a8174' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 18px center; }
.select-pill select { background-image: none; }
.skeleton { border-radius: 20px; min-height: 18px; background: linear-gradient(90deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.title { height: 44px; width: min(420px, 70%); border-radius: 16px; }
.skeleton.line { height: 16px; width: min(560px, 90%); border-radius: 8px; }
.skeleton.block { height: 160px; border-radius: 28px; }
.score { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.score-num { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.score-num b { font: 600 56px/1 var(--display); letter-spacing: -0.04em; }
.score-num span { font-size: 16px; }
.score .progress { background: color-mix(in srgb, var(--text) 10%, transparent); height: 8px; }
.score.sage .progress > i { background: var(--sage); }
.check-groups { display: flex; flex-direction: column; gap: 12px; }
.check-groups .chips-wrap { margin-top: 6px; }
.ai-doc-actions > .ai-more { position: relative; display: block; min-height: 0; } /* a plain block: <details> does not take flex in every WebKit */
.ai-more > summary { list-style: none; cursor: pointer; }
.ai-more > summary::-webkit-details-marker { display: none; }
.ai-more-list { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; min-width: 220px; padding: 6px; display: flex; flex-direction: column; gap: 2px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); }
.ai-more-list > * { width: 100%; justify-content: flex-start; background: transparent; }
.ai-more-list > :hover { background: var(--accent-soft); }
.ai-more-list > [hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .ai-doc:not([hidden]) { animation: doc-in .32s var(--ease) both; }
  .chat-message { animation: rise .35s var(--ease) both; }
}
@keyframes doc-in { from { opacity: 0; transform: translateX(28px); } }

/* — tablet — */
@media (min-width: 600px) {
  .services { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* — desktop — */
@media (min-width: 960px) {
  :root { --pad: 56px; }
  .sidebar { display: flex; position: sticky; top: 0; height: 100dvh; width: 264px; flex: none; flex-direction: column; gap: 12px; padding: 18px 14px 12px; background: var(--surface); box-shadow: inset -1px 0 0 var(--line); }
  .side-user { padding: 6px 8px 6px 10px; }
  .side-user-link { min-height: 48px; }
  .side-user-text span { font-size: 12px; line-height: 1.25; }
}
/* a short window (a laptop with page zoom): the same panel, a little tighter, so it still needs no scrolling */
@media (min-width: 960px) and (max-height: 820px) {
  .sidebar { gap: 8px; padding-top: 12px; }
  .side-link { height: 32px; font-size: 14px; }
  .side-group + .side-group { padding-top: 5px; }
  .side-nav { gap: 5px; }
  .sidebar .btn { height: 40px; }
}
@media (min-width: 960px) {
  .main { padding: 44px var(--pad) 64px; }
  .tabbar, .subnav, .mobile-only { display: none !important; }
  .page { gap: 28px; }
  .h1 { font-size: 48px; letter-spacing: -0.045em; }
  .h3 { font-size: 22px; }
  .lead { font-size: 17px; }
  .card { padding: 24px; border-radius: 32px; }
  .card-list { padding: 8px 24px; }
  .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .chips-inline { display: flex; }
  .chips-inline + span + .btn, .ask-bar .chips-inline ~ .btn { flex: none; }
  .services { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
  .service { padding: 16px; border-radius: 24px; gap: 14px; }
  .home-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
  .halves { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .dayview { display: none; }
  .week, .sch-week { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: start; }
  #sch-days { display: none; }
  .check-actions { flex-direction: row; }
  .center-mobile { text-align: left; }
  .dropzone { padding: 44px 24px; }
  .plans { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; }
  .topnav { height: 76px; gap: 32px; }
  .topnav .wordmark { margin-right: 0; font-size: 26px; }
  .topnav-links { display: flex; gap: 4px; margin-right: auto; }
  .topnav-links a { height: 40px; padding: 0 16px; border-radius: 999px; display: grid; place-items: center; font: 500 15px var(--font); color: var(--text); text-decoration: none; }
  .topnav-links a:hover { background: var(--surface-2); }
  .topnav .btn-ink { margin-left: -20px; }
  .landing { padding: 40px var(--pad) 72px; gap: 56px; max-width: 1440px; }
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 56px; align-items: center; }
  .hero-text { gap: 24px; }
  .hero .lead { font-size: 19px; max-width: 46ch; }
  .features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; overflow: visible; margin: 0; padding: 0; }
  .feature { width: auto; min-height: 220px; padding: 26px; }
  .feature p { font-size: 28px; }
  .chat-log { padding-bottom: 140px; }
  .cookie-banner { left: 288px; bottom: 24px; }
  .gost-hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); padding: 40px; }
  .steps-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .survey-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); padding: 40px; align-items: start; }
  .composer { left: 264px; padding: 16px var(--pad) 24px; max-width: calc(1080px + 2 * var(--pad) + 264px); }
}

/* the helper's files and the cards of its tools (static/assistant.js) */
.attach-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.attach-btn:hover { background: var(--accent-soft); color: var(--text); }
.ai-form.ask-pill { padding-left: 8px; }
.ai-files:empty { display: none; }
.ai-files { flex-wrap: wrap; overflow: visible; }
.chip-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow-wrap: anywhere; cursor: default; }
.chip-x { width: 28px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: 600 18px var(--font); cursor: pointer; }
.chip-x:hover { background: var(--accent-soft); }
.chat-file { margin-top: 6px; opacity: .75; font-size: 13px; overflow-wrap: anywhere; }
.ai-cards { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 8px; }
.ai-cards:empty { display: none; }
.ai-status { margin: 0; color: var(--muted); font-size: 14px; }
.ai-card { max-width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; border-radius: 20px; background: var(--surface-2); font-size: 14px; }
.ai-card .plain-list { margin: 0; }
.ai-card .ai-source { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* a document the helper wrote: a tile in the answer and the panel that opens with it (static/assistant.js).
   Phone and narrow screens: a sheet over the page with a «back to chat» button; from 1200px a column beside the chat, which shrinks to make room. */
.ai-doc-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 100%; min-height: 56px; margin: 8px 0; padding: 12px 18px; border: 0; border-radius: 20px; background: var(--surface-2); color: var(--text); font: 600 15px var(--font); text-align: left; cursor: pointer; }
.ai-doc-tile:hover { background: var(--accent-soft); }
.ai-doc-tile small { color: var(--muted); font: 400 13px var(--font); }
.ai-doc { position: fixed; z-index: 60; inset: 0; display: flex; flex-direction: column; background: var(--surface); }
.ai-doc[hidden] { display: none; }
.ai-doc-head { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 14px 8px; }
.ai-doc-head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 600 17px/1.25 var(--display); }
.ai-doc-head > .ai-more { position: relative; flex: none; }
.ai-doc-head > .ai-more > summary { display: inline-flex; align-items: center; min-height: 44px; }
.ai-doc-head .ai-more-list { left: auto; right: 0; }
.ai-doc-head strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ai-d { display: none; }
.ai-doc-back { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text); font: 600 15px var(--font); cursor: pointer; }
.ai-doc-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 10px; border-bottom: 1px solid var(--line); } /* wraps: a button off the edge of a row nobody can scroll is a button nobody finds */
.ai-doc-actions:not(:has(> :not([hidden]))) { display: none; } /* nothing to offer yet: no empty bar */
.ai-doc-actions > * { flex: none; min-height: 44px; display: inline-flex; align-items: center; }
.chip.primary { background: var(--primary); color: var(--on-primary); }
.ai-doc-body, .ai-doc-editor { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.ai-doc-body[hidden], .ai-doc-editor[hidden], .ai-doc-toolbar[hidden], .ai-doc-count[hidden] { display: none; }
.ai-doc-toolbar { display: flex; gap: 8px; padding: 8px 14px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.ai-doc-toolbar > * { flex: none; min-height: 44px; display: inline-flex; align-items: center; }
.ai-doc-toolbar > [hidden] { display: none; }
.ai-doc-count { margin: 0; padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.ai-doc-body h2, .ai-doc-body h3, .ai-doc-body h4 { margin: 18px 0 8px; font-family: var(--display); }
.ai-doc-body p { margin: 0 0 10px; line-height: 1.6; }
.ai-doc-editor { width: 100%; box-sizing: border-box; resize: none; border: 0; outline: 0; background: var(--surface); color: var(--text); font: 400 16px/1.6 var(--font); } /* 16px: a phone does not zoom in on focus */
.ai-doc.writing .ai-doc-body::after { content: '▍'; color: var(--accent); }
@media (min-width: 1200px) {
  .ai-doc { --doc-w: min(640px, 46vw); inset: 0 0 0 auto; width: var(--doc-w); box-shadow: var(--shadow-lg); }
  .ai-doc-back { order: 2; min-width: 44px; padding: 0; justify-content: center; font-size: 22px; }
  .ai-m { display: none; }
  .ai-d { display: inline; }
  .ai-doc-head { padding-top: 16px; }
  .ai-doc-body, .ai-doc-editor { padding: 22px 28px 32px; }
  body.doc-open .main { margin-right: min(640px, 46vw); }
  body.doc-open .composer { right: min(640px, 46vw); max-width: none; }
}

/* small helpers that replace one-off style="" attributes in templates */
.apart { margin-top: 12vh; }
.grow { flex: 1; }
.gap-top { margin-top: 28px; }
/* a checkbox or radio with its label is one 44px tap target */
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }

/* requirements of one university (pages/requirements.html) */
.req-list { display: grid; gap: 8px; margin: 16px 0; }
.req-list > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 12px 16px; border-radius: 20px; background: var(--surface-2); }
.req-list dt { color: var(--muted); }
.req-list dd { margin: 0; font-weight: 600; }

/* the list of the helper's chats (frontend/components/ChatRow.tsx) */
.chat-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.chat-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding: 8px 8px 2px 16px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.chat-row-link { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; min-height: 44px; justify-content: center; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.chat-row .chip { min-height: 44px; padding: 0 12px; background: transparent; color: var(--muted); font-size: 14px; } /* quiet: the row is for opening, rename and delete are the rare ones */
.chat-row .chip:hover { background: var(--accent-soft); color: var(--text); }
.chat-row .chip:first-of-type { margin-left: auto; }
.chat-filter { width: 100%; min-height: 48px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 16px; }

/* a presentation in the panel: its slides as cards, and what our check says about them */
/* the three colour themes of a deck, the same colours as checks/slides_writer.py THEMES */
.ai-doc-body[data-theme] { --s-bg: #F7F0E6; --s-ink: #2A2420; --s-muted: #6B5F55; --s-accent: #B2622D; --s-soft: #EADFCE; --s-on: #fff; }
.ai-doc-body[data-theme="ocean"] { --s-bg: #fff; --s-ink: #14233B; --s-muted: #51607A; --s-accent: #1F5FA8; --s-soft: #E6EEF8; --s-on: #fff; }
.ai-doc-body[data-theme="night"] { --s-bg: #1E1C1B; --s-ink: #F4EEE6; --s-muted: #BDB3A8; --s-accent: #E39A68; --s-soft: #2D2A28; --s-on: #1E1C1B; }
.ai-doc-actions .ai-doc-theme { flex: 0 0 auto; width: auto; max-width: 100%; min-height: 44px; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; }
.ai-slide { margin: 0 0 12px; padding: 16px 18px 16px 24px; border-radius: 20px; background: var(--surface-2); position: relative; overflow: hidden; }
.ai-slide small { color: var(--muted); }
.ai-slide h3 { margin: 4px 0 8px; font: 600 18px var(--display); }
.ai-slide-point { margin: 0 0 6px; padding-left: 14px; position: relative; }
.ai-slide-point::before { content: '•'; position: absolute; left: 0; color: var(--accent); }
[data-theme] .ai-slide { background: var(--s-bg); color: var(--s-ink); box-shadow: inset 8px 0 0 var(--s-accent); }
[data-theme] .ai-slide small { color: var(--s-muted); }
[data-theme] .ai-slide h3 { color: inherit; }
[data-theme] .ai-slide-point::before { color: var(--s-accent); }
[data-theme] .ai-slide.cover { box-shadow: none; padding-top: 22px; }
[data-theme] .ai-slide.cover h3 { font-size: 22px; }
[data-theme] .ai-slide.cover::after { content: ''; position: absolute; right: -28px; bottom: -28px; width: 110px; height: 110px; border-radius: 50%; background: var(--s-accent); }
[data-theme] .ai-slide.cover .ai-slide-point { color: var(--s-muted); padding-left: 0; }
[data-theme] .ai-slide.cover .ai-slide-point::before { content: none; }
[data-theme] .ai-slide.closing { background: var(--s-accent); color: var(--s-on); box-shadow: none; text-align: center; padding: 28px 18px; }
[data-theme] .ai-slide.closing small { color: var(--s-on); opacity: .8; }
[data-theme] .ai-slide.closing .ai-slide-point::before { content: none; }
[data-theme] .ai-slide.concl { counter-reset: concl; }
[data-theme] .ai-slide.concl .ai-slide-point { counter-increment: concl; margin: 0 0 8px; padding: 10px 12px 10px 46px; border-radius: 14px; background: var(--s-soft); }
[data-theme] .ai-slide.concl .ai-slide-point::before { content: counter(concl); left: 10px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--s-accent); color: var(--s-on); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.ai-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.ai-stat { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px; background: var(--surface); }
.ai-stat b { font: 700 26px var(--display); color: var(--accent); }
[data-theme] .ai-stat { background: var(--s-soft); }
[data-theme] .ai-stat b { color: var(--s-accent); }
.ai-slide.with-photo { display: flow-root; }
.ai-slide-photo { float: right; width: 38%; margin: 0 0 8px 12px; }
.ai-slide-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; }
.ai-slide-photo-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ai-slide-photo .chip { min-height: 44px; font-size: 14px; }
.ai-slide-draw { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 10px; aspect-ratio: 4 / 3; box-sizing: border-box; border: 1.5px dashed var(--line); border-radius: 14px; overflow: hidden; }
.ai-slide-draw-text { margin: 0; font-size: 13px; line-height: 1.35; color: var(--muted); flex: 1; overflow: hidden; }
[data-theme] .ai-slide-draw { border-color: var(--s-muted); }
[data-theme] .ai-slide-draw-text { color: var(--s-muted); }
.ai-slide-draw-wait { margin: 0; font-size: 13px; color: var(--accent-ink); animation: ai-pulse 1.4s ease-in-out infinite; }
@keyframes ai-pulse { 50% { opacity: .45; } }
[data-theme] .ai-slide-draw-wait { color: var(--s-accent); }
.ai-slide-error { margin: 6px 0 0; font-size: 13px; color: var(--danger, #c0392b); }
[data-theme] .ai-slide.cover.with-photo::after { content: none; }
.ai-slide-note { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; font-style: italic; color: var(--muted); }
[data-theme] .ai-slide-note { color: var(--s-muted); border-top-color: var(--s-muted); }
.ai-check { margin: 12px 0 0; padding: 14px 16px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.ai-check p { margin: 6px 0 0; }

/* the modes of the helper as tiles over the empty chat (frontend/components/ModeTiles.tsx) */
.mode-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mode-tile { display: flex; flex-direction: column; gap: 6px; min-height: 120px; padding: 16px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.mode-tile:hover { background: var(--accent-soft); color: var(--text); }
.mode-tile strong { font: 600 16px var(--display); }
@media (min-width: 960px) { .mode-tiles { grid-template-columns: repeat(5, 1fr); } }
.mode-tiles[hidden] { display: none; }

/* the assistant's «Create» workspace: scenarios first, prompt details only when needed */
.create-panel { display: grid; gap: 16px; margin: 18px 0 8px; padding: 20px; }
.create-panel-head, .create-builder-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.create-panel-head h2, .create-builder-title h3 { margin: 0 0 4px; }
.eyebrow { margin: 0 0 4px; color: var(--accent-ink); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.create-scenarios { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.create-scenario { display: flex; min-height: 132px; flex-direction: column; align-items: flex-start; gap: 7px; padding: 14px; border: 1.5px solid transparent; border-radius: 22px; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.create-scenario:hover, .create-scenario.on { border-color: var(--accent); background: var(--accent-soft); }
.create-scenario strong { font: 600 15px var(--display); }
.create-builder { display: grid; gap: 12px; padding-top: 4px; }
.create-builder label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.create-builder input, .create-builder select { min-height: 48px; }
.create-preview { padding: 14px 16px; border-radius: 18px; background: var(--surface-2); }
.create-preview p { margin: 6px 0 0; line-height: 1.5; }
.create-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-doc-rich-editor { flex: 1; min-height: 0; overflow-y: auto; margin: 12px 16px 24px; padding: 28px 30px; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); outline: 0; font: 400 16px/1.7 var(--font); }
.ai-doc-rich-editor:focus { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.ai-doc-rich-editor h1, .ai-doc-rich-editor h2, .ai-doc-rich-editor h3 { font-family: var(--display); line-height: 1.25; }
.ai-doc-rich-editor blockquote { margin: 12px 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.ai-doc-rich-editor li { margin: 4px 0; }
@media (max-width: 959px) { .create-scenarios { grid-template-columns: repeat(2, minmax(0, 1fr)); } .create-scenario:last-child { grid-column: span 2; } .ai-doc-rich-editor { margin: 8px 10px 18px; padding: 20px 18px; } }
@media (min-width: 960px) and (max-width: 1199px) { .create-scenarios { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* «Библиотека» (frontend/app/assistant/library): search over the documents and the pages of the list */
.library-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.library-search input { flex: 1 1 220px; border-radius: 999px; padding: 0 20px; }
.library-search select { flex: 0 1 190px; width: auto; border-radius: 999px; }
.chat-row select.chip { min-height: 44px; width: auto; border-radius: 999px; padding: 0 16px; }
.pager { display: flex; gap: 8px; justify-content: center; }
.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; }
/* a long project title must not push the select out of the card on a phone */
.chat-row select.chip { max-width: 100%; flex: 1 1 160px; }

/* — drop-down lists: one look for every <select> on the site —
   The field: the same pill-soft shape as the other inputs, one arrow of the theme's colour, room for it on the right.
   The list that opens: where the browser can style it (appearance: base-select, Chrome and Edge 135+) it is a soft card with
   rounded rows like the rest of the site; elsewhere it stays the system's list, but in the colours of the theme (color-scheme). */
select:not([multiple]) {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23645c50' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; background-size: 14px;
}
[data-theme="dark"] select:not([multiple]) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c0b6a5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
select:not([multiple]):disabled { cursor: not-allowed; opacity: .6; }
select option, select optgroup { background: var(--surface); color: var(--text); font: 400 16px var(--font); }
.chat-row select.chip { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23645c50' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 12px; padding-right: 36px; }
[data-theme="dark"] .chat-row select.chip { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c0b6a5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.select-pill select:not([multiple]) { background-image: none; }

@supports (appearance: base-select) {
  select:not([multiple]), select:not([multiple])::picker(select) { appearance: base-select; }
  select:not([multiple]) { background-image: none !important; align-items: center; }
  select:not([multiple])::picker-icon {
    content: ''; width: 14px; height: 14px; margin-left: auto; background: currentColor; opacity: .7;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23645c50' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23645c50' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; transition: rotate .2s var(--ease);
  }
  .select-pill select::picker-icon { display: none; }
  select:not([multiple]):open::picker-icon { rotate: 180deg; }
  select:not([multiple])::picker(select) {
    margin-block: 6px; padding: 6px; border: 0; border-radius: 20px; max-height: min(320px, 50vh);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg), inset 0 0 0 1.5px var(--line-strong);
    opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s var(--ease), display .15s allow-discrete, overlay .15s allow-discrete;
  }
  select:not([multiple])::picker(select):popover-open { opacity: 1; transform: none; }
  @starting-style { select:not([multiple])::picker(select):popover-open { opacity: 0; transform: translateY(-4px); } }
  select:not([multiple]) option {
    display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 14px; border-radius: 14px; background: transparent;
    font: 400 16px var(--font); color: var(--text); cursor: pointer; transition: background .12s;
  }
  select:not([multiple]) option:hover, select:not([multiple]) option:focus-visible { background: var(--accent-soft); outline: none; }
  select:not([multiple]) option:checked { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
  select:not([multiple]) option::checkmark { display: none; }
  select:not([multiple]) option:disabled { opacity: .5; cursor: not-allowed; background: transparent; }
}

/* fewer or no animations for whoever asked the system for it */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }

/* ask in place (ConfirmButton), inline rename and the preview of a mode's question */
.confirm-ask { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
.chat-row .confirm-ask .chip:first-of-type { margin-left: 0; }
.chat-row .chip.btn-danger { color: var(--bad-ink); }
.chat-rename { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-bottom: 6px; }
.chat-rename input { flex: 1 1 200px; min-width: 0; }
.chat-row-snippet { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mode-preview { margin: 0; padding: 12px 16px; border-radius: 20px; background: var(--surface-2); white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; }

.fine-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; }
