/* Bell: «зошит у клітинку». Синя кулькова ручка, жовтий маркер, кольорові закладки предметів.
   Один акцент (ручка), жовтий маркер лише для «зараз» і «відмітка відкрита», три «оцінкові» кольори (зелена/червона ручка,
   бурштин) і 24 відтінки маркера для предметів. Два шрифти: Literata (заголовки, час, цифри) і Onest (інтерфейс).
   Без inline-стилів (CSP): динамічні розміри задає JS через CSSOM. Світла й темна теми, вибір у «Ще → Вигляд». */
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/fonts/literata-cyrillic-ext.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/fonts/literata-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/fonts/literata-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/fonts/literata-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/onest-cyrillic-ext.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/onest-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/onest-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/onest-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --font-ui: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Literata", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
  /* Палітра задається чотирма числами: відтінок і насиченість нейтралей (--nh, --nk), відтінок і насиченість акценту (--ah, --ac).
     Типова палітра «Графіт» (сіра); інші перелічено нижче (data-palette), вибір у «Ще → Вигляд». */
  --nh: 265; --nk: 0.35; --ah: 265; --ac: 0.045;
  /* світла тема: папір, аркуш, чорнило з відтінком палітри */
  --paper: oklch(0.972 calc(0.008 * var(--nk)) var(--nh)); --sheet: oklch(0.995 calc(0.003 * var(--nk)) var(--nh));
  --ink: oklch(0.27 calc(0.04 * var(--nk)) var(--nh)); --ink-2: oklch(0.46 calc(0.035 * var(--nk)) var(--nh)); --ink-3: oklch(0.53 calc(0.035 * var(--nk)) var(--nh));
  --rule: oklch(0.915 calc(0.012 * var(--nk)) var(--nh)); --rule-strong: oklch(0.84 calc(0.02 * var(--nk)) var(--nh)); --grid: oklch(0.935 calc(0.022 * var(--nk)) var(--nh));
  --pen: oklch(0.46 var(--ac) var(--ah)); --on-pen: oklch(0.99 0.005 var(--ah)); --pen-soft: oklch(0.94 calc(var(--ac) * 0.22) var(--ah)); --pen-ink: oklch(0.38 calc(var(--ac) * 0.85) var(--ah));
  --hl: oklch(0.925 0.14 97); --hl-ink: oklch(0.25 0.04 80);
  --red: oklch(0.53 0.2 27); --red-soft: oklch(0.945 0.035 27);
  --green: oklch(0.49 0.12 155); --green-soft: oklch(0.945 0.04 155);
  --amber: oklch(0.54 0.12 68); --amber-soft: oklch(0.955 0.05 85);
  --violet: oklch(0.5 0.17 310); --now-wash: 36%;
  --shadow: 0 8px 24px oklch(0.25 0.06 var(--nh) / 0.14);
  --cv-bl: 0.905; --cv-bc: 0.07; --cv-fl: 0.36; --cv-fc: 0.11; --cv-sl: 0.66; --cv-sc: 0.14;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23596383' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --k-wyk: var(--pen); --k-lab: var(--green); --k-cw: var(--amber); --k-lek: var(--violet); --k-ex: var(--red); --k-x: var(--ink-3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --paper: oklch(0.2 calc(0.022 * var(--nk)) var(--nh)); --sheet: oklch(0.245 calc(0.024 * var(--nk)) var(--nh));
    --ink: oklch(0.94 calc(0.01 * var(--nk)) var(--nh)); --ink-2: oklch(0.76 calc(0.025 * var(--nk)) var(--nh)); --ink-3: oklch(0.62 calc(0.025 * var(--nk)) var(--nh));
    --rule: oklch(0.31 calc(0.025 * var(--nk)) var(--nh)); --rule-strong: oklch(0.4 calc(0.03 * var(--nk)) var(--nh)); --grid: oklch(0.255 calc(0.028 * var(--nk)) var(--nh));
    --pen: oklch(0.77 calc(var(--ac) * 0.62) var(--ah)); --on-pen: oklch(0.2 0.04 var(--ah)); --pen-soft: oklch(0.31 calc(var(--ac) * 0.35) var(--ah)); --pen-ink: oklch(0.86 calc(var(--ac) * 0.45) var(--ah));
    --hl: oklch(0.82 0.12 98); --hl-ink: oklch(0.24 0.04 90);
    --red: oklch(0.74 0.15 25); --red-soft: oklch(0.32 0.07 25);
    --green: oklch(0.76 0.13 155); --green-soft: oklch(0.31 0.06 155);
    --amber: oklch(0.8 0.12 78); --amber-soft: oklch(0.33 0.06 80);
    --violet: oklch(0.78 0.12 310); --now-wash: 13%;
    --shadow: 0 10px 28px oklch(0.1 0.03 var(--nh) / 0.5);
    --cv-bl: 0.34; --cv-bc: 0.07; --cv-fl: 0.9; --cv-fc: 0.08; --cv-sl: 0.72; --cv-sc: 0.12;
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9b1c9' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] {
  color-scheme: dark;
  --paper: oklch(0.2 calc(0.022 * var(--nk)) var(--nh)); --sheet: oklch(0.245 calc(0.024 * var(--nk)) var(--nh));
  --ink: oklch(0.94 calc(0.01 * var(--nk)) var(--nh)); --ink-2: oklch(0.76 calc(0.025 * var(--nk)) var(--nh)); --ink-3: oklch(0.62 calc(0.025 * var(--nk)) var(--nh));
  --rule: oklch(0.31 calc(0.025 * var(--nk)) var(--nh)); --rule-strong: oklch(0.4 calc(0.03 * var(--nk)) var(--nh)); --grid: oklch(0.255 calc(0.028 * var(--nk)) var(--nh));
  --pen: oklch(0.77 calc(var(--ac) * 0.62) var(--ah)); --on-pen: oklch(0.2 0.04 var(--ah)); --pen-soft: oklch(0.31 calc(var(--ac) * 0.35) var(--ah)); --pen-ink: oklch(0.86 calc(var(--ac) * 0.45) var(--ah));
  --hl: oklch(0.82 0.12 98); --hl-ink: oklch(0.24 0.04 90);
  --red: oklch(0.74 0.15 25); --red-soft: oklch(0.32 0.07 25);
  --green: oklch(0.76 0.13 155); --green-soft: oklch(0.31 0.06 155);
  --amber: oklch(0.8 0.12 78); --amber-soft: oklch(0.33 0.06 80);
  --violet: oklch(0.78 0.12 310); --now-wash: 13%;
  --shadow: 0 10px 28px oklch(0.1 0.03 var(--nh) / 0.5);
  --cv-bl: 0.34; --cv-bc: 0.07; --cv-fl: 0.9; --cv-fc: 0.08; --cv-sl: 0.72; --cv-sc: 0.12;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9b1c9' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
