@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&family=Playfair+Display:wght@400;500;600&display=swap');

:root {
    /* ── Light Palette ── */
    --bg-deep:        #f0f4f8;
    --bg-card:        #ffffff;
    --bg-glass:       rgba(255, 255, 255, 0.90);
    --bg-surface:     #f8fafc;
    --bg-subtle:      #eef2f7;

    /* ── Accent — teal kept, adjusted for light bg ── */
    --accent:         #0891b2;
    --accent-dim:     rgba(8, 145, 178, 0.10);
    --accent-glow:    0 0 32px rgba(8, 145, 178, 0.18);
    --accent-hover:   #0e7490;

    /* ── Brand red (logos / decorative) ── */
    --brand-red:      #dc3232;

    /* ── Text ── */
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;

    /* ── Borders ── */
    --border:         rgba(8, 145, 178, 0.20);
    --border-subtle:  rgba(15, 23, 42, 0.08);

    /* ── Radius ── */
    --radius-xl:  20px;
    --radius-lg:  14px;
    --radius-md:  10px;
    --radius-sm:  7px;

    /* ── Shadows ── */
    --shadow-card:  0 4px 24px rgba(15, 23, 42, 0.08), 0 1px 4px rgba(15, 23, 42, 0.04);
    --shadow-glow:  0 0 40px rgba(8, 145, 178, 0.10);
    --transition:   all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-deep);
    font-family: 'DM Sans', system-ui, sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    position: relative;
    overflow-x: hidden;
}

/* ── Ambient background ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 15% 5%,  rgba(8, 145, 178, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 55% 40% at 85% 85%, rgba(220, 50, 50, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(8, 145, 178, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 145, 178, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* ══════════════════════════════════════
   KEYFRAME ANIMATIONS
══════════════════════════════════════ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes scan {
    0%   { top: -4px; opacity: 0; }
    8%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(8, 145, 178, 0.4); }
    70%  { box-shadow: 0 0 0 14px rgba(8, 145, 178, 0); }
    100% { box-shadow: 0 0 0 0 rgba(8, 145, 178, 0); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}
@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes blink {
    0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes borderGlow {
    0%, 100% { border-color: rgba(8, 145, 178, 0.20); }
    50%       { border-color: rgba(8, 145, 178, 0.50); }
}
@keyframes progressBar {
    from { width: 0%; }
    to   { width: 100%; }
}
@keyframes notifSlide {
    from { opacity: 0; transform: translateX(120%); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════
   SHARED COMPONENTS
══════════════════════════════════════ */

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(8, 145, 178, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: var(--radius-md);
    border: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.2s;
}
.btn:hover::after { opacity: 1; }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.4);
}
.btn:active:not(:disabled) { transform: scale(0.97); }

.btn.primary {
    background: linear-gradient(135deg, var(--accent), #0e7490);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(8, 145, 178, 0.30);
}
.btn.primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(8, 145, 178, 0.42);
    transform: translateY(-2px);
}

.btn.secondary {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}
.btn.secondary:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--border);
    color: var(--accent);
}

.btn.ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.btn.ghost:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--bg-subtle);
    border-color: var(--border);
}

.btn.small { padding: 9px 16px; font-size: 0.82rem; }
.btn.danger { background: rgba(239, 68, 68, 0.08); color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.20); }
.btn.danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.15); }

/* Input field */
.field {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}
.field::placeholder { color: var(--text-muted); }
.field:focus {
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.10);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.badge.scanned { background: rgba(8, 145, 178, 0.10); color: var(--accent); border: 1px solid rgba(8, 145, 178, 0.22); }
.badge.emailed  { background: rgba(99, 102, 241, 0.10); color: #6366f1; border: 1px solid rgba(99, 102, 241, 0.22); }

/* Toast notification */
#toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: none;
    animation: notifSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#toast.show { display: block; }
.toast-inner {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14);
    max-width: 300px;
}
.toast-inner.error   { border-left-color: #ef4444; }
.toast-inner.success { border-left-color: var(--accent); }

/* ══════════════════════════════════════
   BRAND LOGO
══════════════════════════════════════ */
.brand-logo {
    width: 200px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(220, 50, 50, 0.20));
    animation: float 4s ease-in-out infinite, scaleIn 0.6s ease both;
    display: block;
    margin: 0 auto;
}

