/*
 * Əhli-Dəvət — Admin panel styles
 * Modern dashboard system (Linear/Vercel/Stripe-inspired).
 * Deep Islamic green primary, gold accent used sparingly.
 * Light/dark via [data-theme] override (user toggle). WCAG AA.
 */

:root {
    /* Brand */
    --brand-primary: #01331C;          /* deep Islamic green */
    --brand-primary-deep: #012413;
    --brand-secondary: #0E5C3F;        /* secondary green */
    --brand-mint: #34D399;
    --brand-gold: #C8A24B;             /* gold accent — sparing */
    --brand-gold-soft: #E0C57E;

    /* Surfaces (light) */
    --bg: #F6F7F5;
    --bg-alt: #EFF1ED;
    --surface: #FFFFFF;
    --surface-elevated: #FFFFFF;

    /* Text (light) */
    --text: #1A1F1C;
    --text-secondary: #4A554E;
    --text-tertiary: #8A948D;

    --border: #E4E8E3;
    --border-strong: #D2D8D0;

    /* Accent ring (focus) */
    --ring: rgba(14, 92, 63, 0.30);
    --primary-soft: rgba(1, 51, 28, 0.08);
    --primary-soft-strong: rgba(1, 51, 28, 0.14);

    --danger: #DC2626;
    --danger-soft: rgba(220, 38, 38, 0.10);
    --warning: #B45309;
    --warning-soft: rgba(180, 83, 9, 0.12);
    --info: #2563EB;
    --info-soft: rgba(37, 99, 235, 0.10);
    --success: #0F8A4D;
    --success-soft: rgba(15, 138, 77, 0.12);

    --shadow-sm: 0 1px 2px rgba(16, 24, 20, 0.05), 0 1px 3px rgba(16, 24, 20, 0.04);
    --shadow-md: 0 4px 12px rgba(16, 24, 20, 0.08);
    --shadow-lg: 0 20px 48px rgba(16, 24, 20, 0.18);

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    --sidebar-w: 256px;
    --topbar-h: 60px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --brand-primary: #0E5C3F;
    --brand-primary-deep: #01331C;
    --brand-secondary: #0E5C3F;
    --brand-mint: #34D399;
    --brand-gold: #C8A24B;
    --brand-gold-soft: #E0C57E;

    --bg: #0E1512;
    --bg-alt: #131C18;
    --surface: #16201B;
    --surface-elevated: #1B2922;

    --text: #E6EAE7;
    --text-secondary: #AAB4AE;
    --text-tertiary: #76817A;

    --border: #243029;
    --border-strong: #324339;

    --ring: rgba(52, 211, 153, 0.35);
    --primary-soft: rgba(52, 211, 153, 0.10);
    --primary-soft-strong: rgba(52, 211, 153, 0.18);

    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --warning: #FBBF24;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --info: #60A5FA;
    --info-soft: rgba(96, 165, 250, 0.14);
    --success: #34D399;
    --success-soft: rgba(52, 211, 153, 0.14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
img { max-width: 100%; display: block; }
svg { display: block; }
::selection { background: var(--primary-soft-strong); }

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--ring);
    border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ============ Screen switch ============ */
.screen { display: none; }
.screen.active { display: flex; }

/* ============ Login ============ */
#loginScreen {
    width: 100%;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}
