:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #18202a;
    --muted: #687384;
    --line: #d9dee7;
    --primary: #126c64;
    --primary-dark: #0c4e49;
    --danger-bg: #fff2f0;
    --danger: #a33122;
    --success-bg: #effaf4;
    --success: #24663f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--text);
    font-weight: 750;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto;
}

.panel,
.hero-band,
.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(24, 32, 42, 0.06);
}

.panel {
    padding: 26px;
    margin-bottom: 22px;
}

.narrow {
    max-width: 620px;
    margin: 48px auto;
}

.hero-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    margin-bottom: 22px;
}

h1,
h2 {
    margin: 0 0 10px;
    line-height: 1.15;
}

h1 {
    font-size: 32px;
}

h2 {
    font-size: 21px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.lead {
    margin: 0 0 8px;
    font-size: 18px;
    color: #263445;
}

.form-grid {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: #344052;
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

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

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.primary:hover {
    background: var(--primary-dark);
}

.field-help {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.companion-list {
    display: grid;
    gap: 14px;
}

fieldset {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

legend {
    padding: 0 6px;
    color: var(--muted);
    font-weight: 750;
}

.inline {
    display: inline;
}

.notice {
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--success-bg);
    color: var(--success);
}

.notice.error {
    background: var(--danger-bg);
    color: var(--danger);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.metric {
    padding: 20px;
}

.metric span {
    display: block;
    color: var(--muted);
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

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

.compact-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.compact-metrics .metric {
    padding: 16px;
    box-shadow: none;
}

.account-list {
    display: grid;
    gap: 16px;
}

.account-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.1fr) minmax(420px, 2fr) minmax(360px, 1.5fr);
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.account-identity h3 {
    margin: 0;
    font-size: 18px;
}

.account-identity p {
    margin: 3px 0 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.pill-row,
.event-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill,
.event-chips span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2f7;
    color: #344052;
    font-size: 13px;
    font-weight: 750;
}

.pill-ok {
    background: var(--success-bg);
    color: var(--success);
}

.pill-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.pill-warn {
    background: #fff8e7;
    color: #8a5a00;
}

.account-row-meta {
    display: grid;
    grid-template-columns: 1.2fr 0.55fr 1fr 1.3fr;
    gap: 10px;
    margin: 0;
}

.account-row-meta div {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    min-height: 62px;
}

.account-row-meta dt {
    color: var(--muted);
    font-size: 12px;
}

.account-row-meta dd {
    margin: 3px 0 0;
    font-weight: 800;
}

.account-events-cell dd {
    display: grid;
    gap: 2px;
}

.account-events-cell span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-warning {
    padding: 10px 12px;
    border: 1px solid #f0d391;
    border-radius: 6px;
    background: #fff8e7;
    color: #8a5a00;
    font-weight: 750;
}

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

.account-row-actions form {
    margin: 0;
}

.account-row-actions button {
    min-height: 36px;
    padding: 7px 10px;
}

.delete-inline {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
}

.delete-inline input {
    min-height: 36px;
    padding: 7px 9px;
}

.delete-inline button {
    border-color: var(--danger);
    color: var(--danger);
}

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

.download-card {
    display: grid;
    gap: 10px;
    align-content: start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.download-card h3,
.download-card p {
    margin: 0;
}

.settings-test-form {
    margin-top: 14px;
}

.checklist {
    padding-left: 20px;
}

.status-list {
    display: grid;
    gap: 10px;
}

.status-list.compact {
    margin-top: 14px;
}

.status-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.status-list dt {
    color: var(--muted);
}

.status-list dd {
    margin: 0;
    font-weight: 700;
}

.confirmation-box {
    padding: 18px;
    margin: 22px 0;
    border: 1px solid #b9dec9;
    border-radius: 8px;
    background: var(--success-bg);
}

.confirmation-box h2 {
    margin-bottom: 8px;
}

.payment-total {
    padding: 12px 14px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #b9dec9;
}

.success-text {
    color: var(--success);
    font-weight: 750;
}

.action-stack {
    display: grid;
    gap: 8px;
}

.compact-list {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
}

code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #eef2f7;
    color: #243142;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 13px;
}

hr {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
    .topbar,
    .hero-band {
        align-items: flex-start;
        flex-direction: column;
    }

    .split,
    .metric-grid,
    .download-grid,
    .account-row,
    .account-row-meta,
    .delete-inline {
        grid-template-columns: 1fr;
    }

    .account-row-actions,
    .section-title {
        flex-direction: column;
        align-items: stretch;
    }
}
