/* ─── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --color-primary: #1a73e8;
    --color-primary-dark: #1557b0;
    --color-danger: #dc3545;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-muted: #6c757d;
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-border: #dee2e6;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --sidebar-width: 240px;
    --header-height: 56px;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.12);
    --transition: .2s ease;
}

html { font-size: 15px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    transition: background-color .25s ease, color .25s ease, background .25s ease;
}

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

/* ─── Layout ────────────────────────────────────────── */
.app-wrapper { min-height: 100vh; }

.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-left { display: flex; align-items: center; gap: .75rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.user-info { font-size: .875rem; color: var(--color-text-muted); }
.user-role {
    background: var(--color-primary);
    color: #fff;
    padding: .15rem .5rem;
    border-radius: 3px;
    font-size: .75rem;
    margin-right: .25rem;
}

/* ─── Notification Bell (Jira-style) ─────────────────── */
.notification-bell-wrapper {
    position: relative;
}

.notification-bell-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: .4rem;
    border-radius: 4px;
    transition: background .15s;
    position: relative;
    line-height: 1;
}

.notification-bell-btn:hover {
    background: var(--color-bg-hover, #f1f5f9);
}

/* ─── Help Icon ─────────────────── */
.help-icon-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: .4rem;
    border-radius: 4px;
    transition: background .15s;
    line-height: 1;
    margin-left: .25rem;
    text-decoration: none;
    display: inline-block;
}

.help-icon-btn:hover {
    background: var(--color-bg-hover, #f1f5f9);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: .1rem .35rem;
    border-radius: 10px;
    line-height: 1;
    min-width: 18px;
    text-align: center;
}

.notification-overlay {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 420px;
    max-height: 600px;
    background: var(--color-bg-panel, #fff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.notification-overlay-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-overlay-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.notification-mark-all-read {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: .8rem;
    cursor: pointer;
    padding: .3rem .6rem;
    border-radius: 4px;
    transition: background .15s;
}

.notification-mark-all-read:hover {
    background: var(--color-bg-hover, #f1f5f9);
}

.notification-overlay-body {
    flex: 1;
    overflow-y: auto;
    max-height: 480px;
}

.notification-loading {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
}

.notification-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: .9rem;
}

.notification-item {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    cursor: pointer;
    transition: background .15s;
    display: flex;
    gap: .75rem;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--color-bg-hover, #f8fafc);
}

.notification-item.unread {
    background: #eff6ff;
}

.notification-item.unread:hover {
    background: #dbeafe;
}

.notification-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: .875rem;
    color: var(--color-text);
    margin-bottom: .25rem;
}

.notification-message {
    font-size: .8rem;
    color: var(--color-text-muted);
    margin-bottom: .3rem;
}

.notification-time {
    font-size: .72rem;
    color: var(--color-text-muted);
}

.notification-overlay-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--color-border, #e2e8f0);
    text-align: center;
}

.notification-overlay-footer a {
    color: var(--color-primary);
    font-size: .85rem;
    text-decoration: none;
}

.notification-overlay-footer a:hover {
    text-decoration: underline;
}

/* Dark Mode Overrides */
html[data-theme="dark"] .notification-overlay,
body.theme-dark .notification-overlay {
    background: #1e293b;
    border-color: #334155;
}

html[data-theme="dark"] .notification-bell-btn:hover,
body.theme-dark .notification-bell-btn:hover {
    background: #334155;
}

html[data-theme="dark"] .help-icon-btn:hover,
body.theme-dark .help-icon-btn:hover {
    background: #334155;
}

html[data-theme="dark"] .notification-item.unread,
body.theme-dark .notification-item.unread {
    background: #1e3a5f;
}

html[data-theme="dark"] .notification-item.unread:hover,
body.theme-dark .notification-item.unread:hover {
    background: #2a4a7f;
}

/* Sidebar Toggle */
.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.sidebar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition);
}

.app-body {
    display: flex;
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    z-index: 90;
    transition: transform var(--transition);
}

