/* Shared interaction rules, scoped away from customer-facing quotation documents. */
.hq-merge-list{display:grid;gap:12px;width:100%;min-width:0;margin:10px 0}
.hq-merge-item{min-width:0;padding:12px;border:1px solid #cbdde2;border-radius:9px;background:#fff;color:#203e4b}
.hq-merge-item h4{margin:0 0 8px;font-size:16px}.hq-merge-values{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.hq-merge-values>div{min-width:0;padding:10px;background:#f1f6f7;border-radius:6px}.hq-merge-values strong{font-size:14px}
.hq-merge-values pre{margin:6px 0 0;white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:15px;line-height:1.55}
.hq-merge-item label{display:block;margin:10px 0 0}.hq-merge-item select{display:block;width:100%;min-width:0;min-height:44px;margin-top:5px;padding:7px;border:1px solid #bfd2d9;border-radius:7px;background:white;font:inherit}
.hq-merge-apply,.online-draft-recovery button{min-height:44px!important;padding:8px 12px;border:1px solid #adc9d0;border-radius:7px;background:#fff;color:#205360;cursor:pointer;font:inherit}
.hq-merge-photo{height:100px;max-width:100%;object-fit:contain}.hq-draft-restore{width:100%;min-width:0}
@media(max-width:700px){.hq-merge-values{grid-template-columns:1fr}.hq-merge-item{padding:10px}.hq-merge-item pre{font-size:16px}}
@media print{.hq-merge-list,.hq-draft-restore{display:none!important}}
:root{--hq-ink:#203e4b;--hq-accent:#316c72;--hq-line:#d6e3e8;--hq-soft:#eef5f6;--hq-radius:10px}
@media screen{
  #quotationSheetPreview .quotation-table #quotationUnitPricePreview,
  #quotationSheetPreview .quotation-table #quotationAmountPreview{white-space:normal;overflow-wrap:anywhere;line-height:1.4}
  :where(button,input,select,textarea,summary,a):focus-visible{outline:3px solid #478991;outline-offset:3px}
  :where(button,[role=button],summary){touch-action:manipulation}
  button[aria-pressed=true],.summary button.active{background:var(--hq-soft);border-color:var(--hq-accent);box-shadow:inset 0 0 0 1px var(--hq-accent)}
  #factoryApp .panel,.customer-group,.stat-card,.workbench-module-card{border-radius:var(--hq-radius)}
  #factoryApp .summary{grid-template-columns:repeat(4,minmax(0,1fr))}
  #factoryApp .panel{margin-bottom:14px}
  #factoryApp .sticky-save button{flex:0 1 auto;min-height:44px;padding:8px 18px}
  #factoryApp .sticky-save #saveStatus{flex:1;font-size:14px}
  #factoryApp :is(h2,h3){line-height:1.4}
  #factoryApp :is(.personnel-grid,.machine-grid){grid-template-columns:repeat(auto-fit,minmax(145px,1fr));width:100%;max-width:none}
  #factoryApp [data-fact-section=factory_facts] .fact-grid{max-width:none}
  #factoryApp [data-record-section=customers] .record-row{max-width:none}
  .audit-jump{display:flex;gap:6px;flex-wrap:wrap;position:sticky;top:0;z-index:6;background:#f5f9fa;padding:8px 0;border-bottom:1px solid var(--hq-line);margin-bottom:12px}
  .audit-jump button{font-size:16px;min-height:44px;padding:7px 13px}
  .audit-form .panel,.read-report .panel,.audit-photo-block{scroll-margin-top:72px}
  .materials-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
  .materials-grid section{min-width:0}
  .materials-grid .photo-grid{grid-template-columns:repeat(auto-fill,minmax(110px,1fr))}
  .materials-grid img{width:100%;height:135px;object-fit:contain;background:var(--hq-soft)}
  .material-picker{display:inline-flex;align-items:center;min-height:44px;position:relative;border:1px solid var(--hq-line);border-radius:8px;padding:6px 12px;overflow:hidden;cursor:pointer}
  .material-picker input{position:absolute;inset:0;opacity:0;cursor:pointer}
  #factoryApp .photo-adjust{min-height:36px;font-size:15px;padding:4px 10px;margin-top:4px}
  .correction-preview{display:block;max-width:100%;height:180px;object-fit:contain;margin:0 auto 12px}
  .online-draft-recovery{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:10px 16px;background:#fff5de;border:1px solid #e8d4a2}
  .cost-spec{margin-bottom:6px}
  #costTable :is(.cost-spec,.cost-desc){min-width:145px}
  @media(max-width:700px){
    .customer-mobile-list .table-wrap{overflow:visible}
    .customer-mobile-list table{width:100%;min-width:0;table-layout:fixed}
    .customer-mobile-list table :is(th,td){display:none}
    .customer-mobile-list table :is(th,td):is(:nth-child(1),:nth-child(5),:nth-child(6)){display:table-cell;width:auto;padding:12px 7px;white-space:normal;overflow-wrap:anywhere;max-width:none;text-overflow:clip}
    .customer-mobile-list table :is(th,td):nth-child(1){width:30%}
    .customer-mobile-list table :is(th,td):nth-child(5){width:47%}
    .customer-mobile-list table :is(th,td):nth-child(6){width:23%}
    .customer-mobile-list .customer-name{font-size:15px}
    /* Keep long prices inside the mobile preview; printed/exported documents are unchanged. */
    #quotationSheetPreview .quotation-table th:first-child{width:14%!important}
    #quotationSheetPreview .quotation-table th:last-child{width:34%!important}
    #quotationSheetPreview .quotation-table td{padding:12px 6px;overflow-wrap:anywhere}
    #quotationSheetPreview .quotation-table #quotationUnitPricePreview,
    #quotationSheetPreview .quotation-table #quotationAmountPreview{white-space:normal;overflow-wrap:anywhere;font-size:14px;line-height:1.4}
    #factoryApp .summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
    #factoryApp :is(.personnel-grid,.machine-grid){grid-template-columns:repeat(2,minmax(0,1fr))}
    #factoryApp :is(button,select,input:not([type=checkbox]):not([type=radio]):not([type=file])){min-height:44px}
    #factoryApp label,#factoryApp input,#factoryApp textarea,#factoryApp select{font-size:16px}
    #factoryApp .sticky-save{gap:8px;flex-wrap:wrap;padding-bottom:max(10px,env(safe-area-inset-bottom))}
    #factoryApp .sticky-save #saveStatus{flex-basis:100%;font-size:14px}
    .materials-grid{grid-template-columns:1fr}
    .audit-jump{flex-wrap:nowrap;overflow-x:auto}
    .audit-jump button{white-space:nowrap;flex:1;padding:6px 9px}
    #factoryRows table,#factoryRows tbody,#factoryRows tr,#factoryRows td{display:block;min-width:0;width:100%}
    #factoryRows thead{display:none}
    #factoryRows tr{background:white;border:1px solid var(--hq-line);border-radius:10px;margin:10px 0;padding:12px}
    #factoryRows td{border:0;padding:5px 0;box-sizing:border-box}
    #factoryRows td::before{display:block;color:#617987;font-size:13px;content:attr(data-label)}
  }
}
