/* Free Student: сливово-фіолетовий акцент у тон логотипа, жовтий і сіро-синій як допоміжні. Світла й темна теми. */
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-Bold.woff") format("woff"); font-weight: 700 800; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f7f5f9;
  --surface: #ffffff;
  --surface-2: #f6f3f8;
  --surface-3: #ede7f1;
  --ink: #221a29;
  --muted: #645a6e;
  --faint: #a097a9;
  --line: #ece6f0;
  --line-strong: #dbd2e1;
  --primary: #7b2a6b;
  --primary-hover: #66215a;
  --primary-soft: #f7ecf4;
  --primary-soft-2: #edd6e7;
  --primary-ink: #ffffff;
  --primary-text: #70245f;
  --grad: linear-gradient(135deg, #8a2f78 0%, #6a2160 55%, #4b1a4a 100%);
  --info: #4e7090;
  --info-soft: #eaf0f6;
  --accent: #f2c94c;
  --accent-hover: #e9bd36;
  --accent-soft: #fdf5dc;
  --accent-text: #7a5c00;
  --accent-ink: #2a2100;
  --bad-soft: #fdf3d6;
  --bad-line: #efd07c;
  --bad-text: #7a5c00;
  --overlay: rgba(25, 14, 28, .45);
  --shadow-sm: 0 1px 2px rgba(40, 16, 40, .04);
  --shadow: 0 1px 2px rgba(40, 16, 40, .04), 0 10px 28px rgba(60, 20, 60, .06);
  --shadow-lg: 0 24px 60px rgba(40, 16, 40, .2);
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141118; --surface: #1c1820; --surface-2: #241f29; --surface-3: #2e2834;
  --ink: #efe9f2; --muted: #b2a8ba; --faint: #786f81; --line: #2f2935; --line-strong: #41394b;
  --primary: #d892c7; --primary-hover: #e6add8; --primary-soft: #33202f; --primary-soft-2: #4b2d45; --primary-ink: #1a0f17; --primary-text: #ecb6de;
  --grad: linear-gradient(135deg, #a8458f 0%, #7b2a6b 60%, #4b1a4a 100%);
  --info: #8fb1d1; --info-soft: #1d2631;
  --accent: #e3bf57; --accent-hover: #edcc6c; --accent-soft: #2f2816; --accent-text: #f0d27a; --accent-ink: #1c1600;
  --bad-soft: #352d17; --bad-line: #6e5a24; --bad-text: #f0d27a;
  --overlay: rgba(0, 0, 0, .6);
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  --bg: #141118; --surface: #1c1820; --surface-2: #241f29; --surface-3: #2e2834;
  --ink: #efe9f2; --muted: #b2a8ba; --faint: #786f81; --line: #2f2935; --line-strong: #41394b;
  --primary: #d892c7; --primary-hover: #e6add8; --primary-soft: #33202f; --primary-soft-2: #4b2d45; --primary-ink: #1a0f17; --primary-text: #ecb6de;
  --grad: linear-gradient(135deg, #a8458f 0%, #7b2a6b 60%, #4b1a4a 100%);
  --info: #8fb1d1; --info-soft: #1d2631;
  --accent: #e3bf57; --accent-hover: #edcc6c; --accent-soft: #2f2816; --accent-text: #f0d27a; --accent-ink: #1c1600;
  --bad-soft: #352d17; --bad-line: #6e5a24; --bad-text: #f0d27a;
  --overlay: rgba(0, 0, 0, .6);
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15.5px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; overflow-x: clip; }
a { color: var(--primary-text); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: 30px; }
h2 { font-size: 20px; letter-spacing: -.015em; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- каркас */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; letter-spacing: -.02em; position: relative; overflow: hidden; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--accent); }
.brand-mark.big { width: 64px; height: 64px; border-radius: 18px; font-size: 24px; }
.brand-mark.big::after { height: 10px; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.15; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 6px 16px -6px rgba(123, 42, 107, .55); }
.nav .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.me-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.me-role { font-size: 12px; color: var(--muted); }
.side-tools { display: flex; gap: 6px; }
.side-tools .btn { flex: 1; }
.topbar { display: none; }
.main { padding: 34px clamp(16px, 4vw, 52px) 72px; max-width: 1160px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.crumbs { font-size: 13px; color: var(--faint); margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary-text); }

@media (max-width: 880px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .shell.menu-open .side { transform: none; }
  .shell.menu-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 30; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .main { padding-top: 22px; }
  h1 { font-size: 25px; }
}

/* ---------- елементи */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid > .card + .card, .grid > * + * { margin-top: 0; }
.card-title { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; min-height: 40px; font-weight: 600; font-size: 14.5px; cursor: pointer; background: var(--primary); color: var(--primary-ink); text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--primary-soft); color: var(--primary-text); }
.btn.soft:hover { background: var(--primary-soft-2); }
.btn.danger { background: transparent; color: var(--muted); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.yellow { background: var(--accent); color: var(--accent-ink); }
.btn.yellow:hover { background: var(--accent-hover); }
.btn.sm { padding: 5px 12px; min-height: 32px; font-size: 13px; border-radius: 9px; }
.btn.icon { padding: 6px; min-width: 36px; min-height: 36px; }
.btn.sm.icon { min-width: 32px; min-height: 32px; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 10px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok, .pill.brand { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad-text); border-color: var(--bad-line); }
.pill.warn, .pill.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.pill.dark { background: var(--ink); color: var(--surface); border-color: transparent; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface); color: var(--ink); font-weight: 400; font-size: 15px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; min-height: 220px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
::placeholder { color: var(--faint); }
.form-grid { display: grid; gap: 14px; align-items: end; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s ease; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 6px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { font-size: 13px; color: var(--muted); }
a.list-item { color: inherit; text-decoration: none; border-radius: 10px; }
a.list-item:hover { background: var(--surface-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line-strong); }
.dot.ok { background: var(--primary); } .dot.bad { background: var(--ink); } .dot.warn { background: var(--accent); }

table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; padding: 30px 14px; color: var(--muted); }
.notice { border-radius: var(--radius-sm); padding: 13px 16px; background: var(--primary-soft); color: var(--primary-text); font-size: 14px; }
.notice.warn, .notice.bad { background: var(--accent-soft); color: var(--accent-text); }
.notice.ok { background: var(--primary-soft); color: var(--primary-text); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 11px 20px; border-radius: 99px; font-size: 14px; font-weight: 500; z-index: 100; box-shadow: var(--shadow-lg); animation: toast-in .2s ease; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--accent); color: var(--accent-ink); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

dialog.modal { border: none; border-radius: 22px; padding: 0; width: min(580px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); color: var(--ink); background: var(--surface); }
dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-body { padding: 18px 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 14px; white-space: pre-wrap; font-size: 14px; }

/* ---------- мої дані: узгоджені форми профілю й пароля */
.profile-page { width: 100%; max-width: 960px; margin-inline: auto; }
.profile-grid { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 24px; align-items: stretch; }
.profile-form { display: flex; flex-direction: column; gap: 24px; min-width: 0; margin: 0; padding: 28px; }
.profile-form .card-title { margin: 0; color: var(--ink); font-size: 18px; line-height: 1.35; font-weight: 600; }
.profile-form-fields { display: grid; gap: 20px; }
.profile-form label.field { gap: 8px; font-size: 14px; line-height: 1.45; }
.profile-form input, .profile-form select { width: 100%; height: 48px; padding: 11px 14px; font-size: 16px; line-height: 24px; }
.profile-form-actions { display: grid; gap: 16px; margin-top: auto; padding-top: 4px; }
.profile-form-note { min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; }
.profile-form .btn { width: 100%; min-width: 0; min-height: 48px; padding: 11px 18px; font-size: 15px; line-height: 24px; white-space: normal; }
@media (max-width: 560px) {
  .profile-grid { gap: 18px; }
  .profile-form { padding: 20px; gap: 20px; }
  .profile-form-fields { gap: 18px; }
}

/* ---------- головна */
.hello { margin-bottom: 24px; }
.hello p { color: var(--muted); margin-top: 6px; }
.level-big { font-size: 56px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat { font-size: 32px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

/* ---------- календар */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { margin-right: auto; }
.cal-head h2::first-letter { text-transform: uppercase; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cal-dow { font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 8px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 94px; padding: 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background .12s; }
.cal-day:hover { background: var(--surface-2); }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.other { background: var(--surface-2); color: var(--faint); }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-num { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 99px; }
.cal-day.today .cal-num { background: var(--primary); color: var(--primary-ink); }
.cal-ev { font-size: 11px; line-height: 1.3; padding: 2px 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-more { font-size: 11px; color: var(--muted); }
.day-list { margin-top: 18px; }
.ev-row { display: flex; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.ev-row:first-child { border-top: none; }
.ev-time { font-weight: 650; min-width: 96px; font-variant-numeric: tabular-nums; }
.ev-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--primary); }
@media (max-width: 640px) {
  .cal-day { min-height: 54px; padding: 4px; }
  .cal-ev { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
  .cal-more { display: none; }
}

/* ---------- теми, розділи, вправи */
.topic-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.topic-card:hover { border-color: var(--primary-soft-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.topic-card.locked { opacity: .6; }
.topic-num { font-size: 12px; font-weight: 600; color: var(--faint); }
.section-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 12px; }
section + section .section-head { margin-top: 34px; }
.section-head h2 { font-size: 19px; }
.section-tag { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.section-tag.lesson { background: var(--primary-soft); color: var(--primary-text); }
.section-tag.homework { background: var(--accent-soft); color: var(--accent-text); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split .mini { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.block-card { padding: 0; overflow: hidden; }
.block-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.ex-row { display: flex; align-items: center; gap: 13px; padding: 13px 20px; border-top: 1px solid var(--line); transition: background .12s; }
.ex-row:hover { background: var(--surface-2); }
.block-head + .ex-row { border-top: none; }
.ex-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.ex-ico.done { background: var(--primary-soft); color: var(--primary-text); }
.ex-row .grow { flex: 1; min-width: 0; }
.ex-row .title { font-weight: 600; }
.ex-row .sub { font-size: 12.5px; color: var(--muted); }
@media (max-width: 560px) { .ex-row { flex-wrap: wrap; padding: 12px 14px; } .ex-row .pill { order: 3; } .split { grid-template-columns: 1fr; } }

.exercise { display: flex; flex-direction: column; gap: 14px; }
.q { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.q.ok { border-color: var(--primary-soft-2); background: var(--primary-soft); }
.q.bad { border-color: var(--bad-line); background: var(--bad-soft); }
.q-text { font-weight: 600; margin-bottom: 11px; }
.q-num { color: var(--faint); margin-right: 6px; font-weight: 600; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 8px 16px; cursor: pointer; font-weight: 500; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--primary); }
.opt.sel { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.gap-line { font-size: 16.5px; line-height: 2.4; padding: 4px 2px; }
.gap-input { display: inline-block; width: auto; min-width: 90px; max-width: 220px; padding: 3px 8px !important; margin: 0 3px; border-width: 0 0 2px !important; border-radius: 6px 6px 0 0 !important; background: var(--surface-2) !important; text-align: center; font-weight: 600; box-shadow: none !important; }
.gap-input:focus { border-color: var(--primary) !important; background: var(--primary-soft) !important; }
.gap-input.ok { border-color: var(--primary) !important; background: var(--primary-soft) !important; }
.gap-input.bad { border-color: var(--bad-line) !important; background: var(--bad-soft) !important; }
.slot { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; height: 34px; margin: 0 3px; padding: 0 12px; border: none; border-bottom: 2px solid var(--line-strong); background: var(--surface-2); border-radius: 6px 6px 0 0; font-weight: 600; cursor: pointer; vertical-align: middle; color: var(--ink); }
.slot.active { border-bottom-color: var(--primary); background: var(--primary-soft); }
.slot.ok { border-bottom-color: var(--primary); background: var(--primary-soft); }
.slot.bad { border-bottom-color: var(--bad-line); background: var(--bad-soft); }
.wordbox { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2); position: sticky; top: 8px; z-index: 2; }
.word { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 7px 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm); }
.word:hover { border-color: var(--primary); }
.word.used { opacity: .3; cursor: default; }
.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; padding: 11px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.match-row.ok { border-color: var(--primary-soft-2); background: var(--primary-soft); }
.match-row.bad { border-color: var(--bad-line); background: var(--bad-soft); }
.match-left { font-weight: 600; }
.fix { font-size: 13px; color: var(--primary-text); margin-top: 6px; font-weight: 600; }
.result { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius); }
.result.ok { background: var(--primary-soft); color: var(--primary-text); }
.result.bad { background: var(--accent-soft); color: var(--accent-text); }
.result-score { font-size: 36px; font-weight: 800; letter-spacing: -.03em; }
.md p + p, .md p + ul, .md ul + p { margin-top: 10px; }
.md ul { margin: 8px 0 0; padding-left: 20px; }
.md li + li { margin-top: 4px; }
.md strong { color: var(--primary-text); font-weight: 650; }
.video { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.teacher-note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 13px 16px; border-radius: 0 12px 12px 0; }
.answer-box { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }

/* ---------- вхід */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.login-art { background: linear-gradient(150deg, #8a2f78 0%, #5a1d55 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -90px; bottom: -90px; width: 320px; height: 320px; border-radius: 50%; background: #f2c94c; }
.login-art::before { content: ""; position: absolute; right: 150px; bottom: 120px; width: 90px; height: 90px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .3); }
.login-art > * { position: relative; z-index: 1; }
.login-art h1 { font-size: 42px; max-width: 470px; letter-spacing: -.03em; }
.login-art ul { padding-left: 18px; margin: 20px 0 0; opacity: .92; }
.login-art li + li { margin-top: 7px; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 820px) { .login-page { grid-template-columns: 1fr; } .login-art { padding: 28px 22px; min-height: 280px; } .login-art h1 { font-size: 28px; } .login-art::after { width: 180px; height: 180px; right: -60px; bottom: -60px; } }

/* ---------- редактор, медіа, файли */
.help { white-space: pre-wrap; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; padding: 4px; background: var(--surface-3); border-radius: 13px; width: fit-content; max-width: 100%; }
.tab { border: none; background: transparent; border-radius: 10px; padding: 7px 15px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.checklist { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.media-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); }
.media-box img { max-width: 100%; border-radius: 10px; display: block; }
.media-box video { width: 100%; border-radius: 10px; background: #000; }
.file-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-ico { width: 40px; height: 48px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 20px; text-align: center; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.upbar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.upbar > span { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }
.feature-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.feat { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 11px; border-radius: 99px; background: var(--surface-2); color: var(--faint); }
.feat.on { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.announce { border-left: 3px solid var(--accent); padding: 11px 15px; background: var(--surface-2); border-radius: 0 12px 12px 0; }
.announce + .announce { margin-top: 10px; }

/* ---------- голосова відповідь */
.recorder { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 18px; text-align: center; }
.rec-btn { width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 8px var(--primary-soft); transition: transform .15s, background .15s; }
.rec-btn:hover { transform: scale(1.04); }
.rec-btn svg.i { width: 32px; height: 32px; }
.rec-btn.on { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 8px var(--accent-soft); animation: rec-pulse 1.4s ease-in-out infinite; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 16px var(--accent-soft); } }
.rec-time { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
audio { width: 100%; max-width: 520px; }

/* ---------- сторінка без зв'язку */
.empty-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; }

@media (max-width: 560px) {
  .list-item { flex-wrap: wrap; }
  .list-item .grow { flex-basis: 100%; }
  .section-head { flex-wrap: wrap; }
  .section-head > .btn { width: 100%; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.file-ico.quizlet { background: #4257b2; color: #fff; font-size: 18px; border-radius: 10px; width: 44px; height: 44px; }
.quizlet-frame { padding-top: 0; height: 420px; }
.brand-logo { width: 46px; height: 46px; border-radius: 13px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; padding: 5px; flex: none; }
.brand-logo img { width: 100%; height: auto; display: block; }
.order-line { display: flex; flex-wrap: wrap; gap: 6px; min-height: 46px; padding: 8px; border-radius: 12px; border: 1.5px dashed var(--line-strong); background: var(--surface-2); align-items: center; }
.order-line .word { margin: 0; }
.order-pool { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tf { display: flex; gap: 8px; margin-top: 4px; }
.tf .opt { min-width: 110px; }
.note-box textarea { min-height: 140px; }
.side-tools .btn svg.i { width: 17px; height: 17px; }
.login-logo { width: 150px; background: #fff; border-radius: 22px; padding: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); }
.login-logo img { width: 100%; display: block; }
@media (max-width: 820px) { .login-logo { width: 110px; } }
.grid.top { align-items: start; }

/* ---------- оновлений вигляд (v4) */
body { background: radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 60%), var(--bg); background-attachment: fixed; }
.card { border-radius: var(--radius); box-shadow: var(--shadow); }
.side { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); }
.btn { background: var(--primary); color: var(--primary-ink); border-radius: 12px; }
.btn:not(.ghost):not(.soft):not(.danger):not(.yellow) { background: var(--grad); }
.btn:not(.ghost):not(.soft):not(.danger):not(.yellow):hover { filter: brightness(1.08); }
h1 { letter-spacing: -.03em; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary-text); }
.star { color: #d9a514; font-weight: 800; margin-right: 4px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.lock-note { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface-2); }
.lock-note svg.i { width: 22px; height: 22px; }
.subsection { margin-top: 14px; }
.subsection > .sub-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 4px 10px; }
.section-tag.materials { background: var(--primary-soft); color: var(--primary-text); }
.section-tag.classwork { background: var(--info-soft); color: var(--info); }
.section-tag.lesson { background: var(--primary-soft); color: var(--primary-text); }
.home-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.home-grid > * { margin: 0 !important; }
.home-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 960px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.current { background: var(--grad); color: #fff; border: none; position: relative; overflow: hidden; }
.current::after { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; bottom: -90px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.current > * { position: relative; z-index: 1; }
.current .eyebrow, .current .muted { color: rgba(255, 255, 255, .78); }
.current h2 { font-size: 24px; margin: 6px 0 4px; }
.current .progress { background: rgba(255, 255, 255, .2); }
.current .progress > span { background: var(--accent); }
.current .btn { background: #fff !important; color: #5a1d55; }
.current .btn.ghost { background: transparent !important; color: #fff; border-color: rgba(255, 255, 255, .45); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.step { background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 10px 12px; font-size: 12.5px; }
.step b { display: block; font-size: 17px; }
.step.done { background: rgba(255, 255, 255, .22); }
.step.locked { opacity: .6; }
.group-card .t-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.group-card .t-row:first-of-type { border-top: none; }
.slot-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-text); font-weight: 600; font-size: 13.5px; }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; flex: none; }
.ring > span { width: 60px; height: 60px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.att-row:first-child { border-top: none; }

/* мапа-паспорт */
.pass-card { overflow: hidden; }
.pass-map { width: 100%; height: auto; display: block; margin-top: 6px; }
.pass-map .land { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 1.6; stroke-linejoin: round; }
.pass-map .route { fill: none; stroke: var(--primary); stroke-width: 1.6; stroke-dasharray: 4 5; opacity: .5; }
.pass-map .route-done { fill: none; stroke: var(--primary); stroke-width: 2.6; stroke-linecap: round; }
.pass-map .city circle { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.pass-map .city.done circle { fill: var(--primary); stroke: var(--surface); }
.pass-map .city.cur circle { fill: var(--accent); stroke: var(--surface); }
.pass-map .city.cur .halo { fill: var(--accent); opacity: .35; stroke: none; animation: halo 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 50% { transform: scale(1.8); opacity: 0; } }
.pass-map .city text { font: 600 10.5px var(--font); fill: var(--muted); paint-order: stroke; stroke: var(--primary-soft); stroke-width: 3px; }
.pass-map .city.done text { fill: var(--ink); }
.pass-map .city .n { font-size: 8.5px; fill: #fff; stroke: none; font-weight: 700; }
.pass-map .city:not(.done) .n { fill: var(--muted); }
.pass-map .city.cur .n { fill: var(--accent-ink); }

/* сертифікат */
.cert { position: relative; background: #fffdf8; color: #2a1b2a; border-radius: 6px; padding: 56px 60px; text-align: center; box-shadow: var(--shadow-lg); border: 10px solid #fff; outline: 2px solid #7b2a6b; outline-offset: -22px; max-width: 900px; margin: 0 auto; aspect-ratio: 1.414; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.cert img { height: 64px; margin: 0 auto; }
.cert .c-title { font-size: 44px; font-weight: 800; letter-spacing: .14em; color: #7b2a6b; }
.cert .c-name { font-size: 34px; font-weight: 700; border-bottom: 1.5px solid #d4b8cc; padding-bottom: 8px; margin: 10px auto 0; min-width: 60%; }
.cert .c-foot { display: flex; justify-content: space-between; margin-top: 30px; font-size: 13px; color: #6b5a69; text-align: left; }
.cert .seal { position: absolute; right: 64px; top: 56px; width: 96px; height: 96px; border-radius: 50%; border: 3px double #b78a1e; color: #b78a1e; display: grid; place-items: center; font-weight: 800; font-size: 12px; transform: rotate(-12deg); }
@media (max-width: 640px) { .cert { padding: 28px 18px; } .cert .c-title { font-size: 26px; } .cert .c-name { font-size: 22px; } .cert .seal { display: none; } }
@media print {
  .side, .topbar, .no-print { display: none !important; }
  .shell { display: block; } .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .cert { box-shadow: none; }
  @page { size: A4 landscape; margin: 10mm; }
}
.lang-select { width: auto; padding: 6px 8px; font-size: 13px; min-height: 36px; }
.cal-ev.group { background: var(--info-soft); color: var(--info); }
.ev-bar.group { background: var(--info); }
.home-grid { align-items: start; }
@media (max-width: 560px) {
  .ex-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px 12px; }
  .ex-row .grow { grid-column: 2 / 4; }
  .ex-row > .pill { grid-column: 2; grid-row: 2; justify-self: start; align-self: center; order: 0; }
  .ex-row > .btn, .ex-row > a.btn { grid-column: 3; grid-row: 2; }
  .ex-row > .ex-ico { grid-row: 1 / 3; }
}
/* v5: листівка міста й слово дня */
.postcard { display: flex; gap: 14px; align-items: flex-start; margin-top: 12px; padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg, var(--accent-soft), var(--primary-soft)); border: 1px dashed var(--line-strong); }
.postcard-stamp { width: 58px; height: 58px; flex: none; border-radius: 50%; border: 2.5px dashed var(--primary); color: var(--primary-text); display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .12em; transform: rotate(-10deg); line-height: 1; }
.postcard-stamp span { display: block; font-size: 20px; letter-spacing: 0; }
.postcard-city { font-size: 19px; font-weight: 750; letter-spacing: -.01em; margin: 2px 0 4px; }
.word-card { background: linear-gradient(160deg, var(--surface) 55%, var(--accent-soft)); }
.word-big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--primary-text); margin-top: 6px; }
.word-ex { margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--accent); color: var(--ink); }
.journal { border-collapse: separate; border-spacing: 0; font-size: 14px; }
.journal th, .journal td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.journal th:first-child, .journal td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); padding-right: 14px; }
.journal th { font-size: 12px; color: var(--muted); font-weight: 600; }
.jcell { width: 38px; height: 38px; border-radius: 11px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 17px; font-weight: 800; color: var(--faint); transition: transform .1s; }
.jcell:hover { transform: scale(1.07); border-color: var(--primary); }
.jcell.confirmed { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.jcell.rejected { background: var(--surface-3); color: var(--muted); }
.jcell.pending { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.jall { font-size: 11px; padding: 2px 8px; min-height: 24px; margin-top: 4px; }

/* v6: скасовані й перенесені заняття */
.cal-ev.off { text-decoration: line-through; opacity: .55; }
.ev-row.off .ev-time, .ev-row.off > div > div:first-child { text-decoration: line-through; color: var(--muted); }
.ev-row.off .ev-bar { background: var(--line-strong); }
.ev-change { display: inline-block; margin-top: 4px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); }
.ev-change.bad { background: var(--surface-3); color: var(--ink); }
.change-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-size: 13.5px; margin-top: 8px; }

/* v7: пояснення помилок */
.why { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 9px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 14px; line-height: 1.45; border-left: 3px solid var(--accent); }
.why-ico { flex: none; }
.gap-line + .why { margin: 4px 0 10px; }
.md-table { border-collapse: collapse; font-size: 14px; margin: 6px 0; } .md-table th, .md-table td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; } .md-table th { background: var(--primary-soft); color: var(--primary-text); }

/* v7: фірмові штрихи Free Student — геометричний орнамент у дусі словацьких народних візерунків (Čičmany) */
:root { --orn-line: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='8' viewBox='0 0 24 8'%3E%3Cpath d='M0 4 L4 0 L8 4 L12 0 L16 4 L20 0 L24 4 L20 8 L16 4 L12 8 L8 4 L4 8Z' fill='%237b2a6b' fill-opacity='.85'/%3E%3Ccircle cx='12' cy='4' r='1.3' fill='%23f2c94c'/%3E%3C/svg%3E"); }
.login-kicker { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #f2c94c; margin: 18px 0 6px; }
.login-lead { font-size: 21px; line-height: 1.55; max-width: 520px; opacity: .95; margin-top: 12px; }
.login-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; max-width: 540px; }
.login-facts div { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); border-radius: 16px; padding: 12px 14px; backdrop-filter: blur(4px); }
.login-facts b { display: block; font-size: 20px; letter-spacing: -.01em; }
.login-facts span { font-size: 12.5px; opacity: .85; }
@media (max-width: 820px) { .login-facts { grid-template-columns: 1fr; } }
.page-head h1::after { content: ""; display: block; width: 96px; height: 8px; margin-top: 10px; background: var(--orn-line) repeat-x; background-size: 24px 8px; border-radius: 2px; }
.hello h1::after { content: ""; display: block; width: 96px; height: 8px; margin-top: 10px; background: var(--orn-line) repeat-x; background-size: 24px 8px; }
.side .brand { position: relative; padding-bottom: 14px; }
.side .brand::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--orn-line) repeat-x; background-size: 24px 8px; opacity: .55; }
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ""; width: 8px; height: 8px; transform: rotate(45deg); background: var(--accent); border-radius: 1px; flex: none; }
.eyebrow::before { content: "◆ "; color: var(--accent); }
.current .eyebrow::before { color: var(--accent); }
.pass-card { background-image: linear-gradient(var(--surface), var(--surface)), var(--orn-line); background-repeat: no-repeat, repeat-x; background-position: 0 0, 0 100%; background-size: 100% calc(100% - 6px), 24px 8px; }
.login-art::after { width: 220px; height: 220px; right: -110px; bottom: -110px; opacity: .9; }
.login-art::before { right: 60px; bottom: 60px; width: 60px; height: 60px; }
.login-art ul { max-width: 520px; }

/* v8: словацький календар і прислів’я тижня */
.culture-card { display: grid; grid-template-columns: 1fr; gap: 18px; }
.culture-day { display: flex; gap: 16px; align-items: flex-start; }
.culture-date { flex: none; width: 74px; border-radius: 16px; overflow: hidden; text-align: center; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 2px 8px rgba(60, 20, 60, .06); }
.culture-date b { display: block; font-size: 30px; line-height: 1; padding: 10px 0 6px; color: var(--primary-text); }
.culture-date span { display: block; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 4px 0; }
.culture-title { font-size: 18px; font-weight: 700; margin: 4px 0 2px; }
.culture-proverb { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; }
.culture-proverb blockquote { margin: 6px 0 6px; font-size: 18px; font-weight: 650; font-style: italic; line-height: 1.35; }
.culture-proverb .btn { align-self: flex-start; }

/* v9: панель доступу до лекцій */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; padding: 3px; background: var(--surface-2, var(--surface)); gap: 3px; }
.seg-btn { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.on { background: var(--primary); color: #fff; }
.access-actions { gap: 8px; align-items: center; flex-wrap: wrap; }
.access-level { margin-top: 16px; }
.access-level .row { gap: 10px; align-items: center; }
.access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 8px; }
.access-chip { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; transition: background .15s, border-color .15s; }
.access-chip:hover { border-color: var(--primary); }
.access-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--ink); }
.access-n { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--surface-3, #eee); color: var(--muted); }
.access-chip.on .access-n { background: var(--primary); color: #fff; }
.access-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-ico { flex: none; font-size: 13px; }

/* v10: міні-звіт, живий клас, конспект, словничок, звіт, вкладки рівнів */
.mini-report td, .mini-report th { vertical-align: middle; }
.mini-report tr.flagged td { background: color-mix(in srgb, #f2c94c 10%, transparent); }
.mini-report tbody tr:hover td { background: var(--primary-soft); }
.bad-text { color: #b4442f; font-weight: 600; }
.pill.warn { white-space: nowrap; }
.live-table th.live-ex { cursor: pointer; min-width: 130px; font-size: 13px; }
.live-table th.live-ex:hover { color: var(--primary); }
.live-cell { position: relative; text-align: center; font-size: 13px; font-weight: 600; border-radius: 10px; padding: 8px 6px; color: var(--muted); background: var(--surface-2, #f6f3f7); overflow: hidden; }
.live-table td.live-cell { border: 2px solid var(--surface); }
.live-cell.typing { background: #e9f1ff; color: #2a5bb8; animation: livepulse 1.2s ease-in-out infinite; }
.live-cell.work { background: #f3ecf7; color: var(--primary); }
.live-cell.stuck { background: #fff1d6; color: #9a6400; }
.live-cell.ok { background: #e3f4e8; color: #23804a; }
.live-cell.bad { background: #fde6e2; color: #b4442f; }
.live-cell.sent { background: #eef0f4; color: #4a5670; }
.live-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .5; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c9c3cc; margin-right: 8px; vertical-align: middle; }
.live-dot.on { background: #2fb36a; box-shadow: 0 0 0 3px rgba(47, 179, 106, .2); }
.live-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.live-legend .live-cell { display: inline-block; min-width: 26px; padding: 2px 6px; }
@keyframes livepulse { 50% { opacity: .6; } }
details.lesson-note { margin: 2px 0 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface); }
details.lesson-note summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary-text); }
.lesson-note-body { margin-top: 8px; font-size: 14px; }
.note-words, .dict-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 8px; }
.note-word { border-left: 3px solid var(--accent); padding: 4px 10px; display: flex; flex-direction: column; }
.note-word span { color: var(--muted); font-size: 13px; }
.dict-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface); }
.level-tabs { display: inline-flex; gap: 6px; padding: 4px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 18px; }
.level-tab { border: 0; background: transparent; padding: 9px 18px; border-radius: 12px; font: inherit; cursor: pointer; display: flex; gap: 8px; align-items: baseline; color: var(--muted); }
.level-tab b { font-size: 16px; color: var(--ink); }
.level-tab.on { background: var(--primary); color: rgba(255, 255, 255, .8); }
.level-tab.on b { color: #fff; }
.report { max-width: 860px; margin: 0 auto; padding: 32px 36px; }
.report-head { display: flex; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 20px; }
.report-head img { width: 64px; height: 64px; object-fit: contain; }
.report-head h1 { margin: 2px 0 4px; font-size: 26px; }
.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.report-period-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.report-val { font-size: 28px; font-weight: 750; color: var(--primary-text); }
.report-lab { font-size: 13px; font-weight: 600; margin: 4px 0 2px; }
.report h3 { font-size: 15px; margin: 18px 0 8px; }
.report-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.report-comment { white-space: pre-wrap; border-left: 3px solid var(--accent); padding: 6px 12px; min-height: 24px; }
.report-foot { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 10px; }
.print-only { display: none; }
@media (max-width: 760px) { .report-grid { grid-template-columns: repeat(2, 1fr); } .report { padding: 20px; } }
@media print {
  .print-only { display: block; }
  .report { box-shadow: none; border: 0; padding: 0; max-width: none; }
  .report-stat, .pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@page report { size: A4 portrait; margin: 14mm; }
@media print { .report { page: report; } }
.live-table td:first-child, .live-table th:first-child { min-width: 160px; white-space: nowrap; }

/* ---------- головна адміністратора: пошук і розклад */
.admin-search { margin-bottom: 20px; }
.admin-search-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.admin-search-top h2 { font-size: 18px; }
.admin-search-controls { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 12px; }
.admin-search-query { display: flex; min-width: 0; gap: 8px; }
.admin-search-query .btn { flex: none; }
.admin-search-controls input, .admin-search-controls select { min-width: 0; min-height: 48px; font-size: 16px; }
.admin-search-results { margin-top: 14px; max-height: min(480px, 60vh); overflow-y: auto; }
.admin-search-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 20px; margin-top: 14px; }
.admin-search-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.admin-search-list { margin: 0; padding: 0; list-style: none; }
.admin-search-list li + li { margin-top: 6px; }
.admin-search-result { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.admin-search-result:hover { background: var(--surface-2); border-color: var(--primary); }
.admin-search-copy { display: grid; gap: 3px; min-width: 0; flex: 1 1 150px; overflow-wrap: anywhere; }
.admin-home .home-calendar > .card { scroll-margin-top: 76px; }
@media (max-width: 640px) {
  .admin-search { padding: 18px; }
  .admin-search-controls { grid-template-columns: minmax(0, 1fr); }
  .admin-search-top { align-items: stretch; }
  .admin-search-top .btn { width: 100%; white-space: normal; }
}

/* Узгоджені елементи форм для всіх кабінетів. Пропуски у вправах зберігають свій розмір. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]):not(.gap-input), select:not([multiple]):not([size]) {
  min-width: 0; height: 48px; padding: 11px 14px; font-size: 16px; line-height: 24px;
}
select:not([multiple]):not([size]) {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  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 5 5 5-5' fill='none' stroke='%23867990' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
label.field { gap: 8px; font-size: 14px; line-height: 1.45; min-width: 0; }
select:disabled { background-color: var(--surface-2); color: var(--muted); opacity: 1; cursor: not-allowed; }
.form-grid { gap: 16px; }
.btn:not(.sm):not(.icon) { min-height: 48px; padding: 11px 18px; }
.page-head > :first-child { min-width: 0; max-width: 100%; }
.page-head h1, .hello h1 { width: fit-content; max-width: 100%; overflow-wrap: anywhere; }
.page-head h1::after, .hello h1::after { width: 100%; }
.page-head > .row { max-width: 100%; }
.page-head .btn { white-space: normal; text-align: center; }
.card-title { margin-bottom: 16px; }
.row > .card-title { margin-bottom: 0; }

/* Стабільні відступи й незалежне прокручування довгих модальних форм. */
dialog.modal { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; }
.modal-head { flex: none; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.modal-body { flex: 1 1 auto; min-height: 0; max-height: none; padding: 24px; overflow-y: auto; }
.modal-body .stack > * + * { margin-top: 20px; }
.modal-foot { flex: none; align-items: center; flex-wrap: wrap; gap: 12px; padding: 18px 24px; border-top: 1px solid var(--line); }
.modal-foot .btn { min-height: 48px; }
.schedule-slots { display: grid; gap: 16px; }
.schedule-slot { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) minmax(0,.8fr) auto; align-items: end; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.schedule-slot > .btn { min-height: 48px; }

/* Картка учня. */
.student-details-grid { grid-template-columns: repeat(auto-fit,minmax(min(380px,100%),1fr)); align-items: start; gap: 24px; }
.student-details-form { padding: 24px; }
.student-details-form > .card-title { font-size: 18px; color: var(--ink); }
.student-details-section { display: grid; gap: 18px; margin-top: 24px; }
.student-details-section h3, .student-details-access h3 { font-size: 14px; color: var(--muted); }
.student-details-form .form-grid { grid-template-columns: repeat(auto-fit,minmax(min(180px,100%),1fr)); }
.student-plan-features { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.student-plan-features .feat { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; padding: 6px 10px; }
.student-details-access { display: grid; gap: 12px; margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.student-details-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.student-details-actions .btn { min-width: 150px; }
.student-details-actions p { flex: 1 1 160px; }
.student-teacher-hint { line-height: 1.5; }

/* Теми курсу: вся площа рядка відкриває тему, кнопки порядку незалежні. */
.topic-list-item { position: relative; flex-wrap: wrap; }
.topic-row-link { color: inherit; text-decoration: none; }
.topic-row-link::after { content: ''; position: absolute; inset: 0; cursor: pointer; border-radius: 8px; }
.topic-list-item > .btn { position: relative; z-index: 1; }
.topic-list-item:hover { background: var(--surface-2); }
.topic-list-item:focus-within { outline: 2px solid var(--primary); outline-offset: -2px; }
.level-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin: 20px 0 16px; }
.level-summary h2 { font-size: 18px; }

/* Люди спочатку, технічні відомості нижче. */
.staff-search { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 18px; }
.staff-search input { flex: 1 1 280px; }
.staff-people .list-item { flex-wrap: wrap; gap: 12px; }
.staff-people .grow { flex: 1 1 220px; overflow-wrap: anywhere; }
.staff-technical { display: grid; gap: 20px; margin-top: 28px; }
.staff-technical > .card { margin: 0 !important; }
.staff-technical > h2 { font-size: 18px; }
.system-card-content { display: grid; gap: 16px; }
.system-card-content > * { margin: 0; }
.system-card-content > .row { align-items: center; gap: 12px; }
.system-card-summary { display: grid; gap: 7px; }
.system-card-summary > p { margin: 0; }
.system-card-content .notice { line-height: 1.5; }
.card > .block-head { flex-wrap: wrap; gap: 12px; padding: 0 0 16px; margin-bottom: 12px; }

@media (max-width: 640px) {
  .page-head > .row { width: 100%; }
  .page-head > .row > .btn { flex: 1 1 180px; }
  .modal-head { padding: 18px; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 16px 18px; }
  .modal-foot > .spacer { display: none; }
  .modal-foot .btn { flex: 1 1 160px; white-space: normal; }
  .schedule-slot { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .schedule-slot > .btn { width: 100%; }
  .student-details-form { padding: 20px; }
  .student-details-actions .btn { width: 100%; }
  .student-details-grid { gap: 18px; }
  .system-card-content > .row > .btn { margin-left: 0; }
}

/* Підписи не стискаються на телефоні; компактний паспорт лишається без підписів. */
.pass-map-wrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 16px 0; border-radius: 8px; }
.pass-map-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pass-map-wrap .pass-map { display: block; min-width: 800px; margin: 0; }
.pass-map .city circle { stroke-width: 1.5; }
.pass-map .city text.city-label { font: 500 7px var(--font); fill: var(--ink); stroke-width: 1.25px; }
.pass-map .city .n { font-size: 7.5px; }
.map-scroll-hint { display: none; }
@media (max-width: 760px) { .map-scroll-hint { display: block; margin: 8px 0 0; } }

/* Вибір міста змінює лише листівку; отримані печатки позначаються окремо. */
.pass-map .city.selectable { cursor: pointer; }
.pass-map .city.selectable .city-hit { fill: transparent; stroke: none; pointer-events: all; }
.pass-map .city.selectable .selection-ring { fill: none; stroke: none; pointer-events: none; }
.pass-map .city.selectable:focus-visible { outline: none; }
.pass-map .city.selectable.selected .selection-ring,
.pass-map .city.selectable:focus-visible .selection-ring { stroke: var(--primary); stroke-width: 1.5; }

/* Навігаційні назви без підкреслення; посилання в текстах матеріалів зберігають оформлення. */
.main a[href^="#/"]:not(.off), .main a.title { text-decoration: none; }
.individual-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 24px; }
.individual-controls > input { flex: 1 1 250px; }
.individual-controls .seg { flex-wrap: wrap; }
.individual-empty { grid-column: 1 / -1; }
.individual-card .row { flex-wrap: wrap; }
.individual-card h2 { overflow-wrap: anywhere; }
.schedule-slots { margin-top: 12px; }
.access-actions { align-items: flex-end; }
.access-actions > .btn { min-height: 48px; }
.access-actions > label.field { max-width: 190px; }
.access-actions > label.field input { width: 100% !important; }
@media (max-width: 640px) {
  .individual-controls { padding: 18px; }
  .individual-controls .seg { width: 100%; }
  .individual-controls .seg-btn { flex: 1 1 100px; }
  .individual-card .row > .btn { flex: 1 1 150px; white-space: normal; }
}