/* Палітри: лише відтінки. Решта (світла й темна теми, контраст) виводиться з токенів вище. */
:root[data-palette=ink] { --nh: 255; --nk: 1; --ah: 267; --ac: 0.2; }
:root[data-palette=teal] { --nh: 210; --nk: 1.15; --ah: 200; --ac: 0.1; }
:root[data-palette=plum] { --nh: 320; --nk: 1.15; --ah: 305; --ac: 0.17; }
:root[data-palette=poppy] { --nh: 45; --nk: 1.1; --ah: 28; --ac: 0.18; }
:root[data-palette=moss] { --nh: 150; --nk: 1.25; --ah: 155; --ac: 0.115; }
/* Старі браузери без oklch: тримаємо читабельну світлу тему. */
@supports not (color: oklch(0.5 0.1 100)) {
  :root { --paper: #f3f5fa; --sheet: #fbfcfe; --ink: #1e2540; --ink-2: #596383; --ink-3: #8089a5; --rule: #dfe3ec; --rule-strong: #cbd1de; --grid: #e6eaf3;
    --pen: #3447c1; --on-pen: #fff; --pen-soft: #e6e9fa; --pen-ink: #26359a; --hl: #f6e45b; --hl-ink: #3a3320; --red: #c0392b; --red-soft: #fbe9e6;
    --green: #2a7a52; --green-soft: #e3f3ea; --amber: #9a6b1a; --amber-soft: #fbf0d9; --violet: #7a46b5; --shadow: 0 8px 24px rgba(30, 37, 64, .14); }
}

/* Кольори предметів: лише відтінок, решту (світло-темну пару й закладку) виводять токени теми. */
.c0 { --h: 25; }
.c1 { --h: 150; }
.c2 { --h: 255; }
.c3 { --h: 320; }
.c4 { --h: 75; }
.c5 { --h: 195; }
.c6 { --h: 350; }
.c7 { --h: 110; }
.c8 { --h: 285; }
.c9 { --h: 45; }
.c10 { --h: 175; }
.c11 { --h: 230; }
.c12 { --h: 5; }
.c13 { --h: 130; }
.c14 { --h: 305; }
.c15 { --h: 90; }
.c16 { --h: 215; }
.c17 { --h: 335; }
.c18 { --h: 60; }
.c19 { --h: 165; }
.c20 { --h: 270; }
.c21 { --h: 20; }
.c22 { --h: 120; }
.c23 { --h: 245; }
.c0, .c1, .c2, .c3, .c4, .c5, .c6, .c7, .c8, .c9, .c10, .c11, .c12, .c13, .c14, .c15, .c16, .c17, .c18, .c19, .c20, .c21, .c22, .c23 {
  --mk-bg: oklch(var(--cv-bl) var(--cv-bc) var(--h)); --mk-fg: oklch(var(--cv-fl) var(--cv-fc) var(--h)); --stripe: oklch(var(--cv-sl) var(--cv-sc) var(--h));
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); touch-action: pan-x pan-y;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}   /* лише прокрутка: без збільшення щипком і подвійним дотиком */
/* iPhone та інші пристрої: не збільшувати сторінку при фокусі на полі вводу, але дозволяти ввід тексту */
input, select, textarea { font-size: 16px !important; -webkit-user-select: text !important; user-select: text !important; -webkit-touch-callout: default !important; }
html.chat-open, html.chat-open body { overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0; color: var(--ink); min-height: 100vh; font: 16px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "calt"; text-rendering: optimizeLegibility;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
img, a, button { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* Клітинка зошита: ледь помітна у верхній частині екрана й розчиняється вниз (не fixed: прокрутка дешевша). */
body::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 300px; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px; background-position: 9px 5px;
  -webkit-mask-image: linear-gradient(#000 0%, transparent 92%); mask-image: linear-gradient(#000 0%, transparent 92%); }
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding: 0 16px calc(150px + var(--safe-b)); }
h1, h2, h3, p { margin: 0; }
h1 { font: 600 30px/1.1 var(--font-display); letter-spacing: -0.012em; }
h2 { font: 600 20px/1.2 var(--font-display); letter-spacing: -0.005em; margin: 30px 0 10px; }
h3 { font: 600 16px/1.3 var(--font-ui); }
a { color: var(--pen); text-underline-offset: 2px; }
.sub { color: var(--ink-2); font-size: 14px; } .tiny { color: var(--ink-3); font-size: 12.5px; }
.icon { width: 24px; height: 24px; flex: none; } .icon.sm { width: 16px; height: 16px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) { #app.enter > * { animation: fade .2s ease both; } }

/* ---- шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(22px + env(safe-area-inset-top, 0px)) 0 8px; }
.top .avatar { width: 38px; height: 38px; border-radius: var(--r-m); background: var(--sheet); border: 1px solid var(--rule-strong); color: var(--pen);
  font: 600 17px/1 var(--font-display); display: grid; place-items: center; padding: 0; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 0; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.pill.warn .dot { background: var(--amber); } .pill.bad .dot { background: var(--red); }

/* ---- кнопки й поля */
button { touch-action: manipulation; appearance: none; border: 0; font: inherit; color: inherit; cursor: pointer; background: none; padding: 0; transition: transform .1s, opacity .2s, background-color .15s; }
button:active { transform: scale(.98); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 14px;
  background: var(--pen); color: var(--on-pen); font-weight: 600; font-size: 16px; text-decoration: none; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.btn.soft { background: var(--pen-soft); color: var(--pen-ink); }
.btn.danger { background: transparent; color: var(--red); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--red) 45%, transparent); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: 14.5px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; border-radius: 6px; }
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin: 16px 0 6px; }
input[type=text], input[type=password], input[type=search], input[type=url], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); font: inherit; min-height: 48px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }
input::placeholder { color: var(--ink-3); }
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-repeat: no-repeat; background-position: right 14px center; background-image: var(--chev); background-size: 18px; }
.err { color: var(--red); font-weight: 600; margin-top: 12px; font-size: 14px; }
.banner { padding: 12px 14px; border-radius: var(--r-m); background: var(--amber-soft); color: var(--amber); margin: 10px 0 0; font-size: 14px; font-weight: 500; }
.banner.bad { background: var(--red-soft); color: var(--red); }
.chips-row { display: flex; gap: 8px; overflow-x: auto; margin: 6px -20px 0; padding: 4px 20px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar, .shelf::-webkit-scrollbar { display: none; }
.fchip { flex: none; padding: 6px 13px; border-radius: var(--r-m); box-shadow: inset 0 0 0 1px var(--rule-strong); font-weight: 600; font-size: 14px; color: var(--ink-2); }
.fchip[aria-pressed=true] { background: var(--pen); color: var(--on-pen); box-shadow: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: color-mix(in oklch, var(--ink) 7%, transparent); color: var(--ink-2); }
.chip.ok { background: var(--green-soft); color: var(--green); } .chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.chip.kind { background: color-mix(in oklch, var(--k, var(--k-x)) 13%, transparent); color: color-mix(in oklch, var(--k, var(--k-x)) 72%, var(--ink)); }
.k-Exam { --k: var(--k-ex); } .k-Wyk { --k: var(--k-wyk); } .k-Lab { --k: var(--k-lab); } .k-Cw { --k: var(--k-cw); } .k-Lek { --k: var(--k-lek); }

/* ---- групи, обкладинки-маркери */
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: 18px; padding: 18px; margin-top: 14px; }
.card.stack > * + * { margin-top: 12px; }
.card + .btn { margin-top: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.empty { text-align: center; color: var(--ink-2); padding: 28px 12px; border: 1px dashed var(--rule-strong); border-radius: 14px; margin-top: 8px; }
.cover { position: relative; display: grid; place-items: center; width: 56px; height: 56px; flex: none; border-radius: var(--r-m); overflow: hidden;
  font: 600 19px/1 var(--font-display); letter-spacing: 0; background: var(--mk-bg, var(--rule)); color: var(--mk-fg, var(--ink-2)); }
.cover.lg { width: 88px; height: 88px; font-size: 32px; border-radius: 14px; margin: 4px 0 0; }
.cover.md { width: 148px; height: 92px; font-size: 30px; border-radius: 12px; }
.cover.sq { width: 100%; height: auto; aspect-ratio: 16 / 10; font-size: 36px; border-radius: 12px; }
.cover svg { position: absolute; right: 8px; bottom: 8px; width: 18px; height: 18px; opacity: .8; }

/* ---- «Зараз»: головна картка. Єдине сміливе місце інтерфейсу: великий час і маркер під назвою. */
.hero { display: block; width: 100%; text-align: left; background: var(--sheet); border: 1px solid var(--rule); border-left: 5px solid var(--stripe, var(--pen));
  padding: 16px 16px 16px 18px; border-radius: 0 var(--r-l) var(--r-l) 0; margin-top: 16px; }
.hero .meta { min-width: 0; }
.hero .label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }
.hero .time { font: 600 40px/1.05 var(--font-display); font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.015em; margin: 8px 0 6px; }
.hero .name { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; }
.hero.live .name span { background: linear-gradient(transparent 56%, var(--hl) 56% 94%, transparent 94%); padding: 0 3px; margin: 0 -3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; color: var(--ink); }
.hero .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bar { height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; margin-top: 14px; }
.bar > i { display: block; height: 100%; background: var(--pen); border-radius: 2px; transition: width .8s ease; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 13px; }
.eq i { width: 3px; background: var(--pen); height: 100%; border-radius: 1px; transform: scaleY(.4); transform-origin: bottom; }
@media (prefers-reduced-motion: no-preference) {
  .eq i { animation: eq 1s ease-in-out infinite; } .eq i:nth-child(2) { animation-delay: .25s; } .eq i:nth-child(3) { animation-delay: .5s; }
  @keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }          /* transform, а не height: без перерахунку розкладки */
}

