/* ---------------------------------------------------------------------------
   Справочник монтажника — стили
   --------------------------------------------------------------------------- */
:root {
    --bg:           #f7f8fb;
    --bg-elev:      #ffffff;
    --bg-sidebar:   #ffffff;
    --bg-hover:     #eef2f7;
    --bg-active:    #e2ecff;
    --text:         #0f172a;
    --text-muted:   #64748b;
    --text-soft:    #94a3b8;
    --border:       #e2e8f0;
    --border-strong:#cbd5e1;
    --primary:      #2563eb;
    --primary-hover:#1d4ed8;
    --primary-soft: #dbeafe;
    --danger:       #dc2626;
    --danger-hover: #b91c1c;
    --accent:       #0ea5e9;
    --code-bg:      #f1f5f9;
    --shadow-sm:    0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow:       0 4px 16px -4px rgba(15, 23, 42, 0.12);
    --shadow-lg:    0 20px 50px -10px rgba(15, 23, 42, 0.25);
    --radius:       10px;
    --radius-sm:    6px;
    --header-h:     56px;
    --sidebar-w:    320px;
}

[data-theme="dark"] {
    --bg:           #0b1220;
    --bg-elev:      #111a2e;
    --bg-sidebar:   #0f1729;
    --bg-hover:     #1a2542;
    --bg-active:    #1e3a8a;
    --text:         #e2e8f0;
    --text-muted:   #94a3b8;
    --text-soft:    #64748b;
    --border:       #1f2a44;
    --border-strong:#2d3a5f;
    --primary:      #3b82f6;
    --primary-hover:#60a5fa;
    --primary-soft: #1e3a8a;
    --danger:       #ef4444;
    --danger-hover: #dc2626;
    --code-bg:      #0a1020;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji",
                 sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, textarea, select { font: inherit; color: inherit; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Layout ---------------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
    min-height: 100dvh;
}

.app-header {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: var(--shadow-sm);
}

.app-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.title-icon { color: var(--primary); }

.header-actions { margin-left: auto; display: flex; gap: 4px; }

.menu-btn { display: none; }

.sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow: hidden;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
}

.sidebar-inner {
    height: 100%;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.main {
    grid-area: main;
    overflow-y: auto;
    padding: 28px 32px 60px;
    max-width: 100%;
}

/* ---------------- Search ---------------- */
.search-box { position: relative; }

#search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg);
    transition: border-color .15s, box-shadow .15s;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 20;
    max-height: 340px;
    overflow-y: auto;
}

.search-result {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-hover); }
.search-result-title { font-weight: 500; color: var(--text); }
.search-result-cat { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-empty { padding: 14px; text-align: center; color: var(--text-muted); }

/* ---------------- Tree ---------------- */
.tree-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tree {
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}

.tree ul { list-style: none; padding-left: 0; margin: 0; }
.tree > ul { padding-left: 0; }
.tree ul ul { padding-left: 18px; }

.tree-item { user-select: none; }

.tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color .12s;
    min-height: 32px;
}

.tree-row:hover { background: var(--bg-hover); }
.tree-row.active { background: var(--bg-active); color: var(--primary); font-weight: 500; }

.tree-toggle {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    transition: transform .15s ease;
    font-size: 10px;
}
.tree-toggle.open { transform: rotate(90deg); }
.tree-toggle.placeholder { visibility: hidden; }

.tree-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.tree-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
}
.tree-row.active .tree-icon { color: var(--primary); }

.tree-article .tree-label { color: var(--text-muted); font-size: 13.5px; }
.tree-article.active .tree-label { color: var(--primary); font-weight: 500; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    cursor: pointer;
    transition: background-color .12s, border-color .12s, transform .05s;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }

.btn-sm { padding: 6px 10px; font-size: 13px; }

