@import url('/tokens.css');

/* Keep every surface, including dialogs and semantic emphasis, at regular weight. */
:where(html,body,body *,body *::before,body *::after){font-weight:400;}
.filter-control{display:grid;gap:5px;font-size:12px;margin:0;min-width:120px;}
.filter-control select{width:100%;max-width:210px;}
@media(max-width:760px){.filter-control{flex:1;min-width:130px;}.filter-control select{max-width:none;}#clearFilters{min-height:40px;}}
/* Conversion preview belongs to the entire item, on desktop and mobile. */
.line .unit-preview{grid-column:1 / -1;width:100%;margin:4px 0;overflow-wrap:anywhere}

/* Fit content rather than masking horizontal overflow. All table fields stay visible. */
#content,#drawerBody,.panel,.panel-body,.fields,.line,.toolbar,.page-head,.head-actions,.filter-row,.backup-grid,.dashboard-grid{min-width:0;max-width:100%}
#content,#drawerBody,.notice,.card,.panel-head,.drawer-head,.drawer-footer{overflow-wrap:anywhere}
.table{container-type:inline-size;overflow:visible;min-width:0;max-width:100%}
.table table{table-layout:auto;white-space:normal;max-width:100%}
.table th,.table td{padding:13px clamp(4px,.7vw,12px);overflow-wrap:anywhere;vertical-align:top;min-width:0}
.cell-value{display:block;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.cell-value button,.cell-value a,.badge{white-space:normal;max-width:100%;overflow-wrap:anywhere}
.head-actions,.panel-head,.hero-buttons,.app-footer{flex-wrap:wrap}
.head-actions{flex-shrink:1}.page-head>div,.panel-head>*{min-width:0}
.fields,.line{grid-template-columns:repeat(2,minmax(0,1fr))}
.line label,.fields label,.toolbar>*{min-width:0;max-width:100%}
.line button{justify-self:start}.line label:first-child{grid-column:1 / -1}
#settingsForm .line{grid-template-columns:repeat(2,minmax(0,1fr))}
.filter-control{min-width:0;flex:1 1 140px}.filter-control select{max-width:100%}
.card strong{font-size:clamp(18px,2.2vw,28px)}
#nav{overflow-x:visible;overflow-y:auto}
@media(max-width:760px){.fields{grid-template-columns:minmax(0,1fr)}.head-actions{width:100%}.head-actions button{flex:1}.filter-row label{flex:1;min-width:0}.filter-row input{max-width:100%}.tenant-control{min-width:0;flex:1}.tenant-control select{min-width:0}.app-header .account{flex-shrink:0}.quick-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.hero-buttons>*{min-width:0}.card strong{font-size:22px}}
@media (max-width: 760px){
table{display:block;border-collapse:separate}
table thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;clip-path:inset(50%);overflow:hidden;white-space:nowrap}
table tbody{display:grid;gap:14px;padding:14px}
table tbody tr{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,145px),1fr));gap:0 16px;border:1px solid var(--border);border-radius:9px;padding:0 16px 8px;background:#fff;min-width:0}
table td{display:block;border-bottom:1px solid #eff2f8;padding:12px 0;min-width:0}
table td::before{content:attr(data-label);display:block;font-size:11px;color:var(--muted);margin-bottom:6px;line-height:1.5}
table td:first-child{grid-column:1 / -1;color:var(--navy)}
table td.cell-long{grid-column:1 / -1}
table tr:last-child td{border-bottom:1px solid #eff2f8}
table .cell-value{line-height:1.7}
}
@media(max-width:760px){table tbody tr{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:360px){table tbody tr{grid-template-columns:minmax(0,1fr)}}
.login-story,.login-side{min-width:0;overflow-wrap:anywhere}
.login-decoration{flex-wrap:wrap;gap:12px}.login-decoration span{min-width:0;padding:16px}
/* Purchase forms use the same compact document scale as purchase details. */
#drawer.purchase-document #drawerBody{font-size:12px;line-height:1.7}
.purchase-document .notice,.purchase-document .form-note,.purchase-document label{font-size:12px}
.purchase-document .notice{padding:12px;margin-bottom:16px}
.purchase-document h3{font-size:12px;margin:14px 0 10px}
.purchase-document input,.purchase-document select{font-size:12px;padding:6px 8px;min-height:32px}
.purchase-document .fields{gap:0 16px}
.purchase-document .fields label{margin-bottom:12px}
.purchase-document .total-line,.purchase-document .total-line strong{font-size:12px}
.purchase-document .purchase-line-heading,.purchase-document .line.purchase-line{display:grid;grid-template-columns:minmax(0,2.3fr) minmax(0,1.5fr) minmax(0,1fr) minmax(0,.9fr) 26px;gap:8px;align-items:center;padding:13px 8px;border-bottom:1px solid var(--border);margin:0}
.purchase-line-heading{background:#fafbfd;color:#7d8ba5;font-size:11px}
.purchase-document .purchase-line label,.purchase-document .purchase-line label:first-child{grid-column:auto;margin:0;min-width:0}
.purchase-field-caption{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.purchase-document .purchase-quantity{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:4px;min-width:0}
.purchase-document .purchase-line input,.purchase-document .purchase-line select{width:100%;min-width:0;border-color:transparent;background:transparent;padding:5px 2px}
.purchase-document .purchase-line input:hover,.purchase-document .purchase-line select:hover,.purchase-document .purchase-line input:focus,.purchase-document .purchase-line select:focus{border-color:#dce4f1;background:#fff}
.purchase-document .purchase-line button{grid-column:auto;padding:4px;min-width:26px;font-size:12px}
.purchase-line-amount{overflow-wrap:anywhere;font-size:12px}
.purchase-document #addLine,.purchase-document #addCorrectionLine{font-size:12px;margin:10px 0;padding:7px 10px}
@media(max-width:760px){
 #drawer.purchase-document #drawerBody,.purchase-document .table table,.purchase-document .table td{font-size:16px}
 .purchase-document input,.purchase-document select,.purchase-document .purchase-line input,.purchase-document .purchase-line select{font-size:16px;min-height:40px}
 .purchase-document .purchase-line-heading{display:none}
 .purchase-document .line.purchase-line{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:14px;margin-bottom:14px;border:1px solid var(--border);border-radius:9px}
 .purchase-document .purchase-line>label:first-child{grid-column:1 / -1}
 .purchase-document .purchase-line .purchase-field-caption{position:static;width:auto;height:auto;clip-path:none;display:block;font-size:11px;color:var(--muted);margin-bottom:6px}
 .purchase-document .purchase-quantity{grid-column:1 / -1;gap:12px}
 .purchase-document .purchase-line-amount{font-size:16px}.purchase-line-amount::before{content:'金额';display:block;font-size:11px;color:var(--muted);margin-bottom:6px}
 .purchase-document .purchase-line input,.purchase-document .purchase-line select{border-color:#dce4f1;padding:6px}
}
/* Sales, returns and paid samples share the purchase document scale. */
.purchase-document .extra-document-heading,.purchase-document .line.extra-document-line{grid-template-columns:minmax(0,2.3fr) minmax(0,1.5fr) minmax(0,2fr) 26px}
.purchase-document .extra-document-line .unit-preview{grid-column:auto;margin:0;font-size:12px;line-height:1.7;min-width:0;overflow-wrap:anywhere}
.purchase-document #extraAdd{font-size:12px;margin:10px 0;padding:7px 10px}
@media(max-width:760px){
 .purchase-document .line.extra-document-line{grid-template-columns:repeat(2,minmax(0,1fr))}
 .purchase-document .extra-document-line .unit-preview{grid-column:1 / -1;font-size:12px}
}
.purchase-document .document-line-info{min-width:0}
.purchase-document .valuation-field .purchase-field-caption{position:static;width:auto;height:auto;clip-path:none;display:block;color:var(--muted);font-size:11px}
.purchase-document .valuation-field{display:block;margin-bottom:6px!important}

/* Shared control scale across login, filters, settings and every drawer. */
:root{--control-font:12px;--control-height:32px;--control-padding:6px 8px;--ui-font:12px}
body input,body select,body textarea,
body :is(#workspace,#drawer,#login) :is(input,select,textarea){font-size:var(--control-font);min-height:var(--control-height);padding:var(--control-padding);border-radius:7px;line-height:1.5;font-weight:400}
body button,body .button,
body :is(#workspace,#drawer,#login) :is(button,.button){font-size:var(--ui-font);min-height:var(--control-height);line-height:1.5;font-weight:400;border-radius:8px;padding:6px 10px;gap:8px}
body select{padding-right:24px!important;text-overflow:ellipsis}
body :is(input,select,textarea):disabled{background:var(--bg);color:var(--muted)}
body :is(input,textarea):read-only{background:#fafbfd}
body label,#drawer label{font-size:var(--ui-font);gap:6px;margin-bottom:12px}
#drawer #drawerBody{font-size:12px;line-height:1.7}
#drawer .fields{gap:0 16px}
#drawer :is(.notice,.form-note,h3){font-size:12px}
#drawer h3{margin:14px 0 10px}
#drawer .notice{padding:12px;margin-bottom:16px}
#drawer #unitRows .line{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1.5fr) auto;align-items:end;gap:8px;padding:12px 0}
#drawer #unitRows .line label{grid-column:auto;margin:0}
#drawer #unitRows .line button{grid-column:auto}
#drawer #addUnit{margin:10px 0}
body #drawer .drawer-head button{font-size:24px;padding:0 8px;min-width:36px}
body #workspace #menu{font-size:19px;padding:4px 8px}
body .filter-control,body .filter-row label{margin-bottom:0}
@media(max-width:760px){
 :root{--control-font:16px;--control-height:40px;--control-padding:7px 8px}
 #drawer #drawerBody{font-size:16px}
 #drawer #unitRows .line{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 #drawer #unitRows .line label:first-child{grid-column:auto}
}
/* Administration uses the same compact form rhythm as business documents. */
#wecomStatus,#settingsForm{font-size:12px;line-height:1.7}
#content:has(#wecomStatus)>p{font-size:12px;color:var(--muted);line-height:1.7}
#wecomStatus h3,#settingsForm h3{font-size:12px;margin:14px 0 10px}
#settingsForm .fields{gap:0 16px}
#settingsForm #memberRows .line{grid-template-columns:minmax(0,2fr) minmax(0,1fr) auto;gap:8px;align-items:end;padding:12px 0}
#settingsForm #memberRows label{grid-column:auto;margin:0}
#settingsForm #memberRows button{grid-column:auto}
#settingsForm>button{margin:10px 8px 0 0}
#content>.notice{font-size:12px;padding:12px;line-height:1.7}
@media(max-width:760px){
 #drawer{width:calc(100% - 16px);max-width:calc(100% - 16px)}
 #settingsForm #memberRows .line{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 #settingsForm #memberRows label:first-child{grid-column:1 / -1}
}
/* Reporting screens share document typography and spacing; metrics retain hierarchy. */
#content.report-page{font-size:12px;line-height:1.7}
.report-page .panel-head h3,.report-page .card>span,.report-page .page-head p{font-size:12px}
.report-page .card small,.report-page .panel-head small,.report-page .toolbar .count,.report-page .chart-day small,.report-page .chart-day b{font-size:11px}
.report-page .card{padding:20px;overflow-wrap:anywhere}
.report-page .card strong{line-height:1.4}
.report-page .panel-head{padding:16px 20px}
.report-page .panel-body{padding:20px}
.report-page .toolbar{padding:14px 20px;gap:12px}
.report-page .filter-row{align-items:end;gap:12px}
.report-page .filter-row>span{align-self:end;line-height:32px}
.report-page .backup-grid p,.report-page .tabs-note,.report-page .metric-line{font-size:12px}
.report-page .chart{gap:8px;padding-bottom:32px}
.report-page .chart-day small{bottom:-25px}
.report-page input[type=file]{max-width:100%}
.report-page input[type=file]::file-selector-button{font:inherit;border:1px solid var(--border);border-radius:6px;background:#fff;color:var(--navy);padding:5px 8px;margin-right:8px}
@media(max-width:760px){
 .report-page .card{padding:16px 12px}
 .report-page .panel-head,.report-page .panel-body{padding:16px}
 .report-page .toolbar{padding:14px}
 .report-page .filter-row>span{line-height:40px}
 .report-page .table td{font-size:16px}
 .report-page .chart{gap:4px}
}
/* Group navigation by the user's workflow, hiding empty permission groups. */
#nav{gap:12px;min-height:0;scroll-padding:8px 0}
#nav .nav-group{flex-shrink:0}
#nav .nav-group h2{font-size:11px;line-height:1.5;letter-spacing:0;color:var(--muted);margin:0;padding:6px 16px}
#nav .nav-group a{font-size:12px;min-height:34px;padding:7px 16px;margin:2px 0}
#sidebar .side-label{padding-top:0;padding-bottom:14px}
#sidebar .side-foot{padding-top:12px;flex-shrink:0}
@media(max-width:760px){#nav .nav-group a{min-height:40px;padding:9px 16px}}
