:root {
    color-scheme: light;
    --canvas: #f3f6fa;
    --surface: #fff;
    --text: #142137;
    --muted: #53637a;
    --border: #d9e1eb;
    --nav: #142137;
    --primary: #2255ba;
    --primary-hover: #164294;
    --radius: 12px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid #3975ef; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.95rem, 4vw, 2.65rem); line-height: 1.11; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 1.19rem; line-height: 1.3; letter-spacing: -.01em; }
p, .muted { color: var(--muted); }

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 36px; padding: 27px 19px 20px; background: var(--nav); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; font-size: 1.2rem; font-weight: 750; line-height: 1.12; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; border-radius: 10px; color: #fff; background: #2e61c9; font-size: 1.28rem; font-weight: 800; }
.brand small { display: block; margin-top: 4px; color: #c1cde2; font-size: .75rem; font-weight: 550; }
.nav-item { display: block; padding: 10px 12px; border-radius: 8px; color: #dbe7ff; font-weight: 650; text-decoration: none; }
.nav-item[aria-current], .nav-item:hover { background: #263c5e; color: #fff; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid #3a4a63; }
.identity { display: grid; padding: 0 3px; overflow-wrap: anywhere; }
.identity span { color: #c1cde2; font-size: .82rem; }
.sign-out { padding: 8px 3px; border: 0; color: #cfe0ff; background: none; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.workspace { width: min(100%, 1390px); padding: 44px clamp(17px, 4vw, 56px); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.page-head p { margin-top: 8px; overflow-wrap: anywhere; }
.back { display: inline-block; margin-bottom: 14px; font-weight: 650; }

.card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 4px #101d3310; }
.card-body { padding: clamp(18px, 3vw, 26px); }
.card-body h2 + p { margin-top: 6px; }
.card-body h2 + form { margin-top: 20px; }
.card-title { padding: 19px 22px; }
.table-card { margin-top: 20px; overflow: hidden; }
.empty { padding: 35px 22px; }
.empty p { margin-top: 6px; }
.empty.compact { padding-top: 0; padding-bottom: 20px; }
.empty.compact p { margin-top: 0; }
.summary { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .8fr); gap: 14px; margin-bottom: 20px; }
.summary-with-credits { grid-template-columns: minmax(0, .8fr) minmax(0, 1.35fr) minmax(0, .8fr); }
.metric { display: grid; gap: 7px; align-content: start; padding: 19px 22px; }
.metric span { color: var(--muted); font-size: .86rem; font-weight: 650; }
.metric strong { font-size: clamp(1.1rem, 2.2vw, 1.4rem); line-height: 1.3; overflow-wrap: anywhere; }
.metric:first-child { border-top: 3px solid var(--primary); padding-top: 17px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(230px, 1fr); gap: 17px; align-items: start; }
.settings { max-width: 820px; }
.balance-value { margin: 5px 0 18px; font-size: clamp(1.55rem, 3vw, 2.3rem); font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.numeric { font-variant-numeric: tabular-nums; }
.positive { color: #176044; font-weight: 700; }
.pill, .code { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: .85rem; font-weight: 650; white-space: nowrap; }
.pill.enabled { color: #145a3d; background: #dff3e9; }
.pill.disabled { color: #8a332b; background: #f9e7e4; }
.pill.pending { color: #30496c; background: #edf2f9; }
.pill.expired { color: #744715; background: #fff0d8; }
.code { color: #30496c; background: #edf2f9; font-family: ui-monospace, monospace; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { color: var(--muted); background: #f7f9fc; font-size: .84rem; font-weight: 700; white-space: nowrap; }
th, td { padding: 12px 20px; border-bottom: 1px solid #e5ebf3; }
tbody tr:last-child td { border-bottom: 0; }
td { overflow-wrap: anywhere; }
.cell-detail { display: block; color: var(--muted); font-size: .88rem; }
.action { text-align: right; white-space: nowrap; font-weight: 650; }
.nowrap { white-space: nowrap; }
.note-cell { min-width: 115px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--muted); }
.pagination div { display: flex; gap: 8px; }
.numbered-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 12px 16px; border-top: 1px solid var(--border); }
.numbered-pagination .page-step, .numbered-pagination .page-gap { display: inline-grid; place-items: center; min-width: 36px; min-height: 36px; padding: 0 6px; color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.numbered-pagination .page-step { border-radius: 999px; text-decoration: none; }
.numbered-pagination a.page-step:hover { background: #edf0ff; color: #4634ab; }
.numbered-pagination .page-current { color: #fff; background: #5141cc; box-shadow: 0 0 0 3px #e2ddff; }
.numbered-pagination .page-unavailable { opacity: .4; }
.numbered-pagination [rel], .numbered-pagination .page-unavailable { font-size: 1.4rem; line-height: 1; }

.stack { display: grid; gap: 15px; }
.fields, .duration { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.generate-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-top: 17px; }
.generate-form label { width: min(100%, 230px); }
.user-search { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; padding: 18px 20px; }
.user-search label { width: min(100%, 320px); }
.credential-password summary { color: var(--primary); cursor: pointer; font-weight: 650; }
.credential-password .code { margin-top: 5px; }
label { display: block; min-width: 0; font-weight: 650; }
label small { display: block; margin-top: 4px; color: var(--muted); font-size: .81rem; font-weight: 450; }
label small.inline { display: inline; margin: 0 0 0 3px; }
input, select { display: block; width: 100%; min-height: 42px; margin-top: 5px; padding: 8px 11px; border: 1px solid #aebed2; border-radius: 7px; background: #fff; color: var(--text); }
input::placeholder { color: #65758a; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 15px; border: 1px solid transparent; border-radius: 7px; background: var(--primary); color: #fff; font-weight: 700; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; }
.button:hover { background: var(--primary-hover); }
.button.secondary { border-color: #c6d2e3; background: #fff; color: var(--primary); }
.button.secondary:hover { background: #edf3fe; }
.button.small { min-height: 34px; padding: 5px 10px; font-size: .86rem; }
.notice { border: 1px solid; border-radius: 8px; margin-bottom: 18px; padding: 10px 13px; }
.notice ul { margin: 0; padding-left: 20px; }
.notice.success { background: #e9f7ef; color: #145a3d; border-color: #bddfcf; }
.notice.error { background: #fff0ed; color: #8a332b; border-color: #efc9c2; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.login-screen { display: grid; place-items: center; min-height: 100vh; padding: 22px; background: radial-gradient(ellipse at 50% 5%, #294668, #142137 70%); }
.login-wrap { width: min(100%, 428px); }
.login-wrap > .brand { margin: 0 0 19px 3px; color: #fff; }
.login-card { padding: clamp(21px, 6vw, 33px); }
.login-card p { margin: 8px 0 23px; }

@media (max-width: 1010px) {
    .shell { grid-template-columns: 184px minmax(0, 1fr); }
    .admin-grid { grid-template-columns: 1fr; }
    .balance-card { grid-row: 1; }
}

@media (max-width: 700px) {
    .shell { display: block; }
    .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; }
    .sidebar-footer { margin: 0; padding: 0; border: 0; }
    .identity { display: none; }
    .workspace { padding-top: 25px; }
    .summary { grid-template-columns: 1fr; gap: 9px; }
    .metric { padding: 13px 16px; }
    .metric:first-child { padding-top: 11px; }
}

@media (max-width: 480px) {
    .page-head { align-items: flex-start; flex-wrap: wrap; }
    .fields { grid-template-columns: 1fr; }
    th, td { padding-right: 13px; padding-left: 13px; }
}