/* ---- тривога: відмітка відкрита */
.alert { background: var(--hl); color: var(--hl-ink); padding: 16px 16px 16px 18px; border-radius: 0 var(--r-l) var(--r-l) 0; border-left: 5px solid var(--red); margin-top: 16px; }
.alert h3 { font: 600 22px/1.15 var(--font-display); display: flex; gap: 10px; align-items: center; }
.alert p { margin-top: 4px; font-weight: 500; }
.alert .ring { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--red); flex: none; }
.alert .ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--red); opacity: 0; }
@media (prefers-reduced-motion: no-preference) { .alert .ring::after { animation: pulse 1.2s ease-out infinite; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(2.8); opacity: 0; } }
.alert .how { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-m); background: oklch(0.25 0.05 80 / 0.1); font-weight: 500; font-size: 14.5px; }

/* ---- списки й полиці */
.shelf { display: flex; gap: 12px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scroll-snap-type: x proximity; scrollbar-width: none; }
.tile { flex: none; width: 148px; scroll-snap-align: start; text-align: left; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
.tile .t { font-weight: 600; margin-top: 8px; font-size: 14.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .s { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 0; width: 100%; text-align: left; }
.item + .item { border-top: 1px solid var(--rule); }
.item .body { min-width: 0; flex: 1; }
.item .t { font-weight: 600; font-size: 17px; line-height: 1.3; } .item .s { color: var(--ink-2); font-size: 15px; line-height: 1.35; margin-top: 2px; }
.item .end { flex: none; text-align: right; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.item.past { opacity: .55; }

/* ---- розклад */
.seg { display: flex; gap: 22px; border-bottom: 1px solid var(--rule); margin-top: 6px; }
.seg button { padding: 10px 0; margin-bottom: -1px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; }
.seg button[aria-pressed=true] { color: var(--ink); border-bottom-color: var(--pen); }
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.weekstrip button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.weekstrip .n { width: 40px; height: 40px; border-radius: var(--r-m); display: grid; place-items: center; font: 600 18px/1 var(--font-display); color: var(--ink); font-variant-numeric: lining-nums; }
.weekstrip button[aria-current=date] .n { box-shadow: inset 0 0 0 1.5px var(--pen); color: var(--pen); }
.weekstrip button[aria-pressed=true] .n { background: var(--pen); color: var(--on-pen); box-shadow: none; }
.weekstrip .mark { width: 14px; height: 3px; border-radius: 2px; background: transparent; }
.weekstrip .has .mark { background: var(--stripe, var(--ink-3)); background: var(--ink-3); opacity: .5; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav button.ic { width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-m); color: var(--ink-2); }
.nav button.ic:active { background: var(--pen-soft); }
.lesson { display: grid; grid-template-columns: 52px 1fr; gap: 14px; width: 100%; text-align: left; padding: 13px 0; border-bottom: 1px solid var(--rule); }
.lesson .t { padding-top: 1px; font-variant-numeric: tabular-nums lining-nums; }
.lesson .t b { display: block; font: 600 17px/1.15 var(--font-display); } .lesson .t span { font-size: 12.5px; color: var(--ink-3); }
.lesson .c { position: relative; padding-left: 13px; min-width: 0; }
.lesson .c::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; background: var(--stripe, var(--k, var(--k-x))); }
.lesson.now { background: linear-gradient(90deg, color-mix(in oklch, var(--hl) var(--now-wash), transparent), transparent 85%); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--r-s); }
.lesson.now .t b { color: var(--pen); }
.lesson.past { opacity: .55; }
.lesson .name { font-weight: 600; line-height: 1.3; } .lesson .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.gap { margin: 0 0 0 66px; padding: 7px 0; color: var(--ink-3); font-size: 13px; border-bottom: 1px dotted var(--rule-strong); }
.day-h { margin: 26px 0 2px; font: 600 17px/1.25 var(--font-display); color: var(--ink); }
.day-h::first-letter { text-transform: uppercase; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-top: 12px; text-align: center; }
.month .wd { font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 4px 0; }
.month button { aspect-ratio: 1; border-radius: var(--r-m); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: 600 15px/1 var(--font-display); font-variant-numeric: lining-nums; }
.month button.out { opacity: .3; } .month button[aria-current=date] { box-shadow: inset 0 0 0 1.5px var(--pen); color: var(--pen); }
.month button[aria-pressed=true] { background: var(--pen); color: var(--on-pen); box-shadow: none; }
.month .dots { display: flex; gap: 3px; height: 5px; } .month .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); }
.month .dots i.present { background: var(--green); } .month .dots i.late { background: var(--amber); } .month .dots i.absent, .month .dots i.open { background: var(--red); }
.month .dots i.excused { background: var(--pen); } .month .dots i.plan { background: var(--ink-3); } .month .dots i.unk { background: var(--ink-3); opacity: .45; }
.month button[aria-pressed=true] .dots i { box-shadow: 0 0 0 1px var(--pen); }

