:root {
    --page: #f5f7fb;
    --page-strong: #e9f5f1;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-tint: #eef8f4;
    --ink: #172033;
    --ink-soft: #2a3448;
    --muted: #667489;
    --border: #dbe4ee;
    --border-strong: #c7d4e1;
    --primary: #087f5b;
    --primary-strong: #056548;
    --primary-soft: #e3f7ee;
    --secondary: #f0b133;
    --secondary-strong: #a86a00;
    --accent: #1f6fbf;
    --danger: #c83a3a;
    --danger-soft: #fdecec;
    --warning: #b66f00;
    --paid: #0b7a5b;
    --reserved: #b66f00;
    --shadow: 0 18px 42px rgba(23, 32, 51, 0.12);
    --shadow-soft: 0 8px 22px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
    letter-spacing: 0;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, var(--page-strong) 0, var(--page) 360px, #f9fbfd 100%),
        repeating-linear-gradient(90deg, rgba(8, 127, 91, 0.04) 0 1px, transparent 1px 72px);
}

body.has-open-modal {
    overflow: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    touch-action: manipulation;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
    padding: 0 max(20px, calc((100vw - 1180px) / 2 + 20px));
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(219, 228, 238, 0.9);
    backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--ink);
    font-weight: 850;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(8, 127, 91, 0.22);
    font-size: 0.95rem;
}

.brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.nav a,
.link-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    color: var(--ink-soft);
    font-weight: 750;
}

.nav a:not(.btn) {
    padding: 0 6px;
}

.nav a.btn-primary,
.nav a.btn-primary:hover {
    color: #fff;
}

.nav-user {
    max-width: 170px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-cart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    color: var(--primary-strong);
    background: var(--primary-soft);
    border: 1px solid #b8e8d4;
    border-radius: 8px;
    font-weight: 850;
    cursor: pointer;
}

.cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    color: #fff;
    background: var(--primary);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.cart-badge.is-empty {
    color: var(--muted);
    background: #e7edf4;
}

.nav-form {
    margin: 0;
}

