:root {
    --bg: #f5f1e8;
    --bg-card: #ffffff;
    --bg-sidebar: #1a2420;
    --bg-sidebar-accent: #243530;
    --ink: #1a2420;
    --ink-soft: #5a6159;
    --ink-muted: #8a8f86;
    --border: #e5ddcd;
    --border-strong: #c9c0ac;
    --accent: #543a6b;
    --accent-dark: #3c2a50;
    --accent-warm: #c4733a;
    --accent-gold: #c89a3a;
    --red: #b94545;
    --red-soft: #f5e0e0;
    --green-soft: #e4ecd9;
    --amber-soft: #f5e8cc;
    --shadow-sm: 0 1px 2px rgba(26, 36, 32, 0.04), 0 2px 6px rgba(26, 36, 32, 0.05);
    --shadow-md: 0 4px 14px rgba(26, 36, 32, 0.08);
    --radius: 10px;
    --radius-lg: 16px;
    --font-body: 'Arial', -apple-system, sans-serif;
    --font-display: 'Roboto', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --mobile-header-h: 70px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

body {
    background-image:
        radial-gradient(at 15% 0%, rgba(196, 115, 58, 0.06) 0px, transparent 40%),
        radial-gradient(at 85% 100%, rgba(77, 107, 58, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0 0 0.4em 0;
    font-variation-settings: "opsz" 32;
}
h1 { font-size: 2.4rem; line-height: 1.05; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    background: var(--bg-sidebar);
    color: #e8e3d4;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #0e1814;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 24px; /* replaces flex:1 — just adds spacing below the brand */
    min-width: 0;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #e8e3d4;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
    .brand-mark img {
        width: 36px;
        height: 36px;
        display: block;
        filter: brightness(0) invert(1);
        margin-right:3px;
    }
.brand-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.1;
    color: #f5f1e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a9388;
    margin-top: 3px;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-section {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6d7b71;
    margin: 22px 10px 8px;
}

.nav-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6d7b71;
    margin: 22px 0 8px;
    padding: 0 10px;
    transition: color 0.15s;
}

.nav-section-toggle:hover {
    color: #c4cec1;
}

.nav-section-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

/* Rotate chevron when expanded */
.nav-section-toggle[aria-expanded="true"] .nav-section-chevron {
    transform: rotate(180deg);
}

.nav-section-panel {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-panel.is-open {
    max-height: none; /* set via JS */
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #c4cec1;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #f5f1e8;
    text-decoration: none;
}

.nav-link.active {
    background: var(--bg-sidebar-accent);
    color: #f5f1e8;
}

.nav-link.active .nav-dot {
    background: var(--accent-warm);
    box-shadow: 0 0 8px rgba(196, 115, 58, 0.5);
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-foot {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-warm);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
}

.user-name { font-size: 0.85rem; font-weight: 600; color: #e8e3d4; }

.logout-form { margin: 0; }

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: #8a9388;
    cursor: pointer;
    font-size: 0.75rem;
}
.link-btn:hover { color: #c4cec1; text-decoration: underline; }

/* ========== MAIN ========== */
.main {
    padding: 40px 48px 60px;
    max-width: 1400px;
    width: 100%;
}

.flash {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
    border: 1px solid transparent;
}
.flash-ok {
    background: var(--green-soft);
    border-color: #b8cba0;
    color: #2e4820;
}
.flash-err {
    background: var(--red-soft);
    border-color: #e8b8b8;
    color: #6b2020;
}
.flash-warn {
    background: #fff8e6;
    border-color: #f0c060;
    color: #7a4f00;
}

/* ========== PAGE ========== */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 2.6rem;
    margin: 0;
    font-variation-settings: "opsz" 144;
}

.page-sub {
    color: var(--ink-soft);
    margin: 4px 0 0 0;
    font-size: 0.95rem;
}

.page-head .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    margin: 0;
}

/* ========== KPI GRID ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
}

.kpi::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
}
.kpi.kpi-warm::before { background: var(--accent-warm); }
.kpi.kpi-gold::before { background: var(--accent-gold); }
.kpi.kpi-red::before { background: var(--red); }

.kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 500;
    line-height: 1;
    font-variation-settings: "opsz" 144;
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin-top: 6px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .main { padding: 24px 20px; }
    .grid-2 { grid-template-columns: 1fr; }
}

/* ========== TABLES ========== */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover td { background: rgba(196, 115, 58, 0.03); }
.table tbody tr:last-child td { border-bottom: 0; }

.table-compact td, .table-compact th { padding: 8px 10px; font-size: 0.85rem; }

.mono { font-family: var(--font-mono); font-size: 0.85em; }
.num { font-variant-numeric: tabular-nums; text-align: match-parent; font-family: var(--font-mono); }

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge-active { background: var(--green-soft); color: #2e4820; border-color: #b8cba0; }
.badge-pending { background: var(--amber-soft); color: #7a5920; border-color: #d9c498; }
.badge-expired { background: #eceae4; color: #5a6159; border-color: #cfc9b9; }
.badge-suspended, .badge-cancelled { background: var(--red-soft); color: #6b2020; border-color: #d9a6a6; }
.badge-tier-standard { background: #eceae4; color: #5a6159; }
.badge-tier-premium { background: #e4eaef; color: #2d4a66; border-color: #b8c9d9; }
.badge-tier-founder { background: #f5ecd4; color: #7a5920; border-color: #d9c498; }
.badge-low { background: var(--red-soft); color: #6b2020; border-color: #d9a6a6; }

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    text-decoration: none;
    line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--accent);
    color: #f5f1e8;
    border-color: var(--accent-dark);
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }

.btn-warm {
    background: var(--accent-warm);
    color: #fff;
    border-color: #a65a2d;
}
.btn-warm:hover { background: #a65a2d; color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-card); }

.btn-danger {
    background: transparent;
    color: var(--red);
    border-color: #e0a0a0;
}
.btn-danger:hover { background: var(--red-soft); }

.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

.inline-input {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.875rem;
    width: 100%;
    max-width: 200px;
}
.inline-input--sm { max-width: 80px; }

/* ========== FORMS ========== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.wide { grid-column: 1 / -1; }

label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    text-transform: uppercase;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="password"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #fdfbf5;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--ink);
    transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(77, 107, 58, 0.15);
}
textarea { resize: vertical; min-height: 90px; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.checkbox-row label { text-transform: none; font-size: 0.9rem; font-weight: 500; margin: 0; color: var(--ink); letter-spacing: 0; }

.text-danger { color: var(--red); font-size: 0.8rem; font-weight: 500; }
.field-validation-error { color: var(--red); font-size: 0.8rem; }
.input-validation-error { border-color: var(--red); }

.variance-warning-card {
    border-left: 3px solid var(--red);
}

.override-limit-section {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--gold) 6%, transparent);
}

.override-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink);
    user-select: none;
}

.override-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.filter-bar .form-field { min-width: 180px; }

/* ========== POS ========== */
.pos {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    align-items: start;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 12px;
}

.product-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.12s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.product-tile:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.product-tile .cat {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    font-weight: 600;
}
.product-tile .name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
}
.product-tile .price {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-dark);
    margin-top: auto;
}
.product-tile .stock {
    font-size: 0.7rem;
    color: var(--ink-muted);
}
.product-tile.out { opacity: 0.4; cursor: not-allowed; }

.cart {
    position: sticky;
    top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.cart-lines { margin: 14px 0; }
.cart-line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
}
.cart-line:last-child { border-bottom: 0; }

.qty-ctrl {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    overflow: hidden;
}
.qty-ctrl button {
    background: #fdfbf5;
    border: 0;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-weight: 700;
    color: var(--ink);
}
.qty-ctrl button:hover { background: var(--bg); }
.qty-ctrl .q { padding: 0 10px; min-width: 24px; text-align: center; font-weight: 600; font-family: var(--font-mono); }

.till-calc-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.till-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: var(--muted);
}

.till-calc-row .num {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.till-calc-total {
    color: var(--ink);
    font-weight: 600;
    border-top: 1px solid var(--border);
    padding-top: 6px;
    margin-top: 4px;
}

.denom-counter {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px 12px;
    margin-bottom: 20px;
}
.denom-counter-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-bottom: 6px;
}
.denom-counter table { border-collapse: collapse; }
.denom-counter td { padding: 2px 8px; font-size: 0.88rem; vertical-align: middle; }
.denom-counter .denom-head td {
    color: var(--ink-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 8px;
    padding-bottom: 2px;
}
.denom-counter tfoot td {
    border-top: 1px solid var(--border);
    padding-top: 7px;
    font-weight: 600;
}
.denom-counter input[type=number] {
    width: 64px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 6px;
    background: var(--bg-card);
    color: var(--ink);
}
.denom-counter input[type=number]:focus { outline: 2px solid var(--accent); border-color: transparent; }
.denom-val {
    font-family: var(--font-mono);
    color: var(--ink-muted);
    text-align: right;
    min-width: 72px;
    font-size: 0.88rem;
}
.denom-val.has-value { color: var(--ink); }

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 14px;
    border-top: 2px solid var(--ink);
    margin-top: 14px;
}
.cart-total .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    font-weight: 600;
}
.cart-total .amount {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 500;
}

/* ========== MEMBER DETAILS ========== */
.member-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 22px;
    align-items: center;
    padding: 28px;
    background: linear-gradient(135deg, #fffdf7 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}
.member-avatar {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #f5f1e8;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.member-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.1;
    margin: 0;
}
.member-meta {
    display: flex;
    gap: 16px;
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin-top: 6px;
    flex-wrap: wrap;
}
.member-meta .dot { color: var(--border-strong); }

.wallet-pill {
    padding: 14px 20px;
    border-radius: 12px;
    background: var(--ink);
    color: #f5f1e8;
    text-align: right;
    min-width: 140px;
}
.wallet-pill .label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8a9388;
}
.wallet-pill .amount {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 500;
    font-variation-settings: "opsz" 144;
}

/* Receipt */
.receipt {
    max-width: 460px;
    margin: 0 auto;
    background: #fdfbf5;
    padding: 36px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    font-family: var(--font-mono);
    font-size: 0.88rem;
}
.receipt-head { text-align: center; border-bottom: 1px dashed var(--border-strong); padding-bottom: 16px; margin-bottom: 16px; }
.receipt-head h2 { font-family: var(--font-display); font-size: 1.4rem; }
.receipt-line { display: flex; justify-content: space-between; padding: 4px 0; }
.receipt-total { border-top: 1px dashed var(--border-strong); margin-top: 12px; padding-top: 12px; font-weight: 700; font-size: 1rem; }

/* Empty state */
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--ink-muted);
}
.empty h3 { font-family: var(--font-display); color: var(--ink-soft); }

/* Utility */
.inline { display: inline-flex; align-items: center; gap: 8px; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.85rem; }
/* ========== ID / PHOTO CAPTURE ========== */
.capture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.capture-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: #fdfbf5;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.capture-title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    text-transform: uppercase;
}

.capture-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #1c1c1a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .capture-preview.portrait {
        aspect-ratio: 3 / 4;
        max-width: 220px;
        align-self: center;
    }

    .capture-preview video,
    .capture-preview img,
    .capture-preview canvas {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.capture-placeholder {
    color: #6e7068;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.capture-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.capture-upload-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
/* ========== MEMBER PHOTO AVATAR ========== */
/* Overrides the gradient-filled initials avatar when a photo is available. */
.member-avatar.member-avatar-photo {
    background: #1c1c1a;
    padding: 0;
    overflow: hidden;
    border: 2px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

    .member-avatar.member-avatar-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

/* ========== ID DOCUMENT MODAL ========== */
.id-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

    .id-modal[hidden] {
        display: none;
    }

.id-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 24, 22, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: idModalFade 0.15s ease-out;
}

.id-modal-dialog {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    max-width: min(95vw, 1100px);
    max-height: 92vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: idModalPop 0.18s ease-out;
}

@keyframes idModalFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes idModalPop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.id-modal-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.id-modal-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    flex-shrink: 0;
}

.id-modal-tabs {
    display: flex;
    gap: 4px;
    margin-left: auto;
    padding: 3px;
    background: #efe8d8;
    border-radius: 8px;
}

.id-modal-tab {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-soft);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}

    .id-modal-tab:hover:not(:disabled) {
        color: var(--ink);
    }

    .id-modal-tab.active {
        background: var(--bg-card);
        color: var(--ink);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    }

    .id-modal-tab:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

.id-modal-close {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0 4px;
    margin-left: 4px;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}

    .id-modal-close:hover {
        color: var(--ink);
        background: var(--border);
    }

.id-modal-body {
    flex: 1;
    min-height: 0;
    padding: 20px;
    background: #1c1c1a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

    .id-modal-body img {
        max-width: 100%;
        max-height: 75vh;
        object-fit: contain;
        border-radius: 6px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

.id-modal-foot {
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 600px) {
    .id-modal {
        padding: 0;
    }

    .id-modal-dialog {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .id-modal-body img {
        max-height: none;
    }
}
/* ========== PUBLIC PRODUCT MENU ========== */
.menu-category-heading {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin: 36px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 12px;
}

.menu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.14s, box-shadow 0.14s;
    display: flex;
    flex-direction: column;
}

.menu-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.menu-card-img {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #1c1c1a;
    overflow: hidden;
}

.menu-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.menu-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5248;
}

.menu-card-strain {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(26, 36, 32, 0.75);
    color: #e8e3d4;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}

.menu-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.menu-card-name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
}

.menu-card-cultivator {
    font-size: 0.78rem;
    color: var(--ink-muted);
}

.menu-card-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.menu-stat {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 999px;
}

.menu-stat.thc {
    background: var(--amber-soft);
    color: #7a5920;
}

.menu-stat.cbd {
    background: var(--green-soft);
    color: #2e4820;
}

.menu-card-price {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-dark);
    margin-top: auto;
    padding-top: 10px;
}

/* ========== STANDALONE MENU LAYOUT ========== */
body.menu-standalone {
    background: var(--bg);
    min-height: 100vh;
}

.menu-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}

.menu-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.menu-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-lg);
    transition: opacity 0.15s;
}

