:root {
  --navy-900: #14163d;
  --navy-700: #232a6a;
  --navy-500: #3947a3;
  --paper: #ffffff;
  --bg: #f4f5fa;
  /* Нейтралі контенту БЕЗ синього підмісу бренду + вищий контраст тексту
     (Linear 2024: «neutral, timeless» — синій лишається топнаву й акцентам) */
  --line: #e4e5e9;
  --line-soft: #eff0f3;
  --muted: #5d616c;
  --text: #17181d;
  --accent: #4b5fd6;
  --accent-dark: #3a4dc4;
  /* Типографічна шкала (Carbon productive: 12 → 14 → 16 → 20 → 24).
     Робочий текст таблиць/бейджів — 14px (Geist text-label-14).
     NB: інпути тримаємо 16px — менший кегль вмикає авто-зум на iOS. */
  --fs-12: 12px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-24: 24px;
  --success: #2f9e6a;
  --warn: #d68a25;
  --danger: #c74a4a;
  --shadow: 0 4px 18px rgba(20,27,77,0.08);
  --shadow-sm: 0 1px 4px rgba(20,27,77,0.06);
  --shadow-lg: 0 10px 32px rgba(20,27,77,0.14);
  --ring: 0 0 0 3px rgba(75,95,214,0.18);
  --ring-danger: 0 0 0 3px rgba(199,74,74,0.15);
  --t-fast: 0.15s ease;
  --t-med: 0.22s ease;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; font-family: 'Onest', sans-serif; background: var(--bg); color: var(--text); font-size: 16px;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(75,95,214,0.18); }

/* Keyboard accessibility: a visible ring only when navigating with the keyboard. */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ── Entrance animations (subtle, one-shot; disabled for reduced motion) ── */
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 11px 20px; cursor: pointer; font-size: 16px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--accent-dark); box-shadow: 0 3px 10px rgba(75,95,214,0.3); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { box-shadow: var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--line-soft); border-color: #cdd2e4; box-shadow: none; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b23e3e; box-shadow: 0 3px 10px rgba(199,74,74,0.3); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #278a5b; box-shadow: 0 3px 10px rgba(47,158,106,0.3); }

/* Inline spinner for busy buttons: <span className="spinner" /> */
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite; flex: none; }
.btn-ghost .spinner { border-color: rgba(107,111,138,0.3); border-top-color: var(--muted); }

input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--paper); font-size: 16px; color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: #c8cde0; }
input::placeholder, textarea::placeholder { color: #a2a6bf; }
/* Checkboxes/radios must NOT inherit the full-width box styling of text inputs. */
input[type=checkbox], input[type=radio] {
  width: auto; min-width: 0; padding: 0; margin: 0;
  border: none; border-radius: 0; background: none;
  flex: none; accent-color: var(--accent);
  width: 18px; height: 18px; cursor: pointer; vertical-align: middle;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input.input-error, select.input-error, textarea.input-error { border-color: var(--danger); background: rgba(214,69,69,0.05); }
input.input-error:focus, select.input-error:focus { border-color: var(--danger); box-shadow: var(--ring-danger); }
/* Поле адреси: росте вниз під текст (висоту рахує useAutoExpand у helpers.js),
   тож ручний ресайз і внутрішній скрол не потрібні. */
textarea.auto-expand { resize: none; overflow: hidden; line-height: 1.35; }
label { display: block; font-size: var(--fs-14); color: var(--muted); margin-bottom: 5px; font-weight: 500; }

/* gap: 12px вертикально (при переносі) / 18px між колонками — щоб сусідні
   поля (напр. Телефон і РНОКПП) не злипалися; + повітря між сусідніми рядами */
.row { display: flex; gap: 12px 18px; flex-wrap: wrap; }
.row + .row { margin-top: 10px; }
.col { flex: 1; min-width: 200px; }

/* Inline role/option selector (replaces ad-hoc checkbox+select pairs). */
.role-select { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0; }
.role-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0;
  padding: 10px 14px; border-radius: 8px; border: 2px solid var(--line);
  background: var(--paper); font-size: 14px; font-weight: 500;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); }
