/* ============================================================
   QUANTOBRA.CSS
   Complemento ao apartamentos.css — não duplica nenhum estilo base.
   ============================================================ */

/* ============================= */
/* CONTAINER E LAYOUT            */
/* ============================= */
#quantObra-container {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f9fafb;
    min-height: 100vh;
}

#quantObra-header {
    padding: 20px 30px;
    background: #f5f7fa;
    border-bottom: 1px solid #ddd;
}

#submenu-quantObra {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================= */
/* BARRA DE OBRA                 */
/* ============================= */
#barra-projeto {
    padding: 10px 30px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    min-height: 52px;
}
.projeto-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.projeto-label { font-weight: 700; color: #374151; font-size: 14px; }
#projeto-nome-display { font-size: 14px; color: #1f2937; font-weight: 600; }
#projeto-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-pill { background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: #374151; }
.stat-pill-green { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }

/* ============================= */
/* SEÇÕES                        */
/* ============================= */
.secao-quantObra { padding: 25px 35px; display: none; background: #f9fafb; }
.secao-quantObra.active { display: block; }

/* ============================= */
/* EMPTY STATE                   */
/* ============================= */
.empty-state-module { text-align: center; padding: 80px 40px; color: #6b7280; }
.empty-state-module .empty-icon { font-size: 72px; display: block; margin-bottom: 20px; }
.empty-state-module h3 { font-size: 24px; font-weight: 700; color: #374151; margin-bottom: 12px; }
.empty-state-module p { font-size: 15px; margin-bottom: 8px; }

/* ============================= */
/* KPI CARDS                     */
/* ============================= */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; margin-bottom: 25px; }
.kpi-card { background: #fff; border-radius: 12px; padding: 22px 25px; box-shadow: 0 2px 8px rgba(0,0,0,.06); border: 1px solid #e5e7eb; border-left: 4px solid #667eea; }
.kpi-card.green  { border-left-color: #10b981; }
.kpi-card.orange { border-left-color: #f59e0b; }
.kpi-card.blue   { border-left-color: #3b82f6; }
.kpi-icon  { font-size: 28px; display: block; margin-bottom: 10px; }
.kpi-valor { font-size: 30px; font-weight: 800; color: #1f2937; margin-bottom: 6px; }
.kpi-label { font-size: 12px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-sub   { font-size: 12px; color: #9ca3af; margin-top: 5px; }

/* ============================= */
/* WBS PROGRESS                  */
/* ============================= */
.wbs-row { display: flex; align-items: center; gap: 15px; padding: 12px 5px; border-bottom: 1px solid #f3f4f6; }
.wbs-row:last-child { border-bottom: none; }
.wbs-row:hover { background: #f9fafb; border-radius: 6px; }
.wbs-code-badge { background: #667eea; color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 700; font-family: monospace; min-width: 90px; text-align: center; flex-shrink: 0; }
.wbs-desc { flex: 1; font-size: 13px; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wbs-progress-wrapper { min-width: 140px; }
.wbs-progress-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.wbs-progress-fill { height: 100%; border-radius: 4px; background: #667eea; transition: width .5s; }
.wbs-progress-fill.full   { background: #10b981; }
.wbs-progress-fill.mid    { background: #f59e0b; }
.wbs-progress-fill.low    { background: #ef4444; }
.wbs-progress-fill.zero   { background: #e5e7eb; }
.wbs-pct   { font-size: 12px; color: #6b7280; text-align: right; margin-top: 2px; font-weight: 600; }
.wbs-count { font-size: 12px; color: #9ca3af; min-width: 80px; text-align: right; flex-shrink: 0; }

.ultimo-lev-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.ultimo-lev-item:last-child { border-bottom: none; }
.ultimo-lev-data  { font-size: 11px; color: #9ca3af; min-width: 80px; flex-shrink: 0; }
.ultimo-lev-desc  { flex: 1; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ultimo-lev-valor { font-weight: 700; color: #667eea; white-space: nowrap; }

/* ============================= */
/* TABELA DE LEVANTAMENTOS       */
/* ============================= */
.filtros-lev-row { display: flex; gap: 15px; flex-wrap: wrap; align-items: flex-end; }
.tabela-lev-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.badge-count { background: #667eea; color: #fff; border-radius: 20px; padding: 4px 14px; font-size: 13px; font-weight: 600; }
.tabela-lev-wrapper { overflow-x: auto; }
.tabela-lev { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela-lev th { background: #f3f4f6; padding: 10px 12px; text-align: left; font-weight: 700; color: #374151; border-bottom: 2px solid #e5e7eb; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tabela-lev th.th-num    { text-align: right; }
.tabela-lev th.th-center { text-align: center; }
.tabela-lev th.th-lev    { background: #eff6ff; color: #1d4ed8; border-bottom-color: #bfdbfe; }
.tabela-lev td { padding: 9px 12px; border-bottom: 1px solid #f3f4f6; color: #374151; vertical-align: middle; }
.tabela-lev tr:hover td { background: #f9fafb; }
.tabela-lev .td-num    { text-align: right; font-family: monospace; font-size: 12px; }
.tabela-lev .td-center { text-align: center; }
.tabela-lev .td-empty  { text-align: center; padding: 50px; color: #9ca3af; }
.col-lev-highlight { background: #f0f9ff !important; color: #1d4ed8 !important; font-weight: 700 !important; }
.row-sem-lev td { opacity: .65; }
.row-sem-lev:hover td { opacity: 1; }
.diff-positivo { color: #dc2626 !important; font-weight: 700; }
.diff-negativo { color: #059669 !important; font-weight: 700; }
.diff-zero     { color: #9ca3af !important; }
.btn-levantamento { background: #667eea; color: #fff; border: none; border-radius: 6px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .2s; white-space: nowrap; }
.btn-levantamento:hover { background: #5a6fd8; }
.btn-levantamento.has-lev { background: #10b981; }
.btn-levantamento.has-lev:hover { background: #059669; }

/* ============================= */
/* PRANCHETA DIGITAL             */
/* ============================= */
.prancheta-layout { display: grid; grid-template-columns: 270px 1fr 280px; gap: 18px; height: calc(100vh - 210px); min-height: 580px; }
.painel-ferramentas, .painel-medicoes { overflow-y: auto; display: flex; flex-direction: column; gap: 15px; scrollbar-width: thin; scrollbar-color: #e5e7eb transparent; }
.painel-ferramentas .card-parametrizacao,
.painel-medicoes .card-parametrizacao { margin-bottom: 0; }
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tool-btn { background: #e6e9ef; border: 2px solid transparent; border-radius: 8px; padding: 9px 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .2s; color: #374151; text-align: center; }
.tool-btn:hover { background: #d5d9e3; }
.tool-btn.active { background: #667eea; color: #fff; border-color: #5a6fd8; box-shadow: 0 2px 6px rgba(102,126,234,.3); }
.tool-btn.btn-remover { background: #fef2f2; color: #ef4444; border-color: #fecaca; }
.tool-btn.btn-remover:hover { background: #fee2e2; }
.escala-info { margin-top: 8px; text-align: center; }
.escala-badge { display: inline-block; background: #fffbeb; border: 1px solid #fbbf24; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: #92400e; }
.escala-hint  { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.painel-canvas { background: #d1d5db; border-radius: 10px; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; }
#konva-container { width: 100%; height: 100%; cursor: crosshair; }
.canvas-hint { position: absolute; text-align: center; color: #6b7280; font-size: 14px; pointer-events: none; line-height: 1.6; background: rgba(255,255,255,.6); border-radius: 12px; padding: 20px 30px; }
.canvas-cursor-info { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; border-radius: 4px; padding: 3px 8px; pointer-events: none; display: none; }
.upload-planta { border: 2px dashed #d1d5db; border-radius: 8px; padding: 18px; text-align: center; cursor: pointer; transition: all .2s; color: #6b7280; }
.upload-planta:hover { border-color: #667eea; background: #f5f7ff; color: #667eea; }
.upload-planta span { font-size: 30px; display: block; margin-bottom: 6px; }
.upload-planta p    { font-size: 12px; margin: 0; }
.medicao-item { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin-bottom: 7px; display: flex; align-items: flex-start; gap: 8px; }
.medicao-info { flex: 1; }
.medicao-tipo  { font-size: 11px; color: #6b7280; text-transform: uppercase; margin-bottom: 2px; }
.medicao-valor { font-weight: 700; color: #1d4ed8; font-size: 15px; }
.btn-del-medicao { background: #fef2f2; border: 1px solid #fecaca; color: #ef4444; border-radius: 5px; width: 26px; height: 26px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-del-medicao:hover { background: #fee2e2; }
.medicao-empty { text-align: center; padding: 25px; color: #9ca3af; font-size: 13px; }
.medicao-total-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 15px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: #1d4ed8; margin-top: 10px; }
.medicao-total-box strong { font-size: 20px; font-weight: 800; }
.upload-anexo, .upload-anexo-mini { border: 2px dashed #d1d5db; border-radius: 8px; padding: 12px; text-align: center; cursor: pointer; transition: all .2s; font-size: 13px; color: #6b7280; margin-top: 8px; }
.upload-anexo:hover, .upload-anexo-mini:hover { border-color: #667eea; background: #f5f7ff; color: #667eea; }
.upload-anexo-mini { padding: 8px; font-size: 12px; }
.anexo-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; margin-top: 6px; font-size: 12px; }
.anexo-nome { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; }
.anexo-size { font-size: 11px; color: #9ca3af; flex-shrink: 0; }
.btn-del-anexo { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 16px; padding: 0 3px; flex-shrink: 0; }

/* ============================= */
/* MODAIS                        */
/* ============================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 9999; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-content-std { background: #fff; border-radius: 12px; width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal-content-lev { background: #fff; border-radius: 12px; width: 100%; max-width: 920px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal-header-std { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 25px; border-bottom: 1px solid #e5e7eb; gap: 12px; }
.modal-header-std h3 { font-size: 17px; font-weight: 700; color: #1f2937; margin: 0; }
.btn-close-std { background: #f3f4f6; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #6b7280; flex-shrink: 0; }
.btn-close-std:hover { background: #e5e7eb; color: #1f2937; }
.modal-body-std { padding: 22px 25px; }
.modal-body-lev { padding: 22px 25px; display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.lev-stats-mini { display: flex; gap: 12px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 15px; margin-bottom: 15px; }
.lev-stats-mini > div { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.lev-stats-mini span   { font-size: 10px; color: #6b7280; text-transform: uppercase; font-weight: 600; }
.lev-stats-mini strong { font-size: 14px; color: #1f2937; font-weight: 700; }
.text-highlight { color: #667eea !important; }
.formula-hint { font-size: 12px; color: #667eea; margin-top: 4px; font-style: italic; }
.campos-din-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin-top: 12px; }
.result-preview-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 16px; margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: #1e40af; }
.result-preview-box strong { font-size: 22px; font-weight: 800; }
.lev-historico-panel h4 { font-size: 14px; font-weight: 700; color: #1f2937; margin-bottom: 12px; text-transform: uppercase; }
.hist-row-lev { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.hist-row-top    { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.hist-row-desc   { font-size: 13px; color: #374151; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row-valor  { font-size: 15px; font-weight: 700; color: #667eea; white-space: nowrap; }
.hist-row-bottom { display: flex; justify-content: space-between; align-items: center; }
.hist-row-meta   { font-size: 11px; color: #9ca3af; }
.hist-row-actions { display: flex; gap: 3px; }
.hist-row-actions button { background: #f3f4f6; border: none; border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 12px; color: #374151; }
.hist-row-actions button:hover { background: #e5e7eb; }
.hist-row-actions .btn-hist-del { color: #ef4444; }
.hist-row-actions .btn-hist-del:hover { background: #fef2f2; }
.hist-empty { text-align: center; padding: 30px; color: #9ca3af; font-size: 13px; background: #f9fafb; border-radius: 8px; }
.historico-total-box { background: #f0fdf4; border: 1px solid #6ee7b7; border-radius: 8px; padding: 12px 15px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: #065f46; margin-top: 15px; }
.historico-total-box strong { font-size: 18px; font-weight: 800; }
.lev-anexos-section { margin-top: 20px; padding-top: 15px; border-top: 1px solid #e5e7eb; }
.lev-anexos-section > label { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 6px; }
.escala-modal-info { display: flex; align-items: flex-start; gap: 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 14px; font-size: 14px; color: #78350f; }
.escala-modal-info span { font-size: 28px; flex-shrink: 0; }
.escala-px-info { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 6px; padding: 10px 14px; font-size: 13px; color: #0369a1; margin-top: 12px; }

/* ============================= */
/* SELETOR DE OBRAS              */
/* ============================= */
.obras-loading { text-align: center; padding: 40px; color: #6b7280; font-size: 14px; }
.obras-vazio   { text-align: center; padding: 40px 20px; color: #9ca3af; font-size: 14px; line-height: 1.7; }
.obras-busca-wrapper { margin-bottom: 16px; }
.obras-busca-wrapper input { width: 100%; padding: 11px 15px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; box-sizing: border-box; }
.obras-busca-wrapper input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.12); }
#obras-lista-container { max-height: 440px; overflow-y: auto; scrollbar-width: thin; }
.obra-card-sel { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 10px; cursor: pointer; transition: all .18s; background: #fff; }
.obra-card-sel:hover { border-color: #667eea; background: #f5f7ff; box-shadow: 0 3px 10px rgba(102,126,234,.12); transform: translateY(-1px); }
.obra-card-ativa { border-color: #10b981 !important; background: #f0fdf4 !important; }
.obra-card-icon-sel { font-size: 28px; flex-shrink: 0; }
.obra-card-info-sel { flex: 1; min-width: 0; }
.obra-card-nome { font-size: 15px; font-weight: 700; color: #1f2937; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge-atual { display: inline-block; background: #10b981; color: #fff; border-radius: 12px; padding: 2px 9px; font-size: 11px; font-weight: 600; }
.obra-card-meta-row { display: flex; gap: 16px; font-size: 12px; color: #6b7280; flex-wrap: wrap; }
.obra-card-arrow { color: #9ca3af; font-size: 13px; flex-shrink: 0; transition: transform .18s; }
.obra-card-sel:hover .obra-card-arrow { color: #667eea; transform: translateX(3px); }

/* ============================= */
/* BADGES                        */
/* ============================= */
.badge-perda     { display: inline-block; background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 700; margin-left: 4px; vertical-align: middle; }
.badge-prancheta { display: inline-block; background: #ede9fe; border: 1px solid #c4b5fd; color: #6d28d9; border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 700; margin-left: 4px; vertical-align: middle; }

/* ============================= */
/* RELATÓRIO                     */
/* ============================= */
.relatorio-wbs-section { margin-bottom: 35px; }
.relatorio-wbs-title { font-size: 15px; font-weight: 700; color: #1f2937; padding: 8px 0; border-bottom: 2px solid #667eea; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.relatorio-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.relatorio-table th { background: #f3f4f6; padding: 8px 10px; text-align: left; font-weight: 700; color: #374151; border-bottom: 1px solid #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.relatorio-table td { padding: 7px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.relatorio-table tr:hover td { background: #f9fafb; }
.relatorio-table .td-r   { text-align: right; font-family: monospace; font-size: 12px; }
.relatorio-table .td-lev { color: #1d4ed8; font-weight: 700; }
.relatorio-footer-row td { background: #f3f4f6; font-weight: 700; border-top: 2px solid #e5e7eb; }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-mini { flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.progress-mini-fill { height: 100%; border-radius: 3px; background: #667eea; }
.progress-mini-fill.green  { background: #10b981; }
.progress-mini-fill.orange { background: #f59e0b; }
.progress-mini-fill.red    { background: #ef4444; }

/* ============================= */
/* RESPONSIVIDADE                */
/* ============================= */
@media (max-width: 1024px) {
    .prancheta-layout { grid-template-columns: 1fr; height: auto; }
    .painel-canvas    { height: 480px; }
    .modal-body-lev   { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .secao-quantObra { padding: 15px; }
    .filtros-lev-row { flex-direction: column; }
    .kpi-grid        { grid-template-columns: repeat(2, 1fr); }
}
@media print {
    #quantObra-header, #barra-projeto, #secao-dashboard,
    #secao-levantamentos, #secao-prancheta { display: none !important; }
    #secao-relatorio { display: block !important; padding: 0 !important; }
}

/* ============================= */
/* MODAL PRANCHETA RÁPIDA        */
/* ============================= */
.modal-content-prancheta {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 1100px;
    max-height: 92vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.22);
    display: flex;
    flex-direction: column;
}
.pr-body {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.pr-painel-esq {
    padding: 16px;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
    scrollbar-width: thin;
}
.pr-canvas-wrapper {
    position: relative;
    background: #d1d5db;
    min-height: 460px;
}
.pr-canvas-wrapper canvas { display: block; }

/* Botão prancheta na tabela */
.btn-lev-prancheta {
    background: #ede9fe;
    border: 1px solid #c4b5fd;
    color: #6d28d9;
    border-radius: 6px;
    padding: 4px 7px;
    font-size: 13px;
    cursor: pointer;
    margin-left: 4px;
    transition: background .15s;
    vertical-align: middle;
}
.btn-lev-prancheta:hover { background: #ddd6fe; }

/* Ferramenta Cota */
#tool-cota.active { background: #f59e0b; color: #fff; border-color: #d97706; }

/* Atalhos hint */
.tools-hint { font-size: 11px; color: #9ca3af; margin-top: 6px; line-height: 1.6; }

/* ============================= */
/* FERRAMENTA APAGAR             */
/* ============================= */
#tool-apagar.active {
    background: #ef4444;
    color: #fff;
    border-color: #dc2626;
    box-shadow: 0 2px 6px rgba(239,68,68,.3);
}

/* ============================= */
/* DASHBOARD FILTROS             */
/* ============================= */
.dash-filtros-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e5e7eb);
    box-shadow: 0 3px 10px rgba(0,0,0,.04);
}

/* ============================= */
/* BUSCA INSUMO PRANCHETA        */
/* ============================= */
.insumo-search-wrapper {
    position: relative;
    display: flex;
    gap: 4px;
    align-items: center;
}
.insumo-search-wrapper input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color .2s;
}
.insumo-search-wrapper input:focus {
    outline: none;
    border-color: var(--primary, #667eea);
    box-shadow: 0 0 0 3px rgba(102,126,234,.12);
}
.btn-clear-busca {
    background: #f3f4f6;
    border: none; border-radius: 6px;
    width: 28px; height: 28px;
    cursor: pointer; font-size: 16px; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .15s;
}
.btn-clear-busca:hover { background: #e5e7eb; color: #1f2937; }

.insumo-resultados {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 500;
    max-height: 280px;
    overflow-y: auto;
    margin-top: 4px;
}
.ins-res-vazio { padding: 20px; text-align: center; color: #9ca3af; font-size: 13px; }
.ins-res-grupo { border-bottom: 1px solid #f3f4f6; }
.ins-res-grupo:last-child { border-bottom: none; }
.ins-res-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px 4px; background: #f9fafb;
}
.ins-res-code {
    font-size: 11px; font-family: monospace;
    background: var(--primary, #667eea); color: #fff;
    border-radius: 4px; padding: 1px 6px; flex-shrink: 0;
}
.ins-res-nome { font-size: 13px; font-weight: 600; color: #1f2937; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-res-un { font-size: 11px; font-weight: 700; color: #6b7280; flex-shrink: 0; }
.ins-aprs-lista { padding: 2px 6px 6px; }
.ins-apr-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background .15s;
}
.ins-apr-item:hover { background: #eff6ff; }
.ins-apr-wbs {
    font-size: 11px; font-family: monospace; font-weight: 700; color: #1d4ed8;
    background: #dbeafe; border-radius: 4px; padding: 2px 7px;
    flex-shrink: 0; min-width: 60px; text-align: center;
}
.ins-apr-desc { font-size: 12px; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.insumo-selecionado-box {
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 8px; padding: 10px 12px; margin-top: 8px; position: relative;
}
.ins-sel-nome { font-size: 13px; font-weight: 700; color: #1e40af; margin-bottom: 4px; padding-right: 60px; }
.ins-sel-meta { font-size: 11px; color: #3b82f6; line-height: 1.5; }
.ins-sel-troca {
    position: absolute; top: 8px; right: 8px;
    background: #dbeafe; border: 1px solid #bfdbfe; color: #1d4ed8;
    border-radius: 5px; padding: 3px 8px; font-size: 11px; cursor: pointer;
    transition: background .15s; white-space: nowrap;
}
.ins-sel-troca:hover { background: #bfdbfe; }

.medicao-perimetro { font-size: 11px; color: #047857; font-weight: 600; margin-top: 2px; }

/* ============================= */
/* SNAP GRID / COORD INPUT       */
/* ============================= */
.snap-config-box {
    background:#f9fafb;border:1px solid var(--border-color,#e5e7eb);
    border-radius:8px;padding:10px 12px;margin:10px 0 0;
}
.snap-config-header{display:flex;align-items:center;justify-content:space-between;font-size:12px;font-weight:700;color:#374151;}
.snap-toggle-label{display:flex;align-items:center;gap:6px;cursor:pointer;font-weight:600;font-size:12px;color:#6b7280;}
.snap-toggle-label input[type="checkbox"]{cursor:pointer;}
.coord-input-box{background:#f0fdf4;border:1px solid #6ee7b7;border-radius:8px;padding:10px 12px;margin-top:8px;}
.coord-input-box input[type="number"]{padding:6px 8px;border:1px solid #d1d5db;border-radius:6px;font-size:13px;width:100%;box-sizing:border-box;}

/* ============================= */
/* BUSCA INSUMO PRANCHETA        */
/* ============================= */
.insumo-search-wrapper{position:relative;display:flex;gap:4px;align-items:center;}
.insumo-search-wrapper input{flex:1;padding:9px 12px;border:1px solid var(--border-color,#e5e7eb);border-radius:8px;font-size:13px;font-family:inherit;transition:border-color .2s;}
.insumo-search-wrapper input:focus{outline:none;border-color:var(--primary,#667eea);box-shadow:0 0 0 3px rgba(102,126,234,.12);}
.btn-clear-busca{background:#f3f4f6;border:none;border-radius:6px;width:28px;height:28px;cursor:pointer;font-size:16px;color:#6b7280;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .15s;}
.btn-clear-busca:hover{background:#e5e7eb;color:#1f2937;}
.insumo-resultados{position:absolute;top:100%;left:0;right:0;background:#fff;border:1px solid var(--border-color,#e5e7eb);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);z-index:500;max-height:280px;overflow-y:auto;margin-top:4px;}
.ins-res-vazio{padding:14px;text-align:center;color:#9ca3af;font-size:13px;}
.ins-res-grupo{border-bottom:1px solid #f3f4f6;}
.ins-res-grupo:last-child{border-bottom:none;}
.ins-res-header{display:flex;align-items:center;gap:7px;padding:7px 12px 3px;background:#f9fafb;}
.ins-res-code{font-size:11px;font-family:monospace;background:var(--primary,#667eea);color:#fff;border-radius:4px;padding:1px 6px;flex-shrink:0;}
.ins-res-nome{font-size:13px;font-weight:600;color:#1f2937;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.ins-res-un{font-size:11px;font-weight:700;color:#6b7280;flex-shrink:0;}
.ins-aprs-lista{padding:2px 6px 5px;}
.ins-apr-item{display:flex;align-items:center;gap:8px;padding:5px 8px;border-radius:5px;cursor:pointer;transition:background .15s;}
.ins-apr-item:hover{background:#eff6ff;}
.ins-apr-wbs{font-size:11px;font-family:monospace;font-weight:700;color:#1d4ed8;background:#dbeafe;border-radius:4px;padding:2px 7px;flex-shrink:0;min-width:60px;text-align:center;}
.ins-apr-desc{font-size:12px;color:#374151;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;}
.insumo-selecionado-box{background:#eff6ff;border:1px solid #bfdbfe;border-radius:8px;padding:10px 12px;margin-top:8px;position:relative;}
.ins-sel-nome{font-size:13px;font-weight:700;color:#1e40af;margin-bottom:4px;padding-right:60px;}
.ins-sel-meta{font-size:11px;color:#3b82f6;line-height:1.5;}
.ins-sel-troca{position:absolute;top:8px;right:8px;background:#dbeafe;border:1px solid #bfdbfe;color:#1d4ed8;border-radius:5px;padding:3px 8px;font-size:11px;cursor:pointer;transition:background .15s;white-space:nowrap;}
.ins-sel-troca:hover{background:#bfdbfe;}

/* ============================= */
/* SESSÃO DA PRANCHETA           */
/* ============================= */
.sessao-box{background:#fafafa;border:1px solid var(--border-color,#e5e7eb);border-radius:8px;padding:10px 12px;margin-top:12px;}

/* ============================= */
/* FERRAMENTAS PAN / APAGAR      */
/* ============================= */
#tool-pan.active{background:#0ea5e9;color:#fff;border-color:#0284c7;box-shadow:0 2px 6px rgba(14,165,233,.3);}
#tool-apagar.active{background:#ef4444;color:#fff;border-color:#dc2626;box-shadow:0 2px 6px rgba(239,68,68,.3);}

/* ============================= */
/* MODAL MULTI-INSUMO            */
/* ============================= */
.modal-content-multi{
    background:#fff;border-radius:12px;width:100%;max-width:1100px;
    max-height:90vh;overflow-y:auto;
    box-shadow:0 20px 60px rgba(0,0,0,.18);
}
.multi-resumo-bar{
    display:flex;gap:12px;flex-wrap:wrap;
    background:#f0fdf4;border:1px solid #6ee7b7;
    border-radius:8px;padding:12px 16px;margin-bottom:16px;
}
.multi-resumo-item{
    display:flex;align-items:center;gap:6px;
    font-size:13px;color:#065f46;
}
.multi-resumo-item strong{font-size:16px;font-weight:800;color:#047857;}
.multi-linha{
    background:#f9fafb;border:1px solid var(--border-color,#e5e7eb);
    border-radius:10px;padding:14px 16px;margin-bottom:10px;
}
.multi-linha-header{
    display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;
}
.multi-linha-num{font-weight:700;font-size:13px;color:#374151;}
.multi-linha-body .form-field label{font-size:12px;}
.multi-preview-box{
    background:#eff6ff;border:1px solid #bfdbfe;
    border-radius:6px;padding:8px 12px;
    font-size:13px;color:#1e40af;display:flex;align-items:center;gap:8px;
}
.multi-preview-box strong{font-size:16px;font-weight:800;}

/* Painel de resumo ao vivo */
.multi-resumo-painel {
    background: #f9fafb;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: 0;
}

@media (max-width: 900px) {
    .modal-content-multi { max-width: 98vw; }
    .modal-body-std[style*="grid"] { grid-template-columns: 1fr !important; }
    .multi-resumo-painel { position: static; }
}

/* ============================= */
/* ABAS PAINEL DIREITO PRANCHETA */
/* ============================= */
.painel-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}
.painel-tab {
    flex: 1;
    padding: 8px 6px;
    background: #e6e9ef;
    border: none;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #374151;
    transition: all .18s;
}
.painel-tab:hover  { background: #d5d9e3; }
.painel-tab.active { background: var(--primary, #667eea); color: #fff; }

/* ============================= */
/* LISTA LEVANTADOS NA PRANCHETA */
/* ============================= */
.lev-prancheta-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 11px;
    background: #f9fafb;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    margin-bottom: 7px;
    transition: border-color .18s;
}
.lev-prancheta-item:hover { border-color: #c7d2fe; }
.lev-p-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
}
.lev-p-insumo {
    font-size: 12px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lev-p-valor {
    font-size: 13px;
    font-weight: 800;
    color: var(--primary, #667eea);
    white-space: nowrap;
    flex-shrink: 0;
}
.lev-p-meta {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}
.lev-p-desc {
    font-size: 11px;
    color: #6b7280;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lev-p-data {
    font-size: 10px;
    color: #9ca3af;
    flex-shrink: 0;
}

/* ============================= */
/* PÉ DIREITO CAMPO MULTI        */
/* ============================= */
.multi-pe-direito-box input {
    border-color: #6ee7b7 !important;
    background: #f0fdf4;
}

/* ============================= */
/* MODO LEVANTADOS (painel full) */
/* ============================= */
.prancheta-layout.modo-levantados {
    grid-template-columns: var(--painel-esq-w, 240px) 1fr;
}
.prancheta-layout.modo-levantados .painel-medicoes {
    grid-column: 2 / -1;
    max-height: 80vh;
    overflow-y: auto;
}
.lev-grupo-header {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 6px 10px;
    margin: 10px 0 6px;
    border-left: 3px solid var(--primary, #667eea);
}

/* ============================= */
/* DESCONTO L×A                  */
/* ============================= */
.multi-desconto-dim-box input {
    padding: 5px 7px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}
.multi-desc-toggle {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 3px;
    padding: 1px 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    color: #1d4ed8;
    transition: background .15s;
}
.multi-desc-toggle:hover { background: #dbeafe; }

/* ============================= */
/* NOME DO LEVANTAMENTO          */
/* ============================= */
#pran-nome-lev {
    border-left: 4px solid #fbbf24;
}

/* ============================= */
/* LOCAL HIERÁRQUICO UA/ACI/ACE  */
/* ============================= */
.btn-tipo-local {
    padding: 5px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: #f9fafb;
    color: #374151;
    transition: all .15s;
}
.btn-tipo-local:hover  { background: #e5e7eb; }
.btn-tipo-local.active { background: var(--primary, #667eea); color: #fff; border-color: var(--primary, #667eea); }
.local-sub-campos { animation: fadeInDown .2s ease; }
@keyframes fadeInDown {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0); }
}

/* SESSÕES CARD */
.pran-sessoes-card-container{max-height:220px;overflow-y:auto;border:1px solid #e5e7eb;border-radius:8px;background:#fafafa}
.sessao-card-item{display:flex;align-items:center;gap:8px;padding:8px 10px;cursor:pointer;border-bottom:1px solid #f3f4f6;transition:background .15s}
.sessao-card-item:last-child{border-bottom:none}.sessao-card-item:hover{background:#ecfdf5}
.sessao-card-ativa{background:#d1fae5!important;border-left:3px solid #059669}
.sessao-card-thumb{width:48px;height:36px;object-fit:cover;border-radius:4px;border:1px solid #e5e7eb;flex-shrink:0}
.sessao-card-info{flex:1;min-width:0}.sessao-card-nome{font-size:12px;font-weight:700;color:#1f2937;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sessao-card-meta{font-size:10px;color:#6b7280;margin-top:1px}.sessao-card-tags{display:flex;gap:4px;flex-wrap:wrap;margin-top:3px}
.sessao-tag{font-size:9px;padding:1px 5px;border-radius:3px;font-weight:600}
.tag-pdf{background:#dbeafe;color:#1e40af}.tag-geo{background:#d1fae5;color:#065f46}.tag-med{background:#f3f4f6;color:#6b7280}

/* CONCRETO BADGES */
.conc-med-badge{background:#eff6ff;border:1px solid #bfdbfe;border-radius:6px;padding:6px 10px;margin-bottom:8px;font-size:12px;color:#1e40af}
.conc-info{font-size:11px;color:#6b7280;margin-bottom:8px;font-style:italic}
.conc-form-panel{min-height:60px}

/* INSUMO SEARCH POPUP - expanded */
.insumo-resultados-open{max-height:400px!important;overflow-y:auto;background:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,0.15);margin-top:4px}

/* LAYER BUTTONS */
.layer-btn{font-size:10px;padding:3px 6px;border:1px solid #d1d5db;border-radius:4px;background:#f9fafb;color:#9ca3af;cursor:pointer;transition:all .15s;text-decoration:line-through}
.layer-btn.layer-on{background:#ecfdf5;border-color:#86efac;color:#065f46;text-decoration:none;font-weight:600}

/* ============================================================
   ESTACAS — Levantamento de Fundações
   ============================================================ */
.est-modal-box{background:#fff;border-radius:12px;width:100%;max-width:620px;max-height:92vh;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,.18)}
.est-modal-body{overflow-y:auto;overflow-x:hidden;flex:1;padding:14px 18px}
.est-tipo-btn{display:inline-flex;align-items:center;gap:5px;padding:5px 12px;border:2px solid #e5e7eb;border-radius:8px;background:#f9fafb;font-size:12px;font-weight:700;cursor:pointer;transition:all .18s;color:#374151}
.est-tipo-btn.active{border-color:#6366f1;background:#eef2ff;color:#4338ca}
.est-tipo-btn:hover:not(.active){border-color:#a5b4fc;background:#f5f3ff}
.est-form-card{background:#faf5ff;border:2px solid #c4b5fd;border-radius:10px;padding:14px;margin-bottom:14px}
.est-form-title{font-size:12px;font-weight:800;color:#5b21b6;margin-bottom:10px}
.est-section-title{font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.07em;color:#6366f1;margin:10px 0 5px;padding-bottom:3px;border-bottom:1px solid #e0e7ff}
.est-section-title:first-of-type{margin-top:0}
.est-formula-badge{background:#eff6ff;border:1px solid #bfdbfe;border-radius:6px;padding:5px 9px;font-size:11px;color:#1e40af;margin-top:4px;font-style:italic;word-break:break-word}
/* Compact fields */
.est-field{display:flex;flex-direction:column;gap:3px;min-width:0}
.est-field label{font-size:11px;font-weight:600;color:#374151;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.est-field input,.est-field select{box-sizing:border-box;width:100%;padding:6px 8px;border:1px solid #d1d5db;border-radius:6px;font-size:12px;background:#fff;transition:border-color .2s}
.est-field input:focus,.est-field select:focus{outline:none;border-color:#6366f1;box-shadow:0 0 0 2px rgba(99,102,241,.12)}
.est-inp-sync{background:#f5f3ff!important;border-color:#c4b5fd!important;color:#5b21b6!important;font-weight:700!important}
.est-lbl-sync{font-size:9px;color:#7c3aed;font-weight:400}
/* Grids */
.est-grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-bottom:6px}
.est-grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-bottom:6px}
@media(max-width:520px){.est-grid-4{grid-template-columns:1fr 1fr}.est-grid-3{grid-template-columns:1fr 1fr}}
/* Search */
.est-search-wrap{position:relative;margin-bottom:3px}
.est-search-inp{box-sizing:border-box;width:100%;padding:6px 9px;border:1px solid #d1d5db;border-radius:6px;font-size:12px;background:#fff}
.est-search-inp:focus{outline:none;border-color:#6366f1}
.est-search-res{background:#fff;border:1px solid #c4b5fd;border-radius:6px;box-shadow:0 4px 12px rgba(99,102,241,.12);max-height:180px;overflow-y:auto;margin-top:3px}
.est-search-res .ins-res-header{padding:5px 10px 2px}
.est-search-res .ins-apr-item{padding:5px 10px;font-size:12px}
.est-apr-nome{font-size:10px;color:#4338ca;font-weight:600;min-height:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:2px}
/* Preview */
.est-preview-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(88px,1fr));gap:5px}
.est-summary-card{background:#fff;border:1px solid #e5e7eb;border-radius:6px;padding:5px 6px;text-align:center}
.est-summary-card .est-sc-val{font-size:11px;font-weight:800;color:#1f2937}
.est-summary-card .est-sc-lbl{font-size:9px;color:#6b7280;margin-top:1px}
/* Lista */
.est-lista-card{border:1px solid #e5e7eb;border-radius:8px;overflow:hidden;margin-bottom:12px}
.est-lista-header{background:#f3f4f6;padding:7px 12px;font-size:12px;font-weight:800;color:#374151;display:flex;justify-content:space-between;align-items:center}
.est-trecho-table{width:100%;border-collapse:collapse;font-size:11px}
.est-trecho-table th{background:#f3f4f6;padding:4px 6px;text-align:left;font-weight:700;color:#374151;border-bottom:1px solid #e5e7eb;white-space:nowrap}
.est-trecho-table td{padding:4px 6px;border-bottom:1px solid #f3f4f6;vertical-align:middle;white-space:nowrap}
.est-trecho-table tr:last-child td{border-bottom:none}
.est-trecho-table tr.est-row-editando{background:#fef9c3!important}
.est-empty{text-align:center;color:#9ca3af;padding:10px}
.est-del-btn{background:none;border:none;color:#ef4444;cursor:pointer;font-size:12px;padding:0 3px}
.est-edit-btn{background:#eef2ff;border:1px solid #a5b4fc;color:#4338ca;border-radius:4px;cursor:pointer;font-size:11px;padding:2px 7px;font-weight:700}
.est-edit-btn:hover{background:#e0e7ff}

/* ============================================================
   ESTACAS — Card-based list + totals
   ============================================================ */
.est-lote-row{border:1.5px solid #e5e7eb;border-radius:8px;margin-bottom:8px;overflow:hidden;transition:border-color .2s}
.est-lote-header{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#f9fafb;border-bottom:1px solid #e5e7eb;flex-wrap:wrap}
.est-lote-num{font-size:11px;font-weight:800;color:#6b7280;min-width:20px}
.est-lote-dim{font-size:11px;color:#6b7280;margin-left:4px}
.est-lote-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:6px;padding:8px 10px}
.est-lote-card{background:#f9fafb;border:1px solid #e5e7eb;border-radius:6px;padding:5px 7px;text-align:center}
/* Totals area */
.est-tot-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:6px}
.est-tot-item{background:#fff;border:1px solid #86efac;border-radius:6px;padding:6px 8px;text-align:center}
.est-tot-tag{display:inline-block;background:#e0f2fe;color:#0369a1;border-radius:4px;padding:1px 5px;font-size:9px;font-weight:700;margin:1px 1px 0 0}

/* Modal local context tipo buttons */
.est-loc-tipo-btn{padding:4px 10px;border:1.5px solid #d1d5db;border-radius:6px;background:#f9fafb;font-size:11px;font-weight:700;cursor:pointer;transition:all .15s;color:#374151}
.est-loc-tipo-btn.active{border-color:#f59e0b;background:#fef9c3;color:#92400e}
.est-loc-tipo-btn:hover:not(.active){border-color:#fbbf24;background:#fffbeb}
