/* ===========================
   ZIA Admin — Design System
   =========================== */

:root {
    --primary:       #003d82;
    --primary-mid:   #0a5299;
    --primary-light: #1a7bbf;
    --accent:        #e67e22;
    --danger:        #dc2626;
    --danger-light:  #fef2f2;
    --success:       #16a34a;
    --success-light: #f0fdf4;
    --warning:       #d97706;
    --warning-light: #fffbeb;
    --sidebar-bg:    #0f172a;
    --sidebar-hover: rgba(255,255,255,.07);
    --sidebar-active:#1d4ed8;
    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --border:        #e2e8f0;
    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-light:    #94a3b8;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow:        0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:     0 8px 32px rgba(0,0,0,.14);
    --radius:        12px;
    --radius-sm:     8px;
    --radius-full:   9999px;
    --topnav-h:      64px;
    --sidebar-w:     250px;
    --transition:    0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* ── Top Navigation ─────────────────────────────── */
.admin-topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 200;
    gap: 1rem;
}

.topnav-left { display: flex; align-items: center; gap: 1rem; }

.sidebar-toggle {
    background: none; border: none;
    font-size: 1.2rem; color: var(--text-muted);
    cursor: pointer; padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

.logo { display: flex; align-items: center; gap: 0.6rem; }
.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1rem;
}
.logo h1 { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

.topnav-right { display: flex; align-items: center; gap: 0.75rem; }

.view-site-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 1rem;
    background: var(--primary); color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.8rem; font-weight: 600;
    text-decoration: none;
    transition: background var(--transition), opacity var(--transition);
    white-space: nowrap;
}
.view-site-btn:hover { background: var(--primary-mid); }
.view-site-btn i { font-size: 0.72rem; }
@media (max-width: 640px) { .view-site-btn { display: none; } }

.search-box { position: relative; }
.search-box i { position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.875rem; }
.search-box input {
    padding: 0.5rem 1rem 0.5rem 2.4rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    width: 260px; font-size: 0.875rem;
    background: var(--bg); color: var(--text);
    transition: border-color var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); background: var(--surface); }

.notification-btn {
    position: relative; background: none; border: none;
    font-size: 1.1rem; color: var(--text-muted); cursor: pointer;
    padding: 0.5rem; border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.notification-btn:hover { background: var(--bg); color: var(--text); }
.notification-btn .badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--danger); color: #fff;
    font-size: 0.65rem; font-weight: 700;
    padding: 0.15rem 0.35rem; border-radius: var(--radius-full);
    line-height: 1;
}

.admin-profile {
    display: flex; align-items: center; gap: 0.6rem;
    cursor: pointer; padding: 0.4rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    transition: border-color var(--transition), background var(--transition);
}
.admin-profile:hover { background: var(--bg); border-color: var(--primary); }
.admin-profile .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.8rem; font-weight: 700;
}
.admin-profile span { font-size: 0.875rem; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-profile i { font-size: 0.75rem; color: var(--text-muted); }

.logout-btn {
    background: none; border: none; cursor: pointer;
    color: var(--danger); padding: 0.5rem; border-radius: var(--radius-sm);
    font-size: 1rem; transition: background var(--transition);
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.875rem; font-weight: 600;
}
.logout-btn:hover { background: var(--danger-light); }

/* ── Layout ──────────────────────────────────────── */
.admin-container {
    display: flex;
    margin-top: var(--topnav-h);
    min-height: calc(100vh - var(--topnav-h));
}

/* ── Sidebar ─────────────────────────────────────── */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    left: 0; top: var(--topnav-h); bottom: 0;
    overflow-y: auto; overflow-x: hidden;
    transition: transform var(--transition), width var(--transition);
    z-index: 150;
    display: flex; flex-direction: column;
}

.sidebar-group-label {
    padding: 1.25rem 1.25rem 0.4rem;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,.3);
}

.sidebar-nav { display: flex; flex-direction: column; padding: 0.75rem 0; flex: 1; }

.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 0.875rem;
    padding: 0.7rem 1.25rem;
    color: rgba(255,255,255,.65);
    text-decoration: none; font-size: 0.875rem; font-weight: 500;
    border-radius: 0; transition: background var(--transition), color var(--transition);
    position: relative;
}
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active {
    background: rgba(29,78,216,.25);
    color: #fff;
    border-right: 3px solid #60a5fa;
}
.sidebar-nav .nav-link i { width: 18px; font-size: 0.95rem; flex-shrink: 0; }

