/* ==========================================================================
   core code helper — стилі
   Кольори задані змінними: світла тема за замовчуванням, темна — через
   prefers-color-scheme або перемикач (html[data-theme]).
   ========================================================================== */

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --surface-3: #e8e8e3;
  --border: #e2e2dc;
  --border-strong: #cfcfc7;
  --text: #1c1d1f;
  --text-2: #55585e;
  --text-3: #868a91;
  --accent: #0b7a6e;
  --accent-hover: #086257;
  --accent-soft: #e2f3f0;
  --accent-text: #ffffff;
  --danger: #c2362b;
  --danger-soft: #fbe9e7;
  --todo: #a3a7ad;
  --learning: #d58a06;
  --done: #16934a;
  --mark: #ffe58a;

  --code-bg: #f3f4f1;
  --code-border: #e3e4df;
  --code-text: #24292f;
  --inline-code-bg: #eceee9;
  --hl-comment: #6e7781;
  --hl-keyword: #cf222e;
  --hl-string: #0a3069;
  --hl-number: #0550ae;
  --hl-title: #8250df;
  --hl-builtin: #0b7a6e;
  --hl-attr: #953800;
  --hl-variable: #953800;

  --c-note: #2f6fd6;
  --c-tip: #16934a;
  --c-important: #7c4ddb;
  --c-warning: #c47f00;
  --c-caution: #d1352b;
  --c-example: #0b7a6e;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 40px rgb(0 0 0 / 0.18);
  --topbar-h: 56px;
  --sidebar-w: 290px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111316;
    --surface: #171a1e;
    --surface-2: #1e2227;
    --surface-3: #262b31;
    --border: #2a2f36;
    --border-strong: #3a4049;
    --text: #e5e7ea;
    --text-2: #a6adb7;
    --text-3: #747c87;
    --accent: #3cc8b4;
    --accent-hover: #5ad6c4;
    --accent-soft: rgb(60 200 180 / 0.12);
    --accent-text: #08201c;
    --danger: #ef6b5f;
    --danger-soft: rgb(239 107 95 / 0.12);
    --todo: #5d646e;
    --learning: #f0a92a;
    --done: #3ccb74;
    --mark: #6b5a12;

    --code-bg: #0d0f12;
    --code-border: #252a31;
    --code-text: #d7dce2;
    --inline-code-bg: #252a31;
    --hl-comment: #7b8592;
    --hl-keyword: #ff7b72;
    --hl-string: #a5d6ff;
    --hl-number: #79c0ff;
    --hl-title: #d2a8ff;
    --hl-builtin: #5ad6c4;
    --hl-attr: #ffa657;
    --hl-variable: #ffa657;

    --c-note: #5b9bff;
    --c-tip: #3ccb74;
    --c-important: #a78bfa;
    --c-warning: #f0a92a;
    --c-caution: #ff6b61;
    --c-example: #3cc8b4;

    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 10px 40px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111316;
  --surface: #171a1e;
  --surface-2: #1e2227;
  --surface-3: #262b31;
  --border: #2a2f36;
  --border-strong: #3a4049;
  --text: #e5e7ea;
  --text-2: #a6adb7;
  --text-3: #747c87;
  --accent: #3cc8b4;
  --accent-hover: #5ad6c4;
  --accent-soft: rgb(60 200 180 / 0.12);
  --accent-text: #08201c;
  --danger: #ef6b5f;
  --danger-soft: rgb(239 107 95 / 0.12);
  --todo: #5d646e;
  --learning: #f0a92a;
  --done: #3ccb74;
  --mark: #6b5a12;

  --code-bg: #0d0f12;
  --code-border: #252a31;
  --code-text: #d7dce2;
  --inline-code-bg: #252a31;
  --hl-comment: #7b8592;
  --hl-keyword: #ff7b72;
  --hl-string: #a5d6ff;
  --hl-number: #79c0ff;
  --hl-title: #d2a8ff;
  --hl-builtin: #5ad6c4;
  --hl-attr: #ffa657;
  --hl-variable: #ffa657;

  --c-note: #5b9bff;
  --c-tip: #3ccb74;
  --c-important: #a78bfa;
  --c-warning: #f0a92a;
  --c-caution: #ff6b61;
  --c-example: #3cc8b4;

  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  --shadow-lg: 0 10px 40px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

/* --- База ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

button, input, select, textarea { font: inherit; color: inherit; }

kbd {
  font: 600 11px/1 var(--mono);
  padding: 3px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  white-space: nowrap;
}

.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Кнопки й поля -------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn kbd { background: transparent; border-color: currentColor; color: inherit; opacity: .7; }
.btn svg { flex: none; width: 16px; height: 16px; }
.btn-sm svg { width: 15px; height: 15px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
}
.textarea { height: auto; padding: 10px 11px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-weight: 400; color: var(--text-3); font-size: 12.5px; }
.field-label .hint { margin-left: 6px; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 16px;
}

/* --- Верхня панель -------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none !important;
  min-width: calc(var(--sidebar-w) - 70px);
}
.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
}
.brand-mark svg { width: 18px; height: 18px; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 420px;
  height: 36px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger svg { width: 16px; height: 16px; flex: none; }
.search-trigger span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar-actions form { display: contents; }
.menu-btn { display: none; }

/* --- Каркас --------------------------------------------------------------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 14px 10px 24px; overscroll-behavior: contain; }

.side-link, .side-section summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  text-decoration: none !important;
}
.side-link:hover, .side-section summary:hover { background: var(--surface-2); }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.side-link svg { width: 17px; height: 17px; color: var(--text-3); }

.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 4px 6px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.side-add-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--text-2);
}
.side-add-btn:hover { background: var(--accent-soft); color: var(--accent); }
.side-add-btn svg { width: 16px; height: 16px; }
.side-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none !important;
}
.side-empty:hover { border-color: var(--accent); color: var(--accent); }
.side-empty svg { width: 17px; height: 17px; }

.side-section summary { list-style: none; }
.side-section summary::-webkit-details-marker { display: none; }
.side-section summary .chev { margin-left: auto; width: 14px; height: 14px; color: var(--text-3); transition: transform .15s; }
.side-section[open] summary .chev { transform: rotate(90deg); }
.side-section .emoji { width: 20px; text-align: center; font-size: 15px; }
.side-section .count { font-size: 11.5px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.side-section summary.active-section { color: var(--accent); }

.side-notes { list-style: none; margin: 2px 0 8px; padding: 0 0 0 19px; }
.side-notes a {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 5px 10px;
  border-left: 1px solid var(--border);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none !important;
}
.side-notes a:hover { color: var(--text); background: var(--surface-2); border-radius: 0 6px 6px 0; }
.side-notes a.active { color: var(--accent); font-weight: 600; border-left: 2px solid var(--accent); padding-left: 9px; background: var(--accent-soft); border-radius: 0 6px 6px 0; }
.side-add { color: var(--text-3) !important; font-size: 13px !important; }

.sidebar-footer {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12px;
  text-decoration: none !important;
}
.sidebar-footer a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-footer svg { width: 17px; height: 17px; }

/* Статус вивчення: кружечок біля назви */
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--todo); transform: translateY(-1px); }
.dot.learning { border-color: var(--learning); background: var(--learning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--learning) 22%, transparent); }
.dot.done { border-color: var(--done); background: var(--done); }

.main { min-width: 0; padding: 32px 40px 80px; }
.page { max-width: 1040px; margin: 0 auto; }
.page-narrow { max-width: 760px; margin: 0 auto; }

.backdrop { display: none; }

