:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #101828;
    --muted: #667085;
    --line: #d8e0ea;
    --yellow: #f4d35e;
    --yellow-ink: #1d2939;
    --blue: #2f80ed;
    --green: #12b981;
    --red: #b42318;
    --red-soft: #fee4e2;
    --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
    color: inherit;
}

#blazor-error-ui {
    display: none !important;
}

.app-loading {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 14px;
    color: var(--ink);
}

.brand-mark {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--yellow);
    color: var(--yellow-ink);
    font-weight: 900;
}

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

.business-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    background: #0f172a;
    color: #e5edf8;
}

.business-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    text-decoration: none;
}

.business-brand small,
.business-eyebrow,
.section-kicker {
    display: block;
    color: #8a97aa;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.business-logo {
    width: 46px;
    height: 46px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--yellow);
    color: #0f172a;
    font-size: 1.4rem;
}

.business-nav {
    display: grid;
    gap: 8px;
}

.business-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 700;
}

.business-nav a:hover,
.business-nav a.active {
    background: rgba(244, 211, 94, 0.16);
    color: #ffffff;
}

.business-main {
    min-width: 0;
}

.business-topbar {
    min-height: 78px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
}

.business-version {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    background: var(--surface);
}

.business-content {
    width: min(1320px, calc(100% - 48px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.page-header h1,
.panel h2 {
    margin: 0;
    letter-spacing: 0;
}

.page-header h1 {
    font-size: 2.1rem;
    line-height: 1.1;
}

.page-header h1:focus {
    outline: none;
}

.page-header > .icon-button {
    min-width: 150px;
    white-space: nowrap;
}

.page-header p,
.muted {
    margin: 8px 0 0;
    color: var(--muted);
}

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

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

.metric-card {
    min-height: 136px;
    padding: 20px;
    display: grid;
    align-content: center;
    gap: 6px;
}

.metric-card span,
.metric-card small,
.receiver-row small,
.audit-row small,
.portal-card p,
.portal-card dt,
.trusted-list span,
.trusted-list small {
    color: var(--muted);
}

.metric-card strong {
    font-size: 2rem;
}

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

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

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

.panel-header.flush {
    margin-bottom: 12px;
}

.link-button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

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

.icon-button.subtle {
    background: var(--surface-soft);
}

.icon-button.danger {
    border-color: #fecdca;
    background: var(--red-soft);
    color: var(--red);
}

.icon-button:disabled {
    opacity: 0.48;
}

.receiver-list,
.audit-list,
.trusted-list {
    display: grid;
    gap: 10px;
}

.receiver-row,
.audit-row {
    display: grid;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.receiver-row {
    grid-template-columns: 12px minmax(0, 1fr) auto;
}

.receiver-row.large {
    min-height: 78px;
}

.audit-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #98a2b3;
}

.status-dot.online {
    background: var(--green);
}

.status-dot.offline {
    background: #f79009;
}

.row-status,
.portal-state,
.audit-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2f7;
    color: #475467;
    font-weight: 800;
    font-size: 0.82rem;
}

.audit-state.received,
.audit-state.downloaded,
.portal-state.active {
    background: #dcfae6;
    color: #067647;
}

.audit-state.blocked,
.portal-state.paused {
    background: var(--red-soft);
    color: var(--red);
}

.audit-state.expired {
    background: #fef0c7;
    color: #93370d;
}

.flow-strip {
    display: grid;
    grid-template-columns: 1fr 36px 1fr 36px 1fr 36px 1fr;
    align-items: center;
    gap: 12px;
}

.flow-strip div {
    min-height: 132px;
    padding: 18px;
    display: grid;
    align-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.flow-strip i {
    color: var(--blue);
    font-size: 1.5rem;
}

.flow-strip span {
    height: 2px;
    background: var(--line);
}

.split-panel {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: 18px;
}

.form-grid,
.inline-form {
    display: grid;
    gap: 12px;
}

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

.form-grid .wide {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 6px;
    color: var(--ink);
    font-weight: 800;
}

input,
select {
    min-height: 44px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #ffffff;
    color: var(--ink);
}

.row-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
}

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

.portal-card {
    padding: 18px;
    display: grid;
    gap: 14px;
}

.portal-card h2 {
    margin: 8px 0 4px;
    font-size: 1.1rem;
}

.portal-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.portal-card dd {
    margin: 0;
    font-weight: 800;
}

.table-wrap {
    overflow-x: auto;
}

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

.business-table th,
.business-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

.business-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.empty-cell {
    color: var(--muted);
    text-align: center !important;
}

.usage-bar {
    height: 12px;
    margin-top: 18px;
    border-radius: 999px;
    background: #e4e7ec;
    overflow: hidden;
}

.usage-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--blue));
}

.inline-form {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) auto;
    margin-bottom: 16px;
}

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

.trusted-list div {
    padding: 14px;
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

@media (max-width: 1080px) {
    .business-shell {
        grid-template-columns: 1fr;
    }

    .business-sidebar {
        position: relative;
        height: auto;
    }

    .business-nav,
    .metric-grid,
    .work-grid,
    .split-panel,
    .portal-grid,
    .trusted-list,
    .flow-strip {
        grid-template-columns: 1fr;
    }

    .flow-strip > span {
        display: none;
    }

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

@media (max-width: 720px) {
    .business-content {
        width: min(100% - 24px, 1320px);
    }

    .business-topbar,
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

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