.link-button {
    padding: 0 6px;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.link-button:hover {
    color: var(--primary);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 5px auto;
    background: var(--ink);
    border-radius: 999px;
    transition: transform 0.16s ease, opacity 0.16s ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.page-shell {
    flex: 1 0 auto;
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 72px;
}

.app-footer {
    flex: 0 0 auto;
    color: #dbe7f0;
    background:
        linear-gradient(135deg, #142338 0%, #173a35 52%, #2e4d3e 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(240px, 1.45fr) minmax(170px, 0.7fr) minmax(240px, 0.9fr);
    gap: 28px;
    padding: 34px 0 28px;
}

.footer-brand,
.footer-section {
    min-width: 0;
}

.footer-logo {
    color: #fff;
}

.footer-logo .brand-mark {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.footer-brand p,
.footer-section p {
    max-width: 380px;
    margin: 14px 0 0;
    color: #b9c9d6;
    line-height: 1.65;
}

.footer-section h2 {
    margin: 0 0 12px;
    color: #fff;
    font-size: 0.86rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.footer-section a,
.footer-link-button {
    width: fit-content;
    min-height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    color: #dbe7f0;
    font-weight: 750;
}

.footer-section a:hover,
.footer-link-button:hover {
    color: #ffffff;
}

.footer-link-button {
    text-align: left;
}

.footer-trust {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-top: 14px;
    padding: 0 12px;
    color: #193527;
    background: #d8f7e2;
    border: 1px solid rgba(216, 247, 226, 0.74);
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 850;
}

.footer-bottom {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 18px;
    padding: 16px 0 18px;
    color: #aebfcc;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.92rem;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.section-heading h1,
.auth-panel h1,
.empty-state h1 {
    margin: 0;
    color: var(--ink);
    font-size: 2.35rem;
    line-height: 1.08;
}

.section-heading h2,
.plain-section h2,
.admin-form h2 {
    margin: 0 0 16px;
    color: var(--ink);
}

.visit-counter,
.result-count {
    margin: 8px 0 0;
    color: var(--muted);
    font-weight: 750;
}

.visit-counter strong {
    color: var(--primary);
}

.result-count {
    display: inline-flex;
    margin-bottom: 16px;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--secondary-strong);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.muted,
.label,
dt {
    color: var(--muted);
}

.label,
dt {
    display: block;
    margin-bottom: 4px;
    font-size: 0.77rem;
    font-weight: 850;
    text-transform: uppercase;
}

dd {
    margin: 0;
    color: var(--ink);
    font-weight: 800;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 850;
    cursor: pointer;
    transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 10px 22px rgba(8, 127, 91, 0.2);
}

.btn-primary:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
}

.btn-secondary {
    color: #241600;
    background: var(--secondary);
    border-color: #e0a42d;
}

.btn-secondary:hover {
    background: #ffc453;
}

.btn-light {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--border);
}

.btn-light:hover {
    border-color: var(--primary);
    color: var(--primary-strong);
}

.btn-danger {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #a92929;
    border-color: #a92929;
}

.btn.is-disabled,
.btn:disabled {
    color: #8793a4;
    background: #eef2f6;
    border-color: var(--border);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-small {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.9rem;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    font-weight: 750;
}

.alert-success {
    color: #0f5132;
    background: #e8f7ee;
    border-color: #b8e4cb;
}

.alert-error {
    color: #842029;
    background: var(--danger-soft);
    border-color: #f2b8bd;
}

.alert-warning {
    color: #7a4f00;
    background: #fff7df;
    border-color: #efd28c;
}

.raffle-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.raffle-card,
.cart-order,
.auth-panel,
.empty-state,
.payment-qr,
.payment-copy,
.admin-form,
.stats-grid > div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.raffle-card {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.raffle-card:hover {
    transform: translateY(-3px);
    border-color: rgba(8, 127, 91, 0.38);
    box-shadow: var(--shadow);
}

.raffle-card.is-encerrada {
    opacity: 0.76;
    filter: saturate(0.8);
}

.raffle-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    min-height: 190px;
    color: #fff;
    background: #d9e2ec;
}

.raffle-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.raffle-media::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 44%;
    background: linear-gradient(180deg, rgba(14, 23, 38, 0), rgba(14, 23, 38, 0.74));
}

.status-pill {
    position: absolute;
    right: 14px;
    top: 14px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 8px 18px rgba(23, 32, 51, 0.18);
}

.status-ativa {
    color: #053d2b;
    background: #a9f2d2;
}

.status-encerrada {
    color: #fff;
    background: #6b7280;
}

.raffle-body {
    display: grid;
    grid-template-rows: auto auto auto auto 1fr;
    gap: 15px;
    padding: 18px;
}

.raffle-body h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.22rem;
    line-height: 1.2;
}

.raffle-body p {
    margin: 0;
    color: var(--muted);
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.card-status-text {
    color: var(--primary);
}

.is-encerrada .card-status-text {
    color: var(--danger);
}

.countdown-box {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid #d8ede4;
    border-radius: 8px;
    background: var(--surface-tint);
}

.countdown-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.countdown-timer {
    color: var(--primary-strong);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.is-encerrada .countdown-box {
    background: var(--surface-soft);
    border-color: var(--border);
}

.is-encerrada .countdown-timer {
    color: var(--danger);
}

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

.meta-grid > div {
    min-width: 0;
}

.card-actions,
.order-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    align-self: end;
}

.card-actions .btn {
    flex: 1 1 135px;
}

.auth-panel {
    width: min(480px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.auth-panel > div {
    margin-bottom: 18px;
}

.auth-panel .muted {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.form-heading h2 {
    margin: 0;
}

.form-grid label,
.field-group {
    display: grid;
    gap: 8px;
    min-width: 0;
    color: var(--ink-soft);
    font-weight: 750;
}

.file-upload-field {
    min-width: 0;
}

.file-picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.form-grid .file-picker label.btn {
    display: inline-flex;
    font-weight: 850;
}

.file-input {
    position: absolute;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.file-name {
    min-width: 0;
    color: var(--muted);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.file-hint {
    color: var(--muted);
    font-weight: 650;
}

.rifa-image-preview {
    width: 100%;
    max-height: 210px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.form-grid input,
.form-grid textarea,
.form-grid select,
.payment-copy textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 12px 14px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(23, 32, 51, 0.02);
}

.form-grid textarea,
.payment-copy textarea {
    min-height: auto;
    resize: vertical;
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus,
.payment-copy textarea:focus {
    outline: 3px solid rgba(8, 127, 91, 0.16);
    border-color: var(--primary);
}

.rifa-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
}

.rifa-detail-media {
    position: relative;
    min-height: 280px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #d9e2ec;
    box-shadow: var(--shadow-soft);
}

.rifa-detail-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rifa-detail-copy {
    display: grid;
    align-content: center;
    padding: 22px;
    border-left: 4px solid var(--secondary);
    background: rgba(255, 255, 255, 0.64);
}

.rifa-detail-copy p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 1.05rem;
    line-height: 1.65;
}

.detail-band {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 26px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.detail-band > div {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.plain-section {
    margin-top: 28px;
}

.compact-heading {
    align-items: center;
    margin-bottom: 14px;
}

.compact-heading h2 {
    margin: 0;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 8px;
}

.number-cell {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.number-cell:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: var(--primary);
}

.number-cell:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.number-cell.is-selected {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(8, 127, 91, 0.2);
}

.number-cell.is-disponivel,
.number-cell.is-livre {
    border-color: #99daba;
    background: #fbfffd;
}

.number-cell.is-reservado {
    background: #fff6dc;
    border-color: #eccf82;
    color: var(--reserved);
}

.number-cell.is-pago,
.number-cell.is-vendido {
    background: #e6f6ee;
    border-color: #9bd8b5;
    color: var(--paid);
}

.number-cell.is-expirado {
    background: #f8f2e8;
    border-color: #e0c489;
    color: #7a4f00;
}

.number-cell.is-indisponivel {
    background: #edf1f5;
    border-color: #ccd6e1;
    color: #657386;
}

.static-grid .number-cell {
    cursor: default;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.56);
}

.modal.is-open {
    display: flex;
}

.modal-panel {
    width: min(780px, 100%);
    max-height: min(90vh, 820px);
    overflow: auto;
    padding: 24px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.cart-modal-panel {
    width: min(860px, 100%);
}

.cart-modal-body {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.cart-modal-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-tint);
    color: var(--muted);
    font-weight: 750;
}

.cart-modal-summary strong {
    color: var(--ink);
}

.modal-order {
    box-shadow: none;
}

.modal-pay-form {
    display: flex;
    justify-content: flex-end;
}

.modal-order-actions {
    justify-content: flex-end;
}

.compact {
    box-shadow: none;
}

.modal-header,
.modal-footer,
.order-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.modal-header {
    position: sticky;
    top: -24px;
    z-index: 1;
    margin: -24px -24px 18px;
    padding: 20px 24px 14px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.modal-header h2 {
    margin: 0;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 1.55rem;
    line-height: 1;
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.status-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #99daba;
}

.status-reservado {
    background: #eccf82;
}

.status-livre,
.status-disponivel {
    background: #99daba;
}

.status-pago,
.status-vendido {
    background: var(--paid);
}

.status-expirado {
    background: #d4aa56;
}

.status-indisponivel {
    background: #a6b2c0;
}

.modal-footer {
    position: sticky;
    bottom: -24px;
    margin: 20px -24px -24px;
    padding: 14px 24px 20px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.selection-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-weight: 750;
}

.selection-summary strong {
    color: var(--ink);
    font-size: 1.4rem;
}

.selection-summary span:last-child {
    color: var(--primary-strong);
    font-weight: 900;
}

.cart-list {
    display: grid;
    gap: 16px;
}

.cart-order {
    padding: 20px;
}

.order-topline strong {
    overflow-wrap: anywhere;
}

.order-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 18px 0;
}

.cart-items {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.cart-expiration {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    color: var(--muted);
    font-weight: 750;
}

.cart-expiration strong {
    color: var(--warning);
    font-variant-numeric: tabular-nums;
}

.is-expired .cart-expiration strong,
.payment-qr.is-expired [data-payment-countdown] {
    color: var(--danger);
}

.cart-item-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 2fr);
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.cart-item-row strong {
    color: var(--ink);
}

.cart-item-row span {
    display: block;
    color: var(--muted);
}

.number-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.number-pills > span,
.number-badge,
.number-pill-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 34px;
    padding: 0 9px;
    border-radius: 8px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.number-remove-form {
    margin: 0;
}

.number-pill-button {
    gap: 6px;
    cursor: pointer;
}

.number-pill-button:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.number-pill-button span:last-child {
    color: var(--danger);
    font-weight: 900;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--ink-soft);
    background: #eef2f6;
    border: 1px solid var(--border);
    font-size: 0.84rem;
    font-weight: 850;
    white-space: nowrap;
}

.badge-pending {
    color: #7a4f00;
    background: #fff5d6;
    border-color: #ecd28d;
}

.empty-state {
    display: grid;
    justify-items: start;
    gap: 14px;
    padding: 32px;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
}

.payment-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.payment-qr,
.payment-copy {
    padding: 22px;
}

.payment-qr {
    display: grid;
    gap: 10px;
    justify-items: center;
    text-align: center;
}

.payment-qr img {
    width: min(250px, 100%);
    height: auto;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.payment-qr strong {
    font-size: 1.35rem;
}

.payment-copy {
    display: grid;
    gap: 12px;
}

.payment-copy label {
    color: var(--ink-soft);
    font-weight: 850;
}

.payment-copy textarea {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 0.92rem;
    line-height: 1.5;
}

.payment-note {
    margin: 0;
    color: var(--primary-strong);
    font-weight: 750;
    line-height: 1.5;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.admin-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    font-weight: 800;
}

.account-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.account-panel h2,
.account-panel p {
    margin: 0;
}

.account-panel .muted {
    margin-top: 6px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.stats-grid > div {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.stats-grid span {
    color: var(--muted);
    font-weight: 750;
}

.stats-grid strong {
    color: var(--ink);
    font-size: 1.65rem;
}

.admin-split {
    display: grid;
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.admin-form {
    padding: 20px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 0.78rem;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    color: var(--ink-soft);
}

td code {
    overflow-wrap: anywhere;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fbfdff;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.table-actions form {
    margin: 0;
}

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

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

    .admin-form {
        max-width: 640px;
    }
}

@media (max-width: 780px) {
    .app-header {
        min-height: 68px;
        padding: 0 14px;
    }

    .nav-toggle {
        display: block;
    }

    .nav {
        position: absolute;
        top: 68px;
        left: 12px;
        right: 12px;
        display: none;
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        box-shadow: var(--shadow);
    }

    .nav.is-open {
        display: flex;
    }

    .nav a,
    .nav .btn,
    .nav-cart-button,
    .link-button {
        width: 100%;
        justify-content: center;
    }

    .nav-user {
        max-width: none;
        padding: 8px 6px;
        text-align: center;
    }

    .page-shell {
        width: min(100% - 24px, 1180px);
        margin-top: 20px;
        margin-bottom: 44px;
    }

    .footer-inner,
    .footer-bottom {
        width: min(100% - 24px, 1180px);
    }

    .footer-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 18px;
        padding: 28px 0 22px;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .footer-section a,
    .footer-link-button {
        width: fit-content;
        min-height: 42px;
        justify-content: flex-start;
    }

    .footer-bottom {
        flex-direction: column;
        padding-bottom: 22px;
    }

    .section-heading,
    .account-panel,
    .modal-footer,
    .order-topline {
        align-items: stretch;
        flex-direction: column;
    }

    .section-heading h1,
    .auth-panel h1,
    .empty-state h1 {
        font-size: 1.85rem;
    }

    .btn-small {
        min-height: 44px;
    }

    .section-heading > .btn,
    .section-heading > a,
    .section-heading > button,
    .card-actions .btn,
    .order-actions .btn,
    .order-actions form,
    .modal-footer .btn {
        width: 100%;
    }

    .card-actions .btn {
        flex-basis: 100%;
    }

    .raffle-grid {
        grid-template-columns: 1fr;
    }

    .raffle-media {
        min-height: 210px;
    }

    .detail-band,
    .rifa-detail-layout,
    .order-meta,
    .payment-layout {
        grid-template-columns: 1fr;
    }

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

    .modal {
        align-items: flex-end;
        padding: 12px;
    }

    .modal-panel {
        width: 100%;
        max-height: 92vh;
        padding: 18px;
    }

    .modal-header {
        top: -18px;
        margin: -18px -18px 16px;
        padding: 16px 18px 12px;
    }

    .modal-footer {
        bottom: -18px;
        margin: 18px -18px -18px;
        padding: 14px 18px 18px;
    }

    .cart-item-row {
        grid-template-columns: 1fr;
    }

    .number-pills {
        justify-content: flex-start;
    }

    .order-actions,
    .modal-order-actions,
    .modal-pay-form {
        width: 100%;
        justify-content: stretch;
    }

    .auth-panel,
    .empty-state,
    .cart-order,
    .payment-qr,
    .payment-copy,
    .admin-form {
        padding: 18px;
    }
}

@media (max-width: 480px) {
    .brand span:last-child {
        max-width: 190px;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-brand p,
    .footer-section p {
        max-width: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .number-grid {
        gap: 6px;
    }

    .number-cell {
        min-height: 40px;
        font-size: 0.95rem;
    }

    .status-legend {
        gap: 8px 10px;
        font-size: 0.84rem;
    }

    .payment-copy textarea {
        font-size: 0.84rem;
    }

    .raffle-body p {
        -webkit-line-clamp: 2;
    }

    table {
        min-width: 720px;
    }
}

@media (max-width: 360px) {
    .brand span:last-child {
        max-width: 145px;
    }

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

    .meta-grid {
        grid-template-columns: 1fr;
    }
}