.btn-secondary {
    background: var(--bg-elev);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .12s, color .12s;
    font-size: 24px;
    line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ---------------- Article / category view ---------------- */
.welcome {
    max-width: 720px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
}
.welcome h2 { margin-top: 0; }
.welcome-tips { padding-left: 20px; color: var(--text-muted); }
.welcome-tips li { margin: 6px 0; }
.welcome-tips strong { color: var(--text); }

.article-breadcrumbs {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}
.article-breadcrumbs span + span::before {
    content: "›";
    margin: 0 6px;
    color: var(--text-soft);
}

.article-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.article-header h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 26px;
    letter-spacing: -0.01em;
}
.article-tools {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.article-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.article-view, .category-view {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow-sm);
    max-width: 980px;
}

/* Markdown content */
.article-content h1, .article-content h2, .article-content h3 {
    margin-top: 1.6em;
    margin-bottom: 0.5em;
    letter-spacing: -0.01em;
}
.article-content h1 { font-size: 22px; }
.article-content h2 { font-size: 19px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.article-content h3 { font-size: 17px; }
.article-content p { margin: 0.6em 0; }
.article-content ul, .article-content ol { padding-left: 24px; }
.article-content li { margin: 4px 0; }
.article-content code {
    background: var(--code-bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 90%;
}
.article-content pre {
    background: var(--code-bg);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    border: 1px solid var(--border);
    font-size: 13.5px;
}
.article-content pre code { background: transparent; padding: 0; }
.article-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 4px 14px;
    color: var(--text-muted);
    margin: 1em 0;
    background: var(--primary-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
[data-theme="dark"] .article-content blockquote { background: rgba(59, 130, 246, 0.08); }

.article-content table {
    border-collapse: collapse;
    margin: 14px 0;
    width: 100%;
    font-size: 14px;
}
.article-content th, .article-content td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.article-content th {
    background: var(--bg-hover);
    font-weight: 600;
}

/* Category content */
.category-content { display: grid; gap: 14px; }
.category-card {
    display: block;
    padding: 14px 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .12s, background-color .12s, transform .05s;
}
.category-card:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
[data-theme="dark"] .category-card:hover { background: rgba(59, 130, 246, 0.08); }
.category-card-title { font-weight: 500; font-size: 16px; }
.category-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.category-card-type { font-size: 11px; color: var(--accent); text-transform: uppercase;
                      letter-spacing: 0.05em; margin-bottom: 4px; }

/* ---------------- Modal ---------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}
.modal-window {
    position: relative;
    background: var(--bg-elev);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 760px;
    width: 100%;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: grid;
    gap: 16px;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
}

.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.field-hint { font-size: 12px; color: var(--text-soft); }
.field input, .field textarea {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--bg);
    width: 100%;
    transition: border-color .12s, box-shadow .12s;
    color: var(--text);
}
.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea {
    resize: vertical;
    min-height: 200px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1.55;
}

/* ---------------- Toast ---------------- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 10px 18px;
    border-radius: var(--radius);
    z-index: 200;
    box-shadow: var(--shadow);
    font-size: 14px;
    animation: toast-in .2s ease;
}
.toast.error { background: var(--danger); color: white; }
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------- Sidebar backdrop (mobile) ---------------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 15;
}

/* =============================================================
   Адаптивный мобильный layout
   ============================================================= */
@media (max-width: 860px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
    .menu-btn { display: inline-flex; }

    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        bottom: 0;
        width: min(86%, 340px);
        height: calc(100vh - var(--header-h));
        height: calc(100dvh - var(--header-h));
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 25;
        box-shadow: var(--shadow-lg);
    }
    .app.sidebar-open .sidebar {
        transform: translateX(0);
    }
    .app.sidebar-open .sidebar-backdrop { display: block; }

    .main {
        padding: 16px 14px 60px;
    }
    .article-view, .category-view, .welcome {
        padding: 18px 18px 22px;
    }
    .article-header h2 { font-size: 22px; }
    .app-title span:last-child {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 56vw;
    }
}

@media (max-width: 480px) {
    .article-tools, .tree-actions { width: 100%; }
    .article-tools .btn, .tree-actions .btn { flex: 1; }
}

/* =============================================================
   Экран входа
   ============================================================= */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(14, 165, 233, 0.18), transparent 60%),
        var(--bg);
    z-index: 1000;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 26px 22px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-brand { text-align: center; margin-bottom: 4px; }
.login-brand .title-icon { font-size: 28px; }
.login-brand h1 { margin: 6px 0 2px; font-size: 20px; }
.login-brand p { margin: 0; color: var(--text-muted); font-size: 13px; }
.login-error {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.35);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.login-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--text-soft);
    text-align: center;
}
.login-hint code {
    background: var(--code-bg);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11.5px;
}
.btn-block { width: 100%; padding: 11px 14px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

/* =============================================================
   User menu
   ============================================================= */
.user-menu { position: relative; margin-left: 6px; }
.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    color: var(--text);
    transition: background-color .12s, border-color .12s;
}
.user-btn:hover { background: var(--bg-hover); border-color: var(--border); }
.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}
.user-avatar[data-role="admin"]  { background: #b91c1c; }
.user-avatar[data-role="editor"] { background: #0ea5e9; }
.user-avatar[data-role="viewer"] { background: #64748b; }
.user-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.15;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text-muted); }

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    overflow: hidden;
    z-index: 50;
}
.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-danger { color: var(--danger); }
.dropdown-danger:hover { background: rgba(220, 38, 38, 0.08); }

