/* ============================================
   CSC Admin Panel – Dedicated Stylesheet
   Domain: admin.csc-wilhelmshaven.de
   ============================================ */

/* ── Tokens ─────────────────────────────── */
:root {
    --admin-bg:          #0d1526;
    --admin-surface:     #131c2e;
    --admin-surface-2:   #1a2540;
    --admin-surface-3:   #1f2d4a;
    --admin-surface-4:   #263352;

    --admin-accent:      #22c55e;
    --admin-accent-dark: #16a34a;
    --admin-accent-dim:  rgba(34, 197, 94, 0.12);
    --admin-accent-glow: 0 0 20px rgba(34, 197, 94, 0.22);

    --admin-red:         #ef4444;
    --admin-red-dim:     rgba(239, 68, 68, 0.14);
    --admin-yellow:      #f59e0b;
    --admin-yellow-dim:  rgba(245, 158, 11, 0.14);
    --admin-blue:        #3b82f6;
    --admin-blue-dim:    rgba(59, 130, 246, 0.14);

    --admin-text:        #e2e8f0;
    --admin-text-muted:  #94a3b8;
    --admin-text-dim:    #64748b;

    --admin-border:      rgba(255, 255, 255, 0.07);
    --admin-border-2:    rgba(255, 255, 255, 0.12);
    --admin-glass:       rgba(255, 255, 255, 0.04);

    --sidebar-w:         276px;
    --topbar-h:          70px;
    --radius-card:       16px;
    --radius-btn:        10px;
    --radius-input:      10px;
    --transition-fast:   0.15s ease;
    --transition-med:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; scroll-behavior: smooth; }

body.admin-body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    height: 100%;
    overflow: hidden;
}

/* ── Login Screen ───────────────────────── */
#loginScreen {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 30% 40%, rgba(34,197,94,0.06) 0%, transparent 60%),
                var(--admin-bg);
    z-index: 1000;
}

.login-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border-2);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 32px 64px rgba(0,0,0,0.5);
    animation: loginFadeIn 0.4s ease-out both;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--admin-accent-dim);
    border: 1px solid rgba(34,197,94,0.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}

.login-logo-text h1 { font-size: 1.15rem; font-weight: 700; color: var(--admin-text); }
.login-logo-text p  { font-size: 0.8rem; color: var(--admin-text-muted); }

.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { color: var(--admin-text-muted); font-size: 0.875rem; margin-bottom: 32px; }

.login-error {
    background: var(--admin-red-dim);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--radius-btn);
    padding: 10px 14px;
    font-size: 0.875rem;
    color: #fca5a5;
    margin-bottom: 16px;
    display: none;
}

/* ── Main Layout ────────────────────────── */
#appShell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    height: 100vh;
    transition: grid-template-columns var(--transition-med);
}

#appShell.sidebar-collapsed {
    --sidebar-w: 64px;
}

/* ── Sidebar ────────────────────────────── */
#sidebar {
    grid-row: 1 / 3;
    background: var(--admin-surface);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--transition-med);
    width: var(--sidebar-w);
    position: relative;
    z-index: 10;
}

.sidebar-header {
    height: var(--topbar-h);
    display: flex; align-items: center;
    padding: 0 18px;
    gap: 12px;
    border-bottom: 1px solid var(--admin-border);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-icon {
    width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    background: var(--admin-accent-dim);
    border: 1px solid rgba(34,197,94,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
}

.sidebar-brand {
    font-weight: 700; font-size: 0.9rem; white-space: nowrap;
    overflow: hidden; transition: opacity var(--transition-med), max-width var(--transition-med);
    max-width: 160px;
}

.sidebar-brand span { color: var(--admin-accent); }

#appShell.sidebar-collapsed .sidebar-brand {
    opacity: 0; max-width: 0;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--admin-surface-4) transparent;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--admin-text-dim);
    padding: 12px 8px 4px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-med);
}

#appShell.sidebar-collapsed .nav-section-label { opacity: 0; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 10px;
    border-radius: 9px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background var(--transition-fast), color var(--transition-fast);
    margin-bottom: 2px;
    white-space: nowrap;
    color: var(--admin-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--admin-surface-3);
    color: var(--admin-text);
}

