/* Readability and responsive usability refinements for Estimatra. */
body{font-size:16px}

/* Work names wrap; only the list scrolls, keeping project actions and totals outside it. */
.draft-side{min-width:0}
.quick-draft-list{min-height:0;max-height:min(34vh,280px);overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;scrollbar-width:thin;scrollbar-color:rgba(101,120,105,.4) transparent}
.quick-draft-list:focus-visible{outline:2px solid var(--green);outline-offset:4px}
.quick-item{grid-template-columns:minmax(0,1fr);gap:5px;padding:12px 0}
.quick-item-name{align-items:flex-start;gap:8px;min-width:0}
.quick-item-code{flex:0 0 auto;font-size:12px;line-height:1.45;white-space:nowrap}
.quick-item-title{min-width:0;max-height:none;overflow:visible;overflow-wrap:anywhere;font-size:14px;line-height:1.45;white-space:normal}
.quick-item-meta{grid-column:1;margin-left:0;font-size:12px;line-height:1.4;overflow-wrap:anywhere}
.quick-item-total{grid-column:1;grid-row:auto;justify-self:stretch;text-align:right;white-space:normal;overflow-wrap:anywhere;font-size:15px;line-height:1.4}
.quick-empty strong{font-size:14px}
.quick-empty span{font-size:13px;line-height:1.5}
.side-note{font-size:12px;line-height:1.5}
@media(max-width:760px){.quick-draft-list{scrollbar-width:none;scrollbar-color:transparent transparent;-ms-overflow-style:none}.quick-draft-list::-webkit-scrollbar{display:none;width:0;height:0}}

/* Make signed-in identity legible without changing account values. */
.profile-row{gap:11px;padding:11px 8px 6px;min-width:0}
.profile-row .profile-avatar{width:42px;height:42px;min-width:42px;flex:0 0 42px;font-size:16px}
.profile-row .profile-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.profile-row>div:nth-child(2){flex:1;min-width:0;gap:4px}
.profile-row strong{font-size:13px;line-height:1.35;white-space:normal;overflow-wrap:anywhere}
.profile-row>div:nth-child(2) span{font-size:12px;line-height:1.4;overflow-wrap:anywhere}
.profile-row .profile-menu{flex:0 0 22px;text-align:center;font-size:16px}

