/* =========================================================================
   Media Balans CMS — Modern SaaS design system (Linear / Vercel inspired)
   ========================================================================= */

:root {
    /* Surfaces */
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #fbfbfc;
    --surface-hover: #f4f5f7;
    --glass: rgba(255, 255, 255, .85);

    /* Sidebar (light) */
    --sidebar-bg: #ffffff;
    --sidebar-border: #ececef;
    --sidebar-link: #52525b;
    --sidebar-link-hover-bg: #f4f5f7;
    --sidebar-active-bg: #eef2ff;
    --sidebar-active-text: #4338ca;

    /* Text */
    --text: #18181b;
    --text-soft: #3f3f46;
    --muted: #71717a;
    --faint: #a1a1aa;

    /* Borders */
    --border: #e4e4e7;
    --border-soft: #f0f0f2;
    --border-strong: #d4d4d8;

    /* Section accents */
    --accent-content: #6366f1;
    --accent-people: #10b981;
    --accent-media: #f59e0b;
    --accent-system: #f43f5e;

    /* Accent (indigo) */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --primary-ring: rgba(79, 70, 229, .16);

    /* Status */
    --green: #16a34a;   --green-bg: #ecfdf5;   --green-text: #15803d;
    --amber: #d97706;   --amber-bg: #fffbeb;   --amber-text: #b45309;
    --red: #dc2626;     --red-bg: #fef2f2;     --red-text: #b91c1c;
    --slate-bg: #f4f4f5; --slate-text: #52525b;

    /* Shape */
    --radius-sm: 7px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);

    /* Bootstrap overrides */
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-body-color: #18181b;
    --bs-border-color: #e4e4e7;
    --bs-border-radius: 10px;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html, body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -.018em; color: var(--text); }

/* Tabular figures for data (stats, tables, pager) */
.table, .stat-value, .pager-info, .badge, .status-pill { font-variant-numeric: tabular-nums; }

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

::selection { background: var(--primary-ring); }

/* ---- Scrollbar ---- */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b4b4bb; background-clip: content-box; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: .9rem;
    padding: .5rem .9rem;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:active { transform: translateY(.5px); }
.btn i { font-size: 1rem; line-height: 1; }
.btn-sm { padding: .35rem .6rem; font-size: .82rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .65rem 1.1rem; font-size: 1rem; }

