:root {
    --ink: #07120f;
    --panel: #10231e;
    --panel-2: #18362e;
    --green: #789984;
    --green-light: #b9cbbb;
    --paper: #f7f8f4;
    --muted: #d6ddd6;
    --danger: #b31515;
    --danger-dark: #7d0c0c;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, #33463e 0, var(--ink) 58%);
    color: var(--paper);
    font-family: Arial, Helvetica, sans-serif;
    text-transform: uppercase;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.topbar {
    min-height: 82px;
    display: grid;
    grid-template-columns: 132px 1fr 104px;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    border: 2px solid rgba(185, 203, 187, 0.5);
    background: linear-gradient(180deg, #245344, #10231e);
    box-shadow: var(--shadow);
}

.brand-logo {
    max-width: 100%;
    max-height: 66px;
    object-fit: contain;
}

.rangebot-logo {
    justify-self: start;
    position: relative;
    z-index: 2;
    width: 132px;
    height: 66px;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.34));
}

.bsg-logo {
    justify-self: end;
}

.title-block {
    text-align: center;
}

.eyebrow {
    margin: 0;
    color: var(--green-light);
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    font-weight: 900;
    letter-spacing: 0;
}

h1 {
    font-size: 38px;
}

h2 {
    font-size: 30px;
    text-align: center;
}

.menu-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.menu-button,
.primary-action,
.done-button,
.keypad button {
    touch-action: manipulation;
    user-select: none;
}

.menu-button {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border: 3px solid var(--green-light);
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    color: var(--paper);
    box-shadow: var(--shadow);
    text-align: center;
    cursor: pointer;
}

.menu-button span {
    max-width: 340px;
    font-size: 30px;
    line-height: 1.15;
    font-weight: 900;
}

.work-screen {
    width: min(1120px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.touch-form {
    display: grid;
    gap: 9px;
}

label {
    color: var(--green-light);
    font-size: 20px;
    font-weight: 900;
}

.touch-input {
    width: 100%;
    min-height: 56px;
    border: 3px solid var(--green-light);
    background: var(--paper);
    color: var(--ink);
    padding: 8px 14px;
    font-size: 30px;
    font-weight: 900;
}

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

.keypad button {
    min-height: 58px;
    border: 2px solid rgba(255, 255, 255, 0.44);
    background: #1c2c27;
    color: white;
    font-size: 28px;
    font-weight: 900;
}

.keypad button:active,
.menu-button:active,
.primary-action:active,
.done-button:active {
    transform: translateY(2px);
}

.keypad .clear-key,
.keypad .back-key {
    background: #41554b;
    font-size: 22px;
}

.primary-action,
.done-button {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    color: white;
    font-size: 24px;
    font-weight: 900;
    cursor: pointer;
}

.primary-action {
    background: var(--green);
    color: var(--ink);
}

.done-button {
    background: linear-gradient(180deg, var(--danger), var(--danger-dark));
}

.notice {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 12px 16px;
    font-size: 22px;
    font-weight: 900;
    text-align: center;
}

.notice.success {
    background: #dce9dd;
    color: #0e351c;
}

.notice.error {
    background: #ffe0e0;
    color: #761010;
}

.result-panel,
.user-table {
    border: 3px solid var(--green-light);
    background: rgba(7, 18, 15, 0.82);
    box-shadow: var(--shadow);
}

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

.result-panel div {
    min-height: 82px;
    padding: 12px;
    border-right: 2px solid rgba(185, 203, 187, 0.38);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.result-panel div:last-child {
    border-right: 0;
}

.result-panel span,
.table-head span {
    color: var(--green-light);
    font-size: 16px;
    font-weight: 900;
    text-transform: uppercase;
}

.result-panel strong {
    color: white;
    font-size: 28px;
    overflow-wrap: anywhere;
}

.user-table {
    display: grid;
    overflow-x: hidden;
}

.table-head,
.table-row {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1.1fr 1.1fr 0.7fr;
}

.table-head span,
.table-row strong {
    padding: 10px;
    border-right: 2px solid rgba(185, 203, 187, 0.38);
}

.table-head span:last-child,
.table-row strong:last-child {
    border-right: 0;
}

.table-row {
    border-top: 2px solid rgba(185, 203, 187, 0.38);
}

.table-row strong {
    color: white;
    font-size: 20px;
    overflow-wrap: anywhere;
}

.balance-update-form {
    margin-top: 6px;
}

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

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

.modal-panel {
    width: min(620px, 100%);
    padding: 16px;
    border: 3px solid var(--green-light);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.modal-panel h2 {
    margin-bottom: 12px;
}

@media (max-width: 900px) {
    .app-shell {
        padding: 10px;
        gap: 10px;
    }

    .topbar {
        grid-template-columns: 94px 1fr 72px;
        min-height: 70px;
        gap: 8px;
        padding: 7px;
    }

    .brand-logo {
        max-height: 56px;
    }

    .rangebot-logo {
        width: 94px;
        height: 56px;
    }

    .eyebrow {
        font-size: 16px;
    }

    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 25px;
    }

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

    .menu-button {
        min-height: 112px;
    }

    .menu-button span {
        font-size: 25px;
    }

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

    .result-panel div:nth-child(2) {
        border-right: 0;
    }

    .result-panel div {
        border-bottom: 2px solid rgba(185, 203, 187, 0.38);
    }

    .result-panel div:nth-child(n+3) {
        border-bottom: 0;
    }

    .user-table {
        display: block;
    }

    .table-head {
        display: none;
    }

    .table-row {
        display: grid;
        grid-template-columns: 1fr;
        border-top: 0;
    }

    .table-row strong {
        min-height: 52px;
        display: grid;
        grid-template-columns: 112px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        border-right: 0;
        border-bottom: 2px solid rgba(185, 203, 187, 0.38);
        font-size: 18px;
    }

    .table-row strong:last-child {
        border-bottom: 0;
    }

    .table-row strong::before {
        color: var(--green-light);
        font-size: 14px;
    }

    .table-row strong:nth-child(1)::before {
        content: "NAME";
    }

    .table-row strong:nth-child(2)::before {
        content: "PHONE";
    }

    .table-row strong:nth-child(3)::before {
        content: "JOINED";
    }

    .table-row strong:nth-child(4)::before {
        content: "LAST USED";
    }

    .table-row strong:nth-child(5)::before {
        content: "BALANCE";
    }
}
