/*
 * ChurchConnect — Design System
 * ─────────────────────────────
 * Foundations: 9-level colour scale · 8px spacing grid
 *              12-column layout · WCAG 2.1 AA accessibility
 * Components:  Button · Form · Card · Badge · Modal · Sidebar
 *              Selection card · Upload zone · Toggle · Alert
 */

/* ─── Colour System (9 levels × semantic roles) ─────────────────── */
:root {
    /* Neutral scale — 50 (lightest) → 900 (darkest) */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Semantic colour aliases */
    --color-bg-primary: var(--gray-50);
    --color-bg-secondary: #FFFFFF;
    --color-text-primary: var(--gray-900);
    --color-text-secondary: var(--gray-600);
    --color-text-tertiary: var(--gray-500);
    --color-border: var(--gray-200);
    --color-border-strong: var(--gray-300);

    /* Brand (black — Tesla/Apple minimal) */
    --color-brand: #000000;
    --color-brand-hover: #1F2937;
    --color-brand-light: var(--gray-100);

    /* Status — 9-level bands (bg / text) */
    --color-success: #10B981;
    --color-success-bg: #D1FAE5;
    --color-success-text: #059669;

    --color-warning: #F59E0B;
    --color-warning-bg: #FEF3C7;
    --color-warning-text: #D97706;

    --color-danger: #EF4444;
    --color-danger-bg: #FEE2E2;
    --color-danger-text: #DC2626;

    --color-info: #3B82F6;
    --color-info-bg: #EFF6FF;
    --color-info-text: #1D4ED8;

    /* Badge-specific (status) */
    --badge-new-bg: #E0E7FF;
    --badge-new-text: #4338CA;
    --badge-in_progress-bg: var(--color-warning-bg);
    --badge-in_progress-text: var(--color-warning-text);
    --badge-resolved-bg: var(--color-success-bg);
    --badge-resolved-text: var(--color-success-text);
    --badge-overdue-bg: var(--color-danger-bg);
    --badge-overdue-text: var(--color-danger-text);

    /* ─── Typography ──────────────────────────────────────────────── */
    --font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;

    --text-xs: 0.75rem;
    /* 12px */
    --text-sm: 0.875rem;
    /* 14px */
    --text-md: 1rem;
    /* 16px */
    --text-lg: 1.125rem;
    /* 18px */
    --text-xl: 1.25rem;
    /* 20px */
    --text-2xl: 1.5rem;
    /* 24px */
    --text-3xl: 2rem;
    /* 32px */

    /* ─── 8-px Spacing Grid ───────────────────────────────────────── */
    --sp-1: 0.25rem;
    /*  4px */
    --sp-2: 0.5rem;
    /*  8px */
    --sp-3: 0.75rem;
    /* 12px */
    --sp-4: 1rem;
    /* 16px */
    --sp-5: 1.25rem;
    /* 20px */
    --sp-6: 1.5rem;
    /* 24px */
    --sp-8: 2rem;
    /* 32px */
    --sp-10: 2.5rem;
    /* 40px */
    --sp-12: 3rem;
    /* 48px */
    --sp-16: 4rem;
    /* 64px */

    /* ─── Radii ───────────────────────────────────────────────────── */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    /* ─── Elevation ───────────────────────────────────────────────── */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, .07);

    /* ─── Transitions ─────────────────────────────────────────────── */
    --t-micro: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --t-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --t-slide: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    /* ─── Z-Index Scale ─────────────────────────────────────────────── */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 1000;
    --z-modal: 2000;
    --z-toast: 3000;

    /* ─── Breakpoints (reference only — use in @media manually) ───── */
    /* --bp-sm: 640px;  --bp-md: 768px;  --bp-lg: 1024px;  --bp-xl: 1280px; */
}

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

body {
    font-family: var(--font-family);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

/* Focus ring — WCAG 2.1 AA */
:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

/* ─── 12-Column Grid Utility ─────────────────────────────────────── */
.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--sp-6);
}