.role-opt:hover { border-color: #b9c1e8; }
.role-opt.sel { border-color: var(--accent); background: rgba(75,95,214,0.06); box-shadow: var(--shadow-sm); }

.card {
  background: var(--paper); border-radius: 12px; padding: 22px;
  box-shadow: var(--shadow); margin-bottom: 16px;
  animation: fade-up 0.25s ease both;
}
.card h3 { margin: 0 0 16px 0; font-size: 18px; font-weight: 600; }
.card h4 { margin: 18px 0 10px 0; font-size: 15px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* Friendly empty state: icon + title + actionable hint. */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .empty-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.75; }
.empty .empty-title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.empty .empty-hint { font-size: 14px; line-height: 1.55; max-width: 460px; margin: 0 auto; }

/* Loading skeleton (list/table placeholders). */
.skeleton { background: linear-gradient(90deg, var(--line-soft) 25%, #f7f8fc 50%, var(--line-soft) 75%);
  background-size: 200% 100%; animation: pulse-soft 1.4s ease infinite; border-radius: 8px; min-height: 16px; }

/* ── Stylish sectioned form (matches the applicant anketa look) ── */
.form-wrap { max-width: 880px; margin: 0 auto; }
.form-hero { background: linear-gradient(135deg, #2b327a, #4b5fd6); color: #fff;
  border-radius: 14px; padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow);
  animation: fade-up 0.25s ease both; }
.form-hero h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; color: #fff; }
.form-hero p { margin: 0; font-size: 14px; line-height: 1.5; color: rgba(255,255,255,0.82); }
.fsection { background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow);
  animation: fade-up 0.25s ease both;
  transition: border-color var(--t-med), box-shadow var(--t-med); }
.fsection:focus-within { border-color: rgba(75,95,214,0.45); box-shadow: var(--shadow-lg); }
.fsection > h3 { display: flex; align-items: center; gap: 11px; margin: 0 0 16px;
  font-size: 16px; font-weight: 600; }
.fsection .fnum { width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex: none; }
.fsection .fsub { font-size: 13px; color: var(--muted); margin: -8px 0 14px; }
.fsection h4 { margin: 16px 0 10px; font-size: 14px; font-weight: 600; color: var(--text);
  text-transform: none; letter-spacing: 0; }
.form-actions { display: flex; gap: 10px; align-items: center; position: sticky; bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 14px 0 4px; }

/* Layout — top nav + centered content */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topnav { background: var(--navy-900); color: #fff; padding: 12px 24px; display: flex; align-items: center; gap: 18px; box-shadow: 0 4px 12px rgba(20,27,77,0.12); }
.topnav .logo { display: flex; align-items: center; gap: 10px; margin-right: 18px; }
/* Герб ЛНУ темно-синій — на темному топнаві потрібна світла підкладка */
.topnav .logo-mark { width: 38px; height: 38px; border-radius: 9px; background: #fff; display: grid; place-items: center; padding: 3px; }
.topnav .logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.topnav .logo-name { font-size: 16px; font-weight: 600; line-height: 1.1; }
.topnav .logo-sub { font-size: 12px; color: rgba(255,255,255,0.55); }
.topnav-items { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav-item { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 8px; cursor: pointer; color: rgba(255,255,255,0.78); font-size: 15px; background: transparent; border: 0; text-align: left;
  transition: background var(--t-fast), color var(--t-fast); }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.16); color: #fff; font-weight: 500; }
.nav-item:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,0.25); }
/* Червоний лічильник сповіщень працівника (потрібна дія / нове повідомлення) */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px;
  height: 20px; padding: 0 6px; background: #e23b3b; color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1; box-shadow: 0 1px 3px rgba(226,59,59,0.5);
  animation: pulse-soft 1.8s ease-in-out infinite; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.user-chip-info { font-size: 13px; line-height: 1.2; }
.user-chip-name { font-weight: 500; }
.user-chip-role { color: rgba(255,255,255,0.55); font-size: 12px; }
.topnav .logout-btn { background: rgba(255,255,255,0.08); color: #fff; border-radius: 8px; padding: 8px 14px; border: 0; cursor: pointer; font-size: 14px; transition: background var(--t-fast); }
.topnav .logout-btn:hover { background: rgba(255,255,255,0.18); }

.main { flex: 1; padding: 26px 24px; width: 100%; display: flex; justify-content: center; }
.main-inner { width: 100%; max-width: 1280px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 28px; font-weight: 600; }
.topbar-spacer { flex: 1; }

/* Tables — high density (Polaris: index/data pages щільні, форми — ні);
   tabular-nums вирівнює номери договорів/суми/дати по колонках (Geist). */
/* Широкі таблиці (вступники): прокрутка всередині обгортки, а не всієї
   сторінки. НЕ вішати на таблиці з випадайками («⋯»/«Скачати») — зріже їх. */
.tbl-wrap { overflow-x: auto; border-radius: 10px; }
.tbl-wrap > .tbl { margin: 0; }

/* НЕ overflow:hidden — він зрізав випадайки («Скачати ▾»/«⋯») в останніх
   рядках; кути округлюємо на самих клітинках. */
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-14); background: var(--paper); border-radius: 10px; box-shadow: var(--shadow); animation: fade-up 0.25s ease both; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.tbl th { background: var(--line-soft); color: var(--muted); font-weight: 600; font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 8px; padding-bottom: 8px; }
.tbl thead tr:first-child th:first-child { border-top-left-radius: 10px; }
.tbl thead tr:first-child th:last-child { border-top-right-radius: 10px; }
.tbl tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.tbl tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }
.tbl td, .tbl th { transition: background var(--t-fast); }
.tbl tbody tr:hover td { background: rgba(75,95,214,0.04); }
.tbl tbody tr:last-child td { border-bottom: none; }
/* Випадайки («⋯», «Завантажити ▾») мусять лежати ПОВЕРХ блоку пагінації.
   І .card, і .tbl мають `animation: fade-up ... both` — залишковий transform
   робить з кожного окремий stacking context із z-index:auto, тому картка
   пагінації (нижче в DOM) малювалась над меню. Найпомітніше, коли в списку
   1-2 рядки: меню відкривається вниз і ховається за смугою пагінації. */