.sidebar-nav .nav-link .count {
    margin-left: auto;
    background: rgba(255,255,255,.15); color: rgba(255,255,255,.9);
    padding: 0.15rem 0.5rem; border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 700;
}
.sidebar-nav .nav-link .count.red { background: var(--danger); }

.sidebar-divider { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 0.5rem 0; }

/* ── Main Content ────────────────────────────────── */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 1.75rem 2rem;
    min-width: 0;
}

.admin-section { display: none; animation: fadeUp 0.25s ease; }
.admin-section.active { display: block; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Section Header ──────────────────────────────── */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.section-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.header-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ── Stats Grid ──────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem; margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 1.4rem; box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex; gap: 1.1rem; align-items: flex-start;
    transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
    width: 52px; height: 52px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; color: #fff; flex-shrink: 0;
}

.stat-content h3 { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 0.25rem; }
.stat-content p { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.4rem; }
.stat-change { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.3rem; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ── Charts ──────────────────────────────────────── */
.charts-row {
    display: grid; grid-template-columns: 2fr 1fr;
    gap: 1.25rem; margin-bottom: 1.75rem;
}

.chart-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 1.4rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.chart-card h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }
.chart-card canvas { max-height: 260px; }

/* ── Activity ────────────────────────────────────── */
.activity-section {
    background: var(--surface); border-radius: var(--radius);
    padding: 1.4rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.activity-section h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }
.activity-list { display: flex; flex-direction: column; gap: 0.75rem; }
.activity-item {
    display: flex; gap: 0.875rem; align-items: flex-start;
    padding: 0.875rem; background: var(--bg);
    border-radius: var(--radius-sm);
}
.activity-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; flex-shrink: 0;
}
.activity-content p { font-size: 0.875rem; color: var(--text); margin-bottom: 0.15rem; }
.activity-content small { font-size: 0.78rem; color: var(--text-muted); }

/* ── Cards ───────────────────────────────────────── */
.card {
    background: var(--surface); border-radius: var(--radius);
    padding: 1.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}

/* ── Table ───────────────────────────────────────── */
.table-controls {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.25rem; gap: 0.875rem; flex-wrap: wrap;
}
.search-filter { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-filter i { position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.875rem; }
.search-filter input {
    width: 100%; padding: 0.6rem 1rem 0.6rem 2.4rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: border-color var(--transition);
}
.search-filter input:focus { outline: none; border-color: var(--primary); }

.filter-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-btn {
    padding: 0.45rem 0.9rem; border: 1.5px solid var(--border);
    background: var(--surface); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.8rem; font-weight: 500;
    transition: all var(--transition); color: var(--text-muted);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.data-table {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    overflow: hidden; overflow-x: auto;
}
.data-table table { width: 100%; border-collapse: collapse; min-width: 500px; }
.data-table thead { background: var(--bg); }
.data-table th {
    padding: 0.875rem 1rem; text-align: left;
    font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted);
    border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
.data-table td {
    padding: 0.875rem 1rem; border-bottom: 1px solid var(--border);
    font-size: 0.875rem; color: var(--text); vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }

/* ── Badges / Pills ──────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.2rem 0.65rem; border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-grey   { background: #f1f5f9; color: #64748b; }
.badge-purple { background: #ede9fe; color: #7c3aed; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.6rem 1.2rem; border: none; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
    transition: all var(--transition); text-decoration: none; white-space: nowrap;
    line-height: 1;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-mid); }

.btn-secondary { background: #f1f5f9; color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-icon {
    width: 34px; height: 34px; padding: 0;
    justify-content: center; border-radius: var(--radius-sm);
}

/* ── Inline form inside sections ─────────────────── */
.inline-form {
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.inline-form h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }

.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.form-field input,
.form-field select,
.form-field textarea {
    padding: 0.65rem 0.875rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.875rem; color: var(--text);
    transition: border-color var(--transition);
    width: 100%;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { outline: none; border-color: var(--primary); }
.form-field textarea { resize: vertical; min-height: 80px; }

.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 500;
    align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--surface); border-radius: var(--radius);
    width: 100%; max-width: 560px; max-height: 90vh;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: slideUp .2s ease;
}
.modal-box.modal-lg { max-width: 780px; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem;
    padding: 0.25rem; border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    display: flex; gap: 0.75rem; justify-content: flex-end;
}

/* ── Payment / Summary Cards ─────────────────────── */
.summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.summary-card { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.summary-card h4 { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }
.summary-card .amount { font-size: 1.6rem; font-weight: 700; color: var(--primary); }

/* ── Analytics ───────────────────────────────────── */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.analytics-card { background: var(--surface); border-radius: var(--radius); padding: 1.75rem 1.25rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); text-align: center; }
.analytics-card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.875rem; }
.metric-value { display: block; font-size: 2.5rem; font-weight: 700; color: var(--primary); line-height: 1; margin-bottom: 0.4rem; }
.metric-label { font-size: 0.8rem; color: var(--text-muted); }