.col-span-1 {
    grid-column: span 1;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-3 {
    grid-column: span 3;
}

.col-span-4 {
    grid-column: span 4;
}

.col-span-6 {
    grid-column: span 6;
}

.col-span-8 {
    grid-column: span 8;
}

.col-span-9 {
    grid-column: span 9;
}

.col-span-12 {
    grid-column: span 12;
}

/* ─── Layout Utilities ───────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: var(--sp-6);
}

.page-section {
    margin-bottom: var(--sp-6);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--sp-8);
}

.page-title {
    font-size: var(--text-2xl);
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-top: var(--sp-1);
}

/* ─── Glassmorphism Utility ──────────────────────────────────────── */
.glass-panel {
    background: rgba(255, 255, 255, .7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
}

/* ─── Animations ─────────────────────────────────────────────────── */
.slide-in {
    opacity: 0;
    transform: translateY(20px);
    animation: slideIn var(--t-slide) forwards;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Component: Button ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-6);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: var(--text-md);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--t-micro);
    white-space: nowrap;
    will-change: transform;
}

.btn:active {
    transform: scale(0.97);
}

/* Size modifier */
.btn-sm {
    padding: 6px 14px;
    font-size: var(--text-sm);
}

/* Primary */
.btn-primary {
    background: var(--color-brand);
    color: var(--color-bg-secondary);
    padding: var(--sp-4) var(--sp-6);
}

.btn-primary:hover {
    background: var(--color-brand-hover);
    box-shadow: var(--shadow-md);
}

/* Secondary */
.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

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

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid transparent;
}

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

/* Danger */
.btn-danger {
    background: transparent;
    color: var(--color-danger-text);
    border: 1px solid rgba(239, 68, 68, .3);
}

.btn-danger:hover {
    background: var(--color-danger-bg);
    border-color: rgba(239, 68, 68, .6);
}

/* Utility (pill inside wizard cards) */
.btn-utility {
    background: var(--color-bg-primary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    font-size: var(--text-sm);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-full);
}

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

/* Full-width modifier */
.btn-block {
    width: 100%;
    justify-content: center;
}

/* ─── Component: Form  ───────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--sp-6);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--sp-2);
}

.form-control {
    width: 100%;
    padding: var(--sp-4);
    font-size: var(--text-md);
    font-family: inherit;
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--t-micro), box-shadow var(--t-micro);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-brand-light);
}

.form-hint {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--sp-1);
    text-wrap-style: pretty;
}

.form-row {
    display: flex;
    gap: var(--sp-4);
    flex-wrap: wrap;
}

.form-row>* {
    flex: 1;
    min-width: 200px;
}

.form-section-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--sp-4);
}

/* ─── Component: Alert ───────────────────────────────────────────── */
.alert {
    padding: var(--sp-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--sp-6);
}

.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

/* ─── Component: Badge ───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-new {
    background: var(--badge-new-bg);
    color: var(--badge-new-text);
}

.badge-in_progress {
    background: var(--badge-in_progress-bg);
    color: var(--badge-in_progress-text);
}

.badge-resolved {
    background: var(--badge-resolved-bg);
    color: var(--badge-resolved-text);
}

.badge-overdue {
    background: var(--badge-overdue-bg);
    color: var(--badge-overdue-text);
}

/* ─── Component: Pill (tag/label) ───────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* Role-specific badge colours */
.role-super_admin {
    background: rgba(59, 130, 246, .1);
    color: #3b82f6;
}

.role-manager {
    background: rgba(16, 185, 129, .1);
    color: #10b981;
}

/* User role badge */
.user-role-badge {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

/* Module pill */
.module-pill {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

/* ─── Component: Card (admin list item) ─────────────────────────── */
.admin-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    margin-bottom: var(--sp-4);
}

/* ─── Component: Selection Card (wizard / role picker) ──────────── */
/* Base selection grid */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: var(--sp-4);
}

.selection-card {
    position: relative;
    cursor: pointer;
    display: flex;
    -webkit-tap-highlight-color: transparent;
}

.selection-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.selection-card-content {
    position: relative;
    width: 100%;
    padding: var(--sp-5) var(--sp-4);
    text-align: center;
    background: var(--color-bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--color-text-primary);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, .04), 0 0 3px rgba(0, 0, 0, .02);
    transition: transform var(--t-smooth), box-shadow var(--t-smooth),
        border-color var(--t-micro), background-color var(--t-micro);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

