:root {
    --canvas: #f2f4f1;
    --surface: #ffffff;
    --surface-muted: #f7f8f6;
    --surface-strong: #e7ece8;
    --ink: #152019;
    --ink-soft: #34423a;
    --muted: #6b776f;
    --line: #d8ded9;
    --line-strong: #bdc8c0;
    --green: #13795b;
    --green-soft: #e4f1eb;
    --coral: #c75b42;
    --coral-soft: #f7e9e5;
    --amber: #a86d16;
    --amber-soft: #f6eddc;
    --blue: #3f65bd;
    --blue-soft: #e8edf8;
    --shadow: 0 16px 42px rgba(24, 38, 29, 0.08);
    --shadow-soft: 0 7px 22px rgba(24, 38, 29, 0.06);
    --radius: 8px;
    --radius-small: 6px;
    --font-display: Georgia, "Times New Roman", serif;
    --font-body: "Trebuchet MS", "Gill Sans", sans-serif;
    --font-mono: "Cascadia Mono", Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background-color: var(--canvas);
    background-image:
        linear-gradient(rgba(21, 32, 25, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(21, 32, 25, 0.035) 1px, transparent 1px);
    background-size: 28px 28px;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

button {
    color: inherit;
}

button,
[data-route] {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(19, 121, 91, 0.22);
    outline-offset: 2px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.icon {
    display: block;
    flex: 0 0 auto;
}

.boot-screen {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.boot-mark,
.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-small);
    background: var(--ink);
    color: #f5f7f3;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
}

.brand-mark.large {
    width: 48px;
    height: 48px;
    font-size: 15px;
}

.boot-copy {
    display: grid;
    gap: 2px;
}

.boot-copy strong {
    font-family: var(--font-display);
    font-size: 20px;
}

.boot-copy span {
    color: var(--muted);
    font-size: 13px;
}

.console-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    height: 100vh;
    flex-direction: column;
    padding: 20px 14px 16px;
    border-right: 1px solid rgba(216, 222, 217, 0.86);
    background: rgba(247, 248, 246, 0.95);
    backdrop-filter: blur(16px);
}

.brand,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 8px;
}

.brand strong,
.auth-brand strong {
    display: block;
    font-family: var(--font-display);
    font-size: 17px;
    line-height: 1.15;
}

.brand span,
.auth-brand span {
    display: block;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
}

.primary-nav {
    display: grid;
    gap: 4px;
    margin-top: 34px;
}

.sidebar-legal {
    margin-top: auto;
    padding: 16px 8px 9px;
    border-top: 1px solid var(--line);
}

.sidebar-legal a {
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
}

.sidebar-legal a:hover {
    color: var(--green);
}

.nav-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    text-align: left;
}

.nav-item:hover {
    border-color: var(--line);
    background: var(--surface);
}

.nav-item.active {
    border-color: #bfd4c8;
    background: var(--green-soft);
    color: #0e6249;
    font-weight: 700;
}

.sidebar-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 0;
    padding: 12px 8px 0;
    border-top: 1px solid var(--line);
}