/* ── Events grid ─────────────────────────────────── */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 1.25rem; }
.event-card {
    background: var(--surface); border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.event-card-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); padding: 1.25rem; color: #fff; }
.event-card-header h4 { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.event-card-header p { font-size: 0.8rem; opacity: 0.85; }
.event-card-body { padding: 1.25rem; }
.event-meta { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.event-meta span { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; }
.event-meta i { width: 14px; color: var(--primary); }
.event-card-footer { display: flex; gap: 0.5rem; padding: 0 1.25rem 1.25rem; flex-wrap: wrap; }

/* ── Settings ────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px,1fr)); gap: 1.25rem; }
.settings-card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.settings-card h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.setting-item { margin-bottom: 1rem; }
.setting-item label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 0.35rem; }
.setting-item input, .setting-item select {
    width: 100%; padding: 0.65rem 0.875rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.875rem;
}
.setting-item input:focus, .setting-item select:focus { outline: none; border-color: var(--primary); }

/* ── Period selector ─────────────────────────────── */
.period-selector {
    padding: 0.5rem 0.875rem; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface);
    font-size: 0.875rem; color: var(--text); cursor: pointer;
}

/* ── Pending count pill ──────────────────────────── */
.pending-count { background: var(--warning-light); color: var(--warning); padding: 0.35rem 0.875rem; border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 600; }

/* ── Upload progress ─────────────────────────────── */
.upload-progress {
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.upload-progress-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 600; }
.upload-progress-bar { height: 6px; background: var(--border); border-radius: var(--radius-full); overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--primary); width: 0; transition: width 0.3s; }

/* ── Media grid ──────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.media-card {
    background: var(--surface); border-radius: var(--radius-sm);
    border: 1px solid var(--border); overflow: hidden;
    box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
}
.media-card:hover { box-shadow: var(--shadow); }
.media-card-thumb { height: 120px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: var(--text-muted); }
.media-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-card-body { padding: 0.7rem; }
.media-card-name { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.15rem; }
.media-card-meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.media-card-actions { display: flex; gap: 0.3rem; }

/* ── Toast notifications ─────────────────────────── */
#toastContainer {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    display: flex; flex-direction: column; gap: 0.6rem;
    z-index: 9999; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.875rem 1.25rem; border-radius: var(--radius-sm);
    background: var(--text); color: #fff;
    box-shadow: var(--shadow-lg); font-size: 0.875rem; font-weight: 500;
    pointer-events: auto; min-width: 280px;
    animation: toastIn 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
