/* app.css — ядро стилів платформи: токени, reset, типографіка, оболонка, базові компоненти. */
/* Формат: 1 селектор = 1 рядок. Тема світла, керується CSS-змінними (темна вмикається пізніше через :root). */

/* ── Дизайн-токени ─────────────────────────────────────────────────────────── */
:root { --bg: #f5f6f8; --surface: #ffffff; --surface-2: #fbfbfd; --surface-3: #f1f2f6; --ink: #171b24; --muted: #616b7a; --faint: #9aa3b2; --line: #e6e9ef; --line-strong: #d4d9e2; --accent: #5a4bd6; --accent-600: #4a3cc4; --accent-700: #3d31a8; --accent-050: #eeecfb; --accent-100: #e0ddf8; --success: #1f9d6b; --success-050: #e7f6ef; --warning: #c07d00; --warning-050: #fbf1dd; --danger: #d8394a; --danger-050: #fbe8ea; --info: #2f6fd0; --info-050: #e7f0fb; --on-accent: #ffffff; }
:root { --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; --font-mono: "SFMono-Regular", "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace; }
:root { --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px; --lh: 1.5; }
:root { --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; }
:root { --radius-sm: 6px; --radius: 10px; --radius-lg: 14px; --radius-pill: 999px; }
:root { --shadow-1: 0 1px 2px rgba(23, 27, 36, .06), 0 1px 1px rgba(23, 27, 36, .04); --shadow-2: 0 4px 12px rgba(23, 27, 36, .08), 0 2px 4px rgba(23, 27, 36, .05); --shadow-3: 0 12px 32px rgba(23, 27, 36, .14), 0 4px 10px rgba(23, 27, 36, .08); --ring: 0 0 0 3px rgba(90, 75, 214, .28); }
:root { --sidebar-w: 248px; --topbar-h: 56px; --z-sidebar: 40; --z-topbar: 45; --z-dropdown: 60; --z-modal: 80; --z-toast: 100; --dur: .18s; --ease: cubic-bezier(.2, .6, .2, 1); }

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: var(--fs-base); line-height: var(--lh); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
::selection { background: var(--accent-100); }
[hidden], .hidden { display: none !important; }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
details > summary { list-style: none; }

/* ── Типографіка ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -.01em; color: var(--ink); line-height: 1.25; }
h1 { font-size: var(--fs-2xl); letter-spacing: -.02em; }
h2 { font-size: var(--fs-xl); letter-spacing: -.015em; }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { color: var(--ink); }
small { font-size: var(--fs-sm); }
code, kbd, samp { font-family: var(--font-mono); font-size: .92em; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-lg { font-size: var(--fs-lg); }
.strong { font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Утиліти розкладки ─────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.col { display: flex; flex-direction: column; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-top: 0; margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.stack > * + * { margin-top: var(--sp-4); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ── Оболонка застосунку ───────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "brand topbar" "sidebar content"; min-height: 100vh; min-height: 100dvh; }
.app__brand { grid-area: brand; display: flex; align-items: center; gap: var(--sp-2); height: var(--topbar-h); padding: 0 var(--sp-4); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.app__topbar { grid-area: topbar; }
.app__sidebar { grid-area: sidebar; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); padding: var(--sp-3); }
.app__content { grid-area: content; overflow-y: auto; padding: var(--sp-6); }
.app__content-inner { max-width: 1080px; margin: 0 auto; }

/* Логотип / бренд */
.brand { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 650; letter-spacing: -.02em; font-size: var(--fs-md); color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-700) 100%); color: var(--on-accent); flex: 0 0 auto; }
.brand__mark svg { width: 17px; height: 17px; }

/* ── Верхня панель ─────────────────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: var(--sp-3); height: var(--topbar-h); padding: 0 var(--sp-4); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar__title { font-weight: 600; font-size: var(--fs-md); }
.topbar__spacer { flex: 1 1 auto; }
.topbar__burger { display: none; }

/* ── Навігація (сайдбар) ───────────────────────────────────────────────────── */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__section { margin-top: var(--sp-4); padding: 0 var(--sp-3) var(--sp-1); }
.nav__link { display: flex; align-items: center; gap: var(--sp-3); padding: 9px var(--sp-3); border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: var(--fs-md); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.nav__link:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav__link.is-active { background: var(--accent-050); color: var(--accent-700); font-weight: 600; }
.nav__link svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav__link.is-active svg { color: var(--accent); }
.nav__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; }