.nav-list { list-style: none; padding: .5rem 0; }

.nav-item a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: var(--color-text);
    font-size: .9rem;
    transition: background var(--transition);
}

.nav-item a:hover { background: var(--color-bg); }
.nav-item.active a {
    background: #e8f0fe;
    color: var(--color-primary);
    font-weight: 600;
}

.nav-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; }

/* ─── Main Content ──────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    max-width: 100%;
}

/* ─── Page Header ───────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; }

/* ─── Cards ─────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.card-header h3 { font-size: 1rem; font-weight: 600; }

.card-body { padding: 1.25rem; }

/* ─── Widget Grid ───────────────────────────────────── */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* ─── Tables ────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: .9rem;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--color-text-muted);
}
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--color-text); }

.table tbody tr:hover { background: #f8f9fa; }

.actions { display: flex; gap: .5rem; align-items: center; }
.inline-form { display: inline; }

/* ─── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

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

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.btn-danger:hover { background: #c82333; border-color: #c82333; color: #fff; }

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

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 500;
    font-size: .875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    transition: border-color var(--transition), background-color .25s ease, color .25s ease, box-shadow .25s ease;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .15);
}

.form-group textarea { min-height: 120px; resize: vertical; }

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
}

.checkbox-label input { width: auto; }

/* ─── Alerts ────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-error { background: #f8d7da; color: #721c24; }
.alert-success { background: #d4edda; color: #155724; }
.alert-warning { background: #fff3cd; color: #856404; }

/* ─── Badges ────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 3px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-admin { background: #e8f0fe; color: var(--color-primary); }
.badge-editor { background: #fff3cd; color: #856404; }
.badge-viewer { background: #f0f0f0; color: var(--color-muted); }
.badge-success { background: #d4edda; color: #155724; }
.badge-muted { background: #f0f0f0; color: var(--color-muted); }

/* ─── Error Pages ───────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-page h1 {
    font-size: 4rem;
    color: var(--color-muted);
    margin-bottom: .5rem;
}

.error-page p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

/* ─── Login Page ────────────────────────────────────── */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container { width: 100%; max-width: 400px; padding: 1rem; }

.login-box {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 1.5rem;
    text-align: center;
    color: var(--color-primary);
    margin-bottom: .25rem;
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: .9rem;
    margin-bottom: 1.5rem;
}

/* ─── Utilities ─────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ─── Content Body (WYSIWYG output) ─────────────────── */
.content-body h1, .content-body h2, .content-body h3,
.content-body h4, .content-body h5, .content-body h6 { margin: 1.25em 0 .5em; font-weight: 600; }
.content-body h1 { font-size: 1.75rem; }
.content-body h2 { font-size: 1.45rem; }
.content-body h3 { font-size: 1.2rem; }
.content-body p { margin: 0 0 1em; }
.content-body ul, .content-body ol { margin: 0 0 1em 1.5em; }
.content-body li { margin-bottom: .25em; }
.content-body blockquote {
    border-left: 3px solid var(--color-primary);
    margin: 0 0 1em;
    padding: .5rem 1rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.content-body pre {
    background: #1e293b; color: #e2e8f0;
    padding: 1rem; border-radius: var(--radius);
    overflow-x: auto; margin: 0 0 1em;
    font-size: .85rem;
}
.content-body code { font-size: .9em; background: var(--color-bg); padding: .1em .35em; border-radius: 3px; }
.content-body pre code { background: none; padding: 0; }
.content-body img { max-width: 100%; height: auto; border-radius: var(--radius); }
.content-body table { width: 100%; border-collapse: collapse; margin: 0 0 1em; }
.content-body th, .content-body td { padding: .5rem .75rem; border: 1px solid var(--color-border); text-align: left; }
.content-body th { background: #f8f9fa; font-weight: 600; }
.content-body a { color: var(--color-primary); text-decoration: underline; }
.content-body hr { border: none; border-top: 1px solid var(--color-border); margin: 1.5em 0; }

/* ─── Collapsible Nav Folders ───────────────────────── */
.nav-folder > .nav-folder-toggle {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: var(--color-text);
    font-size: .9rem;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}

.nav-folder > .nav-folder-toggle:hover { background: var(--color-bg); }

.nav-arrow {
    margin-left: auto;
    font-size: .7rem;
    transition: transform var(--transition);
    color: var(--color-text-muted);
}

.nav-folder.open > .nav-folder-toggle .nav-arrow {
    transform: rotate(90deg);
}

.nav-folder.open > .nav-folder-toggle {
    font-weight: 600;
}

.nav-sublist {
    list-style: none;
    overflow: hidden;
    transition: max-height .25s ease;
}

.nav-sublist .nav-item a {
    padding-left: 2.75rem;
    font-size: .85rem;
}

.nav-sublist .nav-sublist .nav-item a {
    padding-left: 3.75rem;
}

/* Backend: Ordner-Styling */
.is-backend .nav-folder > .nav-folder-toggle { color: #cbd5e1; }
.is-backend .nav-folder > .nav-folder-toggle:hover { background: #334155; }
.is-backend .nav-folder.open > .nav-folder-toggle { color: #e2e8f0; }
.is-backend .nav-arrow { color: #64748b; }

/* ─── Backend / Frontend Theming ────────────────────── */
.is-backend .app-header {
    background: #1e293b;
    border-bottom-color: #334155;
}

.is-backend .logo { color: #60a5fa; }

.logo-badge {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .1rem .4rem;
    border-radius: 3px;
    margin-left: .35rem;
    vertical-align: middle;
}

.is-backend .logo-badge {
    background: rgba(96,165,250,.15);
    color: #93c5fd;
}

.is-frontend .logo-badge {
    background: rgba(26,115,232,.1);
    color: var(--color-primary);
}

.is-backend .user-info,
.is-backend .header-right a { color: #94a3b8; }
.is-backend .header-right a:hover { color: #e2e8f0; }

.is-backend .sidebar {
    background: #1e293b;
    border-right-color: #334155;
}

.is-backend .nav-item a { color: #cbd5e1; }
.is-backend .nav-item a:hover { background: #334155; }
.is-backend .nav-item.active a {
    background: rgba(96,165,250,.12);
    color: #60a5fa;
}

.is-backend .sidebar-toggle span { background: #e2e8f0; }

.filter-bar {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.filter-bar select,
.filter-bar input {
    padding: .45rem .65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .85rem;
    font-family: inherit;
}

/* ─── Profile / Appearance Settings ────────────────── */
.settings-card {
    backdrop-filter: blur(10px);
}

.settings-section-title {
    margin: 1.5rem 0 .9rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--color-text-muted);
}

.theme-setting-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(26, 115, 232, .18);
    border-radius: 14px;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, rgba(26,115,232,.09), rgba(26,115,232,.02));
}

.theme-setting-card h3 {
    margin: 0 0 .2rem;
    font-size: 1.05rem;
}

.theme-setting-eyebrow {
    margin-bottom: .25rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-primary);
}

.theme-switch {
    display: inline-flex !important;
    align-items: center;
    gap: .7rem;
    cursor: pointer;
    user-select: none;
}

.theme-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-switch-slider {
    position: relative;
    width: 56px;
    height: 30px;
    border-radius: 999px;
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
    transition: all .25s ease;
}

.theme-switch-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15,23,42,.22);
    transition: transform .25s ease;
}

.theme-switch input:checked + .theme-switch-slider {
    background: linear-gradient(135deg, #1a73e8, #7c3aed);
}

.theme-switch input:checked + .theme-switch-slider::after {
    transform: translateX(26px);
}

.theme-switch-text {
    font-weight: 700;
    color: var(--color-text);
}

/* ─── Premium Frontend Dark Mode ───────────────────── */
html[data-theme="dark"] body.is-frontend,
body.is-frontend.theme-dark {
    --color-primary: #7cb7ff;
    --color-primary-dark: #a5d0ff;
    --color-danger: #ff7b8f;
    --color-success: #38d39f;
    --color-warning: #f3c969;
    --color-muted: #94a3b8;
    --color-bg: #08111d;
    --color-surface: #0f1726;
    --color-border: #233249;
    --color-text: #e8eef8;
    --color-text-muted: #9fb0c7;
    --shadow: 0 10px 30px rgba(0,0,0,.32);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.44);
    background:
        radial-gradient(circle at top left, rgba(74, 144, 226, .13), transparent 0, transparent 42%),
        radial-gradient(circle at top right, rgba(124, 58, 237, .10), transparent 0, transparent 38%),
        linear-gradient(180deg, #060b13 0%, #0b1220 100%);
}

html[data-theme="dark"] body.is-frontend .app-header,
body.is-frontend.theme-dark .app-header {
    background: rgba(8, 17, 29, .88);
    border-bottom-color: rgba(124, 183, 255, .14);
    backdrop-filter: blur(14px);
}

html[data-theme="dark"] body.is-frontend .sidebar,
body.is-frontend.theme-dark .sidebar {
    background: rgba(11, 18, 32, .9);
    border-right-color: rgba(124, 183, 255, .12);
    backdrop-filter: blur(18px);
}

html[data-theme="dark"] body.is-frontend .nav-item a:hover,
html[data-theme="dark"] body.is-frontend .nav-folder > .nav-folder-toggle:hover,
body.is-frontend.theme-dark .nav-item a:hover,
body.is-frontend.theme-dark .nav-folder > .nav-folder-toggle:hover {
    background: rgba(124, 183, 255, .08);
}

html[data-theme="dark"] body.is-frontend .nav-item.active a,
body.is-frontend.theme-dark .nav-item.active a {
    background: linear-gradient(135deg, rgba(124, 183, 255, .18), rgba(124, 58, 237, .14));
    color: #dcecff;
}

html[data-theme="dark"] body.is-frontend .table th,
body.is-frontend.theme-dark .table th,
html[data-theme="dark"] body.is-frontend .content-body th,
body.is-frontend.theme-dark .content-body th {
    background: rgba(148, 163, 184, .08);
}

html[data-theme="dark"] body.is-frontend .table tbody tr:hover,
body.is-frontend.theme-dark .table tbody tr:hover {
    background: rgba(124, 183, 255, .06);
}

html[data-theme="dark"] body.is-frontend .btn,
body.is-frontend.theme-dark .btn {
    background: #121c2d;
    border-color: #2a3b55;
    color: var(--color-text);
}

html[data-theme="dark"] body.is-frontend .btn:hover,
body.is-frontend.theme-dark .btn:hover {
    background: #162338;
}

html[data-theme="dark"] body.is-frontend .btn-outline,
body.is-frontend.theme-dark .btn-outline {
    background: rgba(255,255,255,.02);
}

html[data-theme="dark"] body.is-frontend .btn-primary,
body.is-frontend.theme-dark .btn-primary {
    color: #06101b;
    border-color: transparent;
    background: linear-gradient(135deg, #7cb7ff, #93c5fd 52%, #a78bfa);
}

html[data-theme="dark"] body.is-frontend .btn-primary:hover,
body.is-frontend.theme-dark .btn-primary:hover {
    color: #06101b;
    background: linear-gradient(135deg, #9ac8ff, #b0d5ff 52%, #c4b5fd);
}

html[data-theme="dark"] body.is-frontend .alert-error,
body.is-frontend.theme-dark .alert-error {
    background: rgba(220, 53, 69, .14);
    color: #ffb8c1;
    border: 1px solid rgba(255, 123, 143, .25);
}

html[data-theme="dark"] body.is-frontend .alert-success,
body.is-frontend.theme-dark .alert-success {
    background: rgba(40, 167, 69, .14);
    color: #a7f3d0;
    border: 1px solid rgba(56, 211, 159, .22);
}

html[data-theme="dark"] body.is-frontend .alert-warning,
body.is-frontend.theme-dark .alert-warning {
    background: rgba(255, 193, 7, .12);
    color: #fde68a;
    border: 1px solid rgba(243, 201, 105, .2);
}

html[data-theme="dark"] body.is-frontend .badge-admin,
body.is-frontend.theme-dark .badge-admin {
    background: rgba(124, 183, 255, .16);
    color: #cfe5ff;
}

html[data-theme="dark"] body.is-frontend .badge-editor,
body.is-frontend.theme-dark .badge-editor {
    background: rgba(243, 201, 105, .16);
    color: #fde68a;
}

html[data-theme="dark"] body.is-frontend .badge-viewer,
html[data-theme="dark"] body.is-frontend .badge-muted,
body.is-frontend.theme-dark .badge-viewer,
body.is-frontend.theme-dark .badge-muted {
    background: rgba(148, 163, 184, .14);
    color: #cbd5e1;
}

html[data-theme="dark"] body.is-frontend .content-body blockquote,
body.is-frontend.theme-dark .content-body blockquote {
    background: rgba(124, 183, 255, .06);
}

html[data-theme="dark"] body.is-frontend .content-body code,
body.is-frontend.theme-dark .content-body code {
    background: rgba(148, 163, 184, .12);
}

html[data-theme="dark"] body.is-frontend .filter-bar select,
html[data-theme="dark"] body.is-frontend .filter-bar input,
body.is-frontend.theme-dark .filter-bar select,
body.is-frontend.theme-dark .filter-bar input {
    background: #111a2a;
    color: var(--color-text);
}

html[data-theme="dark"] body.is-frontend .theme-setting-card,
body.is-frontend.theme-dark .theme-setting-card {
    border-color: rgba(124, 183, 255, .18);
    background: linear-gradient(135deg, rgba(124,183,255,.12), rgba(124,58,237,.10));
    box-shadow: 0 18px 40px rgba(5, 10, 20, .28);
}

html[data-theme="dark"] body.is-frontend [style*="background:#fff"],
body.is-frontend.theme-dark [style*="background:#fff"] {
    background: #111a2a !important;
    color: var(--color-text) !important;
}

html[data-theme="dark"] body.is-frontend [style*="border:1px solid #e5e7eb"],
body.is-frontend.theme-dark [style*="border:1px solid #e5e7eb"] {
    border-color: var(--color-border) !important;
}

html[data-theme="dark"] body.is-frontend [style*="background:#fff8e1"],
body.is-frontend.theme-dark [style*="background:#fff8e1"] {
    background: rgba(243, 201, 105, .12) !important;
    color: #fde68a !important;
}

html[data-theme="dark"] body.is-frontend [style*="background:#e8f4ff"],
body.is-frontend.theme-dark [style*="background:#e8f4ff"] {
    background: rgba(124, 183, 255, .16) !important;
    color: #dcecff !important;
}

html[data-theme="dark"] body.is-frontend [style*="background:#eef9f0"],
body.is-frontend.theme-dark [style*="background:#eef9f0"] {
    background: rgba(56, 211, 159, .16) !important;
    color: #b8f7dc !important;
}

html[data-theme="dark"] body.is-frontend [style*="background:#f3ecff"],
body.is-frontend.theme-dark [style*="background:#f3ecff"] {
    background: rgba(167, 139, 250, .16) !important;
    color: #ddd6fe !important;
}

html[data-theme="dark"] body.is-frontend ::selection,
body.is-frontend.theme-dark ::selection {
    background: rgba(124, 183, 255, .35);
    color: #fff;
}

/* ─── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; }

    .page-header { flex-direction: column; align-items: flex-start; }

    .table { font-size: .8rem; }
    .table th, .table td { padding: .5rem .65rem; }
}
