:root {
    --blue: #2766a8;
    --blue-dark: #164578;
    --blue-pale: #eaf3fc;
    --line: #b7cbe0;
    --text: #24374a;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: #f4f7fa; }
a { color: inherit; text-decoration: none; }
.login-page {
    min-height: 100vh; display: grid; place-items: center;
    background: radial-gradient(circle at 20% 15%, #fff 0 12%, transparent 40%),
        linear-gradient(135deg, #143e69, #3984c4);
}
.login-window {
    width: min(820px, calc(100% - 32px)); min-height: 460px; display: grid;
    grid-template-columns: 1.1fr 1fr; overflow: hidden; border-radius: 7px;
    background: white; box-shadow: 0 24px 70px #08294780; border: 1px solid #ffffff80;
}
.login-brand {
    padding: 70px 48px; color: white; text-align: center;
    background: linear-gradient(#266eb0d9, #123f70e8);
}
.brand-mark {
    width: 104px; height: 104px; display: grid; place-items: center; margin: 0 auto 22px;
    border: 3px solid #fff; border-radius: 50%; font: 700 40px Georgia; box-shadow: 0 0 0 8px #ffffff1a;
}
.login-brand h1 { margin: 0; font: 36px Georgia, serif; }
.login-brand p { letter-spacing: 1.5px; opacity: .82; }
.login-panel { padding: 54px 48px 30px; }
.login-panel h2 { margin: 0; color: var(--blue-dark); font-size: 32px; }
.muted { color: #7b8b99; margin: 5px 0 30px; }
label { display: block; margin: 17px 0; font-weight: 600; }
input, select {
    width: 100%; margin-top: 7px; padding: 11px 12px; border: 1px solid #b9c7d3;
    border-radius: 3px; font: inherit; background: #fff;
}
input:focus, select:focus { outline: 2px solid #75ace0; border-color: transparent; }
.primary-button {
    width: 100%; border: 0; padding: 12px; color: white; background: linear-gradient(#3b86c8, #1d5b94);
    border-radius: 3px; font: 600 16px inherit; cursor: pointer;
}
.alert { padding: 10px 12px; background: #fff0f0; border: 1px solid #e6aaaa; color: #8d2929; }
.alert.success { background: #eaf8ee; border-color: #9acba8; color: #236736; }
.alert.warning { background: #fff8e6; border-color: #e8c56d; color: #7a5416; }
.deletion-warning { border-color: #f0c66b; background: linear-gradient(180deg,#fffaf0,#fff); }
.deletion-warning h2 { color: #7a5416; }
.byline { text-align: center; color: #8a99a6; font-size: 13px; }
.app-page { min-height: 100vh; display: grid; grid-template-rows: 38px auto 1fr 28px; }
.titlebar {
    display: flex; align-items: center; gap: 14px; padding: 0 16px; color: white;
    background: linear-gradient(#2872b4, #164b7d); box-shadow: inset 0 1px #ffffff50;
}
.titlebar > span { opacity: .72; font-size: 13px; }
.orb {
    width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%;
    background: linear-gradient(#ffcf4c, #d7830b); border: 2px solid #fff9; font-weight: 800;
}
.logout { margin-left: auto; padding: 4px 13px; border-radius: 3px; background: #ffffff1c; }
.ribbon {
    display: flex; min-height: 126px; padding: 7px 12px 9px; background: linear-gradient(#fafdff, #dceaf7);
    border-bottom: 1px solid #88a9ca; box-shadow: 0 2px 6px #2c4d6b25; overflow-x: auto;
}
.ribbon section { padding: 0 12px; border-right: 1px solid var(--line); }
.ribbon h2 { margin: 0 0 5px; color: #315d88; font-size: 13px; font-weight: 600; }
.ribbon-actions { display: flex; gap: 5px; }
.ribbon-button {
    min-width: 76px; height: 88px; padding: 7px 8px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 3px;
    font-size: 12px; text-align: center;
}
.ribbon-button:hover { border-color: #e7a63b; background: linear-gradient(#fffdf2, #ffe6a7); }
.ribbon-button b { color: var(--blue); font-size: 28px; line-height: 36px; }
.dashboard-icon-tile {
    width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 7px; border-radius: 14px; color: #0a84ff;
    background: linear-gradient(180deg, #f2f8ff, #e4f1ff);
    box-shadow: inset 0 0 0 1px #cfe6ff, 0 7px 16px rgba(10,132,255,.12);
}
.dashboard-icon { width: 27px; height: 27px; display: block; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.workspace { padding: 20px; background: white; position: relative; }
.context-card {
    display: grid; grid-template-columns: auto auto; gap: 4px 14px; width: max-content;
    padding: 13px 18px; border: 1px solid var(--line); background: var(--blue-pale);
}
.context-card span { color: #668099; }
.welcome { text-align: center; margin: 11vh auto 0; color: #7290aa; }
.welcome .brand-mark { color: #4f7ea7; border-color: #80a3c2; box-shadow: none; }
.welcome h1 { margin-bottom: 7px; color: #456b8d; }
.statusbar {
    display: flex; gap: 35px; align-items: center; padding: 0 14px; font-size: 12px;
    background: linear-gradient(#edf5fc, #d0e4f5); border-top: 1px solid #8db1d2;
}
.module-page { grid-template-rows: 38px 1fr 28px; }
.module-workspace { padding: 18px; background: #eef3f8; overflow: auto; }
.panel { margin-bottom: 16px; border: 1px solid #aabfd3; border-radius: 4px; background: white; box-shadow: 0 2px 7px #294e7120; }
.panel > h1, .panel > h2 { margin: 0; padding: 13px 16px; border-bottom: 1px solid #cfdae5; color: #315e87; font-size: 18px; }
.form-panel { padding-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(200px,1fr)); gap: 0 18px; padding: 0 16px; }
.form-grid label { margin: 10px 0; }
.form-grid .full { grid-column: 1/-1; }
.compact { width: auto; min-width: 130px; padding-inline: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 16px; border-bottom: 1px solid #cfdae5; }
.panel-heading h1, .panel-heading h2 { margin: 0; color: #315e87; font-size: 18px; }
.search { display: flex; gap: 5px; }
.search input { width: 220px; margin: 0; padding: 7px; }
.search button, .link-button { border: 1px solid #9cb4ca; background: #edf5fc; color: #295d8d; border-radius: 3px; cursor: pointer; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 9px 10px; color: #315d86; background: #e7f0f8; border-bottom: 1px solid #a9bfd3; text-align: left; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #e0e7ed; vertical-align: top; }
tbody tr:hover { background: #fffbea; }
td small { display: block; color: #7b8c9b; margin-top: 3px; }
.number { text-align: right !important; font-variant-numeric: tabular-nums; }
th.number, td.number { min-width: 105px; }
thead th { vertical-align: middle; }
tbody td { vertical-align: middle; }
.positive { color: #21703a !important; }
.negative { color: #a12e2e !important; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 12px; color: #855b1b; background: #fff0c8; text-transform: capitalize; }
.badge.positive { background: #def4e5; }
.badge.debit { color: #285f8f; background: #e0effc; }
.badge.credit { color: #71418a; background: #f0e3f7; }
.empty { padding: 30px; color: #8091a0; text-align: center; }
.summary-strip { display: grid; grid-template-columns: repeat(3,1fr); margin-bottom: 16px; border: 1px solid #aabfd3; background: white; }
.summary-strip > div { padding: 15px 18px; border-right: 1px solid #d2dee9; }
.summary-strip span { display: block; color: #718497; font-size: 12px; }
.money { display: block; margin-top: 3px; color: #214f79; font-size: 20px; font-variant-numeric: tabular-nums; }
.filter-bar { display: flex; align-items: end; gap: 14px; padding: 14px 16px; }
.filter-bar label { flex: 1; margin: 0; }
.filter-bar button { margin-bottom: 1px; }
.empty-state { margin-top: 15vh; text-align: center; color: #738ba0; }
.empty-state .brand-mark { color: #587e9e; border-color: #7599b9; }
tfoot th { border-top: 2px solid #93abc0; font-size: 14px; }
.editable-row { cursor: pointer; }
.editable-row:hover { background: #fff3cb; }
.editable-row:focus { outline: 2px solid #e4a536; outline-offset: -2px; }
.hint { margin-left: 8px; color: #7c8d9c; font-size: 12px; font-weight: 400; }
.form-actions { display: flex; gap: 8px; }
.secondary-button, .danger-button { border: 1px solid; padding: 10px 18px; border-radius: 3px; font: 600 14px inherit; cursor: pointer; }
.secondary-button { color: #375e7c; border-color: #9db3c6; background: #edf4fa; }
.danger-button { color: white; border-color: #8d2a2a; background: linear-gradient(#c75050,#963131); }
.selection-status { gap: 22px; position: sticky; bottom: 0; z-index: 4; }
.ledger-row { cursor: cell; user-select: none; }
.ledger-row.selected-row { background: #cfe5fa !important; outline: 1px solid #5f9bd3; outline-offset: -1px; }
.entry-drawer summary { padding: 13px 16px; color: #275f91; background: #e8f2fb; cursor: pointer; font-weight: 700; }
.entry-drawer[open] summary { border-bottom: 1px solid #b8cadb; }
.report-heading { padding: 22px; text-align: center; }
.report-heading h1, .report-heading h2, .report-heading p { margin: 3px; }
.admin-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding: 9px 12px; border: 1px solid #9db8d0; background: #e7f1fa; }
.admin-toolbar form { margin-right: auto; }
.admin-toolbar label { display: flex; align-items: center; gap: 8px; margin: 0; }
.admin-toolbar select { width: auto; min-width: 170px; margin: 0; padding: 6px; }
.admin-toolbar a { padding: 7px 11px; border: 1px solid #9db4ca; border-radius: 3px; background: white; color: #275d8c; }
.review-form { display: flex; gap: 5px; align-items: center; }
.review-form input { min-width: 150px; margin: 0; padding: 6px; }
table { table-layout: auto; }
.advanced-filters { display: grid; grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); gap: 10px; align-items: end; padding: 14px; }
.advanced-filters label { margin: 0; min-width: 0; }
.advanced-filters .primary-button, .advanced-filters .secondary-button { width: 100%; text-align: center; }
.search-combobox { position: relative; }
.search-combobox > input[type="text"], .search-combobox > input:not([type]) { margin-top: 7px; }
.combo-results { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; max-height: 260px; overflow-y: auto; border: 1px solid #8faec9; background: white; box-shadow: 0 7px 18px #173a5950; }
.combo-results[hidden] { display: none; }
.combo-results button { display: block; width: 100%; padding: 8px 10px; border: 0; border-bottom: 1px solid #e2e9ef; background: white; text-align: left; cursor: pointer; }
.combo-results button:hover, .combo-results button:focus { background: #dceeff; }
.combo-results button[hidden] { display: none; }
.action-panel { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.action-panel #action-options { display: flex; gap: 8px; align-items: center; }
.bulk-editor { padding-bottom: 15px; border-color: #e0a23c; }
.check-column { width: 38px; min-width: 38px !important; text-align: center; }
.check-column input { width: 17px; height: 17px; margin: 0; }
.ledger-table tbody tr:has(.entry-check:checked) { background: #cfe5fa; outline: 1px solid #5f9bd3; }
.checkbox-label { display: flex; align-items: center; gap: 10px; }
.checkbox-label input { width: 18px; height: 18px; margin: 0; }
.prose { padding: 14px 18px; line-height: 1.55; }
.modern-ui { --blue:#0a84ff; --blue-dark:#1769aa; --blue-pale:#eef6ff; background:#f5f5f7; color:#1d1d1f; }
.modern-ui .titlebar { height:48px; padding-inline:20px; background:rgba(250,250,252,.94); color:#1d1d1f; border-bottom:1px solid #d8d8dc; box-shadow:none; backdrop-filter:blur(18px); }
.modern-ui .titlebar .orb { color:white; background:#0a84ff; border:0; }
.modern-ui .titlebar > span { color:#6e6e73; opacity:1; }
.modern-ui .titlebar .logout { color:#0066cc; background:#eaf4ff; }
.modern-ui .module-workspace { padding:24px; background:#f5f5f7; }
.modern-ui .panel { border:1px solid #e3e3e7; border-radius:14px; box-shadow:0 2px 10px #0000000a; }
.modern-ui .panel > h1,.modern-ui .panel > h2,.modern-ui .panel-heading h1,.modern-ui .panel-heading h2 { color:#1d1d1f; }
.modern-ui input,.modern-ui select { min-height:40px; border-color:#d2d2d7; border-radius:9px; background:#fff; }
.modern-ui input:focus,.modern-ui select:focus { outline:3px solid #0a84ff33; border-color:#0a84ff; }
.modern-ui .primary-button { border-radius:9px; background:#0a84ff; box-shadow:none; }
.modern-ui .secondary-button,.modern-ui .link-button { border-color:#d2d2d7; border-radius:9px; background:#f8f8fa; color:#0066cc; }
.modern-ui th { color:#3a3a3c; background:#f2f2f7; }
.modern-ui tbody tr:hover { background:#f5faff; }
.modern-ui .summary-strip { border:1px solid #e3e3e7; border-radius:14px; overflow:hidden; box-shadow:0 2px 10px #0000000a; }
.modern-ui .advanced-filters { gap:14px; padding:18px; }
.modern-ui .section-help { margin:-5px 16px 12px; color:#6e6e73; }
.modern-ui .hero-panel { max-width:1050px; margin-inline:auto; }
.app-page {
    --blue:#0a84ff; --blue-dark:#1769aa; --blue-pale:#eef6ff;
    grid-template-rows:auto auto 1fr auto; background:#f5f5f7; color:#1d1d1f;
}
.app-page.module-page { grid-template-rows:auto 1fr auto; }
.app-page .titlebar {
    min-height:52px; height:auto; padding:8px 20px; background:rgba(250,250,252,.96);
    color:#1d1d1f; border-bottom:1px solid #d8d8dc; box-shadow:none; backdrop-filter:blur(18px);
}
.app-page .titlebar .orb { flex:0 0 34px; width:34px; height:34px; color:white; background:#0a84ff; border:0; }
.app-page .titlebar > span { color:#6e6e73; opacity:1; }
.app-page .titlebar .logout { color:#0066cc; background:#eaf4ff; border-radius:9px; padding:7px 13px; }
.app-page .module-workspace,.app-page .workspace { padding:24px; background:#f5f5f7; }
.app-page .panel {
    border:1px solid #e3e3e7; border-radius:14px; box-shadow:0 2px 10px #0000000a; overflow:hidden;
}
.app-page .panel > h1,.app-page .panel > h2,.app-page .panel-heading h1,.app-page .panel-heading h2 { color:#1d1d1f; }
.app-page input,.app-page select { min-height:40px; border-color:#d2d2d7; border-radius:9px; background:#fff; }
.app-page input:focus,.app-page select:focus { outline:3px solid #0a84ff33; border-color:#0a84ff; }
.app-page .primary-button { border-radius:9px; background:#0a84ff; box-shadow:none; }
.app-page .secondary-button,.app-page .danger-button,.app-page .link-button { border-radius:9px; }
.app-page .secondary-button,.app-page .link-button { border-color:#d2d2d7; background:#f8f8fa; color:#0066cc; }
.app-page th { color:#3a3a3c; background:#f2f2f7; }
.app-page tbody tr:hover { background:#f5faff; }
.app-page .summary-strip {
    border:1px solid #e3e3e7; border-radius:14px; overflow:hidden; box-shadow:0 2px 10px #0000000a;
}
.app-page .context-card {
    width:min(100%,520px); padding:18px 20px; border:1px solid #e3e3e7; border-radius:14px;
    background:#fff; box-shadow:0 2px 10px #0000000a;
}
.app-page .admin-toolbar {
    flex-wrap:wrap; border:1px solid #e3e3e7; border-radius:12px; background:#fff; padding:12px;
}
.app-page .admin-toolbar a { border-color:#d2d2d7; border-radius:9px; color:#0066cc; background:#f8f8fa; }
.app-page .ribbon {
    min-height:120px; gap:8px; padding:12px 16px; background:#fff; border-bottom:1px solid #e3e3e7; box-shadow:0 2px 10px #0000000a;
}
.app-page .ribbon section { border-right:1px solid #e3e3e7; }
.app-page .ribbon h2 { color:#6e6e73; }
.app-page .ribbon-button { min-width:86px; height:88px; border-radius:10px; color:#3a3a3c; }
.app-page .ribbon-button:hover { border-color:#9acbff; background:#eef7ff; }
.app-page .ribbon-button b { color:#0a84ff; }
.app-page .statusbar {
    min-height:34px; height:auto; padding:7px 16px; background:#fafafa; border-color:#dedede; color:#545458;
}
.print-only { display:none; }
.row-actions { display:flex; gap:7px; min-width:160px; }
.row-actions button { white-space:nowrap; }
.correction-panel { border-color:#9acbff !important; }
.correction-panel .section-help { padding:0 16px; color:#6e6e73; }
@media print {
    @page { size:auto; margin:12mm; }
    html,body,.app-page { min-height:0 !important; height:auto !important; display:block !important; background:#fff !important; }
    .app-page > .titlebar,.app-page > .ribbon,.app-page > .statusbar,.no-print { display:none !important; }
    .app-page > main,.module-workspace,.report-page { display:block !important; padding:0 !important; margin:0 !important; overflow:visible !important; background:#fff !important; }
    .module-workspace > :not(.printable) { display:none !important; }
    .module-workspace > .print-container { display:block !important; }
    .print-container > :not(.printable) { display:none !important; }
    .printable { display:block !important; margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; overflow:visible !important; }
    .printable .print-only { display:block !important; }
    .printable .no-print,.printable .check-column,.printable .row-actions { display:none !important; }
    .printable .table-wrap { overflow:visible !important; }
    .printable table { width:100% !important; font-size:10pt; table-layout:auto; }
    .printable thead { display:table-header-group; }
    .printable tfoot { display:table-footer-group; }
    .printable tr { break-inside:avoid; page-break-inside:avoid; }
    .printable th,.printable td { padding:6px 7px; color:#111 !important; background:#fff !important; border-color:#bbb; }
    .printable .report-heading { padding:0 0 14px; }
    .printable .report-heading h1 { font-size:18pt; }
    .printable .report-heading h2 { font-size:14pt; }
    .printable .report-heading p { font-size:10pt; }
}
@media (max-width: 980px) {
    .app-page .module-workspace,.app-page .workspace { padding:16px; }
    .advanced-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .panel-heading { align-items:flex-start; flex-wrap:wrap; }
    .admin-toolbar form { width:100%; }
    .admin-toolbar label,.admin-toolbar select { width:100%; }
    .action-panel,.action-panel #action-options { flex-wrap:wrap; }
}
@media (max-width: 700px) {
    .login-window { grid-template-columns: 1fr; }
    .login-brand { padding: 34px; }
    .login-brand .brand-mark { width: 70px; height: 70px; font-size: 27px; }
    .login-panel { padding: 32px; }
    .ribbon { min-height: auto; }
    .ribbon-button { min-width: 70px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: auto; }
    .summary-strip { grid-template-columns: 1fr; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .app-page { grid-template-rows:auto auto 1fr auto; }
    .module-page { grid-template-rows:auto 1fr auto; }
    .app-page .titlebar { padding:9px 12px; gap:9px; }
    .app-page .titlebar > span { display:none; }
    .app-page .titlebar strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .app-page .titlebar .logout { padding:7px 10px; }
    .app-page .module-workspace,.app-page .workspace { padding:10px; }
    .app-page .ribbon { min-height:auto; padding:10px; }
    .app-page .ribbon section { padding:0 8px; }
    .advanced-filters { grid-template-columns:1fr; padding:12px; }
    .panel-heading { padding:12px; }
    .panel-heading > * { width:100%; }
    .panel-heading .compact { width:100%; }
    .form-actions { align-items:stretch; flex-direction:column; }
    .form-actions .compact { width:100%; }
    .statusbar { gap:8px 18px; flex-wrap:wrap; }
    .context-card { grid-template-columns:1fr; }
    .welcome { margin-top:8vh; }
    .review-form { min-width:260px; flex-wrap:wrap; }
    .row-actions { min-width:145px; flex-direction:column; }
    .search { width:100%; flex-wrap:wrap; }
    .search input { width:100%; flex:1 1 180px; }
    .search button { min-height:40px; padding:8px 12px; }
}
@media (max-width: 430px) {
    .login-page { place-items:start center; padding:12px 0; }
    .login-brand { padding:24px; }
    .login-panel { padding:24px 20px; }
    .login-panel h2 { font-size:26px; }
    .app-page .orb { display:none; }
    .ribbon-button { min-width:66px; }
}