.login-brand-logo {
    width: 160px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(220, 50, 50, 0.22));
    display: block;
    margin: 0 auto;
}

.topbar-brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 10px;
    filter: drop-shadow(0 2px 6px rgba(220, 50, 50, 0.18));
}

/* ── Footer ── */
.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 560px;
    margin-top: 1.5rem;
    padding: 1.6rem 1.5rem 0.5rem;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
    animation: fadeUp 0.6s 0.6s ease both;
}

.footer-logo {
    width: 90px;
    height: auto;
    object-fit: contain;
    opacity: 0.80;
    filter: drop-shadow(0 2px 8px rgba(220, 50, 50, 0.15));
    transition: opacity 0.3s, filter 0.3s;
}
.footer-logo:hover {
    opacity: 1;
    filter: drop-shadow(0 4px 16px rgba(220, 50, 50, 0.32));
}

.footer-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.footer-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    background: linear-gradient(135deg, #0f172a, #dc3232);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-tagline { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 0.05em; }
.footer-copy    { font-size: 0.72rem; color: var(--text-muted); opacity: 0.7; }
.admin-footer   { max-width: 100%; margin-top: 32px; }

/* ══════════════════════════════════════
   MAIN APP — index.html
══════════════════════════════════════ */
.app-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem 2.2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 560px;
    border: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
    animation: fadeUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.app-card-inner { animation: fadeUp 0.7s 0.1s cubic-bezier(0.4, 0, 0.2, 1) both; }

.app-header { text-align: center; margin-bottom: 2rem; }

.logo-wrap {
    margin: 0 auto 0.75rem;
    display: flex;
    justify-content: center;
}

.app-tagline {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 400;
    animation: fadeUp 0.6s 0.2s both;
    letter-spacing: 0.03em;
    text-align: center;
}

.login-logo { margin-bottom: 1.2rem; }

/* ── User Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.4rem;
    animation: fadeUp 0.6s 0.15s both;
}

.stat-badge {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 0.6rem;
    text-align: center;
    transition: var(--transition);
}
.stat-badge:hover {
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.10);
}
.stat-number {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--accent);
}
.stat-label-desc {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
}

/* ── Doctor Info ── */
.doctor-description {
    display: none;
    align-items: flex-start;
    gap: 12px;
    background: rgba(8, 145, 178, 0.06);
    border: 1px solid rgba(8, 145, 178, 0.18);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    margin-bottom: 1.25rem;
    animation: fadeUp 0.4s ease both;
}
.doctor-icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.doctor-text h3 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.doctor-text p { font-size: 0.83rem; color: var(--text-secondary); margin-bottom: 3px; }

/* Upload Zone */
.upload-container {
    position: relative;
    border: 1.5px dashed rgba(8, 145, 178, 0.30);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    background: rgba(8, 145, 178, 0.03);
    transition: var(--transition);
    overflow: hidden;
    cursor: pointer;
    animation: fadeUp 0.6s 0.25s both;
}
.upload-container:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: var(--accent-glow);
}
.upload-container.dragover {
    border-color: var(--accent);
    background: rgba(8, 145, 178, 0.09);
    box-shadow: 0 0 40px rgba(8, 145, 178, 0.18);
    transform: scale(1.01);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
    transition: transform 0.3s;
}
.upload-container:hover .upload-icon { transform: translateY(-4px); }

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    transition: var(--transition);
    letter-spacing: 0.02em;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}
.upload-btn:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--border);
}

.upload-hint {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Scanner Line */
.scanner-line {
    display: none;
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 16px var(--accent), 0 0 32px rgba(8, 145, 178, 0.35);
    z-index: 10;
    animation: scan 2s infinite ease-in-out;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 1.25rem 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    animation: fadeUp 0.6s 0.3s both;
    min-height: 24px;
}

/* Progress bar */
.progress-track {
    width: 100%;
    height: 3px;
    background: var(--bg-subtle);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    display: none;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #0e7490);
    border-radius: 2px;
    animation: progressBar 8s linear forwards;
}

/* Document Preview */
.document-preview {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    margin: 0 0 1.4rem;
    min-height: 180px;
    max-height: 38vh;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.7;
    animation: fadeUp 0.6s 0.35s both;
    transition: border-color 0.3s;
}
.document-preview.populated {
    border-color: rgba(8, 145, 178, 0.28);
    animation: borderGlow 3s ease-in-out infinite;
}
.document-preview::-webkit-scrollbar { width: 5px; }
.document-preview::-webkit-scrollbar-track { background: transparent; }
.document-preview::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 10px; }

.document-preview p,
.document-preview strong { color: var(--text-primary) !important; }
.document-preview h3 { color: var(--accent) !important; margin: 1rem 0 0.5rem; font-size: 1rem; }
.document-preview ul { padding-left: 0; list-style: none; }
.document-preview li {
    background: rgba(8, 145, 178, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
}

.placeholder-text {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}
.placeholder-text .ph-icon { font-size: 2rem; opacity: 0.35; }

/* Email section */
.email-section {
    position: relative;
    margin-bottom: 1.25rem;
    animation: fadeUp 0.6s 0.4s both;
}
.email-section .field { padding-left: 44px; }
.email-section .email-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.3s;
}
.email-section:focus-within .email-icon { color: var(--accent); }

/* Action grid */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    animation: fadeUp 0.6s 0.45s both;
}

/* Disclaimer */
.disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1.2rem;
    line-height: 1.55;
    animation: fadeUp 0.6s 0.5s both;
}

/* ══════════════════════════════════════
   LOGIN OVERLAY (shared)
══════════════════════════════════════ */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(240, 244, 248, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.login-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.8rem 2.5rem;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow-card), var(--shadow-glow);
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.login-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.login-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.8rem;
}

.field-group { margin-bottom: 1rem; text-align: left; }
.field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.login-card .btn.primary {
    width: 100%;
    padding: 14px;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.error-text {
    color: #dc2626;
    font-size: 0.82rem;
    margin-top: 12px;
    font-weight: 500;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.login-card .field-group + .field-group { margin-top: 0; }

/* ══════════════════════════════════════
   ADMIN DASHBOARD
══════════════════════════════════════ */
.admin-body {
    align-items: flex-start;
    padding: 32px 24px;
}

.dashboard-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: fadeUp 0.6s ease both;
}

/* Admin Top Bar */
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1rem 1.8rem;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    animation: fadeUp 0.5s ease both;
    position: sticky;
    top: 16px;
    z-index: 100;
}

.topbar-left  { display: flex; align-items: center; gap: 14px; }
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
}
.topbar-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.live-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
}
.live-dot::before {
    content: '';
    width: 7px; height: 7px;
    background: #16a34a;
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
    box-shadow: 0 0 6px #16a34a;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    animation: fadeUp 0.6s 0.1s ease both;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.4rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.04) 0%, transparent 60%);
    pointer-events: none;
}
.stat-card:hover { border-color: var(--border); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(8,145,178,0.10); }

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}
.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--accent);
}
.stat-unit { font-size: 0.78rem; color: var(--text-secondary); margin-top: 3px; }

/* Download Bar */
.download-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem 1.4rem;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    animation: fadeUp 0.6s 0.2s ease both;
}
.download-bar label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.download-bar select {
    padding: 9px 34px 9px 14px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.download-bar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8,145,178,0.10); }

.custom-dates {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.custom-dates input[type="date"] {
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.83rem;
    outline: none;
    color-scheme: light;
}
.custom-dates input[type="date"]:focus { border-color: var(--accent); }

.download-bar .spacer { flex: 1; }

/* Admin Content Grid */
.admin-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
    animation: fadeUp 0.6s 0.25s ease both;
}

/* Records Panel */
.records-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.panel-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}
.panel-title {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--text-secondary);
}
.panel-count {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.records-list {
    max-height: 68vh;
    overflow-y: auto;
    padding: 10px;
}
.records-list::-webkit-scrollbar { width: 4px; }
.records-list::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 10px; }

.record-item {
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-surface);
    position: relative;
    overflow: hidden;
}
.record-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.2s ease;
    border-radius: 2px;
}
.record-item:hover::before,
.record-item.active::before { transform: scaleY(1); }
.record-item:hover,
.record-item.active {
    border-color: var(--border);
    background: rgba(8, 145, 178, 0.05);
    transform: translateX(3px);
}

.record-id   { font-size: 0.72rem; color: var(--text-muted); font-family: monospace; margin-bottom: 5px; font-weight: 500; }
.record-date { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.record-footer { display: flex; align-items: center; justify-content: space-between; }
.record-email-tag { font-size: 0.75rem; color: var(--text-secondary); }

/* Detail Panel */
.detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    position: sticky;
    top: 90px;
    overflow: hidden;
    display: none;
    animation: slideInRight 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-panel-header {
    padding: 1.4rem 1.6rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
}
.detail-panel-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
}

.close-btn {
    width: 32px; height: 32px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}
.close-btn:hover { background: rgba(239, 68, 68, 0.08); color: #dc2626; border-color: rgba(239, 68, 68, 0.22); }

.detail-meta {
    padding: 1rem 1.6rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.meta-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.meta-value { font-size: 0.85rem; color: var(--text-primary); font-weight: 500; }
.meta-value.accent { color: var(--accent); }

.detail-body { padding: 1.6rem; }

#detail-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    max-height: 42vh;
    overflow-y: auto;
    font-size: 0.88rem;
    line-height: 1.7;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
}
#detail-content::-webkit-scrollbar { width: 4px; }
#detail-content::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 10px; }
#detail-content p strong,
#detail-content strong { color: var(--text-primary) !important; }
#detail-content h3     { color: var(--accent) !important; font-size: 0.9rem; margin: 0.75rem 0 0.4rem; }
#detail-content ul     { padding-left: 0; list-style: none; }
#detail-content li {
    background: rgba(8, 145, 178, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 4rem 2rem;
    color: var(--text-muted);
    text-align: center;
}
.empty-state .es-icon { font-size: 3rem; opacity: 0.25; }
.empty-state p { font-size: 0.88rem; }

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-subtle) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════
   REGISTER PAGE
══════════════════════════════════════ */
.register-body {
    justify-content: center;
    padding: 32px 24px;
}

.register-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.6rem 2.4rem;
    width: 100%;
    max-width: 460px;
    text-align: center;
    box-shadow: var(--shadow-card);
    position: relative;
    z-index: 1;
    animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.register-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--brand-red), transparent);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.register-logo { margin-bottom: 1.2rem; }

.register-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.65rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.register-sub {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.8rem;
}

/* Input with icon */
.input-icon-wrap { position: relative; }
.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    pointer-events: none;
    transition: opacity 0.2s;
    opacity: 0.5;
}
.field-icon { padding-left: 42px; }
.input-icon-wrap:focus-within .input-icon { opacity: 1; }

/* Password strength meter */
.strength-track {
    display: none;
    width: 100%;
    height: 4px;
    background: var(--bg-subtle);
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}
.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease, background 0.4s ease;
    width: 0%;
}
.strength-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-align: right;
    margin-top: 4px;
    letter-spacing: 0.04em;
    min-height: 16px;
}

.register-footer { max-width: 460px; margin-top: 1.5rem; }

/* Login / register link */
.login-register-link {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 1rem;
}
.login-register-link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}
.login-register-link a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 900px) {
    .admin-content { grid-template-columns: 1fr; }
    .detail-panel  { position: static; }
    .stats-row     { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    body           { padding: 12px; }
    .app-card      { padding: 1.8rem 1.2rem; }
    .action-grid   { grid-template-columns: 1fr; }
    .stats-row     { grid-template-columns: 1fr; }
    .stats-grid    { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .admin-topbar  { flex-wrap: wrap; gap: 10px; top: 0; border-radius: var(--radius-lg); }
    .topbar-right  { width: 100%; }
    .topbar-right .btn { flex: 1; }
    .download-bar  { flex-direction: column; align-items: stretch; }
    .download-bar .spacer { display: none; }
    .admin-body    { padding: 12px; }
}