:root {
    color-scheme: light;
    --page: #f5f7fb;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-brand: #f3f1ff;
    --ink: #172033;
    --ink-soft: #344054;
    --muted: #667085;
    --muted-light: #98a2b3;
    --line: #e4e7ec;
    --line-strong: #d0d5dd;
    --brand: #635bff;
    --brand-hover: #5147ed;
    --brand-ink: #4338ca;
    --good: #087443;
    --good-bg: #ecfdf3;
    --bad: #b42318;
    --bad-bg: #fef3f2;
    --warn: #a15c00;
    --warn-bg: #fff8e8;
    --info: #175cd3;
    --info-bg: #eff8ff;
    --page-glow-brand: rgba(99, 91, 255, .08);
    --page-glow-info: rgba(47, 144, 250, .06);
    --page-veil-border: rgba(228, 231, 236, .55);
    --page-veil-start: rgba(255, 255, 255, .84);
    --page-veil-end: rgba(255, 255, 255, .18);
    --panel-border: rgba(228, 231, 236, .92);
    --panel-bg: rgba(255, 255, 255, .94);
    --hero-accent: rgba(99, 91, 255, .045);
    --config-border: #e6e3ff;
    --config-start: #faf9ff;
    --config-end: #f5f7ff;
    --config-highlight: rgba(255, 255, 255, .9);
    --config-divider: rgba(99, 91, 255, .1);
    --config-code: #4b5565;
    --control-bg: #ffffff;
    --control-hover-border: #b7bdc8;
    --button-ink: #ffffff;
    --secondary-border: #ddd9ff;
    --secondary-bg: #f4f2ff;
    --secondary-hover-border: #c8c2ff;
    --secondary-hover-bg: #ebe8ff;
    --floating-border: #d8d3ff;
    --floating-bg: rgba(255, 255, 255, .96);
    --floating-hover-border: #bdb5ff;
    --floating-shadow: 0 12px 30px rgba(16, 24, 40, .16), 0 3px 10px rgba(99, 91, 255, .12);
    --floating-hover-shadow: 0 15px 34px rgba(16, 24, 40, .18), 0 4px 12px rgba(99, 91, 255, .18);
    --good-line: #abefc6;
    --bad-line: #fecdca;
    --warn-line: #fedf89;
    --info-line: #b2ddff;
    --note-border: #ddd9ff;
    --note-ink: #4f46a5;
    --table-head-bg: #f8fafc;
    --table-row-hover: #fbfbff;
    --badge-border: #e4e7ec;
    --badge-bg: #f2f4f7;
    --surface-hover-border: #d5d0ff;
    --surface-hover-bg: #fbfaff;
    --code-border: #25324a;
    --code-bg: #111827;
    --code-ink: #dbe7ff;
    --code-scrollbar: #475467;
    --timeline-mid: #d9ddf7;
    --timeline-end: #e7e9f8;
    --event-start: #ffffff;
    --event-end: #fafbff;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-card: 0 12px 36px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .03);
    --shadow-button: 0 1px 2px rgba(16, 24, 40, .12), 0 2px 6px rgba(99, 91, 255, .16);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0b1120;
    --surface: #121b2c;
    --surface-subtle: #172235;
    --surface-brand: #211f46;
    --ink: #f1f5f9;
    --ink-soft: #cbd5e1;
    --muted: #94a3b8;
    --muted-light: #64748b;
    --line: #2a364a;
    --line-strong: #41516a;
    --brand: #675dff;
    --brand-hover: #5d53ef;
    --brand-ink: #c4c1ff;
    --good: #70e2a6;
    --good-bg: #102b21;
    --bad: #ff9b91;
    --bad-bg: #361817;
    --warn: #f7c66a;
    --warn-bg: #33260f;
    --info: #7cc4ff;
    --info-bg: #10283a;
    --page-glow-brand: rgba(118, 108, 255, .12);
    --page-glow-info: rgba(47, 144, 250, .08);
    --page-veil-border: rgba(65, 81, 106, .42);
    --page-veil-start: rgba(22, 32, 50, .72);
    --page-veil-end: rgba(11, 17, 32, .12);
    --panel-border: rgba(65, 81, 106, .72);
    --panel-bg: rgba(18, 27, 44, .94);
    --hero-accent: rgba(139, 131, 255, .07);
    --config-border: #37345f;
    --config-start: #1c1e38;
    --config-end: #171e32;
    --config-highlight: rgba(255, 255, 255, .035);
    --config-divider: rgba(196, 193, 255, .12);
    --config-code: #aebbd0;
    --control-bg: #111a2a;
    --control-hover-border: #596a84;
    --button-ink: #ffffff;
    --secondary-border: #48447a;
    --secondary-bg: #25234b;
    --secondary-hover-border: #615b9c;
    --secondary-hover-bg: #302d5d;
    --floating-border: #45416f;
    --floating-bg: rgba(18, 27, 44, .96);
    --floating-hover-border: #615b9c;
    --floating-shadow: 0 14px 34px rgba(0, 0, 0, .34), 0 3px 10px rgba(118, 108, 255, .12);
    --floating-hover-shadow: 0 16px 38px rgba(0, 0, 0, .4), 0 4px 12px rgba(118, 108, 255, .18);
    --good-line: #1f6b4a;
    --bad-line: #7c3532;
    --warn-line: #765619;
    --info-line: #285c7d;
    --note-border: #45416f;
    --note-ink: #c4c1ff;
    --table-head-bg: #172235;
    --table-row-hover: #171f34;
    --badge-border: #3a475b;
    --badge-bg: #1d293b;
    --surface-hover-border: #4a467d;
    --surface-hover-bg: #1d2140;
    --code-border: #3a475b;
    --code-bg: #080d18;
    --code-ink: #dbe7ff;
    --code-scrollbar: #64748b;
    --timeline-mid: #44456f;
    --timeline-end: #2a364a;
    --event-start: #151f31;
    --event-end: #111a2a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 1px 3px rgba(0, 0, 0, .24);
    --shadow-card: 0 14px 38px rgba(0, 0, 0, .22), 0 3px 10px rgba(0, 0, 0, .16);
    --shadow-button: 0 1px 2px rgba(0, 0, 0, .24), 0 2px 8px rgba(118, 108, 255, .2);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 8% 0%, var(--page-glow-brand), transparent 28rem),
        radial-gradient(circle at 94% 8%, var(--page-glow-info), transparent 26rem),
        var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

