/* ===========================
   AD Photo - Dark Theme
   =========================== */

:root {
    --bg:        #1a1a2e;
    --bg-2:     #0f1020;
    --card:      #16213e;
    --card-2:    #1f2b50;
    --border:    #2a3a66;
    --text:      #eaeaf2;
    --muted:     #9aa0b4;
    --accent:    #e94560;
    --accent-2:  #ff6f86;
    --success:   #2dd4bf;
    --warning:   #f6c145;
    --danger:    #ef4444;
    --radius:    14px;
    --shadow:    0 10px 30px rgba(0,0,0,.35);

    /* Type scale -- 8 steps, used everywhere instead of ad-hoc rem values.
       Naming follows size (2xs smallest -> 3xl largest), not semantic role,
       since the same step is reused across unrelated components. */
    --fs-2xs: 0.75rem;   /* 12px - micro labels, badges, table headers */
    --fs-xs:  0.875rem;  /* 14px - secondary/meta text, small buttons */
    --fs-sm:  1rem;      /* 16px - body text, base buttons, inputs */
    --fs-md:  1.125rem;  /* 18px - h4, lg buttons, lead-in text */
    --fs-lg:  1.25rem;   /* 20px - h3 */
    --fs-xl:  1.5rem;    /* 24px - h2 */
    --fs-2xl: 1.75rem;   /* 28px - stat numbers, mobile h1 */
    --fs-3xl: 2.5rem;    /* 40px - desktop h1 */
}

* { box-sizing: border-box; }

h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 700; line-height: 1.25; }
h1 { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

html, body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at 88% 4%, rgba(233, 69, 96, 0.12) 0%, transparent 38%),
        radial-gradient(circle at 4% 92%, rgba(120, 142, 255, 0.09) 0%, transparent 36%),
        radial-gradient(circle at 20% 0%, #20214a 0%, var(--bg) 45%, var(--bg-2) 100%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

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

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 22px;
}

.hidden { display: none !important; }
.muted  { color: var(--muted); }
.accent { color: var(--accent); }

/* -------- Topbar -------- */
.topbar {
    background: rgba(15, 16, 32, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
}
.topbar-inner nav { display: flex; align-items: center; gap: 10px; }
.lang-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}
.lang-switch a {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--muted);
    transition: background-color .15s ease, color .15s ease;
}
.lang-switch a.is-active {
    background: var(--accent);
    color: #fff;
}
.lang-switch a:hover:not(.is-active) { color: var(--text); }
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: var(--fs-md); letter-spacing: 0.3px;
    /* Vertical padding + matching negative margin: grows the tap target
       height (the 40px logo alone is under the ~44px touch-target
       guideline) without shifting it horizontally or affecting the
       topbar spacing already set on .topbar-inner. */
    padding: 8px 0;
    border-radius: 8px;
    transition: background-color .15s ease;
}
.brand:hover { background-color: rgba(255,255,255,0.05); }
.brand-logo {
    height: 40px;
    width: auto;
    display: block;
}