/* --- Заголовки сторінок --------------------------------------------------- */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -0.02em; }
.page-head p { margin: 8px 0 0; color: var(--text-2); max-width: 640px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-emoji { font-size: 34px; line-height: 1; margin-bottom: 10px; }

.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; color: var(--text-3); }
.crumbs a { color: var(--text-2); }

/* --- Головна -------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 28px 30px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(600px 200px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
}
.hero h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.02em; }
.hero p { margin: 0 0 18px; color: var(--text-2); }
.hero-search { display: flex; gap: 8px; max-width: 520px; }
.hero-search .input { height: 42px; }
.hero-search .btn { height: 42px; }

.ring { position: relative; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: var(--done); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font-size: 24px; line-height: 1; }
.ring-label span { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.block-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 14px; font-size: 18px; letter-spacing: -0.01em; }
.block-title a { font-size: 14px; font-weight: 500; }

.grid-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 36px; }

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none !important;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .emoji { font-size: 24px; }
.card-head h3 { margin: 0; font-size: 17px; }
.card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; flex: 1; }
.card-new { flex-direction: row; align-items: center; justify-content: center; border-style: dashed; color: var(--text-3); min-height: 120px; font-weight: 600; }
.card-new svg { width: 20px; height: 20px; }
.card-new:hover { color: var(--accent); border-color: var(--accent); }

.progress { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.bar { flex: 1; display: flex; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar .done { background: var(--done); }
.bar .learning { background: var(--learning); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }

.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.list li + li { border-top: 1px solid var(--border); }
.list a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: var(--text); text-decoration: none !important; }
.list a:hover { background: var(--surface-2); }
.list .title { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.list .dot { transform: none; }
.list-empty { padding: 18px; color: var(--text-3); font-size: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* --- Розділ --------------------------------------------------------------- */

.note-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: n; }
.note-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none !important;
  transition: border-color .15s, box-shadow .15s;
}
.note-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.note-card .num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 700;
  font-size: 14px;
}
.note-card.done .num { background: color-mix(in srgb, var(--done) 15%, transparent); color: var(--done); }
.note-card.learning .num { background: color-mix(in srgb, var(--learning) 16%, transparent); color: var(--learning); }
.note-card h3 { margin: 4px 0 4px; font-size: 16.5px; }
.note-card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.note-card .tags { margin-top: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.learning { background: color-mix(in srgb, var(--learning) 15%, transparent); color: var(--learning); }
.badge.done { background: color-mix(in srgb, var(--done) 14%, transparent); color: var(--done); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 1px 8px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-family: var(--mono); }
a.tag:hover { color: var(--accent); text-decoration: none; }

.empty {
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-2);
}
.empty .emoji { font-size: 36px; }
.empty h3 { margin: 10px 0 6px; color: var(--text); }
.empty p { margin: 0 0 18px; }

/* --- Нотатка -------------------------------------------------------------- */

.note-layout { display: grid; grid-template-columns: minmax(0, 780px) 220px; gap: 56px; justify-content: center; }

.note-title { margin: 0; font-size: 34px; line-height: 1.18; letter-spacing: -0.025em; }
.note-lead { margin: 12px 0 0; font-size: 18px; line-height: 1.55; color: var(--text-2); }

.note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 22px 0 30px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
}
.note-meta .spacer { flex: 1; }
.note-meta form { display: contents; }

.segmented { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--surface-2); gap: 2px; }
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none !important;
}
.pager a:hover { border-color: var(--accent); }
.pager small { color: var(--text-3); font-size: 12.5px; }
.pager strong { font-weight: 600; color: var(--accent); }
.pager .next { grid-column: 2; text-align: right; }

.toc { position: sticky; top: calc(var(--topbar-h) + 32px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 64px); overflow-y: auto; font-size: 13.5px; }
.toc-title { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-2); line-height: 1.4; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc .l3 a { padding-left: 26px; font-size: 13px; }

/* --- Типографіка контенту (markdown) -------------------------------------- */

.prose { font-size: 16.5px; line-height: 1.75; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { position: relative; line-height: 1.3; letter-spacing: -0.015em; scroll-margin-top: calc(var(--topbar-h) + 20px); }
.prose h1 { font-size: 28px; margin: 2em 0 .6em; }
.prose h2 { font-size: 24px; margin: 2.2em 0 .7em; padding-bottom: .35em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 19px; margin: 1.8em 0 .5em; }
.prose h4 { font-size: 16.5px; margin: 1.6em 0 .4em; }
.prose .anchor { position: absolute; left: -1.1em; padding-right: .3em; color: var(--text-3); opacity: 0; text-decoration: none; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.6em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--text-3); }
.prose li > p { margin: 0 0 .4em; }
.prose strong { font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
/* Картинка зі зміненим розміром зберігається як <img width> без абзацу навколо. */
.prose > img, .prose li > img, .prose blockquote > img { display: block; margin: 0 0 1.2em; }
.prose mark, mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

/* Лігатури (Cascadia Code тощо) склеюють --- і -> у символи — у коді це шкодить. */
code, kbd, pre, .source { font-variant-ligatures: none; }

.prose code {
  padding: .15em .4em;
  border-radius: 5px;
  background: var(--inline-code-bg);
  font: .88em/1.5 var(--mono);
}

.prose blockquote {
  margin: 0 0 1.3em;
  padding: .2em 0 .2em 1.1em;
  border-left: 3px solid var(--border-strong);
  color: var(--text-2);
}
.prose blockquote > :last-child { margin-bottom: 0; }

/* Блоки-пояснення: > [!TIP] */
.prose .callout {
  --c: var(--c-note);
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  border-left: 4px solid var(--c);
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 7%, var(--surface));
  color: var(--text);
}
.prose .callout-tip { --c: var(--c-tip); }
.prose .callout-important { --c: var(--c-important); }
.prose .callout-warning { --c: var(--c-warning); }
.prose .callout-caution { --c: var(--c-caution); }
.prose .callout-example { --c: var(--c-example); }
.callout-title { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 700; color: var(--c); font-size: 15px; }
.callout-title::before { font-size: 16px; }
.callout-note .callout-title::before { content: "ℹ️"; }
.callout-tip .callout-title::before { content: "💡"; }
.callout-important .callout-title::before { content: "❗"; }
.callout-warning .callout-title::before { content: "⚠️"; }
.callout-caution .callout-title::before { content: "🛑"; }
.callout-example .callout-title::before { content: "🧪"; }
.prose .callout p { margin-bottom: .6em; }
.prose .callout .codeblock { margin-bottom: .6em; }

