/* ============================================================================
   inspeccion-vehiculos - estructura de la replica original (replicador-web-integral/inspeccion-vehiculos/replica-test)
   re-pintada con la paleta de Vector GPS
   ============================================================================ */
#templatesPanel{padding-left:35px;min-height:156.5px}.tree{width:559px}.tree-node.product{height:25.1px;overflow:hidden}.tree-node.product[aria-expanded=true]{height:auto;overflow:visible}.tree-node.product>.tree-line{height:24.1px;min-height:24.1px}.tree-line{gap:4px}.template-badge{font-size:10px;padding:1px 4px}
.grid table{width:calc(100% - 15px)}
#reportsTab{width:70.9px;padding-left:8px;padding-right:8px}#templatesTab{width:70.6px;padding-left:8px;padding-right:8px}#reportsPanel.grid-ready{height:663.1px}.unit-row,#reportGrid{width:calc(100% + 16px)}.grid table{font-size:12px}.grid th{height:27.8px;padding-top:4px;padding-bottom:4px;white-space:nowrap}.grid td{height:28px}
:root{--paper:#ffffff;--ink:#26313d;--line:#bfcbd6;--muted:#f4f7f9;--soft:#f4f7f9;--selected:#cfd9e2;--good:#e5eee7;--bad:#eee1e1}*{box-sizing:border-box;border-radius:0}html,body{margin:0;min-width:320px;background:var(--paper);color:var(--ink);font:14px Roboto,Arial,sans-serif}button,input,select{font:inherit;color:inherit;background:var(--paper);border:1px solid var(--line)}button{cursor:pointer}button:hover{background:var(--soft)}button:focus-visible,input:focus-visible,select:focus-visible,[role=treeitem]:focus-visible{outline:2px solid #bfcbd6;outline-offset:-2px}#inspectionApp{width:100%;min-height:145px;border:1px solid var(--line);padding:4px}#tabs{height:29px;display:flex;align-items:stretch}#tabs button{height:29px;padding:5px 15px;border-bottom:1px solid var(--line);background:var(--soft)}#tabs button+button{margin-left:-1px}#tabs button[aria-selected=true]{background:var(--paper);border-bottom-color:var(--paper);font-weight:bold}[role=tabpanel]{border:1px solid var(--line);margin-top:-1px;padding:12px 11px;min-height:111px}.unit-row{height:42px}.unit-row label{display:block;margin-bottom:1px}.unit-row select{width:149px;height:27px;padding:3px}.grid{height:552px;border:1px solid var(--line);overflow:auto}.grid table,.detail-grid table{width:100%;border-collapse:collapse;table-layout:fixed}.grid th,.grid td,.detail-grid th,.detail-grid td{border:1px solid var(--line);padding:6px;text-align:left;height:28px}.grid th,.detail-grid th{background:var(--muted);font-weight:bold}.grid col{width:13.1%}.grid .actions-col{width:19.6%}.detail-button{height:24px;padding:2px 12px}.tree{width:59%;min-width:558px;border:1px solid var(--line)}.tree-node{border-bottom:1px solid var(--line)}.tree-line{display:flex;align-items:center;min-height:29px;padding:4px 8px;gap:8px;cursor:pointer}.tree-line:hover{background:var(--soft)}.tree-children{padding-left:0}.tree-node.product>.tree-line{min-height:25px}.tree-node.unit>.tree-line{min-height:25px;padding-left:24px}.template-badge{border:1px solid var(--line);padding:1px 5px;font-size:12px;background:var(--soft)}.tree-toggle{margin-left:auto}.tree-node[aria-expanded=false]>.tree-children{display:none}dialog{padding:0;border:1px solid #bfcbd6;background:var(--paper)}dialog::backdrop{background:rgba(0,0,0,.25)}dialog>header{height:35px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);padding:6px 10px;background:var(--muted)}dialog h2{margin:0;font-size:16px}dialog header button{width:28px;height:24px}#detailDialog{width:70%;min-width:650px}#detailDialog .detail-meta{padding:12px}#detailDialog .detail-meta p{margin:4px 0}#detailDate{float:right}.detail-grid{height:550px;overflow:auto;padding:0 12px}.detail-grid th,.detail-grid td{width:20%}.state-good,.state-bad{display:inline-block;border:1px solid var(--line);padding:2px 7px}.state-good{background:var(--good)}.state-bad{background:var(--bad)}#detailDialog footer{padding:8px 12px}#templateDialog{width:502px}#templateDialog .editor-row{display:grid;grid-template-columns:115px 266px 36px;gap:10px;align-items:center;padding:6px 12px}#templateDialog .editor-row input{height:29px;padding:4px}#addSection{height:30px}.section-tree{margin:6px 12px;max-height:420px;overflow:auto;border:1px solid var(--line)}.section{border-bottom:1px solid var(--line)}.section-header,.line-row,.new-line-row{display:flex;align-items:center;min-height:29px;padding:4px 8px}.section-header{cursor:pointer}.remove{margin-left:auto;border:0;background:transparent}.section-lines{border-top:1px solid var(--line)}.section[aria-expanded=false]>.section-lines{display:none}.line-row,.new-line-row{min-height:25px;padding-left:18px}.new-line-row input{height:25px;flex:1}.new-line-row button{width:34px;height:25px}.line-row .remove{font-size:16px}#templateDialog>footer,#confirmDialog>footer{display:flex;gap:13px;padding:10px 12px}#templateDialog>footer button,#confirmDialog>footer button{height:29px;padding:4px 12px}#confirmDialog{width:450px}#confirmDialog p{margin:18px 12px}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}@media(max-width:700px){.tree{width:100%;min-width:0}.grid{overflow:auto}#detailDialog{min-width:0;width:calc(100% - 20px)}#templateDialog{width:calc(100% - 20px)}}

/* (movido desde index.html) */
.grid table{width:calc(100% - 15px)}#templatesPanel{padding-left:35px;min-height:156.5px}.tree{width:559px}.tree-node.product{height:25.1px;overflow:hidden}.tree-node.product>.tree-line{height:24.1px;min-height:24.1px}.tree-line{gap:4px}.template-badge{font-size:10px;padding:1px 4px}#imageDialog{width:480px}#imagePreview{height:300px;margin:12px;border:1px solid var(--line);display:grid;place-items:center;background:var(--soft);overflow-wrap:anywhere;text-align:center;padding:20px}@media(max-width:700px){.tree{width:100%;min-width:0}#imageDialog{width:calc(100% - 20px)}#reportGrid table{min-width:930px}}


/* ============================================================================
   Capa Vector GPS (colores, bordes y estados) - no altera el layout original
   Referencia: GUIA_ESTILOS_UI.md
   ============================================================================ */
:root {
  --v-primary: #0f8995; --v-primary-border: #0d7d88; --v-primary-dark: #0a6670;
  --v-primary-tint: #e6f4f5; --v-primary-ring: rgba(15, 137, 149, .18);
  --v-danger: #dc3545; --v-danger-dark: #bd2130; --v-success: #28a745; --v-success-dark: #1e8a37;
  --v-text: #26313d; --v-title: #1f2a35; --v-muted: #607080; --v-label: #485664;
  --v-border: #cfd9e2; --v-input-border: #bfcbd6; --v-th-bg: #f4f7f9; --v-input-bg: #f9fbfc;
  --v-shadow-pop: 0 12px 24px rgba(26, 36, 44, .22);
}

html, body { font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif; color: var(--v-text); }
a { color: var(--v-primary); }
h1, h2, h3 { color: var(--v-title); }

button {
  border-color: var(--v-input-border);
  border-radius: 6px;
  background-color: #fff;
  color: var(--v-label);
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
button:hover:not(:disabled) { color: var(--v-primary); border-color: var(--v-primary); background-color: var(--v-primary-tint); }
button:disabled { opacity: .5; color: #9aa6b2; background-color: #f4f7f9; border-color: #d8e0e6; cursor: not-allowed; }

button:is([id*="save" i],[id*="create" i],[id*="crear" i],[id*="guardar" i],[id*="accept" i],[id*="aceptar" i],[id*="apply" i],[id*="send" i],[id*="enviar" i],[id*="agregar" i],[id*="add" i],[id*="submit" i],[id*="filter" i]):not(:disabled) { color: #fff; background-color: var(--v-primary); border-color: var(--v-primary-border); }
button:is([id*="save" i],[id*="create" i],[id*="crear" i],[id*="guardar" i],[id*="accept" i],[id*="aceptar" i],[id*="apply" i],[id*="send" i],[id*="enviar" i],[id*="agregar" i],[id*="add" i],[id*="submit" i],[id*="filter" i]):hover:not(:disabled) { color: #fff; background-color: var(--v-primary-dark); border-color: var(--v-primary-dark); }

button:is([id*="edit" i],[id*="editar" i]):not(:disabled) { color: var(--v-primary); border-color: var(--v-primary); }

button:is([id*="delete" i],[id*="remove" i],[id*="borrar" i],[id*="eliminar" i]):not(:disabled) { color: var(--v-danger); border-color: #e3a0a8; background-color: #fff5f6; }
button:is([id*="delete" i],[id*="remove" i],[id*="borrar" i],[id*="eliminar" i]):hover:not(:disabled) { color: #fff; border-color: var(--v-danger); background-color: var(--v-danger); }

button:is([id*="excel" i],[id*="download" i],[id*="export" i],[id*="csv" i],[id*="descargar" i]):not(:disabled) { color: #fff; background-color: var(--v-success); border-color: var(--v-success); }
button:is([id*="excel" i],[id*="download" i],[id*="export" i],[id*="csv" i],[id*="descargar" i]):hover:not(:disabled) { color: #fff; background-color: var(--v-success-dark); border-color: var(--v-success-dark); }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible, [role="row"]:focus-visible {
  outline: 2px solid var(--v-primary);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea {
  border-color: var(--v-input-border);
  border-radius: 6px;
  background-color: var(--v-input-bg);
  color: var(--v-text);
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color: var(--v-primary); box-shadow: 0 0 0 3px var(--v-primary-ring); }
input:disabled, select:disabled, textarea:disabled { color: #8a97a4; background-color: #f1f4f6; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--v-primary); }

fieldset { border-color: var(--v-border); border-radius: 8px; }
legend { color: var(--v-primary); font-weight: 700; }

th, [role="columnheader"] { background-color: var(--v-th-bg); color: #536171; font-weight: 700; }

tr[aria-selected="true"], [role="row"][aria-selected="true"], [role="option"][aria-selected="true"], tr.selected, [role="row"].selected,
[class*="row"].selected, [class*="item"].selected, [class*="row"][aria-selected="true"], [class*="item"][aria-selected="true"] {
  background-color: var(--v-primary-tint);
  box-shadow: inset 4px 0 0 var(--v-primary);
  outline: none;
}
tbody tr:hover, [role="grid"] [role="row"]:hover { background-color: rgba(15, 137, 149, .07); }
tr[aria-selected="true"]:hover, tr.selected:hover, [role="row"][aria-selected="true"]:hover { background-color: var(--v-primary-tint); }

dialog {
  border: 1px solid var(--v-border);
  border-top: 4px solid var(--v-primary);
  border-radius: 8px;
  background: #fff;
  color: var(--v-text);
  box-shadow: var(--v-shadow-pop);
}
dialog:not([open]) { display: none !important; }
dialog::backdrop { background: rgba(26, 36, 44, .5); }

/* Botones dentro de encabezados de tabla: sin caja */
th button, [role="columnheader"] button { background-color: transparent; border-color: transparent; box-shadow: none; color: inherit; }
th button:hover:not(:disabled), [role="columnheader"] button:hover:not(:disabled) { background-color: rgba(15, 137, 149, .10); border-color: transparent; color: var(--v-primary); }
/* Estado activo / seleccionado en botones (pestañas, filtros, categorías) */
button[aria-pressed="true"]:not(:disabled), button[aria-selected="true"]:not(:disabled), button.active:not(:disabled), button.selected:not(:disabled) {
  color: var(--v-primary-dark); background-color: var(--v-primary-tint); border-color: var(--v-primary); box-shadow: none;
}

/* ============================================================================
   v2 - encabezado, tarjetas, bandas de panel y diálogos al nivel de Alertas
   ============================================================================ */
html, body { background: #eef2f5; }

main.v2 {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 100vh;
  margin: 0 !important;
  padding: 14px 14px 44px !important;
  box-sizing: border-box;
  background: transparent !important;
}
main.v2 > * { min-width: 0; }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--v-border);
  border-left: 4px solid var(--v-primary);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 45, 61, .08);
}
.hero .eyebrow { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--v-primary); }
.hero .hero-heading { margin: 0; font-size: 22.7px; line-height: 1.2; font-weight: 700; color: var(--v-title); }
.hero .hero-meta { margin: 2px 0 0; font-size: 12px; color: var(--v-muted); }
.hero > :not(.hero-title) {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.hero > :not(.hero-title) button { width: auto !important; min-width: 112px; height: auto !important; min-height: 34px; padding: 5px 14px; font-size: 12.5px; }

/* Tarjetas */
main.v2 :is(#reportsPanel,#templatesPanel) {
  background: #fff !important;
  border: 1px solid var(--v-border) !important;
  border-radius: 8px !important;
  box-shadow: 0 3px 12px rgba(31, 45, 61, .06);
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  overflow: hidden;
}

/* Bandas de panel (carbón + filo turquesa); incluye títulos ocultos visualmente */
main.v2 :is(.__none__) {
  display: block !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 9px 14px !important;
  overflow: visible !important;
  white-space: normal !important;
  font: 700 13px/1.45 Roboto, Arial, sans-serif !important;
  letter-spacing: .02em !important;
  text-transform: none !important;
  color: #fff !important;
  background: #343a40 !important;
  border: 0 !important;
  border-bottom: 3px solid var(--v-primary) !important;
  border-radius: 0 !important;
}

/* Contenido de las tarjetas: aire interno (cuadrículas y tablas a sangre) */
main.v2 :is(#reportsPanel,#templatesPanel) > :not(:is(.__none__)):not(table):not([role="grid"]):not(.table-scroll):not(.table-wrap):not(.grid):not(.visually-hidden):not(.sr-only):not([hidden]) {
  margin-left: 14px;
  margin-right: 14px;
}
main.v2 :is(#reportsPanel,#templatesPanel) > :nth-child(2):not(:is(.__none__)),
main.v2 :is(.__none__) + * { margin-top: 12px; }
main.v2 :is(#reportsPanel,#templatesPanel) { padding-bottom: 14px !important; }

/* Diálogos con encabezado */
dialog { padding: 0 0 14px !important; overflow: auto; }
dialog > :not(header):not(h1:first-child):not(h2:first-child) { margin-left: 16px; margin-right: 16px; }
dialog > header, dialog > h1:first-child, dialog > h2:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px !important;
  padding: 9px 14px !important;
  font: 700 13px/1.45 Roboto, Arial, sans-serif !important;
  color: #fff !important;
  background: #343a40 !important;
  border: 0 !important;
  border-bottom: 3px solid var(--v-primary) !important;
}
dialog > header h2, dialog > header h1 { margin: 0 !important; padding: 0 !important; font: 700 13px/1.45 Roboto, Arial, sans-serif !important; color: #fff !important; background: transparent !important; border: 0 !important; }
dialog > header button { min-height: 26px; padding: 0 9px; color: #fff; background: transparent; border-color: rgba(255, 255, 255, .4); }
dialog > header button:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, .16); border-color: #fff; }
dialog[id*="confirm" i] { border-top-color: var(--v-danger); }
dialog[id*="confirm" i] > h1:first-child, dialog[id*="confirm" i] > h2:first-child, dialog[id*="confirm" i] > header { border-bottom-color: var(--v-danger); }
/* v2: tipografia de formularios */
main.v2 label { color: var(--v-label); font-weight: 600; }
main.v2 label:has(> input[type="checkbox"]), main.v2 label:has(> input[type="radio"]) { font-weight: 500; color: var(--v-text); }
main.v2 legend { font-size: 12px; letter-spacing: .02em; }
main.v2 [role="alert"]:not(:empty), main.v2 .inline-error:not(:empty), main.v2 .field-error:not(:empty) { color: var(--v-danger); font-size: 11.5px; font-weight: 500; }
main.v2 [role="status"]:not(:empty):not([hidden]) { color: #155724; }
/* v2: cuadriculas dentro de tarjetas sin doble borde */
main.v2 [role="grid"]:not(table) { border: 0 !important; }
main.v2 [role="columnheader"] { min-height: 34px; }

/* v2: bandas de panel por vista */
main.v2 #reportsPanel::before { content: none; display: block; flex: 0 0 100%; margin: 0 0 12px; padding: 9px 14px; font: 700 13px/1.45 Roboto, Arial, sans-serif; letter-spacing: .02em; color: #fff; background: #343a40; border-bottom: 3px solid var(--v-primary); box-sizing: border-box; }
main.v2 #templatesPanel::before { content: none; display: block; flex: 0 0 100%; margin: 0 0 12px; padding: 9px 14px; font: 700 13px/1.45 Roboto, Arial, sans-serif; letter-spacing: .02em; color: #fff; background: #343a40; border-bottom: 3px solid var(--v-primary); box-sizing: border-box; }
main.v2#inspectionApp { height: auto !important; border: 0 !important; overflow: visible !important; }
main.v2 [role="tab"] { width: auto !important; min-width: 0 !important; padding: 6px 18px !important; }
main.v2 [role="tablist"] { display: flex; gap: 6px; height: auto !important; margin: 0 !important; }

/* v3: tablas a ancho completo del contenedor */
table { width: 100%; }

/* Tarjetas sin contenido visible (todos sus hijos ocultos por JS): no se muestran */
main.v2 section:has(> [hidden]):not(:has(> :not([hidden]))) { display: none !important; }