.user-block {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.user-block > div:last-child {
    min-width: 0;
}

.user-block strong,
.user-block span {
    display: block;
    overflow: hidden;
    max-width: 132px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-block strong {
    font-size: 13px;
}

.user-block span {
    color: var(--muted);
    font-size: 11px;
}

.avatar {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid rgba(216, 222, 217, 0.92);
    background: rgba(242, 244, 241, 0.9);
    backdrop-filter: blur(18px);
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 17px;
}

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

.role-chip {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.view {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 30px 28px 54px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    animation: rise-in 260ms ease-out both;
}

.page-heading h1 {
    margin: 5px 0 5px;
    font-family: var(--font-display);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 500;
    line-height: 1.05;
}

.page-heading p {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--green);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-strip {
    display: grid;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    animation: rise-in 300ms 40ms ease-out both;
}

.metric {
    display: grid;
    min-width: 0;
    gap: 3px;
    padding: 18px 20px;
    border-right: 1px solid var(--line);
}

.metric:last-child {
    border-right: 0;
}

.metric > span {
    color: var(--muted);
    font-size: 12px;
}

.metric strong {
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: clamp(20px, 2vw, 28px);
    font-weight: 600;
    line-height: 1.1;
    text-overflow: ellipsis;
}

.metric small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-action {
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 140ms ease, box-shadow 140ms ease;
}

.metric-action:hover {
    background: var(--surface-muted);
}

.metric-action:active {
    background: var(--surface-strong);
}

.metric-action:focus-visible {
    position: relative;
    z-index: 1;
}

.overview-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.85fr);
}

.panel {
    min-width: 0;
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    animation: rise-in 300ms 70ms ease-out both;
}

.overview-grid .panel {
    margin-bottom: 0;
}

.panel-span {
    grid-column: span 1;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 4px 0 0;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
}

.button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:hover {
    border-color: #9dac9f;
    background: var(--surface-muted);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.button-primary {
    border-color: var(--green);
    background: var(--green);
    color: #ffffff;
}

.button-primary:hover {
    border-color: #0d684d;
    background: #0d684d;
}

.button-quiet {
    min-height: 32px;
    padding: 0 9px;
    border-color: transparent;
    background: transparent;
    color: var(--green);
}

.button-quiet:hover {
    border-color: #bfd4c8;
    background: var(--green-soft);
}

.button-danger {
    border-color: var(--coral);
    background: var(--coral);
    color: #ffffff;
}

.button-wide {
    width: 100%;
}

.icon-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.icon-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
}

.icon-button.danger {
    color: var(--coral);
}

.copy-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.copy-value .icon-button {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
}

.definition-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.definition-list > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.definition-list > div:last-child {
    border-bottom: 0;
}

.definition-list dt {
    color: var(--muted);
    font-size: 12px;
}

.definition-list dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.platform-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 18px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
}

.platform-tab {
    padding: 8px 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    cursor: pointer;
}

.platform-tab:hover {
    background: var(--surface-muted);
    color: var(--ink);
}

.platform-tab.active {
    background: var(--ink);
    color: #ffffff;
}

.payment-filter-tabs,
.readiness-filter-tabs {
    margin-bottom: 18px;
}

.payment-filter-tabs .platform-tab,
.readiness-filter-tabs .platform-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.payment-filter-tabs .platform-tab small,
.readiness-filter-tabs .platform-tab small {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 18px;
    text-align: center;
}