/* Код */
.codeblock {
  position: relative;
  margin: 0 0 1.3em;
  border: 1px solid var(--code-border);
  border-radius: 9px;
  background: var(--code-bg);
  overflow: hidden;
}
.codeblock::before {
  content: attr(data-lang);
  display: block;
  padding: 6px 14px;
  border-bottom: 1px solid var(--code-border);
  font: 600 11.5px/1.5 var(--mono);
  color: var(--text-3);
  letter-spacing: .02em;
}
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.prose .codeblock code, .codeblock code { padding: 0; background: none; border-radius: 0; font: 14px/1.65 var(--mono); color: var(--code-text); white-space: pre; }
.copy-btn {
  position: absolute;
  top: 3px;
  right: 6px;
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn.ok { color: var(--done); }

.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-meta .hljs-keyword, .hljs-doctag, .hljs-section { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: var(--hl-string); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: var(--hl-number); }
.hljs-title, .hljs-title.function_, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: var(--hl-title); }
.hljs-built_in, .hljs-type, .hljs-class .hljs-title { color: var(--hl-builtin); }
.hljs-attr, .hljs-attribute, .hljs-params, .hljs-meta { color: var(--hl-attr); }
.hljs-variable, .hljs-template-variable, .hljs-subst { color: var(--hl-variable); }
.hljs-deletion { color: var(--hl-keyword); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* Таблиці */
.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 1.4em;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.5;
}
.prose th, .prose td { padding: 8px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

/* Спойлери для самоперевірки */
.prose details {
  margin: 0 0 1.2em;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.prose details > summary { padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--text); }
.prose details > summary:hover { color: var(--accent); }
.prose details[open] > summary { border-bottom: 1px solid var(--border); }
.prose details > :not(summary) { margin-left: 14px; margin-right: 14px; }
.prose details > :nth-child(2) { margin-top: 12px; }
.prose details > :last-child { margin-bottom: 12px; }

.prose kbd { font-size: .78em; }

/* Підсвітка знайденого в пошуку */
mark.hl { background: var(--mark); box-shadow: 0 0 0 2px var(--mark); }

/* --- Пошук ---------------------------------------------------------------- */

.search-page form { display: flex; gap: 8px; margin-bottom: 24px; }
.search-page .input { height: 44px; font-size: 16px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.result { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none !important; }
.result:hover { border-color: var(--accent); }
.result-head { display: flex; align-items: center; gap: 10px; }
.result-head strong { font-size: 16px; }
.result-section { margin-left: auto; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.result-snippet { margin: 6px 0 0; font-size: 14px; color: var(--text-2); line-height: 1.55; }

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  background: rgb(10 12 15 / .45);
  backdrop-filter: blur(2px);
}
.search-modal[hidden] { display: none; }
.search-box {
  width: min(640px, 100%);
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.search-input-row svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.search-input-row input { flex: 1; height: 56px; border: 0; outline: none; background: transparent; font-size: 17px; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results li a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.search-results li a.selected { background: var(--accent-soft); }
.search-results li a.selected strong { color: var(--accent); }
.search-results .sr-section { font-size: 12px; color: var(--text-3); }
.search-results .sr-snippet { margin-top: 2px; font-size: 13px; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.search-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); flex-wrap: wrap; }

/* --- Візуальний редактор -------------------------------------------------- */

.editor { display: flex; flex-direction: column; gap: 16px; max-width: 980px; margin: 0 auto; }
.editor-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.title-input {
  flex: 1;
  min-width: 240px;
  height: 52px;
  padding: 0 4px;
  border: 0;
  border-bottom: 2px solid var(--border);
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.title-input:focus { outline: none; border-color: var(--accent); }
.editor-actions { display: flex; gap: 8px; align-items: center; }
.editor-status { font-size: 12.5px; color: var(--learning); margin-right: 4px; }

.editor-fields { display: grid; grid-template-columns: 1.2fr .8fr 1.2fr 90px; gap: 12px; }
.editor-fields .wide { grid-column: 1 / -1; }

/* Панель інструментів прилипає під верхньою панеллю — завжди під рукою. */
.editor-toolbar {
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 2px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.tb-group { display: flex; align-items: center; gap: 2px; padding-right: 6px; margin-right: 4px; border-right: 1px solid var(--border); }
.tb-group:last-of-type, .tb-end { border-right: 0; }
.tb-end { margin-left: auto; }
.tb-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.tb-btn svg { width: 18px; height: 18px; }
.tb-btn:hover { background: var(--surface-2); color: var(--text); }
.tb-btn.active { background: var(--accent-soft); color: var(--accent); }
.tb-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.tb-select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}
.tb-select:hover { border-color: var(--border-strong); }
.tb-select:disabled { opacity: .4; cursor: default; }
.tb-context {
  display: flex;
  flex-basis: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 4px 0;
  margin-top: 2px;
  border-top: 1px dashed var(--border);
}
.tb-context[hidden] { display: none; }
.tb-label { font-size: 12.5px; font-weight: 700; color: var(--text-3); margin-right: 4px; }
.tb-text {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tb-text:hover { border-color: var(--accent); color: var(--accent); }
.tb-text.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Поле тексту виглядає як готова нотатка. */
.editor-surface {
  min-height: 60vh;
  padding: 28px 40px 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: text;
}
.editor-surface:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 4px var(--accent-soft); }
.editor-surface .ProseMirror { min-height: 50vh; outline: none; }
.editor-surface .ProseMirror > :first-child { margin-top: 0; }
.editor-surface p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  color: var(--text-3);
  pointer-events: none;
}
.editor-surface pre {
  margin: 0 0 1.3em;
  padding: 14px 16px;
  border: 1px solid var(--code-border);
  border-radius: 9px;
  background: var(--code-bg);
  overflow-x: auto;
}
.editor-surface pre code { padding: 0; background: none; font: 14px/1.65 var(--mono); color: var(--code-text); white-space: pre; }
.editor-surface .callout::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 15px;
  color: var(--c);
}
.editor-surface img { display: block; }
.editor-surface img.ProseMirror-selectednode { outline: 3px solid var(--accent); }
/* Картинка зі зміною розміру: ручка в правому нижньому куті видна при наведенні та виділенні. */
.img-resizer { position: relative; width: fit-content; max-width: 100%; margin: 0 0 1.2em; }
.img-resizer img { display: block; max-width: 100%; height: auto; margin: 0; }
.img-resizer.ProseMirror-selectednode img { outline: 3px solid var(--accent); }
.img-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow);
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0;
  transition: opacity .15s;
}
.img-resizer:hover .img-handle, .img-resizer.ProseMirror-selectednode .img-handle, .img-resizer.resizing .img-handle { opacity: 1; }
.img-resizer.resizing { user-select: none; }
.tb-hint { margin-left: 6px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (hover: none) { .img-handle { opacity: 1; width: 22px; height: 22px; right: -10px; bottom: -10px; } }
.editor-surface table { display: table; width: 100%; table-layout: fixed; }
.editor-surface td, .editor-surface th { position: relative; min-width: 80px; }
.editor-surface td p, .editor-surface th p { margin: 0; }
.editor-surface .selectedCell::after { content: ""; position: absolute; inset: 0; background: var(--accent-soft); pointer-events: none; }
.editor-surface a { cursor: text; }

.details-box { margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.details-summary { padding: 10px 14px; border-bottom: 1px dashed var(--border); font-weight: 600; }
.details-summary::before { content: "❓ "; }
.details-content { padding: 12px 14px 2px; }
.details-content > :last-child { margin-bottom: 10px; }

/* --- Форми, історія, кошик ------------------------------------------------ */

.form-card { display: grid; gap: 18px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.form-row { display: grid; grid-template-columns: 90px 1fr 110px; gap: 14px; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.form-actions .spacer { flex: 1; }
.danger-zone { margin-top: 28px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: var(--radius); }
.danger-zone h3 { margin: 0 0 4px; font-size: 15px; color: var(--danger); }
.danger-zone p { margin: 0 0 12px; font-size: 14px; color: var(--text-2); }

.table-list { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; font-size: 14.5px; }
.table-list th, .table-list td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.table-list th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--surface-2); }
.table-list tr:last-child td { border-bottom: 0; }
.table-list td.actions { text-align: right; white-space: nowrap; }
.table-list td.actions form { display: inline; }

.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 24px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--learning) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--learning) 35%, transparent);
  font-size: 14px;
}
.banner .spacer { flex: 1; }
.banner form { display: contents; }

