/*
 * Same design system as CMDB (test-cmdb/assets/css/style.css): same
 * color tokens, Inter typeface, card/button/table/alert/modal
 * components, and app-shell (white sidebar + topbar) layout, so the
 * two products read as one family. No Bootstrap here -- plain hand-
 * written CSS, same as CMDB.
 */

: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: 248px;
    --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;
}
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 700; margin-top: 0; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
a { color: var(--primary); }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes driftA { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(20px, -16px); } }
@keyframes driftB { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-18px, 14px); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- form basics ---- */
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=range], input[type=date], 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; }
input[readonly] { background: var(--surface-sunken); color: var(--text-muted); }
.form-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.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; }

/* ---- buttons ---- */
.btn {
    display: inline-flex;
    align-items: 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:active { transform: translateY(1px) scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-primary { background: var(--gradient-primary); color: #fff; box-shadow: var(--shadow-sm); border: 1px solid transparent; }
.btn-primary:hover:not([disabled]) { 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:not([disabled]) { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover:not([disabled]) { background: #fee2e2; }
.btn-ghost { display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text-muted); border: none; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-ghost svg { width: 16px; height: 16px; }
.btn-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---- card / alert / table ---- */
.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 .4s var(--ease-out) both;
}
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; font-weight: 700; }

.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; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.license-banner { display: flex; align-items: flex-start; gap: 10px; }
.license-banner-icon { flex-shrink: 0; display: inline-flex; margin-top: 1px; }
.license-banner-icon svg { width: 18px; height: 18px; }

.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }
.table-responsive .table { box-shadow: none; }
.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 th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.table th { background: var(--surface-sunken); font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color .12s ease; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.badge-primary { background: #eff6ff; color: #1d4ed8; }
.badge-success { background: #f0fdf4; color: #15803d; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-secondary { background: var(--surface-sunken); color: var(--text-muted); }

code { background: var(--surface-sunken); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ---- tabs ---- */
.tab-row { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-link { padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- app shell (sidebar + topbar), same structure as CMDB ---- */
.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;
    transition: width .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.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); position: relative;
}
.app-sidebar-brand .brand-mark { color: var(--primary); display: inline-flex; }
.app-sidebar-brand-text { white-space: nowrap; overflow: hidden; }

/* Згортання бокового меню (порт із test-helpdesk/test-cmdb, за проханням
   користувача) -- кружечок на межі сайдбару, стрілка розвертається залежно
   від стану. Стан (клас .collapsed на #appSidebar) зберігається в
   localStorage і застосовується синхронним інлайн-скриптом одразу після
   розмітки сайдбару (layout_app.php), до першого малювання сторінки. */
.app-sidebar-collapse-btn {
    position: absolute; top: 22px; right: -12px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 41;
    box-shadow: var(--shadow-sm);
    transition: transform .18s var(--ease-out), color .12s ease, background-color .12s ease;
}
.app-sidebar-collapse-btn:hover { color: var(--primary); background: var(--surface-hover); }
.app-sidebar-collapse-btn svg { width: 14px; height: 14px; transform: rotate(180deg); }
.app-sidebar.collapsed .app-sidebar-collapse-btn svg { transform: rotate(0deg); }

/* Згорнутий стан: вузька смужка з іконками. Наведення миші тимчасово
   розгортає на повну ширину (peek), не змінюючи збережений стан; повторний
   клік на кнопку знімає .collapsed і "фіксує" сайдбар розгорнутим. */
.app-sidebar.collapsed { width: var(--sidebar-collapsed-width, 64px); }
.app-sidebar.collapsed .app-sidebar-brand { justify-content: center; padding: 18px 8px; }
.app-sidebar.collapsed .app-sidebar-brand-text,
.app-sidebar.collapsed .app-nav-label,
.app-sidebar.collapsed .app-nav-badge,
.app-sidebar.collapsed .app-user-info,
.app-sidebar.collapsed .app-user-trigger-chevron { display: none; }
.app-sidebar.collapsed .app-nav-item,
.app-sidebar.collapsed .app-user-trigger { justify-content: center; }

.app-sidebar.collapsed:hover { width: var(--sidebar-width); box-shadow: var(--shadow-lg); }
.app-sidebar.collapsed:hover .app-sidebar-brand { justify-content: flex-start; padding: 18px 20px; }
.app-sidebar.collapsed:hover .app-sidebar-brand-text,
.app-sidebar.collapsed:hover .app-nav-label,
.app-sidebar.collapsed:hover .app-nav-badge,
.app-sidebar.collapsed:hover .app-user-trigger-chevron { display: inline; }
.app-sidebar.collapsed:hover .app-user-info { display: block; }
.app-sidebar.collapsed:hover .app-nav-item,
.app-sidebar.collapsed:hover .app-user-trigger { justify-content: flex-start; }
.app-sidebar.collapsed:hover .app-sidebar-collapse-btn svg { transform: rotate(180deg); }

@media (max-width: 880px) {
    .app-sidebar-collapse-btn { display: none; }
    .app-sidebar.collapsed { width: var(--sidebar-width); }
    .app-sidebar.collapsed .app-sidebar-brand-text,
    .app-sidebar.collapsed .app-nav-label,
    .app-sidebar.collapsed .app-nav-badge,
    .app-sidebar.collapsed .app-user-trigger-chevron { display: inline; }
    .app-sidebar.collapsed .app-user-info { display: block; }
    .app-sidebar.collapsed .app-nav-item,
    .app-sidebar.collapsed .app-user-trigger { justify-content: flex-start; }
    .app-sidebar.collapsed .app-sidebar-brand { justify-content: flex-start; padding: 18px 20px; }
}
.app-sidebar-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.app-nav-item {
    display: flex; align-items: center; justify-content: flex-start; width: 100%; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none;
    text-align: left; font-size: 13.5px; font-weight: 500; position: relative;
    transition: background-color .15s ease, color .15s ease, transform .15s var(--ease-out);
}
.app-nav-item:hover { background: var(--surface-hover); color: var(--text); transform: translateX(2px); }
.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); animation: fadeIn .2s ease both;
}
.app-nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; transition: transform .15s var(--ease-out); }
.app-nav-icon svg { width: 100%; height: 100%; }
.app-nav-item:hover .app-nav-icon { transform: scale(1.1); }
.app-nav-label { flex: 1 1 auto; min-width: 0; text-align: left; }

.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-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user-role { font-size: 11.5px; color: var(--text-muted); }
.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;
    opacity: 0; visibility: hidden; transform: translateY(6px) scale(.97); transform-origin: bottom; pointer-events: none;
    transition: opacity .15s var(--ease-out), transform .15s var(--ease-out), visibility 0s linear .15s;
}
.app-user-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; transition: opacity .15s var(--ease-out), transform .15s var(--ease-out), visibility 0s linear; }
.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; transition: background-color .12s ease, transform .12s ease; }
.app-user-dropdown a:hover { background: var(--surface-hover); transform: translateX(2px); }
.app-user-dropdown a.danger { color: #b91c1c; }
.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); }
.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,.4); z-index: 39; }
.app-sidebar-backdrop.open { display: block; }
.app-content { flex: 1; padding: 24px 28px 48px; }

