/* Funds ledger: a stable filter grid and semantic money colors. */
.app-shell{transition:grid-template-columns .2s ease}
.sidebar-toggle{position:absolute;z-index:3;top:68px;right:10px;width:28px;height:28px;display:grid;place-items:center;padding:0;border:1px solid rgba(156,173,201,.55);border-radius:8px;background:rgba(255,255,255,.9);color:#718198;box-shadow:0 5px 14px rgba(55,75,112,.08);cursor:pointer;transition:background .16s ease,color .16s ease,transform .16s ease}
.sidebar-toggle:hover{background:#f0edff;color:#5d50c7}
.sidebar-toggle svg,.ledger-row-open svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.app-shell.sidebar-collapsed{grid-template-columns:76px minmax(0,1fr)!important}
.app-shell.sidebar-collapsed .sidebar{width:76px!important;padding-left:10px!important;padding-right:10px!important}
.app-shell.sidebar-collapsed .main{margin-left:76px!important}
.app-shell.sidebar-collapsed .brand{justify-content:center;padding-left:0!important;padding-right:0!important}
.app-shell.sidebar-collapsed .brand-label,.app-shell.sidebar-collapsed .nav-label,.app-shell.sidebar-collapsed .nav-section-label,.app-shell.sidebar-collapsed .sidebar-foot>span:last-child{display:none!important}
.app-shell.sidebar-collapsed .nav{gap:8px!important}
.app-shell.sidebar-collapsed .nav-item,.app-shell.sidebar-collapsed .nav-item.nav-child{justify-content:center!important;padding-left:7px!important;padding-right:7px!important}
.app-shell.sidebar-collapsed .nav-icon{flex:0 0 30px!important}
.app-shell.sidebar-collapsed .sidebar-foot{justify-content:center!important;padding-left:0!important;padding-right:0!important}
.visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.ledger-filter-shell{padding:16px 18px!important;border-radius:14px!important}
.ledger-filter-primary{display:grid!important;grid-template-columns:repeat(7,minmax(0,1fr))!important;align-items:end!important;gap:14px 12px!important}
.ledger-filter-primary>label{display:grid!important;min-width:0!important;height:auto!important;gap:7px!important;align-content:start!important;color:#5f6171!important;font-size:12px!important;font-weight:750!important;line-height:1.2!important}
.ledger-filter-primary>label[hidden]{display:none!important}
.ledger-filter-primary>label>select,.ledger-filter-primary>label>input,.ledger-filter-primary>label>.smart-select{width:100%!important;height:42px!important;min-height:42px!important}
.ledger-filter-primary>label>.smart-select>.smart-select-trigger{height:42px!important;min-height:42px!important;overflow:hidden!important;font-size:13px!important;font-weight:500!important}
.ledger-filter-primary>label>select,.ledger-filter-primary>label>input{padding:0 11px!important;font-size:13px!important;font-weight:500!important}
.ledger-filter-primary>label>select.native-control-hidden{position:absolute!important;width:1px!important;height:1px!important;min-width:1px!important;min-height:1px!important;padding:0!important;border:0!important}
.ledger-filter-toolbar{display:flex!important;align-items:end!important;gap:12px!important;margin-top:14px!important}
.ledger-filter-toolbar>input[type=search]{flex:1 1 auto;min-width:0!important;height:42px!important;min-height:42px!important;padding:0 12px!important;font-size:13px!important}
.ledger-filter-toolbar>input[type=search]{box-sizing:border-box!important;border:1px solid rgba(126,107,209,.18)!important;border-radius:10px!important;background:rgba(255,255,255,.82)!important;color:#4d5060!important;font-family:inherit!important;font-weight:500!important;line-height:42px!important;outline:none!important;box-shadow:inset 0 1px 1px rgba(47,39,87,.03)!important}
.ledger-filter-toolbar>input[type=search]::placeholder{color:#9895a3!important;opacity:1!important}
.ledger-filter-toolbar>input[type=search]:focus{border-color:#9a8bd0!important;box-shadow:0 0 0 3px rgba(126,107,209,.13)!important}
.ledger-filter-actions{display:flex;align-items:end;justify-content:flex-end;gap:9px;flex:0 0 auto;min-width:0}
.ledger-filter-actions button{height:42px!important;min-height:42px!important;margin:0!important;font-size:13px!important}
.ledger-filter-actions .ledger-add-inline{align-self:auto!important}
.ledger-advanced-filters{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;align-items:end!important;gap:12px!important}
.ledger-advanced-filters.is-collapsed{display:none!important}
.ledger-advanced-filters label{min-width:0!important;font-size:12px!important;font-weight:750!important}
.ledger-advanced-filters select{height:42px!important;font-size:13px!important}

#ledger-page{
  --chart-panel-height:280px;
  --chart-max-width:860px;
  --chart-host-height:192px;
  --chart-svg-height:192px;
  --chart-offset-x:0px;
  --chart-offset-y:0px;
  --chart-plot-offset-x:0px;
  --chart-plot-offset-y:0px;
  --chart-legend-top:-61px;
  --chart-legend-right:112px;
}
#ledger-page .ledger-summary-layout{display:grid!important;grid-template-columns:minmax(340px,.8fr) minmax(550px,1.2fr)!important;gap:14px!important;align-items:stretch!important}
.ledger-stats{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;align-content:start!important}
.ledger-stats>.workspace-stat{display:block!important;min-height:104px!important;height:auto!important}
.ledger-trend-panel{height:var(--chart-panel-height)!important;min-height:var(--chart-panel-height)!important;box-sizing:border-box!important;padding:16px 18px!important;overflow:hidden!important}
.ledger-trend-chart{width:min(100%,var(--chart-max-width))!important;height:var(--chart-host-height)!important;min-height:var(--chart-host-height)!important;display:block!important;overflow:visible!important;margin:0 auto!important;position:relative;left:var(--chart-offset-x);top:var(--chart-offset-y)}
.ledger-trend-chart>svg{display:block;width:100%!important;height:var(--chart-svg-height)!important;max-height:var(--chart-svg-height)!important;position:relative;left:var(--chart-plot-offset-x);top:var(--chart-plot-offset-y)}
.ledger-chart-empty{display:grid;place-items:center;height:156px;color:#858997;font-size:12px;border:1px dashed #e3e0eb;border-radius:8px;background:#fcfbfe}
.ledger-chart-legend{position:absolute!important;z-index:2;top:var(--chart-legend-top);right:var(--chart-legend-right);padding:0!important;white-space:nowrap;pointer-events:none}
.ledger-chart-legend .net,.ledger-chart-legend .balance{background:#7865c4}
.ledger-chart-grid{stroke:#e8e5ef;stroke-width:1}
.ledger-chart-axis{stroke:#cfcbdc;stroke-width:1}
.ledger-chart-y-label{fill:#8a8794;font-size:10px;font-variant-numeric:tabular-nums}
.ledger-net-line{fill:none;stroke:#7865c4;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.ledger-net-dot{fill:#7865c4;stroke:#fff;stroke-width:1.5}
.ledger-chart-value{fill:#5e5b6d;font-size:10px;font-weight:750}
.ledger-chart-value.in-value{fill:#24775b}
.ledger-chart-value.out-value{fill:#c93449}
.ledger-chart-axis-label{fill:#8a8794;font-size:10px}
.ledger-chart-in{fill:#63a98d}
.ledger-chart-out{fill:#d55f74}
.ledger-balance-line{fill:none;stroke:#7865c4;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.ledger-balance-dot{fill:#7865c4;stroke:#fff;stroke-width:1.5}
.ledger-balance-value{fill:#5f4db2!important;font-size:10px!important;font-weight:800;paint-order:stroke;stroke:#fff;stroke-width:4px;stroke-linejoin:round}
.ledger-stats .positive-stat b{color:#24775b!important}
.ledger-stats .negative-stat b{color:#c93449!important}
.ledger-stats .success b{color:#24775b!important}
.ledger-stats .warning b{color:#c93449!important}
.ledger-table-panel,.ledger-table-panel .table-scroll{max-width:100%!important;min-width:0!important}
.ledger-table-panel .table-scroll{overflow-x:hidden!important}
.ledger-table{
  --col-date:8%;
  --col-subtype:10%;
  --col-description:18%;
  --col-amount:12%;
  --col-counterparty:14%;
  --col-team:6%;
  --col-category:7%;
  --col-payer:8%;
  --col-status:14%;
  --col-action:3%;
  width:100%!important;
  min-width:0!important;
  table-layout:fixed!important;
}
.ledger-table th,.ledger-table td{display:table-cell!important;padding:11px 8px!important;overflow:hidden!important;vertical-align:middle!important;white-space:normal!important}
.ledger-table th{font-size:11px!important;letter-spacing:0!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(1),.ledger-table:not([data-ledger-schema]) td:nth-child(1){width:var(--col-date)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(2),.ledger-table:not([data-ledger-schema]) td:nth-child(2){width:var(--col-subtype)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(3),.ledger-table:not([data-ledger-schema]) td:nth-child(3){width:var(--col-description)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(4),.ledger-table:not([data-ledger-schema]) td:nth-child(4){width:var(--col-amount)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(5),.ledger-table:not([data-ledger-schema]) td:nth-child(5){width:var(--col-counterparty)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(6),.ledger-table:not([data-ledger-schema]) td:nth-child(6){width:var(--col-team)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(7),.ledger-table:not([data-ledger-schema]) td:nth-child(7){width:var(--col-category)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(8),.ledger-table:not([data-ledger-schema]) td:nth-child(8){width:var(--col-payer)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(9),.ledger-table:not([data-ledger-schema]) td:nth-child(9){width:var(--col-status)!important}
.ledger-table:not([data-ledger-schema]) th:nth-child(10),.ledger-table:not([data-ledger-schema]) td:nth-child(10){width:var(--col-action)!important;text-align:center!important}
.ledger-table[data-ledger-schema] td:last-child,.ledger-table[data-ledger-schema] th:last-child{text-align:center!important}
.ledger-table tbody tr{height:72px}
.ledger-date{white-space:nowrap!important;font-variant-numeric:tabular-nums;color:#687287!important}
.ledger-description{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#41495a;font-weight:650}
.ledger-person-item{display:grid;min-width:0;gap:5px;align-content:center}
.ledger-person-item .ledger-preview-tag{width:max-content;max-width:100%!important}
.ledger-table[data-ledger-schema="bank"] tbody tr{height:auto;min-height:72px}
.ledger-table[data-ledger-schema="bank"]{min-width:920px}
.ledger-table[data-ledger-schema="bank"] th,.ledger-table[data-ledger-schema="bank"] td{padding-left:12px;padding-right:12px}
.ledger-table[data-ledger-schema="bank"] th:nth-child(2),.ledger-table[data-ledger-schema="bank"] td:nth-child(2){display:table-cell}
.ledger-table[data-ledger-schema="bank"] .ledger-bank-description{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.35;overflow-wrap:normal}
.ledger-table[data-ledger-schema="bank"] .ledger-tag-wrap{display:inline-flex;max-width:100%;vertical-align:middle}
.ledger-table[data-ledger-schema="bank"] .ledger-preview-tag{max-width:100%;overflow:hidden;text-overflow:ellipsis}
.ledger-cell-note{display:block;margin-top:5px;overflow:hidden;color:#7f8290;font-size:11px;line-height:1.35;text-overflow:ellipsis;white-space:nowrap}
.ledger-tag-wrap{display:inline-block;min-width:0;max-width:100%;vertical-align:middle}
.ledger-preview-tag{display:block!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;box-sizing:border-box}
.ledger-payer-preview{display:grid;gap:4px;min-width:0}.ledger-payer-person{display:block;overflow:hidden;color:#626a76;font-size:11px;font-weight:650;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}
.ledger-status-stack{max-width:none!important;gap:4px!important;align-content:center}
.ledger-status-stack.is-compact{display:flex;align-items:center;flex-wrap:wrap}
.ledger-status-stack .ledger-status-tag{padding:3px 6px!important;font-size:11px!important;line-height:1.25!important}
.ledger-row-open{width:32px;height:32px;display:inline-grid;place-items:center;padding:0;border:1px solid #dedbea;border-radius:8px;background:#fff;color:#7162bd;cursor:pointer}
.ledger-row-open:hover{background:#f0edff;border-color:#cfc7ee}
.ledger-table .ledger-amount{font-weight:750!important;font-variant-numeric:tabular-nums!important;white-space:nowrap!important}
.ledger-table .ledger-amount.income{color:#24775b!important}
.ledger-table .ledger-amount.expense{color:#c93449!important}
.ledger-table .ledger-amount.funding{color:#5f4db2!important}
html,body{overflow-x:hidden}

@media(max-width:1500px){.ledger-filter-primary{grid-template-columns:repeat(4,minmax(0,1fr))!important}}
@media(max-width:760px){.sidebar-toggle{display:none!important}.app-shell.sidebar-collapsed .brand-label,.app-shell.sidebar-collapsed .nav-label{display:inline!important}.ledger-filter-primary{grid-template-columns:repeat(2,minmax(0,1fr))!important}.ledger-filter-toolbar{display:grid!important;grid-template-columns:1fr!important}.ledger-filter-actions{justify-content:stretch!important}.ledger-filter-actions button{flex:1 1 0}}
@media(max-width:900px){#ledger-page .ledger-summary-layout{grid-template-columns:1fr!important}.ledger-advanced-filters{grid-template-columns:repeat(2,minmax(0,1fr))!important}.ledger-table-panel .table-scroll{overflow-x:auto!important}.ledger-table{min-width:920px!important}.ledger-table[data-ledger-schema="bank"]{min-width:720px!important}.ledger-table[data-ledger-schema="salary"]{min-width:780px!important}.ledger-table[data-ledger-schema="travel"]{min-width:900px!important}}
@media(max-width:650px){.ledger-filter-shell{padding:13px!important}.ledger-filter-primary{gap:12px 10px!important}.ledger-filter-toolbar{gap:10px!important}.ledger-filter-actions{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important}.ledger-filter-actions button{min-width:0!important;padding-left:8px!important;padding-right:8px!important}.ledger-advanced-filters{grid-template-columns:1fr!important}.ledger-page .ledger-summary-layout{display:block!important}.ledger-trend-panel{margin-top:10px}}

/* Expense entry: separate accounting essentials from optional supporting detail. */
.modal-backdrop #expense-form .expense-form-section{margin:0 0 16px;padding:16px;border:1px solid #ebe8f1;border-radius:8px;background:rgba(255,255,255,.72)}
.modal-backdrop #expense-form .expense-form-section.is-required{border-color:#ddd7f1;background:#fbfaff}
.expense-form-section-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:15px}
.expense-form-section-heading h3{margin:0;color:#343a51;font-size:13px}
.expense-form-section-heading p{margin:4px 0 0;color:#858997;font-size:10px}
.expense-form-section-heading>span,.expense-form-section summary small{flex:none;padding:3px 7px;border-radius:999px;background:#f1edfb;color:#6654bd;font-size:9px;font-weight:750}
.expense-form-section summary{display:flex;align-items:center;justify-content:space-between;gap:12px;color:#4f5362;font-size:12px;font-weight:750;cursor:pointer;list-style:none}
.expense-form-section summary::-webkit-details-marker{display:none}
.expense-form-section summary:after{content:'⌃';order:2;color:#8b829f;font-size:12px}
.expense-form-section:not([open]) summary:after{content:'⌄'}
.expense-form-section summary small{order:1;background:#f3f4f7;color:#6d7480}
.expense-form-section>summary+div{margin-top:15px}
.modal-backdrop #expense-form .form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;column-gap:18px;row-gap:16px}
.modal-backdrop #expense-form .form-grid>label{min-width:0;align-content:start;line-height:1.35}

/* Unified ledger entry follows the same required/optional hierarchy. */
.ledger-entry-section{grid-column:1/-1;padding:15px;border:1px solid #ddd7f1;border-radius:8px;background:#fbfaff}
.ledger-entry-section-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:14px}
.ledger-entry-section-heading h3{margin:0;color:#343a51;font-size:13px}
.ledger-entry-section-heading p{margin:4px 0 0;color:#858997;font-size:10px}
.ledger-entry-section-heading>span{padding:3px 7px;border-radius:999px;background:#f1edfb;color:#6654bd;font-size:9px;font-weight:750}
.ledger-entry-section>.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px 18px}
.ledger-entry-advanced summary{display:flex;align-items:center;justify-content:space-between;gap:10px;list-style:none}
.ledger-entry-advanced summary::-webkit-details-marker{display:none}
.ledger-entry-advanced summary small{padding:3px 7px;border-radius:999px;background:#f3f4f7;color:#6d7480;font-size:9px}
.compact-modal:has(.ledger-entry-type){width:min(760px,calc(100vw - 32px))!important}

@media(max-width:650px){
  .modal-backdrop #expense-form .expense-form-section,.ledger-entry-section{padding:13px}
  .modal-backdrop #expense-form .form-grid,.ledger-entry-section>.form-grid{grid-template-columns:1fr}
}
.ledger-sample-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px;
  padding: 9px 12px;
  border: 1px solid rgba(111, 93, 205, .18);
  border-radius: 8px;
  background: rgba(111, 93, 205, .07);
  color: #514876;
  font-size: 12px;
  line-height: 1.5;
}

.ledger-sample-banner[hidden] { display: none; }
.ledger-sample-banner b { color: #463b7c; font-size: 13px; }

@media (max-width: 700px) {
  .ledger-sample-banner { align-items: flex-start; flex-direction: column; gap: 2px; margin-inline: 10px; }
  #entity-modal-backdrop { padding-inline: 10px; }
  #entity-modal-backdrop .modal {
    width: 100% !important;
    max-width: 100% !important;
  }
}
.ledger-stats .workspace-stat b{font-size:22px;white-space:nowrap;font-variant-numeric:tabular-nums}
@media(max-width:650px){.ledger-trend-panel .panel-heading{display:grid;grid-template-columns:1fr;gap:8px}.ledger-trend-controls{justify-self:start}.ledger-chart-legend{justify-content:flex-start;flex-wrap:wrap}}
