:root {
    --bg: #f3f5f7;
    --ink: #17202a;
    --muted: #667085;
    --line: #d9dee6;
    --card: #ffffff;
    --header: #141820;
    --header-soft: #222936;
    --orange: #d96f20;
    --orange-soft: #fff1e6;
    --green: #1f8a5b;
    --green-soft: #e8f7ef;
    --red: #b42318;
    --red-soft: #fff0ed;
    --shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

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

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.admin-header {
    background: var(--header);
    color: #ffffff;
    border-bottom: 4px solid var(--orange);
}

.header-inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.admin-header h1,
.section-heading h2,
.card h2 {
    margin: 0;
    letter-spacing: 0;
}

.admin-header h1 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 720;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--orange);
    font-size: 0.74rem;
    font-weight: 760;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-header .eyebrow {
    color: #ffb27a;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.admin-identity {
    display: grid;
    gap: 1px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    text-align: right;
}

.admin-identity strong {
    font-size: 0.86rem;
    font-weight: 720;
}

.admin-identity span {
    color: #b8c0cc;
    font-size: 0.74rem;
}

.status-pill {
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: var(--header-soft);
    color: #d9e0ea;
    font-size: 0.84rem;
    font-weight: 650;
}

.live-api-badge {
    background: var(--green-soft);
    color: var(--green);
}

[hidden] {
    display: none !important;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--orange);
    box-shadow: 0 0 0 5px rgba(217, 111, 32, 0.18);
}

.console-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 44px;
}

.tab-list {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    overflow-x: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.tab-button {
    min-height: 40px;
    padding: 9px 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 720;
    white-space: nowrap;
}

.tab-button:hover,
.tab-button:focus-visible {
    color: var(--ink);
    background: #f7f9fb;
    outline: none;
}

.tab-button.active {
    color: var(--orange);
    background: var(--orange-soft);
    box-shadow: inset 0 -2px 0 var(--orange);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

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

.section-heading {
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.section-heading h2,
.card h2 {
    font-size: 1.05rem;
    font-weight: 760;
}

.timestamp {
    color: var(--muted);
    font-size: 0.86rem;
    white-space: nowrap;
}

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

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

.metric-card,
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric-card {
    min-height: 118px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card {
    padding: 20px;
    min-width: 0;
}

.metric-label,
.row-label,
.issue-meta,
.business-meta,
.panel-copy {
    color: var(--muted);
    font-size: 0.86rem;
}

.metric-value {
    margin-top: 8px;
    font-size: 1.8rem;
    font-weight: 780;
}

.metric-trend {
    color: var(--orange);
    font-size: 0.86rem;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
    gap: 18px;
    margin-top: 18px;
}

.overview-ops-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.system-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
}

.search-panel {
    margin-top: 18px;
}

.full-width {
    grid-column: 1 / -1;
}

.health-score {
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--green-soft);
    color: var(--green);
    font-weight: 760;
}

.health-list,
.billing-stack,
.issue-list {
    display: grid;
    gap: 12px;
}

.issue-list.compact {
    gap: 10px;
}

.health-row,
.billing-row,
.issue-row,
.business-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.health-row,
.billing-row,
.issue-row {
    padding: 14px;
}

.health-top,
.billing-row,
.issue-top,
.business-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.health-name,
.health-value,
.billing-value,
.issue-title,
.business-name {
    font-weight: 740;
}

.health-value.good,
.billing-value.good {
    color: var(--green);
}

.health-value.watch,
.billing-value.watch {
    color: var(--orange);
}

.health-value.issue,
.billing-value.issue {
    color: var(--red);
}

.billing-value.neutral {
    color: var(--muted);
}

.billing-value {
    font-size: 1.1rem;
}

.search-header {
    align-items: center;
}

.search-box {
    flex: 0 1 420px;
}

.search-box input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--ink);
}

.search-box input:focus {
    outline: 2px solid rgba(217, 111, 32, 0.26);
    border-color: var(--orange);
}

.business-table {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.business-row {
    padding: 14px;
    border-width: 0 0 1px;
    border-radius: 0;
}

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

.business-meta {
    margin-top: 2px;
}

.tag {
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 760;
    white-space: nowrap;
}

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

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

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

.issue-row {
    border-left: 4px solid var(--orange);
}

.issue-row.issue {
    border-left-color: var(--red);
}

.issue-meta {
    margin-top: 6px;
}

.coming-soon-card {
    max-width: 620px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.coming-soon-card h2 {
    margin-bottom: 8px;
    font-size: 1.35rem;
}

.panel-copy {
    max-width: 520px;
    margin: 0;
}

.ui-state,
.empty-state {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--muted);
}

.metric-grid > .ui-state {
    grid-column: 1 / -1;
}

.ui-state strong,
.empty-state strong {
    color: var(--ink);
}

.ui-state.loading {
    border-left: 4px solid var(--orange);
}

.ui-state.empty,
.empty-state {
    border-left: 4px solid var(--orange);
}

.ui-state.success {
    border-left: 4px solid var(--green);
    background: var(--green-soft);
}

.ui-state.error {
    border-left: 4px solid var(--red);
    background: var(--red-soft);
}

.empty-state {
    text-align: left;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .metric-grid,
    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .overview-ops-grid,
    .system-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .header-inner,
    .console-shell {
        width: min(100% - 24px, 1180px);
    }

    .header-inner,
    .section-heading,
    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        align-items: stretch;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .admin-identity {
        flex: 1 1 100%;
        text-align: left;
    }

    .tab-list {
        margin-bottom: 14px;
    }

    .tab-button {
        flex: 0 0 auto;
    }

    .section-heading,
    .card {
        padding: 16px;
    }

    .metric-grid,
    .overview-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 104px;
    }

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

    .search-header {
        align-items: stretch;
    }

    .search-box {
        flex-basis: auto;
    }

    .health-top,
    .billing-row,
    .issue-top,
    .business-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .tag {
        align-self: flex-start;
    }
}