/* --- Сповіщення ----------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  transition: opacity .3s, transform .3s;
}
.toast.hide { opacity: 0; transform: translate(-50%, 10px); pointer-events: none; }

/* --- Вхід ----------------------------------------------------------------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(800px 400px at 50% 0%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { width: min(380px, 100%); padding: 32px 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; margin-bottom: 6px; min-width: 0; font-size: 19px; }
.login-card .brand-mark { width: 36px; height: 36px; }
.login-card p.sub { margin: 0 0 24px; text-align: center; color: var(--text-3); font-size: 14px; }
.login-card form { display: grid; gap: 14px; }
.login-card .btn { height: 42px; justify-content: center; margin-top: 6px; }

/* --- Адаптивність --------------------------------------------------------- */

@media (max-width: 1280px) {
  .note-layout { grid-template-columns: minmax(0, 780px); }
  .toc { display: none; }
}

@media (max-width: 960px) {
  :root { --sidebar-w: 300px; }
  .menu-btn { display: inline-grid; }
  .brand { min-width: 0; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 40;
    width: min(var(--sidebar-w), 86vw);
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 35; background: rgb(0 0 0 / .35); }
  .main { padding: 24px 16px 64px; }
  .two-col { grid-template-columns: 1fr; }
  .editor-fields { grid-template-columns: 1fr 1fr; }
  .editor-surface { padding: 20px 20px 32px; }
}

