:root {
    --ink: #15221d;
    --muted: #66736d;
    --cream: #fff9ef;
    --paper: #ffffff;
    --brand: #1f7a4f;
    --brand-dark: #15583a;
    --accent: #d9a441;
    --danger: #b73535;
    --ok: #1d7b48;
    --line: rgba(21, 34, 29, .12);
    --shadow: 0 24px 70px rgba(13, 32, 23, .18);
}

/* Final logo/footer overrides. Keep these at the end of the cascade. */
.brand {
    justify-items: center;
}

.brand span {
    display: none;
}

.logo {
    display: block;
    width: 160px;
    height: 86px;
    max-width: 68vw;
    object-fit: contain;
    object-position: center;
    margin: 0 auto 12px;
}

.site-footer {
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
}

.site-footer a {
    color: rgba(21, 34, 29, .62);
    text-decoration: none;
    font-weight: 700;
}

.site-footer a:hover {
    color: var(--brand-dark);
}

@media (max-width: 420px) {
    .logo {
        width: 142px;
        height: 76px;
        max-width: 70vw;
    }
}

.small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14px;
    text-decoration: none;
}

select {
    width: 100%;
    min-height: 56px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fbfdfb;
    padding: 0 14px;
    color: var(--ink);
    outline: none;
    font: inherit;
}

.logout {
    gap: 8px;
}

.result-meta {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
}

.result-meta div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, .22);
    padding-top: 8px;
}

.result-meta dt,
.result-meta dd {
    margin: 0;
}

.result-meta dt {
    font-weight: 800;
}

.admin-page {
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 10%, rgba(217, 164, 65, .16), transparent 28rem),
        linear-gradient(140deg, #f4fbf6 0%, #fff7ea 48%, #edf8f1 100%);
}

.admin-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-logo {
    width: 94px;
    height: 52px;
    object-fit: contain;
}

.admin-header h1,
.admin-section h2,
.admin-login h2 {
    margin: 0;
    letter-spacing: 0;
}

.admin-header h1 {
    font-size: 34px;
}

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

.admin-actions form {
    margin: 0;
}

.admin-login {
    margin: 40px auto 0;
}

.admin-filters,
.stats-grid,
.admin-section {
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 20px;
    box-shadow: 0 18px 48px rgba(13, 32, 23, .1);
}

.admin-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
    margin-bottom: 16px;
    align-items: end;
}

.admin-filters label {
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin-bottom: 16px;
}

.stats-grid article {
    display: grid;
    gap: 4px;
    padding: 18px;
    background: rgba(31, 122, 79, .06);
}

.stats-grid span {
    color: var(--muted);
    font-size: 14px;
}

.stats-grid strong {
    font-size: 34px;
    line-height: 1;
}

.admin-section {
    padding: 18px;
    margin-bottom: 16px;
}

.admin-section h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 840px;
    font-size: 14px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    vertical-align: top;
}

th {
    color: var(--brand-dark);
    background: rgba(31, 122, 79, .07);
    font-weight: 800;
}

.code-cell {
    direction: ltr;
    font-weight: 800;
    letter-spacing: 1px;
}

@media (max-width: 760px) {
    .admin-page {
        padding: 14px;
    }

    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-header h1 {
        font-size: 28px;
    }

    .admin-actions,
    .admin-actions form {
        width: 100%;
    }

    .admin-actions .button,
    .admin-actions button {
        width: 100%;
    }

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

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

.hero {
    align-content: center;
    gap: 14px;
}

.brand {
    justify-items: center;
}

.logo {
    width: 160px;
    height: 86px;
    max-width: 68vw;
    object-fit: contain;
    object-position: center;
}

.site-footer {
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
}

.site-footer a {
    color: rgba(21, 34, 29, .62);
    text-decoration: none;
    font-weight: 700;
}

.site-footer a:hover {
    color: var(--brand-dark);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Tajawal", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 20% 10%, rgba(217, 164, 65, .18), transparent 28rem),
        linear-gradient(140deg, #f4fbf6 0%, #fff7ea 48%, #edf8f1 100%);
}

button,
input,
a {
    font: inherit;
}

.hero {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.panel {
    width: min(100%, 460px);
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 26px;
    box-shadow: var(--shadow);
    padding: 24px;
    backdrop-filter: blur(12px);
}

.customer-panel {
    position: relative;
    overflow: hidden;
}

.customer-panel::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--brand), var(--accent), #b85d3b);
}

.brand {
    display: grid;
    gap: 4px;
    margin-bottom: 22px;
}

.logo {
    display: block;
    width: auto;
    height: 25px;
    max-width: min(220px, 72vw);
    object-fit: contain;
    object-position: center;
    justify-self: center;
    align-self: center;
    margin: 0 auto 12px;
}

.brand span {
    color: var(--brand);
    font-weight: 800;
    font-size: 15px;
    text-align: center;
}

.brand strong {
    font-size: 20px;
    font-weight: 800;
    text-align: center;
}

h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 8vw, 44px);
    line-height: 1.05;
    letter-spacing: 0;
}

.cashier-panel h1 {
    font-size: 30px;
}