/* Keep Draft RAB actions available on phones; use a horizontal scroll area for the wide table. */
.draft-table-panel{min-width:0;overflow:hidden}
.draft-table-panel .table-wrap{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.draft-table-head{gap:12px;align-items:flex-start;flex-wrap:wrap}
.draft-table-head h2{font-size:18px;line-height:1.35}
.draft-table-head p{font-size:13px;line-height:1.5}
.draft-table-panel .draft-table-head .button{display:inline-flex!important;align-items:center;min-height:42px;font-size:14px;white-space:normal}
.draft-item-title{min-width:260px;white-space:normal}
.draft-item-title strong{display:block;font-size:14px;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.draft-item-title small{display:block;font-size:12px;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.draft-table tbody td{font-size:13px;line-height:1.45}
.draft-price,.draft-line-total{font-size:13px!important}
.volume-input{min-height:42px;font-size:14px}

/* Widen the analysis detail drawer so component coefficients and unit prices are easy to inspect. */
.detail-drawer{width:min(940px,calc(100vw - 36px));max-width:calc(100vw - 36px);padding:28px clamp(22px,4vw,44px) 36px;border-radius:16px 0 0 16px}
.detail-title{font-size:22px;line-height:1.4;overflow-wrap:anywhere}
.detail-category{font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.detail-price-card{gap:14px;padding:17px}
.detail-price-card span{font-size:12px;line-height:1.4}
.detail-price-card strong{font-size:16px;line-height:1.45;overflow-wrap:anywhere}
.detail-warning{font-size:13px;line-height:1.55;padding:12px 14px}
.detail-section-head{margin:22px 0 10px}
.detail-section-head h3{font-size:16px;line-height:1.4}
.detail-section-head span{font-size:12px}
.component-group-title{font-size:14px;line-height:1.4;padding:10px 0 8px}
.component-group-title span:last-child{font-size:12px}
.component-row{grid-template-columns:minmax(0,1fr) minmax(125px,auto);align-items:start;gap:18px;padding:13px 0}
.component-name{font-size:14px;line-height:1.45;font-weight:650;overflow-wrap:anywhere}
.component-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 18px;margin-top:6px;color:#718078;font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.component-meta-code{grid-column:1/-1;color:#78877d}
.component-meta b{color:#43574a;font-weight:700}
.component-amount{font-size:14px;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.component-amount small{font-size:12px;line-height:1.4}
.component-empty{font-size:13px;line-height:1.6}

/* The project-analysis table stays readable and scrollable on narrow screens. */
.project-analysis-panel .table-wrap{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.analysis-component-table{min-width:760px}
.analysis-component-table th,.analysis-component-table td{font-size:13px;line-height:1.45}
.analysis-component-name strong{font-size:14px}
.analysis-component-name small{font-size:12px;line-height:1.4}
.analysis-effective-price small{font-size:12px;line-height:1.4}

/* Search and add analyses inside the project, without leaving Draft RAB. */
.add-work-overlay{position:fixed;inset:0;z-index:70;visibility:hidden;pointer-events:none}
.add-work-overlay.open{visibility:visible;pointer-events:auto}
.add-work-scrim{position:absolute;inset:0;width:100%;height:100%;border:0;background:rgba(17,32,23,.45);opacity:0;transition:opacity .2s ease}
.add-work-overlay.open .add-work-scrim{opacity:1}
.add-work-drawer{position:absolute;inset:0 auto 0 0;width:min(660px,94vw);height:100dvh;overflow-y:auto;padding:30px clamp(20px,4vw,38px) 36px;background:#fff;box-shadow:16px 0 42px rgba(16,34,24,.17);transform:translateX(-102%);transition:transform .24s ease}
.add-work-overlay.open .add-work-drawer{transform:translateX(0)}
.add-work-header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-bottom:16px;border-bottom:1px solid #e8eee7}
.add-work-header h2{margin:5px 0 0;color:#213b2c;font-size:23px;line-height:1.35}
.add-work-intro{margin:16px 0 22px;color:#5d6e62;font-size:14px;line-height:1.55}
.add-work-search-label{display:block;margin:0 0 7px;color:#334c3a;font-size:13px;font-weight:700}
.add-work-search{display:block;width:100%;min-height:50px;padding:12px 14px;border:1px solid #cad9ca;border-radius:10px;background:#fcfdfb;color:#24352c;font-size:16px;line-height:1.4}
.add-work-search:focus{outline:3px solid rgba(65,130,92,.22);border-color:#4e8a5c}
.add-work-help{margin:8px 0 14px;color:#68786c;font-size:12px;line-height:1.45}
.add-work-results{display:grid;gap:10px;max-height:calc(100dvh - 300px);overflow:auto;overscroll-behavior:contain;padding:2px 4px 14px 0}
.add-work-empty{padding:20px 15px;border:1px dashed #cbd9c8;border-radius:10px;background:#f8faf7;color:#647469;font-size:14px;line-height:1.55}
.add-work-result{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;padding:15px;border:1px solid #e2eae0;border-radius:12px;background:#fff}
.add-work-result-copy{display:grid;gap:5px;min-width:0}
.add-work-code{color:#47734f;font-size:12px;font-weight:750;line-height:1.4;overflow-wrap:anywhere}
.add-work-result-copy strong{color:#263c2d;font-size:15px;line-height:1.45;overflow-wrap:anywhere}
.add-work-category{color:#6c7b70;font-size:12px;line-height:1.45;overflow-wrap:anywhere}
.add-work-price{color:#2d5840;font-size:13px;font-weight:650;line-height:1.45;overflow-wrap:anywhere}
.add-work-result-button{min-width:142px;min-height:42px;font-size:13px;white-space:normal}
.add-work-result-button:disabled{cursor:default;opacity:.72}

@media(max-width:760px){
  .detail-drawer{width:100vw;max-width:100vw;height:100dvh;padding:20px 17px calc(26px + env(safe-area-inset-bottom));border-radius:0}
  .detail-price-card{grid-template-columns:1fr;gap:12px}
  .component-row{grid-template-columns:minmax(0,1fr);gap:8px}
  .component-meta{grid-template-columns:minmax(0,1fr)}
  .component-meta-code{grid-column:1}
  .component-amount{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left}
  .component-amount small{display:inline;margin:0}
  .draft-table-head{flex-direction:column;align-items:stretch}
  .draft-table-panel .draft-table-head .button{align-self:flex-start}
  .add-work-drawer{width:min(620px,100vw);padding:22px 17px calc(26px + env(safe-area-inset-bottom))}
  .add-work-results{max-height:calc(100dvh - 280px)}
  .add-work-result{grid-template-columns:minmax(0,1fr);gap:12px;padding:14px}
  .add-work-result-button{width:100%}
}
@media(max-width:420px){
  .profile-row{gap:9px;padding-inline:4px}
  .profile-row .profile-avatar{width:40px;height:40px;min-width:40px;flex-basis:40px}
  .quick-item-title{font-size:13px}
  .quick-item-total{font-size:14px}
  .detail-drawer{padding-inline:15px}
  .add-work-header h2{font-size:21px}
}
@media(prefers-reduced-motion:reduce){.add-work-scrim,.add-work-drawer{transition:none}}
