:root {
    --bg: #0a0a0a;
    --panel: #111111;
    --panel-soft: #0f0f0f;
    --line: #222222;
    --line-strong: #444444;
    --text: #ffffff;
    --muted: #888888;
    --dim: #666666;
    --brand: #d1002c;
    --brand-dark: #970020;
    --gold: #d1002c;
    --green: #d1002c;
    --blue: #888888;
    --danger: #d1002c;
    --shadow: none;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: 'Montserrat', sans-serif;
    line-height: 1.45;
}

button,
input,
select {
    font: inherit;
}

button {
    min-height: 44px;
}

input,
select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    background: #0d1014;
    padding: 11px 12px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(209, 0, 44, 0.18);
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 7vw, 4rem);
    line-height: 0.95;
    letter-spacing: 0;
    text-transform: uppercase;
}

h2 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    line-height: 1.15;
    text-transform: uppercase;
}

h3 {
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(16px, 4vw, 44px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-decoration: none;
    text-transform: uppercase;
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex: 0 0 auto;
}

.brand span {
    white-space: nowrap;
}

.mode-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d1014;
}

.tab-button {
    border: 0;
    border-radius: 4px;
    color: var(--muted);
    background: transparent;
    padding: 9px 13px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tab-button.is-active {
    color: #fff;
    background: var(--brand);
}

main {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 34px 0 54px;
}

.view {
    display: none;
}

.view.is-active {
    display: block;
}

.section-head {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(290px, 0.88fr) minmax(340px, 1.12fr);
    gap: 18px;
    align-items: stretch;
}

.staff-workspace,
.admin-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.22fr);
    gap: 18px;
    align-items: start;
}

.panel,
.metric,
.operation-box {
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
}

.access-panel {
    max-width: 520px;
}

.panel-title-row,
.section-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.panel-title-row span,
.section-row span {
    color: var(--muted);
    font-size: 12px;
}

.status-pill,
.balance-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 6px 10px;
    color: #fff;
    background: rgba(209, 0, 44, 0.16);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.form-stack {
    display: grid;
    gap: 14px;
}

.inline-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.primary-action,
.ghost-action,
.danger-action,
.ghost-link {
    border-radius: 0;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.primary-action {
    border: 1px solid var(--brand);
    color: #fff;
    background: var(--brand);
    padding: 12px 16px;
}

.primary-action:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.ghost-action {
    border: 1px solid var(--line-strong);
    color: var(--text);
    background: transparent;
    padding: 9px 12px;
}

.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--line-strong);
    color: var(--text);
    background: transparent;
    padding: 9px 12px;
    font-size: 13px;
    text-decoration: none;
}

.ghost-action:hover,
.ghost-link:hover {
    border-color: var(--text);
}

.danger-action {
    border: 1px solid rgba(225, 79, 79, 0.72);
    color: #fff;
    background: rgba(225, 79, 79, 0.16);
    padding: 12px 16px;
}

.danger-action:hover {
    background: rgba(225, 79, 79, 0.28);
}

.primary-action:active,
.ghost-action:active,
.danger-action:active,
.tab-button:active {
    transform: translateY(1px);
}

.form-message {
    min-height: 20px;
    margin-top: 12px;
    color: var(--gold);
    font-size: 13px;
}

.form-message.is-error {
    color: var(--danger);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.84);
}

.privacy-sheet {
    width: min(720px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border: 1px solid var(--line-strong);
    background: #111;
    padding: 28px;
}

.privacy-copy {
    display: grid;
    gap: 12px;
    max-height: 310px;
    overflow: auto;
    border: 1px solid var(--line);
    background: #0a0a0a;
    color: var(--muted);
    padding: 18px;
    font-size: 14px;
}

.privacy-copy strong {
    color: #fff;
}

.privacy-note {
    color: #aaa;
    font-size: 12px;
}

.privacy-check {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-top: 18px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.privacy-check input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
    accent-color: var(--brand);
}

.privacy-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.customer-card {
    display: grid;
    gap: 18px;
}

.points-hero {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 24px;
    border-radius: 4px;
    background:
        linear-gradient(90deg, rgba(209, 0, 44, 0.22), transparent),
        #0d1014;
}

.points-value {
    font-size: clamp(3.7rem, 10vw, 7rem);
    font-weight: 900;
    line-height: 0.9;
}

.points-label {
    color: var(--muted);
    font-size: 18px;
    font-weight: 800;
}

.progress-wrap {
    display: grid;
    gap: 8px;
}

.progress-wrap p {
    color: var(--muted);
    font-size: 13px;
}

.progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #0d1014;
}

.progress-fill {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
    transition: width 0.22s ease;
}

.member-code {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #0d1014;
}

.member-code canvas {
    width: 120px;
    height: 120px;
    border: 8px solid #fff;
    background: #fff;
}

.member-code span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.member-code strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
    letter-spacing: 0.04em;
}

.reward-section {
    margin-top: 18px;
}

.reward-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.reward-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reward-card {
    min-height: 132px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    padding: 16px;
    display: grid;
    align-content: space-between;
    gap: 16px;
}

.reward-card.is-ready {
    border-color: var(--brand);
    background: #151515;
}

.reward-card strong {
    display: block;
    font-size: 18px;
}