.lead,
.terms,
.hint {
    color: var(--muted);
    line-height: 1.75;
}

.lead {
    margin: 0 0 22px;
    font-size: 17px;
}

.terms,
.hint {
    margin: 14px 0 0;
    font-size: 14px;
}

.selling-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.invite-copy {
    display: grid;
    gap: 6px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(217, 164, 65, .14);
    color: #4f3710;
    line-height: 1.65;
}

.invite-copy strong {
    font-size: 17px;
    font-weight: 800;
}

.invite-copy span {
    color: rgba(79, 55, 16, .86);
}

.selling-points span {
    flex: 1 1 auto;
    min-width: 112px;
    border: 1px solid rgba(31, 122, 79, .18);
    border-radius: 999px;
    padding: 8px 10px;
    background: rgba(31, 122, 79, .08);
    color: var(--brand-dark);
    text-align: center;
    font-size: 14px;
    font-weight: 800;
}

.form {
    display: grid;
    gap: 12px;
}

label {
    font-weight: 800;
}

input {
    width: 100%;
    min-height: 56px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fbfdfb;
    padding: 0 16px;
    color: var(--ink);
    outline: none;
    font-size: 20px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus {
    border-color: rgba(31, 122, 79, .55);
    box-shadow: 0 0 0 4px rgba(31, 122, 79, .12);
    background: #fff;
}

.otp-input,
.coupon-entry {
    text-align: center;
    letter-spacing: 10px;
    direction: ltr;
    font-weight: 800;
    font-size: 30px;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    border: 0;
    border-radius: 16px;
    padding: 0 18px;
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    transition: transform .14s ease, background .14s ease, box-shadow .14s ease;
    box-shadow: 0 12px 28px rgba(31, 122, 79, .22);
}

button:active,
.button:active {
    transform: translateY(1px);
}

button:hover,
.button:hover {
    background: var(--brand-dark);
}

.secondary {
    background: var(--accent);
    color: #24180a;
    box-shadow: 0 12px 28px rgba(217, 164, 65, .22);
}

.ghost {
    background: transparent;
    color: var(--brand);
    box-shadow: none;
    border: 1px solid var(--line);
}

.link-form {
    margin-top: 12px;
}

.alert {
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 14px;
    line-height: 1.6;
    font-weight: 700;
}

.alert.error {
    color: var(--danger);
    background: rgba(183, 53, 53, .1);
}

.alert.success {
    color: var(--ok);
    background: rgba(29, 123, 72, .11);
}

.coupon-list {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.coupon {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 18px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(135deg, #1f7a4f, #174a38);
    overflow: hidden;
}

.coupon::after {
    content: "";
    position: absolute;
    width: 96px;
    height: 96px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    inset-inline-end: -32px;
    top: -28px;
}

.coupon.redeemed {
    background: linear-gradient(135deg, #777, #444);
}

.coupon span,
.coupon small {
    position: relative;
    z-index: 1;
}

.coupon strong {
    position: relative;
    z-index: 1;
    direction: ltr;
    text-align: center;
    font-size: clamp(44px, 16vw, 66px);
    letter-spacing: 8px;
    line-height: 1;
}

.actions {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.share-box,
.empty {
    margin-top: 14px;
    padding: 14px;
    border-radius: 16px;
    border: 1px dashed rgba(31, 122, 79, .35);
    background: rgba(31, 122, 79, .07);
    color: var(--brand-dark);
    direction: ltr;
    text-align: center;
    overflow-wrap: anywhere;
}

.empty {
    direction: rtl;
    color: var(--muted);
}

.logout {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.redeem-result {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding: 16px;
    border-radius: 18px;
    line-height: 1.6;
}

.redeem-result.ok {
    color: #fff;
    background: var(--ok);
}

.redeem-result.used {
    background: rgba(217, 164, 65, .18);
    color: #6b4b11;
}

.redeem-result.bad {
    background: rgba(183, 53, 53, .1);
    color: var(--danger);
}

@media (max-width: 420px) {
    .hero {
        padding: 12px;
        align-items: stretch;
    }

    .panel {
        width: 100%;
        min-height: calc(100vh - 24px);
        border-radius: 22px;
        padding: 22px 18px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .logo {
        width: 142px;
        height: 76px;
        max-width: 70vw;
    }

    .coupon strong {
        letter-spacing: 5px;
    }
}

/* Final logo/footer overrides. Keep these at the end of the cascade. */
.brand {
    justify-items: center;
}

.brand span {
    display: none;
}

.logo {
    display: block;
    width: 160px;
    height: 86px;
    max-width: 68vw;
    object-fit: contain;
    object-position: center;
    margin: 0 auto 12px;
}

.site-footer {
    text-align: center;
    font-size: 12px;
    line-height: 1.5;
}

.site-footer a {
    color: rgba(21, 34, 29, .62);
    text-decoration: none;
    font-weight: 700;
}

.site-footer a:hover {
    color: var(--brand-dark);
}

@media (max-width: 420px) {
    .logo {
        width: 142px;
        height: 76px;
        max-width: 70vw;
    }
}