/* =============================================================
   Editor toolbar (image insert/upload)
   ============================================================= */
.editor-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

/* =============================================================
   Markdown images inside articles
   ============================================================= */
.article-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 18px auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    padding: 8px;
    box-shadow: var(--shadow-sm);
}

/* =============================================================
   Image picker
   ============================================================= */
.modal-wide { max-width: 900px; }

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.image-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    transition: border-color .12s, transform .05s;
}
.image-card:hover { border-color: var(--primary); }
.image-card:active { transform: scale(0.98); }
.image-card img {
    width: 100%;
    height: 110px;
    object-fit: contain;
    background: #fff;
    padding: 6px;
}
.image-card-meta {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--border);
}
.image-badge {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    font-weight: 600;
}

/* =============================================================
   Admin: users table
   ============================================================= */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 12px;
}
.admin-table th, .admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: middle;
}
.admin-table th {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.admin-actions { display: flex; gap: 6px; }
.role-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}
.role-pill.role-admin  { background: rgba(185, 28, 28, 0.12); color: #b91c1c; }
.role-pill.role-editor { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.role-pill.role-viewer { background: rgba(100, 116, 139, 0.15); color: #475569; }
[data-theme="dark"] .role-pill.role-admin  { color: #fca5a5; }
[data-theme="dark"] .role-pill.role-editor { color: #7dd3fc; }
[data-theme="dark"] .role-pill.role-viewer { color: #94a3b8; }

/* Welcome viewer-only note */
.welcome-note {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
    font-size: 13.5px;
}
[data-theme="dark"] .welcome-note { background: rgba(59, 130, 246, 0.08); }

/* ====== Прикреплённые файлы ====================================== */
.article-attachments {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.attach-heading {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.attachments-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.attachment-item:hover { background: var(--surface-hover, var(--primary-soft)); }
.attachment-icon { font-size: 18px; line-height: 1; flex: 0 0 auto; }
.attachment-link {
    flex: 1 1 auto;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attachment-link:hover { text-decoration: underline; }
.attachment-meta {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.attachment-del { flex: 0 0 auto; }
.attachment-empty {
    padding: 10px 12px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}
.attachments-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ====== Админ-табы и резервное копирование ======================= */
.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.admin-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.admin-tab-panel { padding: 4px 0; }
.backup-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.backup-section:last-child { border-bottom: none; }
.backup-section h4 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.backup-section .field-hint { margin: 0 0 10px; line-height: 1.45; }
.backup-warning {
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.08);
    border-left: 3px solid #ef4444;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
}
[data-theme="dark"] .backup-warning { background: rgba(239, 68, 68, 0.12); }
#restore-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
}

/* Mobile tweaks for new UI */
@media (max-width: 640px) {
    .user-meta { display: none; }
    .user-btn { padding: 4px; }
    .admin-table { font-size: 12px; }
    .admin-table th, .admin-table td { padding: 6px 6px; }
    .modal-wide { max-width: 100%; }
    .attachment-item { flex-wrap: wrap; }
    .attachment-meta { margin-left: 28px; }
    .admin-tabs { overflow-x: auto; }
}
