:root {
    color-scheme: light;
    --ink: #17201d;
    --muted: #607069;
    --line: #d8e0dc;
    --paper: #f7f8f4;
    --panel: #ffffff;
    --green: #1f7a4d;
    --green-soft: #e7f4eb;
    --red: #a4382d;
    --red-soft: #fae9e6;
    --gold: #946b18;
    --gold-soft: #fff4d7;
    --blue: #315f86;
    --blue-soft: #e6f0f7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a {
    color: #245d77;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

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

.secondary-button {
    background: #eef3f0;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0;
    min-height: auto;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 20px;
    align-items: center;
    min-height: 62px;
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    color: var(--ink);
    font-weight: 800;
}

nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

nav a {
    border-radius: 6px;
    color: var(--muted);
    padding: 8px 10px;
    font-weight: 700;
}

nav a.active {
    background: #edf2ef;
    color: var(--ink);
}

.page {
    max-width: 1260px;
    margin: 0 auto;
    padding: 28px;
}

.accounts-page {
    max-width: none;
    width: min(100%, 1780px);
    padding-left: clamp(18px, 2.5vw, 34px);
    padding-right: clamp(18px, 2.5vw, 34px);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f7f8f4 0%, #e6f0f7 100%);
}

.login-panel {
    width: min(520px, 100%);
    padding: 36px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(28, 38, 34, 0.12);
}

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

h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.02;
    margin-bottom: 12px;
    letter-spacing: 0;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

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

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

.small {
    font-size: 0.88rem;
}

.fixture-notice {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid #d7e6ee;
    background: var(--blue-soft);
    color: #24495e;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 20px;
}

.hero-strip,
.section-heading,
.detail-title {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.hero-strip p {
    max-width: 700px;
}

.freshness,
.title-actions,
.queue-meta,
.source-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.source-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -8px 0 18px;
}

.page-footer {
    width: min(1400px, calc(100% - 32px));
    margin: 24px auto 0;
    padding: 18px 0 28px;
    border-top: 1px solid var(--line);
}

.page-footer .source-strip {
    margin: 0 0 16px;
}

.page-footer .help-panel {
    margin-bottom: 0;
}

.refresh-form {
    display: grid;
    gap: 8px;
}

.accounts-page .section-heading .title-actions {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.accounts-page .section-heading .refresh-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.accounts-page .section-heading .refresh-form .check-row {
    white-space: nowrap;
}

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

.metric,
.panel,
.server-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.metric span {
    color: var(--muted);
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 1.55rem;
}

.two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 26px;
}

.list-table,
.attention-list,
.queue {
    display: grid;
    gap: 8px;
}

.list-row,
.attention-item,
.queue-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) repeat(6, minmax(120px, 1fr)) auto auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
}

label {
    color: var(--muted);
    display: grid;
    gap: 4px;
    font-size: 0.82rem;
    font-weight: 800;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    min-height: 38px;
    padding: 7px 9px;
    background: #fff;
    color: var(--ink);
}

.check-row {
    display: flex;
    gap: 7px;
    align-items: center;
    min-height: 38px;
}

.check-row input {
    width: auto;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1050px;
}

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

th {
    color: var(--muted);
    background: #f3f6f4;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.sort-link {
    color: inherit;
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.sort-link.up::after {
    content: "^";
}

.sort-link.down::after {
    content: "v";
}

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

.pill,
.count-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.78rem;
    min-height: 26px;
    padding: 3px 9px;
    white-space: nowrap;
}

.good {
    background: var(--green-soft);
    color: var(--green);
}

.danger {
    background: var(--red-soft);
    color: var(--red);
}

.watch {
    background: var(--gold-soft);
    color: var(--gold);
}

.neutral,
.unknown-pill,
.count-chip {
    background: #eef3f0;
    color: var(--muted);
}

.unknown {
    color: #7b4a12;
    font-style: italic;
}

.source-badge {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 8px;
    background: #f8faf8;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.2;
}

.source-badge span:first-child {
    color: var(--ink);
    font-weight: 800;
}

.help-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 16px;
    padding: 10px 12px;
}

.help-panel summary {
    cursor: pointer;
    font-weight: 800;
}

.help-panel p {
    margin: 8px 0;
    color: var(--muted);
}

.help-panel dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

.help-panel dl div {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 10px;
}

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

.panel dl,
.kv-grid {
    display: grid;
    gap: 10px;
    margin: 0;
}

.panel-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-title h2 {
    margin-bottom: 0;
}

.panel dl div,
.kv-grid div {
    display: grid;
    grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
    gap: 12px;
}

dt {
    color: var(--muted);
    font-weight: 800;
}

dd {
    margin: 0;
}

.reason-list {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    padding: 16px 16px 16px 34px;
}

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

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

.bar-label {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-weight: 800;
    font-size: 0.82rem;
    margin: 14px 0 6px;
}

.bar {
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: #e6ece8;
}

.bar span {
    display: block;
    height: 100%;
    background: var(--blue);
}

.empty,
.empty-state {
    text-align: center;
    padding: 36px;
}

.edit-form,
.stack-form {
    display: grid;
    gap: 14px;
    max-width: 860px;
}

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

