/* ═══════════════════════════════════════════════════════════
   INSPECTPRO · Sistema de Diseño v7.0
   Sidebar dark · Diseño SaaS premium · Sin duplicados
═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────── */
:root {
  /* Superficies main */
  --bg:        #f0f2f5;
  --bg2:       #ffffff;
  --bg3:       #eaecf0;
  --surface:   #ffffff;

  /* Sidebar dark */
  --sb-bg:     #111827;
  --sb-bg2:    #1f2937;
  --sb-border: #374151;
  --sb-text:   #d1d5db;
  --sb-text2:  #9ca3af;
  --sb-active: rgba(212,146,10,.15);

  /* Bordes */
  --border:    #e2e6ec;
  --border2:   #c9d1db;

  /* Texto */
  --text:      #111827;
  --text2:     #4b5563;
  --text3:     #9ca3af;

  /* Acento */
  --accent:    #d4920a;
  --accent2:   #b07808;
  --accent-dim:#f0a50014;
  --accent-low:#f0a50022;

  /* Estado */
  --ok:        #16a34a;
  --ok-bg:     #dcfce7;
  --bad:       #dc2626;
  --bad-bg:    #fee2e2;
  --warn:      #d97706;
  --warn-bg:   #fef3c7;
  --info:      #2563eb;
  --info-bg:   #dbeafe;

  /* Forma */
  --radius:    8px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Sombra */
  --shadow-xs: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.07);

  /* Tipografía */
  --font-head: 'Bebas Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'IBM Plex Sans', sans-serif;

  /* Transición */
  --t: .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { font-size: 15px; scroll-behavior: smooth; }
body  { background: var(--bg); color: var(--text); font-family: var(--font-body); line-height: 1.6; min-height: 100vh; }
img   { display: block; max-width: 100%; }
a     { color: inherit; }

/* ── Layout ────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR DARK
══════════════════════════════════════════════════════════ */
.sidebar {
  width: 230px;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: left var(--t);
  z-index: 10;
}

/* Logo / marca */
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 11px;
}
.logo-icon         { font-size: 22px; color: var(--accent); flex-shrink: 0; }
.logo-img          { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.logo-text         { font-family: var(--font-head); font-size: 20px; letter-spacing: 2.5px; color: #fff; line-height: 1; }
.logo-company-name { font-size: .62rem; color: var(--sb-text2); margin-top: 3px; font-family: var(--font-mono); }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--sb-text);
  font-size: .855rem;
  font-weight: 500;
  transition: all var(--t);
  border: 1px solid transparent;
  position: relative;
}
.nav-item:hover  {
  background: var(--sb-bg2);
  color: #fff;
}
.nav-item.active {
  background: var(--sb-active);
  color: var(--accent);
  border-color: rgba(212,146,10,.3);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon      { width: 18px; height: 18px; flex-shrink: 0; }
.nav-icon svg  { width: 100%; height: 100%; }
.nav-label     { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Footer sidebar */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sb-border);
}
.version-tag { font-family: var(--font-mono); font-size: .7rem; color: var(--sb-text2); }

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; min-width: 0; }

/* Topbar */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}
.topbar-title    {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-head);
  font-size: 17px;
  letter-spacing: 2px;
  color: var(--text);
  flex: 1;
}
.topbar-page-emoji { font-size: 1rem; letter-spacing: 0; line-height: 1; }
.topbar-datetime {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--text3);
  flex: 1;
  text-align: center;
}
.topbar-actions  { display: flex; align-items: center; gap: 8px; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text2); border-radius: 2px; transition: all var(--t);
}

.page-content { padding: 24px 28px 64px; flex: 1; }
.page-section { max-width: 1320px; }
.dashboard    { max-width: 1320px; }