@media (hover: hover) {
    .selection-card:hover .selection-card-content {
        box-shadow: 0 6px 24px -4px rgba(0, 0, 0, .08), 0 0 4px rgba(0, 0, 0, .03);
        transform: translateY(-2px);
    }
}

.selection-card:active .selection-card-content {
    transform: scale(0.98) translateY(0);
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .08) inset, 0 0 2px rgba(0, 0, 0, .02);
}

.selection-card input:checked+.selection-card-content {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 1px var(--color-brand), 0 4px 12px rgba(0, 0, 0, .05);
}

.selection-card input:checked+.selection-card-content::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: var(--color-brand) url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 6L5 8.5L9.5 4' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
    border-radius: var(--radius-full);
    animation: checkPop .2s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

@keyframes checkPop {
    from { opacity: 0; transform: scale(0); }
    to   { opacity: 1; transform: scale(1); }
}

.selection-card input:focus-visible+.selection-card-content {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

/* "Other" variant */
.selection-card-content.is-other {
    background: var(--color-bg-primary);
    border: 1px dashed var(--color-border);
    box-shadow: none;
    color: var(--color-text-secondary);
    font-weight: 500;
}

@media (hover: hover) {
    .selection-card:hover .selection-card-content.is-other {
        border-color: var(--color-border-strong);
        background: var(--color-bg-secondary);
    }
}

.selection-card input:checked+.selection-card-content.is-other {
    border: 1px solid var(--color-brand);
    color: var(--color-brand);
    background: var(--color-bg-secondary);
    box-shadow: 0 0 0 1px var(--color-brand), 0 4px 12px rgba(0, 0, 0, .05);
}

/* Compact selection grid (admin forms) */
.select-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
}

.select-card {
    position: relative;
    cursor: pointer;
    display: block;
}

.select-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.select-card-inner {
    position: relative;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--sp-3);
    font-size: var(--text-sm);
    text-align: center;
    transition: all var(--t-micro);
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    height: 100%;
}

.select-card input:checked~.select-card-inner {
    border-color: var(--color-brand);
    background: rgba(0, 0, 0, .02);
    color: var(--color-brand);
    font-weight: 500;
}

.select-card input:checked~.select-card-inner::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: var(--color-brand) url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 6L5 8.5L9.5 4' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
    border-radius: var(--radius-full);
    animation: checkPop .2s cubic-bezier(.34, 1.56, .64, 1) forwards;
}

/* ─── Custom Checkbox Component ────────────────────────────────────── */
.custom-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    cursor: pointer;
    user-select: none;
    position: relative;
    margin-top: var(--sp-2);
}

.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-checkbox .checkmark {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    transition: all var(--t-micro);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.custom-checkbox .checkmark::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--t-micro);
    margin-top: -2px;
}

.custom-checkbox:hover input~.checkmark {
    border-color: var(--color-brand);
}

.custom-checkbox input:checked~.checkmark {
    background-color: var(--color-brand);
    border-color: var(--color-brand);
}

.custom-checkbox input:checked~.checkmark::after {
    transform: rotate(45deg) scale(1);
}

.custom-checkbox input:focus-visible~.checkmark {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.custom-checkbox-content {
    display: flex;
    flex-direction: column;
}

/* ─── Component: Wizard Selected-state Card ─────────────────────── */
.selected-state-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-4);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--t-micro);
}

.selected-state-label {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.selected-state-value {
    font-weight: 500;
    font-size: var(--text-md);
}

/* ─── Component: Collapsible ─────────────────────────────────────── */
.collapsible-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--t-smooth),
        margin-bottom var(--t-smooth),
        opacity var(--t-smooth);
    opacity: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.collapsible-wrapper.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-bottom: var(--sp-6);
}

.collapsible-inner {
    min-height: 0;
}