.form-field {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.form-error {
    color: var(--red);
    display: block;
    font-weight: 800;
    margin-top: 6px;
}

.field-help {
    color: var(--muted);
    grid-column: 1 / -1;
    margin: -4px 0 2px;
}

.form-actions {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
}

.whm-review-row {
    align-items: flex-start;
}

.inline-map-form {
    display: grid;
    gap: 8px;
    min-width: 260px;
}

.whm-filters {
    grid-template-columns: minmax(260px, 1.4fr) minmax(140px, 0.7fr) minmax(180px, 0.8fr) auto auto auto;
}

.whm-table table {
    min-width: 1180px;
}

.accounts-resource-table table {
    min-width: 1480px;
    table-layout: fixed;
}

.accounts-resource-table td {
    font-size: 0.9rem;
    line-height: 1.38;
}

.accounts-resource-table th:nth-child(1),
.accounts-resource-table td:nth-child(1) {
    width: 25%;
}

.accounts-resource-table th:nth-child(2),
.accounts-resource-table td:nth-child(2) {
    width: 7%;
    white-space: nowrap;
}

.accounts-resource-table th:nth-child(3),
.accounts-resource-table td:nth-child(3) {
    width: 12%;
}

.accounts-resource-table th:nth-child(4),
.accounts-resource-table td:nth-child(4) {
    width: 13%;
}

.accounts-resource-table th:nth-child(5),
.accounts-resource-table td:nth-child(5) {
    width: 14%;
}

.accounts-resource-table th:nth-child(6),
.accounts-resource-table td:nth-child(6) {
    width: 17%;
}

.accounts-resource-table th:nth-child(7),
.accounts-resource-table td:nth-child(7) {
    width: 12%;
}

.site-health-alerts {
    background: var(--gold-soft);
    border: 1px solid #ead6a5;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px;
}

.site-health-alerts > div:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.site-health-alert-list {
    display: grid;
    gap: 6px;
}

.site-health-alert-list a {
    align-items: center;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 6px;
    color: var(--ink);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    padding: 7px 9px;
    text-decoration: none;
}

.site-health-panel {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

.site-health-monitor {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
}

.site-health-monitor-title,
.site-health-observation {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    justify-content: space-between;
}

.site-health-monitor-form {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-health-monitor-form label:not(.check-row) {
    display: grid;
    gap: 5px;
}

.site-health-monitor-form .check-row {
    align-items: center;
    display: flex;
}

.site-health-monitor-form .health-baseline-field,
.site-health-monitor-form .button-row {
    grid-column: 1 / -1;
}

.site-health-observation {
    background: #f8faf8;
    border-radius: 6px;
    padding: 10px;
}

.accounts-resource-table tr.is-suspended td {
    background: #fff7f4;
}

.accounts-resource-table tr.is-suspended td:first-child {
    box-shadow: inset 4px 0 0 #e9a99e;
}

.accounts-resource-table tr.attention-24h:not(.is-suspended) td:first-child {
    box-shadow: inset 4px 0 0 var(--red);
}

.accounts-resource-table tr.attention-7d:not(.is-suspended) td:first-child {
    box-shadow: inset 4px 0 0 var(--gold);
}

.accounts-resource-table tr.attention-30d:not(.is-suspended) td:first-child {
    box-shadow: inset 4px 0 0 #b5c0ba;
}

.accounts-resource-table tr.attention-missing:not(.is-suspended) td:first-child {
    box-shadow: inset 4px 0 0 #d4dad6;
}

.domain-link {
    display: inline-block;
    max-width: 44ch;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.risk-text {
    font-weight: 800;
    color: var(--ink);
}

.support-text {
    font-weight: 800;
    color: var(--blue);
}

.danger-text {
    color: var(--red);
    font-weight: 800;
}

.status-inline {
    margin-left: 6px;
}

.service-value-row {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 7px;
}

.fault-summary {
    display: inline-block;
    margin-top: 5px;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.fault-current {
    color: var(--red);
}

.fault-recent {
    color: var(--gold);
}

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

.whm-action {
    border-top: 1px solid var(--line);
    padding: 8px 0;
}

.whm-action:first-child {
    border-top: 0;
    padding-top: 0;
}

.whm-action summary {
    cursor: pointer;
    font-weight: 800;
}

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

.inline-note-editor {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 12px;
}

.inline-note-editor summary {
    cursor: pointer;
    font-weight: 800;
}

.inline-note-editor form {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.mini-list {
    border-top: 1px solid var(--line);
    margin-top: 8px;
    padding-top: 8px;
}

.onboarding-form {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
}

.onboarding-form label:last-of-type {
    grid-column: 1 / -1;
}

.onboarding-form button {
    grid-column: 1 / -1;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin: 14px 0 24px;
}

.v2-dashboard-page code {
    overflow-wrap: anywhere;
}

.v2-lineage {
    margin-bottom: 20px;
}

.v2-controls {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.v2-controls form {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

@media (max-width: 1050px) {

    .metric-grid,
    .detail-grid,
    .server-grid,
    .two-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 720px) {

    .app-header,
    .hero-strip,
    .section-heading,
    .detail-title,
    .server-title,
    .list-row,
    .attention-item,
    .queue-item {
        align-items: stretch;
        flex-direction: column;
    }

    .site-health-alert-list a {
        grid-template-columns: 1fr;
    }

    .app-header {
        position: static;
        padding: 14px;
    }

    .accounts-page .section-heading .title-actions {
        justify-content: flex-start;
    }

    nav {
        flex-wrap: wrap;
    }

    .page {
        padding: 18px;
    }

    .metric-grid,
    .detail-grid,
    .server-grid,
    .two-column,
    .edit-form,
    .filters,
    .onboarding-form,
    .site-health-monitor-form {
        grid-template-columns: 1fr;
    }

    .panel dl div,
    .kv-grid div {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    h1 {
        font-size: 2rem;
    }
}