.nav-item.active {
    background: var(--admin-accent-dim);
    color: var(--admin-accent);
}

.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 20%; bottom: 20%;
    width: 3px; border-radius: 0 2px 2px 0;
    background: var(--admin-accent);
}

.nav-item i {
    font-size: 18px; flex-shrink: 0; width: 22px; text-align: center;
    transition: transform var(--transition-fast);
}

.nav-item:hover i { transform: scale(1.08); }

.nav-label {
    transition: opacity var(--transition-med), max-width var(--transition-med);
    max-width: 160px; overflow: hidden;
}

#appShell.sidebar-collapsed .nav-label {
    opacity: 0; max-width: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--admin-red);
    color: #fff;
    font-size: 0.65rem; font-weight: 700;
    padding: 1px 6px; border-radius: 20px;
    min-width: 18px; text-align: center;
    animation: pulse-badge 2s infinite;
    flex-shrink: 0;
    transition: opacity var(--transition-med);
}

@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    50%       { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

#appShell.sidebar-collapsed .nav-badge { opacity: 0; }

/* Sidebar Footer / User */
.sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid var(--admin-border);
    display: flex; align-items: center; gap: 10px;
    overflow: hidden;
}

.user-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--admin-accent-dark), var(--admin-accent));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: #fff;
}

.user-info {
    flex: 1; overflow: hidden;
    transition: opacity var(--transition-med), max-width var(--transition-med);
    max-width: 140px;
}

.user-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--admin-text-muted); }

#appShell.sidebar-collapsed .user-info { opacity: 0; max-width: 0; }

.btn-logout {
    background: transparent; border: none; cursor: pointer;
    color: var(--admin-text-muted); font-size: 18px;
    padding: 4px; border-radius: 6px;
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}

.btn-logout:hover { color: var(--admin-red); background: var(--admin-red-dim); }

/* ── Topbar ─────────────────────────────── */
.topbar {
    grid-column: 2;
    background: rgba(13, 21, 38, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--admin-border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 9;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right { margin-left: auto; }

.btn-collapse {
    background: transparent; border: none; cursor: pointer;
    color: var(--admin-text-muted); font-size: 20px;
    padding: 6px; border-radius: var(--radius-btn);
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}

.btn-collapse:hover { color: var(--admin-text); background: var(--admin-surface-3); }

.breadcrumb {
    flex: 1;
    font-size: 0.92rem; color: var(--admin-text-muted);
    display: flex; align-items: center; gap: 6px;
}

.breadcrumb .bc-sep { color: var(--admin-text-dim); }
.breadcrumb .bc-root,
.breadcrumb #bcCurrent { color: var(--admin-text); font-weight: 600; }

.kbd-hint {
    display: flex; align-items: center; gap: 6px;
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border-2);
    border-radius: var(--radius-btn);
    padding: 7px 12px;
    font-size: 0.82rem; color: var(--admin-text-muted);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.kbd-hint:hover { background: var(--admin-surface-3); color: var(--admin-text); }
.kbd-hint kbd { font-size: 0.72rem; background: var(--admin-surface-4); border-radius: 4px; padding: 1px 5px; }

/* ── Main Content ────────────────────────── */
.main-content {
    grid-column: 2;
    min-height: 0;
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 30px 34px 48px;
    scrollbar-width: thin;
    scrollbar-color: var(--admin-surface-4) transparent;
}

/* ── Views ──────────────────────────────── */
.view { display: none; animation: viewIn 0.18s ease-out both; }
.view.active { display: block; }

@keyframes viewIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.view-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 30px; gap: 18px; flex-wrap: wrap;
}

.view-title {
    font-size: clamp(1.5rem, 2.5vw, 1.95rem);
    font-weight: 760;
    line-height: 1.15;
    margin-bottom: 6px;
}

.view-subtitle {
    color: var(--admin-text-muted);
    font-size: 0.96rem;
    line-height: 1.55;
    max-width: 70ch;
}

.view-body {
    display: grid;
    gap: 20px;
}

.dashboard-bottom {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 18px;
}

.chart-section,
.top-posts-section {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    padding: 20px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--admin-text);
}