/* ─── Component: Modal ───────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-smooth);
    padding: var(--sp-4);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

body.modal-open {
    overflow: hidden;
}

.modal-content {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform var(--t-smooth);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    font-size: var(--text-2xl);
    line-height: 1;
    cursor: pointer;
    transition: color var(--t-micro);
}

.modal-close:hover {
    color: var(--color-text-primary);
}

.modal-body {
    padding: var(--sp-6);
    overflow-y: auto;
}

.modal-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-shrink: 0;
}

.modal-footer .smart-action-btn,
.modal-footer .smart-action-link {
    margin-left: auto;
}

.modal-footer .smart-action-link+.smart-action-btn {
    margin-left: 0;
}

.modal-divider {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: var(--sp-6) 0;
}

.modal-danger-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-danger-label {
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--sp-1);
}

.modal-danger-hint {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* ─── Component: Dropzone / Upload Zone ─────────────────────────── */
.dropzone,
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-8);
    text-align: center;
    background: var(--color-bg-secondary);
    cursor: pointer;
    transition: all var(--t-micro);
    position: relative;
    overflow: hidden;
}

.dropzone {
    margin-bottom: var(--sp-4);
}

.dropzone:hover,
.dropzone.dragover,
.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-brand);
    background: var(--color-brand-light);
}

/* Upload zone preview image */
.upload-zone img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-top: var(--sp-3);
    display: none;
    object-fit: cover;
    border: 1px solid var(--color-border);
}

/* ─── Component: File List (upload progress) ─────────────────────── */
.file-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: all var(--t-micro);
}

.file-item.upload-error {
    border-color: var(--color-danger);
    background: var(--color-danger-bg);
}

.file-info {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    flex: 1;
    min-width: 0;
}

.file-preview {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

.file-preview--text {
    background: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.file-progress {
    flex: 1;
    min-width: 0;
}

.file-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.file-name {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-percent {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.progress-bar-container {
    height: 4px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--color-info);
    width: 0%;
    transition: width .2s ease, background-color .3s;
    will-change: width;
    transform: translateZ(0);
}

.file-cancel-btn {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    font-size: var(--text-xl);
    cursor: pointer;
    padding: 0 var(--sp-2) 0 var(--sp-4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-cancel-btn:hover {
    color: var(--color-danger);
}

/* ─── Component: Toggle Switch ──────────────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    transition: .4s;
    border-radius: 24px;
}

.toggle-switch .slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.slider {
    background: var(--color-success);
}

.toggle-switch input:checked+.slider::before {
    transform: translateX(20px);
}

.toggle-switch input:focus-visible+.slider {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

/* ─── Component: Success Overlay ────────────────────────────────── */
.success-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg-primary);
    z-index: var(--z-toast);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-smooth);
}

.success-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.success-content {
    text-align: center;
    transform: scale(0.9);
    transition: transform var(--t-slide);
}

.success-overlay.active .success-content {
    transform: scale(1);
}

.success-icon-wrapper {
    margin: 0 auto var(--sp-6);
    width: 80px;
    height: 80px;
}

.success-checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: var(--color-success);
    stroke-miterlimit: 10;
    margin: 0 auto;
    box-shadow: inset 0 0 0 var(--color-success);
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
}

.success-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--color-success);
    fill: none;
    animation: stroke .6s cubic-bezier(.65, 0, .45, 1) forwards;
}

.success-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke .3s cubic-bezier(.65, 0, .45, 1) .8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {

    0%,
    100% {
        transform: none;
    }

    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill {
    100% {
        box-shadow: inset 0 0 0 30px var(--color-success-bg);
    }
}

/* ─── Component: Lightbox ────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-smooth);
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform var(--t-smooth);
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: var(--sp-6);
    right: var(--sp-6);
    background: rgba(255, 255, 255, .2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: var(--text-2xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Admin Layout ───────────────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg-primary);
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    z-index: 50;
    padding: var(--sp-6) var(--sp-4);
    border-radius: 0;
}

.sidebar-header {
    margin-bottom: var(--sp-8);
    padding: 0 var(--sp-2);
}

.sidebar-title {
    font-size: var(--text-xl);
    letter-spacing: -0.02em;
}

.sidebar-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-weight: 500;
    transition: all var(--t-micro);
}

.sidebar-link:hover {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.sidebar-link.active {
    background: var(--color-brand);
    color: var(--color-bg-secondary);
    box-shadow: var(--shadow-sm);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: var(--sp-6);
}

/* Main content */
.admin-main {
    flex: 1;
    min-width: 0;
    padding: var(--sp-8) var(--sp-6);
}

/* ─── Admin Page Patterns ────────────────────────────────────────── */
.dashboard-container {
    max-width: 1000px;
}

/* Two-panel (list + sticky form) layout */
.panel-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: var(--sp-8);
    align-items: start;
}