.payment-filter-tabs .platform-tab.active small,
.readiness-filter-tabs .platform-tab.active small {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.toolbar-note {
    color: var(--muted);
    font-size: 12px;
}

.legal-consent-note {
    margin: -10px 0 20px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: rgba(255, 255, 255, 0.66);
    color: var(--muted);
    font-size: 12px;
}

.legal-consent-note a {
    color: var(--green);
    font-weight: 700;
    text-decoration: none;
}

.segmented {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
}

.segmented button {
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-right: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.segmented button:last-child {
    border-right: 0;
}

.segmented button.active {
    background: var(--ink);
    color: #ffffff;
}

.chart-shell {
    overflow: hidden;
    width: 100%;
    min-height: 260px;
}

.usage-chart {
    display: block;
    width: 100%;
    height: auto;
}

.chart-axis {
    stroke: var(--line);
    stroke-width: 1;
}

.chart-success {
    fill: var(--green);
}

.chart-failed {
    fill: var(--coral);
}

.chart-label {
    fill: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.legend {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend i {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.legend-success {
    background: var(--green);
}

.legend-failed {
    background: var(--coral);
}

.product-strip {
    display: grid;
    overflow: hidden;
    margin-top: 18px;
    border-top: 1px solid var(--line);
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.product-strip > div {
    display: grid;
    gap: 3px;
    padding: 14px 14px 0 0;
}

.product-strip span,
.product-strip small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-strip strong {
    font-family: var(--font-mono);
    font-size: 18px;
}

.table-wrap {
    overflow-x: auto;
    margin: 0 -20px -20px;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

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

thead {
    position: sticky;
    z-index: 2;
    top: 0;
}

th {
    background: var(--surface-muted);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: inset 0 -1px 0 var(--line-strong);
}

th:first-child,
td:first-child {
    padding-left: 22px;
}

th:last-child,
td:last-child {
    padding-right: 22px;
}

tbody tr {
    transition: background-color 140ms ease;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover td {
    background: #f5faf7;
}

tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--green);
}

.cell-sub {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.member-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-identity strong,
.member-identity span {
    display: block;
}

.member-identity strong {
    color: var(--ink);
}

.member-identity span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.member-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.role-select {
    min-height: 34px;
    padding: 0 28px 0 9px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12px;
}

.role-select:disabled {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--muted);
}

.align-right {
    text-align: right;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
}

.status-pill.good {
    border-color: #b9d7c9;
    background: var(--green-soft);
    color: #0f684e;
}

.status-pill.bad {
    border-color: #e6c1b8;
    background: var(--coral-soft);
    color: #99422f;
}

.status-pill.warn {
    border-color: #e5d1aa;
    background: var(--amber-soft);
    color: #8a580f;
}

.ledger-list {
    display: grid;
}

.ledger-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

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

.ledger-row > div {
    display: grid;
    gap: 2px;
}

.ledger-row strong {
    font-size: 13px;
}

.ledger-row span {
    color: var(--muted);
    font-size: 11px;
}

.ledger-figure {
    text-align: right;
}

.ledger-figure strong {
    font-family: var(--font-mono);
}

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

.offer,
.plan-card {
    display: grid;
    min-width: 0;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.offer {
    grid-template-columns: 1fr auto;
}

.offer h3,
.plan-card h3 {
    margin: 4px 0 0;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
}

.offer-figure {
    align-self: center;
    text-align: right;
}

.offer-figure strong {
    display: block;
    font-family: var(--font-mono);
    font-size: 22px;
}

.offer-figure span,
.offer-price {
    color: var(--muted);
    font-size: 11px;
}

.offer-price {
    align-self: center;
    font-family: var(--font-mono);
    font-weight: 700;
}

.offer .button {
    grid-column: 1 / -1;
}

.plan-card {
    align-content: start;
}

.plan-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.plan-card-head > strong {
    font-family: var(--font-mono);
    font-size: 16px;
    text-align: right;
}

.plan-card-head small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
}

.plan-credits {
    padding: 13px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
}

.plan-credits span {
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
}

.plain-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plain-list li {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 12px;
}

.subscription-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.subscription-summary h2 {
    margin: 4px 0;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
}

.subscription-summary p {
    margin: 0;
    color: var(--muted);
}

.entitlement-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.entitlement-chips span {
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.account-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
}

.form-stack {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.field > span,
.advanced-field summary {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: #ffffff;
    color: var(--ink);
}

.field textarea {
    min-height: 100px;
    padding-top: 10px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--green);
}

.advanced-field summary {
    cursor: pointer;
}

.advanced-field .field {
    margin-top: 10px;
}

.form-hint,
.modal-copy {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.form-error {
    display: none;
    padding: 9px 10px;
    border: 1px solid #e6c1b8;
    border-radius: var(--radius-small);
    background: var(--coral-soft);
    color: #99422f;
    font-size: 12px;
}

.form-error.visible {
    display: block;
}

.button.busy {
    cursor: wait;
    opacity: 0.7;
}

.empty-state,
.loading-state,
.error-state {
    display: grid;
    min-height: 180px;
    place-items: center;
    align-content: center;
    gap: 7px;
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong,
.error-state h2 {
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
}

.empty-state span,
.error-state p {
    max-width: 430px;
    margin: 0;
    font-size: 12px;
}

.loading-state .icon {
    animation: spin 900ms linear infinite;
    color: var(--green);
}

.error-state .icon {
    color: var(--coral);
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.05fr);
}

.auth-brand-panel {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    padding: 42px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    background: #17241d;
    color: #f3f6f2;
}

.auth-brand-panel .brand-mark {
    border-color: rgba(255, 255, 255, 0.2);
    background: #f3f6f2;
    color: #17241d;
}

.auth-brand-panel .brand span {
    color: #aebbb2;
}

.auth-statement {
    max-width: 560px;
}

.auth-statement .eyebrow {
    color: #83c5a8;
}

.auth-statement h1 {
    margin: 12px 0 0;
    font-family: var(--font-display);
    font-size: clamp(38px, 5vw, 66px);
    font-weight: 400;
    line-height: 0.98;
}

.auth-system-state {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #b6c2b9;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #76d09f;
    box-shadow: 0 0 0 5px rgba(118, 208, 159, 0.12);
}

.auth-form-panel {
    display: grid;
    min-height: 100vh;
    place-items: center;
    align-content: center;
    gap: 16px;
    padding: 32px;
}

.auth-card {
    width: min(440px, 100%);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-legal-links {
    display: flex;
    width: min(440px, 100%);
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    color: var(--muted);
    font-size: 11px;
}

.auth-legal-links a {
    color: var(--muted);
    text-decoration: none;
}

.auth-legal-links a:hover {
    color: var(--green);
}

.auth-legal-links span {
    color: var(--muted);
}

.auth-tabs {
    display: grid;
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
    grid-template-columns: 1fr 1fr;
}

.auth-tabs button {
    min-height: 38px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.auth-tabs button.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(24, 38, 29, 0.08);
}

.auth-heading {
    margin-bottom: 6px;
}

.auth-heading h2 {
    margin: 4px 0 0;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
}

.auth-form-note {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.auth-link-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -6px;
}

.auth-text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--green);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.auth-text-button:hover {
    color: #0e6249;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(17, 27, 20, 0.48);
    backdrop-filter: blur(6px);
}

.modal {
    width: min(520px, 100%);
    max-height: min(720px, calc(100vh - 40px));
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(17, 27, 20, 0.24);
    animation: modal-in 180ms ease-out both;
}

.modal-wide {
    width: min(920px, 100%);
}

.detail-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-summary > span:not(.status-pill) {
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 11px;
}

.detail-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.detail-section h3 {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
}

.detail-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.detail-section-head h3 {
    margin: 0;
}

.compact-table {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
}

.detail-event {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.detail-event:last-child {
    border-bottom: 0;
}

.detail-event > div {
    display: grid;
    gap: 2px;
}

.detail-event strong {
    font-size: 13px;
}

.detail-event span,
.detail-event time {
    color: var(--muted);
    font-size: 11px;
}

.detail-event time {
    flex: 0 0 auto;
    font-family: var(--font-mono);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.modal-head h2 {
    margin: 4px 0 0;
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.secret-field {
    display: grid;
    gap: 10px;
    margin-top: 17px;
}

.secret-field code {
    display: block;
    overflow-wrap: anywhere;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
    font-size: 12px;
}

.toast-region {
    position: fixed;
    z-index: 120;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 8px;
    pointer-events: none;
}

.toast {
    min-width: 220px;
    max-width: min(360px, calc(100vw - 36px));
    padding: 11px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--ink-soft);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    border-color: #b9d7c9;
    background: var(--green-soft);
    color: #0f684e;
}

.toast.error {
    border-color: #e6c1b8;
    background: var(--coral-soft);
    color: #99422f;
}

.mobile-only {
    display: none;
}

.catalog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.catalog-block {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.catalog-block-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.catalog-block-head > div {
    display: grid;
    gap: 2px;
}

.catalog-block-head strong {
    font-size: 14px;
}

.catalog-block-head span {
    color: var(--muted);
    font-size: 11px;
}

.catalog-count {
    min-width: 28px;
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
    color: var(--ink-soft) !important;
    font-family: var(--font-mono);
    font-size: 10px !important;
    text-align: center;
}

.catalog-table {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
}

.catalog-table table {
    min-width: 780px;
}

.gateway-table {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
}

.gateway-table table {
    min-width: 980px;
}

.audit-filter {
    display: grid;
    align-items: end;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.audit-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.usage-key-filter {
    grid-template-columns: minmax(0, 1fr) auto;
}

.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #e6c1b8;
    border-radius: var(--radius);
    background: var(--coral-soft);
    color: #8f3a28;
}

.alert-banner > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-banner span,
.alert-banner time {
    font-size: 12px;
}

.alert-banner time {
    white-space: nowrap;
    color: var(--muted);
}

.platform-audit-filter {
    margin-bottom: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.payment-history-panel {
    margin-top: 20px;
}

.payment-history-filter {
    margin-bottom: 16px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.runtime-status-panel {
    margin-bottom: 20px;
}

.runtime-status-grid {
    display: grid;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.runtime-status-item {
    min-width: 0;
    padding: 14px 16px;
    border-right: 1px solid var(--line);
}

.runtime-status-item:first-child {
    padding-left: 0;
}

.runtime-status-item:last-child {
    padding-right: 0;
    border-right: 0;
}

.runtime-status-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.runtime-status-head strong {
    font-size: 13px;
}

.runtime-status-item > span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}

.runtime-config-grid {
    display: grid;
    gap: 0 24px;
    padding-top: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.runtime-config-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
}

.runtime-config-item span {
    color: var(--muted);
    font-size: 12px;
}

.runtime-config-item strong {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.readiness-item-label {
    display: grid;
    gap: 6px;
}

.config-env-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.config-env-list code {
    padding: 2px 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-muted);
    color: var(--ink-soft);
    font-size: 10px;
}

.outbox-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.outbox-error {
    display: block;
    overflow: hidden;
    max-width: 320px;
    color: var(--coral);
    font-family: var(--font-mono);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-endpoint-list {
    display: grid;
    min-width: 260px;
    gap: 8px;
}

.catalog-endpoint-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.catalog-endpoint-row > div {
    display: grid;
    gap: 2px;
}

.catalog-endpoint-row code {
    color: var(--ink);
}

.catalog-endpoint-row span {
    color: var(--muted);
    font-size: 11px;
}

.catalog-row-actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}

.catalog-empty,
.catalog-empty-inline {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.catalog-empty {
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
}

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

.checkbox-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.checkbox-fieldset legend {
    padding: 0;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
}

.checkbox-fieldset > p {
    margin: 5px 0 8px;
    color: var(--muted);
    font-size: 11px;
}

.checkbox-list {
    display: grid;
    max-height: 220px;
    gap: 6px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-item input {
    flex: 0 0 auto;
    margin-top: 3px;
    accent-color: var(--green);
}

.checkbox-item span {
    display: grid;
    gap: 1px;
}

.checkbox-item small {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1080px) {
    .overview-grid,
    .account-grid {
        grid-template-columns: 1fr;
    }

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

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

    .metric:nth-child(2) {
        border-right: 0;
    }

    .metric:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .runtime-status-grid,
    .runtime-config-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .runtime-status-item:nth-child(2n) {
        padding-right: 0;
        border-right: 0;
    }

    .runtime-status-item:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 840px) {
    .console-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-102%);
        width: min(284px, calc(100vw - 48px));
        box-shadow: 18px 0 50px rgba(17, 27, 20, 0.18);
        transition: transform 180ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .topbar {
        padding: 0 16px;
    }

    .view {
        padding: 24px 16px 44px;
    }

    .mobile-only {
        display: inline-grid;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        min-height: auto;
        gap: 46px;
        padding: 28px 24px 34px;
        border-right: 0;
    }

    .auth-statement h1 {
        font-size: clamp(34px, 10vw, 52px);
    }

    .auth-form-panel {
        min-height: auto;
        padding: 22px 16px 48px;
    }

    .subscription-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .catalog-actions {
        justify-content: flex-start;
    }

    .outbox-summary {
        justify-content: flex-start;
    }

    .audit-filter {
        grid-template-columns: 1fr;
    }

    .audit-filter-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .topbar-title {
        display: none;
    }

    .role-chip {
        display: none;
    }

    .page-heading h1 {
        font-size: 30px;
    }

    .metric-strip,
    .offer-grid,
    .plan-grid,
    .product-strip,
    .runtime-status-grid,
    .runtime-config-grid {
        grid-template-columns: 1fr;
    }

    .metric {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .metric:last-child {
        border-bottom: 0;
    }

    .runtime-status-item,
    .runtime-status-item:first-child,
    .runtime-status-item:nth-child(2n),
    .runtime-status-item:last-child {
        padding-right: 0;
        padding-left: 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .runtime-status-item:last-child {
        border-bottom: 0;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar .button {
        width: 100%;
    }

    .segmented {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .panel {
        padding: 16px;
    }

    .table-wrap {
        margin: 0 -16px -16px;
    }

    .catalog-table,
    .gateway-table {
        margin: 0;
    }

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

    .modal {
        padding: 18px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .button {
        width: 100%;
    }

    .toast-region {
        right: 12px;
        bottom: 12px;
        left: 12px;
    }

    .toast {
        min-width: 0;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}