.toast.warning { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1100px) {
    .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .admin-topnav { padding: 0 1rem; }
    .search-box { display: none; }
    .admin-main { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .modal-box { max-width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ── Image Upload Widget ──────────────────────── */
.img-upload-widget { display: flex; gap: 1rem; align-items: flex-start; }
.img-preview {
    width: 130px; min-height: 98px; flex-shrink: 0;
    border-radius: var(--radius-sm); border: 2px dashed var(--border);
    background: var(--bg); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-light); font-size: 1.8rem;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-upload-controls { flex: 1; display: flex; flex-direction: column; gap: .45rem; }
.img-upload-controls input[type="url"],
.img-upload-controls input[type="text"] { width: 100%; box-sizing: border-box; }
.img-status { font-size: .8rem; color: var(--text-muted); min-height: 1.1em; }
.img-status.uploading { color: var(--primary-light); font-weight: 600; }
.img-status.done  { color: var(--success); font-weight: 600; }
.img-status.err   { color: var(--danger);  font-weight: 600; }
@media (max-width: 640px) {
    .img-upload-widget { flex-direction: column; }
    .img-preview { width: 100%; min-height: 140px; }
}

/* ── Admin Calendar ──────────────────────────────── */
.cal-admin-notice {
    display: flex; align-items: center; gap: .75rem;
    padding: .85rem 1.1rem; margin-bottom: 1.5rem;
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm); font-size: .875rem; color: #1e40af;
}
.cal-admin-controls {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1rem;
}
.cal-admin-controls h2 { font-size: 1.2rem; font-weight: 700; color: var(--text); min-width: 180px; text-align: center; }
.cal-grid-header {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--primary); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    overflow: hidden;
}
.cal-grid-header span {
    padding: .55rem 0; text-align: center;
    font-size: .75rem; font-weight: 700; color: #fff;
    text-transform: uppercase; letter-spacing: .5px;
}
.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border); border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    overflow: hidden;
}
.cal-day {
    min-height: 110px; padding: .5rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    vertical-align: top; cursor: pointer;
    transition: background .15s;
}
.cal-day:hover { background: #f8fafc; }
.cal-day.other-month { background: var(--bg); }
.cal-day.other-month .cal-day-num { color: #c0cde0; }
.cal-day.today { background: #eff6ff; }
.cal-day.today .cal-day-num {
    background: var(--primary); color: #fff;
    border-radius: 50%; width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day-num { font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: .3rem; }
.cal-ev-chip {
    display: block; font-size: .7rem; font-weight: 600;
    padding: .15rem .4rem; border-radius: 4px; margin-bottom: .2rem;
    color: #fff; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; cursor: pointer;
}
.cal-ev-chip:hover { opacity: .85; }
.cal-more { font-size: .68rem; color: var(--primary); font-weight: 600; cursor: pointer; }

/* ── New Calendar List Layout ───────────────────────── */
.cal-events-list {
    margin-top: 1rem;
}
.cal-month-group {
    margin-bottom: 2rem;
}
.cal-month-header {
    font-size: 1.1rem; font-weight: 700; color: var(--text);
    margin-bottom: 1rem; padding-bottom: .5rem;
    border-bottom: 2px solid var(--border);
}
.cal-event-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.cal-event-card {
    display: flex; gap: .75rem;
    padding: 1rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    align-items: flex-start;
}
.cal-event-date {
    font-size: .85rem; font-weight: 700; color: var(--primary);
    min-width: 50px; text-align: center; padding: .4rem .5rem;
    background: #eff6ff; border-radius: var(--radius-sm);
}
.cal-event-body {
    flex: 1; min-width: 0;
}
.cal-event-type {
    display: inline-block; font-size: .7rem; font-weight: 600;
    color: #fff; padding: .2rem .5rem; border-radius: 12px;
    margin-bottom: .4rem;
}
.cal-event-title {
    font-size: .9rem; font-weight: 600; color: var(--text);
    margin: 0 0 .4rem 0; line-height: 1.3;
}
.cal-event-location {
    font-size: .8rem; color: #64748b;
    display: flex; align-items: center; gap: .4rem;
}
.cal-event-actions {
    display: flex; flex-direction: column; gap: .4rem;
}

/* Modal card (used by calendar) */
.modal-card {
    background: var(--surface); border-radius: var(--radius);
    width: 100%; max-width: 620px; max-height: 92vh;
    overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.22);
    animation: slideUp .2s ease;
}
.modal-footer {
    display: flex; gap: .75rem; justify-content: flex-end;
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ── Document Review Modal ───────────────────────── */
.doc-review-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9100;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}
.doc-review-overlay.open { display: flex; animation: fadeIn .2s ease; }
.doc-review-box {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 680px;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    margin: auto;
}
.doc-review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}
.doc-review-header h2 {
    font-size: 1.1rem;
    color: #0f172a;
    margin: 0;
}
.doc-review-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #64748b;
    padding: .25rem .5rem;
    border-radius: 6px;
    line-height: 1;
}
.doc-review-close:hover { background: #f1f5f9; color: #1e293b; }
.doc-review-body {
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

/* ── Roles & Access ──────────────────────────────── */
.roles-legend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.role-badge-card {
    display: flex; align-items: flex-start; gap: .85rem;
    padding: 1rem 1.1rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    border-left: 4px solid var(--rc, #94a3b8);
}
.role-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--rc, #94a3b8); flex-shrink: 0; margin-top: 3px;
}
.role-badge-card strong { font-size: .9rem; color: var(--text); }
.role-badge-card p { font-size: .8rem; color: var(--text-muted); margin: .2rem 0 0; line-height: 1.45; }
.role-pill {
    display: inline-block; padding: .2rem .65rem; border-radius: 999px;
    font-size: .75rem; font-weight: 700; color: #fff; white-space: nowrap;
}
@media (max-width: 700px) {
    .cal-grid { grid-template-columns: repeat(7,1fr); }
    .cal-day  { min-height: 68px; padding: .3rem; }
    .roles-legend { grid-template-columns: 1fr; }
}

/* ── Live streaming ──────────────────────────────── */
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(1.3); }
}
#liveStatusBar { display: none; }
#liveStatusBar.visible { display: flex !important; }