.view-header-text h2 {
    font-size: 1.5rem; font-weight: 700;
    background: linear-gradient(135deg, var(--admin-text), #94a3b8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.view-header-text p { color: var(--admin-text-muted); font-size: 0.875rem; margin-top: 4px; }

/* ── KPI Cards ──────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    padding: 22px;
    display: flex; align-items: center; gap: 16px;
    position: relative; overflow: hidden;
    transition: transform var(--transition-med), box-shadow var(--transition-med);
    cursor: default;
}

.kpi-card::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.035) 0%, transparent 60%);
    pointer-events: none;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--admin-accent-glow), 0 16px 40px rgba(0,0,0,0.4);
    border-color: rgba(34,197,94,0.25);
}

.kpi-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}

.kpi-icon.green  { background: var(--admin-accent-dim); color: var(--admin-accent); }
.kpi-icon.blue   { background: var(--admin-blue-dim);   color: var(--admin-blue); }
.kpi-icon.yellow { background: var(--admin-yellow-dim); color: var(--admin-yellow); }
.kpi-icon.red    { background: var(--admin-red-dim);    color: var(--admin-red); }

.kpi-body { flex: 1; min-width: 0; }

.kpi-value {
    font-size: 1.95rem; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums;
}

.kpi-label { font-size: 0.86rem; color: var(--admin-text-muted); margin-top: 5px; }

.kpi-trend {
    font-size: 0.79rem; font-weight: 600; margin-top: 7px;
    display: flex; align-items: center; gap: 3px;
}

.kpi-trend.up   { color: var(--admin-accent); }
.kpi-trend.down { color: var(--admin-red); }
.kpi-trend.neutral { color: var(--admin-text-muted); }

/* ── Chart ──────────────────────────────── */
.chart-card {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    padding: 24px;
    margin-bottom: 28px;
}

.chart-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}

.chart-title { font-size: 1rem; font-weight: 600; }
.chart-subtitle { font-size: 0.78rem; color: var(--admin-text-muted); margin-top: 2px; }

.chart-wrapper { position: relative; height: 240px; }

/* ── Tables ─────────────────────────────── */
.table-card {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 22px 15px;
    border-bottom: 1px solid var(--admin-border);
    gap: 12px; flex-wrap: wrap;
}

.table-card-title { font-size: 1rem; font-weight: 650; }

.table-responsive { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--admin-surface-3);
    padding: 12px 16px;
    font-size: 0.74rem; font-weight: 650;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--admin-text-muted);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--admin-border);
    position: sticky; top: 0; z-index: 1;
}

tbody tr {
    border-bottom: 1px solid var(--admin-border);
    transition: background var(--transition-fast);
    animation: rowIn 0.2s ease-out both;
}

tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
tbody tr:hover { background: var(--admin-surface-3); }
tbody tr:last-child { border-bottom: none; }

@keyframes rowIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Staggered rows */
tbody tr:nth-child(1)  { animation-delay: 0.00s; }
tbody tr:nth-child(2)  { animation-delay: 0.03s; }
tbody tr:nth-child(3)  { animation-delay: 0.06s; }
tbody tr:nth-child(4)  { animation-delay: 0.09s; }
tbody tr:nth-child(5)  { animation-delay: 0.12s; }
tbody tr:nth-child(6)  { animation-delay: 0.15s; }
tbody tr:nth-child(7)  { animation-delay: 0.18s; }
tbody tr:nth-child(8)  { animation-delay: 0.21s; }
tbody tr:nth-child(9)  { animation-delay: 0.24s; }
tbody tr:nth-child(10) { animation-delay: 0.27s; }

td {
    padding: 13px 16px;
    font-size: 0.92rem;
    color: var(--admin-text);
    vertical-align: middle;
}

.td-muted { color: var(--admin-text-muted); font-size: 0.86rem; }

