/* IVR TECH workspace. Loaded after the original data component styles. */
:root {
    color-scheme: light;
    --bg: #f3f6f9;
    --surface: #fff;
    --surface-2: #f5f8fa;
    --surface-3: #eaf0f4;
    --line: #dce4eb;
    --line-soft: #e8edf2;
    --text: #182b3c;
    --muted: #607487;
    --faint: #718496;
    --cyan: #087f8c;
    --green: #18764e;
    --red: #bb3e3e;
    --amber: #9a650d;
    --violet: #7654b0;
    --blue: #366dd6;
    --radius: 12px;
    --sidebar-width: 236px;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

html { background: var(--bg); scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--cyan); }
button, input, select, textarea { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 3px solid #46b9c7;
    outline-offset: 3px;
}
[hidden] { display: none !important; }

/* App navigation */
.app-sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 28px 18px 20px;
    background: #102b40;
    color: #d9e7f0;
    border-right: 1px solid #1e3b50;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 28px;
    color: #fff;
    text-decoration: none;
}
.sidebar-brand .brand-mark, .sidebar-brand .brand-mark.small {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    background: #36b6bd;
    color: #092837;
    border-radius: 12px;
    font-size: 19px;
}
.sidebar-brand strong { display: block; font-size: 18px; letter-spacing: .04em; line-height: 1.25; }
.sidebar-brand span, .sidebar-brand small { display: block; margin-top: 4px; color: #92adbf; font-size: 11px; font-weight: 500; }
.sidebar-nav { display: grid; gap: 7px; }
.sidebar-nav a[data-view] {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #bdcfdd;
    text-decoration: none;
    font-size: 14px;
    font-weight: 550;
    line-height: 1.35;
    transition: color .15s, background .15s, border-color .15s;
}
.sidebar-nav a[data-view]:hover { color: #fff; background: #1a394f; }
.sidebar-nav a[data-view].active,
.sidebar-nav a[data-view][aria-current="page"],
.sidebar-nav a[data-view][aria-selected="true"] {
    color: #fff;
    background: #176575;
    border-color: #247d89;
}
.sidebar-nav a[data-view].active::before,
.sidebar-nav a[data-view][aria-current="page"]::before {
    content: "";
    position: absolute;
    left: -19px;
    width: 3px;
    height: 24px;
    border-radius: 0 4px 4px 0;
    background: #4ed2cf;
}
.sidebar-nav svg { width: 19px; height: 19px; flex: 0 0 19px; stroke-width: 1.7; }
.nav-icon { display: inline-grid; place-items: center; flex: 0 0 20px; font-size: 17px; color: #8ab8c4; }
.sidebar-nav .active .nav-icon { color: #b2eff0; }
.sidebar-foot { display: grid; gap: 12px; margin-top: auto; padding: 24px 10px 0; color: #8faabd; font-size: 11px; line-height: 1.6; }
.sidebar-foot p { margin: 0; }
.sidebar-foot a { color: #b7dbe6; text-decoration: none; }
.sidebar-foot form { margin: 0; }
.sidebar-foot button, .sidebar-foot .icon-button {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    text-align: left;
    border: 1px solid #365166;
    border-radius: 7px;
    background: transparent;
    color: #cbdae4;
    font-size: 12px;
}
.sidebar-foot button:hover { background: #1d3b50; color: #fff; }

/* Persistent page context and reporting period */
.app-workspace {
    width: auto;
    min-width: 0;
    margin-left: var(--sidebar-width);
    padding: 0 36px 36px;
}
.workspace-header {
    min-height: 116px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 0 23px;
}
.workspace-header > div { min-width: 0; }
.workspace-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.workspace-heading > div { min-width: 0; }
.workspace-header h1, #view-title { margin: 0; font-size: clamp(25px, 2.5vw, 32px); line-height: 1.2; font-weight: 750; letter-spacing: -.035em; }
.workspace-header p, #view-description { max-width: 780px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.workspace-header .eyebrow { margin: 0 0 7px; font-size: 10px; }
.workspace-status, .workspace-header .topbar-status { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px 16px; min-width: 150px; }
.workspace-status > span, .workspace-header #last-update { color: var(--faint); font-size: 11px; }
.workspace-header .live-pill { color: var(--green); font-size: 11px; }
.live-pill i { box-shadow: none; width: 6px; height: 6px; }
#menu-toggle { display: none; flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #32556e; font-size: 20px; }
.period-toolbar {
    position: sticky;
    z-index: 30;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 22px;
    margin: 0 0 26px;
    padding: 17px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.97);
    box-shadow: 0 4px 18px rgba(24,43,60,.035);
}
.period-main { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 20px; }
.period-title { color: var(--text); font-size: 12px; font-weight: 700; }
.period-pills, .period-toolbar .range-control {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    width: auto;
    max-width: 100%;
    padding: 3px;
    border: 1px solid #e6edf2;
    border-radius: 8px;
    background: #f3f6f8;
    overflow: visible;
}
.period-pills button[data-range], .period-toolbar .range-control button {
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.period-pills button[data-range]:hover { background: #e6eef2; color: var(--text); }
.period-pills button[data-range].active,
.period-pills button[data-range][aria-pressed="true"],
.period-toolbar .range-control button.active {
    border-color: #c5dde2;
    background: #fff;
    color: #076e7c;
    box-shadow: 0 1px 3px rgba(16,43,64,.05);
}
.period-fields, .period-toolbar .date-fields { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; width: auto; }
.period-fields label, .period-toolbar .date-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 650; }
.period-fields label span, .period-toolbar .date-fields label span { color: var(--muted); font-size: 10px; text-transform: none; }
.period-fields input, .period-toolbar .date-fields input {
    width: 141px;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #cfdce5;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    color-scheme: light;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.period-fields .primary-button, .period-toolbar .primary-button { min-height: 36px; padding: 7px 14px; font-size: 12px; }
.period-scope { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 12px; padding: 0 1px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.period-scope strong, #period-label { color: var(--text); font-size: 13px; font-weight: 650; }
#period-caption { color: var(--muted); font-size: 12px; }
.period-scope .status-badge { font-size: 10px; }
.view-stack { width: 100%; min-width: 0; }
.view-panel { min-width: 0; animation: view-arrive .17s ease-out; }
@keyframes view-arrive { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.view-panel > :first-child { margin-top: 0; }
.view-panel > .alert-grid { margin-bottom: 22px; }
.view-intro { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

/* Reusable business cards */
.section-block, .chart-panel, .table-panel, .panel {
    min-width: 0;
    margin: 0 0 22px;
    padding: 23px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 2px 7px rgba(24,43,60,.018);
}
.section-heading, .panel-heading { min-height: 0; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.section-heading h2, .panel-heading h2 { color: var(--text); font-size: 17px; line-height: 1.35; font-weight: 700; letter-spacing: -.015em; }
.panel-heading h3 { margin: 0; font-size: 15px; }
.eyebrow { color: var(--cyan); font-size: 10px; font-weight: 750; letter-spacing: .07em; }
.section-heading .eyebrow, .panel-heading .eyebrow { margin-bottom: 5px; }
.section-meta, .panel-heading > span { color: var(--muted); font-size: 11px; line-height: 1.55; }
p.section-meta { margin: -5px 0 16px; text-align: left; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.overview-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr); gap: 22px; align-items: start; }
.overview-layout > * { min-width: 0; }
.overview-layout .section-block, .overview-layout .panel { margin-bottom: 0; }
.overview-layout + * { margin-top: 22px; }
.overview-kpis, .metric-grid, .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    min-width: 0;
    margin-bottom: 22px;
}
.overview-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section-block .kpi-grid, .panel .metric-grid { margin-bottom: 20px; }
.metric-card, .kpi-card {
    min-width: 0;
    min-height: 126px;
    padding: 17px 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(24,43,60,.018);
    overflow-wrap: anywhere;
}
.metric-card { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.kpi-card::before { width: 22px; height: 3px; border-radius: 4px; margin-bottom: 10px; background: #b9cbd6; }
.metric-card > span, .metric-label, .kpi-card > span { color: var(--muted); font-size: 12px; font-weight: 550; line-height: 1.4; }
.metric-card > strong, .metric-value, .kpi-card > strong {
    display: block;
    margin: 4px 0 7px;
    color: var(--text);
    font-size: clamp(24px, 2.25vw, 32px);
    line-height: 1.15;
    letter-spacing: -.03em;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}
.metric-card small, .metric-note, .kpi-card small { display: block; color: var(--faint); font-size: 11px; line-height: 1.45; }
.metric-card.positive > strong, .metric-card.health > strong { color: var(--green); }
.metric-card.negative > strong { color: var(--red); }
.metric-card.highlight { background: #edf8f8; border-color: #c8e4e5; }
.metric-card .status-badge { align-self: flex-start; }
.cost-strip { margin-top: 0; border-color: var(--line); border-radius: 8px; background: var(--line-soft); }
.cost-part { padding: 12px 14px; background: #f8fafb; }
.cost-part span { font-size: 12px; }
.cost-part strong { font-size: 13px; }
.chart-layout, .split-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.chart-layout > *, .split-layout > * { min-width: 0; }
.chart-frame { min-height: 250px; height: 280px; }
.chart-frame canvas { max-width: 100%; }
.chart-legend { flex-wrap: wrap; gap: 8px 18px; font-size: 11px; }
.channel-grid, .operator-grid { gap: 14px; }
.channel-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.operator-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.channel-card, .operator-card {
    min-width: 0;
    padding: 19px;
    border-color: var(--line);
    border-radius: 9px;
    background: #fff;
    overflow-wrap: anywhere;
}
.channel-card h3, .operator-card h3 { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 700; }
.channel-title, .operator-title { align-items: flex-start; }
.channel-title span, .operator-title span { font-size: 10px; white-space: nowrap; }
#operations-products { margin-top: 20px; }
#operations-products p, #attribution-cards p { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.metric-row { margin-top: 18px; gap: 15px 10px; }
.metric-row span { color: var(--muted); font-size: 10px; text-transform: none; line-height: 1.4; }
.metric-row strong { font-size: 17px; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.status-badge, .health-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 5px;
    background: #edf2f5;
    color: #526c80;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.status-badge.good, .status-badge.ok, .status-badge.healthy, .health-chip.good { color: #20714d; background: #e8f5ee; }
.status-badge.warning, .status-badge.unknown, .status-badge.idle, .health-chip.idle { color: #8d621b; background: #fff3d9; }
.status-badge.error, .status-badge.firing, .status-badge.dead, .health-chip.dead { color: #aa3b3b; background: #fcecec; }
.notice, .error-banner, .quality-banner { margin: 0 0 20px; padding: 14px 17px; border: 1px solid #d4e6eb; border-radius: 9px; background: #edf6f8; color: #365d6e; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.notice strong { color: #25495a; }
.notice.warning, .quality-banner { background: #fffbef; border-color: #eae0bd; color: #80652c; }
.error-banner, .notice.error { color: #a53636; background: #fff2f2; border-color: #eecaca; }
.empty-state { padding: 30px 20px; border: 1px dashed #cddae3; border-radius: 9px; background: #f8fafb; color: var(--muted); font-size: 12px; line-height: 1.65; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--text); }
.empty-state p { margin: 6px 0 0; }
.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.section-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid #d8e4ea; border-radius: 7px; background: #f8fbfc; color: #267183; text-decoration: none; font-size: 12px; font-weight: 600; }
.section-link:hover { background: #eaf5f7; border-color: #b7d7df; }
.panel .section-link, .section-block .section-link { margin-top: 8px; }

/* Data is scrolled within its table, never by widening the workspace. */
.table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border-color: var(--line); border-radius: 8px; }
table, .data-table { width: 100%; min-width: 650px; background: #fff; border-collapse: collapse; }
th, td, .data-table th, .data-table td { padding: 12px 13px; border-bottom: 1px solid var(--line-soft); font-size: 12px; line-height: 1.45; }
th, .data-table th { background: #f5f8fa; color: #60778a; font-size: 10px; font-weight: 700; text-transform: none; letter-spacing: .01em; }
td { color: #324d62; }
th:first-child, td:first-child { color: #203c51; }
tbody tr:hover td { background: #f8fbfc; }
td:last-child { max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.data-table.compact { min-width: 440px; }
.source-details { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.source-details summary { display: list-item; color: #40667c; font-size: 12px; font-weight: 600; }
.source-details[open] summary { margin-bottom: 12px; }
.source-details p { margin: 8px 0; }
.alert-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 13px; }
.alert-card { min-width: 0; padding: 17px; border-color: var(--line); border-left-width: 3px; border-radius: 9px; overflow-wrap: anywhere; }
.alert-card > div { align-items: flex-start; flex-wrap: wrap; }
.alert-card strong { font-size: 13px; line-height: 1.5; }
.alert-card span { font-size: 10px; }
.alert-card p { margin: 10px 0 0; font-size: 12px; line-height: 1.6; }
.alert-card.firing { background: #fff8f8; }
.alert-card.ok { background: #fcfefd; }
.alert-card.unknown, .alert-card.not_configured { background: #fffdf7; }

/* Inputs and explicit operations */
.primary-button {
    min-height: 39px;
    padding: 8px 15px;
    border: 1px solid #087784;
    border-radius: 7px;
    background: #087f8c;
    color: #fff;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.4;
    white-space: normal;
}
.primary-button:hover { filter: none; background: #076c78; border-color: #076c78; }
.icon-button { width: 36px; height: 36px; border-color: var(--line); border-radius: 7px; background: #fff; color: var(--muted); }
.icon-button:hover { background: #eef4f7; border-color: #b9cdd9; color: #244b63; }
.control-form { align-items: flex-end; gap: 16px 12px; margin: 20px 0; padding: 20px; border: 1px solid var(--line-soft); border-radius: 9px; background: #f8fafb; }
.control-form label { min-width: 0; gap: 7px; color: #526e82; font-size: 11px; font-weight: 600; }
.control-form input, .control-form select, .filter-row input, .filter-row select, .sim-filters select {
    min-height: 40px;
    min-width: 0;
    max-width: 100%;
    padding: 8px 11px;
    border: 1px solid #cbd9e3;
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
    font-weight: 400;
}
.control-form input:focus, .control-form select:focus, .period-fields input:focus, .filter-row select:focus, .filter-row input:focus { outline: none; border-color: #58a9b6; box-shadow: 0 0 0 3px #dff0f3; }
.control-form #owner-lock { width: auto; height: auto; padding: 8px 13px; font-size: 12px; }
.control-reason { min-width: 240px; }
#control-result { color: #365c70; overflow-wrap: anywhere; }
.filter-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.filter-row label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.sim-filters { flex-wrap: wrap; }
.sim-filters select { min-height: 36px; font-size: 11px; }
.sim-grid { grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 10px; }
.sim-card { min-width: 0; padding: 13px; border-color: var(--line); border-radius: 8px; background: #fff; }
.sim-card-head strong, .sim-card .phone { font-size: 12px; }
.sim-card-head span, .sim-card-meta { color: var(--muted); font-size: 10px; }
.sim-card .operator { margin-top: 12px; color: var(--muted); font-size: 11px; }
.sim-card .phone { overflow-wrap: anywhere; }
.live-call-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.live-call { min-width: 0; padding: 13px; border-color: var(--line); border-radius: 8px; }
.live-call strong { font-size: 12px; }
.live-call small { font-size: 10px; }
.live-call time { font-size: 12px; }
.state-dot, .live-call.up .state-dot { box-shadow: none; }
.site-footer { margin-top: 26px; padding-top: 18px; gap: 12px; border-color: var(--line); color: var(--faint); font-size: 10px; line-height: 1.6; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .5; }
.loading .kpi-card strong { min-height: 30px; border-radius: 5px; }
.loading .channel-card, .loading .operator-card { background-color: #f7fafb; }
.economics-facts .kpi-card > strong { font-size: clamp(22px, 2vw, 29px); }
.economics-reconciliation .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.economics-reconciliation .metric-card { min-height: 110px; background: #f8fafc; box-shadow: none; }
.economics-reconciliation .unreconciled-value { color: var(--muted); font-size: 23px; }
.economics-reconciliation > p { color: var(--muted); font-size: 13px; }
.finance-missing { display: grid; gap: 7px; margin: 14px 0 0; padding-left: 19px; color: var(--muted); font-size: 13px; }
.fixed-telephony-panel { border-color: #bddce0; background: #faffff; }
.fixed-telephony-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fixed-telephony-kpis .metric-card { background: #fff; }
.fixed-telephony-kpis .metric-card > strong { font-size: clamp(22px, 2vw, 29px); }
.fixed-telephony-panel .section-meta { margin: 16px 0 0; }
/* The SMS table keeps message text readable without widening the workspace. */
.sms-log-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sms-log-filters { gap: 14px; }
.sms-log-filters label { flex: 0 1 320px; }
.sms-log-filters select { width: 100%; }
.sms-log-table { min-width: 1160px; table-layout: fixed; }
.sms-log-table th:nth-child(1) { width: 150px; }
.sms-log-table th:nth-child(2) { width: 115px; }
.sms-log-table th:nth-child(3) { width: 76px; }
.sms-log-table th:nth-child(4) { width: 300px; }
.sms-log-table th:nth-child(5) { width: 130px; }
.sms-log-table th:nth-child(6) { width: 170px; }
.sms-log-table th:nth-child(7) { width: 150px; }
.sms-log-table th:nth-child(8) { width: 80px; }
.sms-log-table td { vertical-align: top; overflow-wrap: anywhere; white-space: normal; }
.sms-log-table td.sms-log-text { white-space: pre-wrap; color: #203c51; line-height: 1.65; }
.sms-log-table td.sms-log-recipient { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sms-log-table td small { display: block; margin-top: 7px; color: var(--faint); font-size: 10px; line-height: 1.5; }
.sms-log-table .sms-log-date { font-variant-numeric: tabular-nums; }
.sms-log-muted { color: var(--muted); }
.sms-log-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.sms-log-pagination .section-meta { margin: 0; }
.sms-log-table-wrap:focus-visible { outline: 3px solid #46b9c7; outline-offset: 3px; }
#sms-log-meta { margin-bottom: 16px; }
#sms-log-panel[aria-busy="true"] .sms-log-summary strong { color: var(--muted); }
@media(max-width:820px) {
    .fixed-telephony-panel .fixed-telephony-kpis { grid-template-columns: 1fr; }
    .fixed-telephony-kpis .metric-card { min-height: 0; }
    .sms-log-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sms-log-filters label { flex: 1 1 240px; }
}
@media(max-width:560px) {
    .economics-facts .kpi-card > strong { font-size: 21px; }
    .economics-reconciliation .metric-grid { grid-template-columns: 1fr; }
    .economics-reconciliation .unreconciled-value { font-size: 23px; }
}

/* A matching, restrained sign-in page keeps the existing auth flow intact. */
.login-body { background: #edf2f6; }
.login-panel { padding: 38px; border-color: #dae3eb; background: #fff; box-shadow: 0 20px 60px rgba(18,45,65,.09); }
.login-panel .brand-mark { color: #fff; background: #087f8c; border-radius: 14px; }
.login-panel .login-kicker { margin-top: 24px; color: #087f8c; }
.login-panel h1 { color: #173448; font-size: 30px; }
.login-copy { font-size: 14px; }
.login-form label { color: #476477; }
.login-form input { color: var(--text); border-color: #cbd9e3; background: #fff; color-scheme: light; }
.login-form button { background: #087f8c; color: #fff; border-radius: 7px; font-size: 14px; }
.form-error { color: #ad3c3c; border-color: #efcaca; background: #fff3f3; }

@media (min-width: 1600px) {
    .app-workspace { padding-left: 48px; padding-right: 48px; }
    .workspace-header, .period-scope, .period-toolbar, .view-stack, .app-workspace > .site-footer { max-width: 1580px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 1320px) {
    :root { --sidebar-width: 214px; }
    .app-sidebar { padding-left: 14px; padding-right: 14px; }
    .sidebar-brand { gap: 10px; padding-left: 6px; padding-right: 6px; }
    .sidebar-brand strong { font-size: 16px; }
    .sidebar-nav a[data-view] { padding-left: 12px; padding-right: 12px; font-size: 13px; }
    .app-workspace { padding-left: 24px; padding-right: 24px; }
    .overview-layout { grid-template-columns: 1fr; }
    .overview-kpis { gap: 12px; }
    .period-toolbar { align-items: flex-start; gap: 12px; }
    .metric-card, .kpi-card { padding: 16px; }
    .metric-card > strong, .metric-value, .kpi-card > strong { font-size: 28px; }
}
@media (max-width: 1080px) {
    :root { --sidebar-width: 236px; }
    .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 15px 0 40px rgba(15,42,62,.15); }
    body.sidebar-open { overflow: hidden; }
    .app-workspace { margin-left: 0; padding-left: 24px; padding-right: 24px; }
    #menu-toggle { display: inline-grid; place-items: center; }
    .workspace-header { justify-content: flex-start; gap: 14px; min-height: 107px; }
    .workspace-header > :last-child { margin-left: auto; }
    .workspace-header > div:first-of-type { flex: 1; }
    .sidebar-open .app-sidebar, .app-sidebar.is-open, .app-sidebar.open, body:has(#menu-toggle[aria-expanded="true"]) .app-sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; z-index: 45; inset: 0; border: 0; background: rgba(9,29,44,.45); backdrop-filter: blur(2px); }
    .sidebar-open::before { content: ""; position: fixed; z-index: 45; inset: 0; background: rgba(9,29,44,.4); }
    .sidebar-open:has(.sidebar-backdrop)::before { content: none; }
    .chart-layout, .split-layout { grid-template-columns: 1fr 1fr; gap: 18px; }
    .sidebar-brand { padding-left: 10px; }
    .sidebar-brand strong { font-size: 18px; }
    .sidebar-nav a[data-view] { font-size: 14px; }
}
@media (max-width: 820px) {
    .workspace-header { align-items: flex-start; padding-top: 24px; min-height: 105px; }
    .workspace-heading { align-items: flex-start; }
    .workspace-header .topbar-status, .workspace-status { min-width: 0; max-width: 150px; gap: 6px; }
    .workspace-header #last-update { display: none; }
    .workspace-header h1, #view-title { font-size: 26px; }
    .workspace-header p, #view-description { font-size: 12px; }
    .period-toolbar { padding: 15px; gap: 12px; margin-bottom: 22px; }
    .period-main { width: 100%; }
    .period-fields, .period-toolbar .date-fields { width: 100%; }
    .period-fields label, .period-toolbar .date-fields label { flex: 1; }
    .period-fields input, .period-toolbar .date-fields input { width: 100%; }
    .period-fields .primary-button, .period-toolbar .date-fields .primary-button { grid-column: auto; }
    .overview-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-layout, .split-layout { grid-template-columns: 1fr; gap: 0; }
    .section-block, .chart-panel, .table-panel, .panel { padding: 20px; }
    .overview-layout { gap: 18px; }
    .chart-frame { min-height: 240px; height: 260px; }
    .cost-strip { grid-template-columns: 1fr; }
    .sim-heading { flex-direction: column; align-items: flex-start; }
    .sim-filters { width: 100%; }
    .sim-filters select { flex: 1; width: auto; }
}
@media (max-width: 560px) {
    .app-workspace { padding: 0 14px 25px; }
    .workspace-header { align-items: flex-start; gap: 10px; padding: 21px 0 19px; }
    .workspace-heading { gap: 10px; }
    .workspace-header h1, #view-title { font-size: 24px; }
    .workspace-header p, #view-description { margin-top: 6px; font-size: 12px; line-height: 1.55; }
    .workspace-header .topbar-status, .workspace-status { display: none; }
    #menu-toggle { flex-basis: 35px; width: 35px; height: 35px; margin-top: -1px; }
    .period-toolbar { gap: 12px; padding: 13px; border-radius: 10px; margin-bottom: 18px; }
    .period-main { gap: 10px; }
    .period-title { flex: 1 0 100%; }
    .period-pills, .period-toolbar .range-control { gap: 2px; padding: 2px; width: 100%; justify-content: space-between; }
    .period-pills button[data-range], .period-toolbar .range-control button { flex: 1 1 auto; min-height: 34px; padding: 5px 7px; font-size: 12px; }
    .period-fields, .period-toolbar .date-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 7px; align-items: end; }
    .period-fields input, .period-toolbar .date-fields input { min-width: 0; padding: 6px; font-size: 12px; }
    .period-fields .primary-button, .period-toolbar .date-fields .primary-button { padding: 7px 9px; font-size: 12px; }
    .period-scope { gap: 8px 10px; margin-bottom: 12px; padding: 0 1px; }
    .period-scope strong, #period-label { font-size: 12px; }
    #period-caption { flex-basis: 100%; font-size: 12px; }
    .section-block, .chart-panel, .table-panel, .panel { padding: 17px; margin-bottom: 18px; border-radius: 10px; }
    .section-heading, .panel-heading { gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
    .section-heading h2, .panel-heading h2 { font-size: 16px; }
    .section-heading .primary-button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
    .section-heading .section-meta, .panel-heading > span { text-align: left; font-size: 10px; }
    .eyebrow { font-size: 9px; }
    .overview-kpis, .metric-grid, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
    .metric-card, .kpi-card { min-height: 124px; padding: 14px 12px; border-radius: 9px; }
    .metric-card > span, .metric-label, .kpi-card > span { font-size: 12px; }
    .metric-card > strong, .metric-value, .kpi-card > strong { font-size: 22px; overflow-wrap: normal; word-break: normal; letter-spacing: -.035em; }
    .metric-card small, .metric-note, .kpi-card small { font-size: 10px; line-height: 1.5; }
    .channel-grid, .operator-grid, .alert-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; }
    .channel-card, .operator-card { padding: 16px; }
    .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-frame { min-height: 225px; height: 240px; }
    .chart-legend { font-size: 10px; }
    .control-form { gap: 14px; padding: 15px; }
    .control-form label { flex: 1 1 100%; width: 100%; }
    .control-form input, .control-form select { width: 100%; }
    .control-form .primary-button, .control-form #owner-lock { flex: 1 1 100%; width: 100%; }
    .control-reason { min-width: 0; }
    .filter-row { align-items: stretch; gap: 10px; }
    .filter-row label { flex: 1 1 100%; }
    .sim-filters { gap: 8px; }
    .sim-filters select { flex: 1 1 100%; width: 100%; }
    .sim-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .sim-card { padding: 11px; }
    .sim-card-head { gap: 5px; flex-wrap: wrap; }
    .site-footer { flex-direction: column; margin-top: 20px; }
    .notice, .quality-banner, .error-banner { padding: 12px 14px; font-size: 12px; }
    .login-panel { padding: 29px 24px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Existing server income, known costs and known contribution; no accounting logic. */
.economics-summary, .economics-details, .overview-financials, .overview-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.economics-summary .kpi-card > span { min-height: 2.5em; }
.economics-summary .kpi-card strong { overflow-wrap: anywhere; }
@media (max-width: 700px) {
    .economics-summary, .overview-financials { grid-template-columns: 1fr; }
    .economics-summary .kpi-card > span { min-height: 0; }
    .economics-details, .overview-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
