/* Дизайн-система -- навмисно та сама, що й у test-cmdb (спільна SaaS-стилістика
   всієї родини проєктів SYD): ті самі токени кольору/тіней/радіусів, той
   самий .app-shell/.app-sidebar/.app-topbar каркас, ті самі .btn/.card/
   .badge/.table/.alert компоненти. */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;

    --surface-sunken: #f8fafc;
    --surface-hover: #f1f5f9;
    --border-strong: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
    --sidebar-bg: #ffffff;
    --sidebar-border: #eef1f6;
    --sidebar-width: 240px;
    --gradient-primary: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 65%, #7c3aed));
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 700; margin-top: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
.container.centered { display: flex; align-items: center; justify-content: center; min-height: 90vh; }
.auth-form { width: 100%; max-width: 380px; text-align: left; }

/* ---- форми/поля ---- */
label { display: block; margin-bottom: 16px; font-size: 14px; font-weight: 600; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input[type=date], input[type=time], input[type=datetime-local], textarea, select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
textarea { resize: vertical; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-row label { flex: 1; min-width: 160px; margin-bottom: 0; }
.form-row .btn { margin-top: 0; }

/* ---- кнопки ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color .15s ease, box-shadow .15s ease, transform .15s var(--ease-out), filter .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-primary { background: var(--gradient-primary); color: #fff; box-shadow: var(--shadow-sm); border: 1px solid transparent; }
.btn-primary:hover { filter: brightness(1.06); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-secondary { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-danger { background: #fff; color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-row { display: flex; align-items: center; gap: 10px; }

/* ---- картки, повідомлення ---- */
.card { background: var(--card-bg); border: 1px solid rgba(15, 23, 42, .06); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 20px; animation: fadeInUp .3s var(--ease-out) both; }
.card h1, .card h2 { margin-top: 0; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ---- бейджі (пастельна пігулка + крапка кольором самого статусу/мітки --
   структура з cmdb, колір довільний -- у "tasks" кожен простір сам обирає
   колір своїх статусів/пріоритетів/міток). ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
}

/* ---- таблиці ---- */
.table-responsive { width: 100%; overflow-x: auto; border-radius: var(--radius-md); }
table.table { width: 100%; border-collapse: collapse; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; }
table.table th, table.table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; }
table.table th { background: var(--surface-sunken); font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
table.table tbody tr:last-child td { border-bottom: none; }
table.table tbody tr:hover td { background: var(--surface-hover); }

/* ============================================================
   App shell -- той самий каркас, що й у test-cmdb: бокова панель
   зліва (лого, навігація, картка користувача внизу), топбар праворуч
   зверху з заголовком сторінки, .app-content під ним.
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
}
.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--sidebar-border);
}
.app-sidebar-brand:hover { text-decoration: none; }
.app-sidebar-brand-mark { width: 22px; height: 22px; color: var(--primary); flex-shrink: 0; }

.app-sidebar-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.app-nav-section-label { padding: 14px 12px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.app-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
    transition: background-color .15s ease, color .15s ease;
}
.app-nav-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.app-nav-item.active {
    background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 12%, transparent), color-mix(in srgb, var(--primary) 4%, transparent));
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}
.app-nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; }
.app-nav-icon svg { width: 100%; height: 100%; }
.app-nav-label { flex: 1 1 auto; min-width: 0; }
.app-nav-workspace {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
}
.workspace-badge {
    width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 10px; font-weight: 700;
}
.app-nav-workspace-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-sidebar-footer { padding: 10px; border-top: 1px solid var(--sidebar-border); position: relative; }
.app-user-trigger {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 10px; border-radius: var(--radius-sm);
    background: transparent; border: none; cursor: pointer; text-align: left;
    font-family: inherit; color: var(--text);
}
.app-user-trigger:hover { background: var(--surface-hover); }
.avatar-fallback {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.app-user-info { min-width: 0; }
.app-user-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.app-user-trigger-chevron { margin-left: auto; color: var(--text-muted); width: 14px; height: 14px; flex-shrink: 0; transition: transform .2s var(--ease-out); }
.app-user-trigger.open .app-user-trigger-chevron { transform: rotate(180deg); }
.app-user-dropdown {
    position: absolute; bottom: calc(100% + 6px); left: 10px; right: 10px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
    display: none;
}
.app-user-dropdown.open { display: block; }
.app-user-dropdown a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; color: var(--text); text-decoration: none; }
.app-user-dropdown a:hover { background: var(--surface-hover); text-decoration: none; }
.app-user-dropdown-divider { height: 1px; background: var(--border); margin: 4px 6px; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 28px; background: var(--card-bg);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.app-topbar-title { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.02em; color: var(--text); }
.app-topbar-search { flex: 1; max-width: 360px; margin-left: 16px; position: relative; }
.app-topbar-search input { margin-top: 0; background: var(--surface-sunken); border-color: transparent; }
.topbar-search-dropdown {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); padding: 6px; max-height: 360px; overflow-y: auto;
}
.topbar-search-dropdown.open { display: block; }
.topbar-search-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px;
    border-radius: var(--radius-sm); text-decoration: none; color: var(--text);
}
.topbar-search-item:hover { background: var(--surface-hover); text-decoration: none; }
.topbar-search-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-search-item-key { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.topbar-search-item-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-toggle {
    display: none; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); width: 34px; height: 34px;
    align-items: center; justify-content: center; cursor: pointer; color: var(--text); flex-shrink: 0;
}
.sidebar-toggle svg { width: 18px; height: 18px; }
.app-sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 39; }
.app-sidebar-backdrop.open { display: block; }

.app-content { flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; padding: 24px 28px 48px; }

.notif-bell-wrap { position: relative; margin-left: auto; flex-shrink: 0; }
.notif-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; color: var(--text-muted); border: none; background: none; cursor: pointer; padding: 0; }
.notif-bell:hover, .notif-bell.open { background: var(--surface-hover); }
.notif-badge { position: absolute; top: 2px; right: 2px; background: #dc2626; color: #fff; font-size: 9.5px; font-weight: 700; min-width: 14px; height: 14px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.notif-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-width: 90vw;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none;
    max-height: 420px; overflow-y: auto;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 8px 10px 6px; }
.notif-dropdown-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--text); }
.notif-dropdown-item:hover { background: var(--surface-hover); text-decoration: none; }
.notif-dropdown-item.unread { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.notif-dropdown-item-message { font-size: 13px; line-height: 1.4; }
.notif-dropdown-item-time { font-size: 11px; color: var(--text-muted); }
.notif-dropdown-empty { color: var(--text-muted); font-size: 13px; padding: 10px; margin: 0; }
.notif-dropdown-footer { display: block; text-align: center; font-size: 12.5px; font-weight: 600; padding: 8px 10px 6px; border-top: 1px solid var(--border); margin-top: 4px; color: var(--primary); text-decoration: none; }
.notif-dropdown-footer:hover { text-decoration: underline; }

@media (max-width: 880px) {
    .app-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s var(--ease-out); }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
    .app-topbar-search { display: none; }
}

/* ============================================================
   Workspaces list
   ============================================================ */
.workspace-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 28px; }
@media (max-width: 1300px) { .workspace-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .workspace-grid { grid-template-columns: 1fr; } }
.workspace-card {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    border-radius: var(--radius-md); background: var(--card-bg);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    text-decoration: none; color: var(--text);
    transition: border-color .12s ease, transform .12s ease;
}
.workspace-card:hover { border-color: var(--primary); transform: translateY(-1px); text-decoration: none; }
.workspace-card-name { font-weight: 600; }
.workspace-card-key { font-size: 11.5px; color: var(--text-muted); }

/* ============================================================
   View tabs (Board / Roadmap / Calendar / Timeline)
   ============================================================ */
.view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-tabs { display: flex; align-items: center; gap: 2px; background: var(--surface-sunken); border-radius: var(--radius-md); padding: 3px; }
.view-tab {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: calc(var(--radius-md) - 3px);
    font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none; transition: background .12s ease, color .12s ease;
}
.view-tab svg { width: 15px; height: 15px; }
.view-tab:hover { color: var(--text); text-decoration: none; }
.view-tab.active { background: var(--card-bg); color: var(--text); box-shadow: var(--shadow-sm); }

/* ============================================================
   Облік часу -- Календар / Табель
   ============================================================ */
.tsc-week-head { display: flex; margin-bottom: 4px; }
.tsc-gutter-spacer { width: 52px; flex-shrink: 0; font-size: 10.5px; color: var(--text-muted); display: flex; align-items: flex-end; padding-bottom: 4px; }
.tsc-head-col { flex: 1; min-width: 110px; padding: 0 6px; border-left: 1px solid var(--border); }
.tsc-head-col-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 6px; }
.tsc-head-col-top b { font-size: 12.5px; color: var(--text); font-weight: 600; white-space: nowrap; }
.tsc-head-col.is-today .tsc-head-col-top b { color: var(--primary); }
.tsc-day-total { font-size: 11px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

.tsc-untimed-row { display: flex; margin-bottom: 8px; }
.tsc-untimed-cell { flex: 1; min-width: 110px; padding: 0 6px; border-left: 1px solid var(--border); }

.tsc-gridwrap {
    display: flex; overflow-x: auto; border: 1px solid var(--border);
    border-radius: var(--radius-md); background: var(--card-bg);
}
.tsc-gutter {
    display: grid; grid-template-rows: repeat(48, 22px); width: 52px; flex-shrink: 0;
    border-right: 1px solid var(--border); position: sticky; left: 0; background: var(--card-bg); z-index: 2;
}
.tsc-hour-label { font-size: 10.5px; color: var(--text-muted); text-align: right; padding: 0 6px; transform: translateY(-6px); }
.tsc-day-col {
    display: grid; grid-template-rows: repeat(48, 22px); flex: 1; min-width: 110px; position: relative;
    border-left: 1px solid var(--border);
    background-image: repeating-linear-gradient(to bottom, var(--border) 0, var(--border) 1px, transparent 1px, transparent 44px);
}
.tsc-day-col.is-today { background-color: color-mix(in srgb, var(--primary) 4%, transparent); }
.tsc-day-col.is-dayoff { background-color: color-mix(in srgb, #ef4444 5%, transparent); }
.tsc-head-col.is-dayoff .tsc-head-col-top b { color: #dc2626; }
.tsc-block {
    grid-column: 1; justify-self: start; box-sizing: border-box; margin: 1px 3px 1px 0; padding: 2px 6px; border-radius: 6px; position: relative;
    background: color-mix(in srgb, var(--primary) 14%, var(--card-bg)); border-left: 3px solid var(--primary);
    overflow: hidden; color: var(--text); font-size: 11px; cursor: pointer; touch-action: none;
    display: flex; flex-direction: column; gap: 1px; min-height: 0; z-index: 1;
}
.tsc-block:hover { background: color-mix(in srgb, var(--primary) 22%, var(--card-bg)); z-index: 3; }
.tsc-block.is-dragging { z-index: 4; box-shadow: var(--shadow-md); opacity: .9; }
.tsc-block-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 58px; }
.tsc-block-time { color: var(--text-muted); font-size: 10px; }
.tsc-block-actions {
    display: none; position: absolute; top: 2px; right: 2px; gap: 2px;
    background: var(--card-bg); border-radius: 5px; padding: 1px; box-shadow: var(--shadow-sm);
}
.tsc-block:hover .tsc-block-actions { display: flex; }
.tsc-block-action {
    display: flex; align-items: center; justify-content: center; width: 18px; height: 18px;
    padding: 0; border: none; background: none; cursor: pointer; color: var(--text-muted); border-radius: 3px;
}
.tsc-block-action svg { width: 11px; height: 11px; }
.tsc-block-action:hover { background: var(--surface-hover); color: var(--text); }
.ts-block-delete:hover { color: #dc2626; }
.tsc-block-resize {
    position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; touch-action: none;
}
.tsc-block-resize:hover { background: color-mix(in srgb, var(--primary) 35%, transparent); }

.tsc-slot {
    grid-column: 1; width: 100%; height: 100%; padding: 0; margin: 0; border: none;
    background: transparent; cursor: pointer;
}
.tsc-slot:hover { background: var(--surface-hover); }
.ts-issue-results { max-height: 320px; overflow-y: auto; }
/* Поля періоду (З/По) на вкладці "Команда" -- <input type=date> усередині
   кнопкоподібного <label>, як .filter-chip-search; глобальні стилі input
   (рамка, ширина 100%, відступи) тут прибрано. */
.ts-period-input { cursor: text; margin-bottom: 0; gap: 6px; }
.ts-period-input input[type=date] { border: none; background: transparent; padding: 0; margin: 0; width: auto; font: inherit; color: var(--text); box-shadow: none; }
.ts-issue-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px; user-select: none;
}
.ts-issue-row:hover { background: var(--surface-hover); }
.ts-issue-row-key { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.ts-issue-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsc-entry {
    display: block; background: var(--surface-sunken); border-radius: var(--radius-sm);
    padding: 6px 8px; margin-bottom: 6px; font-size: 12px; text-decoration: none; color: inherit;
}
.tsc-entry:hover { background: var(--surface-hover); text-decoration: none; }
.tsc-entry-title { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsc-entry-meta { display: flex; justify-content: space-between; gap: 6px; color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.tsc-entry-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsc-entry-meta span:last-child { flex-shrink: 0; }
@media (max-width: 900px) { .tsc-head-col, .tsc-untimed-cell, .tsc-day-col { min-width: 94px; } }

.tsg-table th, .tsg-table td { text-align: center; white-space: nowrap; padding: 8px 10px; font-size: 12.5px; }
.tsg-table th:first-child, .tsg-table td:first-child { text-align: left; white-space: normal; }
.tsg-weekend { background: color-mix(in srgb, #ef4444 6%, var(--surface-sunken)); color: #dc2626; }
.tsg-today { box-shadow: inset 0 0 0 1px var(--primary); }
.tsg-empty { color: var(--text-muted); }

/* ============================================================
   Timeline view
   ============================================================ */
/* ============================================================
   Timeline view -- grouped Gantt-style (Board "Хронологія")
   ============================================================ */
.tl-container { display: flex; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--card-bg); }
.tl-left-col { width: 360px; flex-shrink: 0; border-right: 1px solid var(--border); }
.tl-right-col { flex: 1; overflow-x: auto; min-width: 0; }
.tl-header-row { height: 34px; display: flex; align-items: center; padding: 0 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--surface-sunken); }
.tl-row-label {
    height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
    border-bottom: 1px solid var(--border); font-size: 12.5px; white-space: nowrap;
}
.tl-row-label.is-indent { padding-left: 34px; }
.tl-toggle { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: none; background: none; padding: 0; cursor: pointer; color: var(--text-muted); flex-shrink: 0; transition: transform .15s ease; }
.tl-toggle svg { width: 13px; height: 13px; }
.tl-toggle.is-collapsed { transform: rotate(-90deg); }
.tl-epic-icon { display: inline-flex; color: #8b5cf6; flex-shrink: 0; }
.tl-epic-icon svg { width: 13px; height: 13px; }
.tl-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text); text-decoration: none; }
.tl-row-title:hover { color: var(--primary); text-decoration: none; }
.tl-row-title.is-done { color: var(--text-muted); text-decoration: line-through; }
.tl-row-status { flex-shrink: 0; }
.tl-right-scroll { position: relative; }
.tl-months-header { height: 34px; position: relative; border-bottom: 1px solid var(--border); background: var(--surface-sunken); }
.tl-month-label { position: absolute; top: 0; height: 100%; display: flex; align-items: center; padding-left: 8px; font-size: 11px; font-weight: 700; color: var(--text-muted); border-left: 1px solid var(--border); }
.tl-month-label.is-current { color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.tl-tracks { position: relative; }
.tl-row-track { height: 40px; position: relative; border-bottom: 1px solid var(--border); }
.tl-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; z-index: 2; }
.tl-bar { position: absolute; top: 8px; bottom: 8px; border-radius: 5px; min-width: 6px; display: block; }
.tl-bar:hover { filter: brightness(0.92); }


/* ============================================================
   Gantt chart
   ============================================================ */
.gantt { overflow-x: auto; }
.gantt-months { position: relative; height: 22px; margin-left: 220px; border-bottom: 1px solid var(--border); margin-bottom: 10px; min-width: 480px; }
.gantt-month-label { position: absolute; top: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); white-space: nowrap; }
.gantt-group { margin-bottom: 18px; }
.gantt-group-label { font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 0 0 6px 220px; }
.gantt-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; min-width: 700px; }
.gantt-row-label {
    width: 220px; flex-shrink: 0; font-size: 12.5px; color: var(--text); text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gantt-row-label:hover { color: var(--primary); text-decoration: none; }
.gantt-track { position: relative; flex: 1; height: 22px; background: var(--surface-sunken); border-radius: 5px; }
.gantt-bar { position: absolute; top: 0; bottom: 0; border-radius: 5px; min-width: 6px; display: block; }
.gantt-bar:hover { filter: brightness(0.92); }
.gantt-today-line { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #ef4444; z-index: 2; }

/* ============================================================
   Kanban board
   ============================================================ */
/* Панель фільтрів у стилі Linear/Jira, спільна для всіх сторінок зі
   фільтрами (Дошка/Дорожня карта/Календар/Хронологія/Гант/Список,
   includes/filter_ui.php): плаский рядок під вкладками (без картки-градієнта),
   кнопки-тригери з випадаючою панеллю замість нативних <select>; єдиний
   колірний акцент -- справжній колір обраного статусу (крапка), решта
   фільтрів лишається нейтральною, як і в реальних PM-інструментах. */
.filter-toolbar { display: flex; align-items: center; padding: 4px 0 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.filter-toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; margin-bottom: 0; width: 100%; }
.filter-toolbar-row > * { flex-shrink: 0; }
/* Явна однакова висота для інпута пошуку й кнопок-тригерів поруч -- без
   цього <input type=search> і кнопка-текст можуть порахувати "auto" висоту
   по-різному (form control vs. text line-box), навіть з однаковим font-size. */
.filter-toolbar-row .btn { height: 32px; }
/* .filter-chip-search -- це <label>, а глобальне правило "label" (вище в
   каскаді) додає margin-bottom:16px і font-weight:600, чого немає в кнопок
   поруч ("button") -- саме це, а не висота самого інпута, робило блок пошуку
   помітно вищим за кнопки-фільтри. Скидаємо явно. */
.filter-chip-search { cursor: text; margin-bottom: 0; }
.filter-chip-search input[type=search] {
    -webkit-appearance: none; appearance: none;
    border: none; background: transparent; padding: 0; margin: 0; font: inherit; line-height: normal;
    color: var(--text); width: 180px; height: 100%;
}
.filter-chip-search input[type=search]::-webkit-search-decoration,
.filter-chip-search input[type=search]::-webkit-search-cancel-button,
.filter-chip-search input[type=search]::-webkit-search-results-button,
.filter-chip-search input[type=search]::-webkit-search-results-decoration { display: none; }
.filter-chip-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.filter-clear-all { align-self: center; color: var(--text-muted); text-decoration: none; font-size: 12.5px; font-weight: 500; padding: 0 4px; white-space: nowrap; }
.filter-clear-all:hover { color: var(--text); text-decoration: underline; }
.board-columns-menu { position: relative; }
.board-columns-menu.is-pinned-right { margin-left: auto; }
.board-columns-trigger { white-space: nowrap; }
.board-columns-panel {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 190px; max-width: 260px;
    max-height: 320px; overflow-y: auto; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: 8px; flex-direction: column; gap: 2px;
}
.board-columns-menu.is-pinned-right .board-columns-panel { left: auto; right: 0; }
.board-columns-panel.open { display: flex; }
.board-columns-option {
    display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; padding: 6px 8px; margin: 0;
    cursor: pointer; border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-columns-option:hover { background: var(--surface-sunken); text-decoration: none; }
.board-columns-option.is-selected { background: color-mix(in srgb, var(--primary) 10%, transparent); font-weight: 700; }
.board-columns-option input { width: auto; margin: 0; }
.board-columns-option svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted); }

.rich-editor-container { background: var(--card-bg); margin-top: 6px; margin-bottom: 12px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.rich-editor-container .ql-toolbar { border: none; border-bottom: 1px solid var(--border); }
.rich-editor-container .ql-container { border: none; font-size: 14px; font-family: inherit; }
.rich-editor-container .ql-editor { height: 340px; min-height: 160px; overflow-y: auto; resize: vertical; }
.status-badge-embed { display: inline-block; padding: 2px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.6; }
.status-badge-panel {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 200px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: 8px; flex-direction: column; gap: 8px;
}
.status-badge-panel.open { display: flex; }
.status-badge-panel input { margin: 0; font-size: 13px; padding: 6px 8px; }
.status-badge-swatches { display: flex; gap: 6px; }
.status-badge-swatches button { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.1); cursor: pointer; padding: 0; }

.calendar-scroll { overflow-x: auto; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 140px); gap: 6px; }
.calendar-weekday { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); text-align: center; padding: 4px; }
.calendar-day-cell { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px; height: 108px; width: 140px; display: flex; flex-direction: column; }
.calendar-day-number { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; flex-shrink: 0; }
.calendar-day-issues { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.calendar-day-issue {
    display: block; font-size: 11px; padding: 2px 5px; border-radius: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; flex-shrink: 0;
}

.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.board-column { width: 280px; flex-shrink: 0; }
.board-column-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; font-weight: 600; font-size: 13.5px; color: var(--text); }
.board-column-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.board-column-count { color: var(--text-muted); font-weight: 400; }
.board-drop-zone { min-height: 100px; display: flex; flex-direction: column; gap: 8px; padding: 6px; border-radius: var(--radius-md); border: 2px dashed transparent; }
.board-drop-zone.drag-over { border-color: var(--primary); background: var(--surface-hover); }
.issue-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 12px; box-shadow: var(--shadow-sm); cursor: grab;
    transition: box-shadow .12s ease, transform .12s ease, border-color .12s ease;
}
.issue-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.issue-card.dragging { opacity: 0.4; }
.issue-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.issue-priority-icon { display: inline-flex; flex-shrink: 0; }
.issue-priority-icon svg { width: 13px; height: 13px; }
.issue-key { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.issue-card-top-spacer { flex: 1; }
.issue-card-title { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.4; margin-bottom: 8px; color: var(--text); text-decoration: none; }
.issue-card-title:hover { color: var(--primary); text-decoration: none; }
.issue-card-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 2px; }
.label-dot-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.label-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.points-chip { background: var(--surface-sunken); color: var(--text-muted); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.avatar-sm {
    width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.avatar-empty { width: 22px; height: 22px; border-radius: 50%; border: 1px dashed var(--border); flex-shrink: 0; }
.empty-column-hint { text-align: center; color: var(--text-muted); font-size: 12px; padding: 24px 8px; }

/* ============================================================
   Backlog
   ============================================================ */
.sprint-panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 20px; }
.sprint-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sprint-panel-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sprint-panel-heading h3 { margin: 0; font-size: 15px; font-weight: 700; }
.sprint-collapse-toggle { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; border-radius: var(--radius-sm); flex-shrink: 0; }
.sprint-collapse-toggle:hover { background: var(--surface-sunken); color: var(--text); }
.sprint-collapse-toggle svg { transition: transform .15s ease; }
.sprint-collapse-toggle.is-collapsed svg { transform: rotate(-90deg); }
.sprint-panel.is-collapsed .backlog-row-list,
.sprint-panel.is-collapsed .sprint-progress-track,
.sprint-panel.is-collapsed .sprint-goal { display: none; }
.sprint-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sprint-status-dot.is-active { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 18%, transparent); }
.sprint-status-dot.is-planned { background: var(--text-muted); }
.sprint-status-dot.is-completed { background: var(--border-strong); }
.sprint-panel.is-completed { opacity: .82; }
.sprint-panel.is-completed .backlog-row-title { color: var(--text-muted); }
.sprint-meta { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.sprint-goal { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }
.sprint-progress-track { height: 5px; border-radius: 999px; background: var(--surface-sunken); margin-top: 14px; overflow: hidden; }
.sprint-progress-fill { height: 100%; background: #22c55e; border-radius: 999px; transition: width .3s var(--ease-out); }
.backlog-row-list { display: flex; flex-direction: column; margin-top: 14px; }
.backlog-row-list:empty { display: none; }
.backlog-row {
    display: flex; align-items: center; gap: 10px; padding: 9px 4px;
    border-bottom: 1px solid var(--border); font-size: 13px;
}
.backlog-row:last-child { border-bottom: none; }
.backlog-row.is-done .backlog-row-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.backlog-row .issue-priority-icon { width: 13px; }
.backlog-row-key { color: var(--text-muted); font-weight: 600; font-size: 11.5px; flex-shrink: 0; text-decoration: none; }
.backlog-row-key:hover { color: var(--primary); }
.backlog-row-title { flex: 1; min-width: 120px; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backlog-row-title:hover { color: var(--primary); text-decoration: none; }
.backlog-row-labels { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.backlog-row-status { flex-shrink: 0; }
.backlog-empty-hint { text-align: center; color: var(--text-muted); font-size: 12.5px; padding: 16px 8px; margin: 14px 0 0; }

.backlog-row-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.backlog-row-action-form { margin: 0; }
.btn-icon-action {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
    border: none; background: none; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer;
}
.btn-icon-action svg { width: 14px; height: 14px; }
.btn-icon-action:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-icon-action:disabled { opacity: .3; cursor: default; }
.btn-icon-action.btn-icon-danger:hover { background: color-mix(in srgb, #ef4444 12%, transparent); color: #b91c1c; }

.row-move-menu { position: relative; display: inline-flex; }
.row-move-panel {
    display: none; position: absolute; top: calc(100% + 4px); right: 0; z-index: 40; min-width: 170px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: 4px; flex-direction: column; gap: 1px; max-height: 220px; overflow-y: auto;
}
.row-move-panel.open { display: flex; }
.row-move-panel form { margin: 0; }
.row-move-option {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px;
    border: none; background: none; border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text); cursor: pointer;
}
.row-move-option svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--text-muted); }
.row-move-option:hover { background: var(--surface-hover); }
.row-move-option.is-current { font-weight: 700; color: var(--primary); }

/* ============================================================
   Issue detail
   ============================================================ */
.issue-layout { display: flex; gap: 24px; align-items: flex-start; }
.issue-main { flex: 1; min-width: 0; }
.issue-side {
    width: 260px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); padding: 16px;
}
/* Шапка перегляду задачі (ключ "OBS-20 · Задача" + кнопки Змінити/Посилання/
   На весь екран/Закрити) -- закріплена зверху картки модалки, яка сама
   скролиться (overflow-y:auto), тож при прокручуванні вниз ключ і кнопки
   лишаються видимими. Від'ємні відступи розтягують її на всю ширину картки
   поверх padding:24px, щоб фон перекривав вміст, що прокручується під нею;
   кнопки (position:absolute; top:14px) тепер позиціонуються відносно неї.
   top:-24px -- sticky-зсув рахується від краю вмісту картки (всередині її
   padding), тож з top:0 над шапкою лишалась смуга 24px, крізь яку було
   видно текст, що прокручується. */
.issue-sticky-head {
    position: sticky; top: -24px; z-index: 5;
    margin: -24px -24px 12px; padding: 20px 24px 10px;
    background: var(--card-bg); border-bottom: 1px solid var(--border);
}
/* Розділювач перед "Облік часу" у бічній панелі (gap:16px флекс-колонки
   дає відступи зверху/знизу). */
.issue-side-divider { border: none; height: 1px; background: var(--border); margin: 0; }
.issue-key-line { font-size: 13px; line-height: 22px; color: var(--text-muted); padding-right: 220px; }
.issue-title { font-size: 22px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.02em; }
.issue-title-edit-form { margin: 0 0 16px; }
.issue-title-input { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; padding: 6px 10px; width: 100%; }

/* Вкладки "Головна"/"Історія змін" на перегляді задачі -- легкі підкреслені
   таби для навігації ВСЕРЕДИНІ вмісту, свідомо інші за виглядом від
   .view-tabs/.view-tab (заокруглена "піл"-панель на сірому фоні) -- та
   призначена для навігації МІЖ СТОРІНКАМИ (Дошка/Дорожня карта/Календар),
   тут же тяжкий заповнений фон виглядав недоречно для перемикання розділів
   в межах однієї картки. */
.issue-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.issue-tab {
    background: none; border: none; padding: 0 0 10px; margin-bottom: -1px;
    font-size: 13.5px; font-weight: 600; color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent; transition: color .12s ease, border-color .12s ease;
}
.issue-tab:hover { color: var(--text); }
.issue-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.issue-description { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; margin-bottom: 28px; color: var(--text); }
.issue-description img { max-width: 100%; border-radius: var(--radius-sm); }
.issue-description table { white-space: normal; border-collapse: collapse; margin: 10px 0; }
.issue-description table td, .issue-description table th { border: 1px solid var(--border); padding: 6px 10px; }
.issue-divider { border: none; height: 1px; background: linear-gradient(to right, transparent, var(--border) 15%, var(--border) 85%, transparent); margin: 0 0 28px; opacity: .7; }
.issue-collapsible summary { cursor: pointer; display: flex; align-items: center; gap: 5px; list-style: none; user-select: none; }
.issue-collapsible summary::-webkit-details-marker { display: none; }
.issue-collapsible summary::before { content: '›'; display: inline-block; font-size: 13px; line-height: 1; color: var(--text-muted); transition: transform .15s ease; }
.issue-collapsible[open] summary::before { transform: rotate(90deg); }
.section-heading { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 10px; font-weight: 700; }
.section { margin-bottom: 28px; }
.comment-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.comment-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.comment-body { font-size: 13.5px; white-space: pre-wrap; }
.comment-replies { margin: 10px 0 0 20px; border-left: 2px solid var(--border); padding-left: 12px; }
.comment-replies .comment-item { margin-bottom: 8px; box-shadow: none; }
.comment-replies .comment-item:last-child { margin-bottom: 0; }
.comment-reply-toggle { margin-top: 8px; }
.comment-reply-toggle summary { cursor: pointer; display: inline-block; font-size: 12px; font-weight: 600; color: var(--primary); list-style: none; user-select: none; }
.comment-reply-toggle summary::-webkit-details-marker { display: none; }
.comment-reply-toggle summary:hover { text-decoration: underline; }
.worklog-item, .activity-item { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.issue-side form { margin: 0; }
.issue-side label { margin-bottom: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.issue-side input, .issue-side select { margin-top: 4px; }

/* ============================================================
   Members table
   ============================================================ */
.member-row-name { font-weight: 600; color: var(--text); }
.member-row-email { font-size: 12px; color: var(--text-muted); }

@media (max-width: 720px) {
    .issue-layout { flex-direction: column; }
    .issue-side { width: 100%; }
    .app-content { padding: 16px 16px 40px; }
}

/* ---- Modal (same pattern as test-cmdb's includes/footer.php +
   .modal-overlay) -- .actions-trigger + data-modal opens, .modal-close-btn
   or a click on the dimmed overlay itself closes. ---- */
.modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s var(--ease-out), visibility 0s linear .18s;
}
.modal-overlay.open {
    opacity: 1;
    visibility: visible;
    transition: opacity .18s var(--ease-out), visibility 0s linear;
}
.modal-overlay .card {
    position: relative;
    transform: scale(.94) translateY(8px);
    opacity: 0;
    transition: transform .18s var(--ease-out), opacity .18s var(--ease-out), max-width .18s var(--ease-out), max-height .18s var(--ease-out);
    max-height: 88vh;
    overflow-y: auto;
}
.modal-overlay.open .card { transform: scale(1) translateY(0); opacity: 1; }
.modal-overlay .card.is-fullscreen { max-width: calc(100vw - 40px) !important; max-height: calc(100vh - 40px); width: calc(100vw - 40px); height: calc(100vh - 40px); }
.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close-btn:hover { background: var(--surface-hover); color: var(--text); }
.modal-fullscreen-btn {
    position: absolute;
    top: 14px;
    right: 54px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-fullscreen-btn:hover { background: var(--surface-hover); color: var(--text); }
.modal-fullscreen-btn svg { width: 15px; height: 15px; }
.modal-edit-btn {
    position: absolute;
    top: 14px;
    right: 174px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-edit-btn:hover { background: var(--surface-hover); color: var(--text); }
.modal-edit-btn svg { width: 15px; height: 15px; }
.modal-copy-link-btn {
    position: absolute;
    top: 14px;
    right: 94px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-copy-link-btn:hover { background: var(--surface-hover); color: var(--text); }
.modal-copy-link-btn svg { width: 15px; height: 15px; }
.modal-copy-link-btn.is-copied { color: #22c55e; }

/* ---- Radio-card choice (Public/Private access on workspace creation) ---- */
.radio-card { display: flex; align-items: flex-start; gap: 12px; border: 2px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; margin-top: 10px; cursor: pointer; }
.radio-card:hover { border-color: var(--primary); }
.radio-card input { margin-top: 3px; flex-shrink: 0; }
.radio-card-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; display: block; }
.radio-card-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.radio-card:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* ---- Workspaces overview: top-8-most-active grid, "all workspaces"
   reveal, and the mini analytics row underneath ---- */
.workspace-grid-header { display: flex; align-items: center; justify-content: flex-end; margin-bottom: 14px; }
.workspace-grid-more { display: flex; justify-content: flex-end; margin: 4px 0 24px; }
.workspace-card { position: relative; }
.workspace-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.workspace-card-tag { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-sunken); color: var(--text-muted); }
.workspace-card-visibility { position: absolute; top: 10px; right: 10px; color: var(--text-muted); }
.workspace-card-visibility svg { width: 14px; height: 14px; }
.workspace-analytics-panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 20px 24px; margin-bottom: 24px; }
.workspace-chart { margin-bottom: 18px; }
.workspace-chart-legend { display: flex; gap: 18px; margin-bottom: 8px; }
.workspace-chart-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.workspace-chart-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.workspace-chart-svg { width: 100%; height: 150px; display: block; overflow: visible; }
.workspace-chart-area { fill: color-mix(in srgb, #6366f1 16%, transparent); stroke: none; opacity: 0; animation: workspaceChartFadeIn .6s ease .3s forwards; }
.workspace-chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: workspaceChartDraw 1.1s var(--ease-out) forwards; }
.workspace-chart-line-created { stroke: #6366f1; }
.workspace-chart-line-resolved { stroke: #10b981; animation-delay: .15s; }
@keyframes workspaceChartDraw { to { stroke-dashoffset: 0; } }
@keyframes workspaceChartFadeIn { to { opacity: 1; } }
.workspace-analytics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.workspace-analytics-tile { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.workspace-analytics-tile-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.workspace-analytics-tile-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   Workspace overview
   ============================================================ */
.overview-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
@media (max-width: 880px) { .overview-columns { grid-template-columns: 1fr; } }
.overview-col { display: flex; flex-direction: column; gap: 20px; }
.overview-activity-panel { display: flex; flex-direction: column; height: 100%; }
.overview-activity-panel .recent-issues-list { flex: 1; min-height: 0; height: auto; max-height: 100%; overflow-y: auto; }
.stat-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-bar-row:last-child { margin-bottom: 0; }
.stat-bar-label { width: 130px; flex-shrink: 0; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-track { flex: 1; background: var(--surface-sunken); border-radius: 4px; overflow: hidden; height: 14px; }
.stat-bar-fill {
    height: 100%; border-radius: 4px; transition: width .3s var(--ease-out);
    transform-origin: left; animation: growBar .6s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes growBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.stat-bar-count { width: 26px; flex-shrink: 0; text-align: right; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ============================================================
   Custom reports (dashboard.php)
   ============================================================ */
.custom-reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 8px; }
.custom-report-card { margin-bottom: 0; }
.custom-report-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.custom-report-head h2 { margin: 0; }
.custom-report-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.custom-report-actions form { margin: 0; }
.custom-report-donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.custom-report-donut svg { opacity: 0; transform: scale(.82); transform-origin: center; animation: donutFadeIn .55s var(--ease-out) forwards; }
@keyframes donutFadeIn { to { opacity: 1; transform: scale(1); } }
.custom-report-legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.custom-report-legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text); }
.custom-report-legend-item .stat-bar-count { margin-left: auto; width: auto; }

/* ============================================================
   Workflow settings (statuses/types/priorities CRUD)
   ============================================================ */
.workflow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 8px; }
.workflow-row { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.workflow-row:last-child { border-bottom: none; }
.workflow-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   Reports -- Jira-style widget gallery (dashboard.php)
   ============================================================ */
.jira-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.jira-toolbar h1 { margin: 0; font-size: 20px; font-weight: 700; }
.jira-add-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: #0052CC; color: #fff; border-radius: 3px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; }
.jira-add-btn:hover { background: #0747A6; }
.jira-add-btn svg { width: 15px; height: 15px; }
.jira-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.jira-widget { background: var(--card-bg); border: 1px solid #DFE1E6; border-radius: 3px; box-shadow: 0 1px 2px rgba(9,30,66,.08); overflow: hidden; }
.jira-widget-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 3px solid; font-weight: 700; font-size: 13.5px; color: #172B4D; }
.jira-widget-head svg { width: 15px; height: 15px; flex-shrink: 0; }
.jira-widget-head.c-blue { border-color: #0052CC; }
.jira-widget-head.c-green { border-color: #00875A; }
.jira-widget-head.c-purple { border-color: #6554C0; }
.jira-widget-head.c-orange { border-color: #FF8B00; }
.jira-widget-head.c-red { border-color: #DE350B; }
.jira-widget-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.jira-widget-actions form { margin: 0; }
.jira-widget-body { padding: 16px; }
.jira-pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.jira-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 3px; font-size: 12px; font-weight: 700; }
.jira-pill svg { width: 12px; height: 12px; }
.jira-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.jira-bar-row:last-child { margin-bottom: 0; }
.jira-bar-label { width: 110px; flex-shrink: 0; font-size: 12.5px; color: #172B4D; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jira-bar-track { flex: 1; height: 14px; background: #F4F5F7; border-radius: 2px; overflow: hidden; }
.jira-bar-fill { height: 100%; }
.jira-bar-count { width: 24px; text-align: right; font-size: 11.5px; color: #6B778C; font-weight: 700; }
.jira-donut-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.jira-donut-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #172B4D; }
.jira-activity-item { display: block; padding: 8px 0; border-bottom: 1px solid #F4F5F7; font-size: 12.5px; color: #172B4D; text-decoration: none; }
.jira-activity-item:hover { color: #172B4D; text-decoration: none; background: #F4F5F7; }
.jira-activity-item:last-child { border-bottom: none; }
.jira-activity-meta { color: #6B778C; font-size: 11px; margin-top: 2px; }
.jira-sprint-progress { height: 8px; background: #F4F5F7; border-radius: 4px; overflow: hidden; margin: 10px 0; }
.jira-sprint-progress-fill { height: 100%; background: #00875A; }

/* ============================================================
   New issue modal -- 75/25 split (main content / metadata sidebar)
   ============================================================ */
.issue-modal-layout { display: flex; gap: 28px; align-items: flex-start; }
.issue-modal-main { flex: 1 1 75%; min-width: 0; }
.issue-modal-sidebar { flex: 1 1 25%; min-width: 220px; max-width: 320px; }
@media (max-width: 760px) {
    .issue-modal-layout { flex-direction: column; }
    .issue-modal-sidebar { max-width: none; width: 100%; }
}

.report-card-intro { color: var(--text-muted); font-size: 13.5px; margin: 4px 0 20px; max-width: 640px; }
.tag-picker { position: relative; margin-bottom: 4px; }
.tag-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag-picker-chips:empty { display: none; }
.tag-picker-chip { display: inline-flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--primary) 12%, white); color: var(--primary); font-size: 12.5px; font-weight: 600; padding: 4px 6px 4px 12px; border-radius: 999px; }
.tag-picker-chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.tag-picker-input { width: 100%; }
.tag-picker-dropdown { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 200px; overflow-y: auto; z-index: 40; }
.tag-picker-dropdown.open { display: block; }
.tag-picker-option { padding: 8px 12px; font-size: 13.5px; cursor: pointer; }
.tag-picker-option:hover { background: var(--surface-hover); }
/* ---- Footer credit + version-history modal (ported from test-cmdb) ---- */
.app-footer-credit {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; text-align: center; color: var(--text-muted); font-size: 12.5px;
    padding: 18px 28px; margin-top: 8px; border-top: 1px solid var(--border);
}
.app-footer-credit-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.app-footer-credit-sep { color: var(--border); }
.app-footer-version {
    margin: 0; padding: 0; font-size: 12.5px; font-family: inherit;
    font-variant-numeric: tabular-nums; color: var(--text-muted);
    background: none; border: none; cursor: pointer;
    text-decoration: underline dotted; text-underline-offset: 2px;
}
.app-footer-version:hover { color: var(--primary); }
.changelog-modal { max-width: 640px; width: 92%; max-height: 82vh; display: flex; flex-direction: column; position: relative; text-align: left; padding-top: 36px; }
.changelog-modal-body { overflow-y: auto; padding-right: 4px; }
.changelog-version { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.changelog-version:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.changelog-version-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.changelog-version-date { font-size: 12.5px; color: var(--text-muted); }
.changelog-version h4 { margin: 14px 0 6px; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.changelog-version h4:first-child { margin-top: 0; }
.changelog-version ul { margin: 0 0 4px; padding-left: 20px; }
.changelog-version li { margin-bottom: 8px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.changelog-version li strong { color: var(--text); }
.changelog-version li code { font-size: 12px; background: var(--surface-hover); padding: 1px 5px; border-radius: 4px; }
.changelog-version p { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.section-eyebrow { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 12px; }
.workspaces-split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 880px) { .workspaces-split-grid { grid-template-columns: 1fr; } }
.recent-issues-list { display: flex; flex-direction: column; padding: 6px; height: 456px; overflow-y: auto; }
.recent-issue-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.recent-issue-row:hover { background: var(--surface-hover); text-decoration: none; }
.recent-issue-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.recent-issue-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-issue-meta { font-size: 12px; color: var(--text-muted); }
.recent-issue-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.btn-icon-remove-row {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--card-bg); color: var(--text-muted); cursor: pointer;
}
.btn-icon-remove-row:hover { border-color: #ef4444; color: #ef4444; }
.member-row { margin-bottom: 8px; }

/* ============================================================
   Крос-просторові звіти (reports.php): ліворуч список 10 звітів,
   праворуч фільтри + таблиця. Числові клітинки мають міні-стовпчик
   (.xr-bar) відносно максимуму колонки -- швидке порівняння команд.
   ============================================================ */
.xr-layout { display: flex; gap: 20px; align-items: flex-start; }
.xr-nav { width: 240px; flex-shrink: 0; padding: 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.xr-nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text); text-decoration: none; }
.xr-nav-item svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-muted); }
.xr-nav-item:hover { background: var(--surface-hover); }
.xr-nav-item.active { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); font-weight: 600; }
.xr-nav-item.active svg { color: var(--primary); }
.xr-main { flex: 1; min-width: 0; }
.xr-asof { font-size: 13px; color: var(--text-muted); align-self: center; }
.xr-table th.xr-num, .xr-table td.xr-num { text-align: right; white-space: nowrap; }
.xr-table td.xr-num { position: relative; }
.xr-bar { position: absolute; right: 0; top: 20%; bottom: 20%; background: color-mix(in srgb, var(--primary) 12%, transparent); border-radius: 3px; pointer-events: none; }
.xr-val { position: relative; }
.xr-table td.xr-neg { color: #dc2626; }
.xr-table td.xr-pos { color: #15803d; }
.xr-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
@media (max-width: 900px) {
    .xr-layout { flex-direction: column; }
    .xr-nav { width: 100%; position: static; }
}

/* ---- account_settings.php -> LDAP / AD: блок "Додатково" й результат перевірки користувача. ---- */
.ldap-advanced { margin-top: 6px; }
.ldap-advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 8px; }
.ldap-test-user { margin-top: 8px; font-size: 13px; }
.ldap-test-user ul { margin: 4px 0 6px; padding-left: 18px; font-size: 11.5px; max-height: 160px; overflow-y: auto; }

/* ---- Перегляд задачі: кнопка-дзвіночок "Спостерігачі" одразу після
   "Змінити" (той самий круглий стиль, що й сусідні кнопки шапки) з
   лічильником; is-watching -- поточний користувач уже спостерігає. ---- */
.modal-watch-btn {
    position: absolute; top: 14px; right: 134px; width: 30px; height: 30px; border-radius: 50%;
    border: none; background: transparent; color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.modal-watch-btn:hover { background: var(--surface-hover); color: var(--text); }
.modal-watch-btn svg { width: 15px; height: 15px; }
.modal-watch-btn.is-watching { color: var(--primary); }
.modal-watch-count {
    position: absolute; top: 1px; right: 0; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px;
    background: var(--primary); color: #fff; font-size: 9.5px; font-weight: 700; line-height: 14px; text-align: center;
}
.watcher-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.watcher-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--radius-sm); }
.watcher-row:hover { background: var(--surface-hover); }
.watcher-row form { margin: 0 0 0 auto; }
.watcher-row .btn svg { width: 14px; height: 14px; }
.watcher-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    background: var(--gradient-primary); color: #fff; font-size: 12px; font-weight: 700;
}
.watcher-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.watcher-email { font-size: 11.5px; font-weight: 400; color: var(--text-muted); }

/* ---- Учасники простору: підказки людей з AD під полем "Додати учасника". ---- */
.member-ad-results {
    display: none; position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); padding: 4px; max-height: 280px; overflow-y: auto;
    text-transform: none; letter-spacing: normal; font-weight: 400;
}
.member-ad-results.open { display: block; }
.member-ad-option {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left;
    background: none; border: none; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text);
}
.member-ad-option:hover { background: var(--surface-hover); }
.member-ad-option strong { font-size: 13px; }
.member-ad-option span { font-size: 11.5px; color: var(--text-muted); }
.member-ad-chip { font-size: 10px; padding: 1px 6px; vertical-align: middle; }

/* ============================================================
   Налаштування (account_settings.php) -- той самий компонент, що й
   test.vault -> Налаштування: домашня сітка плиток-розділів зі статистикою,
   а обраний розділ (?tab=X) виїжджає праворуч у "шторці" поверх
   притлумленої сітки. Не SPA -- звичайні посилання, анімація суто CSS.
   Стилі перенесено з test-vault/public/assets/css/app.css без змін.
   ============================================================ */
.settings-home-dimmed { opacity: .5; filter: saturate(.6); pointer-events: none; transition: opacity .2s ease, filter .2s ease; }

.settings-scrim {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
    z-index: 40; display: block; animation: settingsScrimIn .22s ease both;
}
@keyframes settingsScrimIn { from { opacity: 0; } to { opacity: 1; } }
.settings-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 94vw);
    background: var(--bg); box-shadow: -20px 0 60px rgba(15, 23, 42, .18); z-index: 41;
    display: flex; flex-direction: column; animation: settingsDrawerIn .3s var(--ease-out) both;
    transition: width .25s var(--ease-out);
}
/* Анімація виїзду через right (не transform!) -- transform створив би новий
   containing block для position:fixed нащадків (.modal-overlay всередині
   шторки), і модалки центрувались би відносно 720px-колонки, а не екрана. */
@keyframes settingsDrawerIn { from { right: -100%; } to { right: 0; } }
@media (prefers-reduced-motion: reduce) {
    .settings-scrim, .settings-drawer { animation: none; transition: none; }
}
.settings-drawer.settings-drawer-expanded { width: 100vw; }
.settings-drawer-head {
    display: flex; align-items: flex-start; gap: 16px; padding: 24px 28px 18px;
    background: var(--card-bg); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.settings-drawer-head h1 { margin: 0 0 3px; font-size: 20px; }
.settings-drawer-head .field-hint { margin: 0 0 -10px; text-align: left; }
.settings-drawer-expand, .settings-drawer-close {
    width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--card-bg);
    display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0;
    cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.settings-drawer-expand { margin-left: auto; }
.settings-drawer-expand svg, .settings-drawer-close svg { width: 14px; height: 14px; }
.settings-drawer-expand:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.settings-drawer-close { background: #fef2f2; color: #dc2626; border-color: #fecaca; text-decoration: none; }
.settings-drawer-close:hover { background: #fee2e2; border-color: #fca5a5; }
.settings-drawer-expand .icon-maximize, .settings-drawer-expand .icon-minimize { display: flex; }
.settings-drawer-expand .icon-minimize { display: none; }
.settings-drawer-expand.is-expanded .icon-maximize { display: none; }
.settings-drawer-expand.is-expanded .icon-minimize { display: flex; }
.settings-drawer-body { flex: 1; overflow-y: auto; padding: 22px 28px 60px; }
@media (max-width: 640px) {
    .settings-drawer { width: 100vw; }
}

/* Плитки огляду -- повна версія (стрілка на hover, іконка з hue-rotate
   прив'язана до акценту теми, багаторядкові статистики), не спрощена. */
.settings-overview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) {
    .settings-overview-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
.settings-overview-tile {
    display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: inherit;
    padding: 22px; position: relative; border: 1px solid rgba(15, 23, 42, .06); border-radius: 20px;
    background: var(--card-bg); box-shadow: var(--shadow-sm);
    transition: transform .22s var(--ease-out), box-shadow .22s ease, opacity .18s ease, filter .18s ease;
}
.settings-overview-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.settings-overview-tile:active { transform: translateY(-1px); }
.settings-overview-tile-arrow {
    position: absolute; top: 20px; right: 20px; width: 30px; height: 30px; border-radius: 50%;
    background: var(--surface-sunken); color: var(--text-muted); display: flex; align-items: center;
    justify-content: center; transition: background .2s ease, color .2s ease, transform .2s ease;
}
.settings-overview-tile-arrow svg { width: 15px; height: 15px; }
.settings-overview-tile:hover .settings-overview-tile-arrow { background: var(--gradient-primary); color: #fff; transform: translate(2px, -2px); }
.settings-overview-tile-head { display: flex; align-items: center; gap: 14px; padding-right: 30px; }
.settings-overview-icon {
    flex-shrink: 0; width: 46px; height: 46px; border-radius: var(--radius-md); display: flex;
    align-items: center; justify-content: center; color: #fff; box-shadow: var(--shadow-sm);
    transition: transform .22s var(--ease-out); background: var(--gradient-primary);
}
.settings-overview-icon svg { width: 22px; height: 22px; }
.settings-overview-tile:hover .settings-overview-icon { transform: rotate(-6deg) scale(1.06); }
/* Кожна іконка -- той самий градієнт активної теми, лише повернутий по колу
   кольору (hue-rotate) -- завжди узгоджений з обраним акцентом (Дизайн ->
   Тема), але 5 плиток лишаються візуально різними одна від одної. */
.settings-overview-icon-blue { filter: hue-rotate(0deg); }
.settings-overview-icon-green { filter: hue-rotate(60deg); }
.settings-overview-icon-indigo { filter: hue-rotate(120deg); }
.settings-overview-icon-amber { filter: hue-rotate(300deg); }
.settings-overview-icon-slate { filter: grayscale(.6); }
.settings-overview-tile-title { font-size: 17px; font-weight: 700; color: var(--text); }
.settings-overview-tile-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.settings-overview-stats { display: flex; flex-direction: column; gap: 7px; }
.settings-overview-stat-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px;
    padding-top: 7px; border-top: 1px dashed var(--border);
}
.settings-overview-stat-row:first-child { border-top: none; padding-top: 0; }
.settings-overview-stat-label { color: var(--text-muted); }
.settings-overview-stat-value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings-overview-stat-value.ok { color: #15803d; }
.settings-overview-stat-value.off { color: var(--text-muted); font-weight: 600; }
.settings-drawer-head .field-hint { font-size: 13px; color: var(--text-muted); }
/* Лише картки розділу (прямі нащадки), не картки модальних вікон усередині
   шторки -- інакше вікна "Створити користувача" й "Налаштування LDAP"
   розтягувались на всю ширину екрана. */
.settings-drawer-body > .card { max-width: none !important; }
.settings-drawer-body > .card + .card { margin-top: 0; }

/* Групи доступу AD (LDAP / AD -> Хто може входити). */
.ldap-group-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; }
.ldap-group-row form { margin: 0 0 0 auto; }
.ldap-group-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-sunken); color: var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ldap-group-icon svg { width: 14px; height: 14px; }
.ldap-group-dn { font-size: 12px; word-break: break-all; }

/* ---- Налаштування -> Користувачі: вкладки Локальні / AD / Кошик, таблиця
   по 15 на сторінку, нумерація сторінок, кнопки дій. ---- */
.users-tab-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--surface-sunken); color: var(--text-muted); font-size: 11px; line-height: 18px; text-align: center; }
.issue-tab.active .users-tab-count { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.users-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.users-toolbar-hint { margin: 0; color: var(--text-muted); font-size: 13px; }
.users-toolbar .btn { flex-shrink: 0; }
.users-table td { vertical-align: middle; }
.users-row-blocked td { background: color-mix(in srgb, #ef4444 4%, transparent); }
.users-row-blocked .member-row-name { color: var(--text-muted); }
.users-actions { text-align: right; white-space: nowrap; }
.users-actions form { display: inline-block; margin: 0 0 0 4px; }
.users-icon-btn { width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.users-icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.users-icon-btn svg { width: 15px; height: 15px; }
.users-danger, .users-danger:hover { color: #b91c1c; }
.btn.users-danger { background: none; border: none; }
.users-status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.users-status-active { background: #f0fdf4; color: #15803d; }
.users-status-blocked { background: #fef2f2; color: #b91c1c; }
.users-status-invited { background: var(--surface-sunken); color: var(--text-muted); }
.users-pages { display: flex; align-items: center; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.users-page { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text); text-decoration: none; background: var(--card-bg); }
.users-page:hover { background: var(--surface-hover); text-decoration: none; }
.users-page.active { background: var(--gradient-primary); color: #fff; border-color: transparent; font-weight: 600; }
.users-pages-info { margin-left: 10px; color: var(--text-muted); font-size: 12.5px; }
/* Вікно налаштувань LDAP: вкладені картки -- без анімації/обмежень .modal-overlay .card. */
.ldap-settings-modal { max-width: 760px; }
.ldap-settings-modal .card { transform: none; opacity: 1; max-height: none; overflow: visible; box-shadow: none; border: 1px solid var(--border); margin-bottom: 14px; }
@media (max-width: 640px) { .users-toolbar { flex-direction: column; align-items: stretch; } }

/* ============================================================
   Налаштування в стилі test.vault: розкривні списки (.accordion-item),
   іконки-чіпи, перемикачі (.switch), картки тем (.theme-card), приховане
   поле файлу. Перенесено з test-vault/public/assets/css/app.css.
   ============================================================ */
.form-row.cols-2 > * { flex: 1 1 0; min-width: 0; }
.form-row.cols-3 > * { flex: 1 1 0; min-width: 0; }
.field-hint { font-size: 12.5px; color: var(--text-muted); margin-top: -10px; margin-bottom: 16px; }

input[type=checkbox] { width: auto; display: inline-block; margin: 0 6px 0 0; accent-color: var(--primary); }
.check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 500; }
.check-row label { margin: 0; font-weight: 500; }
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.file-input-hidden:focus-visible + label {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
    width: 40px; height: 22px; border-radius: 999px; background: var(--surface-sunken); border: 1px solid var(--border);
    position: relative; flex-shrink: 0; transition: background-color .15s ease, border-color .15s ease;
}
.switch-thumb {
    position: absolute; top: 1px; left: 1px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease-out);
}
.switch input:checked + .switch-track { background: var(--gradient-primary); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch-label { font-size: 13.5px; color: var(--text); }
.icon-chip { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-sm); flex-shrink: 0; }
.icon-chip svg { width: 20px; height: 20px; }
.icon-chip-sm { width: 32px; height: 32px; }
.icon-chip-sm svg { width: 16px; height: 16px; }
.icon-chip-blue { background: color-mix(in srgb, #2563eb 13%, transparent); color: #1d4ed8; }
.icon-chip-primary { background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary-dark); }
.icon-chip-amber { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #92400e; }
.icon-chip-green { background: color-mix(in srgb, #22c55e 15%, transparent); color: #15803d; }
.icon-chip-indigo { background: color-mix(in srgb, #6366f1 15%, transparent); color: #4338ca; }
.icon-chip-slate { background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border); }
/* ---- Settings page (admin) -- accordion + sub-tabs, same pattern as
   test-cmdb's admin_settings.php (mode-bar/mode-tab from cmdb.css,
   accordion-item from style.css), ported for the "Налаштування" section. ---- */
.mode-bar { border-bottom: 1px solid var(--border); }
.mode-bar-inner { display: flex; gap: 4px; overflow-x: auto; }
.mode-tab {
    display: inline-block; padding: 10px 16px; font-size: 13.5px; font-weight: 600;
    color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent;
    white-space: nowrap; transition: color .15s ease, border-color .15s ease;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: none; }
.accordion-item summary {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer;
    list-style: none; font-weight: 600; font-size: 14px; color: var(--text);
    transition: background-color .15s ease;
}
.accordion-item summary::-webkit-details-marker { display: none; }
.accordion-item summary::marker { content: ""; }
.accordion-item summary:hover { background: var(--surface-hover); }
.accordion-summary-text { flex: 1; min-width: 0; }
.accordion-summary-desc { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); margin-top: 1px; }
.accordion-chevron { color: var(--text-muted); width: 16px; height: 16px; flex-shrink: 0; transition: transform .2s var(--ease-out); }
.accordion-item[open] summary .accordion-chevron { transform: rotate(90deg); }
.accordion-item[open] summary { background: var(--surface-hover); }
.accordion-body { padding: 4px 16px 20px; animation: fadeIn .2s ease; }
.accordion-body .form-grid { grid-template-columns: 1fr; }


/* ---- Theme preset gallery (Settings -> Design), simplified version of
   test-cmdb's theme-grid-v2/theme-card. ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.theme-card {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 12px 8px; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.theme-card:hover { border-color: var(--border-strong); }
.theme-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.theme-card-active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.theme-card-swatch {
    width: 100%; height: 44px; border-radius: 6px; border: 1px solid rgba(0,0,0,.06);
    display: flex; align-items: center; justify-content: center;
}
.theme-card-swatch-dot { width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.theme-card-label { font-size: 12px; font-weight: 600; color: var(--text); }
.theme-card-check { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff; display: none; align-items: center; justify-content: center; }
.theme-card-check svg { width: 11px; height: 11px; }
.theme-card-active .theme-card-check { display: flex; }
.accordion-card { padding: 0 !important; overflow: hidden; }
.accordion-item summary { gap: 12px; }
.accordion-summary-text { font-weight: 600; font-size: 14px; }
.accordion-chevron svg { width: 16px; height: 16px; }
.field-hint { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 12px; }
.settings-sep { margin: 18px 0; border: none; border-top: 1px solid var(--border); }
.brand-logo-preview { padding: 10px 16px; background: var(--surface-sunken); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.brand-logo-preview img { height: 32px; max-width: 180px; object-fit: contain; display: block; }
.app-sidebar-brand-logo { height: 26px; max-width: 150px; object-fit: contain; flex-shrink: 0; }
.auth-logo { display: block; height: 40px; max-width: 200px; object-fit: contain; margin: 0 auto 10px; }
.settings-empty { text-align: center; padding: 48px 24px !important; }
.settings-empty .icon-chip { margin: 0 auto 12px; }
.settings-empty h2 { margin: 0 0 6px; font-size: 17px; }
.settings-empty p { margin: 0; color: var(--text-muted); font-size: 13.5px; }

/* ---- Мій профіль -- ті самі структура й класи, що й test.vault -> Мій
   профіль (profile-hero, profile-layout, profile-meta-*, section-head,
   покроковий майстер 2FA з 6 клітинками коду). Перенесено з
   test-vault/public/assets/css/app.css. ---- */
.profile-hero { padding: 0; overflow: hidden; }
.profile-hero-cover { height: 96px; background: var(--gradient-primary); }
.profile-hero-body { display: flex; align-items: flex-end; gap: 20px; padding: 0 28px 24px; margin-top: -48px; flex-wrap: wrap; }
.profile-hero-avatar-wrap { flex-shrink: 0; }
.profile-hero-avatar-wrap .avatar-fallback-xl { margin: 0; border: 4px solid var(--card-bg); box-shadow: var(--shadow-md); }
.avatar-fallback-xl { width: 96px; height: 96px; border-radius: 50%; background: var(--gradient-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; flex-shrink: 0; }
.profile-hero-info { min-width: 0; padding-bottom: 6px; }
.profile-hero-info h1 { margin: 0 0 8px; font-size: 21px; }
.profile-hero-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-muted); font-size: 13.5px; }
.profile-hero-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.profile-hero-meta-item svg { width: 14px; height: 14px; }

.profile-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: stretch; }
@media (max-width: 900px) { .profile-layout { grid-template-columns: 1fr; } }
.profile-layout > * { min-width: 0; }

.profile-meta-list { display: flex; flex-direction: column; }
.profile-meta-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.profile-meta-row:last-child { border-bottom: none; }
.profile-meta-row-text { min-width: 0; flex: 1; }
.profile-meta-row-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.profile-meta-row-value { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.profile-side-cards-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.profile-side-cards-row > .card { flex: 1 1 0; min-width: 320px; display: flex; flex-direction: column; }
.profile-side-cards-row > .card > *:last-child { margin-top: auto; }
.section-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.section-head-text { min-width: 0; }
.section-head-text h2 { margin: 2px 0 3px; }
.section-head-text p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.mfa-setup-step { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.mfa-setup-step:last-of-type { margin-bottom: 0; }
.mfa-setup-step-num { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.mfa-setup-step-body { flex: 1; min-width: 0; }
.mfa-setup-step-title { font-weight: 600; color: var(--text); font-size: 14.5px; margin: 0 0 3px; }
.mfa-setup-step-text { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: 0; }
.mfa-qr-box { display: flex; justify-content: center; padding: 16px; margin-top: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); }
.mfa-qr-box img { display: block; }
.mfa-key-hint { font-size: 12.5px; color: var(--text-muted); margin: 16px 0 8px; }
.mfa-key-row { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.mfa-key-box { display: block; width: 100%; box-sizing: border-box; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 13.5px; letter-spacing: .5px; color: var(--text); word-break: break-all; }
.mfa-code-inputs { display: flex; gap: 8px; margin: 10px 0 16px; }
.mfa-code-digit { width: 44px; height: 52px; text-align: center; font-size: 20px; font-weight: 600; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--text); transition: border-color .15s ease, box-shadow .15s ease; }
.mfa-code-digit:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: var(--focus-ring); }
.profile-role-badge { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.profile-hero-meta .chip { margin: 0; }
.profile-mfa-on { display: flex; align-items: center; gap: 6px; color: #15803d; font-weight: 600; margin: 0 0 12px; }
.profile-mfa-on svg { width: 16px; height: 16px; }
.profile-hero, .profile-layout, .profile-side-cards-row { margin-bottom: 20px; }
.profile-layout > * > .card, .profile-layout > .card { margin-bottom: 0; }
.profile-side-cards-row > .card { margin-bottom: 0; }
.mfa-backup-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; margin-top: 10px; }
.mfa-backup-codes code { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; text-align: center; font-size: 13px; color: var(--text); }
.mfa-code-input { font-size: 20px; letter-spacing: .3em; text-align: center; }

/* ---- Налаштування -> Сповіщення: матриця "подія -> групи", групи
   одержувачів чекбоксами, статистика черги листів. ---- */
.notify-matrix th:not(:first-child), .notify-matrix td:not(:first-child) { text-align: center; width: 1%; white-space: nowrap; }
.notify-matrix input[type=checkbox] { width: 16px; height: 16px; margin: 0; }
.notify-checks-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; margin: 6px 0 6px; }
.notify-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.notify-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--text); margin: 0; }
.notify-check input { width: auto; margin: 0; }
.notify-rule-off td { opacity: .55; }
.notify-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.notify-stats > div { background: var(--surface-sunken); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12px; color: var(--text-muted); }
.notify-stats span { display: block; font-size: 20px; font-weight: 700; color: var(--text); }
.notify-stat-bad span { color: #b91c1c; }

/* ---- Мій профіль -> Сповіщення; @згадки в коментарях. ---- */
.profile-notify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 14px; }
@media (max-width: 900px) { .profile-notify-grid { grid-template-columns: 1fr; } }
.profile-notify-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.profile-tg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 4px 54px; }
.mention { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention-suggest { display: none; position: absolute; z-index: 200; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 4px; max-width: 320px; }
.mention-suggest-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: none; border: none; padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.mention-suggest-item span { font-size: 11.5px; color: var(--text-muted); }
.mention-suggest-item strong { font-size: 13px; }
.mention-suggest-item.active, .mention-suggest-item:hover { background: var(--surface-hover); }

/* ---- Про систему (about.php) -- як у test.vault. ---- */
.about-mark { color: var(--primary); display: inline-flex; }
.about-link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.about-link-btn:hover { text-decoration: underline; }

/* ============================================================
   Темна тема (Мій профіль -> Зовнішній вигляд): data-theme="dark" на <html>,
   або "system" + темна тема в ОС. Перевизначаються токени; специфічність
   :root[data-theme] вища за :root, тож колір фону з Налаштувань -> Дизайн
   діє лише у світлій темі, а основний колір -- в обох.
   ============================================================ */
:root[data-theme="dark"] {
    --bg: #0b1120;
    --card-bg: #131c2e;
    --border: #243049;
    --border-strong: #33415c;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --surface-sunken: #0f172a;
    --surface-hover: #1b2740;
    --sidebar-bg: #0f1729;
    --sidebar-border: #1c2840;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, .45), 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] {
        --bg: #0b1120;
        --card-bg: #131c2e;
        --border: #243049;
        --border-strong: #33415c;
        --text: #e2e8f0;
        --text-muted: #94a3b8;
        --surface-sunken: #0f172a;
        --surface-hover: #1b2740;
        --sidebar-bg: #0f1729;
        --sidebar-border: #1c2840;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-md: 0 1px 3px rgba(0, 0, 0, .45), 0 4px 12px rgba(0, 0, 0, .35);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
        color-scheme: dark;
    }
}
/* Компоненти з власними світлими кольорами. Однаковий набір правил для
   dark і system-у-темній-ОС (клас .is-dark ставить скрипт у header.php). */
html.is-dark .btn-danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
html.is-dark .btn-danger:hover { background: rgba(127, 29, 29, .3); }
html.is-dark .alert-error, html.is-dark .users-status-blocked, html.is-dark .settings-drawer-close { background: rgba(127, 29, 29, .35); color: #fca5a5; border-color: #7f1d1d; }
html.is-dark .alert-success, html.is-dark .users-status-active { background: rgba(20, 83, 45, .4); color: #86efac; border-color: #166534; }
html.is-dark .alert-info { background: rgba(30, 58, 138, .35); color: #93c5fd; border-color: #1e3a8a; }
html.is-dark .mfa-code-digit:focus, html.is-dark .mfa-backup-codes code { background: var(--surface-sunken); color: var(--text); }
html.is-dark .settings-scrim, html.is-dark .modal-overlay { background: rgba(2, 6, 23, .7); }
html.is-dark .switch-thumb { background: #e2e8f0; }
html.is-dark img { color-scheme: light; }
html.is-dark .ql-toolbar, html.is-dark .ql-container { border-color: var(--border) !important; }
html.is-dark .ql-toolbar .ql-stroke { stroke: var(--text-muted); }
html.is-dark .ql-toolbar .ql-fill { fill: var(--text-muted); }
html.is-dark .ql-toolbar .ql-picker { color: var(--text-muted); }
html.is-dark .ql-editor.ql-blank::before { color: var(--text-muted); }

/* ---- Перемикач теми в профілі ---- */
.theme-mode-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-mode-option { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 10px; border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--card-bg); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; }
.theme-mode-option:hover { border-color: var(--border-strong); }
.theme-mode-option.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.theme-mode-preview { width: 100%; height: 54px; border-radius: 8px; border: 1px solid var(--border); position: relative; overflow: hidden; }
.theme-mode-preview span { position: absolute; left: 8px; top: 8px; right: 30%; height: 10px; border-radius: 4px; background: var(--primary); }
.theme-mode-preview-light { background: #f4f6f9; }
.theme-mode-preview-dark { background: #0b1120; }
.theme-mode-preview-system { background: linear-gradient(135deg, #f4f6f9 50%, #0b1120 50%); }

/* ---- Аватари-фото ---- */
.avatar-photo { overflow: hidden; padding: 0 !important; background: var(--surface-sunken) !important; }
.avatar-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.member-row-with-avatar { display: flex; align-items: center; gap: 8px; }
.member-row-with-avatar .avatar-sm { flex-shrink: 0; }
.profile-avatar-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.profile-avatar-actions form { margin: 0; }

/* ---- Активні сесії ---- */
.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.session-row form { margin: 0 0 0 auto; }
.session-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-sunken); color: var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.session-icon svg { width: 15px; height: 15px; }
.session-text { min-width: 0; font-size: 13.5px; }
.session-meta { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- Знайомство з системою: картка "Перші кроки" й тур ---- */
.onboarding-card { margin-bottom: 20px; }
.onboarding-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.onboarding-head-actions { display: flex; gap: 6px; }
.onboarding-hide { background: none; border: none; color: var(--text-muted); }
.onboarding-bar { height: 6px; border-radius: 999px; background: var(--surface-sunken); margin: 12px 0 14px; overflow: hidden; }
.onboarding-bar span { display: block; height: 100%; background: var(--gradient-primary); border-radius: inherit; transition: width .4s var(--ease-out); }
.onboarding-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.onboarding-step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.onboarding-step:hover { border-color: var(--primary); transform: translateY(-1px); text-decoration: none; }
.onboarding-step strong { display: block; font-size: 13.5px; }
.onboarding-step-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.onboarding-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.onboarding-check svg { width: 13px; height: 13px; }
.onboarding-step.is-done { opacity: .65; }
.onboarding-step.is-done strong { text-decoration: line-through; }
.onboarding-step.is-done .onboarding-check { background: #16a34a; border-color: #16a34a; color: #fff; }
.tour-overlay { position: fixed; inset: 0; z-index: 200; }
.tour-spotlight { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(2, 6, 23, .55); transition: all .25s var(--ease-out); pointer-events: none; outline: 2px solid var(--primary); }
.tour-pop { position: fixed; width: 320px; background: var(--card-bg); color: var(--text); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 16px 18px; transition: left .25s var(--ease-out), top .25s var(--ease-out); }
.tour-pop.is-center { left: 50% !important; top: 30% !important; transform: translateX(-50%); width: 380px; box-shadow: 0 0 0 9999px rgba(2, 6, 23, .55), var(--shadow-lg); }
.tour-pop h3 { margin: 4px 0 6px; font-size: 16px; }
.tour-pop p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.tour-step-count { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); }
.tour-actions { display: flex; gap: 6px; align-items: center; }
.tour-skip { background: none; border: none; color: var(--text-muted); }

/* ---- Портфоліо (portfolio.php) -- дашборд керівника ---- */
.pf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.pf-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pf-kpi { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; display: flex; flex-direction: column; gap: 2px; transition: transform .15s, border-color .15s; }
a.pf-kpi:hover { transform: translateY(-2px); text-decoration: none; }
.pf-kpi.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.pf-kpi-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-kpi-label { font-size: 12px; color: var(--text-muted); }
.pf-kpi-green { border-left: 4px solid #16a34a; }
.pf-kpi-yellow { border-left: 4px solid #f59e0b; }
.pf-kpi-red { border-left: 4px solid #dc2626; }
.pf-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.pf-card { margin: 0; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--border); }
.pf-card-green { border-top-color: #16a34a; }
.pf-card-yellow { border-top-color: #f59e0b; }
.pf-card-red { border-top-color: #dc2626; }
.pf-card-head { display: flex; align-items: center; gap: 10px; }
.pf-card-name { font-weight: 700; font-size: 15px; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-card-key { font-size: 12px; color: var(--text-muted); }
.pf-health { padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; cursor: help; }
.pf-health-green { background: color-mix(in srgb, #16a34a 15%, transparent); color: #16a34a; }
.pf-health-yellow { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.pf-health-red { background: color-mix(in srgb, #dc2626 15%, transparent); color: #dc2626; }
.pf-progress-row { display: flex; align-items: center; gap: 10px; }
.pf-progress { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.pf-progress span { display: block; height: 100%; background: var(--gradient-primary); border-radius: inherit; }
.pf-sub { font-size: 12px; color: var(--text-muted); margin-top: -6px; }
.pf-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; font-size: 11.5px; color: var(--text-muted); }
.pf-metrics > div { background: var(--surface-sunken); border-radius: var(--radius-sm); padding: 6px 4px; }
.pf-metrics span { display: block; font-size: 17px; font-weight: 700; color: var(--text); }
.pf-bad, .pf-bad span { color: #dc2626 !important; }
.pf-trend-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.pf-spark { width: 100%; height: 34px; display: block; }
.pf-spark-line { fill: none; stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.pf-spark-area { fill: color-mix(in srgb, var(--primary) 12%, transparent); stroke: none; }
.pf-reasons { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-muted); }
.pf-foot { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; border-top: 1px dashed var(--border); padding-top: 8px; }
.pf-foot-label { display: inline-block; min-width: 120px; color: var(--text-muted); }
.pf-links { font-size: 12.5px; }

/* ---- Журнал аудиту й Стан системи ---- */
.audit-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.audit-filters select, .audit-filters input { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }
.audit-table td { vertical-align: top; }
.audit-action { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-sunken); font-size: 12px; font-weight: 600; white-space: nowrap; }
.audit-warn .audit-action { background: color-mix(in srgb, #dc2626 14%, transparent); color: #dc2626; }
.audit-details { font-size: 12.5px; color: var(--text-muted); word-break: break-word; }
.health-summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.health-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.health-pill svg { width: 14px; height: 14px; }
.health-ok { background: color-mix(in srgb, #16a34a 14%, transparent); color: #16a34a; }
.health-warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.health-error { background: color-mix(in srgb, #dc2626 14%, transparent); color: #dc2626; }
.health-card { margin-bottom: 14px; }
.health-card h3 { margin: 0 0 8px; font-size: 14px; }
.health-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--border); font-size: 13px; }
.health-row:first-of-type { border-top: none; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: #16a34a; }
.health-row-warn .health-dot { background: #f59e0b; }
.health-row-error .health-dot { background: #dc2626; }
.health-label { flex: 1; min-width: 0; }
.health-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.health-value { color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; max-width: 50%; word-break: break-word; }
.health-row-error .health-value { color: #dc2626; font-weight: 600; }

/* Темна тема: насиченіші відтінки статусів, щоб текст читався на темному тлі */
html.is-dark .settings-drawer-close:hover { background: rgba(127, 29, 29, .5); border-color: #991b1b; }
html.is-dark .icon-chip-amber, html.is-dark .pf-health-yellow, html.is-dark .health-warn { color: #fbbf24; }
html.is-dark .icon-chip-blue { color: #93c5fd; }
html.is-dark .icon-chip-green, html.is-dark .pf-health-green, html.is-dark .health-ok { color: #4ade80; }
html.is-dark .pf-health-red, html.is-dark .health-error { color: #f87171; }
html.is-dark [style*="color:#b91c1c"] { color: #f87171 !important; }

/* Адміністратор системи й посилання-запрошення (2.22.0) */
.users-admin-chip { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-size: 11px; font-weight: 600; }
.users-icon-btn.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.invite-link-notice { display: flex; flex-direction: column; gap: 8px; }
.invite-link-row { display: flex; gap: 8px; align-items: center; }
.invite-link-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* Мій профіль: «Редагувати профіль» і «Інформація про обліковий запис» -- однакової висоти */
.profile-layout > aside { display: flex; flex-direction: column; }
.profile-layout > aside > .card { flex: 1; }