/* -------- Hero -------- */
.hero {
    text-align: center;
    padding: 70px 16px 40px;
}
.hero-sm { padding: 40px 16px 24px; }
.hero h1 {
    font-size: var(--fs-3xl);
    margin: 0 0 12px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.hero .lead {
    color: var(--muted);
    font-size: var(--fs-md);
    max-width: 640px;
    margin: 0 auto;
}
.event-chip {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(233, 69, 96, 0.15);
    border: 1px solid rgba(233, 69, 96, 0.4);
    color: var(--accent-2);
    border-radius: 999px;
    font-size: var(--fs-xs);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* -------- Section heads -------- */
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin: 32px 0 18px;
}
.section-head h2 { margin: 0; }

/* -------- Buttons -------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: transform .12s ease, background .2s ease, box-shadow .2s ease, border-color .2s ease;
    text-decoration: none;
    background: transparent;
    color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 6px 18px rgba(233, 69, 96, 0.35);
}
.btn-primary:hover { box-shadow: 0 8px 24px rgba(233, 69, 96, 0.5); }

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.btn-sm  { padding: 7px 14px; font-size: var(--fs-xs); }
.btn-lg  { padding: 13px 26px; font-size: var(--fs-md); }

/* -------- Cards & grids -------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
}
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}
.event-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease;
}
.event-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 16px 32px rgba(0,0,0,.45);
}
.event-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, rgba(233,69,96,.20), rgba(120,142,255,.16));
    overflow: hidden;
}
.event-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.event-card:hover .event-cover img { transform: scale(1.05); }
.event-cover::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(15,16,32,0) 60%, rgba(15,16,32,.5) 100%);
    pointer-events: none;
}
.event-cover-empty {
    display: none;
    position: absolute; inset: 0;
    align-items: center; justify-content: center;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 0 20px;
}
.event-cover.no-cover img { display: none; }
.event-cover.no-cover .event-cover-empty { display: flex; }
.event-card-body {
    padding: 20px 22px 22px;
    display: flex; flex-direction: column;
    flex: 1;
}
.event-card h3 {
    margin: 0 0 8px;
    font-size: var(--fs-lg);
}
.event-meta {
    color: var(--muted);
    font-size: var(--fs-xs);
    margin-bottom: 18px;
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
}
.event-card .btn { margin-top: auto; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: var(--fs-2xs);
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-success { background: rgba(45, 212, 191, 0.15); color: var(--success); border: 1px solid rgba(45,212,191,0.35); }
.badge-warning { background: rgba(246, 193, 69, 0.12); color: var(--warning); border: 1px solid rgba(246,193,69,0.35); }
.badge-danger  { background: rgba(239, 68, 68, 0.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.35); }
.badge-info    { background: rgba(120, 142, 255, 0.15);color: #92a6ff;        border: 1px solid rgba(120,142,255,0.35); }

/* -------- Upload zone -------- */
.upload-card {
    max-width: 720px;
    margin: 0 auto;
}
.dropzone {
    display: block;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
    background: rgba(255,255,255,0.02);
}
.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.06);
}
.upload-icon {
    width: 60px; height: 60px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(233, 69, 96, 0.15);
    color: var(--accent);
    font-size: 2rem; line-height: 60px;
    font-weight: 300;
}
.selfie-preview {
    max-height: 260px;
    border-radius: 12px;
    margin: 0 auto;
    display: block;
    box-shadow: 0 8px 22px rgba(0,0,0,.4);
}
.form-actions {
    display: flex; justify-content: center; gap: 10px;
    margin-top: 22px;
}

