.ml-page{padding:24px;color:var(--text,#243831);font:14px/1.45 Arial,sans-serif;background:var(--bg,#fff);border-radius:16px}
.ml-heading,.ml-tools,.ml-modes,.ml-footer,.ml-dialog-head,.ml-dialog-foot{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.ml-heading{justify-content:space-between}.ml-heading h1{font-size:23px;margin:0 0 16px}.ml-modes{margin:8px 0 18px}.ml-modes [aria-pressed=true]{border-color:#478e71;background:#e9f3ee;font-weight:600}.ml-field{display:flex;flex-direction:column;gap:5px;color:#60756b}.ml-tools{align-items:flex-end}.ml-tools .ml-field:last-of-type{flex:1}.ml-page input,.ml-page select,.ml-dialog input,.ml-dialog select{box-sizing:border-box;font:inherit;color:inherit;background:var(--bg,#fff);border:1px solid #cfddd5;border-radius:6px;padding:9px;min-width:0}.ml-page input:focus,.ml-dialog input:focus,.ml-dialog select:focus{outline:2px solid #478e71;outline-offset:1px}.ml-button{font:inherit;border:1px solid #cfddd5;border-radius:7px;background:var(--bg,#fff);padding:9px 13px;color:inherit;cursor:pointer}.ml-button:focus-visible{outline:2px solid #478e71;outline-offset:2px}.ml-button:disabled{opacity:.55;cursor:default}.ml-primary{background:#478e71;color:#fff;border-color:#478e71;font-weight:600}.ml-notice{margin:16px 0;color:#60756b;max-width:1000px}.ml-notice p{margin:6px 0}.ml-warning{color:#87601b}.ml-status{min-height:22px;color:#347351}.ml-error{color:#b32626!important}.ml-scroll{overflow:auto;max-height:none;border:1px solid #d4e0d9;border-radius:8px}.ml-table{border-collapse:separate;border-spacing:0;width:100%;font-variant-numeric:tabular-nums}.ml-table th{position:sticky;top:0;z-index:3;background:#eaf2ee;padding:12px 8px;text-align:left;white-space:nowrap;border-bottom:1px solid #cbdad1;font-size:12px}.ml-table td{padding:8px;border-bottom:1px solid #e4ebe7;vertical-align:middle;background:var(--bg,#fff)}.ml-table .ml-name{position:sticky;left:0;min-width:220px;max-width:290px;z-index:2;box-shadow:1px 0 #d4e0d9}.ml-table th:first-child{left:0;z-index:4}.ml-table td small{display:block;font-size:11px;margin-top:3px}.ml-table .ml-number{text-align:right;min-width:90px}.ml-number input{width:92px;text-align:right;background:#fbfefc;padding:8px 5px}.ml-table .ml-current{color:#72877b;background:#f6f8f7}.ml-table [data-closing]{font-weight:600;background:#eef6f1}.ml-table .ml-group td{background:#f1f5f2;font-weight:600;padding:10px 12px}.ml-table .ml-unit{color:#72877b;white-space:nowrap}.ml-table td:last-child input{width:190px}.ml-footer{position:sticky;bottom:0;background:var(--bg,#fff);padding:16px 0 0;margin-top:8px;border-top:1px solid #d4e0d9}.ml-sync{display:flex;gap:8px;align-items:center;flex:1}.ml-sync input{width:18px;height:18px}.ml-dialog{width:min(720px,92vw);max-height:88vh;border:1px solid #cbdad1;border-radius:12px;padding:0;color:#243831}.ml-dialog::backdrop{background:#15291e66}.ml-dialog-head,.ml-dialog-foot{padding:18px;justify-content:space-between;border-bottom:1px solid #d4e0d9}.ml-dialog-head h2{font-size:19px;margin:0;max-width:75%}.ml-dialog-content{padding:18px;overflow:auto;max-height:60vh}.ml-dialog-content>select{width:100%;margin:12px 0}.ml-dialog-content>.ml-button{margin:4px}.ml-dialog-content li{margin:8px 0}.ml-dialog-foot{border-top:1px solid #d4e0d9;border-bottom:0;justify-content:flex-end}
@media(max-width:600px){.ml-page{padding:12px 8px}.ml-heading h1{font-size:20px}.ml-tools{gap:8px}.ml-tools .ml-field{flex:1;min-width:125px}.ml-modes{gap:6px}.ml-modes button{font-size:12px;padding:8px}.ml-table .ml-name{min-width:155px;max-width:170px;font-size:12px}.ml-scroll{max-height:none}.ml-footer{gap:8px}.ml-sync{flex-basis:100%;font-size:12px}.ml-footer .ml-primary{flex:1}.ml-button{padding:9px;font-size:13px}}

.ml-formula{display:block;border:0;background:transparent;color:#478e71;font:11px/1.2 Arial,sans-serif;cursor:pointer;margin-top:4px;max-width:100px;text-align:left;padding:2px}.ml-formula:focus-visible{outline:2px solid #478e71}
.ml-footer{z-index:8}
.ml-history{width:min(1500px,96vw);max-height:94vh}.ml-history .ml-dialog-content{max-height:76vh}.ml-history-layout{display:grid;grid-template-columns:270px minmax(0,1fr);gap:20px;margin-top:18px}.ml-history aside>.ml-button{display:block;width:100%;text-align:left;white-space:pre-line;margin-bottom:8px;line-height:1.6}.ml-version-view{min-width:0}.ml-version-view h3{margin-top:0}.ml-version-view details{margin:16px 0}.ml-version-view summary{cursor:pointer;color:#347351;font-weight:600}.ml-version-view input[type=search]{width:100%;margin:8px 0}.ml-version-table{overflow-x:auto;border:1px solid #d4e0d9;border-radius:8px}.ml-version-table .ml-changed{background:#fff2c7}.ml-version-table td:last-child{min-width:160px;white-space:pre-wrap}.ml-diff{width:100%;border-collapse:collapse;font-size:12px;table-layout:fixed}.ml-diff th,.ml-diff td{padding:8px;border-bottom:1px solid #d4e0d9;text-align:left;overflow-wrap:anywhere;white-space:pre-wrap}.ml-diff th:first-child{width:32%}
@media(max-width:700px){.ml-history-layout{grid-template-columns:1fr}.ml-history aside{max-height:240px;overflow-y:auto}.ml-history .ml-dialog-content{padding:12px}.ml-history .ml-dialog-head{padding:12px}}
.ml-history{font:14px/1.45 Arial,sans-serif}.ml-history aside [aria-pressed=true]{background:#e9f3ee;border-color:#478e71}.ml-history input[type=datetime-local]{width:100%}
@media(max-width:700px){.ml-history .ml-tools .ml-field{flex-basis:100%;min-width:0;width:100%}}
.ml-heading-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}.ml-import{font:14px/1.45 Arial,sans-serif;width:min(960px,94vw)}.ml-import-filename,.ml-import-source{overflow-wrap:anywhere}.ml-import-filename{font-weight:600;margin-top:0}.ml-import-help{color:#60756b}.ml-import-issues{padding:12px 16px;background:#fff9ed;border:1px solid #efdfb9;border-radius:8px;margin:16px 0}.ml-import-issues h3{font-size:14px;margin:0}.ml-import-issues ul{padding-left:20px;margin-bottom:0}.ml-import-table{overflow-x:auto;margin:18px 0 4px;border:1px solid #d4e0d9;border-radius:7px}.ml-import-table table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}.ml-import-table th,.ml-import-table td{padding:10px;border-bottom:1px solid #e4ebe7;text-align:left}.ml-import-table th{background:#eaf2ee;white-space:nowrap}.ml-import-table .ml-number{text-align:right;white-space:nowrap}.ml-import-table td:first-child{min-width:170px}.ml-import-table small{display:block;color:#60756b;font-size:11px;margin-top:3px}.ml-import-status{min-height:22px;color:#347351}
@media(max-width:600px){.ml-heading-actions{width:100%;gap:8px}.ml-import .ml-dialog-head,.ml-import .ml-dialog-content,.ml-import .ml-dialog-foot{padding:12px}.ml-import .ml-dialog-head h2{font-size:18px}.ml-import-table th,.ml-import-table td{padding:8px}.ml-import-table td:first-child{min-width:130px}}

/* Ledger layout: one document table, aligned inputs, no fixed bottom toolbar. */
.ml-page{padding:24px;background:var(--card-bg,#fff);font-family:Arial,sans-serif;color:var(--text,#243831)}
.ml-page>.ml-heading{align-items:center;margin-bottom:22px;gap:16px}.ml-page>.ml-heading h1{font-size:24px;line-height:1.25;margin:0}.ml-page .ml-heading-actions{margin:0;margin-left:auto}
.ml-page>.ml-tools{display:grid;grid-template-columns:minmax(180px,250px) minmax(220px,1fr) auto;gap:12px;align-items:end}.ml-page>.ml-tools .ml-field{min-width:0}.ml-page>.ml-tools input,.ml-page>.ml-tools select,.ml-page>.ml-tools .ml-button{height:40px;width:100%}
.ml-page>.ml-notice:empty{display:none}.ml-page>.ml-status{margin:16px 0;font-size:13px;line-height:1.5;color:#62766c}.ml-page>.ml-recovery{display:flex;gap:8px;flex-wrap:wrap;margin:-6px 0 16px}.ml-page>.ml-recovery[hidden]{display:none}
.ml-page>.ml-scroll{height:auto;max-height:none;overflow-x:auto;border:1px solid #d5e1da;border-radius:8px}.ml-page>.ml-scroll:focus{outline:none}.ml-page>.ml-scroll:focus-visible{outline:2px solid #478e71;outline-offset:2px}
.ml-page>.ml-scroll>.ml-table{table-layout:fixed;min-width:1040px;width:100%;font-family:inherit;font-size:14px;line-height:1.4}
.ml-page .ml-table th,.ml-page .ml-table td{font-family:inherit;vertical-align:middle;box-sizing:border-box;padding:10px 12px}.ml-page .ml-table th{font-weight:600;font-size:12px;line-height:1.4;white-space:normal;color:#40564b;background:#edf4ef;padding-top:14px;padding-bottom:14px}
.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(1){width:32%}.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(2){width:5%}.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(3){width:12%}.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(4),.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(5){width:10%}.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(6){width:11%}.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(7){width:20%}
.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(n+3):nth-child(-n+6){text-align:right}.ml-page .ml-table .ml-name{min-width:0;max-width:none;overflow-wrap:anywhere;box-shadow:none}.ml-page .ml-table .ml-unit{min-width:0}.ml-page .ml-table .ml-number{min-width:0}.ml-page .ml-table td input{height:36px;width:100%;min-width:0;max-width:none;font:inherit;border-color:#d5e1da;background:#fff;padding:7px 9px;border-radius:5px;box-sizing:border-box}.ml-page .ml-table .ml-number input{text-align:right;font-variant-numeric:tabular-nums;appearance:textfield}.ml-page .ml-table .ml-number input::-webkit-inner-spin-button,.ml-page .ml-table .ml-number input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.ml-page .ml-table .ml-balance input{font-weight:600;background:#f4faf6;border-color:#bcd5c6}.ml-page .ml-table .ml-group td{padding:11px 12px;background:#f3f7f4;font-size:14px}.ml-page .ml-table td small:empty{display:none}.ml-page .ml-table .ml-formula{max-width:none;font-size:11px;margin-top:5px}.ml-page .ml-table .ml-mapping-table th{width:auto}
@media(max-width:700px){.ml-page{padding:18px 12px}.ml-page>.ml-heading{gap:14px;margin-bottom:18px}.ml-page>.ml-heading h1{font-size:21px}.ml-page .ml-heading-actions{margin:0;width:100%}.ml-page>.ml-tools{grid-template-columns:minmax(0,1fr) auto;gap:10px}.ml-page>.ml-tools .ml-field:first-child{grid-column:1/-1}.ml-page>.ml-status{font-size:12px}.ml-page>.ml-scroll>.ml-table{min-width:960px}.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(1){width:25%}.ml-page .ml-table:not(.ml-mapping-table) th:nth-child(7){width:27%}.ml-page .ml-table .ml-name{font-size:13px}.ml-page .ml-table th,.ml-page .ml-table td{padding-left:10px;padding-right:10px}}

.ml-import-history{width:min(1250px,calc(100vw - 24px))}.ml-import-history-wrap{overflow-x:auto}.ml-import-history-table{width:100%;border-collapse:collapse;font-size:13px}.ml-import-history-table th,.ml-import-history-table td{padding:12px;text-align:left;vertical-align:top;border-bottom:1px solid #dde7e2}.ml-import-history-table th{background:#edf4f0;font-weight:600}.ml-import-history-table td:first-child,.ml-import-history-table td:nth-child(2){white-space:nowrap}.ml-import-document{min-width:170px;overflow-wrap:anywhere}.ml-import-explanation{min-width:280px;white-space:pre-line;overflow-wrap:anywhere;line-height:1.55}.ml-import-state{min-width:130px}.ml-import-state--success{color:#26734e}.ml-import-state--partial{color:#896215}.ml-import-state--failed{color:#b53d35}.ml-import-delete{color:#b53d35;padding:8px;display:grid;place-items:center}.ml-import-delete svg{width:18px;height:18px}.ml-import-history .ml-dialog-foot{align-items:center;gap:12px}.ml-heading-actions{flex-wrap:wrap}

.ml-import-history{font:14px/1.5 Arial,sans-serif;color:#253c36}

/* The CRM shell locks body scrolling; let the ledger section own vertical scroll. */
#section-molding-ledger{overflow-y:auto;overflow-x:hidden;min-height:0;scrollbar-gutter:stable;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
#section-molding-ledger>#molding-ledger-root{flex:0 0 auto;min-width:0;box-sizing:border-box;width:100%}

/* The same editable cells become product cards on phones; saving and formulas stay shared. */
.ml-mobile-unit,.ml-actions-toggle{display:none}
@media(max-width:760px){
 #molding-ledger-root.ml-page{padding:16px 4px 28px;width:100%;min-width:0;box-sizing:border-box;background:transparent;border-radius:0}
 #molding-ledger-root>.ml-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px 10px;margin-bottom:20px}
 #molding-ledger-root>.ml-heading h1{font-size:23px;line-height:1.2;letter-spacing:-.4px;margin:0}
 #molding-ledger-root .ml-actions-toggle{display:block;min-height:44px;font-size:14px;background:var(--card-bg,#fff)}
 #molding-ledger-root .ml-actions-toggle::after{content:' ▾'}
 #molding-ledger-root .ml-actions-toggle[aria-expanded=true]::after{content:' ▴'}
 #molding-ledger-root .ml-heading-actions{display:none;grid-column:1/-1;margin:0;width:100%;gap:8px}
 #molding-ledger-root .ml-heading-actions.ml-actions-open{display:grid;grid-template-columns:1fr 1fr}
 #molding-ledger-root .ml-heading-actions .ml-button{min-height:46px;white-space:normal;font-size:13px;line-height:1.35;padding:10px}
 #molding-ledger-root .ml-heading-actions [hidden]{display:none}
 #molding-ledger-root>.ml-tools{grid-template-columns:minmax(0,1fr) auto;gap:12px 10px}
 #molding-ledger-root>.ml-tools .ml-field:first-child{grid-column:1/-1}
 #molding-ledger-root>.ml-tools .ml-field{font-size:13px;gap:6px}
 #molding-ledger-root>.ml-tools input,#molding-ledger-root>.ml-tools select{height:46px;font-size:16px;background:var(--card-bg,#fff);width:100%}
 #molding-ledger-root>.ml-tools .ml-button{height:46px;font-size:14px;background:var(--card-bg,#fff)}
 #molding-ledger-root>.ml-status{font-size:12px;line-height:1.5;margin:14px 0;overflow-wrap:anywhere}
 #molding-ledger-root>.ml-scroll{border:0;border-radius:0;overflow:visible;width:100%}
 #molding-ledger-root>.ml-scroll>.ml-table{display:block;table-layout:auto;min-width:0;width:100%;font-size:15px}
 #molding-ledger-root .ml-table>thead{display:none}
 #molding-ledger-root .ml-table>tbody{display:block;width:100%}
 #molding-ledger-root .ml-table tr[data-item]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px 10px;margin-bottom:14px;padding:16px;border:1px solid #d5e1da;border-radius:12px;background:var(--card-bg,#fff)}
 #molding-ledger-root .ml-table tr[data-item]>td{display:block;position:static;min-width:0;max-width:none;width:auto;padding:0;border:0;box-shadow:none;background:transparent;text-align:left;overflow-wrap:anywhere}
 #molding-ledger-root .ml-table tr[data-item]>.ml-name{grid-column:1/-1;grid-row:1;font-size:16px;line-height:1.45;font-weight:600}
 #molding-ledger-root .ml-mobile-unit{display:inline-block;margin-left:8px;font-size:12px;font-weight:400;color:#62766c;white-space:nowrap}
 #molding-ledger-root .ml-table tr[data-item]>.ml-unit{display:none}
 #molding-ledger-root .ml-table td[data-label]::before{content:attr(data-label);display:block;font-size:12px;line-height:1.35;color:#60756b;margin-bottom:6px;font-weight:400}
 #molding-ledger-root .ml-table td[data-column=opening],#molding-ledger-root .ml-table td[data-column=income],#molding-ledger-root .ml-table td[data-column=expense]{grid-row:3}
 #molding-ledger-root .ml-table td[data-column=opening]::before,#molding-ledger-root .ml-table td[data-column=income]::before,#molding-ledger-root .ml-table td[data-column=expense]::before{min-height:32px}
 #molding-ledger-root .ml-table tr[data-item]>.ml-balance{grid-column:1/-1;grid-row:2;display:grid;grid-template-columns:1fr minmax(110px,48%);align-items:center;gap:4px 12px;padding:12px;background:var(--bg,#f3f8f5);border-radius:8px}
 #molding-ledger-root .ml-table .ml-balance::before{font-size:14px;font-weight:600;margin:0;color:inherit}
 #molding-ledger-root .ml-table .ml-balance small{grid-column:1/-1;text-align:right}
 #molding-ledger-root .ml-table td input{height:46px;padding:10px 8px;font-size:16px;border-radius:7px}
 #molding-ledger-root .ml-table .ml-balance input{font-size:24px!important;font-weight:700;height:48px;color:#276347;background:var(--card-bg,#fff)}
 #molding-ledger-root .ml-table tr[data-item]>.ml-note{grid-column:1/-1;grid-row:4;padding-top:12px;border-top:1px solid #e4ebe7}
 #molding-ledger-root .ml-table .ml-formula{font-size:12px;min-height:36px;line-height:1.35;padding:6px 0}
 #molding-ledger-root .ml-table .ml-group{display:block;margin:22px 0 12px}
 #molding-ledger-root .ml-table .ml-group:first-child{margin-top:4px}
 #molding-ledger-root .ml-table .ml-group td{display:block;background:transparent;padding:0;border:0;font-size:16px;line-height:1.4;color:inherit;font-weight:700}
 #molding-ledger-root .ml-mapping-table tr[data-item]>td:nth-child(n+3){grid-column:1/-1}
 #molding-ledger-root .ml-mapping-table .ml-button{min-height:44px;width:100%;font-size:15px}
 .ml-dialog{box-sizing:border-box;width:calc(100vw - 16px);max-width:none;max-height:calc(100dvh - 24px)}
 .ml-dialog input,.ml-dialog select{font-size:16px}
 .ml-dialog .ml-button{min-height:44px}
}