/* ══════════════════════════════════════════════════════════
   BOTONES
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: .855rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--t);
  white-space: nowrap;
  line-height: 1;
  letter-spacing: .01em;
}
.btn-accent         { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 4px rgba(212,146,10,.3); }
.btn-accent:hover   { background: var(--accent2); border-color: var(--accent2); box-shadow: 0 4px 12px rgba(212,146,10,.35); }
.btn-ghost          { background: transparent; color: var(--text2); border-color: var(--border2); }
.btn-ghost:hover    { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.btn-outline-accent { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline-accent:hover { background: var(--accent-dim); }
.btn-success        { background: var(--ok); color: #fff; border-color: var(--ok); box-shadow: 0 1px 4px rgba(22,163,74,.3); }
.btn-success:hover  { opacity: .88; }
.btn-danger         { background: transparent; color: var(--bad); border-color: var(--bad); font-size: .8rem; padding: 5px 11px; }
.btn-danger:hover   { background: var(--bad-bg); }
.btn-sm             { padding: 6px 13px; font-size: .8rem; }
.btn-xs             { padding: 4px 9px; font-size: .75rem; }

@media (hover: none) {
  .btn    { min-height: 42px; }
  .btn-xs { min-height: 36px; padding: 6px 12px; }
  .btn-sm { min-height: 38px; }
}

/* ══════════════════════════════════════════════════════════
   BADGES Y TAGS
══════════════════════════════════════════════════════════ */
.badge          { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .71rem; font-weight: 700; background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.badge-rol      { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.badge-completo { background: var(--ok-bg); color: var(--ok); border-color: #86efac; }
.badge-borrador { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }

.placa-tag  {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: .82rem;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 5px;
  padding: 2px 8px;
  color: var(--text);
  letter-spacing: 1.5px;
}
.dot     { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-on  { background: var(--ok); }
.dot-off { background: var(--bad); opacity: .4; }

.tipo-badge   { font-size: .75rem; padding: 2px 9px; border-radius: 20px; font-weight: 700; }
.tipo-moto    { background: #f3e8ff; color: #7c3aed; }
.tipo-carro   { background: #dbeafe; color: #1d4ed8; }
.tipo-trimoto { background: #dcfce7; color: #166534; }
.tipo-triciclo{ background: #fce7f3; color: #9d174d; }
.tipo-custom  { background: var(--accent-low); color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   TABLAS
══════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-xs);
}
.data-table           { width: 100%; border-collapse: collapse; font-size: .855rem; }
.data-table th        { background: var(--bg3); color: var(--text2); font-family: var(--font-mono); font-size: .71rem; letter-spacing: 1px; text-transform: uppercase; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 700; }
.data-table td        { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: #fafbfc; }
.table-footer         { padding: 10px 14px; font-size: .78rem; color: var(--text3); font-family: var(--font-mono); border-top: 1px solid var(--border); }
.actions-cell         { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.data-table td.actions-cell { padding: 7px 10px; }

/* ══════════════════════════════════════════════════════════
   MODALES
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,15,25,.72);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; animation: fadeIn .16s; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s cubic-bezier(.34,1.38,.64,1);
}
.modal-lg   { max-width: 720px; }
.modal-wide { max-width: 960px; }

@keyframes slideUp { from { transform: translateY(24px) scale(.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes fadeIn  { from { opacity: 0; } }

.modal-header  {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  background: var(--bg3);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title   { font-family: var(--font-head); font-size: 19px; letter-spacing: 2px; }
.modal-close   { background: none; border: none; color: var(--text3); font-size: 22px; cursor: pointer; padding: 2px 7px; border-radius: 6px; line-height: 1; transition: all var(--t); }
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body    { padding: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════
   FORMULARIOS
══════════════════════════════════════════════════════════ */
.field, .field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 10px;
}
.form-row .field, .form-row .field-group { margin-bottom: 0; }

label,
.field label,
.field-group label {
  display: block;
  font-size: .71rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 5px;
}

input[type=text], input[type=email], input[type=tel],
input[type=number], input[type=date], input[type=search],
select, textarea,
.field input, .field select, .field textarea,
.field-group input, .field-group select, .field-group textarea {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .875rem;
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%;
  outline: none;
  line-height: 1.4;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,146,10,.12);
  background: var(--bg2);
}
select   { cursor: pointer; }
textarea { resize: vertical; min-height: 90px; }

.input-with-action       { display: flex; gap: 8px; }
.input-with-action input { flex: 1; }
.search-input {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .855rem;
  width: 100%;
  outline: none;
  transition: border-color var(--t);
}
.search-input:focus { border-color: var(--accent); background: var(--bg2); }

.section-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.req             { color: var(--bad); }

.form-section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 14px;
}
.form-section-title {
  font-size: .71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Autocompletar ─────────────────────────────────────── */
.autocomplete-wrap  { position: relative; }
.suggestions-list {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg2);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius);
  z-index: 200;
  box-shadow: var(--shadow-lg);
  display: none;
  max-height: 260px;
  overflow-y: auto;
}
.suggestions-list.open { display: block; animation: fadeIn .12s; }
.sug-item  { padding: 10px 14px; cursor: pointer; font-size: .855rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sug-item:hover { background: var(--bg3); }
.sug-item:last-child { border-bottom: none; }
.sug-badge { margin-left: auto; }
.sug-empty { padding: 12px 14px; font-size: .84rem; color: var(--text3); }
.link-btn  { background: none; border: none; color: var(--accent); cursor: pointer; font-size: .84rem; text-decoration: underline; padding: 0; }

/* ── Info card ─────────────────────────────────────────── */
.info-card        { background: var(--bg3); border: 1.5px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 4px; position: relative; }
.info-card.hidden { display: none; }
.card-row         { display: flex; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: .855rem; }
.card-row:last-child { border-bottom: none; }
.card-label       { color: var(--text2); min-width: 80px; font-size: .78rem; }
.card-value       { color: var(--text); font-weight: 500; }
.tipo-indicator   { position: absolute; right: 14px; top: 10px; font-size: 2rem; }

/* ══════════════════════════════════════════════════════════
   WIZARD NUEVA INSPECCIÓN
══════════════════════════════════════════════════════════ */
.form-wizard {
  max-width: 860px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.wizard-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.wstep          { display: flex; align-items: center; gap: 8px; font-size: .77rem; color: var(--text3); white-space: nowrap; padding: 6px 0; }
.wstep-n        { width: 26px; height: 26px; border-radius: 50%; background: var(--bg3); border: 1.5px solid var(--border2); color: var(--text3); font-weight: 700; font-size: .75rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wstep-line     { flex: 1; height: 1.5px; background: var(--border); min-width: 20px; }
.wstep.active .wstep-n      { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 3px rgba(212,146,10,.2); }
.wstep.active .wstep-label  { color: var(--accent); font-weight: 700; }
.wstep.done .wstep-n        { background: var(--ok); border-color: var(--ok); color: #fff; font-size: 0; }
.wstep.done .wstep-n::before{ content: '✓'; font-size: .8rem; }
.wstep.done .wstep-label    { color: var(--ok); }
.wstep.done + .wstep-line   { background: var(--ok); }
.wizard-panel               { display: none; }
.wizard-panel.active        { display: block; animation: fadeIn .2s; }
.panel-title                { font-family: var(--font-head); font-size: 1.3rem; letter-spacing: 2px; color: var(--text); margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.wizard-nav                 { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); gap: 10px; }

/* ── Tarjetas selección ────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px; margin-top: 12px;
}
.sel-card {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--t), transform .14s, box-shadow var(--t);
  position: relative;
  user-select: none;
}
.sel-card:hover    { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.sel-card.selected { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 0 3px rgba(212,146,10,.15); }
.sel-card .card-check  { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: none; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; }
.sel-card.selected .card-check { display: flex; }
.sel-card .card-type   { font-size: .66rem; color: var(--text3); text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 4px; }
.sel-card .card-name   { font-weight: 700; color: var(--text); font-size: .93rem; margin-bottom: 2px; line-height: 1.3; }
.sel-card .card-sub    { font-size: .74rem; color: var(--text2); margin-top: 2px; }
.sel-card .card-badge  { display: inline-block; margin-top: 6px; font-size: .66rem; padding: 2px 8px; border-radius: 20px; background: var(--accent-low); color: var(--accent); font-weight: 700; }
.sel-card .card-emoji  { font-size: 2rem; margin-bottom: 6px; display: block; line-height: 1; }
.sel-card .card-warn   { font-size: .66rem; color: var(--warn); margin-top: 5px; }
.sel-card .card-alert  { font-size: .66rem; margin-top: 4px; }
.sel-card .card-alert.bad  { color: var(--bad); }
.sel-card .card-alert.warn { color: var(--warn); }

.cards-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.cards-search  { max-width: 320px; }
.selected-preview {
  display: flex; align-items: center; gap: 14px;
  background: var(--accent-low); border: 1.5px solid var(--accent);
  border-radius: var(--radius); padding: 14px 18px; margin-top: 12px;
}
.selected-preview .sp-icon { font-size: 2rem; flex-shrink: 0; }
.selected-preview .sp-main { font-weight: 700; color: var(--text); font-size: .93rem; }
.selected-preview .sp-sub  { font-size: .77rem; color: var(--text2); margin-top: 3px; }
.btn-cambiar { margin-left: auto; font-size: .74rem; flex-shrink: 0; }

/* ── Secciones inspección ──────────────────────────────── */
.insp-section       { margin-bottom: 18px; }
.insp-section-title {
  font-family: var(--font-head); font-size: .88rem; letter-spacing: 1.5px;
  color: var(--text); margin-bottom: 10px; padding: 6px 12px;
  background: var(--bg3); border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.check-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.check-item   { background: var(--bg2); border-radius: var(--radius); padding: 10px 12px; border: 1.5px solid var(--border); transition: border-color var(--t); }
.check-item:hover { border-color: var(--border2); }
.check-item.full-width { grid-column: 1 / -1; }
.check-label  { font-size: .8rem; color: var(--text2); display: block; margin-bottom: 7px; font-weight: 500; }
.radio-group  { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-opt    { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; border: 1.5px solid var(--border2); font-size: .75rem; cursor: pointer; transition: all var(--t); color: var(--text2); }
.radio-opt input { display: none; }
.radio-opt:has(input:checked)                    { font-weight: 700; }
.radio-opt.opt-bueno:has(input:checked),
.radio-opt.opt-yes:has(input:checked)            { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.radio-opt.opt-malo:has(input:checked),
.radio-opt.opt-no:has(input:checked)             { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.radio-opt.opt-na:has(input:checked)             { background: var(--bg3); border-color: var(--border2); color: var(--text3); }

/* ── KM row ────────────────────────────────────────────── */
.km-row          { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.km-box          { flex: 1; min-width: 110px; }
.km-box > label  { font-size: .71rem; color: var(--text3); display: block; margin-bottom: 4px; font-weight: 700; text-transform: uppercase; }
.km-input        { width: 100%; background: var(--bg3); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 9px 12px; color: var(--text); font-family: var(--font-body); font-size: .9rem; outline: none; }
.km-input:focus  { border-color: var(--accent); }
.km-diff         { font-family: var(--font-mono); font-size: .9rem; color: var(--text2); padding: 9px 12px; background: var(--bg3); border: 1.5px solid var(--border); border-radius: var(--radius); white-space: nowrap; min-width: 80px; text-align: center; }

/* ── Fotos ─────────────────────────────────────────────── */
.foto-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.foto-upload-zone {
  background: var(--surface); border: 2px dashed var(--border2);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color var(--t); display: flex; flex-direction: column;
}
.foto-upload-zone:hover { border-color: var(--accent); }
.zone-preview     { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; background: var(--bg3); overflow: hidden; }
.zone-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; text-align: center; }
.zone-icon        { font-size: 26px; opacity: .4; }
.zone-label       { font-size: .78rem; font-weight: 600; color: var(--text2); }
.zone-hint        { font-size: .7rem; color: var(--text3); }
.zone-img         { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.zone-btn         { margin: 8px; }
.file-hidden      { display: none; }

.foto-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.foto-item  { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.foto-item img  { width: 100%; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.foto-item span { display: block; padding: 4px 8px; font-size: .7rem; color: var(--text2); font-family: var(--font-mono); border-top: 1px solid var(--border); }

.foto-zona       { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px; }
.foto-zona-label { font-size: .71rem; color: var(--text2); font-weight: 700; text-align: center; }
.foto-preview-img { width: 100%; max-height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ── Doc upload ────────────────────────────────────────── */
.doc-upload-box {
  display: flex; align-items: center;
  border: 2px dashed var(--border2); border-radius: var(--radius);
  cursor: pointer; overflow: hidden; background: var(--bg3);
  transition: border-color var(--t), background var(--t);
}
.doc-upload-box:hover  { border-color: var(--accent); background: var(--accent-dim); }
.doc-upload-inner      { display: flex; align-items: center; gap: 10px; padding: 12px 14px; width: 100%; pointer-events: none; }
.doc-upload-icon       { font-size: 1.4rem; flex-shrink: 0; }
.doc-upload-txt        { font-size: .84rem; font-weight: 600; color: var(--text2); }
.doc-upload-hint       { font-size: .7rem; color: var(--text3); margin-left: auto; white-space: nowrap; }
.doc-thumb             { width: 100%; max-height: 100px; object-fit: contain; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 6px; cursor: pointer; background: #fff; }

/* ── Firma ─────────────────────────────────────────────── */
.canvas-wrap         { border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.canvas-wrap canvas  { width: 100%; display: block; cursor: crosshair; }
.canvas-actions      { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg3); border-top: 1px solid var(--border); flex-wrap: wrap; }
.pin-input           { width: 100%; padding: 10px; font-size: 1.1rem; letter-spacing: .4rem; text-align: center; background: var(--bg3); border: 1.5px solid var(--border); border-radius: var(--radius); color: var(--text); outline: none; }
.pin-input:focus     { border-color: var(--accent); }
.firma-tab           { background: var(--bg3); color: var(--text2); border: 1.5px solid var(--border); }
.firma-tab.active    { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.firma-guardada-preview { max-width: 260px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 8px; margin-top: 8px; display: block; }

/* ══════════════════════════════════════════════════════════
   DASHBOARD
══════════════════════════════════════════════════════════ */
.dash-hero {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  background: linear-gradient(135deg, var(--sb-bg) 0%, #1f2937 100%);
  border: none;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.dash-hero::before {
  content: 'INSPECT';
  position: absolute;
  right: -20px; top: -10px;
  font-family: var(--font-head);
  font-size: 130px;
  color: rgba(255,255,255,.04);
  line-height: 1;
  pointer-events: none;
  letter-spacing: 4px;
}
.dash-title      { font-family: var(--font-head); font-size: 2.5rem; letter-spacing: 3px; color: #fff; line-height: 1.1; }
.dash-title span { color: var(--accent); }
.dash-sub        { font-size: .8rem; color: rgba(255,255,255,.5); margin-top: 6px; font-family: var(--font-mono); }
.dash-new-btn    { margin-top: 14px; }
.dash-time       { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--accent); letter-spacing: 2px; }
.dash-date-txt   { font-size: .77rem; color: rgba(255,255,255,.5); margin-top: 4px; text-transform: capitalize; font-family: var(--font-mono); }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card  {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 14px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t), transform .14s, border-color var(--t);
  border-top: 3px solid var(--accent);
}
.stat-card:hover    { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card.loading  { opacity: .5; }
.stat-card:nth-child(2) { border-top-color: var(--ok); }
.stat-card:nth-child(3) { border-top-color: var(--info); }
.stat-card:nth-child(4) { border-top-color: #7c3aed; }
.stat-card:nth-child(5) { border-top-color: #0891b2; }
.stat-card:nth-child(6) { border-top-color: var(--bad); }
.stat-number { font-family: var(--font-head); font-size: 2.5rem; color: var(--accent); letter-spacing: 1px; line-height: 1; }
.stat-card:nth-child(2) .stat-number { color: var(--ok); }
.stat-card:nth-child(3) .stat-number { color: var(--info); }
.stat-card:nth-child(4) .stat-number { color: #7c3aed; }
.stat-card:nth-child(5) .stat-number { color: #0891b2; }
.stat-card:nth-child(6) .stat-number { color: var(--bad); }
.stat-label  { font-size: .7rem; color: var(--text3); margin-top: 5px; text-transform: uppercase; letter-spacing: .8px; line-height: 1.4; }
.stat-icon   { position: absolute; right: 14px; top: 16px; font-size: 1.5rem; opacity: .18; }
.stat-trend  { font-size: .7rem; color: var(--ok); margin-top: 4px; font-weight: 700; }

/* 2 col */
.dash-2col  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.dash-box   {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}
.dash-box-title { font-family: var(--font-head); font-size: .94rem; letter-spacing: 1.5px; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

/* Gráficas */
.bar-row   { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { font-size: .78rem; color: var(--text2); min-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-wrap  { flex: 1; background: var(--bg3); border-radius: 20px; height: 8px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .6s ease; }
.bar-count { font-size: .74rem; font-family: var(--font-mono); color: var(--text3); min-width: 24px; text-align: right; }

.chart-wrap        { display: flex; align-items: flex-end; gap: 5px; height: 72px; margin-top: 8px; }
.chart-bar-col     { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.chart-bar-inner   { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--accent), var(--accent2)); transition: height .5s ease; min-height: 3px; }
.chart-day-label   { font-size: .57rem; color: var(--text3); font-family: var(--font-mono); }
.chart-count-lbl   { font-size: .6rem; color: var(--accent); font-weight: 700; }

/* Alertas dash */
.alert-list { display: flex; flex-direction: column; gap: 5px; }
.alert-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); font-size: .78rem; border: 1px solid; }
.alert-item.bad  { background: var(--bad-bg); border-color: #fca5a5; color: var(--bad); }
.alert-item.warn { background: var(--warn-bg); border-color: #fde68a; color: var(--warn); }
.alert-icon { font-size: .9rem; flex-shrink: 0; }

/* Acciones rápidas */
.dash-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; margin-bottom: 22px; }
.action-card  {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--text);
  transition: border-color var(--t), box-shadow var(--t), transform .14s;
  box-shadow: var(--shadow-xs);
}
.action-card:hover  { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.action-card.accent { border-color: var(--accent); background: linear-gradient(135deg, #fef9ee, var(--bg2)); }
.action-icon        { font-size: 1.6rem; flex-shrink: 0; }
.action-text strong { display: block; font-size: .87rem; font-weight: 700; color: var(--text); }
.action-text span   { font-size: .71rem; color: var(--text3); }

/* Últimas inspecciones */
.recent-section  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
.recent-header   { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--bg3); }
.recent-header h2 { font-family: var(--font-head); font-size: .94rem; letter-spacing: 1.5px; color: var(--text); }
.recent-item     { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); transition: background var(--t); }
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: var(--bg3); }
.recent-placa    { font-family: var(--font-mono); font-weight: 800; font-size: .8rem; background: var(--bg3); border: 1px solid var(--border2); border-radius: 5px; padding: 2px 7px; color: var(--text); }
.recent-info     { flex: 1; min-width: 0; }
.recent-name     { font-size: .8rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-sub      { font-size: .7rem; color: var(--text3); margin-top: 1px; }
.recent-date     { font-size: .7rem; color: var(--text3); font-family: var(--font-mono); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   ENTIDADES (personas / vehículos)
══════════════════════════════════════════════════════════ */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(278px, 1fr)); gap: 14px; margin-top: 4px; }

.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t), transform .14s;
  box-shadow: var(--shadow-xs);
}
.entity-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.entity-card-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); background: var(--bg3); }
.entity-avatar      { width: 42px; height: 42px; border-radius: 50%; background: var(--accent-low); color: var(--accent); font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.entity-avatar.veh-avatar { background: var(--bg3); font-size: 1.4rem; border: 1.5px solid var(--border2); }
.entity-avatar-photo { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex-shrink: 0; }
.entity-card-title  { flex: 1; min-width: 0; }
.entity-name        { font-weight: 700; color: var(--text); font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-sub         { font-size: .71rem; color: var(--text3); margin-top: 2px; }
.entity-card-body   { padding: 10px 16px; display: flex; flex-direction: column; gap: 5px; min-height: 58px; }
.entity-detail      { display: flex; align-items: center; gap: 6px; font-size: .79rem; color: var(--text2); }
.entity-detail span:first-child { font-size: .84rem; flex-shrink: 0; }
.entity-alert       { font-size: .7rem; padding: 3px 9px; border-radius: 20px; margin-top: 3px; display: inline-block; font-weight: 600; }
.entity-alert.bad   { background: var(--bad-bg); color: var(--bad); }
.entity-alert.warn  { background: var(--warn-bg); color: var(--warn); }
.entity-card-docs   { padding: 7px 16px; border-top: 1px solid var(--border); display: flex; gap: 6px; flex-wrap: wrap; background: var(--bg3); }
.entity-card-actions { padding: 8px 16px 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.doc-link           { font-size: .74rem; color: var(--accent); text-decoration: none; }
.doc-link:hover     { text-decoration: underline; }

/* ── Filtros pill ──────────────────────────────────────── */
.tipo-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; margin-top: 4px; }
.filter-btn  { padding: 5px 14px; border-radius: 20px; border: 1.5px solid var(--border); background: none; color: var(--text2); cursor: pointer; font-size: .77rem; transition: all var(--t); white-space: nowrap; }
.filter-btn:hover  { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ── Configuración ─────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-xs); }
.settings-card h3 { font-family: var(--font-head); font-size: 1.05rem; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.detail-row  { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-key  { font-size: .7rem; color: var(--text3); text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.detail-val  { font-size: .87rem; color: var(--text); font-weight: 600; }
.logo-preview-wrap { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.logo-preview-img  { width: 80px; height: 80px; object-fit: contain; border: 1px dashed var(--border); border-radius: var(--radius); padding: 4px; background: var(--bg3); }

/* ── Detalle inspección ────────────────────────────────── */
.detalle-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.detalle-section { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.detalle-section.full-width { grid-column: 1 / -1; }
.detalle-section h3 { font-size: .88rem; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
.detalle-table td { padding: 5px 0; border-bottom: 1px solid var(--border); }
.detalle-table td:first-child { color: var(--text2); width: 50%; }
.detalle-table tr:last-child td { border-bottom: none; }
.status-ok  { color: var(--ok); font-weight: 600; }
.status-bad { color: var(--bad); font-weight: 600; }
.status-na  { color: var(--text3); }
.obs-text   { font-size: .9rem; color: var(--text2); line-height: 1.7; white-space: pre-wrap; }

/* ── Pantalla éxito ─────────────────────────────────────── */
.success-screen  { text-align: center; padding: 44px 20px; }
.success-icon    { font-size: 3.5rem; margin-bottom: 16px; animation: bounceIn .45s; }
.success-screen h2 { font-family: var(--font-head); font-size: 1.8rem; letter-spacing: 3px; color: var(--text); margin-bottom: 10px; }
.success-screen p  { color: var(--text2); margin-bottom: 20px; }
.success-actions   { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@keyframes bounceIn { 0%{transform:scale(.3);opacity:0} 65%{transform:scale(1.08)} 100%{transform:scale(1);opacity:1} }

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .84rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-width: 320px;
  border-left: 4px solid;
  animation: slideInRight .22s ease;
  backdrop-filter: blur(2px);
}
.toast-success { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok); }
.toast-error   { background: var(--bad-bg);  color: var(--bad);  border-color: var(--bad); }
.toast-info    { background: var(--info-bg); color: var(--info); border-color: var(--info); }
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════════════════════════
   ALERTAS BELL
══════════════════════════════════════════════════════════ */
.btn-alerta-bell {
  position: relative; background: none;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; cursor: pointer; font-size: 1.1rem;
  color: var(--text2); transition: all var(--t);
  display: flex; align-items: center; gap: 4px;
}
.btn-alerta-bell:hover { border-color: var(--accent); color: var(--accent); }
.alerta-count { background: var(--bad); color: #fff; font-size: .6rem; font-weight: 800; border-radius: 20px; padding: 1px 5px; min-width: 16px; text-align: center; line-height: 1.4; }
.alertas-panel {
  position: fixed; top: 58px; right: 16px;
  width: 340px; max-height: 480px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 400; overflow: hidden; display: flex; flex-direction: column;
}
.alertas-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .84rem; background: var(--bg3); font-weight: 600; }
.alertas-panel-list   { overflow-y: auto; flex: 1; }
.alerta-item          { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: .79rem; }
.alerta-item:last-child { border-bottom: none; }
.alerta-icon    { font-size: .95rem; flex-shrink: 0; margin-top: 1px; }
.alerta-nombre  { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.alerta-doc     { color: var(--text3); font-size: .7rem; }
.alerta-vencido { background: var(--bad-bg); }
.alerta-urgente { background: var(--warn-bg); }
.alerta-proximo { background: var(--bg2); }

/* Historial vehículo */
.hist-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg3); border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer; transition: border-color var(--t); margin-bottom: 6px; }
.hist-item:hover { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   MISCELÁNEOS
══════════════════════════════════════════════════════════ */
.empty-state  { padding: 40px 24px; text-align: center; color: var(--text3); font-size: .875rem; }
.empty-state a { color: var(--accent); }
.muted        { color: var(--text3); font-size: .855rem; }
.mono         { font-family: var(--font-mono); font-size: .82rem; }

.loading-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--bg3) 25%, var(--accent) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: loadingSlide 1.2s infinite;
  border-radius: 2px;
  margin: 20px 0;
}
@keyframes loadingSlide { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

.section-header    { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h2 { font-family: var(--font-head); font-size: 1.1rem; letter-spacing: 2px; }
.link-more         { font-size: .84rem; color: var(--accent); text-decoration: none; }
.link-more:hover   { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (min-width: 901px) {
  .menu-toggle { display: none !important; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: -240px;
    height: 100vh; z-index: 300;
    transition: left .24s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
    width: 240px;
  }
  .sidebar.open  { left: 0; }
  .main          { margin-left: 0 !important; }
  .topbar        { position: sticky; top: 0; z-index: 200; }
  .menu-toggle   { display: flex !important; }
}
@media (max-width: 768px) {
  .entity-grid      { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
  .cards-grid       { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
  .foto-upload-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table       { font-size: .78rem; }
  .data-table th, .data-table td { padding: 7px 10px; }
  .modal            { max-width: 98vw; max-height: 95vh; }
  .form-row         { grid-template-columns: 1fr; }
  .dash-2col        { grid-template-columns: 1fr; }
  .stats-grid       { grid-template-columns: repeat(2, 1fr); }
  .wstep-label      { display: none; }
  .check-grid       { grid-template-columns: 1fr; }
  .dash-hero        { padding: 18px 20px; }
  .dash-title       { font-size: 1.9rem; }
  .dash-time        { font-size: 1.5rem; }
  .topbar-datetime  { display: none; }
  .topbar-actions   { gap: 6px; }
  .table-wrap       { border-radius: 10px; }
  /* Datos básicos modal persona: 1 columna en tablet */
  #formPersona [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 480px) {
  .entity-grid      { grid-template-columns: 1fr; }
  .cards-grid       { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .page-content     { padding: 14px 12px 40px; }
  .form-wizard      { padding: 12px; border-radius: var(--radius); }
  .topbar-title     { font-size: .84rem; }
  .topbar           { padding: 10px 12px; }
  .topbar-actions .btn-accent { display: none; }
  .selected-preview { flex-wrap: wrap; gap: 8px; }
  .btn-cambiar      { margin-left: 0; }
  .alertas-panel    { width: calc(100vw - 16px); right: 8px; }
  .modal-body       { padding: 14px; }
  .doc-upload-hint  { display: none; }
  .canvas-wrap canvas { height: 130px; }
  /* Modal persona en móvil: foto + datos en columna */
  #formPersona > div:first-child { flex-direction: column; align-items: center !important; }
  #formPersona > div:first-child > div:last-child { grid-template-columns: 1fr !important; width: 100%; }
  /* PIN inputs en móvil: 1 columna */
  #formPersona .pin-grid-2 { grid-template-columns: 1fr !important; }
  /* Toolbar nueva inspección */
  .cards-toolbar-row { flex-wrap: wrap; }
  .cards-toolbar-row .tb-fecha { width: 100%; flex: 0 0 100%; }
  .cards-toolbar-row .tb-search { flex: 1; min-width: 0; }
  /* doc-doble en móvil */
  .doc-doble-caras { grid-template-columns: 1fr 1fr !important; gap: 6px !important; }
  /* wizard steps compactos */
  .wstep-n { width: 24px !important; height: 24px !important; font-size: .75rem !important; }
  .form-wizard { padding: 10px; }
  /* wizard-nav botones full width en muy pequeño */
  .wizard-nav { gap: 8px; }
}
@media (max-width: 360px) {
  .cards-grid { grid-template-columns: 1fr; }
  .wizard-nav { flex-direction: column-reverse; }
  .wizard-nav .btn { width: 100%; justify-content: center; }
  .sel-card { padding: 12px; }
}
@media (max-width: 600px) {
  .km-row { flex-wrap: wrap; }
  .km-box { min-width: calc(50% - 8px); }
}
@media (hover: none) {
  .sel-card:hover    { transform: none; }
  .entity-card:hover { transform: none; }
  .action-card:hover { transform: none; }
  .filter-btn        { min-height: 44px; padding: 8px 16px; }
  .sel-card          { min-height: 44px; }
}

/* ── Toggle switch login ──────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border2); border-radius: 24px;
  transition: background .2s;
}
.toggle-track::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(20px); }
.topbar-icon-btn{
  width:38px;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--bg2);
  color:var(--text);
  text-decoration:none;
  font-size:1.1rem;
  cursor:pointer;
  transition:all .18s ease;
  flex-shrink:0;
}

.topbar-icon-btn:hover{
  background:var(--accent-dim);
  color:var(--accent);
  border-color:var(--accent);
}