/* -------- Results grid -------- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 8px;
}
@media (max-width: 900px) { .results-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .results-grid { grid-template-columns: 1fr; } }

.result-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease;
    position: relative;
}
.result-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 14px 28px rgba(0,0,0,.45);
}
.result-card img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
    background: #0c1126;
}
.result-body {
    padding: 12px 14px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.result-card-link { display: block; }
.result-download-btn {
    position: absolute;
    right: 10px; bottom: 10px;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(15, 16, 32, 0.72);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease, background .15s ease, border-color .15s ease;
}
.result-card:hover .result-download-btn {
    opacity: 1;
    transform: translateY(0);
}
.result-download-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}
@media (hover: none) {
    .result-download-btn { opacity: 1; transform: none; }
}
.cart-add-btn {
    position: absolute;
    right: 10px; bottom: 10px;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 700;
    font-size: var(--fs-2xs);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(233, 69, 96, 0.4);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.cart-add-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(233, 69, 96, 0.5); }
.cart-add-btn:disabled { cursor: default; transform: none; }
.cart-add-btn.is-added {
    background: var(--success);
    box-shadow: none;
}
.overlay-badge-tl {
    position: absolute;
    top: 10px; left: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.score-badge {
    position: absolute;
    top: 10px; left: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: var(--fs-2xs);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,.35);
}

/* -------- Loading / alerts / empty -------- */
.loading-box {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 28px;
    color: var(--muted);
}
.spinner {
    width: 22px; height: 22px;
    border: 3px solid rgba(255,255,255,.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin: 16px 0;
    font-size: var(--fs-sm);
    border: 1px solid transparent;
}
.alert-error    { background: rgba(239, 68, 68, 0.12);  color: #ffd0d0; border-color: rgba(239,68,68,0.4); }
.alert-success  { background: rgba(45, 212, 191, 0.12); color: #c8fff5; border-color: rgba(45,212,191,0.4); }
.alert-info     { background: rgba(120, 142, 255, 0.12);color: #d5dcff; border-color: rgba(120,142,255,0.4); }

.empty-state {
    text-align: center;
    padding: 50px 18px;
    color: var(--muted);
}
.empty-state h3 { color: var(--text); margin: 0 0 6px; }

/* -------- Admin -------- */
.login-card {
    max-width: 420px;
    margin: 70px auto 0;
    text-align: center;
}
.login-card h2 { margin-top: 0; }
.login-form {
    display: flex; gap: 10px;
    margin-top: 16px;
}
.login-form input {
    flex: 1;
}

.admin-section { margin-top: 22px; }
.admin-section h2 { margin-top: 0; }

input[type=text], input[type=password], input[type=email], input[type=number], input[type=file], select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: var(--fs-sm);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus, input[type=number]:focus, input[type=file]:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233,69,96,0.18);
}

/* -------- Settings form (admin) -------- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px 20px;
    margin-bottom: 22px;
}
.settings-field label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: var(--fs-xs);
}
.settings-field .hint {
    color: var(--muted);
    font-size: var(--fs-2xs);
    margin-top: 5px;
}
.settings-field-wide { grid-column: 1 / -1; }

.inline-form {
    display: flex; gap: 10px;
    margin-top: 8px;
}
.inline-form input { flex: 1; }

.table-wrap { overflow-x: auto; }
.events-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    min-width: 720px;
}
.events-table th, .events-table td {
    padding: 12px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: var(--fs-xs);
}
.events-table th { color: var(--muted); font-weight: 600; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.6px; }
.events-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.events-table .row-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.path-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: var(--fs-2xs);
    color: var(--muted);
}

/* -------- Footer -------- */
.footer {
    margin-top: 60px;
    padding: 22px 0 30px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    text-align: center;
    font-size: var(--fs-xs);
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 16px;
}
.footer-staff-links {
    font-size: var(--fs-2xs);
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.footer-staff-links a {
    color: var(--muted);
    transition: color .15s ease;
}
.footer-staff-links a:hover { color: var(--text); }

/* -------- Faces grid -------- */
.event-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: nowrap;
}
.event-actions .btn {
    flex: 1;
    min-width: 0;
    padding-left: 10px;
    padding-right: 10px;
    white-space: normal;
    text-align: center;
}

.faces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.face-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
    display: flex; flex-direction: column;
    align-items: center;
    gap: 10px;
    font: inherit; color: inherit;
    text-align: center;
}
.face-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 12px 24px rgba(0,0,0,.4);
}
.face-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: #0c1126;
    display: flex; align-items: center; justify-content: center;
}
.face-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.face-placeholder {
    color: var(--muted);
    font-size: 2rem;
    font-weight: 700;
}
.face-meta {
    display: flex; align-items: center; justify-content: center;
}