.panel-form {
    position: sticky;
    top: var(--sp-6);
}

/* User grid */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--sp-6);
}

/* Module selector */
.module-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-1);
}

/* ─── Admin-specific Components ──────────────────────────────────── */

/* Report card (reports list) */
.report-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    margin-bottom: var(--sp-4);
    display: grid;
    grid-template-columns: 150px 1fr 180px;
    cursor: pointer;
    gap: var(--sp-4);
    align-items: start;
    transition: box-shadow var(--t-smooth), border-color var(--t-micro), transform var(--t-smooth);
}

@media (hover: hover) {
    .report-card:hover {
        box-shadow: 0 6px 24px -4px rgba(0, 0, 0, .10), 0 0 4px rgba(0, 0, 0, .04);
        border-color: var(--color-border-strong);
        transform: translateY(-2px);
    }
}

.report-card:active {
    transform: scale(0.99) translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Media thumbnail */
.media-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--color-border);
}

.media-empty {
    width: 80px;
    height: 80px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    font-size: var(--text-xs);
}

.media-grid {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

/* Report meta text */
.report-meta {
    margin-top: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}


.report-title {
    font-size: var(--text-md);
    margin-bottom: var(--sp-1);
}

.report-body {
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    white-space: pre-wrap;
}

/* Status actions column */
.report-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    align-items: stretch;
    justify-content: space-between;
}

/* Smart action button (context-aware CTA) */
.smart-action-btn {
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-weight: 500;
    font-size: var(--text-sm);
    transition: all .2s cubic-bezier(.16, 1, .3, 1);
    white-space: nowrap;
    padding: var(--sp-3) var(--sp-5);
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.smart-action-btn:active {
    transform: scale(0.97);
}

.smart-action-btn.new {
    background: var(--color-brand);
    color: white;
}

.smart-action-btn.new:hover {
    background: var(--color-brand-hover);
}

.smart-action-btn.in_progress {
    background: var(--color-success);
    color: white;
}

.smart-action-btn.in_progress:hover {
    opacity: 0.9;
}

.smart-action-link {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    font-family: inherit;
    padding: var(--sp-2) 0;
    transition: color .2s;
}

.smart-action-link:hover {
    color: var(--color-text-primary);
}

/* State-visibility wrappers */
.show-on-new,
.show-on-in_progress,
.show-on-resolved {
    display: none !important;
}

.report-card[data-status="new"] .show-on-new {
    display: inline-flex !important;
}

.report-card[data-status="in_progress"] .show-on-in_progress {
    display: inline-flex !important;
}

.report-card[data-status="resolved"] .show-on-resolved {
    display: inline-flex !important;
}

/* Progressive details (assignee/notes) */
.progressive-details {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height .4s ease, opacity .3s ease, margin-top .3s ease, padding .3s ease;
    grid-column: 1 / -1;
    background: var(--color-bg-primary);
    border-radius: var(--radius-md);
}

.progressive-details.expanded {
    max-height: 3000px;
    opacity: 1;
    margin-top: var(--sp-5);
    padding: var(--sp-5);
    border: 1px solid var(--color-border);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .02);
}

.progressive-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--sp-2);
    display: block;
    letter-spacing: 0.02em;
}

.progressive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-6);
}

/* Assignee row inside progressive details */
.progressive-assignee {
    margin-bottom: var(--sp-6);
    max-width: 400px;
}

/* Notes section */
.notes-section {
    margin-bottom: var(--sp-2);
}

/* Notes timeline */
.notes-timeline {
    position: relative;
    margin-bottom: var(--sp-5);
}