.menu-qr:hover {
    opacity: 0.75;
}

.menu-qr canvas,
.menu-qr img {
    display: block;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    background: #fff;
}

.menu-qr-label {
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* QR modal */
.qr-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.qr-modal-backdrop[hidden] {
    display: none;
}

.qr-modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 40px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 420px;
    width: 100%;
}

.qr-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
}

.qr-modal-close:hover {
    background: #f0f0f0;
}

.qr-modal-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: #111;
    text-align: center;
}

.qr-modal-sub {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    margin-top: -6px;
}

.qr-modal-box canvas,
.qr-modal-box img {
    display: block;
    border: 3px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}

.qr-modal-url {
    font-size: 0.7rem;
    color: #999;
    word-break: break-all;
    text-align: center;
    max-width: 300px;
}

.menu-header-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
}

.menu-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

/* ========== COLLAPSIBLE NAV (< 800px) ========== */
.nav-toggle {
    display: none;
}

@media (max-width: 799px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    /* Aside shrinks to just the brand bar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: var(--mobile-header-h);
        min-height: unset;
        flex-direction: row;
        align-items: center;
        padding: 12px 16px;
        z-index: 200;
        border-right: none;
        border-bottom: 1px solid #0e1814;
        overflow: visible;
    }

    .sidebar .nav {
        position: fixed;
        top: var(--mobile-header-h);
        left: 0;
        width: 260px;
        max-height: calc(100vh - var(--mobile-header-h));
        background: var(--bg-sidebar);
        padding: 12px 22px 22px;
        overflow-y: auto;
        z-index: 201;
        border-bottom-right-radius: 12px;
        box-shadow: 4px 4px 24px rgba(0,0,0,0.35);
        transform: translateX(-110%);
        transition: transform 0.25s ease;
    }

    .main {
        padding-top: calc(var(--mobile-header-h) + 24px);
    }

    /* Hide the footer (user chip) in the collapsed bar */
    .sidebar-foot {
        display: none;
    }

    /* Nav panel slides in from the left, below the brand bar */
    .sidebar .nav {
        position: fixed;
        top: var(--mobile-header-h);
        left: 0;
        width: 260px;
        max-height: calc(100vh - var(--mobile-header-h));
        background: var(--bg-sidebar);
        padding: 12px 22px 22px;
        overflow-y: auto;
        z-index: 201;
        border-bottom-right-radius: 12px;
        box-shadow: 4px 4px 24px rgba(0,0,0,0.35);
        transform: translateX(-110%);
        transition: transform 0.25s ease;
    }

    .sidebar .nav.is-open {
        transform: translateX(0);
    }

    /* Dim overlay behind the nav panel */
    .nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 199;
    }

    .nav-overlay.is-open {
        display: block;
    }

    /* Hamburger button � sits in the brand bar on the right */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin-left: auto;
        width: 40px;
        height: 30px;
        background: var(--bg-sidebar-accent);
        border: none;
        border-radius: 8px;
        padding: 7px 8px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .nav-toggle span {
        display: block;
        height: 2px;
        background: #e8e3d4;
        border-radius: 2px;
    }

    /* Push main content below the fixed brand bar */
    .main {
        padding-top: calc(var(--mobile-header-h) + 24px);
    }
}