/* ── Кнопки ────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: 38px; padding: 0 var(--sp-4); border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-3); color: var(--ink); font-weight: 550; font-size: var(--fs-base); line-height: 1; white-space: nowrap; user-select: none; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.btn:hover { text-decoration: none; }
.btn svg { width: 17px; height: 17px; }
.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-3); }
.btn--subtle { background: transparent; color: var(--muted); }
.btn--subtle:hover { background: var(--surface-3); color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { filter: brightness(.95); }
.btn--sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn--lg { height: 44px; padding: 0 var(--sp-5); font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn--icon { width: 38px; height: 38px; padding: 0; }
.btn--icon.btn--sm { width: 32px; height: 32px; }

/* ── Форми ─────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--fs-sm); font-weight: 550; color: var(--ink); }
.label__req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 9px var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 16px; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23616b7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.field.has-error .input:focus, .field.has-error .select:focus, .field.has-error .textarea:focus { box-shadow: 0 0 0 3px rgba(216, 57, 74, .22); }
.hint { font-size: var(--fs-xs); color: var(--muted); }
.error-text { font-size: var(--fs-xs); color: var(--danger); }
.input-prefixed { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.input-prefixed:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.input-prefixed__addon { display: flex; align-items: center; padding: 0 var(--sp-3); background: var(--surface-3); color: var(--muted); font-size: var(--fs-sm); border-right: 1px solid var(--line); font-family: var(--font-mono); white-space: nowrap; }
.input-prefixed .input { border: none; box-shadow: none; }
.input-prefixed .input:focus { box-shadow: none; }
.checkbox { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-base); }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ── Картки і панелі ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.card__body { padding: var(--sp-6); }
.card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6); border-bottom: 1px solid var(--line); }
.card__footer { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card--flush .card__body { padding: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); }

/* Сітка карток (маркетплейс тощо) */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
.mk-card { cursor: pointer; transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.mk-card:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); transform: translateY(-2px); }
.mk-card:focus-visible { box-shadow: var(--ring); }
.mk-card__title { font-size: var(--fs-md); margin-bottom: 6px; }
.mk-card__desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.mk-card__foot { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); }

/* Заголовок сторінки */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-head__title { display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: var(--fs-2xl); }
.page-head__sub { color: var(--muted); font-size: var(--fs-md); }