.btn-primary {
    background-image: linear-gradient(180deg, #5b52e8, var(--primary));
    background-color: var(--primary); border-color: var(--primary); color: #fff;
    box-shadow: 0 1px 2px rgba(79, 70, 229, .25), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-primary:hover, .btn-primary:focus { background-image: none; background-color: var(--primary-dark); border-color: var(--primary-dark); color: #fff; box-shadow: 0 2px 8px rgba(79, 70, 229, .3); }
.btn-primary:active { background-image: none; background-color: var(--primary-dark) !important; border-color: var(--primary-dark) !important; box-shadow: 0 1px 2px rgba(79, 70, 229, .25); }

.btn-outline-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-soft);
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    background: var(--surface-hover);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-outline-primary { border-color: var(--border); color: var(--primary); background: var(--surface); }
.btn-outline-primary:hover, .btn-outline-primary:focus { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

.btn-outline-danger { border-color: var(--border); color: var(--red-text); background: var(--surface); }
.btn-outline-danger:hover, .btn-outline-danger:focus { background: var(--red-bg); border-color: var(--red); color: var(--red-text); }

.btn-light { background: var(--surface); border-color: var(--border); color: var(--text-soft); }
.btn-light:hover { background: var(--surface-hover); }

.btn-link { color: var(--primary); font-weight: 500; }

/* Icon-only button (table actions) */
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon i { font-size: .95rem; }

/* =========================================================================
   Cards
   ========================================================================= */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}
.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    font-weight: 600;
    font-size: .92rem;
    color: var(--text);
    padding: .85rem 1.15rem;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}
.card-body { padding: 1.15rem; }

/* =========================================================================
   Forms / inputs
   ========================================================================= */
.form-label {
    font-weight: 500;
    font-size: .82rem;
    color: var(--text-soft);
    margin-bottom: .35rem;
}
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    color: var(--text);
    background-color: var(--surface);
    padding: .5rem .7rem;
    font-size: .9rem;
    box-shadow: var(--shadow-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control::placeholder { color: var(--faint); }
.form-control:hover, .form-select:hover { border-color: var(--border-strong); }
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-control:disabled, .form-select:disabled { background: var(--surface-2); color: var(--muted); }
.form-control-sm, .form-select-sm { padding: .35rem .55rem; font-size: .82rem; }
textarea.form-control { line-height: 1.55; }

.input-group-text { background: var(--surface-2); border-color: var(--border); color: var(--muted); border-radius: var(--radius-sm); }

/* Checkboxes / switches */
.form-check-input { border-color: #cbcbd2; box-shadow: none; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.form-check-label { font-size: .9rem; color: var(--text-soft); }
.form-switch .form-check-input { width: 2.3em; height: 1.25em; }

.form-text { color: var(--muted); font-size: .8rem; }

/* Validation */
.validation-message, .invalid-feedback { color: var(--red-text); font-size: .8rem; margin-top: .25rem; }
.invalid.form-control, .form-control.invalid, .modified.invalid { border-color: var(--red); }

/* =========================================================================
   Tables
   ========================================================================= */
.table {
    --bs-table-hover-bg: var(--surface-hover);
    --bs-table-bg: transparent;
    color: var(--text);
    margin-bottom: 0;
}
.table > thead th {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 600;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    padding: .7rem 1rem;
    white-space: nowrap;
}
.table > tbody td {
    border-color: var(--border-soft);
    padding: .8rem 1rem;
    vertical-align: middle;
    font-size: .9rem;
}
.table > tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr { transition: background-color .1s ease; }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: var(--surface-hover); }

/* Table wrapped in a card */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }

/* =========================================================================
   Badges & status pills
   ========================================================================= */
.badge {
    font-weight: 600;
    border-radius: 999px;
    padding: .32em .7em;
    font-size: .72rem;
    letter-spacing: .01em;
}
.badge.bg-success { background: var(--green-bg) !important; color: var(--green-text) !important; }
.badge.bg-secondary { background: var(--slate-bg) !important; color: var(--slate-text) !important; }
.badge.bg-danger { background: var(--red-bg) !important; color: var(--red-text) !important; }
.badge.bg-warning { background: var(--amber-bg) !important; color: var(--amber-text) !important; }
.badge.bg-light { background: var(--surface-2) !important; color: var(--text-soft) !important; border: 1px solid var(--border); }
.badge.bg-primary { background: var(--primary-soft) !important; color: var(--primary-dark) !important; }

/* Status pill with leading dot */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .76rem;
    font-weight: 600;
    padding: .28rem .65rem;
    border-radius: 999px;
    line-height: 1;
}
.status-pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; opacity: .9; }
.status-pill.is-on { background: var(--green-bg); color: var(--green-text); }
.status-pill.is-off { background: var(--slate-bg); color: var(--slate-text); }
.status-pill.is-warn { background: var(--amber-bg); color: var(--amber-text); }

/* =========================================================================
   Layout shell
   ========================================================================= */
.admin-shell { display: flex; min-height: 100vh; background: var(--bg); }

.admin-sidebar {
    width: 252px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: .85rem .65rem 1.5rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .brand {
    display: flex; align-items: center; gap: .6rem;
    font-weight: 750; font-size: 1.02rem; color: var(--text);
    padding: .4rem .7rem 1rem; line-height: 1.1;
}
.admin-sidebar .brand .brand-mark {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), #7c6cf0);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: .95rem; font-weight: 700; box-shadow: var(--shadow-sm);
}
.admin-sidebar .brand small { display: block; font-size: .62rem; letter-spacing: .22em; color: var(--faint); font-weight: 600; margin-top: 2px; }

