:root {
    color-scheme: light;
    font: 100%/1.6 Tahoma, Arial, sans-serif;
    --ink: #172735;
    --muted: #536673;
    --line: #d9e4e6;
    --page: #eef4f5;
    --paper: #fff;
    --nav: #122c39;
    --teal: #08655d;
    --teal-dark: #064c46;
    --teal-pale: #e8f5f1;
    --red: #973732;
    --red-pale: #fcf0ef;
    --amber: #795013;
    --amber-pale: #fcf4e0;
    --radius: 0.85rem;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #2ba890; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.3; }
h1 { font-size: clamp(1.65rem, 4vw, 2.25rem); }
h2 { font-size: 1.25rem; }
a { color: var(--teal-dark); }

.shell { inline-size: min(100% - 3rem, 94rem); margin-inline: auto; }
.topbar { color: #fff; background: var(--nav); border-block-end: 4px solid #3ba48a; }
.topbar .shell { min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; color: inherit; text-decoration: none; font-weight: bold; }
.brand-mark {
    display: grid; place-items: center; inline-size: 2.25rem; aspect-ratio: 1;
    border: 1px solid #98d8c7; color: #a9e5d4; border-radius: .5rem; font-size: 1.15rem;
}
.brand-detail { display: block; color: #c2d8df; font-size: .8125rem; font-weight: normal; line-height: 1.25; }
.logout { margin: 0; }
.button {
    min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center;
    padding: .55rem .95rem; border: 1px solid var(--line); border-radius: .55rem;
    background: var(--paper); color: var(--ink); font-size: .875rem; font-weight: bold; text-decoration: none;
}
.button:hover { background: #f0f6f6; border-color: #aabfc2; }
.button-primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.button-primary:hover { color: #fff; background: var(--teal-dark); border-color: var(--teal-dark); }
.button-warning { color: var(--red); border-color: #efcdc9; }
.button-warning:hover { color: var(--red); background: var(--red-pale); border-color: #e2ada7; }
.button-quiet { background: transparent; color: #fff; border-color: #6b8791; }
.button-quiet:hover { background: #244454; border-color: #b0c9cf; }
.button-quiet:focus-visible { outline-color: #8be1ce; }
.button-copy { padding-inline: .65rem; font-size: .8125rem; white-space: nowrap; }

.workspace { padding-block: 2rem 3.25rem; }
.page-heading { display: grid; gap: .4rem; margin-block-end: 1.5rem; }
.muted { color: var(--muted); }
.field-help, .muted-small { color: var(--muted); font-size: .875rem; }
.workspace-grid { display: grid; grid-template-columns: minmax(17rem, 21rem) minmax(0, 1fr); align-items: start; gap: 1.25rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-inline-size: 0; }
.card-heading { padding: 1.05rem 1.15rem; border-block-end: 1px solid var(--line); }
.card-heading p { margin-block-start: .3rem; }
.issue-card { border-block-start: 3px solid var(--teal); }
.form-stack { display: grid; gap: 1rem; padding: 1.15rem; }
.field { display: grid; gap: .3rem; min-inline-size: 0; }
.field > label { font-size: .9rem; font-weight: bold; }
.field > input, .field > select {
    width: 100%; min-width: 0; min-height: 2.75rem; padding: .45rem .6rem;
    border: 1px solid #afc2c6; border-radius: .48rem; background: #fff;
}
.field > input::placeholder { color: #657982; }
.field > select {
    appearance: none;
    padding-inline-end: 2rem;
    background-image: linear-gradient(45deg, transparent 50%, #49616b 50%), linear-gradient(135deg, #49616b 50%, transparent 50%);
    background-position: left 1rem center, left .75rem center;
    background-size: .25rem .25rem;
    background-repeat: no-repeat;
}
.field-help { line-height: 1.5; }
.flash {
    margin-block-end: 1rem; padding: .8rem 1rem; border: 1px solid #bcded5;
    border-inline-start: 4px solid var(--teal); border-radius: .6rem; background: var(--teal-pale);
}
.flash-error { color: var(--red); background: var(--red-pale); border-color: #efcdc9; border-inline-start-color: var(--red); }
.issued { display: grid; gap: .45rem; }
.issued-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; }
.identifier {
    display: inline-block; color: var(--ink); direction: ltr; unicode-bidi: isolate;
    font: 600 .875rem/1.45 Consolas, "Courier New", monospace; overflow-wrap: anywhere; word-break: break-word;
}
.issued .identifier { font-size: clamp(.92rem, 2.5vw, 1.2rem); }
.identifier::selection { color: white; background: var(--teal-dark); }

.ledger-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.ledger-count { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.search {
    padding: .85rem 1.15rem; display: flex; align-items: end; gap: .55rem;
    background: #f8fbfb; border-block-end: 1px solid var(--line);
}
.search .field { flex: 1 1 12rem; }
.search .button { flex-shrink: 0; }
.table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; text-align: start; font-size: .875rem; }
.ledger-table th, .ledger-table td { text-align: start; padding: .8rem .65rem; vertical-align: top; }
.ledger-table :is(th, td):first-child { padding-inline-start: 1.15rem; }
.ledger-table :is(th, td):last-child { padding-inline-end: 1.15rem; }
.ledger-table th { color: var(--muted); background: #f8fbfb; font-weight: bold; white-space: nowrap; }
.ledger-table tbody tr { border-block-start: 1px solid var(--line); }
.ledger-table tbody tr:nth-child(even) { background: #fbfdfd; }
.ledger-table .code-cell { min-inline-size: 9.5rem; }
.ledger-table .action-cell { white-space: nowrap; }
.cell-stack { display: grid; justify-items: start; gap: .25rem; }
.cell-stack > span { overflow-wrap: anywhere; }
.time { white-space: nowrap; unicode-bidi: isolate; direction: ltr; display: inline-block; }
.status { display: inline-block; padding: .15rem .5rem; border-radius: .35rem; background: #e9eff2; color: #435c68; white-space: nowrap; font-weight: bold; }
.status-active { background: var(--teal-pale); color: var(--teal-dark); }
.status-suspended { background: var(--red-pale); color: var(--red); }
.status-expired { background: var(--amber-pale); color: var(--amber); }
.empty { padding: 2.4rem 1.15rem; text-align: center; }
.empty p { margin-block-start: .35rem; }
.ledger-footer { padding: .7rem 1.15rem; border-block-start: 1px solid var(--line); }

.login { display: grid; place-items: start center; padding-block: clamp(2rem, 7vw, 5rem); }
.login-card { width: min(100%, 28rem); overflow: hidden; }
.login-heading { padding: 1.5rem; border-block-end: 1px solid var(--line); background: #f9fcfc; }
.login-heading p { margin-block-start: .45rem; }
.login-card .form-stack { padding: 1.35rem 1.5rem 1.6rem; }
.login-card .flash { margin: 1rem 1.5rem 0; }
.skip-link { position: absolute; inset-inline-start: 1rem; inset-block-start: 1rem; z-index: 1; background: #fff; padding: .5rem .75rem; transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
.topbar nav, .buttons { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.topbar nav a { color: #fff; }
.detail-grid { display: grid; grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.padded, .pager { padding: .9rem 1.15rem; }
.pager { display: inline-block; }
@media (max-width: 65rem) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 35rem) { .topbar .shell { flex-wrap: wrap; padding-block: .6rem; } }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 76rem) {
    .workspace-grid { grid-template-columns: minmax(0, 1fr); }
    .issue-card .form-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
    .issue-card .form-stack > .button { align-self: end; }
}

@media (max-width: 54rem) {
    .shell { inline-size: calc(100% - 2rem); }
    .table-wrap { overflow: visible; }
    .ledger-table { display: block; }
    .ledger-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .ledger-table tbody { display: grid; }
    .ledger-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem 1.15rem; padding: .9rem 1.15rem; }
    .ledger-table td,
    .ledger-table td:first-child,
    .ledger-table td:last-child { padding: 0; min-inline-size: 0; }
    .ledger-table td::before { content: attr(data-label); display: block; margin-block-end: .15rem; color: var(--muted); font-size: .8125rem; }
}

@media (max-width: 35rem) {
    .shell { inline-size: calc(100% - 1.25rem); }
    .workspace { padding-block-start: 1.25rem; }
    .workspace-grid { gap: .85rem; }
    .topbar .shell { min-height: 4rem; }
    .issue-card .form-stack { grid-template-columns: minmax(0, 1fr); }
    .ledger-heading, .search { flex-wrap: wrap; }
    .search .field { flex-basis: 100%; }
    .ledger-table tbody tr { grid-template-columns: minmax(0, 1fr); }
}
