:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #eef2f5;
    --text: #17202a;
    --muted: #62717f;
    --line: #d8e0e7;
    --primary: #14532d;
    --primary-2: #0f766e;
    --danger: #b42318;
    --warning: #9a6700;
    --info: #1d4ed8;
    --radius: 8px;
    --shadow: 0 10px 28px rgba(20, 31, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

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

a {
    color: inherit;
}

.app-shell {
    display: grid;
    place-items: center;
    padding: 24px;
}

.access-grid {
    width: min(960px, 100%);
}

.access-header,
.topbar,
.panel,
.auth-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.access-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.15;
}

h1 {
    font-size: 1.9rem;
}

h2 {
    font-size: 1.15rem;
}

h3 {
    font-size: 1rem;
}

.status-pill,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
}

.access-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.access-link {
    min-height: 112px;
    display: grid;
    place-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-weight: 800;
    text-decoration: none;
    text-align: center;
}

.access-link:hover {
    border-color: var(--primary-2);
}

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px;
    padding: 14px 16px;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.topbar a,
.topbar button,
.btn {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 9px 12px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
}

.btn.primary,
button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

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

.btn.secondary,
button.secondary {
    background: var(--surface-2);
}

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

.content {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 0 16px 28px;
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.cols-2 {
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
}

.grid.cols-3,
.metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
    padding: 16px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
    margin-bottom: 6px;
}

.metric strong {
    font-size: 1.45rem;
}

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

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

.form-row {
    display: grid;
    gap: 6px;
}

.form-row label {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    padding: 9px 10px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(20, 83, 45, 0.15);
    border-color: var(--primary);
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.auth-box {
    width: min(420px, 100%);
    padding: 20px;
}

.hidden {
    display: none !important;
}

.message {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--muted);
}

.message.error {
    border-color: rgba(180, 35, 24, 0.3);
    background: #fff1f0;
    color: var(--danger);
}

.message.success {
    border-color: rgba(20, 83, 45, 0.28);
    background: #eef8f1;
    color: var(--primary);
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    background: var(--surface);
}

th,
td {
    padding: 10px 11px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

td.actions {
    display: flex;
    gap: 8px;
}

.modal {
    width: min(980px, calc(100% - 28px));
    max-height: calc(100vh - 32px);
    border: 0;
    padding: 0;
    background: transparent;
}

.modal.compact-modal {
    width: min(560px, calc(100% - 28px));
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.58);
}

.modal.open {
    position: fixed;
    inset: 0;
    width: auto;
    max-height: none;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.58);
}

.modal.open .modal-panel {
    width: min(980px, calc(100% - 28px));
}

.modal.compact-modal.open .modal-panel {
    width: min(560px, calc(100% - 28px));
}

.modal-panel {
    width: 100%;
    max-height: calc(100vh - 32px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-header,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
}

.modal-header {
    border-bottom: 1px solid var(--line);
}

.modal-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
}

.modal-body {
    display: grid;
    gap: 12px;
    overflow: auto;
    padding: 16px;
}

.modal-body.form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal-message {
    margin: 0 16px 16px;
}

.icon-button {
    width: 38px;
    min-height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
}

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

.checkout-body {
    min-height: 100vh;
    background: #111827;
    color: #f9fafb;
}

.checkout-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.checkout-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.checkout-panel {
    width: min(760px, calc(100% - 28px));
    margin: 20px auto;
    display: grid;
    gap: 16px;
}

.checkout-step {
    background: #f9fafb;
    color: var(--text);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

.checkout-step input {
    min-height: 64px;
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
}

.checkout-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.checkout-actions button {
    min-height: 58px;
    font-size: 1.05rem;
}

.limit-box {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.limit-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
}

.limit-item span {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.limit-item strong {
    font-size: 1.35rem;
}

.receipt {
    display: none;
}

.placeholder-band {
    display: grid;
    gap: 12px;
    padding: 20px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

@media (max-width: 900px) {
    .access-links,
    .grid.cols-2,
    .grid.cols-3,
    .metrics,
    .form-grid,
    .modal-body.form-grid,
    .limit-box {
        grid-template-columns: 1fr;
    }

    .access-header,
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    table {
        min-width: 640px;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    .receipt,
    .receipt * {
        visibility: visible;
    }

    .receipt {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        padding: 4mm;
        color: #000;
        background: #fff;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
    }

    .receipt h1 {
        font-size: 16px;
        text-align: center;
        margin-bottom: 6px;
    }

    .receipt p {
        margin: 4px 0;
    }
}