@media (max-width: 600px) {
    .hero h1 { font-size: var(--fs-2xl); }
    .topbar-inner { padding: 16px; }
    .container { padding: 0 14px; }
    .inline-form { flex-direction: column; }
    .login-form { flex-direction: column; }
    .faces-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ===========================
   App Shell (Admin & Agent)
   =========================== */
.app-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
    align-items: start;
}
.app-sidebar {
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 20px 14px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 40;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 20px;
    font-weight: 700;
    font-size: var(--fs-md);
}
.sidebar-brand .brand-logo { height: 24px; }
.sidebar-scope {
    display: inline-block;
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-2);
    background: rgba(233, 69, 96, 0.14);
    border: 1px solid rgba(233, 69, 96, 0.3);
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: auto;
}
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.nav-group-label {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 10px;
    margin-bottom: 6px;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: 9px;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 500;
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.sidebar-link:hover { color: var(--text); background: rgba(255,255,255,0.045); }
.sidebar-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(233,69,96,0.22), rgba(255,111,134,0.12));
    border-color: rgba(233,69,96,0.35);
}
.sidebar-link.is-active svg { opacity: 1; }
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 14px;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 14px;
}
.sidebar-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: var(--fs-xs); color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}
.sidebar-user-meta { min-width: 0; }
.sidebar-user-name {
    display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-role { display: block; font-size: var(--fs-2xs); color: var(--muted); }
.sidebar-footer-actions { display: flex; flex-direction: column; gap: 8px; }
.sidebar-footer-actions .btn { width: 100%; }
.sidebar-note {
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    color: var(--muted);
    font-size: var(--fs-xs);
}

.app-content { min-width: 0; display: flex; flex-direction: column; }
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 16, 32, 0.65);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 30;
}
.app-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-header-title { font-size: var(--fs-md); font-weight: 700; letter-spacing: .01em; }
.app-header-actions { display: flex; align-items: center; gap: 10px; }
.sidebar-toggle {
    display: none;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px; height: 36px;
    border-radius: 9px;
    align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.app-main { padding: 26px 28px 44px; flex: 1; width: 100%; }

.sidebar-backdrop { display: none; }

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed; left: 0; top: 0; bottom: 0;
        width: 264px; height: 100vh;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 20px 0 40px rgba(0,0,0,.35);
    }
    .app-sidebar.is-open { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
    .sidebar-backdrop {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 39;
    }
    .sidebar-backdrop.is-open { display: block; }
    .app-main { padding: 20px 18px 34px; }
    .app-header { padding: 13px 16px; }
}

/* ---- Dashboard summary cards ---- */
.dashboard-summary, .dashboard-panel { margin-bottom: 22px; }
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}
.summary-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    display: flex; flex-direction: column; gap: 8px;
}
.summary-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.summary-value { font-size: var(--fs-2xl); font-weight: 700; line-height: 1; }

.activity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-list li:last-child { border-bottom: 0; }
.activity-main { font-weight: 600; display: block; margin-bottom: 4px; }
.activity-meta { color: var(--muted); font-size: var(--fs-xs); }
.activity-time { color: var(--muted); opacity: .8; font-size: var(--fs-2xs); margin-top: 4px; }

@media (max-width: 900px) { .activity-grid { grid-template-columns: 1fr; } }

/* ---- Data tables (agents / events / uploads) ---- */
.data-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: var(--fs-xs); vertical-align: middle; }
.data-table th { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--fs-2xs); font-weight: 600; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.api-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-2xs); color: var(--text); background: rgba(255,255,255,0.06); padding: 4px 8px; border-radius: 6px; }
.copy-btn { background: var(--accent); color: #fff; border: none; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: var(--fs-2xs); font-weight: 600; }
.copy-btn:hover { filter: brightness(1.1); }

.badge.active { background: rgba(45,212,191,.15); color: var(--success); }
.badge.inactive { background: rgba(239,68,68,.15); color: #ff8989; }

.action-btn { padding: 6px 12px; margin: 2px; font-size: var(--fs-2xs); border: none; border-radius: 7px; cursor: pointer; font-weight: 600; }
.btn-delete { background: rgba(239,68,68,.15); color: #ff9d9d; border: 1px solid rgba(239,68,68,.35); }
.btn-delete:hover { background: rgba(239,68,68,.25); }
.btn-toggle { background: rgba(120,142,255,.15); color: #b7c3ff; border: 1px solid rgba(120,142,255,.35); }
.btn-toggle:hover { background: rgba(120,142,255,.25); }

.module-section { display: none; }
.module-section.is-active { display: block; }
.module-head { margin-top: 0; font-size: var(--fs-xl); letter-spacing: 0.01em; }

.empty-panel { text-align: center; padding: 46px 18px; color: var(--muted); }
.empty-panel h3 { color: var(--text); margin: 0 0 8px; }

@media (max-width: 640px) {
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===========================
   Auth pages (Admin / Agent login)
   =========================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    padding: 40px 20px;
}
.auth-brand { display: flex; align-items: center; }
.auth-brand .brand-logo { height: 34px; }

.auth-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 36px 32px 30px;
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
    text-align: center;
}
.auth-scope-badge {
    display: inline-block;
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-2);
    background: rgba(233, 69, 96, 0.14);
    border: 1px solid rgba(233, 69, 96, 0.3);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 16px;
}
.auth-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    margin: 0 auto 18px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 26px rgba(233, 69, 96, 0.4);
}
.auth-icon svg { width: 23px; height: 23px; color: #fff; }
.auth-card h2 { margin: 0 0 6px; font-size: var(--fs-xl); }
.auth-card .muted { margin: 0 0 24px; font-size: var(--fs-xs); }

.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-field { position: relative; }
.auth-field svg {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); width: 17px; height: 17px; pointer-events: none;
}
.auth-field input { padding-left: 42px; }
.auth-form .btn-primary { margin-top: 6px; width: 100%; }

.auth-card .alert { text-align: left; }
.auth-links {
    margin-top: 22px;
    display: flex; flex-direction: column; gap: 6px;
    font-size: var(--fs-xs); color: var(--muted);
}
.auth-links a { color: var(--accent-2); font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }
.auth-footnote { color: var(--muted); font-size: var(--fs-2xs); text-align: center; }

@media (max-width: 480px) {
    .auth-card { padding: 30px 22px 26px; }
}

/* ===========================
   Upload progress
   =========================== */
.upload-progress-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.02);
    margin: 16px 0;
}
.upload-progress-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: var(--fs-xs);
    font-weight: 600;
}
.upload-progress-percent { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 999px;
    transition: width .18s ease;
}
.upload-progress-meta {
    color: var(--muted);
    font-size: var(--fs-2xs);
    font-variant-numeric: tabular-nums;
}

