@font-face {
    font-family: 'Involve';
    src: url('/static/fonts/Involve-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Involve';
    src: url('/static/fonts/Involve-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Involve';
    src: url('/static/fonts/Involve-SemiBold.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Involve';
    src: url('/static/fonts/Involve-Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Asterisk24 UI tokens */
    --asterisk24-primary: #2653f2;
    --asterisk24-primary-hover: #0431d0;
    --asterisk24-gray-80: #575757;
    --asterisk24-gray-60: #818181;
    --asterisk24-gray-40: #ababab;
    --asterisk24-gray-20: #d5d5d5;
    --asterisk24-gray-5: #f4f4f4;
    --asterisk24-white: #ffffff;
    --asterisk24-ok: #039855;
    --asterisk24-ok-bg: #ecfdf3;
    --asterisk24-warn: #deaa01;
    --asterisk24-warn-text: #b54708;
    --asterisk24-warn-bg: #fffaeb;
    --asterisk24-error: #ea3b3d;
    --asterisk24-error-bg: #fef3f2;
    --asterisk24-info-bg: #eef2ff;
    --asterisk24-radius: 8px;
    --asterisk24-radius-lg: 12px;

    --bg: var(--asterisk24-gray-5);
    --surface: var(--asterisk24-white);
    --bg-elevated: var(--asterisk24-white);
    --bg-card: var(--asterisk24-white);
    --bg-input: var(--asterisk24-white);
    --border: var(--asterisk24-gray-20);
    --border-strong: var(--asterisk24-gray-20);
    --text: var(--asterisk24-gray-80);
    --text-secondary: var(--asterisk24-gray-80);
    --text-muted: var(--asterisk24-gray-60);
    --accent: var(--asterisk24-primary);
    --accent-hover: var(--asterisk24-primary-hover);
    --accent-soft: rgba(38, 83, 242, 0.1);
    --success: var(--asterisk24-ok);
    --warning: var(--asterisk24-warn-text);
    --danger: var(--asterisk24-error);
    --info: var(--asterisk24-primary);
    --radius: var(--asterisk24-radius-lg);
    --radius-ctrl: var(--asterisk24-radius);
    --shadow: none;
    --shadow-lg: 0 8px 24px rgba(38, 83, 242, 0.08);
    --font: 'Involve', ui-sans-serif, system-ui, sans-serif;
    --mono: ui-monospace, 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

/* SVG symbols need a real viewport even when a component stylesheet is stale. */
.icon { display: block; width: 1rem; height: 1rem; flex: 0 0 auto; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text-secondary);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.875rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .55rem;
    text-decoration: none;
}

.brand-mark { width: 2.25rem; height: 2.25rem; flex: 0 0 auto; }
.brand-mark path { fill: none; stroke: #3157d5; stroke-width: 4; stroke-linecap: round; }
.brand-mark circle { fill: #26334a; }
.brand-wordmark { color: #202a3b; font-size: 1.18rem; font-weight: 750; letter-spacing: -.045em; white-space: nowrap; }
.brand-wordmark span { color: #3157d5; }

.logo-img {
    height: 2.25rem;
    width: auto;
}

.nav {
    display: flex;
    gap: 0.125rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav a {
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-ctrl);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}

.nav a:hover {
    color: var(--accent);
    background: var(--asterisk24-gray-5);
}

.nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav a.nav-muted,
.nav-logout-btn.nav-muted {
    color: var(--asterisk24-gray-40);
}

.nav a.nav-muted:hover,
.nav-logout-btn.nav-muted:hover {
    color: var(--accent);
    background: var(--asterisk24-gray-5);
}

.nav-logout {
    display: inline;
    margin: 0;
}

.nav-logout-btn {
    padding: 0.625rem 0.875rem;
    border: 0;
    border-radius: var(--radius-ctrl);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.main {
    flex: 1;
    max-width: 80rem;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.75rem 3rem;
}

.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.75rem 1.5rem;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

.footer p {
    margin: 0;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--asterisk24-gray-40);
}

/* Typography */
h1 {
    margin: 0 0 0.25rem;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

h2 {
    margin: 0 0 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

h3 {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--asterisk24-gray-40);
    margin-bottom: 0.25rem;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.muted { color: var(--text-muted); font-weight: 500; }
.small { font-size: 0.75rem; font-weight: 500; }

.page-subtitle {
    margin: 0.375rem 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.page-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


.page-header-title h1 {
    margin-bottom: 0;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.span-2 { grid-column: span 2; }
.mb { margin-bottom: 1.5rem; }
.mt { margin-top: 1.5rem; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-pad { padding: 1.25rem; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.card-header h2 { margin: 0; }

.stat-card {
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--asterisk24-warn); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--accent); }

.stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--asterisk24-gray-40);
    font-weight: 600;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.35rem 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
}

.stat-sub {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

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

.badge-ok { background: var(--asterisk24-ok-bg); color: var(--success); }
.badge-down { background: var(--asterisk24-error-bg); color: var(--danger); }
.badge-degraded,
.badge-warning { background: var(--asterisk24-warn-bg); color: var(--asterisk24-warn-text); }
.badge-muted { background: var(--asterisk24-gray-5); color: var(--text-muted); }
.badge-info { background: var(--asterisk24-info-bg); color: var(--accent); }

.health-card {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.health-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-ctrl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: var(--asterisk24-gray-5);
}

.health-icon svg {
    width: 32px;
    height: 32px;
}

.health-info { flex: 1; min-width: 0; }
.health-name { font-weight: 600; font-size: 0.875rem; color: var(--text); }
.health-detail { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); margin-top: 0.15rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-ctrl);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn:hover {
    background: var(--asterisk24-gray-5);
    border-color: var(--asterisk24-gray-40);
    color: var(--text);
}

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

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

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.full { width: 100%; margin-top: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
input,
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font);
    margin-top: 0.35rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(38, 83, 242, 0.4);
}

input::placeholder,
textarea::placeholder {
    color: var(--asterisk24-gray-40);
}

label {
    display: block;
    margin-bottom: 0.875rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--asterisk24-gray-40);
}

.mono {
    font-family: var(--mono);
    font-size: 0.8125rem;
}

.input-row {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.input-row input { margin-top: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }

table.data-table,
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

table.data-table th,
table.table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    color: var(--asterisk24-gray-40);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

table.data-table td,
table.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--asterisk24-gray-5);
    vertical-align: middle;
    color: var(--text-secondary);
}

table.data-table tr:hover td,
table.table tr:hover td {
    background: var(--asterisk24-gray-5);
}

table.data-table tr:last-child td,
table.table tr:last-child td {
    border-bottom: none;
}

.cell-mono { font-family: var(--mono); font-size: 0.75rem; }

.cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Charts */
.chart-container { position: relative; height: 220px; }
.chart-container.tall { height: 280px; }

/* Progress / wizard */
.progress-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.4s ease;
    border-radius: 999px;
}

.step-tab {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font);
    transition: border-color 0.15s, background 0.15s;
}

.step-tab:hover { border-color: var(--accent); }

.step-tab.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.step-tab-num {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-ctrl);
    background: var(--asterisk24-gray-5);
    text-align: center;
    line-height: 24px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0.5rem;
    color: var(--text-muted);
}

.step-tab.active .step-tab-num {
    background: var(--accent);
    color: #fff;
}

/* Misc */
.hidden { display: none !important; }

.alert {
    background: var(--asterisk24-error-bg);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-ctrl);
    margin: 1rem 0;
    border: 1px solid rgba(234, 59, 61, 0.2);
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background: var(--asterisk24-ok-bg);
    color: var(--success);
    border-color: rgba(3, 152, 85, 0.2);
}

.narrow { max-width: 32rem; margin: 0 auto; }
.center { text-align: center; padding: 2rem; }

.success-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-ctrl);
    background: var(--asterisk24-ok-bg);
    color: var(--success);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.dl div {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; font-weight: 500; color: var(--text); }

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
    display: inline-block;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-ctrl);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(1rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.filter-bar .btn.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-muted);
    min-width: 8rem;
    text-align: center;
}