.app-search { position: relative; flex: 1; max-width: 380px; }
.app-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-muted); }
.app-search input { padding-left: 34px; border-radius: 999px; background: var(--surface-sunken); margin-top: 0; }

.app-topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; position: relative; }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
    opacity: 0; visibility: hidden; transform: translateY(6px) scale(.97); transform-origin: top right; pointer-events: none;
    transition: opacity .15s var(--ease-out), transform .15s var(--ease-out), visibility 0s linear .15s;
}
.dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; transition: opacity .15s var(--ease-out), transform .15s var(--ease-out), visibility 0s linear; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; color: var(--text); text-decoration: none; background: none; border: none; text-align: left; cursor: pointer; font-family: inherit; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-hover); }

/* Vault item context menu (⋮) -- a single floating instance appended to
   <body> and positioned with JS (fixed coords from getBoundingClientRect),
   not nested inside .vault-list -- that container clips overflow for its
   rounded corners, which used to cut this menu off for most rows. */
.item-context-menu {
    position: fixed; min-width: 200px; background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; z-index: 90;
    opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.97);
    transition: opacity .12s var(--ease-out), transform .12s var(--ease-out), visibility 0s linear .12s;
}
.item-context-menu.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); transition: opacity .12s var(--ease-out), transform .12s var(--ease-out), visibility 0s linear; }
.item-context-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 6px;
    font-size: 13.5px; color: var(--text); background: none; border: none; text-align: left; cursor: pointer; font-family: inherit;
}
.item-context-menu button svg { flex-shrink: 0; color: var(--text-muted); }
.item-context-menu button:hover { background: var(--surface-hover); }
.item-context-menu button:hover svg { color: var(--text); }
.item-context-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.item-context-menu button.danger { color: #dc2626; }
.item-context-menu button.danger svg { color: #dc2626; }
.item-context-menu button.danger:hover { background: rgba(220, 38, 38, .08); }

.pm-toast-container { position: fixed; top: 18px; right: 18px; z-index: 500; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.pm-toast {
    pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; color: #fff; background: #16a34a;
    opacity: 0; transform: translateX(16px); transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
}
.pm-toast.show { opacity: 1; transform: translateX(0); }
.pm-toast-error { background: #dc2626; }
@media (prefers-reduced-motion: reduce) { .pm-toast { transition: opacity .01s linear; transform: none; } }

@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 { padding: 14px 16px; }
    .app-content { padding: 16px 16px 40px; }
}

/* ---- modal overlay, same pattern as CMDB (.actions-trigger[data-modal] opens, .modal-close-btn / backdrop closes) ---- */
.modal-overlay {
    display: flex; align-items: center; justify-content: center; position: fixed; inset: 0;
    background: rgba(15, 23, 42, .5); z-index: 60; 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 { transform: scale(.94) translateY(8px); opacity: 0; transition: transform .18s var(--ease-out), opacity .18s var(--ease-out); max-width: 560px; width: 92%; max-height: 86vh; overflow-y: auto; margin: 0; }
.modal-overlay.open .card { transform: scale(1) translateY(0); opacity: 1; }
.modal-overlay .card.modal-sm { max-width: 360px; }
.modal-overlay .card.modal-lg { max-width: 720px; }
.modal-close-btn { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--surface-sunken); 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-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.modal-footer .mr-auto { margin-right: auto; }

/* ---- toggle switch (replaces a plain checkbox where the on/off state
   itself is the primary thing being communicated, e.g. "Enable LDAP") ---- */
.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); }

/* ---- pagination (e.g. Settings -> Users) ---- */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 0; }
.pagination-link {
    display: inline-block; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--surface-sunken);
    border: 1px solid var(--border); color: var(--text-muted); text-decoration: none; font-size: 13.5px;
    transition: background-color .15s ease, color .15s ease, transform .15s var(--ease-out), box-shadow .15s ease;
}
.pagination-link:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--text); }
.pagination-link.active { background: var(--gradient-primary); color: #fff; border-color: transparent; }

/* ---- rendered README.md / user-guide prose (About -> Documentation / Guide) ---- */
.markdown-body h1 { font-size: 20px; margin: 0 0 16px; }
.markdown-body h2 { font-size: 17px; margin: 24px 0 8px; }
.markdown-body h3 { font-size: 14.5px; margin: 22px 0 6px; }
.markdown-body h4 { font-size: 13px; margin: 16px 0 4px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.markdown-body p { font-size: 13.5px; line-height: 1.6; margin: 0 0 10px; }
.markdown-body ul { margin: 0 0 12px; padding-left: 20px; }
.markdown-body li { font-size: 13.5px; line-height: 1.6; margin-bottom: 6px; }
.markdown-body code { font-size: 12px; background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px; }
.markdown-body pre { background: var(--surface-sunken); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 12px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.markdown-body a { color: var(--primary); }

/* ---- auth pages ---- */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
.container.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; overflow: hidden; isolation: isolate; }
.container.centered::before, .container.centered::after { content: ""; position: absolute; z-index: -1; width: 55vmax; height: 55vmax; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.container.centered::before { top: -18%; left: -12%; background: radial-gradient(circle, color-mix(in srgb, var(--primary) 10%, transparent), transparent 60%); animation: driftA 22s ease-in-out infinite; }
.container.centered::after { bottom: -20%; right: -14%; background: radial-gradient(circle, color-mix(in srgb, var(--primary) 8%, transparent), transparent 60%); animation: driftB 26s ease-in-out infinite; }
.auth-form { width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); padding: 32px 28px; animation: fadeInUp .45s var(--ease-out) both; }
.auth-form h1 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.auth-form .auth-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.auth-logo { display: block; text-align: center; margin-bottom: 6px; color: var(--primary); }
.auth-logo svg { width: 34px; height: 34px; }
.auth-logo img { height: 40px; max-width: 200px; object-fit: contain; }
.brand-logo { height: 22px; max-width: 140px; object-fit: contain; flex-shrink: 0; }
.auth-form .btn-primary { width: 100%; justify-content: center; }
.auth-form-footer { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--text-muted); }

/* ---- vault-specific ---- */
.vault-toolbar { background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filter-pill-row { display: flex; gap: 6px; }
.filter-pill { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.filter-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.vault-body { display: flex; align-items: flex-start; gap: 16px; margin: 16px 20px; }
.vault-body .vault-list { margin: 0; flex: 1; min-width: 0; }
@media (max-width: 900px) { .vault-body { flex-direction: column; } }
.vault-list { background: var(--card-bg); min-height: 55vh; border-radius: var(--radius-md); margin: 16px 20px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }

.vault-folder-tree { width: 260px; flex-shrink: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 10px; align-self: flex-start; max-height: 75vh; overflow-y: auto; }
@media (max-width: 900px) { .vault-folder-tree { width: 100%; max-height: none; } }
.folder-tree-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.folder-tree-root { display: flex; flex-direction: column; }
.folder-tree-node { display: flex; flex-direction: column; }
.folder-tree-row { display: flex; align-items: center; gap: 6px; padding: 6px 6px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; color: var(--text); }
.folder-tree-row:hover { background: var(--surface-hover); }
.folder-tree-row.active { background: var(--primary); color: #fff; }
.folder-tree-row.active .folder-tree-toggle, .folder-tree-row.active svg { color: inherit; }
.folder-tree-toggle { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: transform .15s ease; }
.folder-tree-toggle.expanded { transform: rotate(90deg); }
.folder-tree-toggle svg { width: 12px; height: 12px; }
.folder-tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tree-actions { display: none; align-items: center; gap: 0; flex-shrink: 0; }
.folder-tree-row:hover .folder-tree-actions { display: flex; }
.folder-tree-actions .btn-ghost { padding: 3px; color: inherit; }
.folder-tree-children { display: flex; flex-direction: column; margin-left: 20px; }
.folder-tree-children.collapsed { display: none; }
.folder-tree-row[draggable="true"] { cursor: grab; }
.folder-tree-row.folder-tree-row-dragover { background: color-mix(in srgb, var(--primary) 16%, transparent); outline: 1px dashed var(--primary); outline-offset: -1px; }
.vault-item { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background-color .12s ease; }
.vault-item:last-child { border-bottom: none; }
.vault-item:hover { background: var(--surface-hover); }
.vault-item-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface-sunken); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0; }
.vault-item-main { flex: 1; min-width: 0; }
.vault-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vault-item-shared { display: inline-flex; vertical-align: middle; color: var(--text-muted); margin-left: 4px; }
.vault-item-shared svg { width: 13px; height: 13px; }
.vault-item-sub { color: var(--text-muted); font-size: 12.5px; }
.vault-item-actions { display: flex; gap: 2px; }

.unlock-gate { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 70; }
.unlock-gate-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 32px; width: 320px; text-align: center; box-shadow: var(--shadow-lg); }
.unlock-gate-icon { color: var(--primary); margin-bottom: 8px; }

.backup-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: monospace; margin-top: 10px; }
.backup-codes code { background: var(--surface-sunken); padding: 6px 10px; border-radius: 6px; text-align: center; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; text-align: center; box-shadow: var(--shadow-sm); }
.stat-card .stat-num { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.progress-track { height: 6px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; border-radius: 999px; transition: width .2s ease; }

/* ---- Profile page, same structure/classes as CMDB's profile.php ---- */
.hint { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 12px; }

.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: start; }
@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; }