@media (max-width: 640px) {
  .brand-text { display: none; }
  .search-trigger kbd { display: none; }
  .search-trigger { flex: 1 1 auto; min-width: 0; padding: 0 10px; }
  .topbar-actions { margin-left: 0; gap: 0; }
  .topbar { gap: 6px; padding: 0 10px; }
  .topbar-actions .btn-label { display: none; }
  .hero { grid-template-columns: 1fr; padding: 22px 18px; }
  .ring { display: none; }
  .note-title { font-size: 27px; }
  .note-lead { font-size: 16.5px; }
  .prose { font-size: 16px; }
  .prose h2 { font-size: 21px; }
  .page-head h1 { font-size: 25px; }
  .note-card { grid-template-columns: 30px minmax(0, 1fr); }
  .note-card .badge { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .editor-head { flex-wrap: wrap; }
  .editor-actions { width: 100%; justify-content: flex-end; }
  .tb-group { border-right: 0; padding-right: 0; margin-right: 0; }
  .tb-end { margin-left: 0; }
  .tb-btn { width: 32px; height: 32px; }
  .editor-toolbar { top: calc(var(--topbar-h) + 4px); padding: 4px; }
  .editor-fields { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .table-list .hide-sm { display: none; }
}

/* --- Користувач і акаунт -------------------------------------------------- */

.user-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; text-decoration: none !important; }
.user-btn:hover .avatar { box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 700;
}
.avatar-lg { width: 56px; height: 56px; font-size: 24px; }

.account-head { display: flex; align-items: center; gap: 16px; }
.account-head strong { font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats div { display: flex; flex-direction: column; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.stats strong { font-size: 20px; }
.stats span { font-size: 12.5px; color: var(--text-3); }

.onboarding { padding: 56px 24px; background: var(--surface); }
.onboarding p { max-width: 460px; margin-left: auto; margin-right: auto; }

/* --- Вхід через Google ---------------------------------------------------- */

.btn-google { width: 100%; height: 44px; justify-content: center; gap: 10px; font-size: 15px; }
.btn-google svg { width: 20px; height: 20px; }
.login-note { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--text-3); }
.login-more { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.login-more summary { cursor: pointer; text-align: center; font-size: 13.5px; color: var(--text-2); list-style: none; }
.login-more summary::-webkit-details-marker { display: none; }
.login-more summary:hover { color: var(--accent); }
.login-more[open] summary { margin-bottom: 14px; }

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
}

/* --- Спільнота: картки статей, рубрики, лічильники ------------------------- */

.avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.avatar-xl { width: 88px; height: 88px; font-size: 36px; }

.grid-articles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.article-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none !important;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.article-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.article-card h3 { margin: 0; font-size: 16.5px; line-height: 1.35; }
.article-card p {
  flex: 1;
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-foot { display: flex; align-items: center; gap: 12px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.article-foot .author { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; color: var(--text-2); font-weight: 550; }
.article-foot .author > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.rubric {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none !important;
}
a.rubric:hover { background: var(--accent); color: var(--accent-text); }

.counter { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; color: var(--text-3); white-space: nowrap; }
.counter svg { width: 15px; height: 15px; }
.counter.liked { color: var(--c-caution); }
.counter.liked svg { fill: currentColor; }

/* --- Бібліотека ----------------------------------------------------------- */

.explore-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px) auto; gap: 8px; margin-bottom: 16px; }
.explore-filters .input, .explore-filters .select, .explore-filters .btn { height: 42px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none !important;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-hint { margin-left: auto; color: var(--text-3); font-weight: 500; font-size: 13.5px; }

.filter-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: -4px 0 18px; font-size: 14px; color: var(--text-2); }
.filter-line a { display: inline-flex; align-items: center; gap: 4px; }
.filter-line svg { width: 13px; height: 13px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 24px; font-size: 14px; }

.welcome-banner, .nudge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 24px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.welcome-banner > div, .nudge > div:not(.nudge-actions) { flex: 1; min-width: 0; }
.welcome-banner p, .nudge p { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }
.welcome-icon, .nudge-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
}
.welcome-icon svg, .nudge-icon svg { width: 20px; height: 20px; }
.nudge-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nudge-actions form { display: contents; }

.suggestions { margin-top: 36px; }
.suggestions .block-title > span { display: inline-flex; align-items: center; gap: 8px; }
.suggestions .block-title svg { width: 18px; height: 18px; color: var(--accent); }

/* --- Стаття ---------------------------------------------------------------- */

.byline { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-top: 22px; }
.author-chip { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.author-chip .avatar { width: 36px; height: 36px; font-size: 16px; }
.author-chip strong { display: block; font-size: 15px; line-height: 1.3; }
.author-chip small { display: block; font-size: 12.5px; color: var(--text-3); }
.author-chip:hover strong { color: var(--accent); }

.article-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 18px 0 30px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.article-actions .spacer { flex: 1; }
.like-btn { gap: 7px; font-variant-numeric: tabular-nums; }
.like-btn svg { transition: transform .15s; }
.like-btn:hover { color: var(--c-caution); border-color: color-mix(in srgb, var(--c-caution) 50%, transparent); }
.like-btn.liked { color: var(--c-caution); border-color: color-mix(in srgb, var(--c-caution) 45%, transparent); background: color-mix(in srgb, var(--c-caution) 8%, var(--surface)); }
.like-btn.liked svg { fill: currentColor; transform: scale(1.08); }
.import-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.import-target { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13.5px; }
.import-target .select { width: auto; max-width: 220px; height: 36px; font-size: 14px; }

.author-card { margin-top: 48px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.author-card-head { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none !important; }
.author-card-head small { display: block; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.author-card-head strong { display: block; font-size: 18px; }
.author-card p { margin: 12px 0 0; color: var(--text-2); font-size: 15px; }
.author-card .contacts { margin-top: 14px; }
.author-more { display: inline-block; margin-top: 14px; font-size: 14px; font-weight: 600; }

.contacts { display: flex; flex-wrap: wrap; gap: 8px; }
.contact {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  max-width: 100%;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none !important;
}
.contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact svg { flex: none; width: 15px; height: 15px; }
.contact:hover { border-color: var(--accent); color: var(--accent); }

/* --- Сторінка автора --------------------------------------------------------- */

.author-head { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 36px; padding: 28px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.author-info { flex: 1; min-width: 0; display: grid; gap: 12px; }
.author-info h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.author-bio { margin: 0; color: var(--text-2); }
.author-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 14px; color: var(--text-2); }
.author-edit { flex: none; }

/* --- Нотатка: публікація й походження ------------------------------------- */

.note-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pub-on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.pub-on:hover { background: var(--accent-soft); border-color: var(--accent); }
.pub-stats { display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.btn .pub-stats svg { width: 13px; height: 13px; margin-left: 4px; }
.pub-mark { display: inline-grid; vertical-align: middle; color: var(--accent); }
.pub-mark svg { width: 15px; height: 15px; }

.source-line, .status-line, .tip-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 9px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
}
.source-line svg, .status-line > svg, .tip-line > svg { flex: none; width: 16px; height: 16px; color: var(--accent); }
.source-line { flex-wrap: nowrap; align-items: flex-start; }
.source-line svg { margin-top: 2px; }
.source-line span { flex: 1; min-width: 0; }
.status-line .spacer { flex: 1; }
.tip-line { margin: 0; }
.tip-line span { flex: 1; min-width: 0; }

/* --- Вибір рубрик ------------------------------------------------------------ */

.picker { display: grid; gap: 10px; }
.picker-head { display: flex; align-items: center; gap: 12px; }
.picker-filter { flex: 1; }
.picker-count { flex: none; min-width: 64px; text-align: right; font-size: 13px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.picker-count.full { color: var(--accent); }
.picker-groups {
  display: grid;
  gap: 14px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overscroll-behavior: contain;
}
.picker-group[hidden], .picker-empty[hidden], .picker-selected[hidden] { display: none; }
.picker-label { margin-bottom: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.picker-empty { margin: 0; color: var(--text-3); font-size: 14px; font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip[hidden] { display: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover span { border-color: var(--accent); color: var(--text); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip input:checked + span::before { content: "✓"; margin-right: 6px; font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.disabled { cursor: not-allowed; }
.chip.disabled span { opacity: .45; }
.chip.disabled:hover span { border-color: var(--border-strong); color: var(--text-2); }
.picker-selected { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-selected {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px 0 12px;
  border: 0;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.chip-selected::after { content: "✕"; font-size: 11px; opacity: .8; }
.chip-selected:hover::after { opacity: 1; }

/* На широкому екрані обгортка кнопок редактора не впливає на розкладку. */
.tb-main { display: contents; }

/* --- Профіль --------------------------------------------------------------- */

.profile-fields { display: grid; gap: 18px; }
.fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 12px; }
.fieldset legend { padding: 0; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.fieldset legend .hint { margin-left: 6px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.contact-field .field-label { display: inline-flex; align-items: center; gap: 6px; }
.contact-field .field-label svg { width: 14px; height: 14px; color: var(--text-3); }
.has-error .input { border-color: var(--danger); }
.field-error { font-size: 12.5px; font-weight: 500; color: var(--danger); }
.form-note { margin: 0; font-size: 14px; }
.section-gap { margin-top: 36px; }
.account-card .form-actions form { display: contents; }

.welcome-head { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.welcome-head h1 { margin: 0 0 4px; font-size: 26px; line-height: 1.25; letter-spacing: -0.02em; }
.welcome-head p { margin: 0; color: var(--text-2); }

/* --- Мобільна адаптація ------------------------------------------------------ */

/* Висота з урахуванням панелей браузера на телефоні. */
@supports (height: 100dvh) {
  .sidebar { height: calc(100dvh - var(--topbar-h)); }
  .shell { min-height: calc(100dvh - var(--topbar-h)); }
}

@media (max-width: 960px) {
  .author-head { padding: 22px; }
  .sidebar nav { padding-bottom: 32px; }
  .side-link, .side-section summary { padding: 9px 10px; }
  .side-notes a { padding: 7px 10px; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 54px; }

  /* iOS збільшує сторінку, якщо шрифт поля менший за 16px. */
  .input, .select, .textarea, .search-input-row input { font-size: 16px; }

  .main { padding: 18px 14px 72px; }
  .page-head { margin-bottom: 18px; }
  .page-head p { font-size: 15px; }
  .block-title { flex-wrap: wrap; gap: 4px 12px; }

  .hero { padding: 18px 16px; margin-bottom: 22px; border-radius: 12px; }
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 15px; margin-bottom: 14px; }
  .grid-sections, .grid-articles { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 14px 16px; }
  .card-new { min-height: 64px; }
  .two-col { gap: 22px; }

  .welcome-banner, .nudge { flex-wrap: wrap; align-items: flex-start; padding: 14px; }
  .welcome-banner > div, .nudge > div:not(.nudge-actions) { flex-basis: calc(100% - 54px); }
  .welcome-banner .btn, .nudge-actions { margin-left: 54px; }

  /* Нотатка: статус і дії — окремими рядками, кнопки не злипаються. */
  .note-meta { gap: 10px; margin: 16px 0 22px; }
  .note-meta .spacer { display: none; }
  .note-meta .updated { order: 3; width: 100%; }
  .note-meta .segmented { width: 100%; }
  .note-meta .segmented button { flex: 1; justify-content: center; height: 32px; }
  .note-actions { width: 100%; }
  .note-actions .btn { height: 34px; }
  .prose { font-size: 16px; line-height: 1.7; }
  .prose .anchor { display: none; }
  .codeblock pre { padding: 12px; }
  .prose .codeblock code, .codeblock code { font-size: 13px; }
  .prose table { font-size: 13.5px; }
  .prose th, .prose td { padding: 7px 10px; }
  .copy-btn { height: 28px; }

  /* Стаття */
  .byline { margin-top: 16px; }
  .article-actions { margin: 14px 0 22px; }
  .article-actions .spacer { display: none; }
  .import-form { width: 100%; }
  .import-target { flex: 1; min-width: 0; }
  .import-target .select { flex: 1; max-width: none; height: 40px; }
  .import-form .btn, .article-actions > .btn-primary { flex: 1 1 100%; height: 42px; justify-content: center; }
  .counter-label { display: none; }
  .author-card { margin-top: 36px; padding: 16px; }

  .author-head { flex-direction: column; align-items: center; gap: 14px; padding: 20px 16px; text-align: center; }
  .author-info { justify-items: center; }
  .author-info h1 { font-size: 24px; }
  .author-stats, .author-info .contacts, .author-info .chips-row { justify-content: center; }

  .explore-filters { grid-template-columns: 1fr auto; }
  .explore-filters .select { grid-column: 1 / -1; grid-row: 2; }
  .tab { padding: 8px 12px; }
  .tab-hint { margin-left: 0; }

  /* Редактор: кнопки форматування — один рядок з горизонтальною прокруткою,
     контекстні дії (таблиця, код…) — другим рядком під ним. */
  .editor { gap: 12px; }
  .editor-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .title-input { min-width: 0; height: 46px; font-size: 22px; }
  .editor-actions .btn { flex: 1; justify-content: center; }
  .editor-actions .btn kbd { display: none; }
  .editor-toolbar { border-radius: 8px; }
  .tb-main { display: flex; flex-basis: 100%; min-width: 0; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .tb-main::-webkit-scrollbar, .tb-context::-webkit-scrollbar { display: none; }
  .tb-group { flex: none; }
  .tb-context { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tb-context .tb-label, .tb-context .tb-text, .tb-context .tb-select { flex: none; }
  .tb-text { height: 34px; }
  .editor-surface { min-height: 50vh; padding: 16px 14px 40px; border-radius: 10px; }
  .editor-surface .ProseMirror { min-height: 40vh; }

  /* Форми, профіль, рубрики */
  .form-card { padding: 16px; gap: 16px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn-primary { flex: 1 1 auto; justify-content: center; }
  .contact-grid { grid-template-columns: 1fr; }
  .picker-groups { max-height: 280px; padding: 10px; }
  .chip span { height: 34px; }
  .welcome-head { align-items: flex-start; gap: 14px; }
  .welcome-head h1 { font-size: 22px; }
  .account-head { align-items: flex-start; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div { padding: 10px 12px; }

  .table-list { font-size: 14px; }
  .table-list th, .table-list td { padding: 10px; }
  .table-list td.actions form { display: inline-flex; }

  .search-modal { padding: 8px; }
  .search-box { max-height: calc(100dvh - 16px); }
  .search-foot { display: none; }
  .toast { bottom: 16px; width: max-content; max-width: calc(100vw - 32px); }
  .login-card { padding: 26px 20px; }
}

/* На сенсорних екранах картки не «підстрибують» після дотику. */
@media (hover: none) {
  .article-card:hover, a.card:hover { transform: none; }
}

/* ==========================================================================
   Сторінки для гостей: вітрина зі статтями (як на Medium) і початок статті
   ========================================================================== */

:root {
  --serif: "Iowan Old Style", "Charter", "Georgia", "Cambria", "Times New Roman", serif;
  --dot: color-mix(in srgb, var(--text) 14%, transparent);
}

body.guest { min-height: 100vh; display: flex; flex-direction: column; }
.guest-main { flex: 1; }

.guest-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.guest-bar-inner { display: flex; align-items: center; gap: 16px; max-width: 1160px; height: 64px; margin: 0 auto; padding: 0 24px; }
.guest-bar .brand { min-width: 0; }
.guest-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.guest-link { padding: 0 10px; color: var(--text-2); font-size: 15px; font-weight: 600; }
.guest-link:hover { color: var(--text); text-decoration: none; }

.btn-lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 10px; }
.btn-outline { border-color: var(--border-strong); background: var(--surface); }
.g-badge { display: grid; place-items: center; width: 26px; height: 26px; margin-left: -6px; border-radius: 50%; background: #fff; }
.g-badge svg { width: 17px; height: 17px; }

/* --- Головний екран ----------------------------------------------------------- */

.landing-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
/* Фон: сітка з крапок, як у блокноті, і м'яке світіння кольору сайту. */
.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.2px, transparent 0);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 80% 90% at 70% 40%, #000 30%, transparent 80%);
  pointer-events: none;
}
.landing-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(520px 360px at 78% 30%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(420px 300px at 8% 100%, color-mix(in srgb, var(--c-important) 9%, transparent), transparent 70%);
  pointer-events: none;
}
.landing-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: 48px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 72px 24px 84px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 650;
}
.eyebrow svg { width: 15px; height: 15px; }
.hero-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.025em;
}
.hero-lead { max-width: 560px; margin: 20px 0 30px; color: var(--text-2); font-size: 19px; line-height: 1.6; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 32px 0 0; padding: 0; list-style: none; color: var(--text-3); font-size: 14.5px; }
.hero-stats strong { color: var(--text); font-size: 22px; font-variant-numeric: tabular-nums; margin-right: 4px; }

/* Ілюстрація: картки статей, код, прогрес і реакції. */
.hero-art { position: relative; width: 100%; max-width: 520px; height: 480px; justify-self: end; }
.art-card {
  position: absolute;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 2px 6px rgb(0 0 0 / .05), 0 18px 48px rgb(0 0 0 / .12);
  font-size: 13px;
  color: var(--text);
  animation: art-float 7s ease-in-out infinite;
}
.art-card b { font-size: 15.5px; line-height: 1.3; }
.art-main { top: 34px; left: 0; z-index: 3; width: min(360px, 76%); rotate: -2deg; }
.art-main .art-title { font-family: var(--serif); font-size: 19px; }
.art-back { top: 0; right: 0; z-index: 1; width: 240px; rotate: 6deg; animation-delay: -2s; }
.art-side { right: 0; bottom: 6px; z-index: 4; width: 220px; rotate: 4deg; animation-delay: -4s; }
.art-line { display: block; height: 7px; border-radius: 4px; background: var(--surface-3); }
.art-line.w85 { width: 85%; }
.art-line.w80 { width: 80%; }
.art-line.w70 { width: 70%; }
.art-line.w60 { width: 60%; }
.art-line.w50 { width: 50%; }
.art-chips { display: flex; gap: 6px; }
.art-chips span { padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; }
.art-byline { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; }
.art-avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.art-code { padding: 10px 12px; border-radius: 9px; background: #0d1117; color: #d7dce2; font: 12px/1.7 var(--mono); white-space: nowrap; overflow: hidden; }
.art-code em { font-style: normal; color: #3cc8b4; margin-right: 6px; }
.art-out { color: #8b949e; }
.art-callout { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-left: 3px solid var(--c-tip); border-radius: 6px; background: color-mix(in srgb, var(--c-tip) 9%, var(--surface)); color: var(--c-tip); font-size: 12px; font-weight: 700; white-space: nowrap; }
.art-callout .art-line { flex: 1; background: color-mix(in srgb, var(--c-tip) 22%, transparent); }
.art-foot { display: flex; gap: 14px; color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.art-foot span { display: inline-flex; align-items: center; gap: 5px; }
.art-foot svg { width: 14px; height: 14px; }
.art-like { color: var(--c-caution); }
.art-like svg { fill: currentColor; }
.art-progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.art-progress span { display: block; width: 60%; height: 100%; background: var(--done); }
.art-back small { color: var(--text-3); font-size: 12px; }
.art-pill {
  position: absolute;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgb(0 0 0 / .18);
  animation: art-float 6s ease-in-out infinite;
}
.art-pill svg { width: 15px; height: 15px; }
.art-pill-import { left: 6%; bottom: 40px; background: var(--accent); color: var(--accent-text); animation-delay: -1s; }
.art-pill-done { right: 2%; top: 196px; background: var(--surface); color: var(--done); border: 1px solid color-mix(in srgb, var(--done) 40%, transparent); animation-delay: -3s; }

@keyframes art-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}
@media (prefers-reduced-motion: reduce) {
  .art-card, .art-pill { animation: none; }
}

/* --- Як це працює -------------------------------------------------------------- */

.steps { border-bottom: 1px solid var(--border); background: var(--surface); }
.steps-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; max-width: 1160px; margin: 0 auto; padding: 28px 24px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step strong { font-size: 15.5px; }
.step p { margin: 3px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.step-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.step-icon svg { width: 19px; height: 19px; }

/* --- Стрічка статей -------------------------------------------------------------- */

.landing-feed { scroll-margin-top: 64px; }
.landing-feed-inner { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; max-width: 1160px; margin: 0 auto; padding: 44px 24px 72px; }
.feed-col { min-width: 0; }
.feed-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.feed-head h2 { margin: 0; font-family: var(--serif); font-size: 30px; letter-spacing: -0.02em; }
.feed-tabs { margin: 0; border-bottom: 0; }

.rubric-scroller {
  display: flex;
  gap: 8px;
  margin: 18px 0 6px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.chip-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none !important;
}
.chip-link span { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chip-link:hover { border-color: var(--accent); color: var(--text); }
.chip-link.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip-link.active span { color: color-mix(in srgb, var(--bg) 70%, transparent); }

.feed { display: grid; }
.feed-item {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none !important;
}
.feed-body { flex: 1; min-width: 0; }
.feed-author { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.feed-item h3 { margin: 10px 0 6px; font-size: 21px; line-height: 1.3; letter-spacing: -0.01em; }
.feed-item:hover h3 { color: var(--accent); }
.feed-item p {
  margin: 0;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 13px; color: var(--text-3); }
.feed-thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border-radius: 14px;
  /* Відтінок задає кожна стаття (--h), щоб стрічка не була одноманітною. */
  background:
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0) 0 0 / 12px 12px,
    linear-gradient(135deg, hsl(var(--h, 170) 70% 50% / .16), hsl(calc(var(--h, 170) + 50) 70% 50% / .06)),
    var(--surface);
  border: 1px solid var(--border);
  font-size: 44px;
}

.feed-aside { position: sticky; top: 88px; align-self: start; display: grid; gap: 16px; }
.aside-card { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.aside-card strong { font-size: 16px; }
.aside-card p { margin: 0 0 6px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.aside-card a:not(.btn) { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; }
.aside-card a svg { width: 13px; height: 13px; }
.aside-card .btn { justify-content: center; }
.aside-cta { background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

/* --- Стаття для гостя ------------------------------------------------------------ */

.teaser-page { max-width: 760px; margin: 0 auto; padding: 40px 24px 72px; }
.teaser-page .note-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
.teaser-page .note-title { font-family: var(--serif); font-size: clamp(30px, 4.4vw, 42px); }
@media (min-width: 1281px) {
  .teaser-page.has-toc { max-width: 1100px; }
  .teaser-page.has-toc .note-layout { grid-template-columns: minmax(0, 760px) 220px; gap: 56px; }
}
.join-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 40px;
  padding: 34px 28px 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.join-card h2 { margin: 0; font-family: var(--serif); font-size: 26px; letter-spacing: -0.015em; }
.join-card > p { max-width: 480px; margin: 0; color: var(--text-2); }
.join-card-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.join-card-icon svg { width: 22px; height: 22px; }
.join-card-alt { font-size: 14px; color: var(--text-3); }
.related { margin-top: 48px; }

/* --- Підвал і сторінка входу ----------------------------------------------------- */

.guest-footer { border-top: 1px solid var(--border); background: var(--surface); }
.guest-footer-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; max-width: 1160px; margin: 0 auto; padding: 24px; font-size: 14px; }
.guest-footer .brand { min-width: 0; font-size: 15px; }
.guest-footer .brand-mark { width: 26px; height: 26px; }

.login-wrap { position: relative; isolation: isolate; grid-template-rows: auto auto; align-content: center; gap: 16px; }
.login-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.2px, transparent 0);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 45%, #000 20%, transparent 75%);
}
.login-back { font-size: 14px; color: var(--text-2); }

/* --- Адаптивність сторінок для гостей ---------------------------------------- */

@media (max-width: 960px) {
  .landing-hero-inner { grid-template-columns: 1fr; gap: 24px; padding: 48px 24px 56px; }
  .hero-art { justify-self: center; height: 420px; }
  .landing-feed-inner { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .feed-aside { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .steps-inner { grid-template-columns: 1fr; gap: 16px; padding: 22px 24px; }
}

@media (max-width: 640px) {
  .guest .brand-text { display: inline; }
  .guest-bar-inner { height: 58px; padding: 0 14px; gap: 8px; }
  .guest-link:not(.guest-link-qa), .guest-login { display: none; }
  .guest-link-qa { padding: 0 6px; font-size: 14px; }
  .guest-nav .btn-primary { height: 36px; padding: 0 14px; }

  .landing-hero-inner { padding: 32px 16px 36px; }
  .eyebrow { font-size: 12.5px; margin-bottom: 14px; }
  .hero-lead { margin: 14px 0 22px; font-size: 16.5px; }
  .hero-cta .btn { flex: 1 1 100%; justify-content: center; }
  .hero-stats { gap: 6px 20px; margin-top: 22px; }
  .hero-stats strong { font-size: 19px; }
  /* Ілюстрація на телефоні — компактніша, без задньої картки. */
  .hero-art { height: 330px; max-width: 360px; }
  .art-back { display: none; }
  .art-main { top: 10px; left: 0; width: 86%; padding: 14px; gap: 8px; }
  .art-main .art-title { font-size: 16.5px; }
  .art-side { width: 180px; right: 0; bottom: 0; padding: 14px; }
  .art-side b { font-size: 14px; }
  .art-pill-import { left: 0; bottom: 22px; }
  .art-pill-done { top: 120px; right: 0; }

  .steps-inner { padding: 18px 16px; }
  .landing-feed-inner { padding: 28px 16px 56px; }
  .feed-head h2 { font-size: 25px; }
  .feed-item { gap: 14px; padding: 18px 0; align-items: flex-start; }
  .feed-item h3 { margin-top: 8px; font-size: 17.5px; }
  .feed-item p { font-size: 14.5px; }
  .feed-meta { margin-top: 10px; gap: 6px 10px; }
  .feed-thumb { width: 64px; height: 64px; border-radius: 10px; font-size: 28px; margin-top: 30px; }

  .teaser-page { padding: 20px 14px 56px; }
  .join-card { padding: 26px 16px 22px; }
  .join-card h2 { font-size: 22px; }
  .join-card .btn-lg { width: 100%; justify-content: center; height: auto; min-height: 48px; padding: 10px 16px; white-space: normal; }
  .guest-footer-inner { padding: 20px 16px; }
}

/* ==========================================================================
   Питання та відповіді
   ========================================================================== */

.guest-page { max-width: 1040px; margin: 0 auto; padding: 40px 24px 72px; }
.qa-page { max-width: 920px; }
.qa-page .page-head .actions { align-self: center; }

.q-list { display: grid; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.q-item { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; padding: 16px 18px; }
.q-item + .q-item { border-top: 1px solid var(--border); }
.q-stats { display: grid; align-content: start; justify-items: end; gap: 6px; font-size: 13px; color: var(--text-3); text-align: right; }
.q-stat { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.q-stat strong { color: var(--text-2); font-variant-numeric: tabular-nums; }
.q-stat.pos strong { color: var(--done); }
.q-stat.neg strong { color: var(--danger); }
.q-stat.answered { padding: 1px 7px; border: 1px solid var(--done); border-radius: 6px; color: var(--done); }
.q-stat.answered strong { color: inherit; }
.q-stat.solved { padding: 1px 7px; border-radius: 6px; background: var(--done); color: #fff; }
.q-stat.solved strong { color: inherit; }
.q-stat svg { width: 13px; height: 13px; }
.q-main { min-width: 0; }
.q-main h3 { margin: 0; font-size: 17px; line-height: 1.35; letter-spacing: -0.005em; }
.q-main h3 a { color: var(--text); }
.q-main h3 a:hover { color: var(--accent); text-decoration: none; }
.q-main p {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.q-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.q-author { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--text-2); }

.q-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.q-title { margin: 0; font-size: 30px; line-height: 1.22; letter-spacing: -0.02em; }
.q-head .btn { flex: none; margin-top: 6px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 22px; padding-bottom: 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text-3); }
.q-solved { display: inline-flex; align-items: center; gap: 4px; color: var(--done); font-weight: 600; }
.q-solved svg { width: 14px; height: 14px; }

.qa-post { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 18px; }
.qa-side { display: grid; justify-items: center; align-content: start; gap: 10px; }
.qa-body { min-width: 0; }
.qa-body > .prose > :first-child { margin-top: 0; }
.qa-post-foot { display: grid; gap: 14px; margin-top: 18px; }
.qa-post-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.qa-post-actions .spacer { flex: 1; }
.qa-post-actions form { display: contents; }
.qa-signature {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none !important;
}
.qa-signature strong { display: block; font-size: 13.5px; line-height: 1.3; }
.qa-signature small { display: block; font-size: 12px; color: var(--text-3); }
.qa-signature:hover strong { color: var(--accent); }

.vote { display: grid; justify-items: center; gap: 2px; margin: 0; }
.vote-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.vote-btn svg { width: 22px; height: 22px; }
.vote-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.vote-btn.active { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.vote-btn:disabled { opacity: .45; cursor: default; }
.vote-score { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }

.accept-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
button.accept-btn:hover { color: var(--done); background: color-mix(in srgb, var(--done) 12%, transparent); }
.accept-btn svg { width: 26px; height: 26px; }
.accept-btn.active { color: var(--done); }
span.accept-btn { cursor: default; }

.qa-answers-title { margin: 40px 0 18px; font-size: 21px; letter-spacing: -0.01em; }
.qa-answer { padding: 22px 0; border-top: 1px solid var(--border); }
.qa-answer.accepted { padding: 22px 18px; border: 1px solid color-mix(in srgb, var(--done) 45%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--done) 6%, var(--surface)); }
.qa-answer + .qa-answer.accepted, .qa-answer.accepted + .qa-answer { margin-top: 12px; }
.accepted-label { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--done); }
.accepted-label svg { width: 15px; height: 15px; }

.qa-answer-form { display: grid; gap: 12px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.qa-answer-form .qa-answers-title { margin: 22px 0 0; }
.qa-surface { min-height: 0; padding: 18px 22px 24px; }
.qa-surface .ProseMirror { min-height: 180px; }
.qa-form { max-width: 920px; }
.qa-form .page-head { margin-bottom: 4px; }
.qa-form .title-input { width: 100%; }
/* Панель інструментів усередині .field (grid) не повинна розтягувати форму на вузькому екрані. */
.qa-form .field { grid-template-columns: minmax(0, 1fr); }
.qa-gate { margin-top: 32px; }

.aside-questions strong { display: inline-flex; align-items: center; gap: 6px; }
.aside-questions strong svg { width: 16px; height: 16px; color: var(--accent); }
.aside-questions ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.aside-questions li a { display: block; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.4; }
.aside-questions li a:hover { color: var(--accent); text-decoration: none; }
.aside-questions li .muted { font-size: 12.5px; }
.author-questions-title { margin-top: 36px; }

@media (max-width: 640px) {
  .guest-page { padding: 24px 16px 56px; }
  .q-item { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px; }
  .q-stats { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 6px 12px; text-align: left; order: 2; }
  .q-main { order: 1; }
  .q-title { font-size: 24px; }
  .q-head { flex-direction: column; gap: 10px; }
  .q-head .btn { margin-top: 0; }
  .qa-post { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .vote-btn, .accept-btn { width: 34px; height: 34px; }
  .vote-btn svg { width: 19px; height: 19px; }
  .vote-score { font-size: 16px; }
  .qa-answer.accepted { padding: 16px 12px; }
  .qa-surface { padding: 14px 14px 18px; }
  .qa-signature { width: 100%; }
}

/* На найвужчих екранах у шапці гостя лишаємо значок без назви — щоб влізло «Питання» й кнопка входу. */
@media (max-width: 400px) {
  .guest .brand-text { display: none; }
}

/* --- Адмін-панель --------------------------------------------------------------- */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.adm-head h1 { display: flex; align-items: center; gap: 10px; }
.adm-head h1 svg { width: 26px; height: 26px; color: var(--accent); }
.adm-tabs .tab { display: inline-flex; align-items: center; gap: 7px; }
.adm-tabs .tab svg { width: 16px; height: 16px; }

.adm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.adm-kpi {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  color: var(--text);
}
a.adm-kpi:hover { border-color: var(--accent); text-decoration: none; }
.adm-kpi-label { font-size: 13px; color: var(--text-2); }
.adm-kpi-value { font-size: 28px; font-weight: 650; line-height: 1.15; letter-spacing: -0.02em; }
.adm-kpi-delta { font-size: 12.5px; color: var(--text-3); }
.adm-kpi-delta.up { color: var(--done); font-weight: 600; }
.adm-kpi-note { font-size: 12.5px; color: var(--text-3); }

.adm-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.adm-chart { margin: 0; padding: 16px 18px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.adm-chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; font-size: 13.5px; color: var(--text-2); }
.adm-chart figcaption strong { font-size: 20px; color: var(--text); }
.adm-plot { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 96px; padding-right: 26px; border-bottom: 1px solid var(--border-strong); }
.adm-gridline { position: absolute; left: 0; right: 0; top: 0; border-top: 1px solid var(--border); pointer-events: none; }
.adm-gridline span { position: absolute; right: 0; top: -8px; min-width: 22px; text-align: right; background: var(--surface); font-size: 11px; line-height: 16px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.adm-col { position: relative; flex: 1; display: flex; align-items: flex-end; height: 100%; max-width: 24px; }
.adm-col i { display: block; width: 100%; min-height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.adm-col:hover i { background: var(--accent-hover); }
.adm-col:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 4px 8px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg);
  font-size: 12px; white-space: nowrap; pointer-events: none;
}
.adm-col:nth-child(2):hover::after { left: 0; transform: none; }
.adm-col:last-child:hover::after { left: auto; right: 0; transform: none; }
.adm-axis { display: flex; justify-content: space-between; margin-top: 6px; padding-right: 26px; font-size: 11.5px; color: var(--text-3); }
.adm-table-toggle { margin-top: 10px; font-size: 14px; }
.adm-table-toggle summary { cursor: pointer; color: var(--text-2); }
.adm-table-toggle .adm-table-wrap { margin-top: 10px; max-height: 360px; }

.adm-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.adm-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.adm-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.adm-list li:last-child { border-bottom: 0; }
.adm-when { margin-left: auto; font-size: 12.5px; white-space: nowrap; }

.adm-person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.adm-person:hover { text-decoration: none; }
.adm-person:hover strong { color: var(--accent); }
.adm-person > span:last-child { display: grid; min-width: 0; }
.adm-person strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-person small, .adm-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12.5px; }
.adm-person-sm { gap: 8px; }
.adm-title { display: grid; min-width: 0; color: var(--text); font-weight: 500; }

.adm-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 14px; }
.adm-search .input, .adm-search .btn { height: 42px; }
.adm-filters { align-items: center; margin-bottom: 16px; }

.adm-table-wrap { position: relative; overflow-x: auto; border-radius: var(--radius); }
.adm-table td { vertical-align: middle; }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table .nowrap { white-space: nowrap; }
.adm-actions { display: inline-flex; gap: 2px; }
.adm-table tr.is-blocked td { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.adm-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.adm-badges .badge svg { width: 12px; height: 12px; }
.account-head .adm-badges { margin-top: 6px; }
.adm-badge-admin { background: var(--accent-soft); color: var(--accent); }
.adm-badge-blocked { background: var(--danger-soft); color: var(--danger); }

.adm-user-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.adm-blocked-banner { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); color: var(--danger); }
.adm-manage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.adm-manage .block-title { justify-content: flex-start; gap: 8px; margin: 0; }
.adm-manage .block-title svg { width: 18px; height: 18px; color: var(--text-3); }
.adm-manage .form-note { margin: 0; }
.adm-form { display: grid; gap: 14px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check-line input { width: 16px; height: 16px; accent-color: var(--accent); }
.check-line input:disabled + span { opacity: .5; }
.admin-bar svg { flex: none; }
.adm-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1100px) {
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-charts, .adm-columns, .adm-manage { grid-template-columns: minmax(0, 1fr); }
  .adm-user-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .adm-kpi { padding: 12px 14px; }
  .adm-kpi-value { font-size: 22px; }
  .adm-user-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-table td.actions .btn-label { display: none; }
  .adm-fields, .form-grid { grid-template-columns: minmax(0, 1fr); }
}