.pagination .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.empty-state {
    text-align: center;
    padding: 2rem 1.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--asterisk24-gray-5);
    border: 1px dashed var(--border);
    border-radius: var(--radius-ctrl);
}

.empty-state-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.55;
}

.portal-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--accent-soft);
    border: 1px solid rgba(38, 83, 242, 0.2);
    border-radius: var(--radius-ctrl);
    font-size: 0.8125rem;
    font-weight: 500;
    margin: 0.25rem 0.25rem 0.25rem 0;
    color: var(--text-secondary);
}

.setup-hero {
    text-align: center;
    margin-bottom: 1.5rem;
}

.setup-hero h1 { font-size: 1.5rem; }

.setup-hero .success-icon {
    background: var(--accent-soft);
    color: var(--accent);
}

.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-section-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.settings-section-header h2 {
    margin-bottom: 0.25rem;
}

.settings-form-actions {
    margin-top: 1rem;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.center-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.toast-error {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

.page-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

a.link-accent {
    color: var(--accent);
    text-decoration: none;
}

a.link-accent:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Probe / settings validation */
.probe-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--asterisk24-gray-5);
    color: var(--text-muted);
}

.probe-status.is-ok {
    background: var(--asterisk24-ok-bg);
    color: var(--success);
}

.probe-status.is-error {
    background: var(--asterisk24-error-bg);
    color: var(--danger);
}

.probe-status.is-loading {
    background: var(--asterisk24-info-bg);
    color: var(--accent);
}

.probe-error {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-ctrl);
    background: var(--asterisk24-error-bg);
    border: 1px solid rgba(234, 59, 61, 0.2);
    color: var(--danger);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: pre-wrap;
}

.probe-error[hidden] { display: none !important; }

.settings-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.settings-form-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Customizer editor */
.rule-editor {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.rule-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.rule-editor-head h2 { margin: 0; }

.rule-editor-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--asterisk24-gray-5);
}

.rule-section {
    padding: 1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-ctrl);
    background: var(--surface);
}

.rule-section h3 {
    margin: 0 0 0.35rem;
}

