:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #e3e8ef;
  --brand: #3457d5;
  --brand-soft: #eef2ff;
  --surface: #fff;
  --background: #f5f7fb;
  --success: #087a55;
  --warning: #a6630a;
  --danger: #b4233a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); font: 15px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; }
.shell { width: min(1240px, calc(100% - 32px)); margin: 38px auto 64px; }
.topbar { display: flex; justify-content: space-between; align-items: start; gap: 24px; margin-bottom: 26px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1; letter-spacing: -.045em; margin-bottom: 12px; }
h2 { font-size: 1.25rem; margin-bottom: 0; }
h3 { margin-bottom: 8px; }
.eyebrow { color: var(--brand); font-size: .72rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 7px; }
.muted, .note, small { color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.account { display: flex; align-items: center; gap: 14px; }
.account span { display: grid; text-align: right; }
.account small { text-transform: capitalize; }
.language-form label { min-width: 118px; gap: 4px; }
.language-form select { min-height: 39px; padding: 7px 32px 7px 10px; font-size: .86rem; font-weight: 750; }
.login-language { justify-content: end; margin-bottom: 18px; }
.login-language label { color: var(--muted); font-size: .78rem; }
.nav-dropdown { position: relative; }
.nav-dropdown summary { display: inline-flex; align-items: center; gap: 8px; min-height: 39px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-weight: 850; list-style: none; cursor: pointer; }
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
.nav-dropdown[open] summary { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.nav-dropdown[open] summary::after { transform: translateY(2px) rotate(225deg); }
.nav-dropdown-menu { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; min-width: 190px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 18px 40px rgba(23, 32, 51, .16); }
.nav-dropdown-menu form { margin: 0; }
.nav-dropdown-menu a, .nav-dropdown-menu button { display: flex; align-items: center; width: 100%; min-height: 38px; padding: 8px 10px; border-radius: 8px; color: var(--ink); background: transparent; font: inherit; font-weight: 800; text-align: left; text-decoration: none; }
.nav-dropdown-menu a:hover, .nav-dropdown-menu a:focus-visible, .nav-dropdown-menu button:hover, .nav-dropdown-menu button:focus-visible { background: #f4f6fb; outline: none; }
.nav-dropdown-menu a.active { color: var(--brand); background: var(--brand-soft); }
.nav-section-label { margin: 8px 10px 3px; color: var(--muted); font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.action-card { display: flex; min-height: 118px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; flex-direction: column; }
.action-card:hover, .action-card:focus-visible { border-color: var(--brand); box-shadow: 0 8px 24px rgba(23, 32, 51, .08); outline: none; }
.action-card span { color: var(--muted); font-size: .82rem; font-weight: 800; }
.action-card strong { margin: 8px 0 auto; font-size: 1.8rem; }
.action-card small { color: var(--brand); font-weight: 800; }
.card, .result, .metric { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(33, 44, 75, .055); }
.card, .result { padding: 22px; }
.compact { max-width: 460px; margin: 12vh auto 0; }
.compact-form { max-width: 520px; }
.metric-section { margin-bottom: 22px; }
	.highlight-grid, .metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
	.compact-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.period-filter { display: grid; grid-template-columns: 1.35fr repeat(2, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 18px; padding: 16px; }
.period-filter label { font-size: .78rem; color: var(--muted); }
.period-filter button { min-height: 44px; }
.metric { padding: 18px; display: grid; gap: 3px; }
.metric.highlight { min-height: 156px; padding: 24px; border-color: #b9c7ff; background: #f8faff; gap: 8px; }
.metric.highlight strong { font-size: 2.65rem; line-height: 1; }
.metric > span { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.metric > span .info-tip { flex: 0 0 auto; }
.metric strong { font-size: 1.8rem; letter-spacing: -.04em; }
.metric.danger strong { color: var(--danger); }
.brain-health-card.status-healthy { border-top: 3px solid var(--success); }
.brain-health-card.status-watch { border-top: 3px solid var(--warning); }
.brain-health-card.status-critical { border-top: 3px solid var(--danger); }
.brain-health-card.status-insufficient_data { border-top: 3px solid var(--muted); }
.brain-evidence { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.brain-evidence li { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.brain-evidence b { font-size: .78rem; line-height: 1.3; }
.brain-evidence span { color: var(--muted); font-size: .75rem; font-weight: 650; line-height: 1.4; letter-spacing: 0; text-transform: none; }
.metric-trend { display: block; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.metric-trend.positive { color: var(--success); }
.metric-trend.negative { color: var(--danger); }
.metric-trend.neutral { color: var(--muted); font-weight: 700; }
.trend-arrow { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 6px; border-radius: 999px; color: white; font-size: .7rem; line-height: 1; vertical-align: -2px; }
.metric-trend.positive .trend-arrow { background: var(--success); }
.metric-trend.negative .trend-arrow { background: var(--danger); }
.metric-trend.neutral .trend-arrow { background: var(--muted); }
.info-tip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; padding: 0; border: 1px solid #bcc7d8; border-radius: 999px; background: #f4f6fa; color: var(--muted); font-size: .7rem; line-height: 1; vertical-align: 1px; }
.info-tip::after { content: attr(data-tip); position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 9px); width: min(250px, 70vw); padding: 9px 11px; border-radius: 8px; background: #172033; color: white; font-size: .75rem; font-weight: 500; line-height: 1.35; letter-spacing: 0; text-align: left; text-transform: none; box-shadow: 0 8px 24px rgba(23, 32, 51, .22); opacity: 0; pointer-events: none; transform: translate(-50%, 4px); transition: opacity .15s ease, transform .15s ease; }
.info-tip:hover::after, .info-tip:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.currency-switch { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 18px 0 18px; }
.currency-switch span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.currency-switch button { padding: 6px 11px; }
.currency-switch button.active { background: var(--brand); }
.currency-switch small { margin-left: 5px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.panel-wide { grid-row: span 2; }
	.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
	.compact-heading { margin-top: 20px; margin-bottom: 10px; }
.count { min-width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.item-list { display: grid; gap: 10px; }
.case-list { display: grid; gap: 14px; }
.case-item { padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.case-heading { display: flex; justify-content: space-between; gap: 18px; }
.case-heading h3 { margin: 9px 0 3px; }
.case-heading p { margin: 0; color: var(--muted); }
.case-meta { display: grid; align-content: start; justify-items: end; min-width: 180px; }
.case-actions { display: grid; grid-template-columns: auto auto minmax(150px, .8fr) minmax(220px, 1.4fr) auto; gap: 9px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.case-actions label { font-size: .75rem; color: var(--muted); }
.case-actions button { min-height: 44px; }
.candidate-evidence { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-top: 14px; }
.candidate-evidence > div { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--brand-soft); }
.candidate-evidence code { width: fit-content; padding: 2px 6px; border-radius: 6px; background: white; color: var(--brand); }
.candidate-evidence small { color: var(--muted); }
.confirmation-check { display: flex; align-items: center; gap: 8px; min-width: 230px; }
.confirmation-check input { width: auto; margin: 0; }
.work-refresh-form { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -8px 0 18px; }
.work-refresh-form p { margin: 0; }
.case-audit { margin-top: 12px; color: var(--muted); }
.case-audit summary { cursor: pointer; font-weight: 800; }
.case-audit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 10px 0 0; }
.case-audit-grid > div { display: grid; gap: 4px; }
.list-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.list-item p { color: var(--muted); margin: 3px 0; }
.distribution-chart { display: grid; gap: 8px; margin-bottom: 22px; }
.distribution-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 48px 54px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.distribution-row span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.distribution-row strong { font-size: .95rem; text-align: right; }
.distribution-row small { color: var(--muted); text-align: right; }
.distribution-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e9edf5; }
.distribution-fill { height: 100%; border-radius: inherit; background: var(--brand); }
.subtle-heading { margin-top: 14px; opacity: .82; }
.mini-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.mini-metric { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mini-metric span { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.mini-metric span .info-tip { flex: 0 0 auto; }
.mini-metric strong { color: #344054; font-size: 1.05rem; letter-spacing: 0; white-space: nowrap; }
.revenue-flow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 10px; margin-bottom: 14px; }
.revenue-flow article { display: grid; gap: 4px; padding: 14px; border: 1px solid #b9c7ff; border-radius: 12px; background: #f8faff; }
.revenue-flow article span { color: var(--brand); font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.revenue-flow article strong { font-size: 1.5rem; }
.flow-arrow { display: grid; place-items: center; color: var(--brand); font-size: 1.4rem; font-weight: 900; }
.reconciliation-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.reconciliation-detail { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px; display: grid; gap: 12px; }
.reconciliation-detail.single { grid-column: 1 / -1; }
.detail-heading { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.detail-heading h4 { margin: 0 0 2px; font-size: .95rem; }
.detail-list { display: grid; gap: 8px; }
.detail-row { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.detail-row:first-child { border-top: 0; padding-top: 0; }
.detail-row strong { font-size: .88rem; }
.detail-row p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.detail-row > strong:last-child { white-space: nowrap; text-align: right; }
.small-empty { min-height: 64px; }
.alert-dates { display: grid; gap: 2px; margin-top: 5px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-item { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 4px; }
.summary-item span { color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.summary-item strong { font-size: 2rem; letter-spacing: -.045em; }
.health-note { margin: 14px 0 0; }
.freshness-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.freshness-item { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 6px; }
.freshness-item div { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.freshness-item p { margin: 0; color: var(--muted); }
.pill.freshness-ok { color: var(--success); background: #e8f7f0; }
.pill.freshness-warning { color: var(--warning); background: #fff8e8; }
.pill.freshness-stale, .pill.freshness-failed { color: var(--danger); background: #fff0f1; }
.pill.freshness-missing { color: var(--muted); background: #eef1f5; }
.severity-critical { border-left: 4px solid var(--danger); }
.severity-warning { border-left: 4px solid var(--warning); }
.severity-info { border-left: 4px solid var(--brand); }
.empty { min-height: 110px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty p { margin: 4px 0 0; }
.section-block { margin-top: 28px; }
.section-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.section-tabs a { border: 1px solid var(--line); border-radius: 999px; color: var(--ink); padding: 8px 13px; text-decoration: none; font-weight: 800; }
.section-tabs a.active { background: var(--brand); border-color: var(--brand); color: white; }
.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 13px; }
label { display: grid; gap: 7px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cfd7e3; border-radius: 9px; padding: 11px 12px; font: inherit; background: white; }
textarea { resize: vertical; }
button { border: 0; border-radius: 9px; padding: 10px 15px; background: var(--brand); color: white; font: inherit; font-weight: 800; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.secondary { background: #e9edf5; color: var(--ink); }
.button-link { display: inline-block; border-radius: 9px; padding: 10px 15px; font-weight: 800; text-decoration: none; }
.button-link.secondary { background: #e9edf5; color: var(--ink); }
.admin-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
.checkbox-row { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.checkbox-row input { width: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { min-width: 120px; }
.password-reset-form input { min-width: 170px; }
.recovery-form { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.secret-card { border-color: #b7e4d0; background: #effbf6; }
.secret-card code { display: block; width: fit-content; margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: white; border: 1px solid #b7e4d0; font-size: 1rem; }
.banner, .alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; }
.banner.warning { color: var(--warning); background: #fff8e8; border: 1px solid #f5deb0; }
.alert.error, .error-text { color: var(--danger); background: #fff0f1; }
.alert.success { color: var(--success); background: #eaf8f2; }
.alert.info { color: var(--brand); background: var(--brand-soft); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 9px; background: #eef1f5; font-size: .75rem; font-weight: 750; }
	.pill.succeeded { color: var(--success); background: #e8f7f0; }
	.pill.failed { color: var(--danger); background: #fff0f1; }
	.pill.partial { color: var(--warning); background: #fff8e8; }
	.pill.ok { color: var(--success); background: #e8f7f0; }
	.pill.review, .pill.limited, .pill.definition_pending { color: var(--warning); background: #fff8e8; }
	.pill.missing { color: var(--danger); background: #fff0f1; }
	.pill.complete, .pill.approved, .pill.closed { color: var(--success); background: #e8f7f0; }
	.pill.in_review, .pill.pending { color: var(--warning); background: #fff8e8; }
	.pill.rejected, .pill.missing_data, .pill.not_calculable { color: var(--danger); background: #fff0f1; }
.financial-close-period { grid-template-columns: minmax(220px, 360px) auto; justify-content: start; }
.financial-close-form { margin-top: 24px; }
.close-metadata-grid, .financial-input-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.owner-input-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.system-revenue-note { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 18px; padding: 16px; border: 1px solid #b9c7ff; border-radius: 12px; background: #f8faff; }
.system-revenue-note span { font-size: 1.2rem; font-weight: 850; }
.system-revenue-note small { grid-column: 1 / -1; }
.financial-input-grid label { align-content: start; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; }
.financial-input-grid .checkbox-row { margin-top: 4px; font-size: .8rem; font-weight: 700; }
.owner-profit-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.close-calculated-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.results { margin-top: 28px; display: grid; gap: 12px; }
.result { border-left: 5px solid var(--line); }
.result.success { border-left-color: var(--success); }
.result.partial { border-left-color: var(--warning); }
.result.failure { border-left-color: var(--danger); }
.result-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
dl div { background: #f7f8fb; border-radius: 9px; padding: 11px; }
dt { color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; }
dd { margin: 4px 0 0; overflow-wrap: anywhere; }
code { font-size: .82rem; }
@media (max-width: 900px) {
	  .period-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
			  .highlight-grid, .metric-grid, .compact-metric-grid, .mini-metric-grid { grid-template-columns: repeat(2, 1fr); }
	  .reconciliation-detail-grid { grid-template-columns: 1fr; }
	  .freshness-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	  .close-metadata-grid, .financial-input-grid, .owner-profit-grid, .close-calculated-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel-wide { grid-row: auto; }
  .case-heading { display: grid; }
  .case-meta { justify-items: start; min-width: 0; }
  .case-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .action-grid { grid-template-columns: 1fr 1fr; }
  .topbar, .result-heading, .list-item, .account { align-items: stretch; display: grid; }
  .account span { text-align: left; }
  .nav-dropdown-menu { left: 1px; right: auto; width: min(78vw, 310px); max-width: calc(100vw - 32px); }
	  .info-tip::after { left: auto; right: 0; width: min(250px, calc(100vw - 48px)); transform: translate(0, 4px); }
	  .info-tip:hover::after, .info-tip:focus-visible::after { transform: translate(0, 0); }
	  .highlight-grid, .metric-grid, .mini-metric-grid, .freshness-grid, .import-grid, .admin-form, dl { grid-template-columns: 1fr; }
	  .revenue-flow { grid-template-columns: 1fr; }
	  .flow-arrow { transform: rotate(90deg); }
	  .period-filter { grid-template-columns: 1fr; }
	  .close-metadata-grid, .financial-input-grid, .owner-input-grid, .owner-profit-grid, .close-calculated-grid { grid-template-columns: 1fr; }
  .currency-switch { align-items: stretch; display: grid; justify-content: stretch; }
  .distribution-row { grid-template-columns: 54px minmax(0, 1fr) 34px 44px; gap: 7px; }
  .shell { margin-top: 22px; }
}