/* ── Бейджі і чіпи ─────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-3); color: var(--muted); }
.badge--accent { background: var(--accent-050); color: var(--accent-700); }
.badge--success { background: var(--success-050); color: var(--success); }
.badge--warning { background: var(--warning-050); color: var(--warning); }
.badge--danger { background: var(--danger-050); color: var(--danger); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--sp-3); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; transition: all var(--dur) var(--ease); }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ── Аватар і меню-дропдаун ────────────────────────────────────────────────── */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-050); color: var(--accent-700); font-weight: 600; font-size: var(--fs-sm); flex: 0 0 auto; overflow: hidden; }
.dropdown { position: relative; }
.menu { position: absolute; z-index: var(--z-dropdown); min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-3); }
.menu--right { right: 0; }
.menu__head { padding: var(--sp-2) var(--sp-3); }
.menu__name { font-weight: 600; font-size: var(--fs-sm); }
.menu__meta { font-size: var(--fs-xs); color: var(--muted); }
.menu__sep { height: 1px; margin: 6px 0; background: var(--line); }
.menu__item { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: 8px var(--sp-3); border-radius: var(--radius-sm); color: var(--ink); font-size: var(--fs-base); text-align: left; }
.menu__item:hover { background: var(--surface-3); text-decoration: none; }
.menu__item svg { width: 17px; height: 17px; color: var(--muted); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger svg { color: var(--danger); }

/* ── Сповіщення (дзвіночок + панель) ───────────────────────────────────────── */
.notif-bell { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border: 2px solid var(--surface); }
.notif-panel { width: 320px; max-width: calc(100vw - var(--sp-6)); padding: 0; }
.notif-panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.notif-list { max-height: min(60vh, 420px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.notif-item { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: none; }
.notif-item__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.notif-item__title { font-weight: 550; font-size: var(--fs-sm); }
.notif-item__time { flex: 0 0 auto; }
.notif-item__msg { margin-top: 2px; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--sp-8) var(--sp-4); color: var(--faint); text-align: center; }

/* ── Таблиця ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.table th { text-align: left; font-weight: 600; font-size: var(--fs-xs); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }

/* ── Модалка ───────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: var(--sp-4); background: rgba(23, 27, 36, .44); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fade var(--dur) var(--ease); }
.modal { width: 100%; max-width: 540px; max-height: calc(100dvh - var(--sp-8)); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden; animation: pop var(--dur) var(--ease); }
.modal--lg { max-width: 720px; }
.modal__header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
.modal__title { font-size: var(--fs-lg); font-weight: 650; }
.modal__body { padding: var(--sp-5); overflow-y: auto; }
.modal__footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); background: var(--surface-2); }

/* ── Тости ─────────────────────────────────────────────────────────────────── */
.toast-host { position: fixed; z-index: var(--z-toast); right: var(--sp-4); bottom: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); max-width: min(380px, calc(100vw - var(--sp-8))); }
.toast { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--ink); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-3); font-size: var(--fs-base); animation: toast-in var(--dur) var(--ease); }
.toast__icon { flex: 0 0 auto; margin-top: 1px; }
.toast__icon svg { width: 18px; height: 18px; }
.toast__msg { flex: 1 1 auto; line-height: 1.4; }
.toast__close { color: rgba(255, 255, 255, .7); flex: 0 0 auto; }
.toast__close:hover { color: #fff; }
.toast--success .toast__icon { color: #6ee7b0; }
.toast--error { background: var(--danger); }
.toast--error .toast__icon { color: #fff; }
.toast--info .toast__icon { color: #9db8f5; }
.toast.is-leaving { animation: toast-out var(--dur) var(--ease) forwards; }

/* ── Стани: завантаження / порожньо / помилка ─────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
.loading-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3); padding: var(--sp-12) var(--sp-4); color: var(--muted); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-12) var(--sp-6); }
.empty__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--radius-lg); background: var(--surface-3); color: var(--faint); }
.empty__icon svg { width: 26px; height: 26px; }
.empty__title { font-size: var(--fs-lg); font-weight: 600; }
.empty__text { color: var(--muted); max-width: 42ch; }
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: shimmer 1.2s infinite; }

/* ── Екран авторизації (split-screen) ──────────────────────────────────────── */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth__brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: var(--sp-10); color: #fff; background: radial-gradient(120% 120% at 15% 10%, var(--accent-600) 0%, var(--accent-700) 55%, #2b2280 100%); }
.auth__brand::after { content: ""; position: absolute; right: -20%; top: -10%; width: 70%; height: 70%; background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 60%); }
.auth__brand-mark { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 650; font-size: var(--fs-lg); position: relative; z-index: 1; }
.auth__brand-mark .brand__mark { background: rgba(255, 255, 255, .16); }
.auth__pitch { position: relative; z-index: 1; max-width: 30ch; }
.auth__pitch h2 { color: #fff; font-size: var(--fs-2xl); line-height: 1.2; }
.auth__pitch p { color: rgba(255, 255, 255, .78); margin-top: var(--sp-3); font-size: var(--fs-md); }
.auth__foot { position: relative; z-index: 1; color: rgba(255, 255, 255, .6); font-size: var(--fs-sm); }
.auth__panel { display: flex; align-items: center; justify-content: center; padding: var(--sp-8) var(--sp-6); overflow-y: auto; }
.auth__form { width: 100%; max-width: 380px; }
.auth__form h1 { font-size: var(--fs-2xl); }
.auth__form-sub { color: var(--muted); margin-top: 6px; margin-bottom: var(--sp-6); }
.auth__alt { margin-top: var(--sp-5); text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.form-error { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--radius-sm); background: var(--danger-050); color: var(--danger); font-size: var(--fs-sm); }
.form-error svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }

/* Двоколонковий рядок форми */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }

/* ── Опис/дефініції (профіль тенанта) ──────────────────────────────────────── */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: var(--sp-3) var(--sp-4); }
.dl dt { color: var(--muted); font-size: var(--fs-sm); }
.dl dd { color: var(--ink); font-weight: 500; }

/* ── Портал зовнішніх користувачів ─────────────────────────────────────────── */
.portal-topbar { padding-left: max(var(--sp-4), env(safe-area-inset-left)); padding-right: max(var(--sp-4), env(safe-area-inset-right)); }
.portal-main { min-height: calc(100dvh - var(--topbar-h)); display: flex; }
.portal-center { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: var(--sp-6); min-height: 100dvh; }
.portal-main .portal-center { min-height: 0; }
.portal-card { width: 100%; max-width: 420px; }

/* ── Off-canvas сайдбар (мобільний) ────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: var(--z-sidebar); background: rgba(23, 27, 36, .4); animation: fade var(--dur) var(--ease); }

/* ── Анімації ──────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ── Адаптив ───────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) { .auth { grid-template-columns: 1fr; } .auth__brand { display: none; } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "topbar" "content"; }
  .app__brand { display: none; }
  .app__sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(84vw, var(--sidebar-w)); z-index: calc(var(--z-sidebar) + 1); transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-3); padding-top: max(var(--sp-3), env(safe-area-inset-top)); }
  .app.nav-open .app__sidebar { transform: translateX(0); }
  .app__content { padding: var(--sp-4); padding-bottom: max(var(--sp-6), env(safe-area-inset-bottom)); }
  .topbar { padding-left: max(var(--sp-2), env(safe-area-inset-left)); padding-right: max(var(--sp-3), env(safe-area-inset-right)); }
  .topbar__burger { display: inline-flex; }
}

@media (max-width: 560px) {
  .app__content { padding: var(--sp-3); }
  .card__body { padding: var(--sp-4); }
  .card__header, .card__footer { padding: var(--sp-3) var(--sp-4); }
  .page-head h1 { font-size: var(--fs-xl); }
  .form-grid-2, .dl { grid-template-columns: 1fr; }
  .modal__footer { flex-direction: column-reverse; align-items: stretch; }
  .toast-host { left: var(--sp-3); right: var(--sp-3); max-width: none; bottom: max(var(--sp-3), env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }
