/* ================= DARK BLUE GLASS THEME ================= */
:root {
    /* --- Palette --- */
    --bg-gradient: radial-gradient(circle at top center, #1e293b 0%, #0f172a 100%); /* Deep Slate Blue */
    --glass-surface: rgba(30, 41, 59, 0.6); /* Semi-transparent Blue */
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    --primary: #3b82f6; /* Bright Blue */
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.4);

    --text-main: #f1f5f9; /* Off-White */
    --text-muted: #94a3b8; /* Blue-Grey */

    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --success: #10b981;

    --radius: 16px;
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

html { background: #0f172a; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* --- Header --- */
header {
    text-align: center;
    margin-bottom: 30px;
    max-width: 600px;
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* --- Glass Card Container --- */
.form-container {
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-glass);
    width: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
}

/* Optional subtle shine effect */
.form-container::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* --- Input Groups --- */
.input-group { margin-bottom: 24px; }

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-left: 4px;
}

.input-group input {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    background: rgba(15, 23, 42, 0.6); /* Darker inner bg */
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.input-group input::placeholder { color: #475569; }

/* --- Remaining Attempts Pill (Glassy) --- */
.turn {
    text-align: center;
    margin-top: 5px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #bae6fd;
    background: rgba(56, 189, 248, 0.1);
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 600;
    border: 1px solid rgba(56, 189, 248, 0.2);
    align-self: center;
    width: auto;
    letter-spacing: 0.5px;

    /* FIX: Ensure it has layout but hide when empty */
    min-height: 20px;
}

/* FIX: Hide completely when text is empty (on first load) */
.turn:empty {
    display: none;
    padding: 0;
    border: none;
    min-height: 0;
}

/* --- Primary Button --- */
.btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 15px var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn:active { transform: scale(0.98); }
.btn:disabled {
    background: #334155; color: #64748b;
    cursor: not-allowed; transform: none; box-shadow: none;
}

/* --- Messages --- */
.msg {
    margin-top: 15px; text-align: center; font-weight: 600; font-size: 0.95rem; min-height: 24px;
}
.msg.ok { color: #4ade80; text-shadow: 0 0 10px rgba(74, 222, 128, 0.2); }
.msg.err { color: #f87171; text-shadow: 0 0 10px rgba(248, 113, 113, 0.2); }

/* --- Delivery Panel --- */
#delivery-panel {
    display: none;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px dashed var(--glass-border);
    animation: fadeIn 0.4s ease;
}
#delivery-panel.show { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* --- Danger Button (Ghost Style) --- */
.btn-not-received {
    margin-top: 20px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.2s ease;
}
.btn-not-received:hover {
    background: var(--danger-glow);
    box-shadow: 0 0 15px var(--danger-glow);
}
.btn-not-received svg { fill: currentColor; width: 20px; height: 20px; }

/* --- Fallback Link Box (Glass) --- */
.fallback-box {
    margin-top: 20px;
    padding: 20px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    text-align: center;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.fallback-header {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 600; color: #fff; margin-bottom: 12px;
}
.fallback-header svg { fill: #fbbf24; width: 20px; height: 20px; }

.link-copy-area {
    background: rgba(0,0,0,0.3);
    border: 1px dashed #475569;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    transition: all 0.2s;

    /* FIX: Add gap so text and button don't touch */
    gap: 12px;
}
.link-copy-area:hover { border-color: var(--primary); background: rgba(0,0,0,0.5); }

.link-text-display {
    font-family: monospace; color: #60a5fa; font-weight: 600;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    /* Remove fixed margin, gap handles it now */
    margin-right: 0;
    flex-grow: 1; /* Let text take available space */
    text-align: left;
}

.copy-badge {
    background: var(--primary); color: white; padding: 6px 12px;
    border-radius: 6px; font-size: 0.75rem; font-weight: 700;

    /* FIX: Prevent vertical stacking */
    white-space: nowrap;
    flex-shrink: 0;
}

.link-copy-area.copied { border-color: var(--success); background: rgba(16, 185, 129, 0.1); }
.link-copy-area.copied .copy-badge { background: var(--success); }

/* ================= VIDEO SECTION ================= */
.video-spotlight { margin-top: 40px; width: 100%; max-width: 900px; }
.video-grid { display: grid; gap: 20px; grid-template-columns: repeat( auto-fit, minmax(300px, 1fr) ); }

.video-card {
    background: var(--glass-surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.video-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-glass); }

.video-badge {
    position: absolute; top: 12px; left: 12px;
    padding: 4px 10px; border-radius: 20px;
    background: rgba(0,0,0,0.8);
    color: #fff; font-weight: 600; font-size: 0.75rem; z-index: 2; border: 1px solid #334155;
}

.video-caption { padding: 15px; }
.video-caption h4 { margin: 0 0 5px; font-size: 1rem; color: #fff; font-weight: 700; }
.video-caption p { margin: 0; color: #94a3b8; font-size: 0.9rem; line-height: 1.4; }

video, iframe { width: 100%; height: 200px; object-fit: cover; display: block; border: none; background: #020617; }


/* ================= STATUS STEPPER ================= */
.status-stepper {
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 4px;
    transition: all 0.3s ease;
    opacity: 0.35;
}
.stepper-step:last-child { margin-bottom: 0; }

.stepper-step.active {
    opacity: 1;
    background: rgba(59, 130, 246, 0.08);
}
.stepper-step.done {
    opacity: 0.7;
}
.stepper-step.failed {
    opacity: 1;
    background: rgba(248, 113, 113, 0.08);
}

/* Icon */
.stepper-icon {
    width: 34px; height: 34px; min-width: 34px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #64748b;
    transition: all 0.3s ease;
}
.stepper-step.active .stepper-icon {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}
.stepper-step.done .stepper-icon {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.25);
    color: #4ade80;
}
.stepper-step.failed .stepper-icon {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.25);
    color: #f87171;
}

/* Content */
.stepper-content { flex: 1; min-width: 0; }
.stepper-label {
    font-size: 0.88rem; font-weight: 600; color: #94a3b8;
    transition: color 0.3s;
}
.stepper-step.active .stepper-label { color: #e2e8f0; }
.stepper-step.done .stepper-label { color: #94a3b8; }
.stepper-step.failed .stepper-label { color: #fca5a5; }

.stepper-detail {
    font-size: 0.78rem; color: #64748b; margin-top: 2px;
}
.stepper-step.active .stepper-detail { color: #94a3b8; }

/* Status badge */
.stepper-status {
    font-size: 0.75rem; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    white-space: nowrap;
    transition: all 0.3s;
}
.stepper-step.active .stepper-status {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
}
.stepper-step.done .stepper-status {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
}
.stepper-step.failed .stepper-status {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
}

/* Spinner for active step */
.stepper-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(96, 165, 250, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: stepSpin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}
@keyframes stepSpin {
    to { transform: rotate(360deg); }
}

/* Entry animation */
@keyframes stepFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.stepper-step.animate-in {
    animation: stepFadeIn 0.35s ease forwards;
}

/* ================= STEPPER TOPBAR (elapsed + keep-open) ================= */
.stepper-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 0 4px;
}
.stepper-elapsed {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
    font-size: 0.78rem; font-weight: 700;
    color: #60a5fa;
    background: rgba(59,130,246,0.08);
    padding: 4px 10px; border-radius: 20px;
    border: 1px solid rgba(59,130,246,0.18);
}
.stepper-elapsed .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #60a5fa;
    box-shadow: 0 0 0 0 rgba(96,165,250,0.5);
    animation: elapsedPulse 1.8s ease-out infinite;
}
@keyframes elapsedPulse {
    0%   { box-shadow: 0 0 0 0 rgba(96,165,250,0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(96,165,250,0); }
    100% { box-shadow: 0 0 0 0 rgba(96,165,250,0); }
}
.stepper-keep-open {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.7rem; font-weight: 600; color: #94a3b8;
    padding: 3px 9px; border-radius: 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.stepper-keep-open svg { color: #fbbf24; }

/* Elapsed separator + cap */
.stepper-elapsed-sep { opacity: 0.4; margin: 0 2px; }
.stepper-elapsed-cap { color: #94a3b8; font-weight: 600; }

/* Progress bar toward the 40s ceiling */
.stepper-progress {
    height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    overflow: hidden;
    margin-bottom: 6px;
}
.stepper-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
    border-radius: 4px;
    transition: width 0.9s linear;
}
.stepper-progress-fill.complete {
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
}
.stepper-progress-caption {
    font-size: 0.72rem; color: #64748b;
    margin-bottom: 14px; padding: 0 2px;
}
.stepper-progress-caption strong { color: #cbd5e1; font-weight: 700; }

/* ================= STATUS MESSAGE (success / error card) ================= */
.status-text {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.86rem; line-height: 1.55;
    white-space: pre-line;       /* preserve \n\n as paragraph breaks */
    border-left: 3px solid transparent;
    animation: statusFadeIn 0.35s ease;
}
.status-text:empty { display: none; }
.status-text.ok {
    color: #d1fae5;
    background: rgba(34,197,94,0.06);
    border-color: #22c55e;
    border-top: 1px solid rgba(34,197,94,0.18);
    border-right: 1px solid rgba(34,197,94,0.18);
    border-bottom: 1px solid rgba(34,197,94,0.18);
}
.status-text.err {
    color: #fecaca;
    background: rgba(248,113,113,0.06);
    border-color: #f87171;
    border-top: 1px solid rgba(248,113,113,0.18);
    border-right: 1px solid rgba(248,113,113,0.18);
    border-bottom: 1px solid rgba(248,113,113,0.18);
}
@keyframes statusFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================= SOFT BANNER (appears at 20s+) ================= */
.stepper-soft-banner {
    margin-top: 12px;
    padding: 9px 13px;
    font-size: 0.76rem; font-weight: 500; line-height: 1.5;
    color: #fcd34d;
    background: rgba(251,191,36,0.05);
    border: 1px solid rgba(251,191,36,0.18);
    border-left: 3px solid #fbbf24;
    border-radius: 8px;
    animation: bannerSlideIn 0.4s ease;
}
.stepper-soft-banner strong { color: #fbbf24; font-weight: 700; }
.banner-caret {
    display: inline-block;
    margin-left: 1px;
    color: #fbbf24;
    animation: caretBlink 0.75s step-end infinite;
}
.banner-caret.done { display: none; }
@keyframes caretBlink {
    0%, 50%  { opacity: 1; }
    51%, 100% { opacity: 0; }
}
@keyframes bannerSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================= ROTATING TIPS ================= */
.stepper-tip {
    margin-top: 14px;
    padding: 12px 14px;
    font-size: 0.8rem; line-height: 1.5;
    color: #cbd5e1;
    background: rgba(96,165,250,0.04);
    border: 1px solid rgba(96,165,250,0.12);
    border-radius: 10px;
    display: none;  /* shown when text is set */
    min-height: 44px;
}
.stepper-tip.show { display: block; animation: tipFade 0.45s ease; }
.stepper-tip strong { color: #60a5fa; font-weight: 700; }
@keyframes tipFade {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================= MODAL STYLES (Dark Glass) ================= */
/* ─── Modal Overlay ─── */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none; align-items: center; justify-content: center; z-index: 9999;
    opacity: 0; transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 30px 16px;
}
.modal-overlay.open { display: flex; opacity: 1; }

.modal-box {
    background: linear-gradient(165deg, rgba(30,41,59,0.97) 0%, rgba(15,23,42,0.98) 100%);
    width: 90%; max-width: 460px;
    padding: 32px 28px 26px;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    text-align: center;
    position: relative;
    transform: scale(0.94) translateY(16px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
    flex-shrink: 0;
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }

/* Icon Circle */
.modal-icon-wrap { margin-bottom: 20px; }
.modal-icon-circle {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
    background: rgba(248, 113, 113, 0.1);
    border: 2px solid rgba(248, 113, 113, 0.2);
    display: flex; align-items: center; justify-content: center;
    animation: modalIconPulse 2s ease-in-out infinite;
}
@keyframes modalIconPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.15); }
    50% { box-shadow: 0 0 0 12px rgba(248, 113, 113, 0); }
}

/* Header */
.modal-header { margin-bottom: 24px; }
.modal-header h2 {
    font-size: 1.35rem; color: #fff; font-weight: 700;
    margin: 0 0 8px;
}
.modal-subtitle {
    font-size: 0.9rem; color: #94a3b8; line-height: 1.5; margin: 0;
}

/* Close Button */
.modal-close-btn {
    position: absolute; top: 18px; right: 18px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
    width: 32px; height: 32px; border-radius: 8px;
    font-size: 1.1rem; line-height: 1; color: #475569; cursor: pointer;
    transition: all 0.2s; z-index: 1;
}
.modal-close-btn:hover { background: rgba(248, 113, 113, 0.1); color: #f87171; border-color: rgba(248, 113, 113, 0.18); }

/* Body */
.modal-body p { color: #cbd5e1; line-height: 1.6; margin-bottom: 20px; font-size: 0.92rem; }

/* Steps Box */
.steps-box {
    text-align: left;
    background: rgba(0, 0, 0, 0.25);
    padding: 22px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 16px;
}
.steps-title {
    display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.steps-box h3 {
    font-size: 0.95rem; color: #60a5fa; margin: 0; font-weight: 700;
}
.steps-box ol {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 12px;
}
.steps-box li {
    color: #e2e8f0; font-size: 0.9rem;
    display: flex; align-items: flex-start; gap: 12px;
    line-height: 1.5;
}
.steps-box .step-text { flex: 1; padding-top: 2px; }
.steps-box .step-text b { color: #fff; }
.step-num {
    width: 26px; height: 26px; min-width: 26px;
    border-radius: 8px;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.2);
    color: #60a5fa; font-weight: 700; font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center;
}
.steps-box a {
    color: #60a5fa; font-weight: 700; text-decoration: none;
    border-bottom: 1px dashed rgba(96, 165, 250, 0.4);
    transition: border-color 0.2s;
}
.steps-box a:hover { border-bottom-color: #60a5fa; }

/* Warning Box */
.warning-box {
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.15);
    color: #fcd34d;
    padding: 16px; border-radius: 14px; font-size: 0.85rem;
    display: flex; gap: 12px; text-align: left;
    align-items: flex-start;
    line-height: 1.5;
}
.warning-icon-wrap {
    width: 36px; height: 36px; min-width: 36px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.1);
    display: flex; align-items: center; justify-content: center;
}
.warning-text { color: #fcd34d; }
.warning-text strong { color: #fde68a; }

/* Footer */
.modal-footer { margin-top: 24px; }
.btn-modal-close {
    background: rgba(255,255,255,0.06); color: #94a3b8;
    padding: 14px 24px; border-radius: 12px;
    font-weight: 700; font-size: 0.88rem;
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer; width: 100%;
    transition: all 0.2s;
}
.btn-modal-close:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.12);
    color: #fff;
}

/* Legacy compat */
.btn-secondary {
    background: #334155; color: white; padding: 12px 24px; border-radius: 12px;
    font-weight: 600; border: none; cursor: pointer; margin-top: 15px; width: 100%;
}
.btn-secondary:hover { background: #475569; }

/* ================= CANONICAL FORM-MODAL STYLES =================
   Shared form-field + footer-button styling so every admin modal that
   takes user input (Add Account, New Admin, etc.) renders identically.
   Pages can still override locally if they need a one-off variant. */
.form-group { margin-bottom: 18px; text-align: left; }
.form-group label {
    display: block; margin-bottom: 7px; font-weight: 600;
    color: #94a3b8; font-size: 0.82rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px 14px; box-sizing: border-box;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    font-size: 0.9rem; color: #fff; outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(15,23,42,0.7);
}
.form-group input[readonly],
.form-group input:disabled {
    background: rgba(255,255,255,0.03); color: #64748b; cursor: not-allowed;
}
.form-group select {
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
    padding-right: 36px;
}
.form-group select option { background: #1e293b; color: #fff; }
.form-group .form-help {
    display: block; margin-top: 6px;
    font-size: 0.72rem; color: #64748b; line-height: 1.4;
}

.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.modal-btn {
    flex: 1; padding: 14px; border-radius: 12px;
    font-weight: 700; border: none; cursor: pointer;
    transition: all 0.2s; font-size: 0.88rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font-family: inherit;
}
.modal-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-save {
    background: var(--primary); color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-save:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
}
.btn-cancel { background: rgba(255,255,255,0.06); color: #94a3b8; }
.btn-cancel:hover { background: rgba(255,255,255,0.12); color: #fff; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover:not(:disabled) {
    background: #dc2626; transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239,68,68,0.35);
}

/* ================= CANONICAL TOGGLE SWITCH =================
   The iOS-style toggle used for booleans across the app (Shared,
   Suspended, Refunded, Active, Pending Replacement, etc). Promoted
   here so admin pages don't have to redefine the same 14 lines. */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #334155; transition: 0.3s; border-radius: 34px;
}
.switch .slider:before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: white;
    transition: 0.3s; border-radius: 50%;
}
.switch input:checked + .slider { background: #4ade80; }
.switch input:checked + .slider:before { transform: translateX(20px); }
/* Variant colors via wrapper class */
.switch.danger input:checked + .slider { background: #ef4444; }
.switch.warning input:checked + .slider { background: #fbbf24; }
.switch.info input:checked + .slider { background: #60a5fa; }

/* ================= CANONICAL ACTION BUTTONS =================
   Shared styling for primary action buttons across admin pages. Use as
   `class="btn-action btn-new"` to get the same blue-gradient "+ Add"
   look that lives on manage_accounts / product_configs. Promoted here
   so every admin page renders the same primary CTA without per-page
   CSS drift. */
.btn-action {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-flex; align-items: center; gap: 7px;
    transition: all 0.2s;
    border: none; cursor: pointer;
}
.btn-action:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-new {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-new:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

/* ================= ADMIN SIDEBAR =================
   Fixed-width vertical sidebar on the left of every admin page. The
   per-page templates already include partials/admin_nav.html which
   renders <aside class="admin-sidebar">. body:has() shifts page
   content right by the sidebar width — zero per-page CSS edits needed.

   On mobile the sidebar slides off-screen and a hamburger button + a
   backdrop overlay handle the drawer toggle. */

/* Sidebar container ------------------------------------------------- */
.admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 240px; z-index: 1000;
    display: flex; flex-direction: column; gap: 2px;
    padding: 18px 12px 14px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid rgba(255,255,255,0.06);
    box-shadow: 4px 0 22px -8px rgba(0,0,0,0.35);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* Shift page content right of the sidebar.
   :has() is supported in all modern browsers (2026); falls back to
   no-shift on ancient ones — which we don't target anyway. */
body:has(.admin-sidebar) { padding-left: 240px; }

/* Brand / logo at the top --------------------------------------------- */
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin-bottom: 14px;
    text-decoration: none; color: #f1f5f9;
    font-size: 1rem; font-weight: 800; letter-spacing: 0.4px;
}
.sidebar-brand-icon {
    width: 32px; height: 32px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7dd3fc, #38bdf8);
    color: #0c4a6e; font-size: 0.85rem;
    box-shadow: 0 4px 16px -4px rgba(125,211,252,0.55);
    flex-shrink: 0;
}
.sidebar-brand-text { font-size: 0.95rem; }

/* Section labels (MAIN / TOOLS) --------------------------------------- */
.sidebar-section-label {
    font-size: 0.62rem; font-weight: 800; color: #475569;
    text-transform: uppercase; letter-spacing: 0.9px;
    padding: 14px 10px 6px; margin-top: 4px;
}
.sidebar-section-label:first-of-type { margin-top: 0; }

/* Sidebar items (Orders, Accounts, Products, etc.) ------------------- */
.sidebar-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; border-radius: 9px;
    color: #94a3b8; text-decoration: none;
    font-size: 0.85rem; font-weight: 600;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.sidebar-item i {
    width: 18px; text-align: center; color: #64748b;
    font-size: 0.85rem; transition: color 0.15s;
    flex-shrink: 0;
}
.sidebar-item span { flex: 1; min-width: 0; }
.sidebar-item:hover { background: rgba(255,255,255,0.04); color: #f1f5f9; }
.sidebar-item:hover i { color: #cbd5e1; }
.sidebar-item.active {
    background: rgba(125,211,252,0.12); color: #7dd3fc;
    box-shadow: inset 2px 0 0 0 #7dd3fc;
}
.sidebar-item.active i { color: #7dd3fc; }

/* Notification bell row (top of sidebar) ----------------------------- */
.sidebar-item-bell { cursor: pointer; }
.sidebar-item-bell .notif-badge {
    /* Override the .sidebar-item span { flex: 1 } rule — without this, the
       badge would grow to fill the row instead of hugging its content. */
    flex: 0 0 auto;
    position: static; transform: none;
    min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box;
    background: #ef4444; color: #fff;
    border: 2px solid rgba(15,23,42,0.92); border-radius: 10px;
    font-size: 0.62rem; font-weight: 800;
    display: none; align-items: center; justify-content: center;
    margin-left: auto;
    animation: notifPop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.sidebar-item-bell .notif-badge.show { display: flex; }

/* Logged-in user card, sits just above the logout button. Avatar
   gradient is keyed off role so the super admin's avatar is visually
   distinct. The whole card is push-to-bottom via margin-top: auto so
   it stacks below the rest of the items regardless of how tall they
   get. */
.sidebar-user {
    margin-top: auto;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.015);
    border-radius: 0;
    transition: background 0.15s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.04); }
.sidebar-user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 800; color: #fff;
    letter-spacing: 0.4px;
    box-shadow: 0 4px 12px -4px rgba(0,0,0,0.35);
}
.sidebar-user-avatar.super {
    background: linear-gradient(135deg, #7dd3fc, #2563eb);
}
.sidebar-user-avatar.admin {
    background: linear-gradient(135deg, #4ade80, #16a34a);
}
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name {
    font-size: 0.84rem; font-weight: 700; color: #f1f5f9;
    line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-meta {
    display: flex; align-items: center; gap: 6px; margin-top: 3px;
    font-size: 0.66rem; min-width: 0;
}
.sidebar-user-role {
    font-weight: 800; padding: 1px 6px; border-radius: 4px;
    letter-spacing: 0.5px; flex-shrink: 0;
}
.sidebar-user-role.super { background: rgba(125,211,252,0.18); color: #7dd3fc; }
.sidebar-user-role.admin { background: rgba(74,222,128,0.18); color: #4ade80; }
.sidebar-user-email {
    color: #64748b; font-family: ui-monospace, monospace;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

/* When the user card is present, the logout button shouldn't push
   itself to the bottom anymore — sidebar-user already does that and
   logout sits right under it as a normal row. */
.sidebar-user + .sidebar-item-logout { margin-top: 0; }

/* Logout pinned to the bottom of the sidebar ------------------------- */
.sidebar-item-logout {
    margin-top: auto; color: #f87171;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 14px; padding-bottom: 14px;
    border-radius: 0;
}
.sidebar-item-logout i { color: #f87171; }
.sidebar-item-logout:hover { background: rgba(248,113,113,0.08); color: #fca5a5; }
.sidebar-item-logout:hover i { color: #fca5a5; }

/* Mobile drawer ------------------------------------------------------- */
.sidebar-hamburger {
    display: none;
    position: fixed; top: 14px; left: 14px; z-index: 1001;
    width: 40px; height: 40px; border-radius: 10px;
    background: rgba(15,23,42,0.85); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    color: #cbd5e1; font-size: 1rem; cursor: pointer;
    align-items: center; justify-content: center;
    transition: all 0.18s;
}
.sidebar-hamburger:hover { color: #fff; background: rgba(15,23,42,0.95); }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    opacity: 0; transition: opacity 0.2s;
}
.sidebar-backdrop.show { opacity: 1; }

@media (max-width: 700px) {
    body:has(.admin-sidebar) { padding-left: 0; }
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .admin-sidebar.open { transform: translateX(0); }
    .sidebar-hamburger { display: flex; }
    .sidebar-backdrop.show { display: block; }
}

/* ================= NAV DROPDOWN (legacy, kept harmless) ================= */
.admin-nav { position: relative; z-index: 1000; }

.nav-dropdown { position: relative; display: inline-flex; }

.nav-dd-trigger {
    background: transparent; border: none; cursor: pointer; font: inherit;
    /* nav-item styles (color, padding, rounding) are inherited from the
       per-page .nav-item rule. We only add caret-specific styling here. */
}
.nav-dd-caret {
    margin-left: 4px; font-size: 0.65rem !important; opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s;
}
.nav-dropdown.open .nav-dd-caret { transform: rotate(180deg); opacity: 1; }

.nav-dd-panel {
    position: absolute; top: calc(100% + 8px); left: 50%;
    transform: translateX(-50%) translateY(-4px);
    min-width: 220px; padding: 6px;
    background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 14px;
    box-shadow: 0 14px 38px -8px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; gap: 2px;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    z-index: 100;
}
.nav-dd-panel::before {
    content: ''; position: absolute; top: -6px; left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px; height: 12px;
    background: rgba(15, 23, 42, 0.95);
    border-left: 1px solid rgba(255,255,255,0.08);
    border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-dropdown.open .nav-dd-panel {
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.nav-dd-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 9px;
    text-decoration: none; color: #cbd5e1;
    font-size: 0.85rem; font-weight: 600;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.nav-dd-item i {
    width: 18px; text-align: center; color: #64748b;
    font-size: 0.82rem; transition: color 0.15s;
}
.nav-dd-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-dd-item:hover i { color: #94a3b8; }
.nav-dd-item.active {
    background: rgba(125,211,252,0.12); color: #7dd3fc;
}
.nav-dd-item.active i { color: #7dd3fc; }

/* On mobile, drop the centering and let the panel anchor to the right
   of the trigger, so it doesn't get clipped by the viewport edge. */
@media (max-width: 700px) {
    .nav-dd-panel { left: auto; right: 0; transform: translateY(-4px); }
    .nav-dropdown.open .nav-dd-panel { transform: translateY(0); }
    .nav-dd-panel::before { left: auto; right: 22px; transform: rotate(45deg); }
}

/* ================= NOTIFICATION BELL ================= */
.notif-bell {
    position: relative; cursor: pointer;
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
    color: #64748b; font-size: 0.95rem; transition: all 0.2s;
    margin-left: 6px;
}
.notif-bell:hover { background: rgba(255,255,255,0.08); color: #94a3b8; }
.notif-bell.has-notifs { color: #fbbf24; }
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; border-radius: 9px;
    background: #ef4444; color: white;
    font-size: 0.6rem; font-weight: 800;
    display: none; align-items: center; justify-content: center;
    padding: 0 5px; border: 2px solid #0f172a;
    animation: notifPop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.notif-badge.show { display: flex; }
@keyframes notifPop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes bellShake {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-12deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-8deg); }
    75% { transform: rotate(4deg); }
    90% { transform: rotate(-2deg); }
}

.notif-panel {
    display: none; position: fixed;
    width: 380px; max-height: 480px;
    background: rgba(15,23,42,0.97); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    z-index: 9999; overflow: hidden;
    animation: notifSlide 0.2s ease;
}
.notif-panel.show { display: flex; flex-direction: column; }
@keyframes notifSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.notif-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.notif-panel-title {
    font-size: 0.85rem; font-weight: 700; color: #e2e8f0;
    display: flex; align-items: center; gap: 8px;
}
.notif-panel-count {
    font-size: 0.65rem; font-weight: 700; color: #60a5fa;
    background: rgba(59,130,246,0.12); padding: 2px 8px; border-radius: 8px;
}
.notif-dismiss-all {
    font-size: 0.72rem; font-weight: 600; color: #64748b;
    background: none; border: none; cursor: pointer;
    padding: 5px 10px; border-radius: 6px; transition: all 0.15s;
}
.notif-dismiss-all:hover { background: rgba(255,255,255,0.06); color: #94a3b8; }

.notif-list {
    flex: 1; overflow-y: auto; padding: 8px;
    scrollbar-width: thin; scrollbar-color: rgba(59,130,246,0.2) transparent;
}
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: rgba(59,130,246,0.2); border-radius: 4px; }

.notif-item {
    display: flex; gap: 12px; padding: 12px;
    border-radius: 10px; cursor: default;
    transition: background 0.15s;
}
.notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-item.notif-new {
    animation: notifHighlight 2s ease;
}
@keyframes notifHighlight {
    0% { background: rgba(251,191,36,0.12); }
    100% { background: transparent; }
}

.notif-icon {
    width: 32px; height: 32px; min-width: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; flex-shrink: 0;
}
.notif-icon.sev-critical { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.15); }
.notif-icon.sev-warning  { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.15); }
.notif-icon.sev-info     { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.15); }

.notif-body { flex: 1; min-width: 0; }
.notif-title {
    font-size: 0.8rem; font-weight: 700; color: #e2e8f0;
    margin-bottom: 2px; line-height: 1.3;
}
.notif-msg {
    font-size: 0.72rem; color: #64748b; line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-meta {
    display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px;
    font-size: 0.62rem; color: #475569;
}
.notif-meta span {
    display: inline-flex; align-items: center; gap: 3px;
    white-space: nowrap;
}

/* Viewed (read) state — dimmed */
.notif-item.notif-viewed { opacity: 0.55; }
.notif-item.notif-viewed:hover { opacity: 0.8; }
.notif-item.notif-viewed .notif-title { font-weight: 600; }

/* Unviewed indicator dot */
.notif-unread-dot {
    width: 7px; height: 7px; min-width: 7px; border-radius: 50%;
    background: #60a5fa; flex-shrink: 0; align-self: flex-start; margin-top: 12px;
    box-shadow: 0 0 6px rgba(96,165,250,0.4);
}
.notif-item.notif-viewed .notif-unread-dot { display: none; }

/* Action buttons row */
.notif-actions {
    display: flex; flex-direction: column; gap: 4px;
    align-self: flex-start; margin-top: 2px;
}
.notif-action-btn {
    width: 24px; height: 24px; min-width: 24px; border-radius: 6px;
    border: none; cursor: pointer;
    background: rgba(255,255,255,0.04); color: #475569;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; transition: all 0.15s;
}
.notif-action-btn.btn-view:hover { background: rgba(59,130,246,0.1); color: #60a5fa; }
.notif-action-btn.btn-dismiss:hover { background: rgba(239,68,68,0.1); color: #f87171; }

/* Header actions */
.notif-header-actions { display: flex; gap: 6px; }
.notif-header-btn {
    font-size: 0.68rem; font-weight: 600; color: #64748b;
    background: none; border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer; padding: 4px 10px; border-radius: 6px;
    transition: all 0.15s; display: flex; align-items: center; gap: 4px;
}
.notif-header-btn:hover { background: rgba(255,255,255,0.06); color: #94a3b8; }
.notif-header-btn i { font-size: 0.58rem; }

.notif-empty {
    text-align: center; padding: 40px 20px; color: #475569;
}
.notif-empty i { font-size: 1.5rem; margin-bottom: 8px; display: block; color: #334155; }
.notif-empty b { color: #64748b; font-size: 0.85rem; }

/* Logout Specific Style */
.nav-item.logout {
    color: var(--danger); /* Red Text */
}

.nav-item.logout:hover {
    background: rgba(239, 68, 68, 0.1); /* Red Glow Background on Hover */
    color: #fff;
}