.login-bg {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(circle at 22% 28%, rgba(14, 92, 63, 0.16), transparent 50%),
        radial-gradient(circle at 80% 75%, rgba(200, 162, 75, 0.12), transparent 55%);
    filter: blur(50px);
    z-index: 0;
}
.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 408px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 38px 34px 26px;
    box-shadow: var(--shadow-lg);
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.brand-icon-lg {
    width: 60px;
    height: 60px;
    margin: 0 auto 14px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(140deg, var(--brand-primary), var(--brand-secondary));
    box-shadow: 0 8px 20px rgba(1, 51, 28, 0.30);
}
.login-brand h1 {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
    color: var(--text);
}
.login-brand p { margin: 0; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.login-footnote {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: 22px;
}

/* ============ Forms ============ */
.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 11px 13px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-tertiary); }
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: 0 0 0 3px var(--ring);
}
.field input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}
.field textarea {
    min-height: 130px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.55;
}
.field-arabic textarea {
    font-family: 'Amiri', serif;
    font-size: 19px;
    direction: rtl;
    text-align: right;
    line-height: 1.9;
}
.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 44px; }
.input-with-icon .icon-btn {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    background: transparent;
    width: 32px;
    height: 32px;
}
.error-msg {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    font-weight: 500;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.08s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
    white-space: nowrap;
}
.btn svg { flex-shrink: 0; }
.btn:active { transform: translateY(0.5px) scale(0.99); }
.btn-primary {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-primary-deep); box-shadow: var(--shadow-md); }
[data-theme="dark"] .btn-primary:hover { background: var(--brand-secondary); filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-alt); border-color: var(--brand-secondary); }
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { filter: brightness(0.92); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

.icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--bg-alt); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ============ Dashboard layout ============ */
#dashboardScreen {
    width: 100%;
    min-height: 100vh;
    display: none;
}
#dashboardScreen.active { display: flex; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}
.sidebar-head { padding: 4px 8px 18px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-icon-sm {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(140deg, var(--brand-primary), var(--brand-secondary));
}
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
}
.side-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.07em;
    padding: 16px 12px 6px;
}
.side-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    text-align: left;
    transition: background 0.13s var(--ease), color 0.13s var(--ease);
}
.side-link:hover { background: var(--bg-alt); color: var(--text); }
.side-link.active {
    background: var(--primary-soft-strong);
    color: var(--brand-primary);
    font-weight: 600;
}
[data-theme="dark"] .side-link.active { color: var(--brand-mint); }
.side-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.9;
}

.side-foot { padding-top: 14px; margin-top: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
/* Logout: align its icon + label with the sidebar nav items (left, not centered) */
#logoutBtn { justify-content: flex-start; gap: 11px; padding: 10px 12px; }
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    background: var(--bg-alt);
    border-radius: var(--radius-md);
}
.user-avatar {
    width: 34px; height: 34px;
    flex-shrink: 0;
    background: linear-gradient(140deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-tertiary); }

.content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    height: var(--topbar-h);
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 max(24px, calc((100% - 1340px) / 2));
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.topbar h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    flex: 1;
    letter-spacing: -0.01em;
}
.topbar-actions { display: flex; gap: 6px; }
.topbar-menu { display: none; }

/* theme icon swap */
.theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: none; }
[data-theme="dark"] .theme-moon { display: block; }

