/* Admin area. Plain CSS, no build step needed on the server. */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --text: #101828;
    --text-2: #475467;
    --text-3: #667085;
    --brand: #e4002b;
    --brand-dark: #b8001f;
    --side: #0f172a;
    --side-2: #1e293b;
    --side-text: #cbd5e1;
    --focus: rgba(228, 0, 43, 0.18);
    --ok-bg: #ecfdf3; --ok-fg: #067647; --ok-bd: #abefc6;
    --warn-bg: #fffaeb; --warn-fg: #b54708; --warn-bd: #fedf89;
    --bad-bg: #fef3f2; --bad-fg: #b42318; --bad-bd: #fecdca;
    --info-bg: #eff8ff; --info-fg: #175cd3; --info-bd: #b2ddff;
    --neutral-bg: #f2f4f7; --neutral-fg: #344054; --neutral-bd: #e4e7ec;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; flex: 0 0 240px; background: var(--side); color: var(--side-text);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 24px; color: #fff; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .5px;
}
.brand-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: #94a3b8; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
    color: var(--side-text); font-weight: 500;
}
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.active { background: var(--side-2); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.sidebar-foot { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--side-2); }
.user { font-size: 13px; color: #fff; font-weight: 500; }
.user-role { font-size: 12px; color: #94a3b8; text-transform: capitalize; }
.logout {
    margin-top: 10px; width: 100%; background: transparent; color: var(--side-text);
    border: 1px solid #334155; border-radius: 8px; padding: 7px 10px; cursor: pointer; font: inherit;
}
.logout:hover { background: var(--side-2); color: #fff; }

.main { flex: 1; min-width: 0; }
.content { max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.page-head p { margin: 4px 0 0; color: var(--text-3); }
.crumbs { font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 13px; flex-wrap: wrap; gap: 8px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pools { padding: 4px 20px 16px; }
.pool { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.pool:last-child { border-bottom: 0; }
.pool .muted { font-size: 13px; margin-top: 2px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 20px; align-items: start; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat-label { color: var(--text-3); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: -0.02em; }

/* Toolbar: tabs + search */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
    color: var(--text-2); font-weight: 500; text-transform: capitalize;
}
.tab:hover { background: var(--neutral-bg); color: var(--text); }
.tab.active { background: #fff1f3; color: var(--brand); }
.tab .count { background: var(--neutral-bg); color: var(--text-2); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.tab.active .count { background: #ffe4e8; color: var(--brand); }
.search { display: flex; gap: 8px; }
.search input { width: 260px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase;
    letter-spacing: .04em; padding: 10px 16px; background: #f9fafb; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 16px; white-space: nowrap; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
.id { color: var(--text-3); font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.person strong { font-weight: 600; }
.phone { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--text-3); padding: 40px 16px; }

/* Progress */
.progress { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.bar { flex: 1; height: 6px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar.done > span { background: #12b76a; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500; border: 1px solid var(--neutral-bd); background: var(--neutral-bg); color: var(--neutral-fg);
    text-transform: capitalize; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.approved, .badge.complete, .badge.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.badge.pending, .badge.open, .badge.manual_review { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.badge.rejected, .badge.expired { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.badge.vip { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }

/* Buttons & forms */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px;
    border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; color: var(--text);
    font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.btn:hover { background: #f9fafb; color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.success { background: #079455; border-color: #079455; color: #fff; }
.btn.success:hover { background: #067647; }
.btn.danger { background: #fff; border-color: var(--bad-bd); color: var(--bad-fg); }
.btn.danger:hover { background: var(--bad-bg); }
.btn svg { width: 16px; height: 16px; }

label { display: block; font-weight: 500; margin: 0 0 6px; color: var(--text-2); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
    font: inherit; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text);
    width: 100%; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus); }
.field { margin-bottom: 16px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; min-width: 280px; }

/* Description list */
.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); margin: 0; }
.dl dt { color: var(--text-3); padding: 10px 0; border-bottom: 1px solid var(--border); }
.dl dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--border); word-break: break-word; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; border: 1px solid; }
.alert.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.alert.bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.alert.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }

/* Receipt + lineup images */
.receipt-preview { display: block; max-width: 100%; max-height: 760px; margin: 0 auto; border-radius: 8px; border: 1px solid var(--border); }
.lineup-img { display: block; width: 100%; max-width: 460px; margin: 0 auto; border-radius: 8px; }

/* Pagination */
.pager { display: flex; gap: 4px; align-items: center; }
.pager a, .pager span { min-width: 32px; height: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); background: #fff; }
.pager a:hover { background: #f9fafb; }
.pager .current { background: #fff1f3; color: var(--brand); border-color: #ffccd5; font-weight: 600; }
.pager .disabled { color: #c0c5cc; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 10% -10%, #ffe4e8 0, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(16, 24, 40, .08); padding: 32px; }
.auth-card .brand { padding: 0 0 24px; color: var(--text); }
.auth-card .brand-sub { color: var(--text-3); }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card p { color: var(--text-3); margin: 0 0 24px; }
.auth-card .btn { width: 100%; padding: 10px; }

@media (max-width: 960px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex: none; }
    .nav { flex-direction: row; flex-wrap: wrap; padding-bottom: 12px; }
    .sidebar-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
    .logout { width: auto; margin: 0; }
    .content { padding: 20px 16px 40px; }
    .grid-2, .grid-side { grid-template-columns: 1fr; }
    .search input { width: 100%; }
    .dl { grid-template-columns: 1fr; }
    .dl dt { border-bottom: 0; padding-bottom: 0; }
}

/* Utilities (no inline styles, so a strict CSP works) */
.pt-0 { padding-top: 0; }
.m-0 { margin: 0; }
.mb-16 { margin-bottom: 16px; }
.stat-value.sm { font-size: 18px; }
.code-lg { font-size: 16px; }
.bar > span.w-0 { width: 0%; }
.bar > span.w-5 { width: 5%; }
.bar > span.w-10 { width: 10%; }
.bar > span.w-15 { width: 15%; }
.bar > span.w-20 { width: 20%; }
.bar > span.w-25 { width: 25%; }
.bar > span.w-30 { width: 30%; }
.bar > span.w-35 { width: 35%; }
.bar > span.w-40 { width: 40%; }
.bar > span.w-45 { width: 45%; }
.bar > span.w-50 { width: 50%; }
.bar > span.w-55 { width: 55%; }
.bar > span.w-60 { width: 60%; }
.bar > span.w-65 { width: 65%; }
.bar > span.w-70 { width: 70%; }
.bar > span.w-75 { width: 75%; }
.bar > span.w-80 { width: 80%; }
.bar > span.w-85 { width: 85%; }
.bar > span.w-90 { width: 90%; }
.bar > span.w-95 { width: 95%; }
.bar > span.w-100 { width: 100%; }
