/* ================= Токени — стиль «midnight command center» (DESIGN.md) =================
   Лише темна тема: майже-чорне полотно, білий текст, один кораловий акцент (логотип, AI, важливе).
   Глибина — не тінями, а тонкими рамками й «клавішною» внутрішньою тінню карток. */
:root {
  --bg: #040506;            /* полотно */
  --ink: #07080a;           /* картки, панелі */
  --surface: #07080a;
  --surface-solid: #07080a;
  --surface-2: rgba(255, 255, 255, 0.05); /* поля вводу, вкладені блоки */
  --obsidian: #111214;
  --raised: #1b1c1e;        /* бейджі, активні сегменти */
  --border: #363739;        /* рамки карток і полів */
  --line: #1c1d1f;          /* тонкі роздільники */
  --text: #ffffff;
  --text-2: #e6e6e6;
  --muted: #9c9c9d;
  --muted-2: #6a6b6c;
  --primary: #e6e6e6;
  --primary-2: #ffffff;
  --primary-text: #454647;
  --btn-fill: #e6e6e6;      /* єдина заповнена дія — нейтральна світла */
  --btn-fill-text: #454647;
  --accent: #f2b84b;        /* бурштиновий — бренд і важливе */
  --accent-tint: #3a2c12;   /* темний бурштиновий фон під акцентний зміст */
  --ok: #59d499;
  --info: #56c2ff;
  --grad: linear-gradient(90deg, var(--text), var(--text));
  --todo: #ffffff;
  --todo-bg: transparent;
  --overdue: #f2b84b;
  --overdue-bg: transparent;
  --done: #6a6b6c;
  --done-bg: transparent;
  --draft: #ffffff;
  --draft-bg: #1b1c1e;
  --shadow: none;
  --shadow-lg: rgba(0, 0, 0, 0.4) 0 4px 40px 8px, rgba(0, 0, 0, 0.8) 0 0 0 0.5px, rgba(255, 255, 255, 0.3) 0 0.5px 0 0 inset;
  --key: rgba(255, 255, 255, 0.05) 0 1px 0 0 inset, rgba(255, 255, 255, 0.12) 0 0 0 1px, rgba(0, 0, 0, 0.2) 0 -1px 0 0 inset;
  --key-hi: rgba(255, 255, 255, 0.05) 0 1px 0 0 inset, rgba(255, 255, 255, 0.25) 0 0 0 1px, rgba(0, 0, 0, 0.2) 0 -1px 0 0 inset;
  --lift: rgba(0, 0, 0, 0.03) 0 7px 3px 0, rgba(0, 0, 0, 0.25) 0 4px 4px 0;
  --radius: 16px;
  --mono: "Geist Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --glow-rgb: 0, 0, 0;
  color-scheme: dark;
}

/* ================= База ================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; font-size: 13px; }
.display { font-family: "Inter", sans-serif; font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Фон: мягкое «северное сияние» */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(80px); opacity: var(--blob-opacity); animation: drift 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { background: var(--blob-1); top: -18vmax; left: -10vmax; }
.aurora span:nth-child(2) { background: var(--blob-2); top: -10vmax; right: -16vmax; animation-delay: -8s; }
.aurora span:nth-child(3) { background: var(--blob-3); bottom: -22vmax; left: 20vmax; animation-delay: -14s; }
.aurora span:nth-child(4) { background: var(--blob-4); bottom: -18vmax; right: -12vmax; animation-delay: -4s; width: 34vmax; height: 34vmax; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vmax, 4vmax) scale(1.08); }
  100% { transform: translate(-4vmax, 7vmax) scale(0.95); }
}

/* ================= Кнопки и поля ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--text);
  padding: 9px 16px; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 600; text-decoration: none;
  white-space: nowrap; transition: transform 0.15s, box-shadow 0.15s, background 0.15s, filter 0.15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: progress; transform: none; box-shadow: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--primary-text); box-shadow: 0 8px 22px -10px rgba(var(--glow-rgb), 0.8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.glass { background: var(--surface); backdrop-filter: blur(12px); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.big { padding: 13px 22px; font-size: 15.5px; border-radius: 14px; }
.btn.icon { padding-left: 11px; padding-right: 11px; }

select, input[type="search"], input[type="text"], textarea {
  font: inherit; color: var(--text); background: var(--surface-solid);
  border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
textarea { width: 100%; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input, .radio-card input { accent-color: var(--primary); }

/* ================= Вход ================= */
.login { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.login-wrap { width: min(1120px, 100%); display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
  background: var(--grad); box-shadow: 0 10px 24px -10px rgba(var(--glow-rgb), 0.9); flex: none;
}
.logo-mark.small { width: 34px; height: 34px; border-radius: 11px; font-size: 18px; }
.brand-name { font-family: "Inter", sans-serif; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; }
.login-left h1 { font-size: clamp(34px, 5vw, 56px); margin: 28px 0 18px; }
.login-left h1 .grad-text { white-space: nowrap; }
.login-left .lead { font-size: 17px; color: var(--muted); max-width: 520px; margin: 0 0 28px; }
.lead { color: var(--muted); }
.btn-google {
  display: inline-flex; align-items: center; gap: 12px; padding: 14px 24px; border-radius: 14px;
  background: var(--surface-solid); color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); transition: transform 0.15s, box-shadow 0.15s;
}
.btn-google:hover { transform: translateY(-2px); }
.fineprint { font-size: 13px; color: var(--muted); margin: 14px 0 34px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.features li {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(14px);
}
.features b { display: block; font-size: 14px; }
.features small { color: var(--muted); font-size: 13px; line-height: 1.4; display: block; margin-top: 2px; }
.f-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--surface-2); font-size: 18px; }