/* ── Badges / Status ────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 600;
    white-space: nowrap;
}

.badge-green  { background: var(--admin-accent-dim);  color: var(--admin-accent); }
.badge-yellow { background: var(--admin-yellow-dim); color: var(--admin-yellow); }
.badge-red    { background: var(--admin-red-dim);    color: var(--admin-red); }
.badge-blue   { background: var(--admin-blue-dim);   color: var(--admin-blue); }
.badge-muted  { background: rgba(255,255,255,0.07); color: var(--admin-text-muted); }

/* ── Buttons ─────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-btn);
    font-size: 0.9rem; font-weight: 620;
    cursor: pointer; border: none;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: var(--admin-accent);
    color: #0a1a0a;
}

.btn-primary:hover {
    background: var(--admin-accent-dark);
    box-shadow: var(--admin-accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--admin-surface-3);
    color: var(--admin-text);
    border: 1px solid var(--admin-border-2);
}

.btn-secondary:hover { background: var(--admin-surface-4); }

.btn-danger {
    background: var(--admin-red-dim);
    color: var(--admin-red);
    border: 1px solid rgba(239,68,68,0.25);
}

.btn-danger:hover { background: rgba(239,68,68,0.22); }

.btn-ghost {
    background: transparent; color: var(--admin-text-muted);
    border: 1px solid var(--admin-border);
}

.btn-ghost:hover { background: var(--admin-surface-3); color: var(--admin-text); }

.btn-icon {
    padding: 7px;
    border-radius: var(--radius-btn);
    font-size: 17px;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block; font-size: 0.86rem; font-weight: 620;
    color: var(--admin-text-muted); margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: var(--admin-surface-3);
    border: 1px solid var(--admin-border-2);
    border-radius: var(--radius-input);
    color: var(--admin-text);
    font-family: inherit; font-size: 0.92rem;
    padding: 11px 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    resize: vertical;
}

.form-control:focus {
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}

.form-control::placeholder { color: var(--admin-text-dim); }

.form-control.error {
    border-color: var(--admin-red);
    animation: shake 0.35s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.char-counter {
    text-align: right; font-size: 0.72rem;
    color: var(--admin-text-dim); margin-top: 4px;
}

/* Blog editor split */
.editor-split {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

.editor-preview-pane {
    background: var(--admin-surface-3);
    border: 1px solid var(--admin-border-2);
    border-radius: var(--radius-input);
    padding: 14px;
    min-height: 240px;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.7;
}

.editor-preview-pane h1, .editor-preview-pane h2, .editor-preview-pane h3 {
    margin: 0.5em 0 0.25em; color: var(--admin-text);
}

.editor-preview-pane p   { margin-bottom: 0.75em; color: var(--admin-text-muted); }
.editor-preview-pane ul, .editor-preview-pane ol { margin: 0 0 0.75em 1.2em; color: var(--admin-text-muted); }
.editor-preview-pane code { background: var(--admin-surface-4); padding: 1px 5px; border-radius: 4px; }
.editor-preview-label { font-size: 0.72rem; color: var(--admin-text-dim); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; }

textarea.form-control { min-height: 240px; }

/* ── Modal ───────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: overlayIn 0.15s ease-out both;
    overflow-y: auto;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border-2);
    border-radius: 18px;
    width: 100%; max-width: 620px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.6);
    animation: modalIn 0.2s ease-out both;
    position: relative;
    max-height: 90vh; overflow-y: auto;
}

.modal-lg { max-width: 860px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--admin-border);
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
    background: transparent; border: none; cursor: pointer;
    color: var(--admin-text-muted); font-size: 22px;
    padding: 4px 6px; border-radius: 7px;
    transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    color: var(--admin-text); background: var(--admin-surface-3);
    transform: rotate(90deg);
}

.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--admin-border);
}

/* ── Toast ───────────────────────────────── */
#toastContainer {
    position: fixed; top: 20px; right: 20px;
    z-index: 500;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border-2);
    border-radius: 12px;
    padding: 14px 16px;
    min-width: 300px; max-width: 380px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    pointer-events: all;
    overflow: hidden;
    position: relative;
    animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.toast.hide { animation: toastOut 0.25s ease-in both; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(110%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(110%); }
}

