/* Scope to list cells; preserve form, document and print layouts. */
@media screen{
#main table .ui-list-left,dialog table .ui-list-left{text-align:left!important}
#main table .ui-list-center,dialog table .ui-list-center{text-align:center!important;white-space:nowrap!important}
#main table .ui-list-right,dialog table .ui-list-right{text-align:right!important;white-space:nowrap!important;font-variant-numeric:tabular-nums}
.ui-list-left>.business-column-menu{justify-content:space-between!important}
.ui-list-center>.business-column-menu{justify-content:center!important;gap:6px}
.ui-list-right>.business-column-menu{justify-content:flex-end!important;gap:6px}
.ui-list-left .link{text-align:left!important;white-space:normal;overflow-wrap:anywhere}
#main .ui-filter-reset{height:32px;min-height:32px;font-size:13px;line-height:20px;padding:5px 10px;white-space:nowrap;flex-shrink:0}
#business-mine .business-mine-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
#business-mine .business-mine-tools input{width:300px;max-width:100%;flex:0 1 300px}
#business-mine .business-mine-tools .business-mine-stats{flex:1 1 auto;min-width:0}
.notice-history-search,.update-history-toolbar,.approval-list-toolbar,.expense-toolbar{gap:8px;flex-wrap:wrap}
#main :is(.filters,.ops-toolbar,.business-toolbar,.person-list-tools) input[type=search]{min-width:0;max-width:100%}
#main .table-wrap{max-width:100%}
#main .stock-compact{min-width:1450px!important}
#main .stock-compact th{overflow:visible;white-space:nowrap}
#main .ui-search-reset-group{display:flex;align-items:center;gap:8px;min-width:0}
#main .ui-search-reset-group input{flex:1;min-width:0}
#main .ui-search-reset-group button{width:auto!important;flex:0 0 auto}
#main .update-history-toolbar{display:flex!important;align-items:flex-end;gap:8px;flex-wrap:wrap}
#main .update-history-toolbar>label{flex:0 1 130px;min-width:0}
#main .update-history-toolbar>.update-history-query{flex:1 1 180px;min-width:160px}
#main .update-history-toolbar>button{flex:0 0 auto}
#business-overview .overview-table{min-width:1350px!important}
dialog th:has(>.business-column-menu[data-column-menu="priority"]){width:86px!important;padding-left:8px!important;padding-right:8px!important}
#business-overview .business-completed-date{width:110px!important}
#business-person-tasks:not(.popup-maximized),#business-monthly-popup:not(.popup-maximized){left:max(20px,calc((100vw - 1200px)/2));max-width:calc(100vw - 40px)!important}
#business-person-tasks .person-task-table table{min-width:1050px}
#business-person-tasks .person-task-table td:has(>.ui-note-preview){white-space:normal!important;overflow:visible!important;text-overflow:clip}
#main table .ui-list-total>*{font-weight:700!important}
.ui-note-preview>.approval-note{display:block!important;max-height:none!important;overflow:visible!important;-webkit-line-clamp:unset!important}
#main th:has(>.business-column-menu[data-column-menu="category"]){width:76px!important;padding-left:8px!important;padding-right:8px!important}
#main th:has(>.business-column-menu[data-column-menu="priority"]){width:86px!important;padding-left:8px!important;padding-right:8px!important}
#expense-table .expense-list{min-width:1250px!important}
#expense-table .expense-list th:nth-child(1){width:165px!important}
#expense-table .expense-list th:nth-child(2),#expense-table .expense-list th:nth-child(8){width:110px!important}
#expense-table .expense-list th:nth-child(3){width:auto!important}
#expense-table .expense-list th:nth-child(4){width:130px!important}
#expense-table .expense-list th:nth-child(5){width:140px!important}
#expense-table .expense-list th:nth-child(6){width:130px!important}
#expense-table .expense-list th:nth-child(7){width:120px!important}
#main .accounting-ledger-filters{display:flex!important;align-items:flex-end!important;flex-wrap:wrap!important;gap:8px!important}
#main .accounting-ledger-filters>label{flex:1 1 200px;min-width:160px}
#main .accounting-ledger-filters>button{width:auto!important;flex:0 0 auto;order:0!important}
#main .accounting-balance-summary{flex:1 1 100%;max-width:100%;white-space:normal}
#main .notice-history-search button,#main .update-history-toolbar button{font-size:13px;line-height:20px;min-height:32px;height:32px;padding:5px 10px;white-space:nowrap}
#business-progress #business-content>.table-wrap>table{min-width:1500px!important}
#business-progress .business-completed-list table{min-width:1250px!important}
#business-mine #business-mine-list table{min-width:1350px!important}
#business-mine .business-completed-list table{min-width:1150px!important}
#main .approval-page table{min-width:1450px!important}
#main .approval-page th:nth-child(8){width:auto!important;min-width:220px}
#main .approval-page th:nth-child(9){width:90px!important}
#main .approval-page th:nth-child(10){width:150px!important}
#main .business-completed-list .table-wrap,#business-mine .business-mine-table{overflow-x:auto!important}
#main .ui-note-preview,dialog .ui-note-preview{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;max-height:6.4em;line-height:1.6;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere;cursor:help;text-align:left}
.ui-note-preview:focus-visible{outline:2px solid #3977d4;outline-offset:3px}
.ui-note-tooltip{position:fixed;z-index:2147483646;box-sizing:border-box;max-height:min(480px,70vh);overflow:auto;padding:14px 16px;border:1px solid #cad8e9;border-radius:8px;background:#fff;color:#203c5b;box-shadow:0 6px 24px #18365430;font:13px/1.65 'Malgun Gothic',sans-serif}
.ui-note-tooltip strong{display:block;margin-bottom:8px;font-size:13px}.ui-note-tooltip>div{white-space:pre-wrap;overflow-wrap:anywhere}
}

/* Compact purchase-ledger balance, outside the search controls. */
.accounting-page-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}
#main .accounting-ledger-card>.ledger-tools>.accounting-balance-summary{flex:0 1 auto;width:auto;min-width:280px;margin:0 0 0 auto;padding:8px 14px;display:grid;grid-template-columns:auto auto;align-items:baseline;gap:2px 16px;background:#edf4ff;border:1px solid #d4e2f7;text-align:right}
#main .accounting-ledger-card>.ledger-tools>.accounting-balance-summary>span:first-child{white-space:nowrap;text-align:left}
#main .accounting-ledger-card>.ledger-tools>.accounting-balance-summary>.tiny{grid-column:1/-1;margin:0}
@media(max-width:600px){#main .accounting-ledger-card>.ledger-tools>.accounting-balance-summary{min-width:0;max-width:100%;gap:2px 10px}#main .accounting-ledger-card>.ledger-tools>.accounting-balance-summary strong{font-size:20px}}

#main .accounting-ledger-card>.ledger-tools>.accounting-balance-summary{padding:5px 12px;min-width:280px;flex:0 0 auto;max-width:100%;box-sizing:border-box}
#main .accounting-ledger-card>.ledger-tools>.ledger-tool-group:has(+.accounting-balance-summary){border-right:0;padding-right:0}

/* Ledger: compact query row and a single controls row. */
#main .accounting-ledger-card>.accounting-ledger-filters{display:grid!important;grid-template-columns:minmax(150px,1fr) auto auto minmax(150px,1fr) minmax(150px,1fr) 300px!important;align-items:end!important}
#main .accounting-ledger-filters>label{min-width:0!important;order:0!important}
#main .accounting-ledger-filters>.accounting-balance-summary{order:0;grid-column:auto;min-width:0;width:auto;margin:0;padding:5px 10px!important;display:grid;grid-template-columns:auto auto!important;gap:2px 8px;align-items:center;box-sizing:border-box}
#main .accounting-ledger-filters>.accounting-balance-summary>span:first-child{white-space:nowrap;text-align:left}
#main .accounting-ledger-filters>.accounting-balance-summary>.tiny{grid-column:1/-1;margin:0;white-space:nowrap;font-size:11px}
#main .accounting-ledger-filters>.accounting-balance-summary strong{font-size:21px}
#main .ledger-controls-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px 18px;border-bottom:1px solid #e1e7ef;padding:4px 0 7px;margin-bottom:5px}
#main .ledger-controls-row>.ledger-view-options{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0;padding:0;flex:0 0 auto}
#main .ledger-controls-row>.ledger-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px 14px;border:0;margin:0;padding:0}
@media(max-width:1150px){#main .accounting-ledger-card>.accounting-ledger-filters{grid-template-columns:minmax(140px,1fr) auto auto minmax(140px,1fr)!important}#main .accounting-ledger-filters>label:has(#accounting-month){grid-column:1/4}#main .accounting-ledger-filters>.accounting-balance-summary{grid-column:4}}
@media(max-width:650px){#main .accounting-ledger-card>.accounting-ledger-filters{grid-template-columns:minmax(0,1fr) auto auto!important}#main .accounting-ledger-filters>label:has(#accounting-vendor),#main .accounting-ledger-filters>label:has(#accounting-month),#main .accounting-ledger-filters>.accounting-balance-summary{grid-column:1/-1}}

/* Typed approval list: document number, type, date, title, author, total, stage, actions, completed. */
#expense-table .expense-typed-list{min-width:1300px!important;table-layout:fixed}
#expense-table .expense-typed-list :is(th,td){text-align:left;white-space:normal}
#expense-table .expense-typed-list th:nth-child(1){width:155px!important}
#expense-table .expense-typed-list th:nth-child(2){width:95px!important}
#expense-table .expense-typed-list th:nth-child(3),#expense-table .expense-typed-list th:nth-child(9){width:110px!important}
#expense-table .expense-typed-list th:nth-child(4){width:auto!important}
#expense-table .expense-typed-list th:nth-child(5){width:130px!important}
#expense-table .expense-typed-list th:nth-child(6){width:130px!important}
#expense-table .expense-typed-list th:nth-child(7){width:110px!important}
#expense-table .expense-typed-list th:nth-child(8){width:170px!important}
#expense-table .expense-typed-list :is(th,td):is(:nth-child(2),:nth-child(3),:nth-child(7),:nth-child(8),:nth-child(9)){text-align:center}
#expense-table .expense-typed-list :is(th,td):nth-child(6){text-align:right}
#expense-table .expense-typed-list .business-column-menu{justify-content:space-between!important}
#expense-form [hidden]{display:none!important}
#expense-form[data-document-type="draft_proposal"] .expense-basic-row{grid-template-columns:2fr 1fr}

/* Approval header actions: matching dimensions, distinct document colors. */
#main :is(#expense-notices,#proposal-new,#expense-new){box-sizing:border-box;width:140px;min-width:140px;height:38px;min-height:38px;padding:0 12px!important;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:13px!important;line-height:1.2;font-weight:600;border-radius:5px}
#main #proposal-new{background:#7550b8!important;border-color:#7550b8!important;color:#fff!important}
#main #proposal-new:hover{background:#63409e!important;border-color:#63409e!important}
#main #proposal-new:focus-visible{outline:2px solid #7550b8;outline-offset:2px}

/* Common header refresh action. */
.topbar #app-refresh{background:#e8f3ee!important;border:1px solid #bfdccd!important;color:#285f49!important;border-radius:5px;padding:0 13px!important;height:38px;min-height:38px;white-space:nowrap;font-size:13px!important;line-height:1.2}
.topbar #app-refresh:hover{background:#d9ece2!important}.topbar #app-refresh:focus-visible{outline:2px solid #669d83;outline-offset:2px}