body::before {
    position: fixed;
    z-index: -1;
    top: 0;
    right: 0;
    left: 0;
    height: 230px;
    border-bottom: 1px solid var(--page-veil-border);
    background: linear-gradient(180deg, var(--page-veil-start), var(--page-veil-end));
    content: "";
    pointer-events: none;
}

main {
    width: min(1480px, calc(100% - 48px));
    margin: 0 auto;
    padding: 36px 0 88px;
}

.settings-main {
    width: min(880px, calc(100% - 48px));
}

.access-main {
    display: grid;
    width: min(520px, calc(100% - 32px));
    min-height: 100vh;
    place-items: center;
    padding: 32px 0;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--ink);
    line-height: 1.2;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(28px, 3.5vw, 44px);
    font-weight: 760;
    letter-spacing: -.045em;
}

h2 {
    margin-bottom: 0;
    font-size: 19px;
    font-weight: 730;
    letter-spacing: -.025em;
}

h3 {
    margin-bottom: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
}

p {
    color: var(--muted);
    line-height: 1.65;
}

a {
    color: var(--brand-ink);
    text-underline-offset: 3px;
}

code,
pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

code {
    overflow-wrap: anywhere;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--brand-ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.eyebrow::before {
    width: 8px;
    height: 8px;
    border: 3px solid rgba(99, 91, 255, .16);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
    content: "";
}

.hero,
.card,
.metric {
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    box-shadow: var(--shadow-card);
}

.hero {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 36px;
    overflow: hidden;
    padding: 32px;
    border-radius: 24px;
}

.hero::after {
    position: absolute;
    top: -92px;
    right: -78px;
    width: 240px;
    height: 240px;
    border: 45px solid var(--hero-accent);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.hero-copy,
.hero-main {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.hero-copy p,
.hero-main p {
    max-width: 760px;
    margin: 12px 0 0;
    font-size: 15px;
}

.config,
.hero-identifiers {
    position: relative;
    z-index: 1;
    flex: 0 1 520px;
    min-width: 360px;
    padding: 8px 18px;
    border: 1px solid var(--config-border);
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, var(--config-start), var(--config-end));
    box-shadow: inset 0 1px 0 var(--config-highlight);
    font-size: 12px;
}

.config-row,
.id-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 11px 0;
}

.config-row + .config-row,
.id-row + .id-row {
    border-top: 1px solid var(--config-divider);
}

.config strong,
.id-row strong {
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.config code,
.id-row code {
    color: var(--config-code);
    line-height: 1.55;
}

.sandbox-summary .summary-row {
    align-items: center;
}

.dashboard-hero {
    align-items: center;
}

.summary-value,
.summary-url {
    min-width: 0;
}

.summary-inline {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.summary-environment-badge {
    font-size: 12px;
}

.summary-environment-badge [data-environment-state]::before {
    content: "· ";
}

.summary-link {
    min-width: 0;
    max-width: 100%;
    color: var(--brand-ink);
    font-weight: 720;
    text-decoration: none;
}

.summary-link:hover {
    text-decoration: underline;
}

.summary-ellipsis {
    display: block;
    max-width: min(250px, 100%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-meta,
.summary-empty {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.summary-meta {
    margin-top: 5px;
}

.summary-url {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.config .summary-url-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-copy {
    min-height: 32px;
    padding: 0 9px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.grid {
    display: grid;
    grid-template-columns: minmax(360px, 400px) minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
    margin-top: 22px;
}

.grid > *,
.create-card form {
    min-width: 0;
}

.card {
    margin-top: 22px;
    padding: 26px;
    border-radius: var(--radius-lg);
}

.grid > .card {
    margin-top: 0;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.section-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.section-actions > form {
    margin: 0;
}

.section-head p,
.card > p {
    margin: 7px 0 0;
    font-size: 13px;
}

.section-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--brand-ink);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

label {
    display: block;
    margin-top: 16px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 680;
}

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

input,
form select {
    width: 100%;
    min-width: 0;
    height: 44px;
    margin-top: 7px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--control-bg);
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, .03);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:hover,
form select:hover {
    border-color: var(--control-hover-border);
}

input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(99, 91, 255, .12);
}

select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(99, 91, 255, .12);
}

input::placeholder {
    color: var(--muted-light);
}

.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
}

form select {
    appearance: auto;
}

input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--brand);
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    align-self: end;
    min-height: 44px;
    margin-top: 16px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}

button,
.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--brand);
    box-shadow: var(--shadow-button);
    color: var(--button-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 740;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

button:hover,
.button:hover {
    background: var(--brand-hover);
    box-shadow: 0 3px 9px rgba(99, 91, 255, .22);
    transform: translateY(-1px);
}

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

button:focus-visible,
.button:focus-visible,
summary:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(99, 91, 255, .22);
    outline-offset: 2px;
}

button.secondary,
.button.secondary {
    border-color: var(--secondary-border);
    background: var(--secondary-bg);
    box-shadow: none;
    color: var(--brand-ink);
}

button.secondary:hover,
.button.secondary:hover {
    border-color: var(--secondary-hover-border);
    background: var(--secondary-hover-bg);
}

button.small,
.button.small {
    min-height: 34px;
    padding: 0 11px;
    border-radius: 9px;
    font-size: 12px;
}

.form-actions,
.hero-actions,
.action-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.form-actions {
    justify-content: space-between;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.hero-actions {
    margin-top: 22px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.floating-controls {
    position: fixed;
    z-index: 20;
    right: 24px;
    bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.floating-settings,
.theme-trigger {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid var(--floating-border);
    border-radius: 999px;
    background: var(--floating-bg);
    box-shadow: var(--floating-shadow);
    color: var(--brand-ink);
    font-size: 13px;
    font-weight: 760;
    line-height: 1;
    text-decoration: none;
    backdrop-filter: blur(12px);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.floating-settings:hover,
.theme-trigger:hover {
    border-color: var(--floating-hover-border);
    background: var(--floating-bg);
    box-shadow: var(--floating-hover-shadow);
    transform: translateY(-2px);
}

.floating-settings-icon {
    font-size: 17px;
    line-height: 1;
}

.theme-picker {
    position: relative;
    z-index: 1;
}

.theme-trigger {
    min-width: 106px;
}

.theme-trigger-icon {
    width: 18px;
    font-size: 18px;
    line-height: 1;
    text-align: center;
}

.theme-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: 238px;
    overflow: hidden;
    padding: 6px;
    border: 1px solid var(--floating-border);
    border-radius: var(--radius-md);
    background: var(--floating-bg);
    box-shadow: var(--floating-shadow);
    backdrop-filter: blur(16px);
}

.theme-menu[hidden] {
    display: none;
}

.theme-option {
    display: grid;
    width: 100%;
    min-height: 58px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    justify-content: stretch;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    box-shadow: none;
    color: var(--ink-soft);
    text-align: left;
    white-space: normal;
}

.theme-option:hover,
.theme-option.selected {
    background: var(--surface-brand);
    box-shadow: none;
    color: var(--brand-ink);
    transform: none;
}

.theme-option.selected {
    box-shadow: inset 0 0 0 1px var(--secondary-border);
}

.theme-option-icon {
    display: grid;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--brand-ink);
    font-size: 18px;
    place-items: center;
}

.theme-option strong,
.theme-option small {
    display: block;
}

.theme-option strong {
    color: inherit;
    font-size: 13px;
}

.theme-option small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
}

.access-card {
    width: 100%;
    margin: 0;
    padding: 32px;
}

.access-card h1 {
    font-size: 30px;
}

.access-card > p {
    margin: 10px 0 0;
}

.access-card form {
    margin-top: 22px;
}

.access-card form > button {
    width: 100%;
    margin-top: 22px;
}

.settings-hero {
    display: block;
}

.settings-card {
    padding: 30px;
}

.settings-card > p {
    margin-bottom: 0;
}

.settings-card form {
    margin-top: 20px;
}

.settings-divider {
    height: 1px;
    margin: 30px 0;
    background: var(--line);
}

.environment-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.environment-panel {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.environment-panel:first-child {
    grid-column: 1 / -1;
}

.environment-panel p {
    margin: 6px 0 0;
    font-size: 12px;
}

.readonly-setting {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.readonly-setting strong {
    color: var(--muted);
    font-size: 11px;
}

.readonly-setting code {
    overflow-wrap: anywhere;
}

.compact-note {
    margin-top: 16px;
}

.page-size-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.page-size-form label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 680;
    white-space: nowrap;
}

.page-size-form select {
    min-width: 66px;
    height: 34px;
    margin-top: 0;
    padding: 0 28px 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    background: var(--control-bg);
    color: var(--ink-soft);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.flash,
.alert {
    margin-top: 18px;
    padding: 13px 16px;
    border: 1px solid;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    font-size: 13px;
}

.flash.good {
    border-color: var(--good-line);
    background: var(--good-bg);
    color: var(--good);
}

.flash.bad,
.alert.bad {
    border-color: var(--bad-line);
    background: var(--bad-bg);
    color: var(--bad);
}

.note {
    margin: 20px 0 0;
    padding: 13px 14px;
    border: 1px solid var(--note-border);
    border-radius: 11px;
    background: var(--surface-brand);
    color: var(--note-ink);
    font-size: 13px;
    line-height: 1.6;
}

.table-wrap {
    margin-top: 20px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    min-width: 830px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.orders-card table {
    min-width: 760px;
}

.callback-card table {
    min-width: 900px;
}

th,
td {
    padding: 14px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--table-head-bg);
    color: var(--muted);
    font-size: 11px;
    font-weight: 780;
    letter-spacing: .055em;
    text-transform: uppercase;
    white-space: nowrap;
}

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

tbody tr {
    transition: background .15s ease;
}

tbody tr:hover {
    background: var(--table-row-hover);
}

td {
    color: var(--ink-soft);
    line-height: 1.55;
}

td code {
    color: var(--muted);
    font-size: 11px;
}

.order-link {
    display: inline-block;
    margin-bottom: 3px;
    color: var(--brand-ink);
    text-decoration: none;
}

.order-link:hover {
    text-decoration: underline;
}

.action-group {
    align-items: flex-start;
}

.badge {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border: 1px solid var(--badge-border);
    border-radius: 999px;
    background: var(--badge-bg);
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 780;
    letter-spacing: .01em;
    line-height: 1;
    white-space: nowrap;
}

.badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: .72;
}

.badge.success,
.badge.verified,
.badge.created,
.badge.processed {
    border-color: var(--good-line);
    background: var(--good-bg);
    color: var(--good);
}

.badge.failed,
.badge.rejected,
.badge.unknown_order,
.badge.query_failed {
    border-color: var(--bad-line);
    background: var(--bad-bg);
    color: var(--bad);
}

.badge.confirming,
.badge.pending,
.badge.paid_less,
.badge.auditing,
.badge.received {
    border-color: var(--warn-line);
    background: var(--warn-bg);
    color: var(--warn);
}

.badge.unpaid,
.badge.creating {
    border-color: var(--info-line);
    background: var(--info-bg);
    color: var(--info);
}

.muted {
    color: var(--muted);
}

.danger,
.error-text {
    margin-top: 6px;
    color: var(--bad);
    font-size: 12px;
}

.empty {
    padding: 42px 24px;
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
}

.pagination-summary {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.pagination-link {
    display: inline-flex;
    min-width: 34px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

a.pagination-link:hover {
    border-color: var(--secondary-hover-border);
    background: var(--surface-brand);
    color: var(--brand-ink);
}

.pagination-link.active {
    border-color: var(--brand);
    background: var(--brand);
    color: var(--button-ink);
}

.pagination-link.disabled {
    background: var(--surface-subtle);
    color: var(--muted-light);
}

details {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

td details {
    margin-top: 8px;
}

summary {
    padding: 11px 13px;
    color: var(--brand-ink);
    font-size: 12px;
    font-weight: 740;
    list-style-position: inside;
    cursor: pointer;
    transition: background .15s ease;
}

summary:hover {
    background: var(--surface-brand);
}

pre {
    max-width: 100%;
    max-height: 440px;
    margin: 0 10px 10px;
    overflow: auto;
    padding: 15px;
    border: 1px solid var(--code-border);
    border-radius: 9px;
    background: var(--code-bg);
    color: var(--code-ink);
    font-size: 12px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-color: var(--code-scrollbar) var(--code-bg);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 16px;
    color: var(--muted-light);
    font-size: 12px;
}

.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--brand-ink);
}

.breadcrumb strong {
    max-width: min(520px, 50vw);
    overflow: hidden;
    color: var(--ink-soft);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-hero .hero-main {
    flex: 1;
}

.detail-hero h1 {
    overflow-wrap: anywhere;
}

.hero-main > .badge {
    margin-bottom: 13px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.metric {
    min-width: 0;
    padding: 19px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.metric-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 780;
    letter-spacing: .075em;
}

.metric-value {
    margin-top: 11px;
    font-size: 23px;
    font-weight: 780;
    letter-spacing: -.035em;
}

.metric-note {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
    margin-top: 20px;
}

.field {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-subtle);
    transition: border-color .15s ease, background .15s ease;
}

.field:hover {
    border-color: var(--surface-hover-border);
    background: var(--surface-hover-bg);
}

.field-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .065em;
    text-transform: uppercase;
}

.field-value {
    margin-top: 8px;
    overflow-wrap: anywhere;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.55;
}

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

.timeline {
    position: relative;
    margin-top: 24px;
    padding-left: 29px;
}

.timeline::before {
    position: absolute;
    top: 7px;
    bottom: 8px;
    left: 8px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--brand), var(--timeline-mid) 20%, var(--timeline-end));
    content: "";
}

.event {
    position: relative;
    margin-bottom: 15px;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, var(--event-start), var(--event-end));
    box-shadow: var(--shadow-sm);
}

.event::before {
    position: absolute;
    top: 23px;
    left: -28px;
    width: 11px;
    height: 11px;
    border: 3px solid var(--page);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 1px rgba(99, 91, 255, .24);
    content: "";
}

.event-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.event-head time {
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.event-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.event .field-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.event-json {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 13px;
}

.mt-sm {
    margin-top: 10px;
}

.mt-md {
    margin-top: 18px;
}

button:disabled,
.button.disabled {
    box-shadow: none;
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

@media (max-width: 1120px) {
    main {
        width: min(100% - 32px, 1480px);
        padding-top: 24px;
    }

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

    .create-card {
        max-width: none;
    }

    .hero {
        display: block;
    }

    .config,
    .hero-identifiers {
        min-width: 0;
        margin-top: 24px;
    }

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

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

    .json-grid,
    .event-json {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    main {
        width: min(100% - 20px, 1480px);
        padding: 12px 0 56px;
    }

    body::before {
        height: 150px;
    }

    .hero,
    .card {
        padding: 19px;
        border-radius: 16px;
    }

    .floating-controls {
        right: 12px;
        bottom: 12px;
    }

    .floating-settings,
    .theme-trigger {
        min-height: 42px;
        padding: 0 13px;
    }

    .theme-menu {
        width: min(238px, calc(100vw - 24px));
    }

    .summary-ellipsis {
        max-width: min(100%, 72vw);
    }

    .hero {
        gap: 22px;
    }

    .hero::after {
        top: -130px;
        right: -125px;
    }

    .hero-copy p,
    .hero-main p {
        font-size: 13px;
    }

    .detail-hero h1 {
        font-size: 22px;
    }

    .config,
    .hero-identifiers {
        margin-top: 20px;
        padding: 6px 13px;
    }

    .config-row,
    .id-row {
        grid-template-columns: 1fr;
        gap: 3px;
        padding: 10px 0;
    }

    .grid,
    .card,
    .metrics {
        margin-top: 14px;
    }

    .section-head,
    .event-head {
        display: block;
    }

    .section-head > form,
    .section-head > .section-actions,
    .section-head > .badge,
    .section-head > .muted {
        margin-top: 14px;
    }

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

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

    .pagination-links {
        justify-content: flex-start;
    }

    form .row,
    .environment-settings,
    .metrics,
    .field-grid,
    .event .field-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        align-items: stretch;
    }

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

    .hero-actions > *,
    .hero-actions .button,
    .hero-actions button {
        flex: 1 1 auto;
    }

    .hero-actions .inline-form button {
        width: 100%;
    }

    .event-head time {
        display: block;
        margin-top: 10px;
        white-space: normal;
    }

    .timeline {
        padding-left: 22px;
    }

    .timeline::before {
        left: 5px;
    }

    .event {
        padding: 15px;
    }

    .event::before {
        left: -22px;
    }

    .breadcrumb strong {
        max-width: 42vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
