/* Presentation only. Screen-only to preserve printed documents. */
@media screen {
:root{--ink:#202734;--muted:#596575;--blue:#2563db;--line:#dce2ea;--bg:#f4f6fa;--panel:#fff;--soft:#eaf1ff;--nav:#fff;font-family:'Malgun Gothic','맑은 고딕',sans-serif}
body,button,input,select,textarea{font-family:'Malgun Gothic','맑은 고딕',sans-serif}
body{background:var(--bg);color:var(--ink)}
.topbar{background:#fff;border-bottom:1px solid #dce2ea;padding:10px 20px;min-height:58px}
.sidebar{background:#fff;color:#263446;border-right:1px solid #dce2ea;padding:16px 10px}
.sidebar button,.sidebar .nav-group>summary{color:#374456;font-size:14px;padding:8px 12px;min-height:38px;line-height:22px;margin-bottom:3px}
.sidebar button.selected{background:#e9f1ff;color:#1355c4;box-shadow:inset 3px 0 #2865dc;font-weight:700}
.sidebar button:hover,.sidebar .nav-group>summary:hover{background:#f0f4fa;color:#174fa3}
.sidebar .nav-title{color:#68778b;font-size:10px;margin-bottom:14px}
.sidebar .nav-group{border-color:#e3e8ef;margin-top:8px;padding-top:8px}
.sidebar .bottom-note{border-color:#e3e8ef;color:#6b7685;font-size:11px;padding:12px;margin-top:12px}
.sidebar #messenger-launch{background:#edf3ff;color:#1d54ad;border-color:#ccdafa}
button{border-color:#cdd5e0;color:#273549;background:#fff;border-radius:5px}
button.primary{background:#2563db;border-color:#2563db;color:#fff}
button.primary:hover{background:#174ead;border-color:#174ead}
button:not(.primary):not(.vendor-danger-delete):not(.selected):hover{background:#edf3ff;border-color:#a7bce2}
input,select,textarea{background:#fff;border-color:#bcc8d8;color:#202734;border-radius:5px;accent-color:#2563db}
input::placeholder,textarea::placeholder{color:#737f90}
:is(button,a,input,select,textarea):focus-visible{outline:2px solid #2563db;outline-offset:2px}
.card,.panel,.table-wrap,dialog{background:#fff;border-color:#dce2ea;border-radius:7px;box-shadow:none}
th,.card th{background:#eef2f7;color:#37465b;border-bottom:1px solid #ccd7e5;font-weight:700}
td,.card td{border-bottom-color:#e7ecf2;color:#202d40}
.card td.stock-difference,td.stock-difference{color:#b3302d;font-weight:700}
.sidebar{scrollbar-color:#c8d1de #f5f7fa;scrollbar-width:thin}
tbody tr:hover{background:#f4f8ff}
.popup-window-tools{background:#234b80!important}
.popup-window-tools button{color:#234b80!important;border-color:#ccd7e5!important}
dialog,#messenger-panel,#msg-action{border-color:#bbcce1!important}
.muted{color:#596575}.chart .line{stroke:#2563db}.chart .point{fill:#2563db}
.main{max-width:none;margin:0;padding:16px 20px}
.page-head,.section-title{margin-bottom:10px;align-items:center;gap:8px 14px;flex-wrap:wrap}
.page-head h1,.section-title h1{margin:0;color:#182a44}
.page-head>div:first-child{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px 14px}
.page-head>div:first-child p{margin:0;font-size:12px}
.page-head>.row{gap:6px;flex-wrap:wrap}
.page-head button,.supply-page-head button,.sub-page-tabs button{height:32px;min-height:32px;padding:0 11px;font-size:13px;border-radius:5px;white-space:nowrap}
.filters,.accounting-ledger-filters{background:#f5f7fb;border:1px solid #dce2ea;border-radius:6px;padding:10px;gap:8px;margin-bottom:8px}
.filters label{gap:3px;color:#41516a}
/* Real action groups: original button IDs and handlers remain unchanged. */
.stock-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px 14px;padding:9px 0;margin:0 0 8px;border-bottom:1px solid #e1e7ef}
.stock-tool-group{display:flex;flex-wrap:wrap;align-items:center;gap:5px;padding-right:14px;border-right:1px solid #dae2ed}
.stock-tool-group:last-child{border-right:0;padding-right:0}
.stock-tool-group>span{color:#596575;font-size:11px;font-weight:700;margin-right:3px;white-space:nowrap}
.stock-tools button{height:32px;min-height:32px;margin:0;padding:0 10px;font-size:12px;white-space:nowrap}
.stock-tools #material-receipt,.stock-tools #material-upload{background:#2563db;color:#fff;border-color:#2563db}
.stock-tools #material-period-delete{color:#9f3030;border-color:#e2c7c7}
.material-main-card{padding:10px 12px!important;display:flex;flex-direction:column}
.material-main-card>.row:first-child{display:grid;grid-template-columns:155px 160px minmax(180px,1fr) 160px 150px 145px;gap:8px 12px;padding:10px;background:#f5f7fb;border:1px solid #dce2ea;border-radius:6px;margin:0}
.material-main-card>.row:first-child>label{margin:0;gap:3px;font-size:12px;color:#41516a;min-width:0}
.material-main-card>.row:first-child>label:has(#material-period){order:0}
.material-main-card>.row:first-child>label:has(#material-vendor){order:1}
.material-main-card>.row:first-child>label:has(#material-search){order:2}
.material-main-card>.row:first-child>label:has(#material-status){order:3}
.material-main-card>.row:first-child>label:has(#material-view){order:4}
.material-main-card>.row:first-child>label:has(#material-sort){order:5}
.material-main-card>.row:first-child :is(input,select){height:32px;padding:4px 8px;width:100%;max-width:none;font-size:13px}
.material-context-row{display:flex;align-items:center;justify-content:space-between;gap:6px 12px;margin:0 0 7px;padding:0;flex-wrap:wrap}
.stock-formula{font-size:12px;color:#596575;max-width:700px}
.stock-formula summary{cursor:pointer;color:#465d7e}
.stock-formula p{margin:6px 0 0;line-height:1.5}
.material-context-row>#material-summary{margin:0;padding:0;gap:6px;min-height:30px}
#material-confirm-all{margin-right:6px}
.material-main-card>.notice{padding:6px 10px;margin:0 0 7px;font-size:12px}
#material-totals{background:#edf4ff;border:1px solid #d4e2f7;border-left:3px solid #2563db;border-radius:5px;padding:8px 12px;margin:0 0 8px;gap:8px 20px}
#material-totals .material-grand-total{color:#1552b5;font-size:19px}
#material-totals .material-vendor-total{color:#263c5b;font-size:15px}
.material-grid{max-height:calc(100vh - 330px);min-height:240px}
.material-grid thead{z-index:2}
.material-grid:not(.material-summary-view) :is(th,td):is(:nth-child(6),:nth-child(9)){background:#eaf0f8;color:#142f53}
.material-grid:not(.material-summary-view) td:nth-child(12){background:#f5f8fd}
.material-grid:not(.material-summary-view) tbody td:nth-child(2){color:#344b6b}
.accounting-ledger-card{padding:10px 12px}
.accounting-ledger-card .accounting-ledger-filters{display:grid!important;grid-template-columns:minmax(190px,1fr) minmax(210px,1fr) 145px auto auto minmax(230px,1fr);align-items:end!important;gap:8px!important}
.accounting-ledger-card .accounting-ledger-filters>label{display:grid;gap:3px!important;min-width:0;font-size:12px}
.accounting-ledger-filters>label:has(#accounting-query){order:0}
.accounting-ledger-filters>label:has(#accounting-vendor){order:1}
.accounting-ledger-filters>label:has(#accounting-month){order:2}
#accounting-search{order:3;background:#2563db;color:#fff;border-color:#2563db}#accounting-reset{order:4}
.accounting-ledger-filters .accounting-balance-summary{order:5;grid-column:auto;margin:0;padding:6px 12px!important;background:#edf4ff;border-color:#d4e2f7}
.accounting-ledger-card .accounting-ledger-filters :is(input,select){width:100%!important;max-width:none!important;height:32px;font-size:13px}
.accounting-ledger-card>.row{padding:5px 2px;gap:8px!important}
.accounting-ledger-card>.notice{padding:3px 2px!important;margin-bottom:6px;font-size:12px}
.sub-main-card{padding:10px 12px}
.sub-main-card>.row:first-child{padding:10px;background:#f5f7fb;border:1px solid #dce2ea;border-radius:6px;gap:8px 12px;margin-bottom:8px}
.sub-main-card>.row:first-child>label{gap:3px}
.sub-main-card>.row:first-child>label:last-child{flex:1;min-width:220px}
.sub-page-head,.sub-page-tabs{margin-bottom:8px}
.supply-page-head{display:flex;justify-content:flex-start;gap:6px 10px!important;padding:0 0 10px;border-bottom:1px solid #dce2ea;margin-bottom:8px!important}
.supply-page-head h1{margin-right:18px!important}
.supply-flow-guide,.supply-rule-guide,.supply-sync-guide{font-size:12px;margin:3px 0!important;line-height:1.5}
.supply-week>.table-wrap,.supply-week>.card{width:100%!important;max-width:none!important}
.supply-week h3{font-size:14px;margin:12px 0 6px;color:#253f62}
@media(min-width:1100px){.shell{grid-template-columns:185px minmax(0,1fr);align-items:start}.topbar{position:sticky;top:0;z-index:110}.sidebar{position:sticky;top:58px;height:calc(100vh - 58px);overflow:auto}.sidebar .nav-group>summary{font-weight:700}}
@media(max-width:1250px){.material-main-card>.row:first-child{grid-template-columns:repeat(3,minmax(0,1fr))}.accounting-ledger-card .accounting-ledger-filters{grid-template-columns:repeat(3,minmax(0,1fr))}.stock-tools{gap:8px}.stock-tool-group{padding-right:8px}.material-grid{max-height:62vh}}
@media(max-width:700px){.material-main-card>.row:first-child,.accounting-ledger-card .accounting-ledger-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.stock-tool-group{border:0;flex:1 1 100%;padding:0}.stock-tool-group>span{width:64px}.main{padding:12px}.sidebar{position:static;height:auto}.material-grid{max-height:65vh}.accounting-ledger-filters .accounting-balance-summary{grid-column:1/-1}}
}

/* Ledger controls: display-only grouping, shared by AP and AR. */
@media screen {
 .accounting-page-head{margin-bottom:8px!important}
 .accounting-ledger-card .accounting-ledger-filters{padding-bottom:8px;border-bottom:1px solid #e1e7ef;margin-bottom:0!important}
 .ledger-view-options{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;padding:7px 0 4px}
 .ledger-view-options label{display:flex;align-items:center;gap:6px;margin:0;font-size:12px}
 .ledger-group-label,.ledger-tool-group>span{color:#596575;font-size:11px;font-weight:700;white-space:nowrap}
 .ledger-view-options select{height:30px;padding:3px 8px;font-size:12px}
 .ledger-view-options input[type=checkbox]{margin:0;width:16px;height:16px}
 .ledger-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px 14px;padding:7px 0;margin-bottom:5px;border-bottom:1px solid #e1e7ef}
 .ledger-tool-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding-right:14px;border-right:1px solid #dae2ed}
 .ledger-tool-group:last-child{border-right:0;padding-right:0}
 .ledger-tools button{height:32px;min-height:32px;padding:0 10px;margin:0;font-size:12px;white-space:nowrap}
 .accounting-ledger-card .accounting-ledger-filters>button{height:32px;min-height:32px;padding:0 12px;margin:0}
}
@media screen {.accounting-ledger-card .accounting-balance-summary>span:first-child{white-space:nowrap}.accounting-ledger-card .accounting-balance-summary{grid-template-columns:auto auto!important}.accounting-ledger-card .accounting-balance-summary strong{white-space:nowrap}}

@media screen {
 .supply-control-card{padding:8px 12px;margin-bottom:10px}
 .supply-control-card .ledger-tools{padding-top:0}
 .order-tools a.button{display:inline-flex;align-items:center;height:32px;min-height:32px;padding:0 10px;margin:0;font-size:12px;white-space:nowrap}
 .supply-control-card .supply-compact-guide p{margin:3px 0!important;padding:0!important;font-size:12px;line-height:1.5}
 .sub-main-card .sub-search-conditions{display:grid;grid-template-columns:minmax(270px,1.2fr) minmax(140px,.55fr) minmax(250px,1.5fr);gap:8px;align-items:end;padding-bottom:9px;border-bottom:1px solid #e1e7ef}
 .sub-search-conditions label{display:grid;gap:4px;margin:0;min-width:0;font-size:12px}
 .sub-search-conditions :is(select,input){width:100%;max-width:none!important;height:32px;margin:0;font-size:13px}
 .sub-main-card .order-tools{margin:0 0 5px}
 .sub-order-group{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:5px 0 7px}
 .sub-order-group #sub-orders{margin:0!important;gap:6px;justify-content:flex-start}
 .sub-order-group #sub-orders button{height:32px;min-height:32px;padding:0 10px;margin:0;font-size:12px}
 .sub-main-card>.tiny{margin:4px 0!important;padding:0!important}
 @media(max-width:800px){.sub-main-card .sub-search-conditions{grid-template-columns:1fr 1fr}.sub-search-conditions label:last-child{grid-column:1/-1}}
}
@media screen {#sub-orders:not(:empty)::before{content:"업체별 발주";color:#596575;font-size:11px;font-weight:700;margin-right:4px;white-space:nowrap}#sub-orders{align-items:center;gap:6px!important}#sub-orders button{height:32px;min-height:32px;padding:0 10px;margin:0;font-size:12px}}

@media screen {
 .raw-page-head{margin-bottom:8px!important}
 .raw-page-head p{margin:3px 0 0!important}
 .raw-control-card{padding:10px 12px;margin-bottom:10px}
 .raw-control-card .raw-filters{display:grid;grid-template-columns:minmax(260px,2fr) minmax(130px,.65fr) minmax(170px,.8fr);gap:8px;align-items:end;margin:0!important;padding:0 0 9px!important;background:transparent;border:0;border-bottom:1px solid #e1e7ef;border-radius:0}
 .raw-control-card .raw-filters label{display:grid;gap:4px;margin:0;min-width:0;font-size:12px}
 .raw-control-card .raw-filters :is(input,select){width:100%;max-width:none;height:32px;margin:0;font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px}
 .raw-tools:empty{display:none}
 .raw-compact-guide{display:flex;flex-wrap:wrap;gap:4px 14px;align-items:center;font-size:12px;line-height:1.5}
 .raw-summary{gap:8px;margin-bottom:10px}
 .raw-summary>.panel{padding:9px 12px}
 .price-tools #export-prices{font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;font-weight:400;line-height:1.4;height:34px;min-height:34px;padding:0 10px;display:inline-flex;align-items:center;white-space:nowrap;margin:0}
 .price-tools select{font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;height:34px;min-height:34px;line-height:1.4}
 @media(max-width:700px){.raw-control-card .raw-filters{grid-template-columns:1fr 1fr}.raw-control-card .raw-filters label:first-child{grid-column:1/-1}}
}
@media screen {.raw-control-card .raw-filters{width:100%!important;max-width:none!important;box-sizing:border-box}.raw-control-card .raw-filters label :is(input,select){max-width:none!important;width:100%!important}#main:has(.raw-control-card) .stock-heading :is(button,a.button){font-family:"Malgun Gothic","맑은 고딕",sans-serif;font-size:13px;display:inline-flex;align-items:center;height:32px;min-height:32px;line-height:1.4;padding:0 10px;margin:0}}

@media screen {
 #main:has(.price-page-head)>.compact-summary{margin:4px 0 7px}
 #main:has(.price-page-head)>.parts{margin:6px 0 8px;gap:5px}
 #main:has(.price-page-head)>.price-search-conditions{display:grid;grid-template-columns:minmax(180px,1fr) 130px 130px minmax(220px,1.4fr) auto auto;align-items:end;gap:8px;padding:10px;margin-bottom:0}
 #main:has(.price-page-head)>.price-search-conditions>label{display:grid;gap:4px;min-width:0;max-width:none;margin:0;font-size:12px}
 #main:has(.price-page-head)>.price-search-conditions>label :is(input,select){width:100%;max-width:none;height:34px;min-height:34px;font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;line-height:1.4;padding:5px 9px}
 .price-search-conditions>.vendor-select{order:0}.price-search-conditions>label:has(#direction-filter){order:1}.price-search-conditions>label:has(#search-field){order:2}.price-search-conditions>label:has(#search){order:3}.price-search-conditions>#search-btn{order:4}.price-search-conditions>#reset-search{order:5}
 #main:has(.price-page-head)>.price-search-conditions>.price-advanced{order:6;grid-column:1/-1;height:auto;margin:0;padding:5px 0 0;border:0;border-top:1px solid #dce2ea;border-radius:0;background:transparent;font-size:12px}
 .price-search-conditions>.price-advanced>.row{margin:7px 0 0;align-items:end;gap:8px}
 .price-search-conditions>.price-advanced label{display:grid;gap:3px;font-size:12px}
 .price-search-conditions>button{height:34px;min-height:34px;padding:0 12px;margin:0;font-size:13px}
 .price-action-tools{padding:8px 0;margin:0;border-bottom:1px solid #dce2ea}
 #main:has(.price-page-head)>.price-tools{margin:6px 0;gap:10px;justify-content:flex-start}
 .price-tools>.row{gap:8px;flex-wrap:wrap}
 .price-tools label{font-size:12px;gap:5px}
 .price-source-note{margin:3px 0 7px;line-height:1.5}
 @media(max-width:1100px){#main:has(.price-page-head)>.price-search-conditions{grid-template-columns:repeat(3,minmax(0,1fr))}}
 @media(max-width:650px){#main:has(.price-page-head)>.price-search-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}}
}
@media screen {.price-search-conditions>.price-advanced>.row{position:static;width:100%;max-width:none;box-sizing:border-box;box-shadow:none;border:0;border-radius:0;background:transparent;padding:5px 0 0;margin:0;display:flex;flex-wrap:wrap}.price-search-conditions>.price-advanced>.row label{flex:0 1 220px}.price-search-conditions>.price-advanced>.row :is(input,select){height:34px;min-height:34px;font-family:"Malgun Gothic","맑은 고딕",sans-serif;font-size:13px;padding:5px 9px}.price-search-conditions>.price-advanced>.row>.tiny{align-self:center}}

/* Shared screen layout: controls may wrap, values/tables remain untouched. */
@media screen {
 .shell>.main,#main{min-width:0;box-sizing:border-box}
 #main :is(.filters,.accounting-ledger-filters,.price-search-conditions,.sub-search-conditions,.raw-filters,.ledger-tools,.stock-tools,.ops-toolbar,.fs-toolbar){box-sizing:border-box;max-width:100%;min-width:0}
 #main :is(.filters,.accounting-ledger-filters,.price-search-conditions,.sub-search-conditions,.raw-filters,.ops-toolbar) :is(label,input,select,button){box-sizing:border-box;min-width:0;max-width:100%}
 #main :is(.filters,.ops-toolbar){flex-wrap:wrap;gap:8px;align-items:end}
 #main :is(.filters,.ops-toolbar)>label{margin:0;gap:4px;font-size:12px;flex:1 1 170px}
 #main :is(.filters,.ops-toolbar)>label.grow{flex:2 1 260px}
 #main :is(.filters,.ops-toolbar) :is(input:not([type=checkbox]):not([type=radio]),select){font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;height:34px;min-height:34px;padding:5px 9px}
 #main :is(.filters,.ops-toolbar,.page-head,.section-title,.stock-heading,.work-title-row,.business-toolbar,.settings-grid .row) :is(button,a.button){font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;min-height:32px;padding:5px 10px;line-height:1.4;box-sizing:border-box;white-space:normal}
 #main :is(.page-head,.section-title,.stock-heading,.work-title-row,.ops-toolbar){flex-wrap:wrap;gap:8px 12px}
 #main :is(.page-head,.section-title)>div,#main :is(.row,.filters)>.grow{min-width:0}
 #main>.filters,#main>.panel,#main>.card{margin-bottom:10px}
 #main>h1{margin:0 0 8px;font-size:25px}
 #main>p.muted{margin:4px 0 10px;font-size:12px;line-height:1.5}
 #main:has(.price-page-head)>.price-search-conditions{width:100%;grid-template-columns:minmax(160px,1fr) minmax(145px,.45fr) minmax(130px,.4fr) minmax(180px,1.4fr) 56px 66px;gap:8px}
 #main:has(.price-page-head)>.price-search-conditions>label{width:auto;min-width:0!important;max-width:100%;flex:initial}
 #main:has(.price-page-head)>.price-search-conditions>label :is(input,select){min-width:0!important;box-sizing:border-box}
 #main:has(.price-page-head)>.price-search-conditions>button{width:100%;min-width:0;white-space:nowrap;box-sizing:border-box}
 .finance-controls{padding:10px 12px;margin-bottom:10px}
 .finance-controls .profit-period{margin:0;gap:8px 16px;align-items:end;flex-wrap:wrap}
 .finance-controls .profit-period label{display:grid;gap:4px;font-size:12px;margin:0;min-width:180px}
 .finance-controls select{height:34px;font-size:13px;padding:5px 9px}
 .finance-controls .ledger-tools{padding:8px 0 0;margin:7px 0 0;border-bottom:0;border-top:1px solid #dce2ea}
 .finance-controls .ledger-tool-group:empty{display:none}
 .fs-page{max-width:none;min-width:0}
 .fs-hero{padding:12px 16px!important;gap:8px 20px;flex-wrap:wrap;margin-bottom:10px!important}
 .fs-hero h1{font-size:25px;margin:3px 0!important}.fs-hero p{margin:4px 0!important;font-size:12px}
 .fs-toolbar{display:flex;flex-wrap:wrap;gap:8px 16px;padding:10px 12px!important;margin:0 0 10px!important;align-items:center;background:#fff;border:1px solid #dce2ea;border-radius:6px}
 .fs-toolbar nav,.fs-toolbar .fs-query-group{display:flex;align-items:center;flex-wrap:wrap;gap:7px}
 .fs-toolbar label{font-size:12px;display:flex;align-items:center;gap:5px;margin:0}
 .fs-toolbar :is(button,select,a){font-family:'Malgun Gothic','맑은 고딕',sans-serif!important;font-size:13px!important;box-sizing:border-box;min-height:32px;padding:5px 9px!important;line-height:1.4}
 .fs-kpis{gap:8px!important;margin-bottom:10px!important}.fs-panel{padding:12px!important;margin-bottom:10px!important}
 .stock-heading{margin-bottom:8px!important}.stock-heading h2{margin:0;font-size:20px}.stock-heading p{margin:3px 0;font-size:12px}
 .stock-heading .stock-sync-time{flex:1 1 210px;order:3}.stock-heading .stock-source-link{order:2}.stock-heading .stock-sync-tools{order:1}
 .stock-heading .stock-sync-tools button{height:32px;font-size:13px;margin:0;padding:0 10px}
 .document-search-condition{display:grid;gap:4px;font-size:12px;width:min(100%,600px);max-width:600px!important;margin-bottom:10px!important}
 .document-search-condition input{height:34px;font-size:13px;box-sizing:border-box;width:100%}
 .settings-grid{gap:10px!important}.settings-grid>.panel{padding:12px!important}.settings-grid h2{margin:0 0 8px;font-size:19px}.settings-grid p{margin:6px 0;line-height:1.5}
 .work-hero{padding:12px 16px!important;margin-bottom:10px!important}.work-hero h1{margin:3px 0;font-size:25px}.work-hero p{margin:5px 0;font-size:12px}.work-metrics{gap:8px!important}.work-overview{padding:12px!important;margin-bottom:10px!important}
 @media(max-width:1150px){#main:has(.price-page-head)>.price-search-conditions{grid-template-columns:repeat(3,minmax(0,1fr))}.fs-toolbar{align-items:flex-start}.material-main-card>.row:first-child{grid-template-columns:repeat(3,minmax(0,1fr))}}
 @media(max-width:700px){#main:has(.price-page-head)>.price-search-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.fs-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}.settings-grid{grid-template-columns:1fr!important}.ledger-tool-group{flex-wrap:wrap;max-width:100%;border-right:0}.stock-heading>div:first-child{flex-basis:100%}}
}
/* Common popup presentation only; no form values or behavior changed. */
@media screen {
 dialog:not(.popup-minimized){max-width:calc(100vw - 20px);max-height:calc(100dvh - 20px);box-sizing:border-box}
 dialog>.popup-window-tools .popup-bar-title{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:15px;line-height:1.4;margin-right:6px}
 dialog>.popup-window-tools{gap:5px;align-items:center;padding:6px 8px;min-height:42px}
 dialog>.popup-standard-body{padding:12px 14px!important;max-height:calc(100dvh - 90px)!important;min-width:0;overscroll-behavior:contain;container-type:inline-size}
 dialog.popup-maximized>.popup-standard-body{max-height:none!important}
 dialog .popup-standard-body :is(form,fieldset,.form-grid,.raw-form-grid,.row,.actions){min-width:0;box-sizing:border-box;max-width:100%}
 dialog .popup-standard-body :is(.row,.actions,.supply-form-heading,.raw-register-heading){flex-wrap:wrap;gap:7px 9px;align-items:center}
 dialog .popup-standard-body :is(.row,.actions)>*{min-width:0}
 dialog .popup-standard-body :is(.form-grid,.raw-form-grid){grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;margin:10px 0}
 dialog .popup-standard-body label{font-size:12px;line-height:1.5;gap:4px;min-width:0;overflow-wrap:anywhere}
 dialog .popup-standard-body form>label{margin-bottom:10px}
 dialog .popup-standard-body :is(input,select,textarea){box-sizing:border-box;max-width:100%;min-width:0;font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;line-height:1.5;border-radius:5px}
 dialog .popup-standard-body label> :is(input:not([type=checkbox]):not([type=radio]),select,textarea){width:100%}
 dialog .popup-standard-body :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select){min-height:34px;height:34px;padding:5px 9px}
 dialog .popup-standard-body input[type=file]{height:auto!important;min-height:34px;padding:5px;white-space:normal}
 dialog .popup-standard-body textarea{min-height:80px;height:auto;padding:7px 9px;resize:vertical}
 dialog .popup-standard-body :is(input[type=checkbox],input[type=radio]){width:16px;height:16px;min-height:16px;flex:0 0 16px;padding:0;margin:0 4px 0 0}
 dialog .popup-standard-body button,dialog .popup-standard-body a.button{font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;line-height:1.4;min-height:32px;height:auto;padding:6px 10px;margin:0;max-width:100%;box-sizing:border-box;white-space:normal;overflow-wrap:break-word;word-break:keep-all;flex-shrink:0}
 dialog .popup-standard-body .actions{margin-top:12px;padding-top:9px;border-top:1px solid #dce2ea;justify-content:flex-end}
 dialog .popup-standard-body :is(.supply-form-heading,.raw-register-heading){padding-bottom:9px;margin-bottom:10px!important;border-bottom:1px solid #dce2ea}
 dialog .popup-standard-body :is(.supply-form-heading,.raw-register-heading) button{flex:0 1 auto!important}
 dialog .popup-standard-body :is(p,.notice){line-height:1.5;overflow-wrap:anywhere}
 dialog .popup-standard-body p{margin:6px 0 10px}
 dialog .popup-standard-body .notice{padding:8px 10px;margin-bottom:10px}
 dialog .popup-standard-body :is(.panel,.card,fieldset){padding:12px;margin-bottom:10px}
 dialog .popup-standard-body .table-wrap{max-width:100%;overflow:auto}
 dialog .popup-standard-body td :is(input,select){width:100%;min-width:65px}
 dialog .popup-standard-body :is(.form-error,.error){white-space:normal;overflow-wrap:anywhere}
 dialog .popup-standard-body .check-list label{display:flex;align-items:flex-start;gap:6px;padding:6px}
 @container (max-width:540px){
  .popup-standard-body :is(.form-grid,.raw-form-grid){grid-template-columns:minmax(0,1fr)!important}
  .popup-standard-body :is(.form-grid .full,.raw-wide){grid-column:1/-1}
  .popup-standard-body .row>label{flex:1 1 180px}
  .popup-standard-body .row>button{flex:0 1 auto}
 }
 @media(max-width:600px){dialog>.popup-standard-body{padding:10px!important}dialog>.popup-window-tools .popup-bar-title{font-size:14px}dialog .popup-standard-body button{padding:6px 9px}}
}

@media screen {
 /* Custom detail windows do not use popup-standard-body. */
 dialog .project-dialog-body{padding:12px 14px;min-width:0;max-width:100%;box-sizing:border-box;container-type:inline-size;overscroll-behavior:contain}
 dialog .project-dialog-body :is(.row,.actions,.filters){flex-wrap:wrap;gap:7px 9px;max-width:100%;min-width:0;box-sizing:border-box}
 dialog .project-dialog-body :is(input,select,textarea,button){font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;max-width:100%;min-width:0;box-sizing:border-box}
 dialog .project-dialog-body button{min-height:32px;height:auto;padding:6px 10px;white-space:normal;overflow-wrap:anywhere;line-height:1.4}
 dialog .project-dialog-body :is(input:not([type=checkbox]):not([type=radio]),select){height:34px;padding:5px 9px}
 dialog .project-dialog-body textarea{padding:7px 9px;min-height:80px}
 dialog .project-dialog-body label{font-size:12px;line-height:1.5;overflow-wrap:anywhere}
 #business-overview .overview-title-actions{align-items:flex-start;min-width:0;gap:6px}
 #business-overview .overview-title-actions .overview-task-title{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;line-height:1.5;height:auto;min-height:0;padding:0}
 #business-overview .overview-title-actions .business-summary-open{white-space:nowrap;flex:0 0 auto}
 dialog.source-preview-dialog>div>div:first-child{flex-wrap:wrap;gap:6px 10px;padding:8px 12px!important}
 dialog.source-preview-dialog>div>div:first-child strong{min-width:0;overflow-wrap:anywhere;font-size:15px}
 dialog.source-preview-dialog>div>div:first-child button{font-family:'Malgun Gothic','맑은 고딕',sans-serif;font-size:13px;min-height:32px;height:auto;padding:5px 10px;white-space:normal}
 dialog :is(.project-dialog-body,.popup-standard-body) :is(.request-asset-row,.business-asset-row,.request-link-input){min-width:0;max-width:100%;flex-wrap:wrap;gap:6px}
 dialog :is(.project-dialog-body,.popup-standard-body) :is(.request-asset-actions,.business-asset-actions){flex-wrap:wrap;flex-shrink:1}
 @container(max-width:540px){.project-dialog-body .form-grid{grid-template-columns:minmax(0,1fr)}.project-dialog-body .row>label{flex:1 1 180px}}
}

/* File names follow their containing panel instead of browser-default link styling. */
:is(a[href^="/api/"][href*="/file"],a[download],.business-asset-name,.request-asset-name,.mp-file>a,.mp-file>span,.attachment-selection-controls span,.msg-pending-file,.project-asset-list a):not(.button):not(.primary){font-family:inherit;font-size:13px;font-weight:400;line-height:1.6;letter-spacing:normal;color:inherit;text-decoration:none;overflow-wrap:anywhere}
:is(a[href^="/api/"][href*="/file"],a[download],.mp-file>a,.project-asset-list a):not(.button):not(.primary):hover{color:inherit;text-decoration:underline;text-underline-offset:3px}
:is(a[href^="/api/"][href*="/file"],a[download],.mp-file>a):focus-visible{outline:2px solid #6488b5;outline-offset:3px;border-radius:2px}
.mp-memo-paper .mp-file{color:#665b47}

/* Menu-page headings share the ledger title scale; dialog content is excluded. */
@media screen {
#main:not(:has(#detail-return)) h1{font-family:'Malgun Gothic','맑은 고딕',sans-serif!important;font-size:24.48px!important;font-weight:700!important;line-height:1.35!important;letter-spacing:-.612px!important;color:#182a44!important;margin:0!important}
#main :is(.page-head,.section-title,.business-page-heading,.mp-heading,.supply-page-head,.work-hero,.company-hero,.fs-hero){margin:0 0 8px!important;padding:0!important;min-height:0;gap:8px 14px;align-items:baseline;flex-wrap:wrap}
#main :is(.business-page-heading,.section-title:has(>h1),.page-head>div:first-child,.section-title>div:first-child,.mp-heading>div:first-child,.company-hero>div:first-child,.fs-hero>div:first-child,.work-hero>div:first-child){display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 14px}
#main :is(.work-hero,.company-hero,.fs-hero){background:transparent!important;border:0!important;box-shadow:none!important;border-radius:0!important;color:#182a44}
#main :is(.work-hero,.company-hero,.fs-hero)>div:first-child>small,#main .work-eyebrow{display:none}
#main .work-title-row{display:contents}
#main :is(.page-head,.section-title,.business-page-heading,.mp-heading,.company-hero,.fs-hero,.work-hero) :is(p,.muted.tiny){font-family:'Malgun Gothic','맑은 고딕',sans-serif!important;font-size:12px!important;font-weight:400!important;line-height:1.55!important;letter-spacing:normal!important;color:#596575!important;margin:0!important}
#main .work-hero>div:first-child>p{order:1}#main .work-title-row>button{order:2;margin-left:auto}
#main>h1{margin:0 0 8px!important}
}

@media screen {
#main .work-hero>div:first-child{width:100%}
#main .company-hero>div:last-child{font-size:12px;color:#596575;text-align:right;line-height:1.55;margin-left:auto}
#main .company-hero>div:last-child a{color:#2563db}
#main .fs-hero>div:last-child{display:flex;align-items:baseline;justify-content:flex-end;flex-wrap:wrap;gap:4px 12px;margin-left:auto;text-align:right;color:#596575}
#main .fs-hero>div:last-child b{font-size:14px;color:#182a44}
#main .fs-hero>div:last-child :is(span,small){font-size:12px;color:#596575;letter-spacing:normal}
}
@media screen {#main .section-title>div:first-child>span.muted{font-family:"Malgun Gothic","맑은 고딕",sans-serif;font-size:12px;line-height:1.55;font-weight:400;letter-spacing:normal;color:#596575;margin:0}}

/* Inventory owns the page scroll; reference panels open separately. */
body:has(#main .material-main-card){overflow:hidden}
#main:has(.material-main-card){height:calc(100dvh - var(--material-top,80px));min-height:0;display:flex;flex-direction:column;overflow:hidden;padding-bottom:10px}
#main:has(.material-main-card)>.material-page-head{flex:none;margin-bottom:8px;gap:8px;flex-wrap:wrap}
.material-info-actions{display:flex;gap:6px;flex-wrap:wrap;margin-left:auto}
.material-info-actions button{font-size:13px;height:32px;padding:4px 10px;white-space:nowrap}
#main>.material-main-card{flex:1;min-height:0;overflow:hidden;margin-bottom:0}
.material-main-card>:not(.material-grid){flex-shrink:0}
#main>.material-main-card>.material-grid{flex:1 1 0;min-height:0!important;max-height:none!important;overflow:auto;overscroll-behavior:contain}
.material-grid thead{position:sticky;top:0;z-index:2}
dialog:has(.material-info-popup):not(.popup-maximized):not(.popup-minimized){width:960px!important;max-width:calc(100vw - 32px)!important;height:auto!important;min-height:0!important;max-height:85vh!important;inset:7vh 0 auto!important;margin:0 auto!important}
dialog:has(.material-info-popup)>.popup-standard-body{flex:0 1 auto;min-height:0;max-height:calc(85vh - 44px);overflow:auto}
.material-info-popup .table-wrap{max-height:none;overflow:visible}
.material-info-footer{display:flex;justify-content:flex-end;margin-top:12px}

/* Compact stock controls and content-sized reference dialogs. */
@media screen {
.material-main-card .stock-tools{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;margin:4px 0;padding:0;border:0}
.material-main-card .stock-tool-group{gap:4px;padding-right:7px;flex:0 1 auto}
.material-main-card .stock-tool-group>span{font-size:11px;white-space:nowrap}
.material-main-card .stock-tools button{height:28px;min-height:28px;padding:3px 7px;font-size:12px;line-height:20px;white-space:nowrap}
.material-main-card #material-summary{margin:0 0 0 auto;padding:0;min-height:28px;display:flex;align-items:center;gap:5px;flex-wrap:wrap;font-size:11px}
.material-main-card #material-summary button{margin:0}
.material-main-card .material-inline-notice{margin:0;padding:2px 6px;font-size:11px;line-height:18px;flex:0 1 auto}
.material-main-card>.row:first-child{padding:6px 9px;gap:4px 9px}
.material-main-card>.row:first-child :is(input,select){height:29px;padding:3px 7px}
#material-totals{min-height:0;padding:4px 9px;margin:0 0 5px;gap:4px 16px;line-height:20px}
#material-totals .material-grand-total{font-size:15px}
#material-totals .material-vendor-total{font-size:13px}
#material-totals .tag{font-size:11px;padding:1px 6px;line-height:18px}
dialog:has(.material-info-popup):not(.popup-maximized):not(.popup-minimized){width:fit-content!important;min-width:min(420px,calc(100vw - 32px));max-width:min(760px,calc(100vw - 32px))!important}
dialog:has(.material-result-popup):not(.popup-maximized):not(.popup-minimized){max-width:min(600px,calc(100vw - 32px))!important}
.material-info-popup{font-size:13px}
.material-info-popup h2{font-size:16px;margin-bottom:10px}
.material-info-popup p{margin-bottom:8px}
.material-info-popup :is(th,td){padding:5px 9px;font-size:12px}
.material-info-popup .table-wrap table{min-width:0;width:100%}
.material-info-footer{margin-top:8px}
}

/* Main menu heading spacing: use the ledger header's 8px gap once. */
@media screen {
#main:not(:has(#detail-return))>:is(.page-head,.section-title,.business-page-heading,.work-hero,.company-hero,.fs-hero)+*,
#main>.mp-page>.mp-heading+*{margin-top:0!important}
}
/* Compact stock rows, retaining text sizes and expandable details. */
@media screen {
.material-grid:not(.material-summary-view) tbody tr{height:42px}
.material-grid:not(.material-summary-view) tbody td{height:42px;padding-top:4px;padding-bottom:4px}
.material-grid:not(.material-summary-view) tbody button[data-stock-confirm]{width:78px;height:28px;min-height:28px;padding:0 7px;font-size:13px;line-height:18px}
.material-grid:not(.material-summary-view) tbody tr.material-paid-divider{height:30px}
.material-grid:not(.material-summary-view) tbody tr.material-paid-divider>th{height:30px;padding-top:4px;padding-bottom:4px}
}

/* Verified against purchase ledger: 12px above, 8px below main headings. */
@media screen {
#main{padding-top:12px!important}
#main>:is(.page-head,.section-title,.business-page-heading,.work-hero,.company-hero),
#main>.fs-page>.fs-hero,#main>.mp-page>.mp-heading{display:flex;align-items:center!important;border-bottom:0!important}
#main .work-hero>div:first-child{align-items:center}
#main>:is(.page-head,.section-title,.work-hero) button{height:32px;min-height:32px;padding-top:0;padding-bottom:0}
#main>.company-hero>div:last-child{display:flex;align-items:center;flex-wrap:wrap;gap:4px 12px;line-height:18.6px}
#main>.company-hero>div:last-child>br{display:none}
#main>.section-title>label:has(#doc-upload){display:flex;align-items:center;gap:8px;margin:0;font-size:12px}
#main #doc-upload{height:32px;padding:3px 6px;font-size:12px;width:250px}
#main>.section-title .attachment-selection-controls[hidden]{display:none!important}
#main:not(:has(#detail-return))>h1{margin-bottom:8px!important}
}
/* Attachment filenames: shared across lists, timelines, dialogs, notes and chat. */
@media screen {
.business-inline-item > a:first-child[href^="/api/business-events/"][href$="/file"],
.request-inline-item > a:first-child[href^="/api/request-events/"][href$="/file"],
.project-asset-list a[href^="/api/"][href*="/file"],
.business-asset-name:not(:has(a)),
.request-asset-name:not(:has(a)),
.mp-file > a,.mp-file > span,
a.msg-attachment,
a[href^="/api/sources/"][href$="/file"]:not(.button):not(.primary){color:#2563eb!important}
}

@media screen{[data-project-task]{user-select:text;cursor:auto}.project-task-drag{display:inline-block;flex-shrink:0;align-self:center;padding:2px 3px;color:#6b7d96;cursor:grab;user-select:none;line-height:1.2;font-size:15px}.project-task-drag:active{cursor:grabbing}}

/* Shared explanatory copy: match the compact 12px form hint. */
@media screen {
 .ui-help,p.tiny.muted,p.muted.tiny,.business-milestone-preview{
  font-family:"Malgun Gothic","맑은 고딕",sans-serif!important;
  font-size:12px!important;font-weight:400!important;line-height:1.55!important;
  letter-spacing:normal!important;color:#596575!important;
 }
 .ui-help{margin-top:6px;margin-bottom:8px}
}

/* Aligned expense and business approval list controls; document fields unchanged. */
#main .expense-heading-title{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap}
#main .expense-heading{justify-content:space-between}
#main .expense-list-page{padding:20px}
#main :is(.expense-toolbar,.approval-list-toolbar){display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:0 0 16px}
#main :is(#expense-filters,.approval-stages){display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0}
#main :is(.expense-heading,.expense-toolbar,.approval-list-toolbar,.business-page-heading) button{font-family:inherit;font-size:13px;line-height:1.5;min-height:36px;padding:8px 12px;margin:0;white-space:nowrap}
#main :is(.expense-toolbar,.approval-list-toolbar) input[type=search]{font-family:inherit;font-size:13px;height:38px;width:300px;max-width:100%;padding:8px 12px}
#main .expense-toolbar .row,#main .approval-list-toolbar>.row:last-child{gap:8px;flex-wrap:nowrap;margin-left:auto}
#main #expense-filters small{font-size:inherit}
#main .expense-list td:last-child button{font-family:inherit;font-size:13px;min-height:34px;padding:6px 10px;margin:0}
#main #expense-filters .selected{background:#e7efff;border-color:#2563eb;color:#184ba1}

/* Common search shape for business, approval, diary and expense lists. */
#main :is(#business-search,#business-mine-search,#mp-search,#expense-search,.approval-list-toolbar input[type="search"]){box-sizing:border-box!important;width:300px!important;height:38px!important;min-height:38px!important;min-width:0!important;max-width:100%!important;flex:0 1 300px!important;padding:8px 12px!important;border:1px solid #bcc8d8!important;border-radius:5px!important;background:#fff!important;color:#202734!important;font-family:'Malgun Gothic','맑은 고딕',sans-serif!important;font-size:13px!important;font-weight:400!important;line-height:1.5!important;box-shadow:none}
#main :is(#business-search,#business-mine-search,#mp-search,#expense-search,.approval-list-toolbar input[type="search"])::placeholder{color:#718198;opacity:1}
/* Align subtitles to the same text baseline as the company main heading. */
@media screen {
#main :is(.page-head,.section-title,.business-page-heading,.mp-heading,.supply-page-head,.material-page-head,.work-hero,.company-hero,.fs-hero){align-items:baseline!important}
#main :is(.page-head,.section-title,.mp-heading,.work-hero,.company-hero,.fs-hero)>div:first-child,
#main .expense-heading-title{align-items:baseline!important}
#main :is(.page-head,.section-title,.business-page-heading,.mp-heading,.supply-page-head,.material-page-head,.work-hero,.company-hero,.fs-hero)>button,
#main .expense-heading>.row{align-self:center}
}

/* Shared section-fold controls. */
#main :is(#business-toggle,#business-completed-fold,#business-mine-toggle,#mine-completed-toggle,#business-chart-toggle,.update-history-expand,#collapse-groups,[data-profit-expand]){
  box-sizing:border-box!important;min-height:32px!important;height:32px!important;
  padding:5px 10px!important;font-family:'Malgun Gothic','맑은 고딕',sans-serif!important;
  font-size:13px!important;line-height:1.4!important;white-space:nowrap!important;
  flex-shrink:0;margin-left:auto!important;order:99;
}
#main .business-toolbar{margin-left:auto;justify-content:flex-end}
#main .update-history-day>summary small{margin-left:auto}
#main .update-history-expand{margin-left:0!important}
#main .profit-month>.row.spread>.row{margin-left:auto}
#main .mp-filters{margin-left:auto;justify-content:flex-end}
#main #mp-fold{order:99;margin-left:auto}

/* Common action buttons across categories and dialogs; content and window controls retain their roles. */
@media screen {
:is(#main,dialog,.project-dialog,.popup-standard-body) :is(.filters,.ops-toolbar,.page-head,.section-title,.stock-tools,.business-toolbar,.business-form-toolbar,.approval-actions,.expense-actions,.actions,.mp-toolbar,.expense-unsaved-actions,.update-history-toolbar,.ledger-tools,.person-list-tools) button:not(:is(
 .link,.business-column-menu,.business-count-button,.business-person-open,.person-task-title,
 .business-mine-title,.business-title-edit,.business-owner-line,.business-person-caption,
 .mp-date,.mp-bar,.mp-note-preview,.mp-title-drag,.msg-person,[draggable="true"],[data-detail],[data-business-detail-title],[data-task-summary],
 [role="tab"],[data-popup-mirror],.popup-window-tools *,
 .business-summary *, .business-mine-stats *, .stats *,
 .sidebar *, .history-list *, .check-list *,
 .business-filter-values *, .business-filter-select *,
 .business-filter-menu>[data-sort],.msg-window-tools *
)) {
 box-sizing:border-box!important;font-size:13px!important;line-height:20px!important;
 min-height:32px!important;height:auto!important;padding:5px 10px!important;
 border-radius:6px!important;white-space:nowrap!important;flex-shrink:0;
}
}