.admin-sidebar .nav-section {
    font-size: .66rem; text-transform: uppercase; letter-spacing: .07em;
    color: var(--faint); padding: 1rem .8rem .35rem; font-weight: 700;
}
.admin-sidebar .nav-link {
    position: relative;
    color: var(--sidebar-link);
    padding: .5rem .75rem;
    display: flex; align-items: center; gap: .65rem;
    font-size: .885rem; font-weight: 500;
    border-radius: var(--radius-sm);
    margin-bottom: 1px;
    transition: background-color .12s ease, color .12s ease;
}
.admin-sidebar .nav-link i { width: 1.15rem; text-align: center; font-size: 1.02rem; color: var(--faint); transition: color .12s ease; }
.admin-sidebar .nav-link:hover { background: var(--sidebar-link-hover-bg); color: var(--text); }
.admin-sidebar .nav-link:hover i { color: var(--muted); }
.admin-sidebar .nav-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; }
.admin-sidebar .nav-link.active i { color: var(--sidebar-active-text); }
.admin-sidebar .nav-link.active::before {
    content: ""; position: absolute; left: -.65rem; top: 50%; transform: translateY(-50%);
    width: 3px; height: 1.1rem; border-radius: 0 3px 3px 0; background: var(--primary);
}

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    display: flex; align-items: center; gap: 1rem;
    padding: .7rem 1.75rem;
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
    min-height: 58px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.admin-content { padding: 1.85rem 1.75rem; max-width: 1320px; width: 100%; animation: page-in .26s ease-out; }

@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .admin-content { animation: none; } }

.topbar-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.topbar-user { font-size: .84rem; color: var(--text-soft); font-weight: 500; }
.topbar-divider { width: 1px; height: 22px; background: var(--border); }

.locale-switch { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; }
.locale-switch .btn {
    padding: .22rem .65rem; font-size: .78rem; text-transform: uppercase;
    font-weight: 600; border: 0; border-radius: 5px; box-shadow: none; color: var(--muted);
}
.locale-switch .btn.btn-primary { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow-sm); }
/* Active locale in the per-item editing switcher: vivid solid so it clearly stands out. */
.locale-switch .btn.locale-current { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); font-weight: 600; }
.locale-switch .btn.locale-current i { font-size: .85rem; }
.locale-switch .btn.btn-outline-secondary { background: transparent; }
.locale-switch .btn.btn-outline-secondary:hover { background: transparent; color: var(--text); }
.locale-switch .btn:disabled { opacity: 1; cursor: default; }
.locale-switch .btn.locale-missing { color: var(--muted); opacity: .7; border: 1px dashed var(--border); }
.locale-switch .btn.locale-missing:hover { opacity: 1; color: var(--text); }

/* Per-item "Editing language" switcher used on content Edit pages */
.locale-editing { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.locale-editing-label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.locale-editing-hint { font-size: .75rem; color: var(--amber-text); }

/* =========================================================================
   Page header (shared component)
   ========================================================================= */
.page-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header .page-titles { min-width: 0; }
.page-header h1 { font-size: 1.5rem; margin: 0; font-weight: 680; }
.page-header .page-subtitle { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }
.page-header .page-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.breadcrumbs { font-size: .8rem; color: var(--muted); margin-bottom: .4rem; display: flex; gap: .4rem; align-items: center; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }

/* Toolbar / filter bar */
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.toolbar .search-box { position: relative; flex: 1 1 280px; max-width: 380px; }
.toolbar .search-box i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: .95rem; pointer-events: none; }
.toolbar .search-box .form-control { padding-left: 2.1rem; }

/* =========================================================================
   Empty state (shared component)
   ========================================================================= */
.empty-state { text-align: center; padding: 3.25rem 1.5rem; color: var(--muted); }
.empty-state .empty-icon {
    width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 1rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--faint); font-size: 1.5rem;
}
.empty-state h3 { font-size: 1.05rem; color: var(--text); margin-bottom: .35rem; }
.empty-state p { font-size: .9rem; margin-bottom: 1.1rem; }

/* =========================================================================
   Sticky form footer (save bar)
   ========================================================================= */