/* ---- завдання, відвідуваність */
.check { width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 2px var(--rule-strong); display: grid; place-items: center; flex: none; color: var(--ink-3); }
.check.on { background: var(--green); box-shadow: none; color: var(--paper); } .check svg { width: 16px; height: 16px; }
.task-title.done { text-decoration: line-through; color: var(--ink-3); }
.ring { position: relative; width: 44px; height: 44px; flex: none; } .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; } .ring .bg { stroke: var(--rule); } .ring .fg { stroke: var(--green); stroke-linecap: round; }
.ring.warn .fg { stroke: var(--amber); } .ring.bad .fg { stroke: var(--red); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 600 11.5px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: lining-nums; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 14px; margin-top: 12px; }
.grid2 .tile { width: auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; } .stats b { display: block; font: 600 24px/1.1 var(--font-display); font-variant-numeric: lining-nums; } .stats span { color: var(--ink-2); font-size: 12px; }

/* ---- міні-блок поточної пари і вкладки */
.mini { position: fixed; left: 12px; right: 12px; bottom: calc(66px + var(--safe-b)); max-width: 576px; margin: 0 auto; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 12px 11px 8px;
  border-radius: 0 var(--r-m) var(--r-m) 0; border: 1px solid var(--rule); border-left: 4px solid var(--stripe, var(--pen)); background: var(--sheet); text-align: left; width: calc(100% - 24px); overflow: hidden; box-shadow: var(--shadow); }
.mini .cover { width: 40px; height: 40px; font-size: 14px; border-radius: 8px; }
.mini .body { min-width: 0; flex: 1; } .mini .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .s { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .end { font: 600 14px/1 var(--font-display); font-variant-numeric: tabular-nums lining-nums; color: var(--pen); }
.mini .line { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--rule); }
.mini .line i { display: block; height: 100%; background: var(--pen); }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding: 6px 6px calc(6px + var(--safe-b)); background: var(--paper); border-top: 1px solid var(--rule); }
nav.tabs > div { display: flex; width: 100%; max-width: 600px; }
nav.tabs button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 0 4px; color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
nav.tabs button .icon { width: 26px; height: 26px; }
nav.tabs button[aria-current=page] { color: var(--pen); }
nav.tabs button[aria-current=page]::before { content: ""; position: absolute; top: -7px; left: 32%; right: 32%; height: 3px; border-radius: 0 0 3px 3px; background: var(--pen); }

/* ---- нижній аркуш */
#overlay:empty { display: none; }
.backdrop { position: fixed; inset: 0; z-index: 50; background: oklch(0.15 0.04 var(--nh) / 0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; background: var(--paper); border-radius: 20px 20px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); box-shadow: var(--shadow); }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .26s ease both; } @keyframes up { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--rule-strong); margin: 0 auto 14px; }
.sheet .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet .head h3 { font: 600 20px/1.2 var(--font-display); }
.sheet .close { width: 36px; height: 36px; border-radius: var(--r-m); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); display: grid; place-items: center; color: var(--ink-2); }
.big-name { font: 600 26px/1.15 var(--font-display); letter-spacing: -0.012em; margin-top: 16px; }
.times { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.sheet .bar > i { background: var(--pen); }
.advice { padding: 12px 14px; border-radius: var(--r-m); background: var(--pen-soft); color: var(--pen-ink); font-weight: 500; font-size: 14.5px; margin-top: 12px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--rule); font-weight: 500; }
.setting:first-child { border-top: 0; }
.switch { position: relative; width: 48px; height: 28px; flex: none; margin: 0; }
.switch input { appearance: none; -webkit-appearance: none; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 99px; background: var(--rule-strong); margin: 0; transition: background .2s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--sheet); transition: transform .2s; box-shadow: 0 1px 2px oklch(0.2 0.05 var(--nh) / 0.3); }
.switch input:checked { background: var(--pen); } .switch input:checked::after { transform: translateX(20px); }
.switch input:focus { box-shadow: 0 0 0 3px var(--pen-soft); }
code.topic { display: block; padding: 12px; border-radius: var(--r-m); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); word-break: break-all; margin: 8px 0; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(130px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: var(--r-m); font-weight: 600; font-size: 14px; z-index: 80; box-shadow: var(--shadow); }

/* ---- вхід */
.login { padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
.logo { width: 64px; height: 64px; border-radius: 15px; display: block; margin-bottom: 16px; }
.login h1 { font-size: 40px; letter-spacing: -0.02em; } .login .lead { color: var(--ink-2); margin: 10px 0 24px; font-size: 16px; max-width: 46ch; }
.results { margin-top: 8px; }
.result { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 6px; border-radius: var(--r-m); }
.result + .result { border-top: 1px solid var(--rule); border-radius: 0; }
.result:active { background: var(--pen-soft); }
.result .cover { width: 46px; height: 46px; font-size: 16px; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; font-size: 13.5px; color: var(--ink-2); margin: 16px 0; }
.consent input { margin-top: 2px; width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--pen); padding: 0; }
.linkbtn { color: var(--pen); font-weight: 600; padding: 10px 0; }
.note { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); margin-top: 14px; }
.chips-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.item > .cover { width: 52px; height: 52px; font-size: 19px; border-radius: 50%; }
.langbar { display: flex; justify-content: flex-end; margin-bottom: 8px; } .langbar select { width: auto; min-height: 38px; padding: 8px 36px 8px 14px; font-weight: 600; font-size: 14px; }
.pct.ok { color: var(--green); } .pct.warn { color: var(--amber); } .pct.bad { color: var(--red); } .pct { font-weight: 600; }
.stats .present b { color: var(--green); } .stats .late b { color: var(--amber); } .stats .absent b { color: var(--red); } .stats .excused b { color: var(--pen); }