/* ===========================
   Cart / Checkout / Order
   =========================== */
.cart-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.cart-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.cart-row-thumb {
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: 10px;
    background: #0c1126;
    flex-shrink: 0;
}
.cart-row-meta {
    display: flex; flex-direction: column; gap: 4px;
    flex: 1;
    min-width: 0;
}
.cart-row-event { font-weight: 600; }
.cart-row-price { color: var(--muted); font-size: var(--fs-xs); }
.cart-summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.cart-summary-label { color: var(--muted); font-weight: 600; }
.cart-summary-total { font-size: var(--fs-xl); font-weight: 800; }

.order-summary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}
.order-summary-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.order-summary-meta {
    display: flex; flex-direction: column; gap: 4px;
    flex: 1;
    min-width: 160px;
}
.order-summary-event { font-weight: 600; }
.order-summary-date { color: var(--muted); font-size: var(--fs-xs); }
.order-summary-total { font-weight: 700; white-space: nowrap; }

.cart-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cart-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: var(--fs-2xs);
    font-weight: 700;
}

.order-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin: 20px 0;
}

/* ===========================
   Pagination
   =========================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 28px 0 6px;
}
.pagination-info {
    color: var(--muted);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
}
.pagination .btn:disabled { opacity: .4; }

/* ===========================
   Light theme (customer-facing site only)
   Scoped to body.site-light so admin.php / agent panels -- which share
   this stylesheet -- keep the original dark theme untouched. Brand colors
   sampled directly from the AD Photo logo (red/blue/green/gold pinwheel).
   =========================== */
body.site-light {
    --bg:        #ffffff;
    --bg-2:      #f5f6f8;
    --card:      #ffffff;
    --card-2:    #f5f6f8;
    --border:    #e7e9ee;
    --text:      #14161a;
    --muted:     #6b7280;
    --accent:    #ee2f2f;
    --accent-2:  #ff5b52;
    --success:   #1a8a45;
    --warning:   #a67a12;
    --danger:    #d1272b;
    --shadow:    0 10px 30px rgba(20,22,30,.07);
    --brand-blue:  #3094e2;
    --brand-green: #28c551;
    --brand-gold:  #e9c559;
    background: #ffffff;
}

body.site-light .topbar {
    background: rgba(255,255,255,0.88);
    border-bottom: 1px solid var(--border);
}
body.site-light .brand:hover { background-color: rgba(0,0,0,0.04); }

body.site-light .btn-ghost {
    background: rgba(0,0,0,0.035);
    border-color: var(--border);
    color: var(--text);
}
body.site-light .btn-ghost:hover { background: rgba(0,0,0,0.06); }