/* Pages */
.page { display: none; padding: 26px max(24px, calc((100% - 1340px) / 2)) 60px; flex: 1; width: 100%; }
.page.active { display: block; animation: pageIn 0.2s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
    cursor: pointer;
}
.stat-card--static { cursor: default; }
.stat-card:not(.stat-card--static):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.stat-text { min-width: 0; }
.stat-card .label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.stat-card .num {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.stat-card .ico {
    width: 44px; height: 44px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(140deg, var(--brand-primary), var(--brand-secondary));
}
.stat-card.gold .ico { background: linear-gradient(140deg, #A67C2E, var(--brand-gold)); }
.stat-card.mint .ico { background: linear-gradient(140deg, var(--brand-secondary), var(--brand-mint)); }
.stat-card.violet .ico { background: linear-gradient(140deg, #6D28D9, #A855F7); }
.stat-card.amber .ico { background: linear-gradient(140deg, #B45309, #F59E0B); }
.stat-card.blue .ico { background: linear-gradient(140deg, #1E40AF, #3B82F6); }

/* Panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-head {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-body { padding: 16px 20px; }

/* Toolbar */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    align-items: center;
}
.toolbar .search {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}
.toolbar .search-ico {
    position: absolute;
    left: 13px;
    color: var(--text-tertiary);
    pointer-events: none;
}
.toolbar .search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.toolbar .search input::placeholder { color: var(--text-tertiary); }
.toolbar .search input:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: 0 0 0 3px var(--ring);
}
.toolbar select {
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text);
    min-width: 170px;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.toolbar select:focus { outline: none; border-color: var(--brand-secondary); box-shadow: 0 0 0 3px var(--ring); }

/* Data list (table-like rows) */
.records {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.record {
    display: flex;
    gap: 16px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    transition: background 0.13s var(--ease);
}
.record:last-child { border-bottom: 0; }
.record:nth-child(even) { background: color-mix(in srgb, var(--bg-alt) 45%, transparent); }
.record:hover { background: var(--bg-alt); }
.record-body { flex: 1; min-width: 0; }
.record-title {
    font-weight: 600;
    font-size: 14.5px;
    margin: 0 0 5px;
    color: var(--text);
}
.record-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}
.record-snippet {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.record-arabic {
    font-family: 'Amiri', serif;
    font-size: 18px;
    color: var(--brand-secondary);
    direction: rtl;
    text-align: right;
    margin-bottom: 6px;
    line-height: 1.7;
}
[data-theme="dark"] .record-arabic { color: var(--brand-mint); }
.record-actions {
    display: flex;
    gap: 4px;
    align-items: flex-start;
}

/* Status badges / tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    background: var(--primary-soft-strong);
    color: var(--brand-primary);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.4;
}
[data-theme="dark"] .tag { color: var(--brand-mint); }
.tag.warn    { background: var(--warning-soft); color: var(--warning); }
.tag.muted   { background: var(--bg-alt); color: var(--text-tertiary); }
.tag.success { background: var(--success-soft); color: var(--success); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}
.pagination button {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    transition: background 0.13s var(--ease), color 0.13s var(--ease), border-color 0.13s var(--ease);
}
.pagination button:hover:not(:disabled):not(.active) {
    background: var(--bg-alt);
    color: var(--text);
    border-color: var(--brand-secondary);
}
.pagination button.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: transparent;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Recent activity records (dashboard) reuse .record but stack */
#recentActivity .record { border-radius: 0; }
#recentActivity .record:first-child { border-top: 0; }

/* ============ Modal ============ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 14, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    animation: fadeIn 0.18s var(--ease);
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: zoomIn 0.18s var(--ease);
}
.modal-sm { max-width: 400px; }
.modal-head {
    padding: 17px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-body { padding: 22px; flex: 1; overflow-y: auto; }
.modal-foot {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.confirm-body { padding: 28px 24px 18px; text-align: center; }
.confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-soft);
    color: var(--danger);
}
.confirm-body h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.confirm-body p { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ Toast ============ */
.toasts {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-tertiary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    max-width: 360px;
    pointer-events: auto;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
    animation: slideIn 0.25s var(--ease);
}
.toast::before {
    content: "";
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}
.toast.success { border-left-color: var(--success); }
.toast.success::before { color: var(--success); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m20 6-11 11-5-5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m20 6-11 11-5-5'/%3E%3C/svg%3E"); }
.toast.error { border-left-color: var(--danger); }
.toast.error::before { color: var(--danger); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M15 9l-6 6M9 9l6 6'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M15 9l-6 6M9 9l6 6'/%3E%3C/svg%3E"); }
.toast.info { border-left-color: var(--info); }
.toast.info::before { color: var(--info); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============ Empty / loading states ============ */
.dim { color: var(--text-tertiary); text-align: center; padding: 30px 10px; font-size: 14px; }
.empty {
    text-align: center;
    padding: 56px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.empty .ico {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    color: var(--text-tertiary);
}
.empty h3 { margin: 0 0 6px; font-weight: 700; font-size: 16px; color: var(--text); }
.empty p { margin: 0; color: var(--text-secondary); font-size: 14px; }

.loading {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-tertiary);
    font-size: 14px;
}
.spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--border);
    border-top-color: var(--brand-secondary);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Responsive sidebar (drawer on mobile) ============ */
@media (max-width: 980px) {
    .sidebar {
        position: fixed;
        left: -290px;
        top: 0;
        z-index: 60;
        transition: left 0.25s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { left: 0; }
    .topbar-menu { display: inline-flex; }
    .content { width: 100%; }
}
@media (max-width: 980px) {
    /* dim overlay when drawer open */
    .sidebar.open::after {
        content: "";
        position: fixed;
        inset: 0 0 0 var(--sidebar-w);
        left: var(--sidebar-w);
        width: 100vw;
    }
}
@media (max-width: 560px) {
    .page { padding: 18px 16px 48px; }
    .topbar { padding: 0 16px; }
    .record { flex-direction: column; gap: 10px; }
    .record-actions { align-self: flex-end; }
    .toolbar .btn-primary span { display: none; }
    .toolbar .btn-primary { padding: 10px 12px; }
}
