:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #16202a;
  --muted: #66717d;
  --line: #dfe4e8;
  --accent: #0b63ce;
  --accent-dark: #084b9b;
  --teal: #0a7c74;
  --danger: #b42318;
  --warning-bg: #fff6d8;
  --warning-ink: #6d5200;
  --shadow: 0 12px 35px rgba(30, 48, 68, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #111d29; color: white; padding: 28px 18px; display: flex; flex-direction: column; overflow: hidden; transition: opacity .16s ease, transform .2s ease; }
.sidebar-toggle { position: fixed; z-index: 50; top: 24px; left: 211px; width: 38px; height: 38px; padding: 0; border: 1px solid #314151; border-radius: 50%; background: #172738; color: white; box-shadow: 0 8px 24px rgba(13,29,43,.22); display: grid; place-items: center; cursor: pointer; transition: left .2s ease, background .15s ease; }
.sidebar-toggle:hover { background: #21384e; }
.sidebar-toggle:focus-visible { outline: 3px solid rgba(33,133,248,.35); outline-offset: 2px; }
.sidebar-toggle-arrow { width: 9px; height: 9px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(-135deg); transition: transform .2s ease; }
.app-shell.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar-collapsed .sidebar { opacity: 0; transform: translateX(-100%); pointer-events: none; }
.sidebar-collapsed .sidebar-toggle { left: 12px; }
.sidebar-collapsed .sidebar-toggle-arrow { transform: rotate(45deg); }
.sidebar-collapsed .main-content { padding-left: 64px; padding-right: 28px; }
.sidebar-collapsed .analytics-table table { min-width: 1480px; }
.sidebar-collapsed .analytics-table th, .sidebar-collapsed .analytics-table td { padding-left: 10px; padding-right: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2185f8, #06a89d); color: white; }
.nav-list { margin-top: 34px; display: grid; gap: 7px; }
.nav-list a { color: #b9c5d1; padding: 11px 12px; border-radius: 9px; font-size: 14px; }
.nav-list a:hover, .nav-list a.active, .nav-group summary:hover, .nav-group summary.active { color: white; background: rgba(255,255,255,.09); text-decoration: none; }
.nav-group { min-width: 0; }
.nav-group summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #b9c5d1; padding: 11px 12px; border-radius: 9px; font-size: 14px; cursor: pointer; list-style: none; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group-arrow { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .16s ease; }
.nav-group[open] .nav-group-arrow { transform: rotate(225deg) translate(-2px, -2px); }
.nav-submenu { display: grid; gap: 4px; margin: 5px 0 2px 11px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.14); }
.nav-submenu a { padding: 9px 10px; font-size: 13px; line-height: 1.3; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 18px 12px 0; }
.user-name { font-weight: 650; margin-bottom: 6px; }
.link-button { border: 0; background: none; color: #aebbc8; padding: 0; cursor: pointer; }
.main-content { min-width: 0; padding: 38px 44px 64px; }
.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.page-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
h1, h2 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(28px, 3vw, 42px); }
h2 { font-size: 21px; }
.eyebrow { margin: 0 0 8px; color: var(--teal); text-transform: uppercase; font-size: 11px; letter-spacing: .13em; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.section-gap { margin-top: 22px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 10px; min-height: 42px; padding: 0 17px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.button:hover { text-decoration: none; }
.button.primary { color: white; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: white; background: var(--teal); }
.button.ghost { color: var(--ink); border-color: var(--line); background: white; }
.button.full { width: 100%; }
.button:disabled { opacity: .58; cursor: not-allowed; }
.form-panel { max-width: 680px; }
.stack-form { display: grid; gap: 17px; }
.stack-form label, .filters label { display: grid; gap: 7px; color: #33404c; font-size: 13px; font-weight: 700; }
.form-control, .stack-form input, .stack-form select, .stack-form textarea, .login-card input { width: 100%; min-height: 43px; border: 1px solid #cdd5dc; border-radius: 9px; background: white; padding: 9px 11px; color: var(--ink); font: inherit; }
.form-control:focus, input:focus, select:focus { outline: 3px solid rgba(11,99,206,.14); border-color: var(--accent); }
.field-help { color: var(--muted); font-weight: 400; line-height: 1.45; }
.field-error { color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 5px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: #65717d; background: var(--surface-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
tbody tr:hover { background: #e8eef4; }
tfoot td { font-weight: 800; background: #f0f5f9; border-top: 2px solid #ccd8e1; }
.profit-value { font-weight: 800; }
.profit-value.positive { color: #08745f; }
.profit-value.negative { color: var(--danger); }
.profit-value.neutral { color: var(--ink); }
code { background: #eef2f5; border-radius: 6px; padding: 3px 6px; }
.status { display: inline-block; border-radius: 999px; padding: 5px 9px; background: #e9eef2; color: #53616f; font-size: 11px; font-weight: 800; }
.status.ready, .status.succeeded { background: #dff6ed; color: #08745f; }
.status.error, .status.failed { background: #fde7e5; color: var(--danger); }
.status.running { background: #e1eeff; color: #0a5ab4; }
.status.disabled { background: #eceff1; color: #66717d; }
.message { padding: 13px 15px; border-radius: 10px; background: #e2f1ff; color: #0b518e; margin-bottom: 15px; }
.message.success { background: #dff6ed; color: #08745f; }
.message.error { background: #fde7e5; color: var(--danger); }
.mock-banner { border: 1px solid #f0d36b; background: var(--warning-bg); color: var(--warning-ink); border-radius: 12px; padding: 13px 16px; margin-bottom: 20px; }
.real-banner { border: 1px solid #ffccc7; background: #fff1f0; color: #7a1f1a; border-radius: 12px; padding: 13px 16px; margin-bottom: 20px; }
.actions-cell form { display: inline; margin-left: 12px; }
.danger-link { color: var(--danger); }
.restore-link { color: #08745f; }
.archived-account-row { background: #f7f8fa; color: #687582; }
.archived-account-row:hover { background: #f1f3f5; }
.account-option.archived { color: var(--muted); }
.archived-account-mark { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: #eceff1; color: #66717d; font-size: 10px; font-weight: 700; }
.compact-panel { max-width: 760px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.filters { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.filters label { min-width: 160px; }
.account-filter { min-width: 280px; display: grid; gap: 7px; color: #33404c; font-size: 13px; font-weight: 700; }
.filters .account-filter { flex: 1 1 300px; max-width: 420px; }
.filter-label { display: block; }
.account-picker { position: relative; }
.account-picker summary { min-height: 43px; border: 1px solid #cdd5dc; border-radius: 9px; background: white; padding: 9px 38px 9px 12px; display: flex; align-items: center; cursor: pointer; list-style: none; color: var(--ink); font-weight: 500; }
.account-picker summary::-webkit-details-marker { display: none; }
.account-picker summary:focus { outline: 3px solid rgba(11,99,206,.14); border-color: var(--accent); }
.account-picker-arrow { position: absolute; right: 14px; width: 8px; height: 8px; border-right: 2px solid #66717d; border-bottom: 2px solid #66717d; transform: rotate(45deg) translateY(-2px); transition: transform .16s ease; }
.account-picker[open] .account-picker-arrow { transform: rotate(225deg) translate(-2px, -2px); }
.account-options { position: absolute; z-index: 20; top: calc(100% + 7px); left: 0; right: 0; max-height: 270px; overflow: auto; padding: 8px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 45px rgba(30,48,68,.16); }
.account-options-actions { display: flex; justify-content: space-between; gap: 8px; padding: 3px 5px 8px; margin-bottom: 3px; border-bottom: 1px solid var(--line); }
.account-options-actions button { border: 0; background: none; color: var(--accent); padding: 4px; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.filters .account-option, .stack-form .account-option { min-width: 0; display: flex; grid-template-columns: none; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; }
.account-option:hover { background: var(--surface-soft); }
.account-option input, .stack-form .account-option input { appearance: none; flex: 0 0 17px; width: 17px; height: 17px; min-height: 17px; margin: 0; padding: 0; border: 1.5px solid #aab5bf; border-radius: 4px; background: white; display: grid; place-content: center; cursor: pointer; }
.account-option input::before { content: ""; width: 9px; height: 5px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg) scale(0); transition: transform .1s ease; }
.account-option input:checked { border-color: var(--accent); background: var(--accent); }
.account-option input:checked::before { transform: rotate(-45deg) scale(1); }
.account-option input:focus-visible { outline: 3px solid rgba(11,99,206,.18); outline-offset: 2px; }
.sync-history-panel { max-width: 920px; }
.sync-history-panel h2 { margin-bottom: 8px; }
.sync-history-panel > .small { margin: 0 0 20px; }
.history-account-filter { width: 100%; }
.history-period-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.history-coverage { min-width: 230px; }
.subscription-cell { min-width: 190px; }
.subscription-date-trigger { border: 0; background: none; padding: 3px 0; color: var(--ink); font: inherit; font-weight: 750; cursor: pointer; border-bottom: 1px dashed #8b98a4; }
.subscription-date-trigger:hover { color: var(--accent); }
.subscription-date-trigger.expiring { color: var(--danger); }
.subscription-date-trigger.muted { color: var(--muted); font-weight: 600; }
.subscription-entry { display: flex; align-items: center; gap: 6px; }
.subscription-entry[hidden] { display: none; }
.subscription-entry input { width: 72px; min-height: 32px; padding: 5px 7px; border: 1px solid #cdd5dc; border-radius: 7px; font: inherit; }
.subscription-cell .link-button { color: var(--accent); font-weight: 700; }
.subscription-cell .link-button:disabled { color: #9aa5af; cursor: not-allowed; }
.review-summary { position: relative; display: inline-block; outline: none; }
.review-count { cursor: help; border-bottom: 1px dashed #8b98a4; }
.review-tooltip { position: fixed; z-index: 1000; left: 0; top: 0; min-width: 190px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #172738; color: white; box-shadow: 0 12px 30px rgba(18, 34, 50, .24); opacity: 0; visibility: hidden; transform: translate(-50%, 4px); transition: opacity .14s ease, transform .14s ease, visibility .14s ease; pointer-events: none; }
.review-tooltip::after { content: ""; position: absolute; left: 50%; top: 100%; width: 9px; height: 9px; background: #172738; transform: translate(-50%, -5px) rotate(45deg); }
.review-tooltip div { display: flex; justify-content: space-between; gap: 18px; }
.review-tooltip div + div { margin-top: 5px; }
.review-tooltip .muted { color: #c1ccd6; white-space: normal; }
.review-summary:hover .review-tooltip, .review-summary:focus .review-tooltip, .review-summary:focus-within .review-tooltip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.history-warning { color: #986b00; margin-top: 3px; }
.status.history-attention { background: #fff0c2; color: #765700; }
.direction-badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #e7f0ff; color: #0a5ab4; }
.direction-badge.rk_lm { background: #e1f5f1; color: #08745f; }
.direction-badge.kc_sanya { background: #fff0d9; color: #92530b; }
.direction-badge.kc { background: #f0e8ff; color: #6941a5; }
.category-item-count { margin-top: 4px; font-weight: 400; }
.review-statistics-table { min-width: 760px; }
.review-statistics-table th, .review-statistics-table td { text-align: center; }
.review-statistics-table th:first-child, .review-statistics-table td:first-child { text-align: left; }
.period-hint { margin: 12px 0 0; }
.crm-source-form { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(180px, .55fr) auto; gap: 14px; align-items: end; margin: 20px 0; }
.crm-source-form label { display: grid; gap: 7px; color: #33404c; font-size: 13px; font-weight: 700; }
.crm-source-form.editing { padding: 14px; border: 1px solid rgba(11,99,206,.35); border-radius: 11px; background: #f7fbff; }
.crm-source-form-actions, .crm-source-actions-inner { display: flex; align-items: center; gap: 10px; }
.crm-source-table-wrap { border: 1px solid var(--line); border-radius: 11px; }
.crm-source-table-wrap tbody tr:last-child td { border-bottom: 0; }
.crm-source-actions { width: 135px; text-align: right; }
.crm-source-actions-inner { justify-content: flex-end; }
.crm-source-actions form { display: inline-flex; margin: 0; }
.analytics-table table { min-width: 1650px; }
.pulse-filters .account-filter { max-width: 440px; }
.pulse-action-filter { min-width: 250px !important; }
.pulse-export-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.pulse-export-row p { margin: 5px 0 0; }
.pulse-export-form { justify-content: flex-end; flex: 1 1 560px; }
.pulse-export-form .account-filter { flex: 1 1 300px; max-width: 420px; }
.pulse-account-panel { padding: 0; overflow: hidden; }
.pulse-account-heading { padding: 22px 24px 18px; margin: 0; background: #edf3f8; border-bottom: 1px solid #cfd8e0; }
.pulse-scan-meta { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.pulse-note { margin: 14px 24px 0; }
.pulse-account-panel > .message { margin: 16px 24px 0; }
.pulse-table-wrap { overflow-x: auto; }
.pulse-table { min-width: 960px; }
.pulse-table th, .pulse-table td { padding: 13px 16px; }
.pulse-table th:nth-child(1) { width: 24%; }
.pulse-table th:nth-child(2) { width: 19%; }
.pulse-table th:nth-child(3) { width: 24%; }
.pulse-table th:nth-child(4) { width: 19%; }
.pulse-sheet { display: block; margin-top: 3px; }
.pulse-action { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.pulse-action.delete { color: #8f1d16; background: #fde7e5; }
.pulse-action.restore_old { color: #735700; background: #fff0c2; }
.pulse-action.restore_removed { color: #6941a5; background: #f0e8ff; }
.pulse-action.create_new { color: #0a5ab4; background: #e1eeff; }
.pulse-item-links { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pulse-item-links a, .pulse-item-links span { white-space: nowrap; }
.pulse-account-summary { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 13px 24px; border-top: 1px solid var(--line); background: #f8fafc; color: var(--muted); font-size: 12px; }
.repair-table table { min-width: 1370px; }
.call-center-table table { min-width: 1480px; }
.balance-month-filter { max-width: 560px; }
.balance-summary-filter { max-width: 720px; }
.balance-summary-stack { display: grid; gap: 22px; }
.balance-summary-card { min-width: 0; padding: 0; overflow: hidden; }
.balance-summary-title { padding: 18px 24px 16px; text-align: center; background: #edf3f8; border-bottom: 1px solid #cfd8e0; }
.balance-summary-title .eyebrow { margin-bottom: 5px; }
.balance-summary-table { text-align: center; }
.balance-summary-table th, .balance-summary-table td { text-align: center; padding: 15px 14px; }
.balance-summary-table th { color: var(--ink); font-size: 12px; letter-spacing: 0; text-transform: none; }
.balance-summary-table tbody tr:hover { background: transparent; }
.lm-summary-table { min-width: 1080px; }
.repair-summary-table { min-width: 790px; }
.call-center-summary-table { min-width: 890px; }
.compact-summary-card { max-width: 1100px; }
.balance-summary-note { margin: 0; padding: 12px 24px 16px; border-top: 1px solid var(--line); }
.cash-overview-panel { min-width: 0; padding: 0; overflow: hidden; }
.cash-overview-table { min-width: 720px; text-align: center; }
.cash-overview-table th, .cash-overview-table td { text-align: center; padding: 17px 16px; }
.cash-overview-table th { color: var(--ink); font-size: 12px; letter-spacing: 0; text-transform: none; }
.cash-overview-table tbody tr:hover { background: transparent; }
.cash-month-filter { max-width: 420px; }
.cash-primary-grid { display: grid; grid-template-columns: minmax(620px, 1.25fr) minmax(410px, .75fr); gap: 22px; align-items: start; }
.cash-left-stack { display: grid; gap: 22px; min-width: 0; align-content: start; }
.kc-debt-stack { display: grid; gap: 22px; min-width: 0; }
.kc-debt-entry-panel.editing { border-color: rgba(11,99,206,.45); box-shadow: 0 0 0 3px rgba(11,99,206,.08), var(--shadow); }
.kc-debt-entry-panel .panel-heading { margin-bottom: 8px; }
.kc-debt-summary-table { min-width: 390px; text-align: center; }
.kc-debt-summary-table th, .kc-debt-summary-table td { text-align: center; padding: 16px 12px; }
.kc-debt-summary-table th { color: var(--ink); font-size: 12px; letter-spacing: 0; text-transform: none; }
.cash-inline-entry { padding: 18px 20px; border-bottom: 1px solid var(--line); transition: height .24s ease; }
.cash-add-trigger { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 8px 0 14px; border: 1px dashed #aebbc6; border-radius: 9px; background: white; color: var(--muted); font: inherit; cursor: pointer; }
.cash-add-trigger:hover { border-color: var(--accent); color: var(--accent); background: #f7fbff; }
.cash-add-plus { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: white; font-size: 22px; line-height: 1; }
.cash-inline-form { display: grid; grid-template-columns: minmax(180px, 1.25fr) minmax(145px, .7fr) minmax(150px, .75fr) auto; gap: 12px; align-items: end; }
.cash-inline-form[hidden] { display: none; }
.cash-inline-form label { display: grid; gap: 6px; min-width: 0; color: #33404c; font-size: 12px; font-weight: 700; }
.cash-inline-form input { width: 100%; min-height: 38px; border: 1px solid #cdd5dc; border-radius: 8px; padding: 7px 9px; color: var(--ink); font: inherit; }
.cash-inline-actions { display: flex; align-items: center; gap: 7px; }
.cash-editable-table { min-width: 720px; }
.cash-editable-table .expense-history-actions { min-width: 125px; }
.kc-debt-history-table { min-width: 460px; }
.cash-ledger-stack { display: grid; gap: 22px; max-width: 920px; }
.cash-ledger-card { min-width: 0; padding: 0; overflow: hidden; }
.cash-ledger-title { padding: 17px 22px; text-align: center; background: #edf3f8; border-bottom: 1px solid #cfd8e0; }
.cash-ledger-table { min-width: 620px; }
.cash-ledger-table th, .cash-ledger-table td { text-align: center; }
.cash-ledger-table td:first-child { text-align: left; white-space: normal; }
.cash-ledger-table tfoot td:first-child { text-align: left; }
.cash-ledger-table.cash-purpose-centered th:first-child, .cash-ledger-table.cash-purpose-centered td:first-child, .cash-ledger-table.cash-purpose-centered tfoot td:first-child { text-align: center; }
.cash-ledger-table.kc-debt-history-table th:first-child, .cash-ledger-table.kc-debt-history-table td:first-child, .cash-ledger-table.kc-debt-history-table tfoot td:first-child { text-align: center; }
.cash-empty-row { padding: 26px 14px; text-align: center !important; }
.account-expense-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(650px, 100%), 1fr)); gap: 20px; align-items: start; }
.account-expense-card { min-width: 0; border: 1px solid #cfd8e0; border-radius: 12px; overflow: hidden; background: white; }
.account-expense-title { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 14px; background: #edf3f8; border-bottom: 1px solid #cfd8e0; text-align: center; }
.expense-month-table { min-width: 650px; font-size: 12px; }
.expense-month-table th { text-align: center; color: var(--ink); background: #f8fafc; letter-spacing: 0; text-transform: none; font-size: 12px; }
.expense-month-table th, .expense-month-table td { padding: 7px 9px; text-align: center; }
.expense-month-table td:first-child, .expense-month-table th:first-child { text-align: left; }
.expense-month-table tfoot td { border-top: 2px solid #aebbc6; }
.compact-empty { padding: 22px 12px; }
.expense-input-layout { display: grid; grid-template-columns: minmax(430px, .82fr) minmax(620px, 1.18fr); gap: 22px; align-items: start; }
.expense-input-stack { display: grid; gap: 22px; min-width: 0; }
.expense-input-panel .panel-heading { margin-bottom: 8px; }
.expense-input-panel.editing { border-color: rgba(11,99,206,.45); box-shadow: 0 0 0 3px rgba(11,99,206,.08), var(--shadow); }
.compact-button { min-height: 34px; padding: 0 12px; font-size: 12px; }
.expense-history-panel { position: sticky; top: 24px; min-width: 0; }
.expense-history-panel .panel-heading { margin-bottom: 12px; }
.history-count { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px; border-radius: 999px; background: #edf3f8; color: #4d5d6c; font-size: 12px; font-weight: 800; }
.expense-history-scroll { max-height: calc(100vh - 190px); border: 1px solid var(--line); border-radius: 11px; }
.expense-history-table { min-width: 680px; }
.expense-history-table thead { position: sticky; z-index: 2; top: 0; }
.expense-history-table th, .expense-history-table td { padding: 11px 12px; }
.expense-history-table tbody tr:last-child td { border-bottom: 0; }
.expense-history-table .history-description { min-width: 170px; max-width: 310px; white-space: normal; line-height: 1.35; }
.expense-history-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.expense-history-actions form { display: inline-flex; margin: 0; }
.expense-delete-button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--danger); cursor: pointer; }
.expense-delete-button:hover { background: #fde7e5; }
.expense-delete-button:focus-visible { outline: 3px solid rgba(180,35,24,.18); outline-offset: 1px; }
.expense-delete-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.history-row-editing { background: #e7f0ff; }
.history-row-editing:hover { background: #dce9fb; }
.expense-type { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #e7f0ff; color: #0a5ab4; font-size: 10px; font-weight: 800; }
.expense-type.other_expense { background: #fff0dc; color: #8a4b08; }
.expense-type.compensation { background: #dff6ed; color: #08745f; }
.expense-type.withdrawal { background: #f0e8ff; color: #6941a5; }
.empty-history { padding: 28px 12px; text-align: center; }
.searchable-account-control { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(240px, 1.2fr); gap: 10px; }
.repair-manual-grid { display: grid; grid-template-columns: minmax(320px, .75fr) minmax(560px, 1.25fr); gap: 20px; align-items: start; }
.compact-entry-form { margin-top: 20px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state h2 { color: var(--ink); margin-bottom: 8px; }
.progress { width: 100px; height: 7px; border-radius: 99px; background: #e4e9ed; overflow: hidden; display: inline-block; margin-right: 7px; }
.progress span { display: block; height: 100%; background: var(--teal); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #e5f2ff, #f5f7f9 55%); }
.login-card { width: min(440px, 100%); background: white; border: 1px solid var(--line); border-radius: 20px; padding: 34px; box-shadow: 0 28px 80px rgba(23,45,67,.13); }
.login-brand { color: var(--ink); margin-bottom: 30px; }
.login-card h1 { font-size: 30px; margin-bottom: 24px; }
.login-card .muted { margin: 19px 0 0; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar-collapsed .sidebar { opacity: 1; transform: none; pointer-events: auto; }
  .sidebar-toggle { display: none; }
  .nav-list { margin-top: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-footer { margin-top: 20px; }
  .main-content { padding: 28px 18px 50px; }
  .page-header { flex-direction: column; }
  .page-header-actions { justify-content: flex-start; }
  .two-column { grid-template-columns: 1fr; }
  .history-period-grid { grid-template-columns: 1fr; }
  .repair-manual-grid { grid-template-columns: 1fr; }
  .account-expense-grid { grid-template-columns: 1fr; }
  .searchable-account-control { grid-template-columns: 1fr; }
  .pulse-export-row { align-items: stretch; flex-direction: column; }
  .pulse-export-form { width: 100%; flex: 0 0 auto; justify-content: flex-start; }
  .crm-source-form { grid-template-columns: 1fr; }
}
@media (max-width: 1250px) {
  .expense-input-layout { grid-template-columns: 1fr; }
  .expense-history-panel { position: static; }
  .expense-history-scroll { max-height: none; }
  .cash-primary-grid { grid-template-columns: 1fr; }
  .kc-debt-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kc-debt-stack > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .kc-debt-stack { grid-template-columns: 1fr; }
  .kc-debt-stack > :last-child { grid-column: auto; }
  .cash-inline-form { grid-template-columns: 1fr; }
  .cash-inline-actions { justify-content: flex-start; }
}