table.tbl { position: relative; z-index: 2; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: var(--fs-12); font-weight: 600; background: var(--line-soft); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.65; flex: none; }
.badge.b-draft { background: #eef0f7; color: #565b78; }
.badge.b-sent { background: #ecdcf7; color: #6f3aa3; }
.badge.b-signed_by_applicant { background: #fde0c8; color: #8a4a1c; }
.badge.b-active { background: #d4edc7; color: #2f6e1e; }
.badge.b-generated { background: #d8eaff; color: #1f4e8a; }
.badge.b-invalidated { background: #f4d4d4; color: #8a2828; }
.badge.b-submitted { background: #d6e8f5; color: #2a5d8a; }
/* Бейдж з емодзі-іконкою статусу: емодзі замінює крапку, текст трохи жирніший */
.badge-ico::before { display: none; }
.badge-ico { font-weight: 700; padding: 4px 11px 4px 9px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05); }
/* Кольорові лічильники вкладок онлайн-черги за терміновістю */
.tab-count.tc-urgent { background: #fbe0e0; color: #b32b2b; }
.tab-count.tc-warn { background: #fdeccd; color: #8a5a12; }
.tab-count.tc-ok { background: #d7efce; color: #2f6e1e; }
.tab-count.tc-info { background: #ddeafc; color: #1f4e8a; }
.tab.active .tab-count.tc-urgent,
.tab.active .tab-count.tc-warn,
.tab.active .tab-count.tc-ok,
.tab.active .tab-count.tc-info { filter: saturate(1.15); }
/* Індикатор нового повідомлення вступника у рядку онлайн-списку */
.chat-dot { font-size: 14px; line-height: 1; animation: pulse-soft 1.6s ease-in-out infinite; }
/* Тег способу подачі заяви з порталу: онлайн (КЕП) vs очно (друк) */
.mode-tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: 0.02em; }
.mode-online { background: #e0ecff; color: #1f4e8a; }
.mode-offline { background: #ffe8c7; color: #8a5a12; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy-900), var(--navy-500)); }
.login-card { width: 380px; background: var(--paper); border-radius: 14px; padding: 32px; box-shadow: 0 24px 64px rgba(0,0,0,0.32); animation: fade-up 0.3s ease both; }
.login-card h2 { margin: 0 0 4px 0; font-size: 18px; }
.login-card .sub { color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.login-card .err { background: #fdecec; color: #8a2828; padding: 9px 12px; border-radius: 7px; font-size: 12px; margin-top: 12px; }

.demo-creds { margin-top: 18px; padding: 12px; background: var(--line-soft); border-radius: 8px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.demo-creds b { color: var(--text); }

.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: min(560px, calc(100vw - 44px)); }
.toast { background: #1f2350; color: #fff; padding: 16px 20px 16px 16px; border-radius: 10px; font-size: 15px; line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25); animation: toast-in 0.22s ease both; cursor: pointer;
  display: flex; align-items: flex-start; gap: 9px; border-left: 3px solid var(--success); }
.toast.t-error { background: var(--danger); border-left-color: #7e2525; }
.toast .toast-ico { flex: none; font-weight: 700; }
.toast:hover { filter: brightness(1.08); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-tile { background: var(--paper); padding: 18px; border-radius: 10px; box-shadow: var(--shadow); animation: fade-up 0.25s ease both; transition: box-shadow var(--t-med), transform var(--t-med); }
.stat-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-tile .label { font-size: var(--fs-12); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-tile .value { font-size: 32px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-tile .tile-hint { font-size: var(--fs-12); color: var(--muted); margin-top: 8px; line-height: 1.35; }
/* Матриця графіків 2×2 (на вузьких екранах — один стовпчик) */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.chart-grid > .card { margin: 0; }
@media (max-width: 720px) { .chart-grid { grid-template-columns: 1fr; } }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }

/* Фільтри списку онлайн-заяв: компактні чіпи (великі вкладки у вузькій
   колонці ламались на нерівні рядки і виглядали розкидано) */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.chip-btn.active { background: rgba(75,95,214,0.10); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip-btn .tab-count { margin-left: 0; padding: 0 8px; font-size: 12px; }
.tab { padding: 12px 20px; background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer; font-size: 16px; font-weight: 500; color: var(--muted); white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }
.tab-count { display: inline-block; margin-left: 6px; background: var(--line-soft); border-radius: 999px; padding: 1px 9px; font-size: 13px; color: var(--muted); transition: background var(--t-fast), color var(--t-fast); }
.tab.active .tab-count { background: rgba(75,95,214,0.12); color: var(--accent); }
.tab-badge { display: inline-flex; align-items: center; justify-content: center; margin-left: 7px; min-width: 20px; height: 20px; padding: 0 6px; background: #e23b3b; color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1; box-shadow: 0 1px 3px rgba(226,59,59,0.4); }

/* Bar charts (stats) */
.bar-row { display: grid; grid-template-columns: 220px 1fr 80px; align-items: center; gap: 12px; padding: 8px 0; }
.bar-track { background: var(--line-soft); border-radius: 999px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.5s ease; }
.bar-row .bar-pct { color: var(--muted); font-size: 14px; text-align: right; }
.bar-row .bar-label { font-size: 14px; }
.bar-row .bar-label b { font-weight: 600; }

/* padding-top — місце під числа над стовпчиками: вони позиціонуються поза
   стовпчиком, а при overflow:hidden обрізались по верхній межі діаграми.
   Клипінг іде по padding-box, тому в цій смузі підпис лишається видимим. */
.spark { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding: 18px 0 8px; overflow: hidden; }
/* min-width: 0 обовʼязково: глобальне .col (верстка форм) має min-width: 200px,
   і стовпчики діаграми через це не стискались — вилазили за межі картки. */
.spark .col { flex: 1 1 0; min-width: 0; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; transition: background var(--t-fast); }
.spark .col:hover { background: var(--accent-dark); }
.spark .col .col-tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 10.5px; line-height: 1; color: var(--muted); white-space: nowrap; padding-bottom: 3px; font-variant-numeric: tabular-nums; }
.spark-axis { display: flex; gap: 4px; font-size: 11px; color: var(--muted); overflow: hidden; }
/* overflow у клітинці НЕ ховаємо: при 30–40 днях колонка вужча за дату, і
   «01.07.26» обрізалось до «01». Сусідні клітинки порожні (підписуємо кожен
   N-й), тому текст спокійно розтягується поверх них; клипінг лишається на
   контейнері, а крайні підписи вирівнює по краю сам DailyBars. */
.spark-axis div { flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; }

/* Online page – two-column master/detail */
.online-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.online-list-card { background: var(--paper); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.online-list-scroll { flex: 1; overflow-y: auto; }
.online-row { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); cursor: pointer; border-left: 3px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast); }
.online-row:hover { background: var(--bg); }
.online-row.active { background: rgba(75,95,214,0.07); border-left-color: var(--accent); }
.online-row .pib { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.online-row .sub { font-size: 12px; color: var(--muted); }

/* KV pairs */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 10px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.kv:last-child { border-bottom: none; }
.kv-key { font-size: 13px; color: var(--muted); }
.kv-val { font-size: var(--fs-14); color: var(--text); word-break: break-word; font-variant-numeric: tabular-nums; }

/* Horizontal stepper */
.stepper { display: flex; align-items: center; padding: 16px 0; }
.stepper-step { display: flex; align-items: center; gap: 8px; }
.stepper-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0;
  transition: background var(--t-med), border-color var(--t-med), color var(--t-med); }
.stepper-dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.stepper-dot.current { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px rgba(75,95,214,0.15); }
.stepper-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stepper-label.done, .stepper-label.current { color: var(--text); font-weight: 500; }
.stepper-line { flex: 1; height: 2px; background: var(--line); margin: 0 6px; min-width: 8px; transition: background var(--t-med); }
.stepper-line.done { background: var(--success); }

/* Detail card header */
.detail-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.detail-head h3 { margin: 0; font-size: 18px; font-weight: 600; }

/* Reissue reason modal overlay */
.reason-panel { background: var(--navy-900); color: #fff; border-radius: 10px; padding: 18px 20px; margin: 8px 0; animation: fade-up 0.22s ease both; }
.reason-panel h4 { margin: 0 0 10px 0; font-size: 15px; font-weight: 600; }
.reason-panel textarea { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); color: #fff; }
.reason-panel textarea::placeholder { color: rgba(255,255,255,0.45); }

/* File upload zone */
.upload-zone { border: 2px dashed var(--line); border-radius: 10px; padding: 22px 20px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(75,95,214,0.04); }
.upload-zone input[type=file] { display: none; }
.upload-zone .uz-icon { font-size: 28px; margin-bottom: 8px; color: var(--muted); }
.upload-zone .uz-label { font-size: 15px; font-weight: 500; color: var(--text); }
.upload-zone .uz-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.upload-zone.has-file { border-color: var(--accent); background: rgba(75,95,214,0.06); }
.upload-zone .uz-fname { font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 6px; }

/* ── Modal dialog (email send etc.) ── */
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-overlay { position: fixed; inset: 0; background: rgba(20,22,61,0.45); z-index: 900;
  display: grid; place-items: center; padding: 20px; animation: fade-up 0.15s ease both; }
.modal { background: var(--paper); border-radius: 14px; padding: 24px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg); animation: modal-in 0.2s ease both; }
.modal h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.modal .modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.modal label { margin-top: 6px; }

/* ── Responsive: narrow screens (planshet at the admission desk) ── */
@media (max-width: 900px) {
  .online-layout { grid-template-columns: 1fr; }
  .online-list-card { max-height: 320px; }
  .bar-row { grid-template-columns: 130px 1fr 60px; }
  .topbar h1 { font-size: 22px; }
  .main { padding: 18px 14px; }
  .topnav { padding: 10px 14px; gap: 10px; }
  .user-chip-info { display: none; }
}

/* ── Reduced motion: keep it calm for users who ask for it ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  /* Спінер завантаження — функціональний індикатор, а не декор: крутиться завжди,
     навіть коли ОС просить «менше анімації» (інакше «Генеруємо…» стоїть колом). */
  .spinner { animation-duration: 0.7s !important; animation-iteration-count: infinite !important; }
}

/* Примітка працівника до заяви (таблиця «Вступники — ще не укладено») */
.note-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 220px;
  background: #fff7db; color: #7a5a12; border: 1px solid #ecd98c; border-radius: 8px;
  padding: 4px 9px; font-size: 12.5px; font-weight: 500; cursor: pointer; text-align: left;
  line-height: 1.35; white-space: normal; }
.note-chip:hover { background: #fff0c2; border-color: #e2c968; }

/* Гарний файл-пікер: ховаємо нативний input, показуємо кнопку + назву файла */
.file-picker { display: inline-flex; align-items: center; gap: 12px; cursor: pointer;
  max-width: 100%; }
.file-picker input[type="file"] { position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.file-picker-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--navy-50, #eef1fb); color: var(--navy-700, #34409c);
  border: 1px solid var(--navy-200, #c7cef0); border-radius: 9px;
  padding: 9px 15px; font-size: 14px; font-weight: 600; transition: background .12s, border-color .12s; }
.file-picker:hover .file-picker-btn { background: #e2e7fb; border-color: #a8b3ea; }
.file-picker-name { font-size: 13.5px; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.file-picker-name.has-file { color: var(--fg, #1a1c2b); font-weight: 500; }

/* Пагінація списків (серверна): Назад/Далі + «X–Y з N» */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px 8px; flex-wrap: wrap; }
.pager-info { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* Дії в рядку таблиці договорів: компактні кнопки, що переносяться на новий
   рядок усередині клітинки — таблиця не вилазить за край екрана. */
.actions-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions-wrap .btn { font-size: 12px; padding: 5px 10px; white-space: nowrap; }

/* Меню «Скачати ▾» у таблиці договорів */
.dl-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; min-width: 130px; overflow: hidden; }
.dl-menu button, .dl-menu label { background: none; border: 0; text-align: left; padding: 9px 14px; font-size: 13px;
  cursor: pointer; color: var(--text); display: block; }
.dl-menu button:hover, .dl-menu label:hover { background: var(--line-soft); }

/* Чат вступник <-> працівник */
.chat-box { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 2px; }
.chat-msg { max-width: 78%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; word-break: break-word; }
.chat-msg.mine { align-self: flex-end; background: var(--accent, #4b5fd6); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.mine .chat-meta { color: rgba(255,255,255,0.75); }
.chat-msg.theirs { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-meta { font-size: 11px; color: var(--muted); margin: 1px 0; }

/* Вкладення в чаті */
.chat-file { background: rgba(0,0,0,0.08); border: 0; border-radius: 8px; padding: 5px 10px; margin-top: 5px;
  font-size: 13px; cursor: pointer; color: inherit; text-decoration: underline; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-msg.mine .chat-file { background: rgba(255,255,255,0.18); color: #fff; }