.form-footer {
    display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
    padding: .85rem 1.15rem;
    margin-top: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.form-footer .footer-hint { color: var(--muted); font-size: .82rem; margin-right: auto; }

/* Collapsible section header (e.g. SEO) */
.section-toggle { background: none; border: 0; padding: 0; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: .4rem; }
.section-toggle .chev { transition: transform .15s ease; color: var(--muted); font-size: .8rem; }
.section-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* =========================================================================
   Loading skeleton / spinner
   ========================================================================= */
.loading-row { display: flex; align-items: center; gap: .6rem; color: var(--muted); padding: 1.25rem; font-size: .9rem; }
.spinner-ring { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, #f0f0f2 25%, #f7f7f9 37%, #f0f0f2 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* =========================================================================
   Pagination (shared)
   ========================================================================= */
.pager { display: flex; align-items: center; gap: .85rem; margin-top: 1.1rem; }
.pager .pager-info { color: var(--muted); font-size: .82rem; }
.pager .pager-controls { margin-left: auto; display: flex; gap: .35rem; }

/* =========================================================================
   Alerts
   ========================================================================= */
.alert { border-radius: var(--radius); font-size: .9rem; border: 1px solid transparent; }
.alert-danger { background: var(--red-bg); border-color: #fecaca; color: var(--red-text); }
.alert-light { background: var(--surface); border-color: var(--border); color: var(--text-soft); }
.alert-warning { background: var(--amber-bg); border-color: #fde68a; color: var(--amber-text); }
.alert-success { background: var(--green-bg); border-color: #bbf7d0; color: var(--green-text); }

/* =========================================================================
   Rich text editor
   ========================================================================= */
.rte .ql-toolbar { border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); border-color: var(--border); background: var(--surface-2); }
.rte .ql-container { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); border-color: var(--border); min-height: 180px; font-size: .95rem; }
.rte .ql-editor { min-height: 180px; }
.rte .ql-editor.ql-blank::before { color: var(--faint); font-style: normal; }

/* =========================================================================
   File manager / image picker
   ========================================================================= */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.file-card { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: border-color .12s ease, box-shadow .12s ease; }
.file-card.selectable { cursor: pointer; }
.file-card.selectable:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.file-thumb { height: 118px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb i { font-size: 2rem; color: var(--faint); }
.file-meta { padding: .5rem .6rem; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-del { position: absolute; top: .4rem; right: .4rem; padding: .1rem .35rem; }

.image-picker-preview { width: 96px; height: 96px; border: 1px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-2); flex-shrink: 0; }
.image-picker-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-picker-preview i { font-size: 1.6rem; color: var(--faint); }

/* =========================================================================
   Modal
   ========================================================================= */
.rte-modal-backdrop { position: fixed; inset: 0; background: rgba(24, 24, 27, .45); backdrop-filter: blur(2px); z-index: 1050; }
.rte-modal { position: fixed; top: 5vh; left: 50%; transform: translateX(-50%); width: min(920px, 92vw); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: var(--radius-lg); z-index: 1060; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.rte-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--border); }
.rte-modal-body { padding: 1.35rem; }

/* =========================================================================
   Toasts
   ========================================================================= */
.toast-host { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 1080; display: flex; flex-direction: column; gap: .6rem; max-width: 380px; }
.mb-toast { display: flex; align-items: flex-start; gap: .65rem; min-width: 290px; padding: .8rem .95rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--muted); box-shadow: var(--shadow-lg); font-size: .88rem; animation: mb-toast-in .2s ease-out; }
.mb-toast-icon { font-size: 1.1rem; line-height: 1.35; }
.mb-toast-body { flex: 1; color: var(--text); }
.mb-toast-title { font-weight: 600; margin-bottom: .1rem; }
.mb-toast-close { border: 0; background: transparent; color: var(--faint); padding: 0 .15rem; font-size: .8rem; line-height: 1; cursor: pointer; }
.mb-toast-close:hover { color: var(--text); }
.mb-toast-success { border-left-color: var(--green); } .mb-toast-success .mb-toast-icon { color: var(--green); }
.mb-toast-error { border-left-color: var(--red); } .mb-toast-error .mb-toast-icon { color: var(--red); }
.mb-toast-warning { border-left-color: var(--amber); } .mb-toast-warning .mb-toast-icon { color: var(--amber); }
.mb-toast-info { border-left-color: var(--primary); } .mb-toast-info .mb-toast-icon { color: var(--primary); }
@keyframes mb-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* =========================================================================
   Dashboard stat cards
   ========================================================================= */
.stat-card { border-radius: var(--radius-lg); transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.stat-card .stat-icon { width: 42px; height: 42px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; background: var(--primary-soft); color: var(--primary); }
.stat-card .stat-value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-card .stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }

/* =========================================================================
   Login
   ========================================================================= */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: radial-gradient(1200px 600px at 50% -10%, #eef2ff 0%, var(--bg) 55%); }
.login-card { background: var(--surface); padding: 2.5rem 2.25rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); width: 100%; max-width: 400px; }
.login-card .brand-mark { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), #7c6cf0); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.25rem; margin-bottom: 1.1rem; box-shadow: var(--shadow-md); }

/* =========================================================================
   Helpers
   ========================================================================= */
.text-muted { color: var(--muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.cell-primary { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: .8rem; }

#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1100; }

/* =========================================================================
   Section accents (sidebar icon tints by group)
   ========================================================================= */
.nav-group[data-accent="content"] { --group-accent: var(--accent-content); }
.nav-group[data-accent="people"]  { --group-accent: var(--accent-people); }
.nav-group[data-accent="media"]   { --group-accent: var(--accent-media); }
.nav-group[data-accent="system"]  { --group-accent: var(--accent-system); }
.nav-group .nav-link i { color: var(--group-accent); opacity: .82; }
.nav-group .nav-link:hover i { opacity: 1; }
.nav-group .nav-link.active i { color: var(--group-accent); opacity: 1; }
.nav-group .nav-link.active::before { background: var(--group-accent); }
.nav-group[data-accent] .nav-section::before {
    content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--group-accent); margin-right: .45rem; vertical-align: middle; opacity: .7;
}

/* =========================================================================
   Mobile nav (hamburger + backdrop)
   ========================================================================= */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 991.98px) {
    .admin-sidebar { position: fixed; left: 0; top: 0; z-index: 1040; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
    .admin-sidebar.open { transform: translateX(0); }
    .nav-toggle { display: inline-flex; }
    .nav-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(24, 24, 27, .45); backdrop-filter: blur(2px); z-index: 1035; animation: mb-toast-in .15s ease-out; }
    .admin-content { padding: 1.25rem; }
    .page-header h1 { font-size: 1.3rem; }
}

/* =========================================================================
   Dashboard — quick actions + mini bars
   ========================================================================= */
.quick-action {
    display: flex; align-items: center; gap: .8rem; width: 100%;
    padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--surface); color: var(--text); text-align: left;
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); color: var(--text); }
.quick-action .qa-icon { width: 38px; height: 38px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.quick-action .qa-title { font-weight: 600; font-size: .92rem; }
.quick-action .qa-sub { color: var(--muted); font-size: .78rem; }
.quick-action .qa-arrow { margin-left: auto; color: var(--faint); transition: transform .14s ease, color .14s ease; }
.quick-action:hover .qa-arrow { transform: translateX(3px); color: var(--primary); }

.mini-bar { display: grid; grid-template-columns: 2.5rem 1fr 2rem; align-items: center; gap: .65rem; margin-bottom: .7rem; }
.mini-bar:last-child { margin-bottom: 0; }
.mini-bar .mb-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.mini-bar .mb-track { height: 8px; border-radius: 999px; background: var(--surface-hover); overflow: hidden; }
.mini-bar .mb-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #7c6cf0); transition: width .5s ease; }
.mini-bar .mb-value { font-size: .82rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* =========================================================================
   Dark theme
   ========================================================================= */
[data-theme="dark"] {
    --bg: #0d0f13;
    --surface: #16181d;
    --surface-2: #1b1e24;
    --surface-hover: #21242b;
    --glass: rgba(22, 24, 29, .82);

    --sidebar-bg: #121419;
    --sidebar-border: #24262d;
    --sidebar-link: #a1a1aa;
    --sidebar-link-hover-bg: #1d2026;
    --sidebar-active-bg: rgba(99, 102, 241, .18);
    --sidebar-active-text: #c7d2fe;

    --text: #f4f4f5;
    --text-soft: #d4d4d8;
    --muted: #9b9ba4;
    --faint: #6b6b75;

    --border: #2a2d35;
    --border-soft: #23262d;
    --border-strong: #3a3d47;

    --primary: #6366f1;
    --primary-dark: #818cf8;
    --primary-soft: rgba(99, 102, 241, .16);
    --primary-ring: rgba(99, 102, 241, .28);

    --green-bg: rgba(22, 163, 74, .16);   --green-text: #4ade80;
    --amber-bg: rgba(217, 119, 6, .16);    --amber-text: #fbbf24;
    --red-bg: rgba(220, 38, 38, .16);      --red-text: #f87171;
    --slate-bg: #26282f;                   --slate-text: #c4c4cc;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .35);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .6);

    --bs-body-color: #f4f4f5;
    --bs-border-color: #2a2d35;

    color-scheme: dark;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .btn-primary { background-image: linear-gradient(180deg, #6f72f5, var(--primary)); box-shadow: 0 1px 2px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.1); }
[data-theme="dark"] .btn-primary:hover { background-image: none; background-color: var(--primary-dark); color: #15151a; }
[data-theme="dark"] .alert-danger { border-color: rgba(248,113,113,.35); }
[data-theme="dark"] .alert-warning { border-color: rgba(251,191,36,.3); }
[data-theme="dark"] .alert-success { border-color: rgba(74,222,128,.3); }
[data-theme="dark"] .badge.bg-light { border-color: var(--border); }
[data-theme="dark"] .login-wrapper { background: radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,.14) 0%, var(--bg) 55%); }
[data-theme="dark"] *::-webkit-scrollbar-thumb { background: #3a3d47; background-clip: content-box; }
[data-theme="dark"] *::-webkit-scrollbar-thumb:hover { background: #4a4d57; background-clip: content-box; }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #1b1e24 25%, #22252c 37%, #1b1e24 63%); background-size: 400% 100%; }
[data-theme="dark"] #blazor-error-ui { background: #3a2e0a; color: #fde68a; }
/* Quill dark */
[data-theme="dark"] .rte .ql-snow .ql-stroke { stroke: var(--text-soft); }
[data-theme="dark"] .rte .ql-snow .ql-fill { fill: var(--text-soft); }
[data-theme="dark"] .rte .ql-snow .ql-picker { color: var(--text-soft); }

/* Theme menu (Light / Dark / System) */
.theme-menu { position: relative; }
.theme-toggle i { font-size: 1rem; }
.menu-backdrop { position: fixed; inset: 0; z-index: 1060; background: transparent; }
.theme-menu-pop {
    position: absolute; top: calc(100% + .4rem); right: 0; z-index: 1070;
    min-width: 168px; padding: .35rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    animation: menu-pop .14s ease-out;
}
@keyframes menu-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.theme-menu-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 700; padding: .35rem .6rem .25rem; }
.theme-menu-item {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    padding: .5rem .6rem; border: 0; background: transparent;
    border-radius: var(--radius-sm); color: var(--text-soft);
    font-size: .88rem; font-weight: 500; cursor: pointer; text-align: left;
    transition: background-color .1s ease, color .1s ease;
}
.theme-menu-item i:first-child { width: 1.1rem; text-align: center; color: var(--muted); }
.theme-menu-item .item-check { margin-left: auto; color: var(--primary); }
.theme-menu-item:hover { background: var(--surface-hover); color: var(--text); }
.theme-menu-item.active { color: var(--primary); font-weight: 600; }
.theme-menu-item.active i:first-child { color: var(--primary); }