.reward-card span {
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reward-card p {
    color: var(--muted);
    font-size: 12px;
}

.reward-card button {
    width: 100%;
}

.history-panel {
    margin-top: 18px;
}

.activity-list {
    display: grid;
    gap: 10px;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-title {
    display: block;
    color: var(--text);
}

.activity-meta {
    margin-top: 4px;
    color: var(--dim);
    font-size: 12px;
}

.activity-points {
    color: var(--gold);
    font-weight: 900;
    white-space: nowrap;
}

.activity-points.is-negative {
    color: var(--danger);
}

.search-input {
    margin-bottom: 14px;
}

.customer-list,
.staff-list,
.reward-table {
    display: grid;
    gap: 10px;
}

.customer-row,
.staff-row,
.reward-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--text);
    background: #0d1014;
    padding: 12px;
    text-align: left;
}

button.customer-row {
    cursor: pointer;
}

button.customer-row:hover,
button.customer-row.is-selected {
    border-color: var(--brand);
}

.customer-row strong,
.staff-row strong,
.reward-row strong {
    display: block;
}

.customer-row span,
.staff-row span,
.reward-row span {
    color: var(--muted);
    font-size: 12px;
}

.reward-admin-row {
    align-items: flex-start;
    display: grid;
    grid-template-columns: minmax(140px, 0.75fr) minmax(0, 1.35fr);
}

.reward-admin-row.is-disabled {
    opacity: 0.62;
}

.reward-rule-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px auto;
    gap: 10px;
    margin-bottom: 8px;
}

.reward-edit-form {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 110px auto auto;
    gap: 10px;
    width: 100%;
}

.reward-edit-form input {
    min-height: 42px;
}

.operations-panel {
    min-height: 400px;
}

.empty-state {
    display: grid;
    min-height: 360px;
    place-content: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
}

.empty-state h2 {
    color: var(--text);
}

.operation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.operation-box {
    display: grid;
    gap: 12px;
    padding: 16px;
    box-shadow: none;
}

.redeem-block {
    margin-top: 18px;
}

.danger-zone {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.customer-danger-zone {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.danger-action {
    border-color: rgba(209, 0, 44, 0.45);
    color: var(--danger);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric {
    padding: 16px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 34px;
    line-height: 1;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 14px;
}

.staff-role-form {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr 1fr auto auto;
    gap: 10px;
    margin-bottom: 4px;
}

.download-link {
    color: var(--gold);
}

.admin-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.poster-body {
    min-height: 100vh;
    background: #0a0a0a;
}

.poster-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    width: min(100% - 28px, 960px);
    padding: 34px 0;
}

.poster-card {
    width: min(760px, 100%);
    border: 1px solid #222;
    background: #111;
    padding: clamp(26px, 5vw, 54px);
    text-align: center;
}

.poster-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.poster-brand img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.poster-card h1 {
    max-width: 680px;
    margin: 10px auto 18px;
    font-size: clamp(2.5rem, 8vw, 5.3rem);
}

.poster-copy {
    color: #aaa;
    font-size: clamp(1rem, 2.6vw, 1.35rem);
}

.qr-frame {
    width: min(420px, 82vw);
    margin: 34px auto 22px;
    border: 12px solid #fff;
    background: #fff;
}

.qr-frame img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
}

.poster-url {
    color: #888;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.poster-warning {
    max-width: 520px;
    margin: 14px auto 0;
    border: 1px solid var(--brand);
    color: #fff;
    background: rgba(209, 0, 44, 0.16);
    padding: 12px;
    font-size: 13px;
}

.poster-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 24px;
    text-align: left;
}

.poster-actions {
    display: flex;
    gap: 10px;
}

[hidden] {
    display: none !important;
}

@media (max-width: 920px) {
    .workspace-grid,
    .staff-workspace,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .reward-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
        padding: 12px;
    }

    .brand {
        justify-content: center;
    }

    .mode-tabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tab-button {
        padding: 9px 6px;
        font-size: 11px;
    }

    main {
        width: min(100% - 20px, 1180px);
        padding-top: 22px;
    }

    .panel {
        padding: 16px;
    }

    .panel-title-row,
    .section-row,
    .activity-item {
        align-items: flex-start;
    }

    .points-hero {
        padding: 18px;
    }

    .member-code {
        align-items: flex-start;
        flex-direction: column;
    }

    .reward-grid,
    .reward-grid.compact,
    .operation-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }

    .inline-actions,
    .staff-role-form,
    .reward-rule-form,
    .reward-edit-form {
        grid-template-columns: 1fr;
    }

    .reward-admin-row {
        grid-template-columns: 1fr;
    }

    .privacy-sheet {
        padding: 20px;
    }

    .privacy-actions {
        flex-direction: column-reverse;
    }

    .poster-controls {
        grid-template-columns: 1fr;
    }

    .poster-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}

@media print {
    body {
        background: #fff;
    }

    .poster-shell {
        width: 100%;
        min-height: auto;
        padding: 0;
    }

    .poster-card {
        border: 0;
        color: #111;
        background: #fff;
        padding: 18mm 14mm;
    }

    .poster-brand,
    .poster-card .eyebrow,
    .poster-card h1 {
        color: #111;
    }

    .poster-copy,
    .poster-url {
        color: #333;
    }

    .poster-controls,
    .poster-warning {
        display: none !important;
    }
}