.notes-empty {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    font-style: italic;
    margin-bottom: var(--sp-4);
}

/* Each note step */
.note-step {
    display: flex;
    gap: var(--sp-3);
    position: relative;
    padding-bottom: var(--sp-5);
}

.note-step::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 18px;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.note-step:last-child::before {
    display: none;
}

.note-step-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--color-brand);
    background: var(--color-bg-secondary);
    flex-shrink: 0;
    margin-top: 3px;
    position: relative;
    z-index: 1;
    transition: background .3s, border-color .3s;
}

/* Compose node: dashed ring to signal it's a draft */
.note-step-dot--compose {
    border-style: dashed;
    background: var(--color-bg-primary);
    opacity: 0.6;
}

.note-step-compose .note-compose-input {
    margin-top: var(--sp-2);
    resize: vertical;
    min-height: 80px;
}

.note-step--new .note-step-dot {
    background: var(--color-brand);
}

@keyframes note-appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.note-step--new {
    animation: note-appear .35s cubic-bezier(.16, 1, .3, 1);
}

.note-step-body {
    flex: 1;
    min-width: 0;
}

.note-step-meta {
    display: flex;
    align-items: baseline;
    gap: var(--sp-2);
    margin-bottom: var(--sp-1);
    flex-wrap: wrap;
}

.note-step-author {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
}

.note-step-time {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.note-step-text {
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Note compose area */
.note-compose {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    max-width: 600px;
}

.note-compose .note-input {
    resize: vertical;
    min-height: 64px;
}

.note-compose .note-submit-btn {
    align-self: flex-end;
}

.drawer-actions {
    margin-top: var(--sp-6);
    border-top: 1px solid var(--color-border);
    padding-top: var(--sp-4);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    align-items: center;
}

.closed-date {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-tertiary);
    margin-top: var(--sp-2);
    text-align: right;
}

/* Filter toolbar */
.filters-toolbar {
    display: flex;
    gap: var(--sp-4);
    flex-wrap: nowrap;
    align-items: center;
    margin-bottom: var(--sp-8);
    background: var(--color-bg-secondary);
    padding: var(--sp-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.filter-pill {
    position: relative;
    z-index: 2;
    cursor: pointer;
    padding: 6px 14px;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: color .3s;
    white-space: nowrap;
    color: var(--color-text-secondary);
    border: 1px solid transparent;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.filter-pill:hover {
    color: var(--color-text-primary);
}

.filter-pill.active {
    color: var(--color-text-primary);
}

.pill-tracker {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 0;
    background: var(--color-bg-primary);
    border-radius: calc(var(--radius-md) - 2px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    border: 1px solid var(--color-border);
    transition: transform .3s cubic-bezier(.25, 1, .5, 1), width .3s cubic-bezier(.25, 1, .5, 1);
    z-index: 1;
    pointer-events: none;
}

.pill-container {
    position: relative;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

/* Category select wrapper */
.category-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 150px;
    max-width: 280px;
    margin-left: auto;
}

.category-select-wrapper select {
    width: 100%;
    padding: 8px 32px 8px 34px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    cursor: pointer;
    appearance: none;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    transition: all .2s;
    font-family: inherit;
}

.category-select-wrapper select:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-brand-light);
}

.category-select-icon {
    position: absolute;
    pointer-events: none;
}

.category-select-icon--left {
    left: 12px;
}

.category-select-icon--right {
    right: 12px;
}

/* ─── Component: List Card (shared base) ────────────────────────── */
/* Shared by .officer-card, .location-card, .category-card.          */
/* Add class="list-card" directly, or use one of the aliases below.  */
.list-card,
.officer-card,
.location-card,
.category-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    transition: box-shadow var(--t-micro), border-color var(--t-micro);
}

.list-card:hover,
.officer-card:hover,
.location-card:hover,
.category-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--color-border-strong);
}

/* Semantic sub-elements — use these inside any list-card variant */
.list-card-title {
    font-size: var(--text-lg);
    font-weight: 500;
    margin-bottom: var(--sp-1);
}

