:root {
    color-scheme: light;
    --ink: #202c3e;
    --muted: #647184;
    --line: #e2e6ec;
    --surface: #fff;
    --canvas: #f5f6f8;
    --sidebar-soft: #f2f4f7;
    --primary: #375d89;
    --primary-hover: #294c74;
    --primary-soft: #edf2f8;
    --danger: #a43d3d;
    --danger-soft: #fcf0ef;
    --warning: #875c1f;
    --warning-soft: #faf3e5;
    --info: #375d89;
    --info-soft: #eff4fa;
    --shadow: 0 16px 56px rgb(21 34 54 / 16%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-synthesis: none;
    font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--ink); }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, strong { font-weight: 600; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .55; }
.skip-link { position: fixed; z-index: 2000; top: -80px; left: 20px; padding: 12px 18px; color: #fff; background: var(--primary); }
.skip-link:focus { top: 12px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: #fff; padding: 28px 16px 20px; border-right: 1px solid var(--line); }
.sidebar__heading { display: flex; align-items: center; justify-content: space-between; }
.sidebar__brand, .auth-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.sidebar__brand { padding: 0 10px 32px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 36px; border: 1px solid #b5c2d1; border-radius: 4px; color: var(--primary); font-size: 22px; font-weight: 600; }
.sidebar__brand strong, .auth-brand strong { display: block; font-size: 18px; letter-spacing: .04em; }
.sidebar__brand small, .auth-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .07em; }
.nav { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 24px; scrollbar-width: thin; }
.nav__item { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 9px 12px; border-radius: 5px; color: #546174; text-decoration: none; font-size: 13px; transition: background .15s, color .15s; }
.nav__item--root { margin-bottom: 10px; font-weight: 600; }
.nav__item:hover, .nav-group__trigger:hover { background: var(--sidebar-soft); color: var(--ink); }
.nav__item.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; box-shadow: inset 2px 0 var(--primary); }
.nav-group { border: 0; }
.nav-group__trigger { display: flex; align-items: center; width: 100%; min-height: 42px; gap: 8px; padding: 9px 12px; border: 0; border-radius: 5px; font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.nav-group__trigger::-webkit-details-marker { display: none; }
.nav-group__chevron { margin-left: auto; color: #8c97a5; font-size: 18px; line-height: 1; transition: transform .15s; }
.nav-group[open] .nav-group__chevron { transform: rotate(90deg); }
.nav-group__items { display: grid; gap: 2px; padding: 2px 0 8px 12px; }
.nav-group:not([open]) > .nav-group__items { display: none; }
.nav-group__items .nav__item { min-height: 37px; padding: 7px 12px; }
.nav__item small, .nav-group__trigger small { margin-left: auto; color: var(--muted); font-size: 12px; }
.nav__item--disabled { opacity: .55; cursor: default; }
.sidebar__footer { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid var(--line); }
.current-user { padding: 0 0 14px; }
.current-user strong, .current-user small { display: block; }
.current-user strong { font-size: 13px; }
.current-user small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.workspace { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 36px; border-bottom: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; }
.topbar__location { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar__location strong { color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar__separator { color: #bac2cc; }
.topbar__hint { white-space: nowrap; }
.environment-label { flex: 0 0 auto; padding: 3px 9px; border: 1px solid #e5d9be; border-radius: 4px; background: var(--warning-soft); color: var(--warning); }
.content { max-width: 1540px; margin: 0 auto; padding: 36px 36px 64px; }
.content:focus { outline: none; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin-bottom: 8px; font-size: clamp(25px, 2.4vw, 30px); line-height: 1.35; letter-spacing: -.025em; }
.page-header p { max-width: 810px; margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .06em; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; padding: 8px 14px; border: 1px solid transparent; border-radius: 5px; font-weight: 500; font-size: 13px; line-height: 1.3; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.button--primary { color: #fff; background: var(--primary); }
.button--primary:hover:not(:disabled) { background: var(--primary-hover); }
.button--quiet { color: var(--ink); border-color: #d5dce5; background: #fff; }
.button--quiet:hover:not(:disabled) { border-color: #9eabbc; background: #f8f9fb; }
.button--danger { color: #fff; background: var(--danger); }
.button--danger:hover:not(:disabled) { background: #8a3030; }
.button--text, .button--ghost { color: var(--primary); background: transparent; }
.button--text:hover:not(:disabled), .button--ghost:hover:not(:disabled) { background: var(--primary-soft); }
.button--small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button--large { min-height: 46px; }
.button--full { width: 100%; }
.button__icon { font-size: 16px; line-height: 1; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: 23px; cursor: pointer; }
.icon-button:hover { background: var(--sidebar-soft); color: var(--ink); }
.status-chip { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.status-chip--success { color: #356448; background: #edf5ef; }
.status-chip--warning { color: var(--warning); background: var(--warning-soft); }
.status-chip--danger { color: var(--danger); background: var(--danger-soft); }
.status-chip--muted { color: #626f80; background: #f0f2f5; }
.status-chip--info { color: var(--primary); background: var(--primary-soft); }
.panel, .table-card { margin-bottom: 24px; border: 1px solid var(--line); border-radius: 7px; background: #fff; overflow: hidden; }
.panel__header, .table-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel__header h2 { margin-bottom: 3px; font-size: 17px; }
.panel__header p, .table-card__meta small { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.table-card__meta { padding: 17px 20px; }
.table-card__meta strong { font-size: 13px; }
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th { padding: 12px 18px; color: #667386; background: #f9fafb; font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
.data-table td { padding: 17px 18px; border-top: 1px solid #edf0f4; vertical-align: middle; }
.data-table tbody tr:hover { background: #fafbfd; }
.data-table td strong, .data-table td small { display: block; }
.data-table td small { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.data-table__actions { text-align: right !important; white-space: nowrap; }
.data-table--audit { min-width: 1050px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; white-space: nowrap; }
.record-title { display: block; color: var(--ink); font-weight: 600; }
.record-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.page-loading, .empty-state { padding: 58px 24px; color: var(--muted); text-align: center; font-size: 13px; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 16px; }
.empty-state--compact { padding: 26px 18px; }
.entity-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px; flex: 1 1 auto; }
.filter-field { display: grid; gap: 7px; min-width: 160px; }
.filter-field--search { min-width: min(290px, 100%); }
.filter-field > span, .inline-controls label span { color: var(--muted); font-size: 12px; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
select, input, textarea { width: 100%; border: 1px solid #cfd6e0; border-radius: 5px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
input, select { min-height: 40px; padding: 8px 11px; }
textarea { min-height: 88px; padding: 10px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #8993a2; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(55 93 137 / 10%); }
input:disabled, select:disabled, textarea:disabled { background: #f6f7f9; }
.field { display: block; min-width: 0; }
.field > span { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 500; }
.field > small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.field--sensitive { padding: 16px; border: 1px solid #e8dcbd; border-radius: 6px; background: #fcf9f1; }
.form-stack { display: flex; flex-direction: column; gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.form-grid .field--wide { grid-column: 1 / -1; }
.inline-controls { display: flex; align-items: flex-end; gap: 12px; }
.inline-controls label span { display: block; margin-bottom: 5px; }
.inline-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.choice-group { margin: 0; padding: 0; border: 0; }
.choice-group legend { font-size: 14px; font-weight: 600; }
.choice-group > p { margin: 3px 0 12px; color: var(--muted); font-size: 12px; }
.choice-card { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: #a7b9d0; background: var(--primary-soft); }
.choice-card input { width: 17px; min-height: 17px; height: 17px; margin-top: 3px; accent-color: var(--primary); }
.choice-card span, .choice-card strong, .choice-card small { display: block; }
.choice-card strong { font-size: 13px; }
.choice-card small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.allocation-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.allocation-row:first-of-type { border-top: 0; }
.allocation-row > .button { justify-self: end; }
.line-editor, .scope-editor { margin-top: 20px; border: 1px solid var(--line); border-radius: 6px; background: #f9fafb; overflow: hidden; }
.line-editor__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.line-editor__header strong, .line-editor__header small, .scope-editor__header strong, .scope-editor__header small { display: block; }
.line-editor__header strong, .scope-editor__header strong { font-size: 13px; }
.line-editor__header small, .scope-editor__header small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.line-editor__item { padding: 18px; border-top: 1px solid var(--line); background: #fff; }
.line-editor__item:first-of-type { border-top: 0; }
.line-editor__remove { display: flex; margin: 12px 0 0 auto; }
.scope-editor { padding: 16px; }
.scope-editor__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.scope-row { display: grid; grid-template-columns: 145px 1fr 36px; gap: 8px; margin-top: 8px; }
.notice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 20px; padding: 14px 16px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; }
.notice strong { flex: 0 0 auto; }
.notice--info { color: var(--primary); background: var(--info-soft); border-color: #d9e4ef; }
.notice--success { color: #356448; background: #f0f6f1; border-color: #d5e5d9; }
.notice--danger { color: var(--danger); background: var(--danger-soft); border-color: #efd5d2; }
.backup-status { justify-content: space-between; }
.backup-status div, .backup-status strong, .backup-status span { display: block; }
.backup-status div span { margin-top: 4px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.metric-card__label { display: block; color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin: 16px 0 8px; font-size: 24px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.metric-card small { color: var(--muted); font-size: 12px; }
.formula-help { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 4px; border: 1px solid #a8b4c3; border-radius: 50%; font-size: 11px; cursor: help; }
.modal-card { width: min(580px, calc(100vw - 48px)); max-height: min(860px, calc(100dvh - 48px)); margin: auto; padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.modal-card[open] { display: flex; flex-direction: column; }
.modal-card::backdrop, .connection-state::backdrop { background: rgb(25 36 53 / 40%); }
.modal-card--wide { width: min(880px, calc(100vw - 48px)); }
.modal-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 26px 20px; border-bottom: 1px solid var(--line); }
.modal-card__header h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; outline: none; }
.modal-card__header p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.modal-card__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 24px 26px; }
.modal-card__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 18px 26px; border-top: 1px solid var(--line); background: #fafbfd; }
.modal-fields { display: block; margin: 0; padding: 0; min-width: 0; border: 0; }
.dialog-open, .navigation-open { overflow: hidden; }
.detail-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.detail-summary div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; }
.detail-summary small, .detail-summary strong { display: block; }
.detail-summary small { color: var(--muted); font-size: 12px; }
.detail-summary strong { margin-top: 4px; font-size: 15px; }
.detail-section { margin-top: 20px; }
.action-list { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.confirm-strip { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px; border: 1px solid #efd5d2; border-radius: 6px; color: var(--danger); background: var(--danger-soft); font-size: 13px; }
.confirm-strip span { flex: 1 1 250px; }
.one-time-secret { padding: 16px; border: 1px solid #e8dcbd; border-radius: 6px; background: #fcf9f1; }
.one-time-secret strong, .one-time-secret small { display: block; }
.one-time-secret p { margin: 5px 0 12px; color: var(--warning); font-size: 12px; }
.one-time-secret textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.one-time-secret small { margin-top: 6px; color: var(--warning); }
.connection-state { display: none; padding: 0; width: min(430px, calc(100vw - 40px)); margin: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); box-shadow: var(--shadow); }
#components-reconnect-modal.connection-state { background-color: #fff !important; }
#components-reconnect-modal .connection-state__reload { margin: 20px 0 0 !important; color: #fff; background: var(--primary); line-height: 1.5; border-radius: 5px; }
#components-reconnect-modal .connection-state__reload:hover { background: var(--primary-hover); }
.connection-state.components-reconnect-show, .connection-state.components-reconnect-retrying, .connection-state.components-reconnect-paused, .connection-state.components-reconnect-failed, .connection-state.components-reconnect-rejected { display: block; }
.connection-state__panel { padding: 28px; }
.connection-state strong { display: block; font-size: 18px; }
.connection-state p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.connection-state .connection-state__failed { display: none; }
.connection-state .connection-state__reload { display: inline-flex; }
.connection-state.components-reconnect-failed .connection-state__connecting, .connection-state.components-reconnect-rejected .connection-state__connecting, .connection-state.components-reconnect-paused .connection-state__connecting { display: none; }
.connection-state.components-reconnect-failed .connection-state__failed, .connection-state.components-reconnect-rejected .connection-state__failed, .connection-state.components-reconnect-paused .connection-state__failed { display: block; }
.auth-shell { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; background: var(--canvas); }
.auth-brand { width: min(440px, 100%); margin-bottom: 26px; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-card { width: min(440px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.auth-card__header { margin-bottom: 28px; }
.auth-card__header h1 { margin-bottom: 10px; font-size: 28px; letter-spacing: -.025em; }
.auth-card__header p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.auth-help { display: grid; gap: 5px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; }
.auth-help span { color: var(--muted); }
.auth-back { display: block; margin-top: 20px; color: var(--primary); font-size: 13px; text-align: center; }
.auth-footnote { margin-top: 22px; color: var(--muted); font-size: 12px; }
.state-panel { display: flex; align-items: flex-start; gap: 20px; max-width: 720px; margin: 70px auto; padding: 30px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.state-panel__icon { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 6px; color: var(--info); background: var(--info-soft); font-size: 22px; }
.state-panel--danger .state-panel__icon { color: var(--danger); background: var(--danger-soft); }
.state-panel h1 { margin-bottom: 8px; font-size: 24px; }
.state-panel p { color: var(--muted); }
.workspace-label { margin-top: 8px; padding-left: 14px; border-left: 1px solid #cad3df; color: var(--muted); font-size: 12px; white-space: nowrap; }
.workspace-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin: 0 0 32px; padding: 32px; border: 1px solid #dbe2ec; border-radius: 7px; background: #edf1f6; }
.workspace-intro__heading { align-self: center; }
.workspace-intro h2 { max-width: 390px; margin: 14px 0; font-size: 26px; line-height: 1.65; letter-spacing: -.035em; }
.workspace-intro p { max-width: 400px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.workflow-steps { display: grid; gap: 18px; margin: 0; padding: 4px 0 4px 30px; border-left: 1px solid #d3dce8; list-style: none; }
.workflow-steps li { display: flex; gap: 16px; align-items: flex-start; }
.workflow-steps__number { padding-top: 2px; color: #7d90a8; font-size: 12px; font-variant-numeric: tabular-nums; }
.workflow-steps strong { display: block; margin-bottom: 4px; font-size: 14px; }
.workspace-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.workspace-links .panel__header { padding: 24px; }
.workspace-links .eyebrow { margin-bottom: 6px; }
.workspace-links h2 { margin: 0; font-size: 19px; }
.workspace-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid #edf0f4; text-decoration: none; transition: background .15s; }
.workspace-link:last-child { border-bottom: 0; }
.workspace-link:hover { background: #f7f9fc; }
.workspace-link strong { display: block; margin-bottom: 4px; font-size: 14px; }
.workspace-link p { margin: 0; color: var(--muted); font-size: 12px; }
.workspace-link > span { color: #8091a6; font-size: 18px; }
.availability-note { padding: 0 2px; }
.availability-note h2 { margin: 12px 0 8px; font-size: 16px; }
.availability-note p, .workspace-footnote { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.workspace-footnote { margin-top: 12px; }
.navigation-backdrop, .navigation-toggle, .navigation-close { display: none; }
@media (max-width: 1120px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .entity-toolbar { flex-wrap: wrap; }
    .workspace-intro { gap: 24px; padding: 26px; }
    .workspace-intro h2 { font-size: 23px; }
    .content { padding: 28px 24px 56px; }
}
@media (max-width: 820px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 100; left: 0; top: 0; width: 280px; max-width: calc(100vw - 44px); visibility: hidden; transform: translateX(-100%); padding: 22px 16px; }
    .navigation-open .sidebar { visibility: visible; transform: none; }
    .navigation-open .navigation-backdrop { display: block; position: fixed; z-index: 99; inset: 0; width: 100%; height: 100%; border: 0; background: rgb(25 36 53 / 40%); }
    .navigation-toggle, .navigation-close { display: inline-flex; }
    .navigation-close { align-self: flex-start; }
    .sidebar__brand { padding-bottom: 28px; }
    .topbar { height: 62px; padding: 0 20px; }
    .topbar__location > span, .topbar__hint { display: none; }
    .topbar__location { gap: 12px; }
    .content { padding: 26px 20px 48px; }
    .workspace-intro { grid-template-columns: 1fr; }
    .workflow-steps { padding: 20px 0 0; border-left: 0; border-top: 1px solid #d3dce8; }
    .workspace-grid { grid-template-columns: 1fr; gap: 0; }
    .workspace-intro h2 { max-width: none; }
    .workspace-label { display: none; }
    .button { min-height: 42px; }
}
@media (max-width: 560px) {
    input, select, textarea { font-size: 16px; }
    .page-header { display: block; margin-bottom: 24px; }
    .page-header > .button, .page-header > .status-chip { margin-top: 14px; }
    .metric-grid { grid-template-columns: 1fr; }
    .panel__header { align-items: flex-start; }
    .panel__header--controls { display: block; }
    .inline-controls { margin-top: 14px; flex-wrap: wrap; }
    .detail-summary { grid-template-columns: 1fr; }
    .scope-row { grid-template-columns: 1fr 36px; }
    .scope-row select { grid-column: 1 / -1; }
    .auth-card { padding: 28px 24px; }
    .notice { display: block; }
    .notice strong { display: block; margin-bottom: 4px; }
    .entity-toolbar { align-items: stretch; flex-direction: column; padding: 16px; }
    .filter-bar { display: grid; grid-template-columns: 1fr; }
    .filter-field, .filter-field--search { min-width: 0; }
    .toolbar-actions { justify-content: flex-end; flex-wrap: wrap; }
    .modal-card, .modal-card--wide { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); border-radius: 8px; }
    .modal-card__header, .modal-card__body, .modal-card__footer { padding: 20px; }
    .form-grid, .allocation-row { grid-template-columns: 1fr; }
    .form-grid .field--wide { grid-column: auto; }
    .line-editor__header, .inline-actions { align-items: stretch; flex-direction: column; }
    .table-card__meta { align-items: flex-start; gap: 8px; flex-wrap: wrap; }
    .workspace-intro { padding: 24px; }
    .workspace-intro h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
/* Profit analysis keeps figures, evidence and completeness in a restrained reading order. */
.profit-version { display: flex; align-items: end; gap: 1.5rem; margin: 0 0 1.5rem; flex-wrap: wrap; }
.profit-version .filter-field { flex: 1; min-width: 16rem; }
.profit-version p { margin: 0; font-size: .8rem; color: var(--text-muted, #637181); line-height: 1.7; }
.profit-version p span { display: block; }
.profit-metrics { grid-template-columns: 1.4fr 1fr 1fr; }
.profit-metrics .metric-card > small { display: block; margin-top: .3rem; }
.profit-unavailable { font-size: 1.4rem !important; color: #607080; }
.metric-help { border: 0; padding: 0; background: transparent; color: inherit; text-align: left; font: inherit; font-size: .8rem; cursor: pointer; }
.metric-help span { color: #7b8896; margin-left: .3rem; }
.metric-help:focus-visible { outline: 2px solid #2f5b7e; outline-offset: 5px; border-radius: 2px; }
.profit-gaps { display: grid; grid-template-columns: minmax(13rem, 1fr) 2fr; gap: 2rem; padding: 2rem 0; margin-top: 1rem; border-top: 1px solid #dfe5eb; }
.profit-gaps h2 { font-size: 1.1rem; margin: .6rem 0; }
.profit-gaps p, .profit-gaps li { color: #5d6b79; font-size: .85rem; line-height: 1.8; }
.profit-gaps ul { margin: 0; padding-left: 1.2rem; }
.profit-gaps li { margin-bottom: .55rem; }
.profit-gaps small { display: block; color: #788693; }
.profit-jobs { margin-top: 1.5rem; }
.ledger-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; padding: 1rem 1.25rem; font-size: .8rem; color: #607080; }
.ledger-detail { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: .9rem 1.5rem; margin: 0; line-height: 1.7; font-size: .875rem; }
.ledger-detail dt { color: #667584; }
.ledger-detail dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 800px) {
    .profit-metrics, .profit-gaps { grid-template-columns: 1fr; }
    .profit-gaps { gap: 1rem; }
    .ledger-detail { grid-template-columns: 1fr; gap: .3rem; }
    .ledger-detail dd { margin-bottom: .75rem; }
}

.profit-reconciliation { margin-bottom: 1.5rem; }
.reconciliation-row { display: flex; align-items: center; gap: 1.5rem; padding: 1.1rem 1.3rem; border-top: 1px solid var(--line); }
.reconciliation-row > div:first-child { flex: 1; }
.reconciliation-row strong { display: block; font-size: .86rem; font-weight: 600; }
.reconciliation-row div > span { display: block; color: var(--muted); font-size: .78rem; line-height: 1.8; }
.reconciliation-amount { text-align: right; font-variant-numeric: tabular-nums; }
.reconciliation-note { padding: .9rem 1.3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.7; }
.reconciliation-note a { margin-left: .7rem; }
@media (max-width: 640px) {
    .reconciliation-row { flex-wrap: wrap; gap: .7rem; }
    .reconciliation-row > div:first-child { flex-basis: 65%; }
    .reconciliation-amount { order: 3; flex-basis: 100%; text-align: left; }
}