.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); }

.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; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid > label { min-width: 0; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- MFA (TOTP) setup wizard, same classes as CMDB's profile.php ---- */
.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); }

.d-none { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-3 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }

/* ---- 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; }


/* ---- Generator page (tools/generator.php) -- more presentable pass, per
   user request: bigger highlighted result, segmented tabs, tips sidebar. ---- */
.gen-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.gen-layout { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.gen-card { flex: 1 1 420px; min-width: 0; max-width: 520px; }
.gen-tabs { display: flex; gap: 6px; background: var(--surface-sunken); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 18px; }
.gen-tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 10px; border: none; background: transparent; border-radius: 7px;
    font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer;
    font-family: inherit; transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.gen-tab svg { width: 15px; height: 15px; }
.gen-tab:hover { color: var(--text); }
.gen-tab.active { background: var(--card-bg); color: var(--primary); box-shadow: var(--shadow-sm); }
.gen-result {
    display: flex; align-items: center; gap: 10px; background: var(--surface-sunken);
    border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 10px;
}
.gen-result-text {
    flex: 1; min-width: 0; font-family: "SFMono-Regular", Consolas, monospace; font-size: 19px;
    font-weight: 600; color: var(--text); word-break: break-all; user-select: all;
    border: none; background: transparent; padding: 0; margin: 0; width: auto;
}
.gen-result-text:focus { outline: none; box-shadow: none; }
.gen-result-actions { display: flex; gap: 4px; flex-shrink: 0; }
.gen-result-actions .btn-ghost { border: 1px solid var(--border); background: var(--card-bg); }
.gen-strength { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.gen-strength .progress-track { flex: 1; margin-bottom: 0; }
.gen-strength-label { font-size: 12px; font-weight: 700; white-space: nowrap; min-width: 68px; text-align: right; }
.gen-option-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.gen-option-row label { font-size: 13px; font-weight: 600; margin-bottom: 0; }
.gen-option-value { font-family: monospace; font-weight: 700; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); padding: 1px 9px; border-radius: 999px; font-size: 12.5px; }
.gen-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.gen-tips { flex: 0 1 260px; min-width: 220px; }
.gen-tips-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.gen-tips-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.gen-tips-list li svg { width: 15px; height: 15px; color: #16a34a; flex-shrink: 0; margin-top: 2px; }
@media (max-width: 760px) {
    .gen-card { max-width: none; }
}

/* ---- 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; }

/* ---- Settings drawer (порт із test-cmdb admin_settings.php: справжня
   "шторка" -- клік на плитку відкриває конкретний розділ праворуч поверх
   притлумленої домашньої сітки замість переходу на окрему сторінку-вкладку.
   Закриття -- звичайне посилання на /settings.php без параметрів: це НЕ
   SPA, кожне відкриття/закриття -- повне server-side перезавантаження з
   анімацією появи, яка й створює ефект шторки. За проханням користувача --
   попередня версія (лише горизонтальні pill-вкладки зверху) була візуально
   іншим компонентом, не тим, що в test-cmdb.) ---- */
.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; }

/* ---- Підпис у підвалі кабінету: версія (з CHANGELOG.md) + модалка історії
   версій -- той самий патерн, що й test-cmdb/test-helpdesk. ---- */
.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: inherit; font-size: 12.5px; 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; text-align: left; }
.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-head .badge { font-variant-numeric: tabular-nums; }
.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, .changelog-version p 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); }
