/* Road estimate app - layout on top of the shared culvert/style.css */
.new-est { display: grid; grid-template-columns: minmax(300px, 1fr) auto; gap: 14px; align-items: end; }
.new-est input { padding: 7px 9px; border: 1px solid #c9d2dc; border-radius: 6px; font: inherit; }
.est-main { margin-top: 12px; }
.est-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.est-head h1 { margin: 0; }
.total-chip { background: #eef6ff; color: var(--accent); border-radius: 99px; padding: 5px 12px; font-size: 13px; }
.est-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(380px, 1fr); gap: 14px; align-items: start; }
.map-wrap { position: relative; }
#map { height: calc(100vh - 210px); min-height: 480px; border: 1px solid var(--line); border-radius: 10px; }
.map-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.map-tools input { flex: 1; min-width: 160px; padding: 5px 9px; border: 1px solid #c9d2dc; border-radius: 6px; font: inherit; }
.map-tools .sep { width: 10px; }
.map-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.bc-app .leaflet-container { font: 12px/1.4 "Segoe UI", Arial, sans-serif; }
.bc-app .leaflet-control-layers label { font-weight: 500; margin: 0; }
.bc-app .leaflet-control-layers-selector { margin-right: 4px; }
.bc-app .leaflet-pane img, .bc-app .leaflet-tile { max-width: none !important; }
.est-panel { padding: 12px 14px; max-height: calc(100vh - 170px); overflow: auto; position: sticky; top: 64px; }
.tab-body { margin-top: 6px; }
.feat { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 6px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.feat:hover { background: #f7f9fc; }
.feat .sw { width: 10px; height: 28px; border-radius: 3px; }
.feat .fname { font-weight: 600; font-size: 13.5px; }
.feat .famt { font-weight: 700; font-size: 13px; white-space: nowrap; }
.feat .facts button { border: 1px solid var(--line); background: #fff; border-radius: 5px; width: 26px; height: 26px; cursor: pointer; margin-left: 2px; }
.empty-note { padding: 16px; background: #f6f8fb; border-radius: 8px; color: var(--muted); font-size: 13px; }
.tbl.boq td, .tbl.boq th { font-size: 12.5px; padding: 5px 6px; }
.tbl.boq tr.grp td { background: #eef2f7; font-weight: 700; color: var(--accent); text-transform: uppercase; font-size: 11.5px; letter-spacing: .04em; }
.tbl.boq tr.gtot td { font-weight: 700; background: #fafbfd; }
.tbl.boq tr.norate td { background: #fff7e6; }
.tbl.rates td { font-size: 12.5px; padding: 4px 6px; vertical-align: middle; }
.tbl.rates input { width: 96px; padding: 4px 6px; border: 1px solid #c9d2dc; border-radius: 6px; font: inherit; text-align: right; }
.tbl.rates tr:not(.used) td { color: #6b7785; }
.grid.three { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; }
h3.sub { font-size: 14px; margin: 16px 0 6px; color: var(--accent); }
.pane-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.warn-list div { background: #fff4e5; color: #8a5300; padding: 6px 10px; border-radius: 6px; margin: 6px 0; font-size: 12.5px; }
/* dialog */
.dlg-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.dlg-back[hidden] { display: none; }
.dlg-box { background: #fff; border-radius: 12px; width: min(1240px, 96vw); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dlg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 14px 18px 8px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 12px 18px; overflow: auto; }
.dlg-body .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
.dlg-body .field.wide { grid-column: span 2; }
.dlg-foot { display: flex; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.dlg-cols { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 18px; }
.dlg-cols .dlg-inputs .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.dlg-preview { border-left: 1px solid var(--line); padding-left: 16px; min-width: 0; }
.pv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 2px 0 6px; font-size: 13px; }
.pv-svg svg { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }
.pv-svg { margin-bottom: 12px; min-height: 120px; }
/* detailed measurement tables */
.tbl.detail td, .tbl.detail th { font-size: 12px; padding: 4px 5px; vertical-align: top; }
.tbl.detail td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl.detail th.n { text-align: right; }
.tbl.detail tr.ihead td { background: #eef2f7; font-weight: 700; color: var(--accent); }
.tbl.detail tr.itot td { font-weight: 700; background: #fafbfd; }
.tbl.detail .loc { color: var(--muted); font-size: 11px; }
.tbl.small-t td, .tbl.small-t th { font-size: 11.5px; padding: 3px 4px; }
/* rates */
.rate-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.rate-tools input[type=search], .rate-tools input[type=number] { padding: 4px 8px; border: 1px solid #c9d2dc; border-radius: 6px; font: inherit; }
.rate-tools input[type=search] { flex: 1; min-width: 140px; }
.rate-tools .sep { flex: 1; }
.rate-tools label.chk, .se-tools label.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
.file-btn { cursor: pointer; margin: 0; }
input.rate-in { width: 92px; padding: 3px 6px; border: 1px solid #c9d2dc; border-radius: 5px; font: inherit; font-size: 12px; text-align: right; }
input.ref-in { width: 150px; padding: 3px 6px; border: 1px solid #c9d2dc; border-radius: 5px; font: inherit; font-size: 12px; }
tr.userrate input.rate-in { background: #fff8db; border-color: #e0b84a; }
.tbl.boq input.rate-in { width: 86px; }
.tbl.boq td.right { white-space: nowrap; }
input.ref-in { width: 120px; }
/* full cross-section editor in the road dialog */
.field.full { grid-column: 1 / -1; }
.bc-app .field.sec-ed { display: block; }
.sec-ed { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.se-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 8px 0 4px; font-size: 13px; }
.se-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 6px; }
.se-tools select { padding: 4px 6px; border: 1px solid #c9d2dc; border-radius: 6px; font: inherit; max-width: 260px; }
.se-tbl td, .se-tbl th { padding: 3px 4px; font-size: 12px; vertical-align: middle; }
.se-tbl input, .se-tbl select { padding: 3px 5px; border: 1px solid #c9d2dc; border-radius: 5px; font: inherit; font-size: 12px; background: #fff; }
.se-tbl input[type=number] { width: 54px; }
.se-tbl input[type=text] { width: 80px; }
.se-tbl input.wide { width: 150px; }
.se-tbl select { max-width: 128px; }
.se-tbl .det label { display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.se-tbl .det input[type=number] { width: 52px; }
.se-tbl .acts { white-space: nowrap; }
.se-tbl .acts button { border: 1px solid var(--line); background: #fff; border-radius: 5px; width: 24px; height: 24px; cursor: pointer; margin-left: 2px; }
@media (max-width: 1000px) { .dlg-cols { grid-template-columns: 1fr; } .dlg-preview { border-left: 0; padding-left: 0; } }
@media (max-width: 1100px) {
  .est-layout { grid-template-columns: 1fr; }
  .est-panel { position: static; max-height: none; }
  #map { height: 60vh; }
}
