:root {
    color-scheme: light;
    --page: #f8f9fa;
    --surface: #ffffff;
    --ink: #222222;
    --muted: #555e6b;
    --line: #dbe1e9;
    --field: #f1f3f6;
    --blue: #0064c8;
    --blue-deep: #004e9d;
    --blue-soft: #e7f1ff;
    --danger: #a2222a;
    --danger-soft: #fff0f1;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
button, input, select { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
::selection { color: var(--blue-deep); background: var(--blue-soft); }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .layout { width: min(76rem, 100%); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }
.topbar-inner, .staff-user { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.topbar-inner { min-height: 4.3rem; padding-block: .5rem; }
.brand { font-size: 1.04rem; letter-spacing: .03em; }
.staff-user { justify-content: flex-end; }
#staff-name { overflow-wrap: anywhere; color: var(--muted); }
.layout { padding-block: 1.75rem 3rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.access { width: min(100%, 26rem); margin: clamp(1.6rem, 7vh, 4.5rem) auto 0; padding: clamp(1.25rem, 5vw, 2rem); }
h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: clamp(1.5rem, 3.6vw, 1.9rem); }
h2 { font-size: 1.2rem; }
.access h1 { margin-bottom: 1.5rem; }
.form-stack { display: grid; gap: 1rem; }
label { display: grid; gap: .38rem; font-size: .9rem; font-weight: 600; }
input, select {
    min-width: 0;
    width: 100%;
    min-height: 2.75rem;
    padding: .55rem .7rem;
    color: var(--ink);
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 8px;
}
input:focus, select:focus { background: var(--surface); border-color: var(--blue); }
.button, .text-button, .tabs button { min-height: 2.75rem; }
.button { padding: .52rem .93rem; border-radius: 9px; border: 1px solid transparent; font-weight: 600; white-space: nowrap; }
.primary { color: #ffffff; background: var(--blue); }
.primary:hover { background: var(--blue-deep); }
.secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.secondary:hover { border-color: var(--blue); color: var(--blue-deep); }
.text-button { padding: .25rem .15rem; color: var(--blue-deep); background: transparent; border: 0; text-underline-offset: .17em; }
.text-button:hover { text-decoration: underline; }
.setup { background: var(--field); padding: .95rem; border-radius: 8px; overflow-wrap: anywhere; }
.setup p { margin: 0 0 .55rem; }
.code-list { padding: 0; margin: 1rem 0; list-style: none; line-height: 1.65; background: var(--field); border-radius: 8px; }
.code-list li { padding-inline: .8rem; overflow-wrap: anywhere; }
.notice { width: fit-content; max-width: 100%; padding: .7rem .9rem; margin: 0 0 1rem; border-radius: 8px; background: var(--blue-soft); }
.notice.error { color: var(--danger); background: var(--danger-soft); }
.layout:has(.access:not([hidden])) > .notice { margin-inline: auto; }

.tabs { display: flex; align-items: baseline; gap: .3rem 1rem; flex-wrap: wrap; margin-bottom: .85rem; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: .35rem .5rem; color: var(--muted); font-weight: 600; }
.tabs button:hover, .tabs button[aria-pressed="true"] { color: var(--blue-deep); }
.tabs button[aria-pressed="true"] { border-bottom-color: var(--blue); }
.registry { padding: clamp(1rem, 3.5vw, 1.6rem); }
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
    align-items: end;
    gap: .7rem;
    margin: 1.2rem 0 1.15rem;
}
.totals { display: flex; flex-wrap: wrap; gap: .7rem 1.8rem; margin: .9rem 0; }
.totals > div { min-width: 5rem; }
.totals dt, .detail-fields dt { color: var(--muted); font-size: .9rem; }
.totals dd { margin: .14rem 0 0; font-weight: 650; }
.totals, table { font-variant-numeric: tabular-nums; }
.results-status { margin: 0; color: var(--muted); }
.results-status:not(:empty) { margin: .7rem 0; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 27rem; border-collapse: collapse; text-align: left; }
.payment-table { min-width: 39rem; }
th, td { padding: .72rem .85rem; vertical-align: middle; overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 600; font-size: .9rem; }
tbody td { border-top: 1px solid var(--line); }
th:first-child { width: 25%; }
tbody tr:nth-child(2n) { background: var(--page); }
td:first-child, .payment-detail dd { overflow-wrap: anywhere; }
tr button { text-align: left; }
.mobile-field-label { display: none; }
.more { margin-top: 1rem; }
.payment-detail { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: .8rem; }
.detail-header { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.detail-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .75rem 1rem; margin: .75rem 0 0; }
.detail-fields dd { margin: .2rem 0 0; }

@media (max-width: 33rem) {
    input, select { font-size: 1rem; }
    .topbar-inner, .staff-user { gap: .55rem; }
    .staff-user { font-size: .88rem; }
    .layout { padding-block-start: 1.15rem; }
    .table-scroll { overflow: visible; }
    table, .payment-table { display: block; min-width: 0; }
    thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
    tbody { display: block; }
    tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; padding: .75rem; }
    tbody tr + tr { border-top: 1px solid var(--line); }
    tbody td { display: block; border: 0; padding: 0; }
    .payment-table td:first-child { grid-column: 1 / -1; }
    .mobile-field-label { display: block; color: var(--muted); font-size: .85rem; margin-bottom: .15rem; }
}