.rule-section-help {
    margin: 0 0 0.85rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.rule-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
}

.rule-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    margin: 0;
}

.rule-toggle input {
    width: auto;
    margin: 0;
}

.rule-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.field-stack > label {
    margin-bottom: 0;
}

.field-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--asterisk24-gray-40);
}

/* Refined connector UI */
:root {
    --asterisk24-primary: #3157d5;
    --asterisk24-primary-hover: #2647bb;
    --asterisk24-gray-80: #202a3b;
    --asterisk24-gray-60: #64718a;
    --asterisk24-gray-40: #8b97aa;
    --asterisk24-gray-20: #e1e6ef;
    --asterisk24-gray-5: #f4f6fa;
    --asterisk24-ok: #17865e;
    --asterisk24-ok-bg: #eaf7f0;
    --asterisk24-warn: #d49325;
    --asterisk24-warn-text: #9a6214;
    --asterisk24-warn-bg: #fff6e6;
    --asterisk24-error: #cf4b55;
    --asterisk24-error-bg: #fff0f0;
    --asterisk24-info-bg: #edf2ff;
    --bg: #f5f7fb;
    --border: #e3e8f0;
    --border-strong: #d3dbe7;
    --text: #182338;
    --text-secondary: #344158;
    --text-muted: #68758c;
    --accent: #3157d5;
    --accent-hover: #2647bb;
    --accent-soft: #edf2ff;
    --radius: 14px;
    --radius-ctrl: 9px;
    --shadow: 0 8px 28px rgba(26, 42, 72, .06);
    --shadow-lg: 0 16px 40px rgba(26, 42, 72, .16);
}

html { scroll-behavior: smooth; }

body {
    color: var(--text-secondary);
    background: #f5f7fb;
    line-height: 1.55;
}

.header {
    background: rgba(255, 255, 255, .94);
    border-bottom-color: #e6eaf1;
    box-shadow: 0 2px 10px rgba(24, 35, 56, .025);
    backdrop-filter: blur(14px);
}