/* Dashboard quick-action button row */
.dashboard-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 24px;
}

/* Larger icons inside dashboard action buttons */
.dashboard-quick-actions .btn i {
    font-size: 1.25rem;
    vertical-align: -0.2em;
}

/* Receipt drag-and-drop upload zone */
.receipt-drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 24px 20px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--bg);
    user-select: none;
}
.receipt-drop-zone:hover,
.receipt-drop-zone--over {
    border-color: var(--accent);
    background: rgba(84, 58, 107, 0.04);
}
.receipt-drop-zone--over { border-style: solid; }
.receipt-drop-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 0.9rem;
    text-align: center;
}
.receipt-drop-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}
.receipt-drop-error {
    font-size: 0.85rem;
    color: var(--red);
    margin-top: 6px;
    text-align: center;
}

/* Receipt / attachment modal */
.receipt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 36, 32, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.receipt-modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 900px;
    width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.receipt-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.receipt-modal-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.receipt-modal-body img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius);
    display: block;
}
.receipt-modal-body iframe {
    width: 100%;
    height: 70vh;
    border: none;
}

/* ── Appointment slot picker ─────────────────────────────── */
.appt-slot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.appt-slot {
    position: relative;
    cursor: pointer;
}
.appt-slot input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.appt-slot span {
    display: inline-block;
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    background: var(--surface);
    color: var(--ink);
}
.appt-slot:hover span,
.appt-slot input[type="radio"]:focus + span {
    border-color: var(--accent);
}
.appt-slot-selected span,
.appt-slot input[type="radio"]:checked + span {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Unified cart POS tabs ───────────────────────────────── */
.cart-tab {
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--surface);
    border: none;
    cursor: pointer;
    color: var(--muted);
    transition: background 0.12s, color 0.12s;
}
.cart-tab:first-child { border-right: 1px solid var(--border); }
.cart-tab-active {
    background: var(--accent);
    color: #fff;
}
.cart-tab:hover:not(.cart-tab-active) { background: var(--hover, #f1f5f9); }