.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 2px; }
.toast-msg   { font-size: 0.8rem; color: var(--admin-text-muted); }

.toast-progress {
    position: absolute; bottom: 0; left: 0;
    height: 3px; border-radius: 0 2px 2px 0;
    animation: toastProgress 4s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

.toast.success .toast-icon { color: var(--admin-accent); }
.toast.success .toast-progress { background: var(--admin-accent); }
.toast.error   .toast-icon { color: var(--admin-red); }
.toast.error   .toast-progress { background: var(--admin-red); }
.toast.info    .toast-icon { color: var(--admin-blue); }
.toast.info    .toast-progress { background: var(--admin-blue); }
.toast.warning .toast-icon { color: var(--admin-yellow); }
.toast.warning .toast-progress { background: var(--admin-yellow); }

/* ── Skeleton Loader ─────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--admin-surface-2) 25%, var(--admin-surface-3) 50%, var(--admin-surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

.sk-card  { height: 100px; border-radius: var(--radius-card); margin-bottom: 12px; }
.sk-row   { height: 44px; border-radius: 6px; margin-bottom: 8px; }
.sk-title { height: 24px; width: 40%; border-radius: 6px; margin-bottom: 20px; }
.sk-line  { height: 14px; border-radius: 4px; margin-bottom: 8px; }

/* ── Command Palette ─────────────────────── */
#cmdPalette {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 400;
    display: none;
    align-items: flex-start; justify-content: center;
    padding-top: 80px;
    animation: overlayIn 0.1s ease-out both;
}

#cmdPalette.open { display: flex; }

.cmd-box {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border-2);
    border-radius: 16px;
    width: 100%; max-width: 540px;
    box-shadow: 0 32px 64px rgba(0,0,0,0.6);
    overflow: hidden;
    animation: modalIn 0.15s ease-out both;
}

.cmd-input-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--admin-border);
}

.cmd-input-wrap i { color: var(--admin-text-muted); font-size: 18px; }

.cmd-input {
    background: transparent; border: none; outline: none;
    color: var(--admin-text); font-family: inherit;
    font-size: 1rem; flex: 1;
}

.cmd-list { max-height: 340px; overflow-y: auto; padding: 8px; }