.header-inner, .main { max-width: 88rem; }
.header-inner { min-height: 72px; padding-top: .75rem; padding-bottom: .75rem; }
.logo-img { height: 2.35rem; }
.nav { gap: .35rem; }
.nav a, .nav-logout-btn {
    padding: .55rem .9rem;
    border-radius: 9px;
    color: #59677f;
    font-size: .875rem;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav a:hover, .nav-logout-btn:hover { color: var(--accent); background: #f1f4fa; }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav-logout-btn.nav-muted { color: #8a95a7; }

.main { padding: 2rem 2rem 3.5rem; }
.footer { padding: 1.1rem 1.5rem; background: #fff; border-top-color: #e6eaf1; }
.footer p { color: #8a95a7; font-size: .75rem; }

h1 { color: var(--text); font-size: clamp(1.5rem, 2vw, 1.9rem); letter-spacing: -.035em; }
h2 { color: var(--text); }
.muted, .page-subtitle { color: var(--text-muted); }
.small { font-size: .8125rem; }

.btn {
    min-height: 40px;
    padding: .55rem .95rem;
    border-color: #dce3ed;
    border-radius: 9px;
    color: #344158;
    background: #fff;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(24, 35, 56, .035);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { color: var(--text); border-color: #c5cfdd; background: #fbfcfe; box-shadow: 0 3px 9px rgba(24, 35, 56, .07); }
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; border-color: var(--accent); background: var(--accent); box-shadow: 0 4px 10px rgba(49, 87, 213, .18); }
.btn-primary:hover { color: #fff; border-color: var(--accent-hover); background: var(--accent-hover); box-shadow: 0 5px 14px rgba(49, 87, 213, .23); }
.btn-ghost { box-shadow: none; }
.btn-sm { min-height: 34px; padding: .35rem .7rem; border-radius: 8px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(49, 87, 213, .24);
    outline-offset: 2px;
}

input, select, textarea {
    min-height: 42px;
    padding: .6rem .8rem;
    border-color: #dce3ed;
    border-radius: 9px;
    color: var(--text);
    background: #fff;
    font-size: .875rem;
    font-weight: 400;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(49, 87, 213, .13); }
input::placeholder, textarea::placeholder { color: #9aa5b5; }
label { margin-bottom: .9rem; color: #53617a; font-size: .8125rem; font-weight: 600; }
.mono { font-size: .8125rem; }

.card, .panel, .kpi, .health-card, .rule-editor {
    border-color: #e3e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(24, 35, 56, .025);
}
.card-pad { padding: clamp(1.15rem, 2vw, 1.75rem); }
.panel { padding: clamp(1rem, 1.7vw, 1.5rem); }
.panel-head { margin-bottom: 1.1rem; }
.section-title { font-size: .975rem; letter-spacing: -.01em; }
.panel-desc { color: #748198; font-size: .8125rem; }

.badge, .probe-status { padding: .32rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge::before { width: 7px; height: 7px; }
.health-grid { gap: .8rem; }
.health-card { min-height: 86px; padding: 1rem 1.1rem; border-left-width: 3px; }
.health-card .health-name { color: var(--text); font-size: .875rem; }
.health-card .health-detail { color: #748198; font-size: .75rem; }

.dash-hero {
    position: relative;
    overflow: hidden;
    align-items: center;
    min-height: 158px;
    padding: 1.6rem 1.8rem;
    border: 1px solid #dce5fb;
    border-radius: 18px;
    background: radial-gradient(ellipse at 85% 0%, rgba(106, 145, 255, .18), transparent 38%), linear-gradient(115deg, #fff 0%, #f8faff 72%, #f0f4ff 100%);
    box-shadow: 0 4px 18px rgba(36, 65, 130, .045);
}
.dash-hero::after {
    content: "";
    position: absolute;
    right: -55px;
    bottom: -118px;
    width: 255px;
    height: 255px;
    border: 1px solid rgba(49, 87, 213, .09);
    border-radius: 50%;
    box-shadow: 0 0 0 30px rgba(49, 87, 213, .025), 0 0 0 60px rgba(49, 87, 213, .02);
    pointer-events: none;
}
.dash-hero-text, .dash-hero .action-row { position: relative; z-index: 1; }
.eyebrow { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; color: #697994; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow .live-dot { width: 7px; height: 7px; }
.dash-hero-title-row { gap: .7rem; flex-wrap: wrap; }
.dash-hero-title { color: #1a2740; font-size: clamp(1.55rem, 2.4vw, 2rem); font-weight: 700; }
.dash-hero-sub { margin-top: .45rem; color: #64728a; font-size: .9rem; }
.dash-hero .action-row { gap: .6rem; }

.kpi-row-6 { gap: .8rem; }
.kpi {
    position: relative;
    min-width: 0;
    min-height: 124px;
    padding: 1.1rem 1.15rem;
    border-top: 0;
    transition: transform .18s ease, box-shadow .18s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(24, 35, 56, .07); }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; border-radius: 14px 0 0 14px; background: #8fa8f3; }
.kpi:nth-child(2)::before { background: #44a987; }
.kpi:nth-child(3)::before { background: #e4a83c; }
.kpi:nth-child(4)::before { background: #d96770; }
.kpi:nth-child(5)::before { background: #7787d9; }
.kpi:nth-child(6)::before { background: #4e9dc3; }
.kpi-label { color: #65738a; font-size: .75rem; font-weight: 600; }
.kpi-value { margin-top: .45rem; color: #1e2a40; font-size: 1.8rem; line-height: 1.1; letter-spacing: -.04em; }
.kpi-sub { margin-top: .45rem; overflow: hidden; color: #8792a4; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }

.chart-container { height: 240px; }
.chart-container.tall { height: 290px; }
.soft-box { min-height: 48px; border: 1px solid #e9edf4; background: #f7f9fc; color: #46546c; }
.empty-state { border-color: #e1e7f0; border-radius: 10px; background: #f8f9fc; color: #7a879a; }
.portal-chip { border-color: #e0e7f6; border-radius: 9px; background: #f1f4fb; color: #344158; }

.table-wrap { border: 1px solid #e8ecf3; border-radius: 11px; }
table.data-table, table.table { font-size: .8125rem; }
table.data-table th, table.table th { padding: .8rem .85rem; border-bottom-color: #e8ecf3; background: #f8f9fc; color: #748198; font-size: .68rem; }
table.data-table td, table.table td { padding: .78rem .85rem; border-bottom-color: #eef1f5; color: #43516a; }
table.data-table tr:hover td, table.table tr:hover td { background: #f8faff; }
.cell-mono { color: #53617a; }
.filter-bar { align-items: center; gap: .4rem; margin-bottom: 1rem; }
.filter-bar .btn.active { border-color: #d9e2fc; border-radius: 999px; background: #edf2ff; color: #3157d5; }
.pagination { margin-top: 1rem; }

.page-header { align-items: center; margin-bottom: 1.5rem; }
.page-header > div:first-child > p { margin: .35rem 0 0; }
.settings-sections { gap: 1rem; }
.settings-section-header { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom-color: #edf0f5; }
.settings-section-header h2 { margin-bottom: .3rem; font-size: 1rem; }
.settings-section-header p { max-width: 52rem; margin: 0; line-height: 1.55; }
.settings-form-actions { padding-top: .4rem; }
.probe-status { border-radius: 999px; }
.field-hint { color: #77849a; font-size: .75rem; }

#master-root { max-width: 58rem; margin: 0 auto; }
#master-root .page-header { margin-bottom: 1rem; }
#master-root .progress-row { gap: 1rem; margin: 1.5rem 0 1rem; }
#master-root .progress-bar { height: 8px; background: #e6eaf2; }
#master-root .progress-fill { background: linear-gradient(90deg, #3157d5, #6d8ef0); }
#master-root .grid-3 { gap: .7rem; }
#master-root .step-tab { min-height: 68px; border-color: #e1e7f0; border-radius: 12px; background: #fff; color: #617089; font-weight: 600; box-shadow: 0 2px 8px rgba(24, 35, 56, .025); }
#master-root .step-tab:hover { border-color: #aebff5; background: #fbfcff; }
#master-root .step-tab.active { border-color: #9bb0f1; background: #f0f4ff; color: #2949b3; }
#master-root .step-tab-num { width: 28px; height: 28px; border: 1px solid #e0e6f0; border-radius: 50%; background: #fff; line-height: 26px; }
#master-root .step-tab.active .step-tab-num { border-color: var(--accent); background: var(--accent); }
#master-root .step-panel h2 { margin-bottom: .35rem; font-size: 1.15rem; }
#master-root .step-panel > p { max-width: 48rem; line-height: 1.6; }
#master-root .step-panel .btn { margin-top: .25rem; }
#master-root code { padding: .15rem .35rem; border: 1px solid #e8ecf3; border-radius: 5px; background: #f5f7fa; color: #47556d; font-size: .85em; }

.narrow { max-width: 30rem; }
.setup-hero { margin: .75rem 0 1.5rem; }
.setup-hero .success-icon { width: 58px; height: 58px; border: 1px solid #dbe5ff; border-radius: 17px; box-shadow: 0 5px 16px rgba(49, 87, 213, .1); }
.narrow .card { padding: clamp(1.25rem, 4vw, 2rem); }
.narrow .card h2 { margin-bottom: .4rem; font-size: 1rem; }
.narrow .card > p { line-height: 1.6; }
.narrow form { margin-top: 1.25rem; }
.narrow .btn.full { min-height: 46px; margin-top: .25rem; }

.alert { border-radius: 10px; }
.toast { border-radius: 11px; }
.live-dot { box-shadow: 0 0 0 4px rgba(23, 134, 94, .1); }

@media (max-width: 1100px) {
    .kpi-row-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .main { padding: 1.25rem 1rem 2rem; }
    .header-inner { padding: .7rem 1rem; }
    .dash-hero { align-items: flex-start; flex-direction: column; padding: 1.25rem; }
    .dash-hero .action-row { width: 100%; }
    .dash-hero .action-row .btn { flex: 1; }
    .grid-2 { grid-template-columns: 1fr; }
    .kpi-row-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #master-root .grid-3 { grid-template-columns: 1fr; }
    #master-root .step-tab { min-height: 54px; }
    .page-header { align-items: flex-start; }
}

@media (max-width: 480px) {
    .logo-img { height: 1.8rem; }
    .nav { gap: .1rem; }
    .nav a, .nav-logout-btn { padding: .5rem .55rem; font-size: .8rem; }
    .kpi-row-6, .health-grid { grid-template-columns: 1fr; }
    .kpi { min-height: 108px; }
    .panel-head { flex-direction: column; }
    .panel-head > .btn, .panel-head > .input-row { width: 100%; }
    .input-row { align-items: stretch; }
    .settings-form-actions { justify-content: stretch; }
    .settings-form-actions .btn { flex: 1; }
    .dash-hero-title { font-size: 1.5rem; }
    .chart-container { height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: rgba(209, 209, 209, 0.2); }
::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 0;
}

@media (max-width: 640px) {
    .main { padding: 1rem; }
    .span-2 { grid-column: span 1; }
    .stat-value { font-size: 1.5rem; }
    .logo-img { height: 2rem; }
}

/* === Operations dashboard === */
/* --- Layout helpers --- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.row-between,
.action-row,
.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-between {
  justify-content: space-between;
}

.action-row {
  flex-wrap: wrap;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-3 {
  margin-bottom: 12px;
}

.mt-3 {
  margin-top: 12px;
}

/* --- Surfaces --- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

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

.panel-head-text {
  min-width: 0;
}

.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.soft-box {
  padding: 12px 14px;
  border-radius: var(--asterisk24-radius);
  background: var(--asterisk24-gray-5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

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

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.toggle-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.toggle-title {
  font-size: 14px;
  font-weight: 500;
}

.toggle-desc {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.toggle-row.is-disabled {
  opacity: 0.55;
}

/* --- KPI --- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.kpi-row-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  border-top: 3px solid var(--border);
}

.kpi-accent-info {
  border-top-color: var(--brand);
}

.kpi-accent-warn {
  border-top-color: var(--asterisk24-warn);
}

.kpi-accent-danger {
  border-top-color: var(--asterisk24-error);
}

.kpi-accent-ok {
  border-top-color: var(--asterisk24-ok);
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.kpi-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* --- Dashboard hero / health / charts --- */

.dash-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dash-hero-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-hero-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-hero-sub {
  margin: 6px 0 0;
  max-width: 560px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

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

.health-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-left: 3px solid var(--border);
}

.health-card.is-ok {
  border-left-color: var(--asterisk24-ok);
}

.health-card.is-error {
  border-left-color: var(--asterisk24-error);
}

.health-card.is-warn {
  border-left-color: var(--asterisk24-warn);
}

.health-card .health-name {
  font-size: 13px;
  font-weight: 600;
}

.health-card .health-detail {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.chart-box {
  position: relative;
  height: 220px;
}

.chart-box--doughnut {
  height: 240px;
  display: grid;
  place-items: center;
}

.filter-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--asterisk24-gray-5);
  border: 1px solid var(--border);
  border-radius: 10px;
}


/* --- Responsive --- */

@media (max-width: 960px) {
  .kpi-row,
  .kpi-row-5,
  .kpi-row-6,
  .grid-2,
  .master-steps,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .app-shell-layout {
    grid-template-columns: 1fr;
  }

  .menu-btn-wrap {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgb(0 0 0 / 35%);
  }

  .sidebar-backdrop.is-hidden {
    display: none;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(var(--asterisk24-sidebar-width), 88vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgb(0 0 0 / 8%);
  }
}

.dash-hero-title { font-size: 1.5rem; font-weight: 600; margin: 0; color: var(--text); }
.field-label { display:block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.health-card.is-idle { border-color: var(--border); }
.empty-state-icon { display: none; }
.portal-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 8px 0; padding: 6px 10px; background: var(--asterisk24-gray-5); border-radius: 8px; font-size: 13px; }

/* Keep the connector's tablet layout compact after legacy app-shell rules. */
@media (max-width: 960px) and (min-width: 761px) {
    .kpi-row, .kpi-row-5, .kpi-row-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .kpi-row, .kpi-row-5, .kpi-row-6, .health-grid { grid-template-columns: 1fr; }
}

.portal-chip { border: 1px solid #e0e7f6; border-radius: 9px; background: #f1f4fb; color: #344158; }

/* Navigation, setup flow, connection cards, and login screen. */
.brand-lockup { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.brand-divider { width: 1px; height: 30px; background: #e2e7ef; }
.brand-product { display: flex; flex-direction: column; gap: .1rem; min-width: 0; line-height: 1.2; }
.brand-product strong { overflow: hidden; color: #26334a; font-size: .83rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.brand-product small { color: #8591a4; font-size: .7rem; }
.nav a { display: inline-flex; align-items: center; gap: .45rem; }
.nav .icon, .nav-logout-btn .icon { width: 16px; height: 16px; }
.nav-logout-btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.footer { gap: .2rem; }
.footer-note { color: #9aa4b3; font-size: .7rem; }
.page-eyebrow { margin-bottom: .4rem; }
.page-eyebrow .icon { width: 14px; height: 14px; }

.setup-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#master-root .step-tab { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; }
#master-root .step-tab-num { flex: 0 0 28px; margin: 0; }
.step-tab-copy { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.step-tab-copy strong { color: inherit; font-size: .84rem; font-weight: 650; }
.step-tab-copy small { color: #8390a4; font-size: .71rem; font-weight: 500; }
.step-intro { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.35rem; }
.step-intro-icon, .settings-section-icon, .settings-overview-icon, .login-key-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid #e1e8f7;
    border-radius: 13px;
    background: #f3f6ff;
    color: #3157d5;
}
.step-intro-icon .icon, .settings-section-icon .icon, .settings-overview-icon .icon, .login-key-icon .icon { width: 21px; height: 21px; }
.section-kicker { display: block; margin-bottom: .24rem; color: #7d8aa0; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.step-intro h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.step-intro p { margin: 0; font-size: .84rem; }
.setup-hint { display: flex; flex-direction: column; gap: .25rem; margin: 0 0 1.3rem; padding: .85rem 1rem; border: 1px solid #e3e9f5; border-radius: 10px; background: #f7f9fd; color: #64718a; font-size: .78rem; }
.setup-hint strong { color: #344158; font-size: .8rem; }
.setup-hint code { padding: .1rem .3rem; border-radius: 4px; background: #edf1f7; }
.setup-hint-info { border-color: #dce5fb; background: #f3f6ff; }
.step-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .3rem; padding-top: 1rem; border-top: 1px solid #edf0f5; }
.action-note { color: #8792a4; font-size: .75rem; }
.progress-copy { flex: 0 0 auto; color: #718098; font-size: .78rem; font-weight: 600; }
.progress-copy strong { color: #263652; }
.progress-copy-total { color: #98a2b2; font-weight: 500; }

.settings-page-header { margin-bottom: 1.2rem; }
.settings-overview { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; padding: 1rem 1.2rem; border: 1px solid #e4e9f1; border-radius: 14px; background: linear-gradient(110deg, #fff, #f9faff); }
.settings-overview-item { display: flex; align-items: center; gap: .7rem; flex: 1; min-width: 0; }
.settings-overview-icon { width: 38px; height: 38px; border-radius: 11px; }
.settings-overview-icon .icon { width: 18px; height: 18px; }
.settings-overview-item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.settings-overview-item strong { color: #344158; font-size: .79rem; }
.settings-overview-item small { color: #8994a5; font-size: .7rem; }
.settings-overview-arrow { color: #a8b3c3; }
.settings-title-lockup { display: flex; align-items: flex-start; gap: .9rem; min-width: 0; }
.settings-title-copy { min-width: 0; }
.settings-section-icon { width: 42px; height: 42px; border-radius: 12px; }
.settings-section-icon .icon { width: 19px; height: 19px; }
.settings-section-header h2 { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.settings-tech { padding: .18rem .45rem; border: 1px solid #e7ebf3; border-radius: 6px; background: #f6f8fb; color: #6d7b92; font-size: .68rem; font-weight: 600; letter-spacing: .01em; }
.settings-save-hint { display: flex; align-items: center; gap: .4rem; margin: .2rem 0 0; color: #8290a4; font-size: .73rem; }
.settings-save-hint .icon { width: 14px; height: 14px; flex: 0 0 auto; }
.settings-form-actions { padding-top: .55rem; }

.health-section { display: flex; flex-direction: column; gap: .7rem; }
.health-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 .15rem; }
.health-section-heading .section-kicker { margin-bottom: .08rem; }
.health-section-heading h2 { margin: 0; font-size: .98rem; }
.health-refresh-note { display: inline-flex; align-items: center; gap: .45rem; color: #7d8aa0; font-size: .72rem; }
.health-refresh-note .live-dot { width: 6px; height: 6px; }
.dash-shortcuts { display: flex; align-items: center; gap: .45rem; overflow-x: auto; padding: .65rem .8rem; border: 1px solid #e4e9f1; border-radius: 11px; background: rgba(255, 255, 255, .75); scrollbar-width: none; }
.dash-shortcuts::-webkit-scrollbar { display: none; }
.dash-shortcuts > span { flex: 0 0 auto; margin: 0 .3rem 0 .1rem; color: #8994a5; font-size: .7rem; font-weight: 600; }
.dash-shortcuts a { flex: 0 0 auto; padding: .36rem .62rem; border-radius: 7px; color: #52617a; font-size: .74rem; font-weight: 600; text-decoration: none; transition: color .15s ease, background .15s ease; }
.dash-shortcuts a:hover { background: #edf2ff; color: #3157d5; }
#active-calls, #recent-calls, #outbox-events, #connector-tools, #delivery-overview { scroll-margin-top: 100px; }

.setup-hero { margin: .4rem 0 1.4rem; }
.setup-hero h1 { margin-bottom: .3rem; }
.setup-hero > p { max-width: 27rem; margin: 0 auto; }
.login-mark { position: relative; display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 1rem; border: 1px solid #dce5fb; border-radius: 20px; background: linear-gradient(145deg, #fff, #edf2ff); color: #3157d5; box-shadow: 0 8px 22px rgba(49, 87, 213, .1); }
.login-mark .icon { width: 29px; height: 29px; }
.login-mark > span { position: absolute; right: 5px; bottom: 5px; width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; background: #17865e; }
.setup-hero .page-eyebrow { justify-content: center; margin-bottom: .45rem; }
.login-error { display: flex; align-items: flex-start; gap: .55rem; }
.login-error .icon { flex: 0 0 auto; width: 17px; height: 17px; margin-top: .1rem; }
.login-card-heading { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.25rem; }
.login-key-icon { width: 42px; height: 42px; border-radius: 12px; }
.login-key-icon .icon { width: 18px; height: 18px; }
.login-card-heading h2 { margin: 0 0 .15rem; }
.login-card-heading p { margin: 0; }
.login-input-wrap { position: relative; }
.login-input-wrap > .icon { position: absolute; top: 50%; left: .8rem; width: 16px; height: 16px; color: #8995a8; transform: translateY(-50%); pointer-events: none; }
.login-input-wrap input { padding-left: 2.5rem; }
.narrow .login-input-wrap + .btn.full { margin-top: .75rem; }
.narrow .card { border-color: #e4e9f1; box-shadow: 0 12px 34px rgba(25, 43, 77, .07); }
.login-note { display: flex; align-items: flex-start; gap: .5rem; margin-top: 1.1rem; padding-top: .95rem; border-top: 1px solid #edf0f5; }
.login-note .icon { flex: 0 0 auto; width: 15px; height: 15px; margin-top: .1rem; color: #8290a4; }
.login-note p { margin: 0; color: #79869a; font-size: .74rem; line-height: 1.5; }
.login-footnote { margin: 1rem 0 0; color: #8a96a8; font-size: .73rem; text-align: center; }
.login-footnote code { padding: .12rem .35rem; border: 1px solid #e5eaf1; border-radius: 5px; background: #fff; color: #59677e; }

@media (max-width: 760px) {
    .brand-product { display: none; }
    .brand-divider { display: none; }
    .settings-overview { gap: .45rem; padding: .8rem; }
    .settings-overview-item { gap: .45rem; }
    .settings-overview-item strong { font-size: .72rem; }
    .settings-overview-arrow { font-size: .8rem; }
    .settings-section-header { align-items: flex-start; }
    .action-note { max-width: 14rem; }
}
@media (max-width: 560px) {
    .header-inner { gap: .4rem; }
    .nav { flex: 0 0 auto; flex-wrap: nowrap; gap: 0; }
    .nav a { gap: .25rem; padding: .45rem .4rem; font-size: .73rem; white-space: nowrap; }
    .nav-logout { flex: 0 0 auto; }
    .nav-logout-btn { padding: .45rem .3rem; }
    .nav .icon, .nav-logout-btn .icon { width: 14px; height: 14px; }
    .settings-overview { align-items: stretch; flex-direction: column; }
    .settings-overview-arrow { display: none; }
    .settings-overview-item { padding: .25rem 0; }
    .settings-title-lockup { gap: .65rem; }
    .settings-section-icon { width: 36px; height: 36px; }
    .settings-form-actions { flex-direction: column-reverse; }
    .settings-form-actions .btn { width: 100%; }
    .step-actions { align-items: stretch; flex-direction: column; }
    .step-actions .btn { width: 100%; }
    .action-note { max-width: none; }
    .health-section-heading { align-items: flex-start; flex-direction: column; gap: .3rem; }
    .dash-shortcuts { margin-inline: -.1rem; }
    .nav a { gap: .3rem; }
    .nav-logout-btn span { display: none; }
}

/* A quieter switchboard aesthetic: information is grouped by signal, not by decoration. */
:root {
    --bg: #f1f4f7;
    --surface: #ffffff;
    --text: #192a40;
    --text-secondary: #34465e;
    --text-muted: #728096;
    --accent: #3157c8;
    --accent-hover: #2548ad;
    --accent-soft: #edf2fc;
    --border: #dfe5ec;
    --border-strong: #cbd5e1;
    --radius: 10px;
    --radius-ctrl: 7px;
}
.eyebrow, .section-kicker { color: #6d7b91; font-size: .75rem; font-weight: 600; letter-spacing: .01em; text-transform: none; }
.dash-hero {
    align-items: center;
    min-height: 148px;
    padding: 1.6rem 1.8rem;
    border: 0;
    border-left: 4px solid #5279e4;
    border-radius: 10px;
    background: #192d47;
    box-shadow: none;
}
.dash-hero::after { content: none; }
.dash-hero .eyebrow { color: #b6c6de; }
.dash-hero-title { color: #fff; font-size: clamp(1.55rem, 2.4vw, 2rem); font-weight: 700; }
.dash-hero-sub { color: #c3cede; }
.dash-hero .badge { background: rgba(255, 255, 255, .12); color: #eef3fb; }
.dash-hero .badge-ok { background: rgba(68, 185, 128, .2); color: #91e0b6; }
.dash-hero .badge-down { background: rgba(229, 101, 110, .2); color: #ffadb2; }
.dash-hero .badge-warning, .dash-hero .badge-degraded { background: rgba(231, 173, 69, .2); color: #ffcf79; }
.dash-hero .badge-info { background: rgba(119, 157, 255, .2); color: #b9ccff; }
.dash-hero .btn { border-color: rgba(255, 255, 255, .24); background: transparent; color: #f2f5fa; box-shadow: none; }
.dash-hero .btn:hover { border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .08); }
.dash-hero .btn-primary { border-color: #6e8ff0; background: #6e8ff0; color: #fff; }
.dash-hero .btn-primary:hover { border-color: #829df2; background: #829df2; }
.dash-hero .live-dot { background: #60c69a; box-shadow: none; }

.kpi-row-6 { overflow: hidden; gap: 0; border: 1px solid #dfe5ec; border-radius: 10px; background: #fff; }
.kpi {
    min-height: 112px;
    padding: 1rem 1.1rem;
    border: 0;
    border-right: 1px solid #e9edf2;
    border-radius: 0;
    box-shadow: none;
    transition: background .15s ease;
}
.kpi:last-child { border-right: 0; }
.kpi:hover { transform: none; background: #f8faff; box-shadow: none; }
.kpi::before { inset: 0 auto 0 0; width: 2px; border-radius: 0; }
.kpi-value { color: #1e2a40; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.health-card, .panel, .card { border-radius: 10px; box-shadow: none; }
.health-card { min-height: 76px; }
.panel { border-color: #dfe5ec; }
.field-label { color: #53617a; }
.settings-overview { border-radius: 10px; background: #fff; }
.settings-overview-icon, .settings-section-icon, .step-intro-icon, .login-key-icon {
    border-color: #dfe5ec;
    border-radius: 9px;
    background: #f1f4f8;
    color: #3157c8;
}
.step-tab, #master-root .step-tab { border-radius: 9px; box-shadow: none; }
.step-tab.active, #master-root .step-tab.active { border-color: #94a9e4; background: #f1f4fb; }
.setup-hint { border-radius: 8px; background: #f5f7fa; }
.login-mark { border-radius: 16px; background: #edf2fc; box-shadow: none; }
.narrow .card { box-shadow: none; }
.dash-shortcuts { border-radius: 8px; }
.dash-shortcuts a { border-radius: 5px; }
.table-wrap { border-radius: 8px; }
.empty-state { border-radius: 8px; }

@media (max-width: 1100px) {
    .kpi-row-6 { overflow: visible; gap: .65rem; border: 0; background: transparent; }
    .kpi { border: 1px solid #dfe5ec; border-radius: 9px; background: #fff; }
    .kpi:last-child { border-right: 1px solid #dfe5ec; }
}
@media (max-width: 760px) {
    .dash-hero { border-left-width: 3px; }
    .dash-hero { align-items: flex-start; padding: 1.25rem; }
}