body.site-light .btn-primary { box-shadow: 0 6px 18px rgba(238,47,47,.28); }
body.site-light .btn-primary:hover { box-shadow: 0 8px 24px rgba(238,47,47,.38); }

body.site-light .dropzone { background: rgba(0,0,0,0.015); }
body.site-light .dropzone:hover,
body.site-light .dropzone.dragover { background: rgba(238,47,47,0.04); }
body.site-light .upload-icon { background: rgba(238,47,47,.10); color: var(--accent); }
body.site-light .selfie-preview { box-shadow: 0 8px 22px rgba(20,22,30,.15); }

body.site-light .spinner { border-color: rgba(0,0,0,0.08); border-top-color: var(--accent); }
body.site-light .progress-track { background: rgba(0,0,0,0.06); }
body.site-light .upload-progress-box { background: rgba(0,0,0,0.015); }

body.site-light .event-card:hover,
body.site-light .result-card:hover,
body.site-light .face-card:hover {
    box-shadow: 0 16px 32px rgba(20,22,30,.10);
}
body.site-light .result-card img,
body.site-light .face-thumb,
body.site-light .cart-row-thumb {
    background: #eef0f3;
}

body.site-light .event-chip {
    background: rgba(238,47,47,0.08);
    border-color: rgba(238,47,47,0.25);
    color: var(--accent);
}

body.site-light .badge-success { background: rgba(40,197,81,0.12);  color: #1a7d3d; border-color: rgba(40,197,81,0.35); }
body.site-light .badge-warning { background: rgba(233,197,89,0.20); color: #8a6a12; border-color: rgba(233,197,89,0.5); }
body.site-light .badge-danger  { background: rgba(238,47,47,0.10);  color: #c81e1e; border-color: rgba(238,47,47,0.3); }
body.site-light .badge-info    { background: rgba(48,148,226,0.12); color: #1f6fb8; border-color: rgba(48,148,226,0.35); }

body.site-light .alert-error   { background: rgba(238,47,47,0.08);  color: #b81f1f; border-color: rgba(238,47,47,0.3); }
body.site-light .alert-success { background: rgba(40,197,81,0.08);  color: #1a7d3d; border-color: rgba(40,197,81,0.3); }
body.site-light .alert-info    { background: rgba(48,148,226,0.08); color: #1f6fb8; border-color: rgba(48,148,226,0.3); }

body.site-light input[type=text]:focus,
body.site-light input[type=password]:focus,
body.site-light input[type=email]:focus,
body.site-light input[type=file]:focus,
body.site-light select:focus {
    box-shadow: 0 0 0 3px rgba(238,47,47,0.15);
}

body.site-light .cart-add-btn { box-shadow: 0 6px 16px rgba(238,47,47,.3); }
body.site-light .cart-add-btn:hover { box-shadow: 0 8px 20px rgba(238,47,47,.4); }

body.site-light .auth-card { box-shadow: 0 24px 60px rgba(20,22,30,.12); }
body.site-light .auth-icon { box-shadow: 0 10px 26px rgba(238,47,47,.25); }
body.site-light .auth-scope-badge {
    color: #b81f1f;
    background: rgba(238,47,47,0.08);
    border-color: rgba(238,47,47,0.25);
}
body.site-light .auth-links a { color: var(--accent); }

/* -------- Hero eyebrow + 2-line heading -------- */
.section-eyebrow {
    display: block;
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
}
.hero h1 span { display: block; }

/* -------- How it works -------- */
.how-it-works {
    margin: 56px 0 10px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 24px;
    text-align: left;
}
.step-item { display: flex; gap: 14px; align-items: flex-start; }
.step-number {
    font-size: var(--fs-lg);
    font-weight: 800;
    color: var(--muted);
    opacity: 0.5;
    flex-shrink: 0;
}
.step-title { margin: 2px 0 6px; }
.step-text { color: var(--muted); font-size: var(--fs-xs); margin: 0; }
@media (max-width: 760px) {
    .steps-grid { grid-template-columns: 1fr; }
}

/* -------- Event card meta icons -------- */
.event-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.event-meta-item svg { flex-shrink: 0; opacity: 0.7; }
