.leaflet-map {
  height: min(64vh, 610px);
  min-height: 430px;
  border: 1px solid #c7c7c2;
  border-radius: 9px;
  background: #e8e9e4;
  z-index: 1;
}

.leaflet-container {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.map-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.map-toolbar label { display: grid; gap: 6px; min-width: min(420px, 100%); }
.map-toolbar label span { font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.map-toolbar select { width: 100%; padding: 11px 38px 11px 12px; border: 1px solid #b8b8b2; border-radius: 7px; background: #fff; color: #050505; font: inherit; font-weight: 650; }
.map-totals { color: #555; font-size: 13px; text-align: right; }
.map-status { display: none; padding: 12px; margin-bottom: 12px; border: 1px solid #d4d4cf; border-radius: 7px; background: #f4f4f1; font-size: 13px; }
.map-status.visible { display: block; }
.map-legend .bridge-dot { background: #050505; }
.map-legend .drain-dot { background: #fff; border: 2px solid #050505; }
.map-legend .endpoint-dot { background: #c8a35a; border: 2px solid #050505; }
.map-popup { min-width: 210px; }
.map-popup strong { display: block; margin-bottom: 4px; font-size: 14px; }
.map-popup span { display: block; margin-top: 2px; color: #4b4b47; }
.data-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 0 0 18px; padding: 16px; border: 1px solid #d5d5d0; border-radius: 9px; background: #fff; }
.data-toolbar label { display: grid; gap: 5px; width: min(430px, 100%); color: #444; font-size: 12px; font-weight: 750; }
.data-toolbar input, .data-toolbar select { padding: 11px 12px; border: 1px solid #b8b8b2; border-radius: 7px; background: #fff; color: #050505; font: inherit; }
.data-toolbar strong { font-size: 14px; white-space: nowrap; }
.record-table-wrap { overflow: auto; border: 1px solid #d5d5d0; border-radius: 9px; background: #fff; }
.record-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.record-table th { padding: 12px 14px; background: #f1f1ee; color: #555; font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.record-table td { padding: 12px 14px; border-top: 1px solid #e1e1dc; white-space: nowrap; }
.record-table tr:hover td { background: #faf9f5; }
.record-table .empty-row { padding: 30px; color: #666; text-align: center; }
.module-cards .condition span { text-align: right; }
.bridge-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 14px; }
.bridge-gallery img { width: 100%; aspect-ratio: 4 / 3; border-radius: 5px; background: #e7e7e2; object-fit: cover; }
.bridge-photo-count { margin: 7px 0 0; color: #536078; font-size: .78rem; font-weight: 700; }
.survey-overview { display: grid; gap: 18px; margin-bottom: 18px; }
.section-label { margin: 0 0 7px; color: #555; font-size: 10px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.state-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.state-card { min-width: 0; min-height: 112px; padding: 20px 22px; overflow: hidden; border: 1px solid #bcbcb6; border-radius: 11px; background: linear-gradient(135deg, #fff 0%, #f2f1ed 100%); color: #050505; text-align: left; cursor: pointer; }
.state-card:hover, .state-card.active { border-color: #050505; box-shadow: inset 0 -3px #c8a35a; }
.state-card span { display: block; color: #666; font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.state-card strong { display: block; margin-top: 5px; font-size: clamp(25px, 3vw, 38px); line-height: 1.08; overflow-wrap: anywhere; }
.state-card small { display: block; margin-top: 5px; color: #555; font-size: 13px; }
.survey-buttons { display: grid; grid-template-columns: repeat(2, minmax(230px, 1fr)); gap: 10px; }
.survey-choice { min-height: 112px; padding: 17px 18px; border: 1px solid #c7c7c1; border-radius: 10px; background: #fff; color: #050505; cursor: pointer; text-align: left; }
.survey-choice:hover { border-color: #777; transform: translateY(-1px); }
.survey-choice.active { border-color: #050505; background: #050505; color: #fff; box-shadow: inset 0 -3px #c8a35a; }
.survey-choice strong, .survey-choice span { display: block; }
.survey-choice strong { font-size: 19px; }
.survey-choice span { margin-top: 7px; color: inherit; font-size: 12px; line-height: 1.35; opacity: .78; }
.survey-choice small { display: block; margin-top: 5px; color: inherit; font-size: 11px; font-weight: 700; opacity: .62; }
.metric-actions { align-items: stretch; }
.metric-actions button { position: relative; min-height: 178px; padding: 20px; border: 1px solid #d2d2cd; border-radius: 10px; background: #fff; color: #050505; cursor: pointer; text-align: left; transition: transform .18s ease, border-color .18s ease; }
.metric-actions button:hover { border-color: #050505; transform: translateY(-2px); }
.metric-actions button i { position: absolute; top: 17px; right: 17px; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: #eeeDE8; font-size: 10px; font-style: normal; font-weight: 850; }
.metric-actions button span, .metric-actions button strong, .metric-actions button small, .metric-actions button em { display: block; }
.metric-actions button span { color: #555; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.metric-actions button strong { margin-top: 13px; font-size: clamp(30px, 3vw, 44px); }
.metric-actions button small { min-height: 32px; margin-top: 2px; color: #666; font-size: 11px; }
.metric-actions button em { margin-top: 12px; font-size: 11px; font-style: normal; font-weight: 800; }
.metric-actions { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.advance-track { height: 7px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #e3e2dc; }
.advance-track b { display: block; width: 0; height: 100%; border-radius: inherit; background: #c8a35a; transition: width .25s ease; }
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.survey-dialog { width: min(620px, calc(100% - 28px)); height: min(900px, calc(100dvh - 28px)); max-height: none; padding: 0; overflow: hidden; border: 0; border-radius: 13px; box-shadow: 0 24px 90px rgba(0,0,0,.3); }
.survey-dialog::backdrop { background: rgba(0,0,0,.58); backdrop-filter: blur(2px); }
.survey-dialog form { display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; height: 100%; min-width: 0; padding: 0; overflow: hidden; }
.compact-dialog { width: min(620px, calc(100% - 28px)); }
.gps-capture { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px; border: 1px solid #d5d5d0; border-radius: 9px; background: #f5f4ef; }
.gps-capture div { display: grid; gap: 4px; }
.gps-capture span { color: #666; font-size: 12px; }
.gps-capture button { flex: 0 0 auto; }
.hierarchy-selector { display: grid; gap: 20px; }
.route-summary { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.all-states { border-color: #050505 !important; }
.selection-summary { display: flex; align-items: center; gap: 18px; margin-top: 18px; padding: 18px 20px; border-left: 4px solid #c8a35a; border-radius: 7px; background: #f0eee7; }
.selection-summary strong { white-space: nowrap; }
.selection-summary span { color: #555; }
.form-section { min-width: 0; margin: 8px 0 16px; padding: 18px; border: 1px solid #cfcfc8; border-radius: 10px; background: #fafaf7; }
.form-section legend { padding: 0 8px; font-size: 13px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.assessment-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(150px, .7fr) minmax(220px, 1.2fr); gap: 10px; align-items: end; padding: 13px; border: 1px solid #deded8; border-radius: 8px; background: #fff; }
.assessment-row > strong, .assessment-row > small { grid-column: 1; }
.assessment-row > label { margin: 0; }
.assessment-row > label:last-child { grid-column: 3; grid-row: 1 / span 2; }
.field-readonly { display: grid; gap: 5px; padding: 14px; border-left: 4px solid #c8a35a; background: #f0eee7; }
.mobile-module-grid { display: none; }
.mobile-recent { display:none; }
.file-preview { display:grid; grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); gap:8px; margin-top:10px; }
.file-preview figure { min-width:0; margin:0; overflow:hidden; border:1px solid #d9dee4; border-radius:10px; background:#fff; }
.file-preview img { display:block; width:100%; height:86px; object-fit:cover; }
.file-preview figcaption { overflow:hidden; padding:5px 7px; color:#526173; font-size:.68rem; text-overflow:ellipsis; white-space:nowrap; }
.draft-file-preview { padding:12px; border:1px solid #b9d4c4; border-radius:10px; background:#f0f8f3; }
.draft-file-preview>strong { display:block; margin-bottom:8px; color:#167641; font-size:.78rem; }
.install-app { margin-left:auto; padding:9px 13px; border:1px solid #c8a35a; border-radius:999px; background:#c8a35a; color:#050505; font-weight:800; text-decoration:none; cursor:pointer; }
.install-app + .sync { margin-left:0; }
.severity-buttons { grid-column: 2; display: grid; grid-template-columns: repeat(4, minmax(74px,1fr)); gap: 8px; }
.severity-buttons.compact { grid-template-columns: repeat(4,minmax(68px,1fr)); }
.severity-buttons label { margin: 0; cursor: pointer; }
.severity-buttons input { position: absolute; opacity: 0; pointer-events: none; }
.severity-buttons span { display: grid; place-items: center; min-height: 64px; border: 1px solid #aeb6c2; border-radius: 8px; background: #fff; color: #173861; font-size: 22px; font-weight: 850; text-align: center; }
.severity-buttons span small { display: block; font-size: 9px; font-weight: 650; }
.severity-buttons input:checked + span { outline: 3px solid rgba(17,69,121,.2); background: #eaf3fb; }
.severity-buttons input:checked + .level-a { border-color: #20924d; background: #eaf8ef; color: #19733d; }
.severity-buttons input:checked + .level-b { border-color: #d99a18; background: #fff8df; color: #a56c00; }
.severity-buttons input:checked + .level-c { border-color: #d94b44; background: #fff0ef; color: #b52d28; }
.form-progress { display:grid; grid-template-columns:1fr auto; gap:7px 12px; align-items:center; margin-top:12px; }
.form-progress::before { content:""; grid-column:1; grid-row:1; height:7px; border-radius:9px; background:rgba(255,255,255,.25); }
.form-progress i { grid-column:1; grid-row:1; z-index:1; width:0; height:7px; border-radius:9px; background:#38b86a; transition:width .2s; }
.form-progress span { grid-column:2; grid-row:1; color:inherit; font-size:11px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; margin: 0; padding: 22px 24px; background: #07396f; color: #fff; }
.dialog-heading h2 { margin: 3px 0 5px; font-size: 30px; }
.dialog-heading p, .dialog-heading .kicker { margin: 0; color: #dce9f6; }
.dialog-close { flex: 0 0 38px; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; background: transparent; color:#fff; font-size: 25px; cursor: pointer; }
.survey-dialog form > .form-grid { grid-template-columns: 1fr; min-height: 0; padding: 22px 24px; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 15px; min-width:0; }
.form-grid label { display: grid; gap: 6px; min-width:0; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid label span { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-width:0; max-width:100%; box-sizing: border-box; padding: 12px; border: 1px solid #bcbcb6; border-radius: 7px; background:#fff; font: inherit; }
.form-grid input:focus { border-color: #050505; outline: 2px solid rgba(200,163,90,.35); }
.checklist { display:grid; gap:8px; padding:12px; border:1px solid #d8d8d2; border-radius:8px; background:#fff; }
.checklist label { display:grid; grid-template-columns:22px 1fr; gap:8px; align-items:start; padding:7px 5px; border-bottom:1px solid #ecece8; cursor:pointer; }
.checklist label:last-child { border-bottom:0; }
.checklist input { width:18px; height:18px; margin:1px 0 0; }
.checklist label span { font-size:12px; font-weight:650; letter-spacing:0; line-height:1.35; text-transform:none; }
.form-message { min-height: 20px; margin: 0; padding: 4px 24px 8px; color: #8a341f; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin: 0; padding: 14px 24px; border-top:1px solid #d8dee5; background:#fff; box-shadow:0 -4px 18px rgba(0,0,0,.08); }
.tunnel-component { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
.tunnel-component > strong, .tunnel-component > label:last-child { grid-column:1/-1; grid-row:auto; }
.bridge-detail-button { width: 100%; margin-top: 14px; padding: 11px 13px; border: 1px solid #050505; border-radius: 7px; background: #050505; color: #fff; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.bridge-detail-button:hover { background: #292929; }
.table-detail-button { min-width: 88px; padding: 8px 11px; border: 1px solid #050505; border-radius: 6px; background: #050505; color: #fff; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.table-detail-button:hover { background: #785c2a; border-color: #785c2a; }
.bridge-gallery img.image-error { background: #e8e8e3; }
.detail-actions { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.bridge-detail { padding: 28px; border: 1px solid #d3d3ce; border-radius: 11px; background: #fff; }
.bridge-detail-header { padding-bottom: 22px; border-bottom: 2px solid #050505; }
.conflict-panel { margin:16px 0; padding:16px; border:1px solid #d8902a; border-radius:10px; background:#fff4df; }
.conflict-panel>strong { color:#7e500d; font-size:1rem; }
.conflict-panel p { margin:7px 0 12px; color:#655c4e; font-size:.8rem; }
.conflict-panel>div { display:flex; flex-wrap:wrap; gap:8px; }
.bridge-detail-header h1 { max-width: 900px; margin: 5px 0 7px; font-size: clamp(30px, 4vw, 52px); line-height: 1.02; }
.bridge-detail-header > p:last-child { margin: 0; color: #555; }
.bridge-score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.bridge-score-grid > div { padding: 16px; border: 1px solid #d5d5d0; border-radius: 8px; background: #f5f4f0; }
.bridge-score-grid span, .bridge-score-grid strong { display: block; }
.bridge-score-grid span { color: #666; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.bridge-score-grid strong { margin-top: 8px; font-size: 18px; line-height: 1.15; }
.technical-section { margin-top: 12px; border: 1px solid #d5d5d0; border-radius: 8px; overflow: hidden; }
.technical-section > summary { padding: 15px 18px; background: #f1f1ed; font-size: 14px; font-weight: 850; cursor: pointer; }
.technical-section[open] > summary { border-bottom: 1px solid #d5d5d0; }
.technical-section > :not(summary) { margin: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 !important; }
.detail-grid > div { padding: 14px; border: 1px solid #e0e0dc; }
.detail-grid dt { color: #666; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.detail-grid dd { margin: 6px 0 0; font-size: 13px; font-weight: 650; white-space: pre-wrap; }
.detail-table td:nth-child(2), .detail-table td:nth-child(3), .detail-table td:nth-child(6) { white-space: normal; min-width: 180px; }
.factor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.factor-grid article { padding: 14px; border: 1px solid #ddd; border-radius: 7px; }
.factor-grid strong, .factor-grid span { display: block; }
.factor-grid span { margin-top: 7px; font-weight: 800; }
.factor-grid p { margin: 5px 0 0; color: #666; font-size: 12px; }
.detail-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.detail-gallery figure { margin: 0; }
.detail-gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 7px; background: #e8e8e3; object-fit: cover; }
.detail-gallery figcaption { margin-top: 6px; color: #555; font-size: 11px; font-weight: 750; }
.detail-gallery .photo-error img { display: none; }
.detail-gallery .photo-error { min-height: 120px; padding: 20px; border: 1px dashed #aaa; border-radius: 7px; background: #eee; }
.activity #homeSurveyList { display: grid; }
.activity #homeSurveyList button { width: 100%; }
.activity #homeSurveyList button.selected { background: #f0eee7; box-shadow: inset 3px 0 #c8a35a; }

@media (max-width: 720px) {
  .state-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .state-card { padding: 16px; }
  .state-card strong { font-size: clamp(23px, 7vw, 32px); }
  .state-card.all-states { grid-column: 1 / -1; min-height: 104px; }
  .route-summary .state-card { grid-column: auto; }
  .gps-capture, .selection-summary { align-items: stretch; flex-direction: column; }
  .assessment-row { grid-template-columns: 1fr; }
  .assessment-row > strong, .assessment-row > small, .assessment-row > label:last-child { grid-column: 1; grid-row: auto; }
  .severity-buttons { grid-column: 1; grid-template-columns: repeat(4,1fr); }
  .mobile-module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
  .mobile-module-grid button { display: grid; place-items: center; gap: 3px; min-height: 122px; border: 1px solid #d9dde3; border-radius: 12px; background: #fff; color: #092f5c; box-shadow: 0 3px 12px rgba(0,30,70,.08); }
  .mobile-module-grid b { font-size: 30px; }
  .mobile-module-grid strong { font-size: 16px; }
  .mobile-module-grid span { color: #607083; font-size: 11px; }
  .mobile-recent { display:block; margin:0 0 18px; }
  .mobile-recent>div:first-child { display:flex; align-items:end; justify-content:space-between; margin-bottom:8px; }
  .mobile-recent h2 { margin:0; color:#102238; font-size:1rem; }
  .mobile-recent>div:first-child span { color:#687789; font-size:.7rem; }
  #mobileRecentRecords { display:grid; gap:7px; }
  #mobileRecentRecords>button { display:grid; grid-template-columns:40px 1fr auto; align-items:center; gap:10px; width:100%; padding:11px; border:1px solid #dce2e8; border-radius:10px; background:#fff; color:#0b2e57; text-align:left; box-shadow:0 2px 8px rgba(0,30,70,.05); }
  #mobileRecentRecords>button>b { display:grid; place-items:center; width:38px; height:38px; border-radius:8px; background:#edf3f8; font-size:20px; }
  #mobileRecentRecords>button span { min-width:0; }
  #mobileRecentRecords>button strong,#mobileRecentRecords>button small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #mobileRecentRecords>button strong { font-size:.8rem; }
  #mobileRecentRecords>button small { margin-top:3px; color:#66768a; font-size:.65rem; }
  #mobileRecentRecords>button em { padding:7px; border-radius:7px; background:#e8f4ed; color:#167641; font-size:.62rem; font-style:normal; font-weight:800; }
  #mobileRecentRecords>button em.pending { background:#fff0e7; color:#e85200; }
  .survey-dialog { width: 100vw; max-width: none; max-height: none; height: 100dvh; margin: 0; border-radius: 0; }
  .survey-dialog form { padding: 0; }
  .survey-dialog .dialog-heading { position: static; z-index: 3; margin: 0; padding: 14px 16px; background: #07396f; color: #fff; }
  .survey-dialog .kicker, .survey-dialog .dialog-heading p { color: #dce9f6; }
  .survey-dialog .dialog-heading h2 { font-size: 21px; }
  .survey-dialog .dialog-close { border-color: rgba(255,255,255,.5); background: transparent; color: #fff; }
  .survey-dialog form > .form-grid { padding:16px; }
  .survey-dialog .form-message { padding:4px 16px 7px; }
  .survey-dialog .dialog-actions { position: static; z-index: 4; display:grid; grid-template-columns:1fr 1fr; padding: 10px 14px; background: #fff; box-shadow: 0 -4px 20px rgba(0,0,0,.12); }
  .survey-dialog .dialog-actions #saveOfflineDraftButton { grid-column:1/-1; }
  .survey-dialog .dialog-actions .primary { border-color: #ff5a00; background: #ff5a00; }
  .map-toolbar { align-items: stretch; flex-direction: column; }
  .map-totals { text-align: left; }
  .data-toolbar { align-items: stretch; flex-direction: column; }
  .survey-overview { grid-template-columns: 1fr; }
  .survey-buttons { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.wide { grid-column: auto; }
  .tunnel-component { grid-template-columns:1fr; }
  .tunnel-component > strong, .tunnel-component > label:last-child { grid-column:1; }
  .heading-actions { justify-content: flex-start; }
  .bridge-score-grid, .detail-grid, .factor-grid { grid-template-columns: 1fr; }
  .detail-gallery { grid-template-columns: 1fr; }
  .bridge-detail { padding: 16px; }
}

@media print {
  .topbar, .sidebar, .detail-actions, .toast { display: none !important; }
  .shell, main { display: block !important; margin: 0 !important; padding: 0 !important; }
  .view { display: none !important; }
  #view-puente-detalle { display: block !important; }
  .bridge-detail { padding: 0; border: 0; }
  .technical-section { break-inside: avoid; }
  .technical-section > summary { list-style: none; }
  .record-table { font-size: 9px; }
  .detail-gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .leaflet-map {
    min-height: 390px;
  }
}
