/* Модуль ui — общие стили всех сервисов Studio: переменные тем, каркас, элементы, формы, таблицы, меню, модальное окно, адаптив.
   Стили сервиса — его public/assets/app.css (подключается после модулей). */

/* Studio — тёмная панель управления: боковое меню с разделами, поиск сверху,
   бирюзовые кнопки, карточки-списки, статусы-«пилюли». Светлая тема — по переключателю. */
:root {
    --bg: #0f1315;
    --surface: #151a1d;
    --surface-2: #1d2327;
    --surface-3: #2a3135;
    --border: #353c41;
    --border-strong: #4b5359;
    --text: #e9edef;
    --muted: #a2acb2;
    --primary: #80c9cd;
    --primary-hover: #9ad7da;
    --on-primary: #0b2427;
    --primary-soft: rgba(128, 201, 205, .12);
    --link: #8fd2d6;
    --danger: #ff8b82;
    --danger-soft: rgba(255, 110, 100, .14);
    --success: #4fd384;
    --success-text: #c2efd2;
    --success-soft: #1b3b29;
    --sidebar: #0f1315;
    --sidebar-text: #d8dde0;
    --sidebar-active: #2a3135;
    --overlay: rgba(4, 7, 9, .7);
    --radius: 8px;
    --shadow: none;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f3f6f7;
    --surface-3: #e7ecee;
    --border: #dde2e5;
    --border-strong: #c3cace;
    --text: #1a2023;
    --muted: #5b676d;
    --primary: #0f7d84;
    --primary-hover: #0b676d;
    --on-primary: #ffffff;
    --primary-soft: rgba(15, 125, 132, .1);
    --link: #0d737a;
    --danger: #c63a2f;
    --danger-soft: #fdecea;
    --success: #1e9a52;
    --success-text: #15633a;
    --success-soft: #dcf5e6;
    --sidebar: #f7f9fa;
    --sidebar-text: #2a3236;
    --sidebar-active: #e3e9eb;
    --overlay: rgba(20, 30, 35, .45);
    --shadow-lg: 0 12px 32px rgba(20, 30, 35, .16);
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h3 { font-size: 17px; font-weight: 700; margin: 0 0 14px; letter-spacing: -.01em; }
h3:not(:first-child) { margin-top: 28px; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.icon { width: 18px; height: 18px; flex: none; }
::selection { background: var(--primary); color: var(--on-primary); }

/* ---------- Каркас ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; flex: none;
    background: var(--sidebar); color: var(--sidebar-text);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand-logo {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--text); color: var(--bg); font-weight: 800; font-size: 16px;
    box-shadow: inset 0 0 0 5px var(--bg), 0 0 0 2px var(--text);
}
.brand-logo.lg { width: 56px; height: 56px; font-size: 22px; margin: 0 auto 14px; box-shadow: inset 0 0 0 7px var(--surface), 0 0 0 3px var(--text); background: var(--text); }
.nav { padding: 4px 0 24px; display: flex; flex-direction: column; }
.nav-section {
    margin: 20px 0 6px; padding: 0 16px;
    font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text);
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 16px; color: var(--sidebar-text); font-size: 15px;
}
.nav-item .icon { width: 17px; height: 17px; opacity: .7; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: var(--text); font-weight: 500; }
.nav-item.active .icon { opacity: 1; }
.nav-item .icon:last-child:not(:first-child) { width: 13px; height: 13px; margin-left: auto; opacity: .5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 72px; display: flex; align-items: center; gap: 14px;
    padding: 0 32px; background: var(--bg);
    position: sticky; top: 0; z-index: 5;
}
.topbar-search { position: relative; flex: 0 1 620px; }
.topbar-search > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topbar-search input {
    height: 44px; padding-left: 44px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg); font-size: 15px;
}
.topbar-search input:focus { border-color: var(--border-strong); background: var(--surface); }
.quick-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg);
    padding: 6px; display: flex; flex-direction: column;
}
.quick-results a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.quick-results a .icon { color: var(--muted); width: 16px; height: 16px; }
.quick-results a:hover, .quick-results a.focused { background: var(--surface-3); text-decoration: none; }
.quick-results .quick-empty { padding: 8px 10px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-divider { width: 1px; height: 32px; background: var(--border); margin: 0 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text); }
.user-chip:hover { text-decoration: none; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-text strong { font-weight: 500; }
.user-chip-text small { color: var(--muted); font-size: 12px; }
.icon-btn.menu-toggle { display: none; }
.theme-toggle > span { display: grid; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.content { padding: 24px 32px 48px; max-width: 1360px; width: 100%; margin: 0 auto; }

/* Заголовок страницы */
.page-head { margin: 8px 0 28px; display: flex; flex-direction: column; gap: 6px; }
.page-title { font-size: 34px; line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -.025em; overflow-wrap: anywhere; }
.content-wide .page-head { margin-bottom: 16px; }

/* ---------- Элементы ---------- */
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    display: inline-grid; place-items: center;
    color: #fff; font-size: 12px; font-weight: 700;
}
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 18px; border-radius: 999px;
    border: 1px solid var(--border-strong); background: transparent; color: var(--text);
    font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-block { width: 100%; height: 44px; }
.icon-btn {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: 50%;
    border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Статусы-«пилюли» */
.tag {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500; line-height: 18px;
    border: 1px solid var(--border-strong); background: transparent; color: var(--muted);
    white-space: nowrap; vertical-align: middle;
}
.tag-blue { border-color: transparent; background: var(--success-soft); color: var(--success-text); }
.tag-blue::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.tag-red { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
.tag-gray { border-color: transparent; background: var(--surface-3); color: var(--muted); }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; border: 1px solid transparent; transition: opacity .4s; }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.panel:has(> .table) { padding: 0; overflow-x: auto; }
.panel:has(> .table) > h3 { padding: 20px 18px 0; margin: 0 0 8px; }

/* ---------- Формы ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form > .btn:not(.btn-block) { align-self: flex-start; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
    font: inherit; color: var(--text);
    background: var(--bg); border: 1px solid var(--border-strong); border-radius: 6px;
    padding: 8px 12px; min-height: 40px; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--primary); box-shadow: none; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.error { color: var(--danger); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.form-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--muted); }

.check {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer;
}
.check:hover { background: var(--surface-2); }
.check input { margin-top: 3px; }
.check span { display: flex; flex-direction: column; }
.check small { color: var(--muted); }
.check-root:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); }
.check-inline { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.perm-groups { display: flex; flex-direction: column; gap: 10px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); margin: 0; padding: 8px 14px 10px; }
.perm-group legend { font-weight: 600; padding: 0 6px; }
.perm-groups.disabled { opacity: .45; pointer-events: none; }
.root-note { display: none; }
.perm-groups.disabled + .root-note { display: block; }

/* ---------- Таблица ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.toolbar p { margin: 0; }
.toolbar .btn { margin-left: auto; }
.search { position: relative; flex: 0 1 380px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 38px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .06em;
    padding: 12px 18px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th.right { text-align: right; }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.inactive { opacity: .55; }
.table td .tag + .tag { margin-left: 4px; }
.person { display: flex; gap: 12px; align-items: center; }
.person strong { color: var(--link); font-weight: 500; }

/* ---------- Главная ---------- */
.hero { margin: 8px 0 32px; display: grid; grid-template-columns: auto 1fr; column-gap: 22px; row-gap: 4px; align-items: center; }
.hero::before {
    content: ""; grid-row: span 2; width: 96px; height: 96px; border-radius: 6px;
    background:
        radial-gradient(circle at 30% 30%, #b8ecef 0 14%, transparent 14.6%),
        radial-gradient(circle at 70% 30%, #2f6bea 0 14%, transparent 14.6%),
        radial-gradient(circle at 30% 70%, #2f6bea 0 14%, transparent 14.6%),
        radial-gradient(circle at 70% 70%, #b8ecef 0 14%, transparent 14.6%),
        #6fd0d6;
}
.hero h2 { align-self: end; margin: 0; font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.hero p { align-self: start; margin: 0; font-size: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tile {
    display: flex; align-items: center; gap: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; color: var(--link); position: relative;
    transition: border-color .12s, background .12s;
}
.tile:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.tile .tag { position: absolute; top: 14px; right: 14px; }
.tile-title { font-size: 17px; font-weight: 400; }
.tile-icon {
    width: 52px; height: 52px; border-radius: 6px; flex: none;
    display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.tile-icon .icon { width: 22px; height: 22px; stroke-width: 1.6; }

/* ---------- Должности ---------- */
.positions { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.cards-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.position-card { display: flex; flex-direction: column; gap: 6px; position: relative; }
.position-card p { margin: 0; }
.position-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.position-head strong { color: var(--link); font-weight: 500; font-size: 16px; }
.card-actions { display: flex; gap: 2px; justify-content: flex-end; margin-top: auto; }
.position-card.editing { grid-column: 1 / -1; border-color: var(--primary); }

/* ---------- Вход и пустые состояния ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 36px 32px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.auth-brand p { margin: 4px 0 0; }
.empty-state { text-align: center; padding: 56px 16px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-state h2 { color: var(--text); font-size: 24px; letter-spacing: -.02em; }
.guest .empty-state { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; }
.empty-code { font-size: 72px; font-weight: 800; color: var(--border-strong); letter-spacing: -.04em; }

/* ---------- Навигация по вложенности ---------- */
.breadcrumbs { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; font-size: 14px; }
.breadcrumbs a { color: var(--muted); white-space: nowrap; }
.breadcrumbs a:hover { color: var(--link); }
.breadcrumbs .sep { color: var(--border-strong); }
.breadcrumbs .current { color: var(--text); }
.content-wide { max-width: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 40px 0 16px; }
.section-head h3 { margin: 0; }
.section-head a { font-size: 14px; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn.small .icon { width: 15px; height: 15px; }
.small-pad { padding: 28px 16px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; gap: 8px; align-items: center; }
.narrow { max-width: 680px; }
.form-actions.spread { justify-content: space-between; }
.form-actions.spread > span { display: flex; gap: 8px; }

/* ---------- Иконки сущностей и карточки-списки ---------- */
.entity-icon {
    flex: none; display: inline-grid; place-items: center; object-fit: cover;
    border-radius: 6px; color: #fff; font-weight: 700; background: var(--surface-2);
}
.entity-icon.md { width: 32px; height: 32px; font-size: 12px; }
.entity-icon.lg { width: 52px; height: 52px; font-size: 17px; }
.entity-icon.xl { width: 96px; height: 96px; font-size: 32px; border-radius: 6px; }
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.entity-card {
    display: flex; gap: 16px; align-items: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; color: var(--text); transition: border-color .12s, background .12s;
}
.entity-card:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.entity-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.entity-body strong { font-size: 17px; font-weight: 400; color: var(--link); }
.entity-header { display: flex; gap: 22px; align-items: center; margin-bottom: 8px; }
.entity-header-body { flex: 1; min-width: 0; }
.entity-header h2 { margin: 0 0 6px; font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.entity-header p { margin: 0; font-size: 17px; }
.entity-actions { display: flex; gap: 10px; flex-wrap: wrap; align-self: flex-start; }

/* ---------- Ссылки продукта ---------- */
.product-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.link-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
    background: transparent; color: var(--text); font-size: 14px;
}
.link-chip:hover { border-color: var(--primary); text-decoration: none; }
.link-chip .icon { width: 13px; height: 13px; color: var(--muted); }
.link-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.link-rows { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 8px; align-items: center; }
.add-link { align-self: flex-start; padding-left: 4px; }

/* ---------- Доски продукта ---------- */
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.board-tile {
    min-height: 82px; border-radius: var(--radius); padding: 14px 16px 14px 20px;
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
    background: var(--surface); border: 1px solid var(--border); color: var(--link);
    position: relative; overflow: hidden;
}
.board-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tile, var(--primary)); }
.board-tile strong { font-size: 17px; font-weight: 400; }
.board-tile:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.board-tile span { font-size: 14px; color: var(--muted); }
.board-tile-new { border-style: dashed; border-color: var(--border-strong); color: var(--text); background: transparent; padding-left: 14px; }
.board-tile-new::before { display: none; }
.reveal-btn {
    display: flex; align-items: center; gap: 8px; width: 100%;
    border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer;
    padding: 8px; border-radius: 6px; text-align: left;
}
.reveal-btn:hover { background: var(--surface-2); color: var(--text); }
.reveal-body { display: flex; flex-direction: column; gap: 8px; }


/* Всплывающие меню (позиционирует JS: position: fixed у кнопки) */
.menu { position: relative; display: inline-flex; }
.menu-pop {
    position: fixed; z-index: 30; width: 304px; max-height: calc(100vh - 24px); overflow-y: auto;
    background: var(--pop-bg, var(--surface)); color: var(--pop-text, var(--text));
    border: 1px solid var(--pop-border, var(--border)); border-radius: 8px;
    box-shadow: 0 8px 12px rgba(0, 0, 0, .36), 0 0 1px rgba(0, 0, 0, .5);
    padding: 4px 0 8px; cursor: default; text-align: left;
}
.menu-pop-wide { width: 336px; }
.menu-head {
    display: grid; grid-template-columns: 32px 1fr 32px; align-items: center;
    padding: 4px 8px 8px; font-size: 14px;
}
.menu-head strong { grid-column: 2; text-align: center; font-weight: 600; color: var(--pop-text, var(--text)); }
.menu-head .icon-btn { grid-column: 3; color: var(--pop-text, var(--muted)); }
.menu-head .icon-btn:hover { background: var(--pop-hover, var(--surface-2)); color: var(--pop-text, var(--text)); }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 14px; border: 0; background: transparent; color: inherit;
    font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.menu-item .icon { width: 16px; height: 16px; opacity: .8; }
.menu-item:hover { background: var(--pop-hover, var(--surface-2)); }
.menu-item.danger:hover { color: var(--danger); }
.menu-sep { height: 1px; margin: 8px 12px; background: var(--pop-border, var(--border)); }
.menu-label { padding: 2px 14px 8px; font-size: 12px; font-weight: 600; color: var(--col-muted, var(--muted)); }


/* ---------- Модальное окно ---------- */
.modal {
    border: 1px solid var(--border); padding: 0; border-radius: 12px; width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 64px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: var(--overlay); }
.modal-body { padding: 20px 24px 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-loading { padding: 40px; text-align: center; color: var(--muted); }
.title-input { font-size: 22px; font-weight: 700; }
input.title-input { border-color: transparent; padding-left: 6px; background: transparent; }
input.title-input:hover { background: var(--surface-2); }
input.title-input:focus { border-color: var(--primary); background: var(--bg); }


/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
    .form-grid, .positions { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .sidebar { position: fixed; left: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
    .icon-btn.menu-toggle { display: inline-grid; }
    .content { padding: 12px 16px 32px; }
    .topbar { padding: 0 12px; height: 64px; gap: 8px; }
    .topbar-search { flex: 1 1 auto; min-width: 0; }
    .topbar-search input { height: 40px; }
    .topbar-create, .topbar-divider, .user-chip-text { display: none; }
    .page-title { font-size: 26px; }
    .hero h2, .entity-header h2 { font-size: 28px; }
    .hero::before { width: 64px; height: 64px; }
    .hero p { font-size: 16px; }
    .entity-icon.xl { width: 64px; height: 64px; font-size: 22px; }
    .grid-2 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .toolbar { flex-wrap: wrap; }
    .search { flex: 1 1 100%; }
    .toolbar .btn { margin-left: 0; }
    .entity-header { flex-wrap: wrap; align-items: flex-start; }
    .entity-grid, .boards-grid, .tiles { grid-template-columns: 1fr; }
    .menu-pop, .menu-pop-wide { width: min(304px, calc(100vw - 24px)); }
}

/* ---------- Аватары (фото профиля из ID) ---------- */
img.avatar { object-fit: cover; background: var(--surface-2); }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.xl { width: 88px; height: 88px; font-size: 30px; }


/* ---------- Главная: приветствие с фото сотрудника ---------- */
.hero-user::before { display: none; }
.hero-user .hero-avatar { grid-row: span 2; width: 96px; height: 96px; font-size: 34px; }
.hero-user h2 { overflow-wrap: anywhere; }
.hero-meta { align-self: start; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 17px; color: var(--muted); }
.hero-services { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.hero-services a.tag:hover { text-decoration: none; filter: brightness(1.15); }
@media (max-width: 760px) {
    .hero-user .hero-avatar { width: 64px; height: 64px; font-size: 22px; }
    .hero-meta { font-size: 15px; }
}