/* ---- місяць: календар у верхній половині, пари вибраного дня в нижній */
#app.is-split { height: 100vh; height: 100dvh; padding-bottom: 0; display: flex; flex-direction: column; overflow: hidden; }
#app.is-split > .top, #app.is-split > .seg, #app.is-split > .banner { flex: none; }
.msplit { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 8px; }
.mcal { flex: none; }
.msplit .month { margin-top: 6px; gap: 2px; }
.msplit .month button { aspect-ratio: auto; height: clamp(32px, 4.7vh, 40px); gap: 2px; }
.mday { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; margin: 10px -20px 0; padding: 0 20px calc(96px + var(--safe-b)); border-top: 1px solid var(--rule-strong); }
.mday .day-h { margin-top: 12px; }

/* ---- деталі пари й історія відвідуваності */
.info { margin-top: 12px; border-radius: var(--r-m); background: var(--sheet); border: 1px solid var(--rule); padding: 0 14px; }
.info-row { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--rule); } .info-row:first-child { border-top: 0; }
.info-row .t { font-weight: 600; } .info-row .icon { color: var(--ink-3); }
.hstrip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.hsq { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--rule-strong); }
.hsq.present { background: var(--green); } .hsq.late { background: var(--amber); } .hsq.absent { background: var(--red); } .hsq.excused { background: var(--pen); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 4px; font-size: 12.5px; color: var(--ink-2); } .legend span { display: inline-flex; align-items: center; gap: 6px; }
.sheet .chips-row { margin: 8px -20px 0; padding: 4px 20px; }
.sheet h2 { margin-top: 24px; }

.note.warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); font-weight: 500; margin: 12px 0; }
/* Вибір мови на стартовому екрані й екрані оплати */
.langpick { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 22px; border-bottom: 1px solid var(--rule); }
.langpick button { padding: 8px 0; margin-bottom: -1px; color: var(--ink-3); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; }
.langpick button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--pen); }
.price-line { color: var(--pen); font-weight: 600; font-size: 14px; margin: -10px 0 18px; }
.paywall .btn { margin-top: 12px; } .paywall .note { margin-bottom: 4px; }
.consent a, .tiny a { color: var(--pen); }
.paywall .tiny { margin-top: 20px; }

/* Послідовні кроки (справжня послідовність, тож цифри доречні) */
.steps { list-style: none; counter-reset: step; margin: 6px 0 0; padding: 0; }
.steps li { counter-increment: step; display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--rule); }
.steps li::before { content: counter(step); flex: none; width: 20px; font: 600 20px/1 var(--font-display); color: var(--pen); font-variant-numeric: lining-nums; }
/* Сторінка вітання перед входом */
.welcome .features { display: flex; flex-direction: column; gap: 16px; margin: 6px 0 24px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature .fi { flex: none; width: 40px; height: 40px; border-radius: var(--r-m); background: var(--pen-soft); color: var(--pen-ink); display: grid; place-items: center; }
.feature h3 { margin-bottom: 2px; }
.welcome .tiny { margin-top: 12px; }

/* Знайомство: екран затемнюється навколо підсвіченої частини, поруч стоїть підказка зі стрілкою */
.tour-block { position: fixed; inset: 0; z-index: 90; }
.tour-spot { position: fixed; z-index: 91; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 9999px oklch(0.15 0.04 var(--nh) / 0.62), 0 0 0 2px var(--hl); }
.tour-pop { position: fixed; z-index: 92; padding: 14px 16px 16px; border-radius: var(--r-l); background: var(--sheet); box-shadow: var(--shadow), inset 0 0 0 1px var(--rule-strong); display: flex; flex-direction: column; gap: 6px; }
.tour-pop h3 { font: 600 18px/1.25 var(--font-display); }
.tour-head { display: flex; justify-content: space-between; align-items: center; } .tour-head .linkbtn { padding: 0; font-size: 13px; }
.tour-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.tour-arrow { position: absolute; bottom: -7px; width: 13px; height: 13px; background: var(--sheet); transform: rotate(45deg); border-right: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.tour-pop.below .tour-arrow { bottom: auto; top: -7px; border: 0; border-left: 1px solid var(--rule-strong); border-top: 1px solid var(--rule-strong); }
@media (prefers-reduced-motion: no-preference) {
  .tour-spot { transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
  .tour-pop { transition: left .25s ease, top .25s ease; animation: fade .2s ease both; }
}
.steps .step-body { flex: 1; min-width: 0; }
.steps .step-body b { display: block; font-weight: 600; }
.steps .step-body p { margin: 2px 0 0; }
.steps .step-body .btn { margin-top: 8px; margin-right: 8px; }
.banner .row .btn { flex: none; }
code.topic.export { max-height: 46vh; overflow: auto; white-space: pre-wrap; font-size: 12px; }
.row .linkbtn { padding: 0; }

/* ---- сторінка «Що таке Bell», спільний розклад, панель власника */
.page { padding-bottom: 60px; }
.landing { padding-top: calc(24px + env(safe-area-inset-top, 0px)); }
.landing h1 { font-size: clamp(30px, 8vw, 40px); line-height: 1.1; letter-spacing: -0.02em; max-width: 18ch; }
.landing .lead { color: var(--ink-2); font-size: 17px; margin: 14px 0 22px; max-width: 46ch; }
.landing .cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.landing .cta-row .price-line { margin: 0; }
.landing .mock { margin-top: 30px; max-width: 420px; pointer-events: none; }
.landing section { margin-top: 44px; }
.landing h2 { margin-top: 0; }
.landing .steps.big li { padding: 14px 0; }
.landing .steps.big h3 { font-size: 16px; }
.landing .steps.big p { margin-top: 2px; }
.rule-item { padding: 12px 0; border-top: 1px solid var(--rule); } .rule-item p { margin-top: 2px; }
.faq details { border-top: 1px solid var(--rule); padding: 12px 0; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--pen); font: 600 20px/1 var(--font-display); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: 8px; }
.foot { margin-top: 40px; }
.admin .person { padding: 12px 0; border-top: 1px solid var(--rule); }
.admin .actions { justify-content: flex-start; margin-top: 8px; }
.admin h1 { font-size: 26px; } .admin .row .linkbtn { white-space: nowrap; }
.admin .person .t { font-weight: 600; } .admin .person .s { color: var(--ink-2); font-size: 13.5px; }
.login h1 + .sub { margin-top: 6px; }

/* ---- вибір палітри */
.palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.palette button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-m); box-shadow: inset 0 0 0 1px var(--rule-strong); font-weight: 600; font-size: 14px; text-align: left; }
.palette button[aria-pressed=true] { box-shadow: inset 0 0 0 2px var(--pen); }
.palette i { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px oklch(0.2 0.05 var(--nh) / 0.15); }
.icon-preview-mini { flex: none; width: 22px; height: 22px; border-radius: 5px; object-fit: cover; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.icon-dot.auto { flex: none; width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 0deg, #4e5b75, #1b7948, #00767d, #7d44b2, #cc3e35, #3357d6, #4e5b75); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.examcard { display: block; width: 100%; text-align: left; }

/* ---- розділ «Предмети» з вкладкою «Завдання», саме завдання */
.seg .count { display: inline-block; min-width: 20px; margin-left: 6px; padding: 1px 6px; border-radius: 10px; background: var(--pen-soft); color: var(--pen-ink); font-size: 12px; text-align: center; }
.item .tap { text-align: left; }
.tile .tasks-n { display: flex; align-items: center; gap: 5px; color: var(--pen-ink); font-weight: 600; }
.task-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; }
.card.files { padding: 4px 16px; }
.card.files .item { color: var(--ink); text-decoration: none; } .card.files .icon { color: var(--ink-3); }
.row.actions { justify-content: flex-start; margin-top: 14px; }

/* ---- друзі, групи, профіль */
.ava { width: 54px; height: 54px; flex: none; border-radius: 50%; object-fit: cover; }
img.ava { display: block; }
.sheet .btn.block { margin-top: 14px; }
.cover.ava { width: 54px; height: 54px; border-radius: 50%; font-size: 19px; }
.ava.sm, .cover.ava.sm, .head-ava { width: 38px; height: 38px; border-radius: 50%; font-size: 15px; }
.ava.lg, .cover.ava.lg { width: 96px; height: 96px; font-size: 34px; margin: 4px 0 0; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: var(--paper); font-size: 12px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
nav.tabs .badge { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 4px; font-size: 11px; box-shadow: 0 0 0 2px var(--paper); }
.card.people { padding: 6px 16px; border-radius: 18px; }
.card.people.main-pinned { border-color: var(--pen); background: var(--sheet); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); }
.pin-row { display: flex; align-items: center; gap: 6px; }
.pin-badge { display: inline-flex; align-items: center; color: var(--pen); opacity: 0.85; }
.item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.item-badges { display: flex; align-items: center; gap: 5px; }
.muted-icon { display: inline-flex; align-items: center; color: var(--ink-3); }
.card.people > .row { padding: 12px 0 6px; }
.card.people > .btn, .card.people > p { margin: 10px 0 12px; }
.plain { flex: none; border-radius: 50%; }
.plain-btn { width: 100%; text-align: left; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.group-title-btn { background: none; border: 0; padding: 4px 8px; border-radius: var(--r-m); text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: calc(100% - 130px); }
.group-title-btn:hover { background: var(--pen-soft); }
.group-title-text { font: 600 20px/1.2 var(--font-display); color: var(--pen); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.group-sub-text { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.clip1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-row .linkbtn { font-size: 14.5px; padding: 0; flex: none; }
.ava-edit { display: flex; }
.about { margin-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.row.ghead { margin-top: 32px; } .row.ghead h2 { margin: 0; font-size: 24px; } .row.ghead + .banner, .row.ghead + .sub { margin-top: 10px; }
.banner .btn { margin-top: 12px; display: flex; }
.center { text-align: center; }
textarea { resize: vertical; min-height: 48px; font: inherit; }

/* ---- чат: на весь екран, масштаби й вигляд як у Telegram */
.chat { position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: 60; margin: 0 auto; max-width: 680px; display: flex; flex-direction: column; background: var(--paper); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.chat-head .close, .chat-head .back-btn, .chat-head .mute-btn { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--pen); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); cursor: pointer; }
.chat-head .chat-head-ava { flex: none; display: flex; align-items: center; }
.chat-head .body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.chat-head b { font-size: 18px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .tiny { font-size: 13.5px; color: var(--ink-2); margin-top: 1px; }
.chat-tools { display: flex; flex-direction: column; align-items: flex-start; padding: 0 16px; } .chat-tools:empty { display: none; }
.chat-tools .linkbtn { padding: 8px 0; font-size: 14.5px; color: var(--red); }
.chat-task { width: 100%; padding: 10px 0; border-bottom: 1px solid var(--rule); } .chat-task summary { font-weight: 600; font-size: 15.5px; color: var(--pen); cursor: pointer; }
.chat-task .task-text { margin-top: 8px; max-height: 34vh; overflow-y: auto; font-size: 15px; line-height: 1.45; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.chat-day { align-self: center; margin: 10px 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.msg { align-self: flex-start; max-width: 84%; padding: 10px 15px 9px; border-radius: 18px 18px 18px 6px; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); cursor: pointer; position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: filter .12s; }
.msg:active { filter: brightness(0.96); }
.msg.mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--pen-soft); box-shadow: none; color: var(--pen-ink); }
.msg.highlight { animation: jumpHighlight 1.2s ease; }
@keyframes jumpHighlight { 0% { transform: scale(1.02); box-shadow: 0 0 0 3px var(--pen); } 70% { transform: scale(1.01); box-shadow: 0 0 0 3px var(--pen); } 100% { transform: scale(1); box-shadow: none; } }
.msg .fwd { font-size: 13.5px; font-weight: 600; color: var(--pen); margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.msg.mine .fwd { color: var(--pen-ink); opacity: 0.9; }
.msg .who { font-size: 14px; font-weight: 700; color: var(--pen); margin-bottom: 3px; }
.msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16.5px; line-height: 1.4; }
.msg .at { font-size: 12.5px; color: var(--ink-3); text-align: right; margin-top: 4px; font-variant-numeric: tabular-nums; }
.msg.mine .at { color: var(--pen-ink); opacity: 0.75; }
.msg .at .edited-badge { font-size: 11.5px; opacity: 0.75; margin-right: 4px; font-style: italic; }
.msg .pic { display: block; margin: 2px -4px 4px; } .msg .pic img { display: block; max-width: 100%; max-height: 360px; border-radius: 14px; }
.msg .fileline { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 600; padding: 3px 0; font-size: 15.5px; }
.msg .fileline .fname { overflow-wrap: anywhere; } .msg .fileline .icon { width: 20px; height: 20px; }

/* ---- цитата / відповідь на повідомлення ---- */
.quote { display: flex; align-items: stretch; gap: 8px; padding: 5px 9px; margin-bottom: 6px; background: rgba(125, 125, 125, 0.12); border-radius: 8px; cursor: pointer; max-width: 100%; overflow: hidden; user-select: none; }
.msg.mine .quote { background: rgba(0, 0, 0, 0.12); }
.quote-line { width: 3px; border-radius: 2px; background: var(--pen); flex: none; }
.msg.mine .quote-line { background: var(--pen-ink); }
.quote-content { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.quote-name { color: var(--pen); font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.mine .quote-name { color: var(--pen-ink); }
.quote-snippet { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.mine .quote-snippet { color: var(--pen-ink); opacity: 0.85; }

/* ---- панель редагування та панель відповіді ---- */
.chat-edit-bar { display: flex; align-items: center; gap: 10px; padding: 7px 16px; background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); flex: none; }
.chat-edit-bar .edit-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pen); font-weight: 600; }
.chat-edit-bar .close { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); background: transparent; }
.chat-reply-bar { display: flex; align-items: center; gap: 10px; padding: 7px 16px; background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); flex: none; }
.chat-reply-bar .reply-preview { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-reply-bar .reply-name { color: var(--pen); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 700; }
.chat-reply-bar .reply-snippet { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.chat-reply-bar .close { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); background: transparent; }

/* ---- нижня панель введення ---- */
.chat-bar { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 8px 14px calc(8px + var(--safe-b)); border-top: 1px solid var(--rule); background: var(--paper); }
.chat-bar-row { display: flex; align-items: flex-end; gap: 10px; width: 100%; }
.chat-bar .close, .chat-bar .clip-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); background: transparent; box-shadow: none; cursor: pointer; transition: background .15s; }
.chat-bar .close:active, .chat-bar .clip-btn:active { background: var(--sheet); }
.chat-bar .close .icon, .chat-bar .clip-btn .icon { width: 23px; height: 23px; }
.chat-bar textarea { flex: 1; min-height: 44px; max-height: 130px; padding: 11px 16px; border-radius: 22px; resize: none; font-size: 16.5px; line-height: 1.35; background: var(--sheet); border: 1px solid var(--rule-strong); color: var(--ink); }
.chat-bar .send, .chat-bar .send-btn { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--pen); color: var(--on-pen); cursor: pointer; }
.chat-bar .send .icon, .chat-bar .send-btn .icon { width: 23px; height: 23px; }

/* ---- рядок чату зі затисканням (long-press) ---- */
.chat-row { cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; }
.chat-row:active { background: color-mix(in oklch, var(--pen) 6%, transparent); }

/* ---- контекстне меню повідомлення та чату ---- */
.chat-msg-menu-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; justify-content: flex-end; padding: 14px calc(14px + env(safe-area-inset-right, 0px)) calc(14px + var(--safe-b)) calc(14px + env(safe-area-inset-left, 0px)); }
.chat-msg-menu { background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 20px; padding: 8px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35); max-width: 560px; width: 100%; margin: 0 auto; animation: msgMenuSlide .18s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes msgMenuSlide { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.chat-menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px 12px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.chat-menu-title { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.chat-menu-title b { font-size: 16.5px; font-weight: 700; }
.chat-menu-title span { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.chat-msg-menu .item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; font-size: 16.5px; font-weight: 500; color: var(--ink); text-align: left; cursor: pointer; transition: background .12s; width: 100%; border: none; background: transparent; }
.chat-msg-menu .item:hover, .chat-msg-menu .item:active { background: var(--sheet); }
.chat-msg-menu .item.danger-item { color: var(--red); }
.chat-msg-menu .item.cancel-item { margin-top: 4px; border-top: 1px solid var(--rule); color: var(--ink-2); }
nav.tabs button { min-width: 0; }

/* ---- переглядач файлів у чаті ---- */
.file-viewer {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: #0f172a;
  color: #fff;
}
.file-viewer-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex: none;
}
.file-viewer-head .title {
  min-width: 0; flex: 1; display: flex; flex-direction: column;
}
.file-viewer-head .title b {
  font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-viewer-head .title .tiny {
  color: rgba(255, 255, 255, 0.6); font-size: 11px;
}
.file-viewer-head .close {
  width: 36px; height: 36px; border-radius: var(--r-m);
  display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  border: none; cursor: pointer;
}
.file-viewer-head .btn.sm {
  flex: none; background: rgba(255, 255, 255, 0.15); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.file-viewer-head .btn.sm:hover {
  background: rgba(255, 255, 255, 0.25);
}
.file-viewer-body {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 14px; overflow: auto; -webkit-overflow-scrolling: touch;
}
.viewer-media {
  max-width: 100%; max-height: 100%; border-radius: 8px;
}
.viewer-img {
  object-fit: contain; box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.viewer-pdf {
  width: 100%; height: 100%; border: none; background: #fff; border-radius: 8px;
}
.viewer-player-box {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 24px; background: rgba(255, 255, 255, 0.08); border-radius: 16px; width: 90%; max-width: 420px;
}
.viewer-audio {
  width: 100%;
}
.viewer-video {
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.viewer-code {
  width: 100%; height: 100%; margin: 0; padding: 14px;
  background: rgba(0, 0, 0, 0.45); color: #e2e8f0; border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
  overflow: auto;
}
.viewer-card {
  text-align: center; padding: 24px 20px; max-width: 340px; width: 100%;
  background: rgba(255, 255, 255, 0.1); border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.viewer-card .icon { width: 36px; height: 36px; color: var(--pen); }
.viewer-card h3 { margin: 0; font-size: 16px; word-break: break-word; }
.viewer-card .btn { margin-top: 6px; width: 100%; }

/* елементи файлів у чаті */
button.pic.plain {
  display: block; margin: 2px -4px 4px; padding: 0; border: none; background: none; cursor: pointer; text-align: left;
}
button.pic.plain img {
  display: block; max-width: 100%; max-height: 300px; border-radius: 11px;
}
.msg .fileline {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
}
.msg .filebtn {
  display: flex; align-items: center; gap: 8px; text-align: left;
  min-width: 0; flex: 1; color: inherit; font-weight: 600; padding: 2px 0;
  cursor: pointer;
}
.msg .filedl {
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 6px; flex: none; color: inherit; opacity: 0.7;
}
.msg .filedl:hover { opacity: 1; }
.code-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px;
}

/* ---- PWA install prompt banner for iOS / Android ---- */
.pwa-prompt {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  max-width: 480px;
  margin: 0 auto;
  pointer-events: none;
  animation: pwaSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.pwa-prompt.closing {
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.pwa-card {
  pointer-events: auto;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pwa-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pwa-logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}
.pwa-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pwa-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--pen);
  line-height: 1.25;
}
.pwa-desc {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 2px;
  line-height: 1.35;
}
.pwa-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in oklch, var(--ink) 8%, transparent);
  color: var(--ink-2);
  border: none;
  cursor: pointer;
  flex: none;
}
.pwa-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: color-mix(in oklch, var(--ink) 5%, transparent);
  border-radius: 14px;
  padding: 10px 14px;
}
.pwa-step {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pwa-step-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: color-mix(in oklch, var(--pen) 12%, transparent);
  color: var(--pen);
  display: grid;
  place-items: center;
  flex: none;
}
.pwa-step-icon .icon {
  width: 20px;
  height: 20px;
}
.pwa-step-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pwa-step-t {
  font-size: 14px;
  font-weight: 700;
  color: var(--pen);
  line-height: 1.25;
}
.pwa-step-s {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 1px;
  line-height: 1.3;
}
.pwa-action {
  margin-top: 4px;
}
.pwa-pointer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 2px;
}
.pwa-arrow {
  width: 22px;
  height: 22px;
  color: var(--pen);
  animation: pwaBounce 1.4s ease-in-out infinite;
}
@keyframes pwaSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pwaBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---- перегляд документів (docview.js) */
.file-viewer-body.doc { align-items: stretch; justify-content: flex-start; padding: 0; flex-direction: column; }
.file-viewer-body.zoomed-host { align-items: flex-start; }
.file-viewer-body.zoomed-host .viewer-img { margin: auto; }
.viewer-doc { width: 100%; min-height: 100%; color: #111; }
.viewer-doc > .sub, .viewer-doc > .err { color: #fff; text-align: center; padding: 30px 14px; }
.viewer-doc > .viewer-card { margin: 30px auto; }
.viewer-doc.pdf { background: transparent; }
.viewer-zoom { position: absolute; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 3; display: flex; flex-direction: column; gap: 8px; }
.file-viewer .viewer-zoom button { width: 44px; height: 44px; border-radius: 50%; background: #1e293b; color: #fff; border: 1px solid rgba(255, 255, 255, 0.35); font: 600 24px/1 var(--font-ui); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; min-width: min-content; }
.pdf-page { background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.45); flex: none; display: grid; place-items: center; color: #94a3b8; }
.pdf-canvas { width: 100%; height: 100%; display: block; }
.pdf-status { position: sticky; bottom: 0; align-self: center; margin-top: -4px; padding: 5px 12px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.doc-page { background: #fff; color: #1b1f27; max-width: 860px; margin: 0 auto; padding: 22px 20px 40px; min-height: 100%; font: 16px/1.55 var(--font-ui); overflow-wrap: anywhere; }
.doc-page.wide { max-width: none; }
.doc-page h1, .doc-page h2, .doc-page h3, .doc-page h4 { font-family: var(--font-display); line-height: 1.25; margin: 1.1em 0 .4em; color: #0f172a; }
.doc-page h1 { font-size: 26px; } .doc-page h2 { font-size: 21px; } .doc-page h3 { font-size: 18px; } .doc-page h4 { font-size: 16px; }
.doc-p { margin: 0 0 .6em; min-height: 1.2em; } .doc-p.c { text-align: center; } .doc-p.r { text-align: right; } .doc-p.j { text-align: justify; }
.doc-p.li { display: flex; gap: .5em; } .doc-num { flex: none; min-width: 1.4em; text-align: right; color: #475569; }
.doc-p.li[data-lvl="1"] { margin-left: 1.5em; } .doc-p.li[data-lvl="2"] { margin-left: 3em; } .doc-p.li[data-lvl="3"] { margin-left: 4.5em; } .doc-p.li[data-lvl="4"], .doc-p.li[data-lvl="5"], .doc-p.li[data-lvl="6"] { margin-left: 6em; }
.doc-li-body { min-width: 0; flex: 1; }
.dv-b { font-weight: 700; } .dv-i { font-style: italic; } .dv-u { text-decoration: underline; } .dv-s { text-decoration: line-through; } .dv-sup { vertical-align: super; font-size: .75em; } .dv-sub { vertical-align: sub; font-size: .75em; }
.doc-page a { color: #1d4ed8; }
.doc-img { max-width: 100%; height: auto; display: block; margin: 8px 0; border-radius: 4px; }
.doc-tablewrap { overflow-x: auto; margin: 8px 0 14px; -webkit-overflow-scrolling: touch; }
.doc-table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.doc-table td, .doc-table th { border: 1px solid #cbd5e1; padding: 5px 8px; vertical-align: top; white-space: pre-wrap; }
.doc-table th { background: #f1f5f9; font-weight: 600; color: #475569; position: sticky; top: 0; }
.doc-table th.rn { width: 1%; text-align: right; color: #94a3b8; }
.doc-tablewrap.grid { background: #fff; color: #1b1f27; padding: 0 0 10px; margin: 0; }
.doc-tablewrap.grid .btn { margin: 10px 12px 0; width: calc(100% - 24px); }
.doc-sheets .chips-row { background: #1e293b; margin: 0; padding: 8px 12px; position: sticky; top: 0; z-index: 2; }
.doc-slides { max-width: 860px; margin: 0 auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.doc-slide { background: #fff; color: #1b1f27; border-radius: 8px; padding: 18px 18px 14px; box-shadow: 0 2px 14px rgba(0,0,0,.4); }
.doc-slide-n { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #94a3b8; margin-bottom: 8px; }
.doc-slide h3 { margin-top: 0; }
.doc-code { margin: 0; padding: 12px; background: #0f172a; color: #e2e8f0; border-radius: 8px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; overflow-x: auto; }
.doc-page.md code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.doc-page blockquote { border-left: 3px solid #cbd5e1; padding-left: 12px; color: #475569; margin-left: 0; }
.doc-zip { width: 100%; max-width: 640px; margin: 0 auto; padding: 16px; color: #fff; }
.doc-zip .card { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); } .doc-zip .item .t { color: #fff; overflow-wrap: anywhere; } .doc-zip .tiny { color: rgba(255,255,255,.6); }

/* фото в чаті: місце резервується до завантаження, тож чат не стрибає, а нові фото не лишаються «за екраном» */
button.pic.plain.sized { max-width: 100%; }
button.pic.plain.sized img { width: 100%; height: 100%; max-height: none; object-fit: cover; background: rgba(127, 127, 127, 0.16); }
button.pic.plain.wait { min-width: 180px; min-height: 140px; border-radius: 11px; background: rgba(127, 127, 127, 0.16); }
html.chat-open .pwa-prompt, body:has(.file-viewer) .pwa-prompt { display: none; }      /* підказка «Встановити Bell» не закриває чат і перегляд файлів */

.nb-cell { margin: 0 0 14px; } .nb-cell .doc-code { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.nb-out { margin: 0; padding: 10px 12px; background: #f1f5f9; color: #1e293b; border: 1px solid #e2e8f0; border-top: 0; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-x: auto; } .nb-out.err { background: #fef2f2; color: #b91c1c; }
.nb-md { padding: 0 0 8px; }
.doc-rtf { white-space: pre-wrap; overflow-wrap: anywhere; }
.file-viewer-head .close { width: 44px; height: 44px; }                 /* кнопку закриття легко влучити пальцем */
.file-viewer { touch-action: pan-x pan-y; }
.viewer-hint { margin: 0; padding: 6px 14px; flex: none; font-size: 12.5px; color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.06); text-align: center; }
.pdf-wait.err { padding: 12px; text-align: center; font-size: 13px; color: #b91c1c; }
.pdf-wait.err small { display: block; margin-top: 8px; color: #64748b; font-size: 11.5px; word-break: break-word; }