.login-right { position: relative; height: 520px; }
.mock {
  position: absolute; width: 330px; padding: 18px; border-radius: 20px; background: var(--surface);
  border: 1px solid var(--border); backdrop-filter: blur(18px); box-shadow: var(--shadow-lg);
  animation: float 7s ease-in-out infinite;
}
.mock-1 { top: 0; left: 10px; z-index: 1; }
.mock-2 { top: 200px; right: 0; animation-delay: -2.5s; width: 300px; z-index: 3; }
.mock-3 { bottom: 0; left: 0; animation-delay: -4.5s; width: 260px; z-index: 2; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.mock-course { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.mock-title { font-weight: 800; margin: 4px 0 10px; }
.mock-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--todo-bg); color: var(--todo); }
.pill.ok { background: var(--done-bg); color: var(--done); }
.mock-team { display: flex; gap: 6px; margin: 14px 0 10px; flex-wrap: wrap; }
.mini-model { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--draft-bg); color: var(--draft); }
.mini-model.busy { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.mock-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.mock-bar span { display: block; height: 100%; width: 70%; background: var(--grad); border-radius: 99px; animation: load 3.5s ease-in-out infinite; }
@keyframes load { 0% { width: 18%; } 70% { width: 86%; } 100% { width: 18%; } }
.mock-caption { font-size: 12px; color: var(--muted); margin-top: 10px; }
.paper { background: #fff; border-radius: 8px; padding: 14px 16px 18px 22px; display: grid; gap: 7px; }
.paper-sig { justify-self: end; font: italic 10px "Times New Roman", serif; color: #555; }
.paper-h { height: 9px; width: 55%; justify-self: center; background: #2b2b40; border-radius: 3px; margin: 4px 0; }
.paper-l { height: 6px; background: #d5d4e3; border-radius: 3px; }
.paper-l:nth-of-type(3n + 1) { margin-left: 14px; }
.paper-l.short { width: 62%; }

/* ================= Шапка ================= */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px max(16px, calc((100vw - 1080px) / 2)); background: var(--surface);
  backdrop-filter: blur(18px) saturate(1.4); border-bottom: 1px solid var(--border);
}
.user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 14px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* сторінка входу видима без JS; тим, хто вже входив, — прихована до відповіді /api/me (index.html, app.js rememberSignedIn) */
.auth-pending #login { display: none; }
/* «Адмінка» — значок ⚙ (назва — у підказці), щоб шапка не вилазила за край на телефоні */
.admin-icon { font-size: 16px; line-height: 1; }
.user-text { display: grid; line-height: 1.25; min-width: 0; }
.user-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 16px 40px; }

/* ================= Приветствие ================= */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  padding: 28px; border-radius: 26px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(18px); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: var(--grad); opacity: 0.12; filter: blur(10px); pointer-events: none;
}
.display.small { font-size: clamp(24px, 3.6vw, 34px); margin: 0 0 8px; }
.hero .lead { margin: 0 0 18px; font-size: 15.5px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-sub-actions { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-top: 12px; font-size: 14px; }
.ring-box { position: relative; width: 132px; height: 132px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.ring-fg { fill: none; stroke: url(#ringGrad); stroke-width: 11; stroke-linecap: round; stroke-dasharray: 314.16; stroke-dashoffset: 314.16; transition: stroke-dashoffset 1s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-family: "Inter", sans-serif; font-size: 24px; }
.ring-label span { font-size: 12px; color: var(--muted); }

/* ================= Статистика ================= */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(14px);
  padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 2px; position: relative; overflow: hidden;
}
.stat .s-icon { font-size: 18px; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); margin-bottom: 6px; }
.stat .num { font-family: "Inter", sans-serif; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.stat.todo .num { color: var(--todo); }
.stat.overdue .num { color: var(--overdue); }
.stat.done .num { color: var(--done); }
.stat.draft .num { color: var(--draft); }
.stat.todo .s-icon { background: var(--todo-bg); }
.stat.overdue .s-icon { background: var(--overdue-bg); }
.stat.done .s-icon { background: var(--done-bg); }
.stat.draft .s-icon { background: var(--draft-bg); }
/* плитки — це кнопки-фільтри */
button.stat { font: inherit; color: inherit; text-align: left; cursor: pointer; justify-items: start; }
button.stat:hover { transform: translateY(-2px); }
button.stat:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat.active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent), var(--shadow); }

/* ================= Панели настроек ================= */
.panels { display: grid; gap: 12px; margin-bottom: 22px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.panel summary { padding: 14px 18px; cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: "⌄"; margin-left: auto; color: var(--muted); transition: transform 0.2s; }
.panel[open] summary::after { transform: rotate(180deg); }
.p-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); }
.summary-hint { font-weight: 500; font-size: 13px; color: var(--muted); }
.panel-body { padding: 4px 18px 20px; display: grid; gap: 20px; }
.field { display: grid; gap: 7px; font-size: 14px; font-weight: 700; min-width: 0; }
.field-label { font-size: 14px; font-weight: 700; }
.field input[type="text"], .field select { width: 100%; font-weight: 500; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-weight: 400; }
.row input[type="search"] { flex: 1 1 220px; min-width: 0; }
.signature-preview { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; font-size: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
#sigPreview { font-family: "Times New Roman", Times, serif; font-size: 17px; }

.selected-models { display: flex; flex-wrap: wrap; gap: 6px; }
.model-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 11px; border-radius: 999px;
  background: var(--draft-bg); color: var(--draft); font-size: 13px; font-weight: 700; max-width: 100%;
}
.model-pill .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-pill .main-tag { font-size: 12px; }
.model-pill button { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; padding: 0 4px; opacity: 0.7; }
.model-pill button:hover { opacity: 1; }
.model-list { max-height: 270px; overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; display: grid; font-weight: 400; background: var(--surface-solid); }
.model-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.model-item:last-child { border-bottom: 0; }
.model-item:hover { background: var(--surface-2); }
.model-item.disabled { opacity: 0.45; cursor: not-allowed; }
.model-item .mid { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-item .mname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.model-item .ctx { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 14px; cursor: pointer; font-weight: 400; background: var(--surface-solid); transition: border-color 0.15s, box-shadow 0.15s;
}
.radio-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.radio-card input { margin-top: 4px; }
.radio-card b { display: block; }
.radio-card small { color: var(--muted); display: block; margin-top: 2px; line-height: 1.45; }
.prompt-summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-weight: 400; }

/* ================= Фильтры ================= */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 5px; border-radius: 14px; flex-wrap: wrap; border: 1px solid var(--border); backdrop-filter: blur(14px); }
.tabs button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 10px; cursor: pointer; }
.tabs button.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.tabs .count { font-size: 12px; color: var(--muted); margin-left: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input { width: 220px; }

/* ================= Карточки заданий ================= */
.list { display: grid; gap: 12px; }
.card {
  --c: var(--primary);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(14px);
  padding: 16px 18px 16px 22px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; gap: 10px 18px;
  transition: transform 0.18s, box-shadow 0.18s; animation: rise 0.35s ease both;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card .course { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; font-weight: 600; }
.card h3 { margin: 4px 0 4px; font-size: 16.5px; line-height: 1.35; }
.card .desc { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 10px; font-size: 13px; }
.card .actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.card .main { cursor: pointer; min-width: 0; }
.card .main:hover h3 { color: var(--primary); }
.card.working { box-shadow: 0 0 0 2px var(--primary), var(--shadow-lg); }
.card.working::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad);
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.todo { color: var(--todo); background: var(--todo-bg); }
.badge.overdue { color: var(--overdue); background: var(--overdue-bg); }
.badge.done, .badge.returned { color: var(--done); background: var(--done-bg); }
.badge.draft { color: var(--draft); background: var(--draft-bg); }
.badge.demo { color: var(--todo); background: var(--todo-bg); }
.due { font-weight: 600; color: var(--muted); }
.due.soon { color: var(--todo); }
.due.late { color: var(--overdue); }
.chip { color: var(--muted); background: var(--surface-2); padding: 3px 9px; border-radius: 8px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chip.note { color: var(--draft); background: var(--draft-bg); }

.empty { text-align: center; color: var(--muted); padding: 50px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.empty .big-emoji { font-size: 44px; display: block; margin-bottom: 8px; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0 10px; }

/* ================= Панель задания ================= */
.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10, 6, 30, 0.45); backdrop-filter: blur(3px); animation: fade 0.2s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(780px, 100%);
  background: var(--surface-solid); overflow-y: auto; padding: 24px 28px 40px;
  border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slide 0.25s ease;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-panel h2 { margin: 4px 0 10px; font-size: 22px; line-height: 1.3; }
.drawer-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; margin-bottom: 14px; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.dtabs, .vtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.dtabs button, .vtabs button {
  border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 13px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.dtabs button.active, .vtabs button.active { color: var(--text); border-bottom-color: var(--primary); }
.vtabs { margin-bottom: 14px; }
.dtabs .count { font-size: 12px; color: var(--muted); }

.section-title { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 0 9px; }
.section-title:first-child { margin-top: 0; }
.info-grid { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; font-size: 14px; }
.info-grid dt { color: var(--muted); }
.info-grid dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 14px; padding: 14px; font-size: 14px; }
.materials { display: grid; gap: 7px; padding: 0; margin: 0; list-style: none; }
.materials li { display: flex; gap: 8px; align-items: baseline; font-size: 14px; overflow-wrap: anywhere; }
.choices { margin: 0; padding-left: 20px; font-size: 14px; }
.note-saved { font-size: 12px; color: var(--done); font-weight: 600; text-transform: none; letter-spacing: 0; }

.variant-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.variant-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.loading-box { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 20px 0; }
.empty-result { text-align: center; padding: 34px 0; color: var(--muted); display: grid; gap: 14px; justify-items: center; }
.howto { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 18px; }
.answer { line-height: 1.7; overflow-wrap: anywhere; }
.answer pre { background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; }
.answer table { border-collapse: collapse; display: block; overflow-x: auto; }
.answer td, .answer th { border: 1px solid var(--border); padding: 5px 9px; }
.answer .signature { text-align: right; font-style: italic; color: var(--muted); }
.error-box { color: var(--overdue); background: var(--overdue-bg); padding: 12px 14px; border-radius: 12px; }

/* Команда моделей */
.team-box { border: 1px solid var(--border); border-radius: 16px; padding: 14px; margin-bottom: 16px; background: var(--surface-2); }
.team-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; margin-bottom: 10px; }
.team-members { display: grid; gap: 6px; }
.member { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; font-size: 13.5px; }
.member .m-state { display: grid; place-items: center; }
.member .m-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.member .m-info { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.member.err .m-name { color: var(--muted); text-decoration: line-through; }
.member.editor { padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
.drafts { margin-top: 18px; }
.drafts > summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: 14px; }
.drafts details { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.drafts details summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.drafts .answer { font-size: 14px; margin-top: 8px; }

/* ================= Модальные окна ================= */
.modal { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 6, 30, 0.5); backdrop-filter: blur(4px); animation: fade 0.2s; }
.modal-card {
  position: relative; width: min(580px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: 22px; padding: 22px;
  display: grid; gap: 14px; box-shadow: var(--shadow-lg); animation: pop 0.22s ease;
}
.modal-card.wide { width: min(820px, 100%); }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.modal-card h3 { margin: 0; font-size: 19px; }
.modal-card p { margin: 0; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal-head p { margin-top: 4px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.selectable button {
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background 0.15s;
}
.chips.selectable button:hover { background: var(--surface-2); }
.chips.selectable button.on { background: var(--grad); border-color: transparent; color: #fff; }

.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.preset {
  text-align: left; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text);
  border-radius: 16px; padding: 12px 13px; cursor: pointer; font: inherit; display: grid; gap: 3px; position: relative;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.preset:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.preset .p-emoji { font-size: 20px; }
.preset b { font-size: 14px; }
.preset small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.preset.on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); background: color-mix(in srgb, var(--primary) 7%, var(--surface-solid)); }
.preset.on::after { content: "✓"; position: absolute; top: 9px; right: 11px; color: var(--primary); font-weight: 800; }
.prompt-preview summary { cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 600; }
.prompt-preview pre { white-space: pre-wrap; font: 13px/1.5 var(--mono); background: var(--surface-2); padding: 12px; border-radius: 12px; margin: 8px 0 0; max-height: 220px; overflow: auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; max-width: calc(100% - 32px);
  font-weight: 600; box-shadow: var(--shadow-lg); animation: pop 0.2s ease;
}


/* ================= Сортировка и месяцы ================= */
.filters select { max-width: 230px; }
.chip.added { color: var(--muted); }

/* ================= Викладачі та предмети ================= */
.teach-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); width: fit-content; }
.teach-tabs button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 14px; padding: 6px 14px; border-radius: 9px; cursor: pointer; }
.teach-tabs button.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.teach-summary { font-size: 14px; color: var(--muted); }
.teach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.teach-card {
  --c: var(--primary); position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 14px 14px 18px; background: var(--surface-solid); display: grid; gap: 10px; align-content: start;
}
.teach-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.teach-card h4 { margin: 0; font-size: 15.5px; line-height: 1.3; }
.teach-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.person { display: flex; gap: 10px; align-items: center; min-width: 0; }
.person .ava {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--c, var(--primary)); color: #fff; font-weight: 800; font-size: 13px;
}
.person .ava img { width: 100%; height: 100%; object-fit: cover; }
.person b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person a, .person small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.person a:hover { color: var(--primary); }
.teach-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.teach-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.subject-list { display: flex; flex-wrap: wrap; gap: 6px; }
.subject-list button {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.subject-list button:hover { border-color: var(--primary); }

/* ================= Лекції та Excel ================= */
.lectures { display: grid; gap: 8px; }
.lecture { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: grid; gap: 3px; font-size: 14px; }
.lecture.hit { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.lecture .l-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-weight: 700; }
.lecture .l-meta { font-size: 12.5px; color: var(--muted); }
.tables-box { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; display: grid; gap: 8px; background: color-mix(in srgb, #1d9e5a 7%, transparent); }
.table-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.table-row .t-name { font-weight: 700; flex: 1 1 200px; min-width: 0; }

/* ================= Титульна сторінка (превью) ================= */
.titlepage {
  background: #fff; color: #111; border-radius: 10px; padding: 34px 30px; margin: 0 0 22px;
  font: 15px/1.35 "Times New Roman", Times, serif; box-shadow: var(--shadow-lg); min-height: 420px;
  display: flex; flex-direction: column;
}
.titlepage p { margin: 0; }
.titlepage .tp-center { text-align: center; }
.titlepage .tp-right { margin-left: 52%; }
.titlepage .tp-empty { height: 1.35em; }
.titlepage .tp-gap { flex: 1 1 40px; min-height: 40px; }
.guide h1 { font-size: 20px; }
.guide h2 { font-size: 16px; margin-top: 22px; }
.guide pre { font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.modal-card > * { min-width: 0; }

/* ================= Стиль: типографіка ================= */
html { scrollbar-color: var(--border) var(--bg); }
body {
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "calt", "kern", "liga", "ss03";
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(242, 184, 75, 0.35); color: #fff; }
.aurora { display: none; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: var(--muted-2); }
a:hover { text-decoration-color: var(--text); }
h1, h2, h3, h4 { font-weight: 500; letter-spacing: 0; }
code, kbd { font-family: var(--mono); }

/* Великі заголовки — регулярна вага, розмір робить усю роботу */
.display { font-family: inherit; font-weight: 400; line-height: 1.1; letter-spacing: 0.004em; }
.login-left h1 { font-size: clamp(40px, 5.6vw, 64px); margin: 28px 0 20px; }
.login-left h1 .grad-text { white-space: normal; }
.display.small { font-size: clamp(28px, 3.4vw, 40px); margin: 0 0 10px; }
.grad-text { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--muted); }
.brand-name { font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
.card h3 { font-size: 15.5px; line-height: 1.3; font-weight: 500; }
.drawer-panel h2 { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; font-weight: 500; }
.modal-card h3 { font-size: 20px; line-height: 1.2; font-weight: 500; }
/* Надрядкова мітка — єдине місце з великими літерами */
.section-title { font-size: 11px; font-weight: 500; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.073em; }
.stat .num { font-family: inherit; font-weight: 500; font-size: 30px; line-height: 1.1; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.ring-label b { font-family: inherit; font-weight: 500; font-size: 26px; line-height: 1; }
.ring-label span { font-size: 12px; color: var(--muted); }
.panel summary { font-size: 14px; font-weight: 500; }
.field, .field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea { color: var(--text); font-weight: 400; }
.lead, .desc, .description, .answer, .hint, .features small, .preset small, .radio-card small, .fineprint, .l-meta, .teach-card .sub { font-weight: 400; }
.login-left .lead { font-size: clamp(16px, 1.4vw, 18px); line-height: 1.55; color: var(--muted); max-width: 520px; }
.hero .lead { font-size: 16px; color: var(--muted); }
.card .course, .mock-course { font-weight: 500; }
.info-grid dt { color: var(--muted-2); }
.info-grid dd { font-weight: 500; }

/* ================= Стиль: поверхні — картки з «клавішною» тінню ================= */
.topbar {
  top: 12px; margin: 12px auto 0; width: min(1080px, calc(100% - 32px)); padding: 8px 8px 8px 16px;
  background: rgba(7, 8, 10, 0.72); backdrop-filter: blur(48px) saturate(1.2); -webkit-backdrop-filter: blur(48px) saturate(1.2);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: none;
}
.hero, .stat, .panel, .card, .features li, .mock, .teach-card, .preset, .radio-card, .model-list,
.tables-box, .team-box, .lecture, .empty, .pro-col {
  background: var(--ink); border: 0; border-radius: var(--radius); box-shadow: var(--key);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.description, .signature-preview, .howto { background: var(--surface-2); border: 0; border-radius: 12px; box-shadow: none; }
.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
/* Привітання — не картка, а відкритий простір */
.hero { background: transparent; box-shadow: none; border-radius: 0; padding: 32px 0 28px; margin-bottom: 18px; }
.hero::after { display: none; }
.stats { gap: 12px; }
.stat { padding: 16px 18px; }
.s-icon, .p-icon { display: none !important; }
.card { padding: 16px 20px 16px 22px; }
.card::before, .teach-card::before { width: 2px; top: 14px; bottom: 14px; border-radius: 2px; }
.card:hover, .stat:hover, .teach-card:hover, .preset:hover, button.stat:hover { transform: none; box-shadow: var(--key-hi); }
.card .main:hover h3 { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--muted-2); }
.stat.active { box-shadow: var(--key-hi), 0 0 0 1px rgba(255, 255, 255, 0.35); }
.card.working { box-shadow: var(--key-hi); }
.card.working::after { height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 200% 100%; }

.drawer-backdrop, .modal-backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.drawer-panel { background: var(--ink); border-left: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow-lg); }
.modal-card { background: var(--ink); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); }
.dtabs, .vtabs { border-bottom: 1px solid var(--line); }
.dtabs button, .vtabs button { font-size: 13px; font-weight: 500; border-bottom-width: 1px; }
.dtabs button.active, .vtabs button.active { border-bottom-color: var(--text); }
.toast { background: var(--raised); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; }

/* ================= Стиль: кнопки — нейтральні, без кольорових CTA ================= */
.btn, .btn-google {
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 500; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover, .btn-google:hover { background: var(--surface-2); border-color: #4a4b4d; transform: none; box-shadow: none; filter: none; }
.btn:active, .btn-google:active { transform: none; }
.btn.ghost, .btn.glass { background: transparent; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.big { padding: 11px 18px; font-size: 14.5px; border-radius: 10px; }
/* Єдина заповнена дія — світла «Mist» з графітовим текстом */
.btn.primary, .btn-google {
  background: var(--btn-fill); color: var(--btn-fill-text); border: 1px solid var(--btn-fill);
  box-shadow: var(--lift); filter: none;
}
.btn.primary:hover, .btn-google:hover { background: #ffffff; border-color: #ffffff; color: #2f3031; }
.btn-google { padding: 12px 20px; font-size: 15px; gap: 12px; border-radius: 10px; }
.btn-google svg { flex: none; }
.btn:focus-visible, .btn-google:focus-visible, button:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.5); outline-offset: 2px; }

/* ================= Стиль: поля — «колодязь» із легким білим тоном ================= */
select, input[type="search"], input[type="text"], input[type="number"], textarea {
  background: var(--surface-2); color: var(--text); border: 1px solid transparent; border-radius: 8px;
  padding: 8px 12px; backdrop-filter: none; -webkit-backdrop-filter: none;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
select:focus, input:focus, textarea:focus { border-color: var(--border); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06); }
select option { background: var(--ink); color: var(--text); }
.check input, .radio-card input { accent-color: var(--accent); }

/* ================= Стиль: перемикачі-сегменти ================= */
.tabs, .teach-tabs {
  background: var(--ink); border: 0; padding: 3px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line);
  backdrop-filter: none; -webkit-backdrop-filter: none; gap: 2px;
}
.tabs button, .teach-tabs button {
  background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); border: 0; box-shadow: none;
  font-size: 13px; font-weight: 500;
}
.tabs button:hover, .teach-tabs button:hover { color: var(--text); }
.tabs button.active, .teach-tabs button.active { background: var(--raised); color: var(--text); box-shadow: rgba(255, 255, 255, 0.1) 0 1px 0 0 inset; }
.tabs .count { color: var(--muted-2); }

/* ================= Стиль: мітки ================= */
.badge, .pill, .chip { background: var(--raised); color: var(--text); border: 0; border-radius: 6px; padding: 2px 7px; font-size: 12px; font-weight: 500; }
.chip { color: var(--muted); }
.chip.note { color: var(--text); background: var(--raised); }
.badge.todo { color: var(--text); background: var(--raised); }
.badge.overdue, .badge.demo { color: var(--accent); background: var(--accent-tint); }
.badge.done, .badge.returned { color: var(--muted); background: var(--raised); }
.badge.draft { color: var(--text); background: var(--raised); box-shadow: rgba(255, 255, 255, 0.1) 0 1px 0 0 inset; }
.pill.warn { color: var(--accent); background: var(--accent-tint); }
.pill.ok { color: var(--ok); background: rgba(89, 212, 153, 0.12); }
.due { font-weight: 500; }
.due.soon { color: var(--text); }
.due.late { color: var(--accent); }
.stat.todo .num, .stat.draft .num { color: var(--text); }
.stat.overdue .num { color: var(--accent); }
.stat.done .num { color: var(--muted); }
.mini-model { background: var(--raised); border: 0; color: var(--text); border-radius: 6px; font-weight: 500; }
.mini-model.busy { background: var(--accent-tint); color: var(--accent); }
.model-pill { background: var(--raised); color: var(--text); border-radius: 8px; font-weight: 500; }
.chips.selectable button { background: transparent; border-color: var(--border); border-radius: 8px; font-size: 13px; font-weight: 500; }
.chips.selectable button:hover { background: var(--surface-2); }
.chips.selectable button.on { background: var(--btn-fill); color: var(--btn-fill-text); border-color: var(--btn-fill); }
.preset.on, .radio-card:has(input:checked) { box-shadow: var(--key-hi), 0 0 0 1px rgba(255, 255, 255, 0.35); background: var(--ink); }
.preset.on::after { color: var(--text); }
.lecture.hit { box-shadow: var(--key-hi); background: var(--ink); }
.error-box { background: var(--accent-tint); border: 0; color: #f7d08a; border-radius: 10px; }
.note-saved { color: var(--ok); font-weight: 500; }
.subject-list button { background: var(--surface-2); border: 0; border-radius: 6px; font-weight: 500; }
.subject-list button:hover { background: var(--raised); }
.member.editor { border-top: 1px solid var(--line); }
.model-list { background: var(--ink); }
.model-item { border-bottom-color: var(--line); }

/* Аватари, кільце прогресу, макети */
.avatar, .person .ava { background: var(--raised); color: var(--text); font-weight: 500; }
.ring-bg { stroke: var(--raised); stroke-width: 7; }
.ring-fg { stroke: var(--text); stroke-width: 7; stroke-linecap: round; }
.mock-bar { background: var(--raised); height: 3px; }
.mock-bar span { background: var(--accent); }
.paper { border-radius: 6px; box-shadow: none; }
.titlepage { border-radius: 6px; box-shadow: none; }
.usage { margin-top: 18px; font: 12px/1.5 var(--mono); letter-spacing: 0.017em; color: var(--muted-2); }
.usage b { color: var(--text-2); font-weight: 500; }
.legal, .legal a { color: var(--muted-2); }

/* Логотип — кораловий знак з літерою */
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; font-size: 0; background: var(--accent); box-shadow: rgba(255, 255, 255, 0.25) 0 1px 0 0 inset;
  position: relative;
}
.logo-mark::after { content: "S"; position: absolute; inset: 0; display: grid; place-items: center; color: #1a1406; font: 600 16px/1 "Inter", sans-serif; }
.logo-mark, .logo-mark.small { font-size: 0; color: transparent; overflow: hidden; }
.logo-mark.small { width: 22px; height: 22px; border-radius: 6px; }
.logo-mark.small::after { font-size: 13px; }

/* Технічна мітка внизу праворуч — моноширинним, як метадані */
.side-label {
  position: fixed; right: 16px; bottom: 14px; top: auto; transform: none; writing-mode: horizontal-tb;
  font: 11px/1 var(--mono); letter-spacing: 0.05em; color: var(--muted-2); pointer-events: none; z-index: 1; white-space: nowrap;
}
@media (max-width: 1439px) { .side-label { display: none; } }

/* ================= Головна для гостей: атмосферний «кінематографічний» фон ================= */
.login { position: relative; overflow: hidden; isolation: isolate; }
.login::before {
  content: ""; position: absolute; inset: -10% -10% 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 45% at 72% 28%, rgba(4, 63, 150, 0.7), rgba(6, 18, 37, 0.25) 60%, transparent 78%),
    radial-gradient(40% 35% at 20% 85%, rgba(20, 60, 163, 0.25), transparent 70%);
}
.login::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; filter: blur(42px); opacity: 0.85;
  background:
    linear-gradient(118deg, transparent 46%, rgba(242, 184, 75, 0.55) 50%, transparent 55%),
    linear-gradient(118deg, transparent 58%, rgba(242, 184, 75, 0.28) 61%, transparent 65%);
}
.login-wrap { position: relative; z-index: 1; }
.features li { padding: 16px; gap: 14px; }
.f-icon { width: 36px; height: 36px; border-radius: 99999px; background: var(--raised); font-size: 17px; box-shadow: rgba(255, 255, 255, 0.1) 0 1px 0 0 inset; }
.features b { font-weight: 500; }
.mock { background: rgba(7, 8, 10, 0.86); border-radius: 14px; box-shadow: var(--key-hi), var(--shadow-lg); }
.mock-title { font-weight: 500; }
.fineprint { font-size: 13px; color: var(--muted-2); }

/* ================= Адаптив ================= */
@media (max-width: 960px) {
  .login-wrap { grid-template-columns: 1fr; gap: 30px; }
  .login-right { height: 300px; max-width: 520px; width: 100%; justify-self: center; }
  .mock-3 { display: none; }
  .mock { width: 290px; }
  .mock-2 { top: 160px; }
  .preset-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; }
  .login-right { display: none; }
  .hero { grid-template-columns: 1fr; padding: 20px; }
  .ring-box { position: absolute; top: 16px; right: 16px; width: 76px; height: 76px; }
  .ring-label b { font-size: 15px; }
  .ring-label span { font-size: 10px; }
  .hero .display.small { padding-right: 84px; }
  .hero-actions .btn { width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .stat:first-child { grid-column: span 2; }
  .grid3, .mode-grid, .preset-grid { grid-template-columns: 1fr; }
  .card { grid-template-columns: 1fr; }
  .card .actions { flex-direction: row; flex-wrap: wrap; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .filters .icon { justify-self: start; }
  .filters input { width: 100%; grid-column: 1 / -1; }
  .drawer-panel { padding: 18px 16px 30px; }
  .info-grid { grid-template-columns: 1fr; gap: 2px; }
  .info-grid dd { margin-bottom: 7px; }
  .user-text, .topbar .brand-name { display: none; }
  .user { gap: 6px; }
  /* у адміна в шапці на одну кнопку більше — аватар ховаємо, щоб усе влізло */
  .user:has(#adminLink:not(.hidden)) .avatar { display: none; }
  .teach-grid { grid-template-columns: 1fr; }
  .filters select { max-width: none; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Доступ до файлів викладача */
.files-access { margin-top: 10px; display: grid; gap: 8px; }
.files-access ul { margin: 0; padding-left: 18px; }
.files-access .btn { justify-self: start; }
/* Вікно Google Picker — поверх шухляди завдання */
.picker-dialog-bg, .picker-dialog { z-index: 10000 !important; }

/* Юридичні посилання (потрібні для верифікації Google) */
.legal { text-align: center; font-size: 12.5px; color: var(--muted); padding: 18px 16px 26px; position: relative; z-index: 1; }
.legal p { margin: 0 auto 6px; max-width: 640px; }
.legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
#login .legal { grid-column: 1 / -1; }
#login:not(.hidden) ~ .app-legal { display: none; }

/* ===== Pro й оплата ===== */
.pro-compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pro-col .btn { justify-self: start; margin-top: 6px; }
.pro-col .price small { font-size: 13px; color: var(--muted); }
.pro-col { padding: 18px 18px; display: grid; gap: 6px; align-content: start; }
.pro-col.on { box-shadow: var(--key-hi), 0 0 0 1px rgba(255, 255, 255, 0.4); }
.pro-col h4 { margin: 0 0 4px; font-weight: 500; font-size: 15px; }
.pro-col ul { margin: 0; padding-left: 18px; font-size: 14px; }
.pro-col .price { font-size: 26px; font-weight: 500; }
.pay-box { background: var(--ink); box-shadow: var(--key); border-radius: 16px; padding: 14px 16px; display: grid; gap: 10px; }
.pay-row { display: grid; gap: 4px; }
.pay-row small { font-size: 12px; font-weight: 500; color: var(--muted); }
.pay-value { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pay-value code { font: 500 15px/1.4 var(--mono); overflow-wrap: anywhere; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; }
.pay-value code.big { font-size: 22px; }
.pay-warn { font-size: 13px; color: var(--accent); }
.pay-state { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.ref-box { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.ref-box .pay-value code { word-break: break-all; }
.ref-note { background: var(--accent-tint); color: #f9dfae; border-radius: 8px; padding: 8px 12px; font-size: 14px; justify-self: start; }
.price s { color: var(--muted); font-size: 15px; margin-right: 6px; }
.donate-box { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; justify-items: start; }
@media (max-width: 860px) { .pro-compare { grid-template-columns: 1fr; } }

/* Moodle */
.moodle-body { display: grid; gap: 12px; }
.moodle-body .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.moodle-body .field { display: grid; gap: 6px; font-size: 14px; }
.moodle-body input { width: 100%; }
.todo-notes { background: var(--ink); box-shadow: var(--key); border-radius: 12px; padding: 12px 16px; font-size: 14px; }
.todo-notes p { margin: 6px 0 0; }
.upsell-box { background: var(--accent-tint); box-shadow: rgba(255, 255, 255, 0.06) 0 1px 0 0 inset, rgba(242, 184, 75, 0.35) 0 0 0 1px; border-radius: 12px; padding: 14px 16px; font-size: 14px; display: grid; gap: 10px; }
.upsell-box p { margin: 0; }
.upsell-box .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.upsell-box, .todo-notes { margin-bottom: 14px; }