.cmd-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 9px;
    cursor: pointer; font-size: 0.875rem;
    color: var(--admin-text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.cmd-item:hover, .cmd-item.focused {
    background: var(--admin-accent-dim);
    color: var(--admin-accent);
}

.cmd-item i { font-size: 17px; width: 20px; text-align: center; }
.cmd-item-label { flex: 1; }

/* ── Confirm Dialog ──────────────────────── */
.confirm-body { text-align: center; padding: 32px 24px 24px; }
.confirm-icon { font-size: 48px; margin-bottom: 16px; }
.confirm-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.confirm-msg   { color: var(--admin-text-muted); font-size: 0.875rem; }

/* ── Toggle Switch ───────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }

.toggle {
    position: relative; display: inline-block;
    width: 40px; height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute; inset: 0;
    background: var(--admin-surface-4);
    border-radius: 22px; cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute; width: 16px; height: 16px;
    border-radius: 50%; background: #fff;
    top: 3px; left: 3px;
    transition: transform var(--transition-fast);
}

.toggle input:checked + .toggle-slider { background: var(--admin-accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Partner Cards ───────────────────────── */
.partner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.partner-card {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    padding: 20px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.partner-card:hover {
    border-color: var(--admin-border-2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.partner-logo {
    width: 56px; height: 56px; border-radius: 12px;
    background: var(--admin-surface-3);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; margin-bottom: 12px;
    overflow: hidden;
}

.partner-logo img { width: 100%; height: 100%; object-fit: cover; }
.partner-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.partner-url  { font-size: 0.8rem; color: var(--admin-accent); text-decoration: none; }
.partner-url:hover { text-decoration: underline; }
.partner-desc { font-size: 0.82rem; color: var(--admin-text-muted); margin: 8px 0 14px; }
.partner-actions { display: flex; gap: 8px; }

/* ── Settings Section ────────────────────── */
.settings-section {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    padding: 26px;
    margin-bottom: 20px;
}

.settings-section-title {
    font-size: 0.9rem; font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem;
}

/* ── Content Editor Grid ─────────────────── */
.content-grid {
    display: grid; gap: 16px;
}

.content-item {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    padding: 20px;
}

.content-key {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--admin-accent); margin-bottom: 8px;
}

/* ── FAQ ─────────────────────────────────── */
.faq-item-admin {
    background: var(--admin-surface-2);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-card);
    padding: 18px 20px;
    margin-bottom: 12px;
    display: flex; align-items: flex-start; gap: 14px;
    transition: border-color var(--transition-fast);
}

.faq-item-admin:hover { border-color: var(--admin-border-2); }

.faq-drag-handle {
    color: var(--admin-text-dim); font-size: 18px; cursor: grab; padding-top: 2px;
    flex-shrink: 0;
}

.faq-content { flex: 1; }
.faq-question { font-weight: 650; margin-bottom: 6px; font-size: 0.96rem; }
.faq-answer   { font-size: 0.9rem; color: var(--admin-text-muted); line-height: 1.6; white-space: pre-wrap; }
.faq-actions  { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Message Detail ──────────────────────── */
.msg-detail-header {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--admin-border);
    margin-bottom: 16px;
}

.msg-from { font-weight: 700; font-size: 1rem; }
.msg-meta { font-size: 0.8rem; color: var(--admin-text-muted); margin-top: 2px; }

.msg-body {
    background: var(--admin-surface-3);
    border-radius: 10px;
    padding: 16px;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--admin-text-muted);
    white-space: pre-wrap;
}

/* ── Pagination ──────────────────────────── */
.pagination {
    display: flex; align-items: center; gap: 6px;
    justify-content: center; padding: 16px 0 0;
}

.page-btn {
    padding: 7px 12px; border-radius: 7px;
    background: var(--admin-surface-3);
    border: 1px solid var(--admin-border);
    color: var(--admin-text-muted); font-size: 0.82rem;
    cursor: pointer; transition: all var(--transition-fast);
}

.page-btn:hover  { background: var(--admin-surface-4); color: var(--admin-text); }
.page-btn.active { background: var(--admin-accent-dim); color: var(--admin-accent); border-color: rgba(34,197,94,0.25); font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Empty State ─────────────────────────── */
.empty-state {
    text-align: center; padding: 60px 24px;
    color: var(--admin-text-muted);
}

.empty-icon { font-size: 48px; opacity: 0.4; margin-bottom: 14px; }
.empty-title { font-weight: 700; font-size: 1rem; margin-bottom: 6px; color: var(--admin-text); }
.empty-msg   { font-size: 0.875rem; margin-bottom: 20px; }

/* ── Top Posts mini-list ─────────────────── */
.top-posts { display: flex; flex-direction: column; gap: 10px; }

.top-post-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: var(--admin-surface-3);
    border-radius: 9px;
}

.top-post-rank {
    font-size: 0.72rem; font-weight: 800; color: var(--admin-accent);
    width: 20px; text-align: center; flex-shrink: 0;
}

.top-post-title { flex: 1; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-post-views { font-size: 0.78rem; color: var(--admin-text-muted); white-space: nowrap; }

/* ── Dashboard bottom grid ───────────────── */
.dashboard-grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--admin-surface-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--admin-surface-3); }

/* ── Responsive ──────────────────────────── */
@media (max-width: 1024px) {
    :root { --sidebar-w: 64px; }
    .sidebar-brand, .nav-label, .nav-badge, .nav-section-label, .user-info { opacity: 0; max-width: 0; }
    .dashboard-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .main-content { padding: 20px 16px 32px; }
    .form-row { grid-template-columns: 1fr; }
    .editor-split { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .partner-grid { grid-template-columns: 1fr; }
    .dashboard-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .login-card { padding: 30px 20px; }
}