.list-card-meta {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* ── Per-type overrides (one property each) ────────────────────── */

/* Location & category: actions column sits at the far end */
.location-card,
.category-card {
    justify-content: space-between;
    padding: var(--sp-5);
}

/* Officer: dim the whole card when toggled off */
.officer-card.inactive {
    opacity: 0.6;
}

/* Drag handle (inside draggable list cards) */
.drag-handle {
    color: var(--color-text-secondary);
    font-size: var(--text-lg);
    line-height: 1;
    margin-right: var(--sp-4);
    cursor: grab;
}

.list-card[draggable],
.location-card[draggable],
.category-card[draggable] {
    cursor: grab;
}

.officer-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--sp-3);
    margin-left: auto;
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .officer-actions {
        flex-direction: row;
        align-items: center;
        gap: var(--sp-4);
    }
}

/* Avatar */
.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    color: var(--color-text-tertiary);
    font-weight: 500;
    flex-shrink: 0;
}

/* Officer officer info panel (safety card, injected by JS) */
.officer-info {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-3);
    background: rgba(255, 255, 255, 1);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    transition: all var(--t-micro);
}

a.officer-info {
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

@media (hover: hover) {
    a.officer-info:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }
}

a.officer-info:active {
    transform: translateY(0) scale(0.98);
}

.officer-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.officer-initials {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

.officer-name {
    font-weight: 500;
    font-size: var(--text-md);
    margin-bottom: 2px;
}

.officer-phone {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* Officers grid container (injected by JS) */
.officers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sp-3);
}



/* Contact / email pill (inside list cards) */
.contact-pill,
.email-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: var(--sp-2);
}

/* Safety panel (incident) */
.safety-panel-inner {
    background: rgba(239, 68, 68, .05);
    padding: var(--sp-4);
    border-color: rgba(239, 68, 68, .2);
}

.safety-panel-title {
    color: var(--color-danger);
    margin-bottom: var(--sp-4);
    font-size: var(--text-md);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* User card (settings) */
.user-card {
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: var(--sp-4);
}

.user-last-active {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

/* Login */
.login-panel {
    width: 100%;
    max-width: 400px;
    padding: var(--sp-8);
}

/* Page header branding (index.php) */
.brand-header {
    text-align: center;
    margin-bottom: var(--sp-8);
}

.brand-logo {
    display: block;
    margin: 0 auto var(--sp-2);
    width: 64px;
}

.brand-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--sp-2);
}

.brand-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--text-lg);
}

/* Report Panel on index.php */
.report-panel {
    padding: var(--sp-8);
    margin-top: var(--sp-8);
}

/* Selection header label */
.selection-header {
    font-size: var(--text-xl);
    font-weight: 500;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
    margin-bottom: var(--sp-5);
    display: block;
}

/* Loading placeholder inside grid */
.grid-loading {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    text-align: center;
    grid-column: 1 / -1;
    padding: var(--sp-4);
}

/* ─── Utility: Scrollbar hide ────────────────────────────────────── */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container {
        padding: var(--sp-4);
    }
    
    .report-panel {
        padding: var(--sp-5);
        margin-top: var(--sp-6);
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: var(--sp-4);
    }

    .sidebar-header {
        margin-bottom: var(--sp-4);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: var(--sp-2);
        gap: var(--sp-2);
        mask-image: linear-gradient(to right, black 90%, transparent);
        -webkit-mask-image: linear-gradient(to right, black 90%, transparent);
    }

    .sidebar-link {
        white-space: nowrap;
    }

    .sidebar-footer {
        display: none;
    }

    .admin-main {
        padding: var(--sp-4);
    }

    .panel-layout {
        grid-template-columns: 1fr;
    }

    .report-card {
        grid-template-columns: 1fr;
    }

    .filters-toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: var(--sp-4) !important;
    }

    .category-select-wrapper {
        margin-left: 0 !important;
        max-width: none !important;
    }

    .filters-toolbar .divider {
        display: none !important;
    }
}

/* ─── Utility Classes ────────────────────────────────────────────── */
.hidden       { display: none !important; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.flex-grow    { flex-grow: 1; }
.text-center  { text-align: center; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Accessibility: Reduced Motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}