@font-face {
  font-family: "Satoshi";
  src: url("../assets/fonts/Satoshi-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("../assets/fonts/Satoshi-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* —— Light (default) —— */
:root,
html[data-theme="light"] {
  --red: #E31F26;
  --red-brand: #D2222A;
  --red-dim: #b51a20;
  --red-soft: #FDECEC;
  --chrome: #1A1A1A;
  --chrome-2: #222;
  --chrome-3: #2A2A2A;
  --chrome-border: #3A3A3A;
  --chrome-text: #F7F7F7;
  --chrome-muted: #9A9A9A;
  --bg: #E6E6E6;
  --bg-gradient: linear-gradient(180deg, #F5F5F5 0%, #E8E8E8 55%, #E0E0E0 100%);
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --border: #E4E4E4;
  --border-strong: #D0D0D0;
  --text: #1A1A1A;
  --muted: #6E6E6E;
  --ok: #1FA66A;
  --ok-soft: #E8F7EF;
  --danger: #E31F26;
  --btn-primary-bg: #1A1A1A;
  --btn-primary-hover: #2A2A2A;
  --btn-primary-active: #111111;
  --btn-primary-fg: #FFFFFF;
  --modal-scrim: rgba(26, 26, 26, 0.35);
  --theme-toggle-bg: rgba(26, 26, 26, 0.06);
  --theme-toggle-hover: rgba(26, 26, 26, 0.1);
  --radius: 10px;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-bar: 64px; /* header content+pads excl. safe-top */
  --font: "Satoshi", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

/* —— Dark —— */
html[data-theme="dark"] {
  --red: #E31F26;
  --red-brand: #E31F26;
  --red-dim: #FF6B6F;
  --red-soft: rgba(227, 31, 38, 0.18);
  --chrome: #1A1A1A;
  --chrome-2: #222;
  --chrome-3: #2A2A2A;
  --chrome-border: #3A3A3A;
  --chrome-text: #F7F7F7;
  --chrome-muted: #8A8A8A;
  --bg: #242424;
  --bg-gradient: linear-gradient(180deg, #2A2A2A 0%, #242424 55%, #1F1F1F 100%);
  --surface: #2A2A2A;
  --surface-elevated: #303030;
  --border: #3A3A3A;
  --border-strong: #4A4A4A;
  --text: #F2F2F2;
  --muted: #9A9A9A;
  --ok: #3DCC8A;
  --ok-soft: rgba(31, 166, 106, 0.18);
  --danger: #E31F26;
  --btn-primary-bg: #E31F26;
  --btn-primary-hover: #C91B21;
  --btn-primary-active: #B0181D;
  --btn-primary-fg: #FFFFFF;
  --modal-scrim: rgba(0, 0, 0, 0.55);
  --theme-toggle-bg: rgba(255, 255, 255, 0.08);
  --theme-toggle-hover: rgba(255, 255, 255, 0.14);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  min-height: 100%;
  scroll-padding-top: calc(var(--header-bar) + var(--safe-top));
}

.app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  background-image: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  padding-bottom: calc(24px + var(--safe-bottom));
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  color: #1A1A1A;
  padding: calc(12px + var(--safe-top)) 16px 12px 20px;
  border-bottom: 1px solid #E31F26; /* thin brand red separator */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Dark theme: charcoal header matching logo plate (~#1e1e1e) */
html[data-theme="dark"] .header {
  background: #1e1e1e;
  color: #F7F7F7;
  border-bottom: 1px solid #E31F26; /* thin brand red separator */
}

html[data-theme="dark"] .header .theme-toggle {
  color: #F7F7F7;
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .header .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.brand-text { min-width: 0; }

.brand-logo {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
}

/* Dark Drive white-plate logo has internal padding — bump height to match/exceed light */
.brand-logo.logo-for-dark {
  height: 63px;
  max-width: 281px;
}

/* Dual logos: light = red/black noslogan; dark = Drive white plate */
.logo-for-dark { display: none; }
.brand-logo.logo-for-dark,
.pin-logo.logo-for-dark { display: none; }
html[data-theme="dark"] .logo-for-light,
html[data-theme="dark"] .brand-logo.logo-for-light,
html[data-theme="dark"] .pin-logo.logo-for-light { display: none; }
html[data-theme="dark"] .logo-for-dark,
html[data-theme="dark"] .brand-logo.logo-for-dark,
html[data-theme="dark"] .pin-logo.logo-for-dark { display: block; }
html[data-theme="dark"] .logo-chip.logo-for-dark { display: inline-flex; }

/* Dark chrome chip behind white logo for contrast on white header / light PIN strip */
.logo-chip {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1A1A1A;
  flex-shrink: 0;
  line-height: 0;
}

.logo-chip .brand-logo,
.logo-chip .pin-logo {
  margin: 0;
  height: 28px;
  max-width: 160px;
}

.pin-logo-chip {
  margin: 0 auto 24px;
}

.pin-logo-chip .pin-logo {
  height: 36px;
  max-width: 200px;
  margin: 0;
}

.brand-mark {
  /* legacy fallback if img missing */
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--chrome);
  color: var(--chrome-text);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.page-title {
  margin: 0 0 22px;
}

.page-title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

/* —— Theme toggle —— */
.theme-toggle {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--theme-toggle-bg);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease;
  font-family: inherit;
}

.theme-toggle:hover { background: var(--theme-toggle-hover); }
.theme-toggle:active { transform: scale(0.96); }

.theme-toggle .theme-icon { display: none; line-height: 1; }
html[data-theme="light"] .theme-toggle .theme-icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }

.theme-toggle--pin {
  position: absolute;
  top: calc(12px + var(--safe-top));
  right: 16px;
  z-index: 2;
}

.main {
  /* Header is sticky (in-flow); top padding is content inset, not under-header offset */
  padding: 24px 20px;
  padding-top: 24px;
  flex: 1;
}

.field {
  margin-bottom: 22px;
}

.field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.field-row .field {
  margin-bottom: 0;
  flex: 1;
}

.field-row .grow { flex: 1.3; }

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.optional {
  font-weight: 400;
  color: var(--chrome-muted);
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--surface-elevated);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.4 0.6L6 5.2 10.6 0.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 40px;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: none;
}

textarea { resize: vertical; min-height: 72px; }

.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.input-prefix:focus-within {
  border-color: var(--text);
  box-shadow: none;
}

.input-prefix span {
  padding: 0 0 0 14px;
  color: var(--muted);
  font-weight: 500;
}

.input-prefix input {
  border: none;
  box-shadow: none;
  min-height: var(--tap);
  background: transparent;
}

.input-prefix input:focus { box-shadow: none; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.chip.active {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red-dim);
}

.chip.recent {
  background: var(--surface-elevated);
  font-size: 0.8rem;
}

.select-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
  background: var(--surface-elevated);
  display: none;
}

.select-list.open { display: block; }

.opt-group {
  padding: 8px 12px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
  position: sticky;
  top: 0;
}

.opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  min-height: var(--tap);
}

.opt:last-child { border-bottom: none; }

.opt:active, .opt:hover { background: var(--bg); }

.opt .code {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.selected-pill {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--red-soft);
  border: 1px solid rgba(227, 31, 38, 0.25);
  border-radius: var(--radius);
  color: var(--red-dim);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.selected-pill button {
  border: none;
  background: transparent;
  color: var(--red);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
}

.ticket-box input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.ticket-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  margin: 0;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.ticket-btn:hover {
  border-color: var(--red);
  color: var(--red-dim);
  background: var(--red-soft);
}

.ticket-icon { font-size: 1.25rem; }

.ticket-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticket-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.btn-text {
  border: none;
  background: none;
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px;
}

.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  line-height: 52px;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  margin-top: 8px;
  box-shadow: none;
}

.btn-primary:hover { background: var(--btn-primary-hover); }
.btn-primary:active { background: var(--btn-primary-active); }

.btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.form-error {
  color: var(--danger);
  background: var(--red-soft);
  border: 1px solid rgba(227, 31, 38, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin: 0 0 12px;
}

.history {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.history h2 {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.history-list li:last-child { border-bottom: none; }

.history-list .amt {
  font-weight: 700;
  color: var(--text);
}

.history-list .meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--chrome);
  color: var(--chrome-text);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 50;
  max-width: 90vw;
}

html[data-theme="dark"] .toast {
  background: #2A2A2A;
  border: 1px solid var(--border);
}

.modal {
  position: fixed;
  inset: 0;
  background: var(--modal-scrim);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.modal[hidden] { display: none; }

.modal-card {
  background: var(--surface-elevated);
  border-radius: 12px;
  padding: 28px 22px;
  width: min(400px, 100%);
  text-align: center;
  border: 1px solid var(--border);
}

.modal-ok {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 700;
}

.modal-card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modal-card p { color: var(--muted); margin: 0 0 16px; line-height: 1.45; }

.fallback-hint { font-size: 0.9rem !important; }

.fallback-actions { margin-bottom: 8px; }

@media (min-width: 481px) {
  body { padding: 32px 0; background: var(--bg); background-image: var(--bg-gradient); }
  .app {
    border-radius: 12px;
    min-height: calc(100dvh - 64px);
    overflow: hidden;
    border: 1px solid var(--border);
  }
}

/* —— PIN gate —— */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  background-image: var(--bg-gradient);
  display: grid;
  place-items: center;
  padding: 24px 16px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

.pin-gate[hidden] { display: none; }

.pin-card {
  background: var(--surface-elevated);
  border-radius: 12px;
  padding: 24px 22px 20px;
  width: min(340px, 100%);
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: none;
}

.pin-logo {
  height: 72px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  margin: 0 auto 24px;
  display: block;
  border-radius: 8px;
}

/* PIN: light = noslogan red/black; dark = Drive white plate */
.pin-logo-wrap {
  display: block;
  margin: 0 auto 0;
}

.pin-mark {
  margin: 0 auto 16px;
  background: var(--chrome);
  color: var(--chrome-text);
  border: none;
}

.pin-card h1 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.pin-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.pin-card input[type="password"],
.pin-card input[type="text"] {
  text-align: center;
  letter-spacing: 0.2em;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.pin-card .btn-primary {
  margin-top: 4px;
}

.pin-card .form-error {
  text-align: left;
}

.gps-hint {
  margin: 0 0 14px;
  font-size: 0.75rem;
  color: var(--chrome-muted);
  text-align: center;
}

/* —— Mantenimiento —— */
.pin-card .pin-logo { height: 44px; margin-bottom: 18px; }
html[data-theme="dark"] .pin-card .pin-logo.logo-for-dark { height: 64px; }
.loading { color: var(--muted); padding: 18px 0; text-align: center; }
.eq-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}
.eq-head { display: flex; gap: 14px; align-items: flex-start; }
.eq-photo img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.eq-info { min-width: 0; flex: 1; }
.eq-code { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; color: var(--red-dim); text-transform: uppercase; }
.eq-info h2 { margin: 2px 0 6px; font-size: 1.15rem; line-height: 1.25; letter-spacing: -0.01em; }
.eq-meta { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.eq-reqs { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.eq-reqs h3 { margin: 0 0 6px; font-size: 0.72rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.req-list { list-style: none; margin: 0; padding: 0; }
.req-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.req-list li:last-child { border-bottom: none; }
.req-list .meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.badge { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); margin-right: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.badge.corrective { background: var(--red-soft); color: var(--red-dim); }
.badge.preventive { background: var(--ok-soft); color: var(--ok); }
.btn-change { margin-top: 8px; padding-left: 0; }
.chip-ok.active { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.chip-warn.active { background: rgba(245, 158, 11, 0.15); border-color: #F59E0B; color: #B45309; }
html[data-theme="dark"] .chip-warn.active { color: #FBBF24; }
.fotos-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.fotos-preview .fp { position: relative; }
.fotos-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.fotos-preview button { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--chrome); color: #fff; font-size: 0.8rem; cursor: pointer; line-height: 24px; padding: 0; }


/* —— Flujo de elección (3 opciones) —— */
.flow-choice { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
/* Las 8 opciones con la MISMA altura: la fila más alta manda (grid 1fr). */
.flow-lista { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: 1fr; gap: 12px; }
.flow-lista > .flow-btn { height: 100%; }
.flow-intro { margin: 0 0 4px; color: var(--muted); font-size: 0.95rem; }
/* Opciones de la ficha: TODAS iguales (8/10, ?v=qr1). Rojo sólo al tocar/foco, nunca fijo. */
.flow-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 76px; padding: 14px 16px; margin: 0;
  text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface-elevated); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  -webkit-tap-highlight-color: transparent; transition: border-color .12s ease, background-color .12s ease;
}
.flow-ico { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; line-height: 1; background: var(--bg); }
.flow-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.flow-title { font-weight: 700; font-size: 1.02rem; line-height: 1.25; color: var(--text); }
.flow-desc { font-size: 0.88rem; color: var(--muted); line-height: 1.35; }
.flow-badge { margin-left: 4px; font-size: 0.75rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.flow-btn:active { border-color: var(--red-brand); }
.flow-btn:focus { outline: none; }
.flow-btn:focus-visible { border-color: var(--red-brand); box-shadow: 0 0 0 2px rgba(210, 34, 42, 0.25); }
@media (hover: hover) and (pointer: fine) { .flow-btn:hover { border-color: var(--red-brand); } }
html[data-theme="dark"] .flow-btn { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.pend-items { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.pend-item {
  display: block; width: 100%; text-align: left; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  color: var(--fg); font: inherit; cursor: pointer;
}
.pend-item:active, .pend-item:hover { border-color: #D2222A; }
.pend-item .pend-name { font-weight: 650; margin-bottom: 4px; }
.pend-item .meta { font-size: 0.85rem; color: var(--muted); }
.section-h { margin: 8px 0 4px; font-size: 1.05rem; }
.btn-back { margin: 0 0 10px; padding: 0; }
.close-target {
  padding: 12px 14px; margin-bottom: 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border);
}
.close-target strong { display: block; margin-bottom: 4px; }

.who-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin-bottom: 8px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border);
}
.who-banner #who-hello { font-weight: 650; }
.who-static {
  padding: 12px 14px; border-radius: 12px; background: var(--bg);
  border: 1px solid var(--border); font-size: 0.95rem;
}


/* —— Preguntar al manual —— */
.manual-chat { display: flex; flex-direction: column; gap: 10px; }
.manual-docs { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); padding: 10px 14px; font-size: 0.9rem; }
.manual-docs summary { cursor: pointer; font-weight: 650; }
.manual-docs ul { margin: 8px 0 0; padding-left: 18px; }
.manual-docs li { margin: 4px 0; line-height: 1.35; }
.manual-docs a { color: var(--text); }
.manual-docs .meta { color: var(--muted); font-size: 0.78rem; }
.chat-log { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 10px 12px; border-radius: 14px; font-size: 0.93rem; line-height: 1.45; word-wrap: break-word; }
.msg-user { align-self: flex-end; background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg-bot { align-self: flex-start; background: var(--surface-elevated); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-bot.loading-msg { color: var(--muted); font-style: italic; }
.msg-head { font-weight: 700; margin-bottom: 6px; }
.msg-head.web { color: #B45309; }
html[data-theme="dark"] .msg-head.web { color: #FBBF24; }
.msg-head.warn { color: var(--red-dim); }
.msg-text p { margin: 0 0 6px; }
.msg-text sup { font-size: 0.7em; color: var(--red-dim); font-weight: 700; }
.pasaje { border-left: 3px solid var(--red); padding: 6px 0 6px 10px; margin: 8px 0; }
.pasaje .src { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.pasaje .txt { font-size: 0.86rem; white-space: pre-wrap; }
.msg a { color: inherit; font-weight: 600; }
.fuentes { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); }
.fuentes ol, .fuentes ul { margin: 4px 0 0; padding-left: 18px; }
.avisos { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.35); font-size: 0.82rem; }
.avisos div + div { margin-top: 4px; }
.chat-sugs { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-sugs button { border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; }
.chat-form { position: sticky; bottom: calc(8px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 6px; background: var(--bg); padding: 6px 0; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 48px; max-height: 140px; resize: none; padding: 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 16px; }
.chat-send { width: 48px; height: 48px; flex: none; border: none; border-radius: 12px; background: var(--btn-primary-bg); color: var(--btn-primary-fg); font-size: 1.1rem; cursor: pointer; }
.chat-send:disabled { opacity: 0.5; cursor: wait; }
.chat-foot { margin: 0; font-size: 0.75rem; color: var(--muted); text-align: center; }

/* El atributo hidden siempre oculta (algunas secciones usan display:flex) */
[hidden] { display: none !important; }

/* —— Navegación: inicio / volver / buscador —— */
a.brand { text-decoration: none; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a.brand:active { opacity: 0.75; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.picker-list.select-list { max-height: none; }
.cat-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chips button { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; white-space: nowrap; min-height: 36px; }
.cat-chips button.active { background: var(--red-brand); border-color: var(--red-brand); color: #fff; }
.cat-chips button .n { opacity: 0.7; margin-left: 4px; font-size: 0.75rem; }
.eq-count { margin: 6px 0 0; font-size: 0.8rem; }
#card-back { display: block; }
.opt .pat { font-weight: 600; }

/* —— Fase 3: Datos del equipo, foto y dictado —— */
.eq-datos { margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); }
.eq-datos h3 { margin: 0 0 6px; font-size: 0.95rem; }
.datos-main .dato { display: grid; grid-template-columns: 7.2em 1fr; gap: 2px 8px; padding: 3px 0; font-size: 0.88rem; border-bottom: 1px dashed var(--border); }
.datos-main .dato:last-child { border-bottom: 0; }
.dato .k { color: var(--muted); }
.dato .v b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.02em; word-break: break-all; }
.dato .src, .datos-flota .src { display: block; font-size: 0.75rem; color: var(--muted); }
.dato .src a, .datos-flota a, .datos-more a { color: inherit; text-decoration: underline; }
.dato .dif, .datos-flota .dif { display: block; font-size: 0.78rem; color: #B45309; }
html[data-theme="dark"] .dato .dif, html[data-theme="dark"] .datos-flota .dif { color: #FBBF24; }
.datos-flota { margin-top: 8px; font-size: 0.85rem; padding-top: 6px; border-top: 1px solid var(--border); }
.datos-flota:empty { display: none; }
.datos-more { margin-top: 6px; font-size: 0.85rem; }
.datos-more summary { cursor: pointer; color: var(--muted); }
.datos-more ul { margin: 4px 0 6px; padding-left: 18px; }
.datos-more li { margin: 2px 0; }
.datos-none { font-size: 0.85rem; color: var(--muted); margin: 0; }
.chat-tools { display: flex; gap: 6px; }
.chat-tool { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; border: 1px solid var(--border-strong); background: var(--surface-elevated); color: var(--text); border-radius: 10px; font: inherit; font-size: 0.85rem; cursor: pointer; user-select: none; }
.chat-tool.rec { background: #FEE2E2; border-color: #DC2626; color: #991B1B; }
html[data-theme="dark"] .chat-tool.rec { background: #450A0A; color: #FCA5A5; }
.chat-img-prev { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-elevated); }
.chat-img-prev img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.chat-img-prev .meta { flex: 1; font-size: 0.8rem; }
.chat-img-del { border: 1px solid var(--border-strong); background: transparent; color: var(--text); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 0.8rem; cursor: pointer; }
.mic-status { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: #FEE2E2; color: #991B1B; font-size: 0.85rem; }
html[data-theme="dark"] .mic-status { background: #450A0A; color: #FCA5A5; }
.mic-status #mic-label { flex: 1; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #DC2626; animation: recpulse 1s infinite; }
@keyframes recpulse { 50% { opacity: 0.25; } }
.msg-photo { display: block; max-width: 180px; max-height: 180px; border-radius: 10px; margin-bottom: 6px; object-fit: cover; }
.msg-vision { font-size: 0.83rem; margin-bottom: 6px; padding: 6px 8px; border-radius: 8px; background: var(--bg); }
.msg-difs { margin-top: 6px; font-size: 0.82rem; color: #B45309; }
html[data-theme="dark"] .msg-difs { color: #FBBF24; }
.msg-head.datos { color: var(--text); }

/* —— HormitecFoto (fotos con sello) —— */
button.ticket-btn { width: 100%; font: inherit; }
.fotos-preview .fp-code { display: block; margin-top: 3px; font-size: 0.68rem; color: var(--muted); text-align: center; letter-spacing: 0.02em; white-space: nowrap; }

/* Al abrir una opción desde la ficha, la sección queda anclada arriba (debajo del header): alto mínimo de una pantalla
   para que siempre se pueda anclar aunque la lista o el chat sean cortos */
#historial-view:not([hidden]), #pend-list:not([hidden]), #manual-chat:not([hidden]), #mant-form:not([hidden]), #done-form:not([hidden]), #close-form:not([hidden]) {
  min-height: calc(100vh - var(--header-bar) - var(--safe-top));
  min-height: calc(100dvh - var(--header-bar) - var(--safe-top));
}

/* —— HormitecFoto 1.1: antes/después, galería del equipo y mapa de fotos —— */
.foto-fases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.ticket-btn--fase { min-height: 52px; font-weight: 600; color: var(--text); }
.ticket-btn--fase[data-fase="antes"] { border-color: #d97706; }
.ticket-btn--fase[data-fase="despues"] { border-color: #059669; }
.ticket-btn--otra { min-height: 44px; font-size: 0.92rem; }
.foto-fases-hint { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }
.fotos-preview .fp-fase { position: absolute; left: 4px; bottom: 22px; font-size: 9px; padding: 0 5px; }
.eq-fotos { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.eq-fotos-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.eq-fotos h3 { margin: 0; font-size: 0.72rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.eq-fotos-n { font-weight: 600; }
.eq-fotos-mapa, .eq-fotos-mas { font-size: 0.85rem; padding: 4px 0; }
.eq-fotos-mas { margin-top: 8px; }
.eq-galeria.hf-gal { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.eq-galeria .hf-gal-item { background: var(--bg); border-color: var(--border); color: var(--text); }
.eq-galeria .hf-gal-item figcaption span { color: var(--muted); }
.eq-galeria .hf-gal-links a { color: var(--red-dim); }
.btn-mapa-fotos {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin-top: 14px; padding: 12px 16px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.btn-mapa-fotos span { font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.btn-mapa-fotos:hover { border-color: var(--red-brand); }
.mapa-view { display: flex; flex-direction: column; gap: 10px; }
.mapa-filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mapa-filtros label { display: flex; flex-direction: column; gap: 3px; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mapa-filtros .mf-eq { grid-column: 1 / -1; }
.mapa-filtros select, .mapa-filtros input { font: inherit; font-size: 0.95rem; text-transform: none; letter-spacing: 0; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); width: 100%; min-width: 0; }
.mapa-info { margin: 0; }
.mapa-box { height: calc(100dvh - 300px); min-height: 360px; border-radius: 12px; border: 1px solid var(--border); }

/* acceso al portal de fotos (hormitec-fotos.pages.dev) */
.link-portal-fotos { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; padding: 12px 16px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 700; }
.link-portal-fotos span { font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.link-portal-fotos:hover { border-color: var(--red-brand); }
.link-portal-fotos--mini { flex-direction: row; margin: 0; padding: 8px 12px; font-size: 0.9rem; color: var(--red-dim); border-style: solid; }

/* Checklist con fotos obligatorias */
.ck-field .ck-sel { margin-bottom: 6px; }
.ck-hint { margin: 2px 0 8px; font-size: .82rem; color: var(--muted); line-height: 1.3; }

.fp-rep { position: absolute; left: 4px; top: 4px; font-size: .62rem; font-weight: 800; color: #fff; padding: 1px 5px; border-radius: 6px; background: #d9822b; }
.fp-rep-seg { background: #D2222A; }

/* —— Chequeo con IA —— */
.chequeo-view .cq-anterior { margin: 8px 0 10px; font-size: .9rem; }
.cq-base, .cq-ant { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin: 0 0 6px; }
.cq-hist ul { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; }
.cq-firma { text-align: center; margin-top: 6px; }
.cq-progreso { text-align: center; padding: 28px 12px; }
.cq-spin { width: 44px; height: 44px; margin: 0 auto 12px; border: 4px solid var(--border); border-top-color: var(--red-brand); border-radius: 50%; animation: cqgira 0.9s linear infinite; }
@keyframes cqgira { to { transform: rotate(360deg); } }
.cq-ok { font-weight: 700; color: var(--ok); font-size: 1.05rem; margin: 4px 0 10px; }
.cq-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 8px; }
.cq-tile { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--muted); border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; }
.cq-tile span { font-size: .8rem; color: var(--muted); }
.cq-tile b { font-size: 1.8rem; line-height: 1.1; }
.cq-tile small { font-size: .72rem; color: var(--muted); }
.cq-tile.ok { border-top-color: #1E8E3E; } .cq-tile.ok b, b.ok { color: #1E8E3E; }
.cq-tile.med { border-top-color: #B45309; } .cq-tile.med b, b.med { color: #B45309; }
.cq-tile.mal { border-top-color: #B91C1C; } .cq-tile.mal b, b.mal, span.mal { color: #B91C1C; }
.cq-h { margin: 12px 0 6px; font-size: .95rem; }
.cq-hall { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.cq-niv { display: inline-block; min-width: 46px; text-align: center; font-size: .7rem; font-weight: 700; color: #fff; border-radius: 4px; padding: 1px 4px; background: #52525b; }
.cq-niv.alto { background: #B91C1C; } .cq-niv.medio { background: #B45309; }
.cq-pedidos { background: var(--red-soft); color: #7f1d1d; border-radius: 10px; padding: 8px 10px; font-size: .9rem; margin: 6px 0; }
.cq-vista { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; margin: 0 0 6px; font-size: .88rem; }
.cq-vista summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; }
.cq-vista summary span { color: var(--muted); font-size: .8rem; }
.cq-pdf { display: block; text-align: center; text-decoration: none; margin: 12px 0 8px; }
[data-theme="dark"] .cq-pedidos { background: #3b1414; color: #fecaca; }

/* —— 📜 Historial de mantenimiento del equipo —— */
.historial-view { display: flex; flex-direction: column; gap: 10px; }
.historial-view .section-h { margin: 0; }
.hi-resumen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hi-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hi-tile span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.hi-tile b { font-size: 1.05rem; line-height: 1.2; }
.hi-tile small { font-size: 0.74rem; color: var(--muted); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hi-tile.hi-venc { border-color: #B91C1C; } .hi-tile.hi-venc b { color: #B91C1C; }
.hi-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.tb-acc { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tb-acc:hover { border-color: var(--red-brand); }
.tb-acc:disabled { opacity: 0.6; cursor: progress; }
.hi-acciones .tb-acc { flex: 1 1 140px; }
.hi-filtros { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hi-filtros select, .tb-filtros select, .tb-filtros input { font: inherit; font-size: 0.92rem; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); min-width: 0; min-height: 40px; }
.hi-filtros select { flex: 1 1 140px; }
.tb-sem { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1 1 100%; padding-bottom: 2px; }
.tb-sem::-webkit-scrollbar { display: none; }
.tb-sem button { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 0.82rem; cursor: pointer; white-space: nowrap; min-height: 36px; }
.tb-sem button.active { background: var(--red-brand); border-color: var(--red-brand); color: #fff; }
.tb-sem button .n { opacity: 0.75; margin-left: 5px; font-size: 0.74rem; }
.hi-lista { display: flex; flex-direction: column; gap: 8px; }
.hi-item { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 10px; }
.hi-item.hi-ok { border-left-color: var(--ok); } .hi-item.hi-pend { border-left-color: #B45309; } .hi-item.hi-mal { border-left-color: #B91C1C; } .hi-item.hi-cancel { opacity: 0.75; }
.hi-item > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; position: relative; padding-right: 30px; }
.hi-item > summary::-webkit-details-marker { display: none; }
.hi-item > summary::after { content: "▾"; position: absolute; right: 12px; top: 10px; color: var(--muted); transition: transform .15s; }
.hi-item[open] > summary::after { transform: rotate(180deg); }
.hi-l1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hi-fecha { font-weight: 700; font-size: 0.9rem; }
.hi-est { font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.hi-est-ok { background: var(--ok-soft); color: var(--ok); } .hi-est-pend { background: rgba(180, 83, 9, .14); color: #B45309; } .hi-est-mal { background: var(--red-soft); color: var(--red-dim); }
[data-theme="dark"] .hi-est-pend { color: #F59E0B; }
.hi-nom { font-weight: 600; line-height: 1.3; word-break: break-word; }
.hi-meta { font-size: 0.8rem; color: var(--muted); }
.hi-det { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.hi-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 0.86rem; }
.hi-dl dt { color: var(--muted); } .hi-dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.hi-desc p { margin: 4px 0 0; white-space: pre-wrap; font-size: 0.86rem; line-height: 1.4; background: var(--bg); border-radius: 8px; padding: 8px 10px; word-break: break-word; }
.hi-desc b, .hi-cq > b, .hi-ck > b, .hi-fotos-h b { font-size: 0.86rem; }
.hi-cq .cq-tiles { grid-template-columns: repeat(4, 1fr); margin-top: 6px; }
.hi-cq .cq-tile b { font-size: 1.3rem; }
.hi-cq .meta { margin: 0; font-size: .82rem; }
.hi-ck ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.hi-ck li { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; background: var(--bg); border-radius: 8px; padding: 4px; }
.hi-ck li small { display: block; color: var(--muted); font-size: .68rem; }
.hi-ck-foto { border: 0; padding: 0; background: none; cursor: zoom-in; flex: 0 0 auto; }
.hi-ck-foto img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; background: var(--border); }
.hi-ck-sin { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 6px; border: 1px dashed var(--border-strong); color: var(--muted); }
.hi-ck li.mal .hi-ck-sin { color: #B91C1C; border-color: #B91C1C; }
.hi-ck-est { font-size: .72rem; font-weight: 700; } .hi-ck-est.ok { color: var(--ok); } .hi-ck-est.mal { color: #B91C1C; }
.hi-fotos-h { font-size: .82rem; color: var(--muted); }
.hi-vacio { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); font-size: .9rem; line-height: 1.4; margin: 0; }
.hi-vacio b { color: var(--text); }
.hi-extra { display: flex; flex-direction: column; gap: 10px; }
.hi-extra:empty { display: none; }
.hi-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.hi-sec h4 { margin: 0 0 6px; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hi-sec .meta { margin: 6px 0 0; font-size: .82rem; }
.hi-mini { margin: 0; padding-left: 18px; font-size: 0.86rem; display: flex; flex-direction: column; gap: 3px; }
.hi-mini small { color: var(--muted); }
.hi-tabla { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.hi-tabla th { text-align: left; font-weight: 600; color: var(--muted); font-size: .74rem; border-bottom: 1px solid var(--border); padding: 4px 6px 4px 0; }
.hi-tabla td { padding: 5px 6px 5px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.hi-tag { font-size: .66rem; font-weight: 700; background: var(--bg); color: var(--muted); padding: 1px 5px; border-radius: 4px; }
.hi-rojo { color: #B91C1C; font-weight: 700; }
[data-theme="dark"] .hi-rojo, [data-theme="dark"] .hi-tile.hi-venc b, [data-theme="dark"] .hi-ck-est.mal { color: #F87171; }

/* —— 📊 Tablero de gerencia —— */
.btn-tablero {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin-top: 14px; padding: 12px 16px;
  border: 1px solid var(--red-brand); border-radius: 12px; background: var(--red-soft); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.btn-tablero[hidden] { display: none; }
.btn-tablero span { font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.app.app--ancho { max-width: 1440px; }
.tablero-view { display: flex; flex-direction: column; gap: 10px; }
.tb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tb-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.tb-acciones .tb-acc { min-height: 36px; padding: 4px 10px; font-size: .82rem; }
.tb-info { margin: 0; font-size: .8rem; }
.tb-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tb-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--border-strong); border-radius: 10px; color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.tb-kpi:not([data-kpi]) { cursor: default; }
.tb-kpi b { font-size: 1.45rem; line-height: 1.1; }
.tb-kpi span { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.tb-kpi.ok { border-top-color: #1E8E3E; } .tb-kpi.med { border-top-color: #B45309; } .tb-kpi.mal { border-top-color: #B91C1C; } .tb-kpi.mal b { color: #B91C1C; }
[data-theme="dark"] .tb-kpi.mal b { color: #F87171; }
.tb-alertas { background: var(--red-soft); border: 1px solid var(--red-brand); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.tb-alertas ul { margin: 4px 0 0; padding-left: 0; list-style: none; }
.tb-alertas .btn-text { text-align: left; padding: 3px 0; color: var(--text); }
.tb-alertas.tb-alertas--ok { background: var(--ok-soft); border-color: transparent; }
.tb-alertas .meta { margin: 0; color: var(--text); opacity: .8; }
.tb-grid { display: flex; flex-direction: column; gap: 12px; }
.tb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tb-card-h { display: flex; flex-direction: column; gap: 4px; }
.tb-card h3 { margin: 0; font-size: .95rem; }
.tb-n { color: var(--muted); font-weight: 500; font-size: .85rem; }
.tb-regla summary { cursor: pointer; font-size: .82rem; color: var(--red-dim); }
.tb-regla div { font-size: .82rem; line-height: 1.4; background: var(--bg); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.tb-regla ul { margin: 4px 0; padding-left: 18px; }
.tb-regla p { margin: 4px 0; }
.tb-filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tb-filtros input, .tb-filtros .tb-sem { grid-column: 1 / -1; }
.tb-lista { display: grid; grid-template-columns: 1fr; gap: 6px; }
.tb-eq { display: flex; gap: 10px; align-items: stretch; text-align: left; font: inherit; color: var(--text); background: var(--surface-elevated); border: 1px solid var(--border); border-left: 5px solid #1E8E3E; border-radius: 10px; padding: 8px 10px; cursor: pointer; min-width: 0; }
.tb-eq:hover { border-color: var(--red-brand); }
.tb-eq.tb-amarillo { border-left-color: #D97706; } .tb-eq.tb-rojo { border-left-color: #B91C1C; }
.tb-eq-score { flex: 0 0 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; background: rgba(30,142,62,.12); color: #1E8E3E; }
.tb-amarillo .tb-eq-score { background: rgba(217,119,6,.14); color: #B45309; } .tb-rojo .tb-eq-score { background: rgba(185,28,28,.14); color: #B91C1C; }
[data-theme="dark"] .tb-eq-score { color: #4ADE80; } [data-theme="dark"] .tb-amarillo .tb-eq-score { color: #FBBF24; } [data-theme="dark"] .tb-rojo .tb-eq-score { color: #F87171; }
.tb-eq-score b { font-size: 1.2rem; line-height: 1; } .tb-eq-score small { font-size: .56rem; text-transform: uppercase; font-weight: 700; }
.tb-eq-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tb-eq-nom { font-weight: 700; line-height: 1.25; }
.tb-eq-sub, .tb-eq-resp { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-eq-tags { display: flex; gap: 6px; flex-wrap: wrap; font-size: .78rem; align-items: center; }
.tb-est { font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .02em; }
.tb-est-operativo { background: var(--ok-soft); color: var(--ok); } .tb-est-pendientes { background: rgba(217,119,6,.15); color: #B45309; } .tb-est-parado { background: var(--red-soft); color: var(--red-dim); }
[data-theme="dark"] .tb-est-pendientes { color: #FBBF24; }
.tb-eq-dl { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .76rem; color: var(--muted); }
.tb-eq-dl b { color: var(--text); font-weight: 600; }
.tb-mas { align-self: center; }
.tb-pend-lista { display: flex; flex-direction: column; gap: 6px; }
.tb-p { display: flex; gap: 10px; text-align: left; font: inherit; color: var(--text); background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; min-width: 0; }
.tb-p:hover { border-color: var(--red-brand); }
.tb-p-venc { border-left: 4px solid #B91C1C; }
.tb-p-vence { flex: 0 0 74px; display: flex; flex-direction: column; font-size: .82rem; }
.tb-p-vence small { color: var(--muted); font-size: .7rem; }
.tb-p-venc .tb-p-vence b, .tb-p-venc .tb-p-vence small { color: #B91C1C; }
[data-theme="dark"] .tb-p-venc .tb-p-vence b, [data-theme="dark"] .tb-p-venc .tb-p-vence small { color: #F87171; }
.tb-p-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tb-p-nom { font-weight: 600; font-size: .88rem; line-height: 1.3; }
.tb-p-sub { font-size: .76rem; color: var(--muted); }
.tb-prio { font-size: .66rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-right: 4px; background: rgba(217,119,6,.15); color: #B45309; text-transform: uppercase; }
.tb-prio.prio-a { background: var(--red-soft); color: var(--red-dim); }
.tb-cols { display: flex; align-items: flex-end; gap: 4px; height: 170px; }
.tb-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.tb-col-n { font-size: .66rem; color: var(--muted); height: 14px; }
.tb-col-bar { flex: 1; width: 100%; max-width: 34px; display: flex; flex-direction: column-reverse; background: var(--bg); border-radius: 4px 4px 0 0; overflow: hidden; }
.tb-col-bar i { display: block; width: 100%; }
.tb-col-bar i.c, .tb-ley i.c { background: var(--red-brand); } .tb-col-bar i.p, .tb-ley i.p { background: #1E8E3E; }
.tb-col-m { font-size: .66rem; color: var(--muted); margin-top: 3px; }
.tb-ley { display: flex; gap: 12px; flex-wrap: wrap; font-size: .76rem; margin-top: 6px; align-items: center; }
.tb-ley i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.tb-ley .meta { margin: 0; }
.tb-hbars { display: flex; flex-direction: column; gap: 6px; }
.tb-hb { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; font: inherit; font-size: .8rem; color: var(--text); background: none; border: 0; padding: 0; text-align: left; }
button.tb-hb { cursor: pointer; } button.tb-hb:hover .tb-hb-l { color: var(--red-dim); }
.tb-hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-hb-b { height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.tb-hb-b i { display: block; height: 100%; background: var(--red-brand); border-radius: 6px; }
.tb-hb b { min-width: 24px; text-align: right; }

@media (min-width: 700px) {
  .tb-kpis { grid-template-columns: repeat(5, 1fr); }
  .tb-filtros { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .tb-filtros .tb-sem, .tb-filtros input { grid-column: 1 / -1; }
  .tb-lista { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
@media (min-width: 1000px) {
  .tb-kpis { grid-template-columns: repeat(9, 1fr); }
  .tb-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
  .tb-equipos { grid-column: 1; grid-row: 1 / span 4; }
  .tb-pend, .tb-graf { grid-column: 2; }
  .tb-pend-lista { max-height: 620px; overflow-y: auto; }
}
@media (min-width: 1400px) {
  .tb-grid { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr); }
  .tb-equipos { grid-row: 1 / span 3; }
  .tb-pend { grid-column: 2; grid-row: 1 / span 3; }
  .tb-graf { grid-column: 3; }
  .tb-pend-lista { max-height: 1100px; }
}
.tb-pie { text-align: center; margin: 8px 0 0; font-size: .88rem; }
.tb-pie a { color: var(--red-dim); }

/* —— Ficha plegable (8/10, ?v=menu1): plegada muestra código, nombre y estado —— */
.eq-head[role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: 8px; }
.eq-head[role="button"]:focus-visible { outline: 2px solid var(--red-brand); outline-offset: 4px; }
.eq-flecha { flex: 0 0 auto; align-self: center; width: 32px; height: 32px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); position: relative; }
.eq-flecha::before { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translate(-50%, -70%) rotate(45deg); transition: transform .15s ease; }
.eq-card:not(.plegada) .eq-flecha::before { transform: translate(-50%, -30%) rotate(-135deg); }
.eq-card.plegada { margin-bottom: 16px; padding-bottom: 12px; } /* mismo padding-top: el encabezado no se mueve al plegar/desplegar */
.eq-card.plegada .eq-photo, .eq-card.plegada .eq-meta, .eq-card.plegada .eq-detalle { display: none; }
.eq-card.plegada .eq-info h2 { margin-bottom: 4px; }
.eq-estado { font-size: 0.85rem; font-weight: 600; margin: 0 0 6px; }
.eq-card.plegada .eq-estado { margin-bottom: 0; }
.eq-estado--operativo { color: var(--ok); }
.eq-estado--pendientes { color: #B45309; }
.eq-estado--parado { color: #B91C1C; }
html[data-theme="dark"] .eq-estado--pendientes { color: #FBBF24; }
html[data-theme="dark"] .eq-estado--parado { color: #F87171; }
/* lista de acciones: historial primero, fotos con sello al final */
.eq-fotos--lista { margin-top: -4px; padding: 4px 2px 0; border-top: none; }
.plan-sugs { margin-top: 8px; }
.plan-sugs .chip { font-size: 0.82rem; }
#plan-form .section-h { margin-top: 0; }

/* —— 📷 Escanear QR del equipo (buscador) —— */
.btn-scan-qr { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 84px; margin: 0 0 18px; padding: 16px 18px;
  border: none; border-radius: 16px; background: var(--red-brand); color: #fff; font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 2px 8px rgba(210, 34, 42, 0.28); -webkit-tap-highlight-color: transparent; }
.btn-scan-qr:active { filter: brightness(0.92); }
.btn-scan-qr:focus-visible { outline: 3px solid rgba(210, 34, 42, 0.35); outline-offset: 2px; }
.scan-ico { flex: 0 0 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.6rem; background: rgba(255, 255, 255, 0.18); }
.scan-txt { display: flex; flex-direction: column; gap: 3px; }
.scan-txt b { font-size: 1.12rem; }
.scan-txt span { font-size: 0.86rem; opacity: 0.9; }
.qr-scan { position: fixed; inset: 0; z-index: 2000; background: #000; color: #fff; }
.qr-scan[hidden] { display: none; }
.qr-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.qr-marco { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.qr-marco span { width: min(70vw, 300px); aspect-ratio: 1; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45); }
.qr-top, .qr-bottom { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; }
.qr-top { top: 0; padding-top: max(14px, env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.6), transparent); }
.qr-bottom { bottom: 0; flex-direction: column; padding-bottom: max(18px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.qr-titulo { font-weight: 700; }
.qr-msg { margin: 0; text-align: center; font-size: 0.98rem; line-height: 1.35; max-width: 420px; }
.qr-msg.qr-aviso { background: rgba(245, 158, 11, 0.95); color: #1f1300; padding: 8px 12px; border-radius: 10px; }
.qr-msg.qr-error { background: rgba(185, 28, 28, 0.95); padding: 10px 12px; border-radius: 10px; }
.qr-msg.qr-ok { background: rgba(30, 142, 62, 0.95); padding: 8px 12px; border-radius: 10px; }
.qr-btn { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.45); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.qr-btn[aria-pressed="true"] { background: #fff; color: #000; }

/* —— Registro de estado: paso «Gomas» (9/10/2026) —— */
.cq-gomas-box { margin-top: 12px; }
.cq-g-conf { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 2px 0 8px; }
.cq-g-ctl { display: flex; align-items: center; gap: 6px; font-size: .88rem; }
.cq-g-ctl span { color: var(--muted); }
.cq-g-ctl b { min-width: 1.4em; text-align: center; font-size: 1.05rem; }
.cq-g-pm { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.cq-g-ejes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.cq-g-eje { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 10px; font: inherit; font-size: .8rem; min-height: 36px; cursor: pointer; }
.cq-g-tot { margin: 0 0 8px; }
.cq-gomas .hf-ck-item { flex-wrap: wrap; }
.cq-g-btns { display: flex; align-items: center; gap: 2px; }
.cq-g-saltar, .cq-g-des { font-size: .82rem; padding: 6px 8px; min-height: 40px; }
.cq-g-om .hf-ck-check { opacity: .8; border-style: dashed; }
.cq-g-om .hf-ck-txt b { opacity: .75; }
.cq-g-motivo { flex: 1 0 100%; display: flex; flex-direction: column; gap: 6px; padding: 6px 0 2px; }
.cq-g-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cq-g-chips .chip { font-size: .8rem; }
.cq-g-txt { width: 100%; box-sizing: border-box; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.cq-g-ok { display: flex; justify-content: flex-end; gap: 8px; }
.cq-goma-res summary span b { font-size: .95rem; }
/* —— Perfil de registro —— */
.eq-perfil { margin: 10px 0; }
.cq-perfil { margin: 6px 0 8px; }
.pf-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: .9rem; }
.pf-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.pf-tipo { font-weight: 700; color: var(--red-brand, #D2222A); font-size: .85rem; }
.pf-lo { margin: 4px 0; line-height: 1.7; }
.pf-chip { display: inline-block; background: rgba(127,127,127,.12); border-radius: 999px; padding: 1px 8px; font-size: .78rem; line-height: 1.5; }
.pf-origen { margin: 4px 0 0; }
.pf-acc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.pf-btn { width: auto; padding: 8px 12px; min-height: 40px; font-size: .85rem; }
.pf-compacto .pf-lo { font-size: .85rem; }
.pf-lbl { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); margin: 6px 0; }
.pf-in { padding: 9px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg, transparent); color: var(--text); font: inherit; font-size: .9rem; }
.pf-attrs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.pf-att { display: flex; align-items: center; gap: 6px; font-size: .84rem; min-height: 34px; }
.pf-att input { width: 18px; height: 18px; flex: none; }
.pf-gom { margin: 8px 0 4px; font-weight: 700; }
.hi-cq .cq-tiles { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.cq-h .meta { font-size: .78rem; font-weight: 400; }
.cq-tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.hi-cq .cq-tiles > :last-child:nth-child(odd) { grid-column: auto; }

/* PIN: sacudida al fallar (auto-envío a las 4 cifras) */
@keyframes pinMal{0%,100%{transform:translateX(0)}20%,60%{transform:translateX(-9px)}40%,80%{transform:translateX(9px)}}
.pin-mal{animation:pinMal .35s}
@media (prefers-reduced-motion:reduce){.pin-mal{animation:none}}

/* 🏷️ Etiquetas QR (js/etiquetas.js) */
body.et-abierto { overflow: hidden; }
.et-capa { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center; padding: max(12px, env(safe-area-inset-top)) 12px 12px; overflow-y: auto; }
.et-caja { position: relative; width: 100%; max-width: 560px; margin: auto 0; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 16px; padding: 18px 16px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.et-cerrar { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.et-tit { margin: 0 40px 4px 0; font-size: 1.15rem; }
.et-sub { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.et-prev { display: flex; justify-content: center; align-items: center; min-height: 120px; background: #fff; border: 1px dashed #bbb; border-radius: 8px; padding: 6px; }
.et-img { width: 100%; height: auto; display: block; }
.et-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.et-masivo .et-acc { grid-template-columns: 1fr 1fr; }
.et-ficha .et-png { display: block; margin: 6px auto 0; }
.et-masivo .et-fil { grid-template-columns: 1fr 1fr; }
.et-masivo .et-fil .et-q { grid-column: 1 / -1; }
.et-acc button { width: 100%; margin: 0; }
.et-nota { margin: 10px 0 0; font-size: .8rem; }
.et-fil { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.et-fil select, .et-fil input { font: inherit; font-size: .95rem; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); width: 100%; min-width: 0; }
.et-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0 4px; }
.et-selbar .et-n { margin-left: auto; font-size: .82rem; }
.et-lista { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.et-item { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.et-item:last-child { border-bottom: 0; }
.et-item input { width: 20px; height: 20px; accent-color: var(--red-brand); }
.et-cod { font-weight: 700; color: var(--red-brand); font-size: .85rem; white-space: nowrap; }
.et-nom { font-size: .92rem; line-height: 1.25; }
.et-nom small { display: block; color: var(--muted); font-size: .76rem; }
.et-prog { margin: 8px 0 0; font-size: .85rem; }
.btn-etiquetas-qr { margin-top: 10px; }
@media (max-width: 420px) { .et-fil, .et-acc { grid-template-columns: 1fr; } }
.et-item { text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 400; font-size: 1rem; margin: 0; }
.et-nom small { text-transform: none; letter-spacing: 0; }

/* 🔢 Pantalla de PIN con teclado (componente compartido HormitecPin, mismo diseño que Vigilancia) */
.pin-card.hxpin-card { width: min(420px, 100%); background: transparent; border: 0; padding: 8px 2px 12px; }
.pin-card.hxpin-card h1 { font-size: 1.5rem; margin: 0 0 10px; }
.pin-card.hxpin-card .pin-hint { margin: 0; font-size: 1rem; }
.pin-gate:has(.hxpin-card) { place-items: start center; overflow-y: auto; }
.pin-card.hxpin-card .hxpin-ayuda { color: var(--text); }

/* M: acciones del equipo agrupadas (mismo estilo que Inventario) */
.inv-sec { margin-top: 16px; }
.inv-sec[hidden], html body #flow-choice .flow-btn[hidden] { display: none !important; }
.inv-sec .pg-cab { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 2px solid var(--t-rojo, #E31F26); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t-tx2, #8a8a90); }
.inv-sec .pg-ico { flex: none; display: inline-flex; }
.inv-sec .pg-tit { flex: 1; min-width: 0; }
.inv-sec .pg-n { flex: none; min-width: 26px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--t-rojo, #E31F26); color: #fff; font-size: 12px; display: inline-grid; place-items: center; letter-spacing: 0; }
html body #flow-choice .flow-intro { font-size: 22px !important; font-weight: 600 !important; line-height: 1.25; color: var(--t-tx, inherit) !important; margin: 14px 0 4px !important; padding: 0 2px; text-align: left; }
@media (min-width: 900px) { html body #flow-choice .flow-intro { font-size: 26px !important; } }

/* H: con un equipo abierto, la tarjeta del equipo es el título (sin «Mantenimiento» ni usuario) */
html body:has(#eq-card:not([hidden])) .page-title,
html body:has(#eq-card:not([hidden])) #who-banner { display: none !important; }
html body:has(#eq-card:not([hidden])) #eq-card { margin-top: 12px; }

/* B: buscador del historial + resumen sin cortes */
html body .hi-buscador { margin: 12px 0 8px; }
html body .hi-buscador input { width: 100%; min-height: 52px; border-radius: 26px; padding: 0 20px; }
html body .hi-cuenta { margin: 8px 2px 0; font-size: 13px; }
html body .hi-limpiar { margin-top: 10px; width: auto; display: inline-flex; padding: 0 18px; }
html body .hi-resumen { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html body .hi-resumen .hi-tile:first-child { grid-column: 1 / -1; }
html body .hi-tile { padding: 10px 12px; }
html body .hi-tile b { font-size: 1.05rem !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
html body .hi-tile small { display: block; -webkit-line-clamp: unset; overflow: visible; overflow-wrap: anywhere; }
@media (min-width: 900px) { html body .hi-resumen { grid-template-columns: repeat(3, minmax(0, 1fr)); } html body .hi-resumen .hi-tile:first-child { grid-column: auto; } }
@media (min-width: 900px) { html body #historial-view .hi-resumen { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } html body #historial-view .hi-resumen .hi-tile { grid-column: auto !important; } }

/* C: historial limpio — un solo «Volver», sin ficha grande, equipo como subtítulo */
html body:has(#historial-view:not([hidden])) #eq-card,
html body:has(#historial-view:not([hidden])) #card-back { display: none !important; }
html body #historial-view > .btn-back { align-self: flex-start; display: inline-block; margin: 4px 0 6px; text-align: left; }
html body #historial-view #hi-info { margin: 2px 0 14px; font-size: 14px; color: var(--t-tx2, var(--muted)); }
html body #historial-view .hi-filtros { margin-top: 0; }
html body #historial-view .hi-mas { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--t-s2, var(--border)); display: flex; flex-direction: column; gap: 12px; }
html body #historial-view .hi-mas .hi-acciones { margin: 0; }

/* D: año compacto en la misma fila que los tipos (fijo al final; los chips scrollean) */
html body #historial-view .hi-filtros { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center; gap: 8px; }
html body #historial-view .hi-filtros #hi-f-tipo { flex: 1 1 auto; min-width: 0; margin: 0 !important; }
html body #historial-view .hi-filtros #hi-f-anio { flex: none; width: auto !important; min-width: 0 !important; max-width: 110px; height: 44px !important; min-height: 0 !important; margin: 0 !important; padding: 0 30px 0 14px !important; border-radius: 999px !important; font-size: 14px !important; line-height: 1 !important; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A8A90' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 11px center !important; }
html body #historial-view .hi-filtros #hi-f-anio { order: -1; }

/* G: Análisis del equipo */
html body .hi-analisis { margin-top: 8px; }
html body .hi-analisis:empty { display: none; }
.hi-analisis .an-aviso { margin: 8px 2px 0; }
.hi-analisis .an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.hi-analisis .an-ancha { grid-column: 1 / -1; }
.hi-analisis .an-card { background: var(--t-s1, var(--surface)); border: 1px solid var(--t-s2, var(--border)); border-radius: 14px; padding: 12px; min-width: 0; }
.hi-analisis h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--t-tx, inherit); }
.hi-analisis .an-bar { width: 100%; height: auto; display: block; }
.hi-analisis .an-bar rect { fill: #E31F26; }
.hi-analisis .an-bar line { stroke: var(--t-s2, #ccc); stroke-width: 1; }
.hi-analisis .an-bar text { font-size: 9px; text-anchor: middle; fill: var(--t-tx2, #888); }
.hi-analisis .an-bar text.v { fill: var(--t-tx, #111); font-weight: 600; }
.hi-analisis .an-dona-w { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hi-analisis .an-dona { width: 96px; height: 96px; transform: rotate(0deg); }
.hi-analisis .an-dona circle { fill: none; stroke-width: 6; }
.hi-analisis .an-dona .an-fondo { stroke: var(--t-s2, #e6e6e9); }
.hi-analisis .an-dona text { font-size: 8px; font-weight: 700; text-anchor: middle; fill: var(--t-tx, #111); }
.hi-analisis .c-prev { stroke: #E31F26; background: #E31F26; } .hi-analisis .c-corr { stroke: #8A8A90; background: #8A8A90; } .hi-analisis .c-otro { stroke: #C7C7CC; background: #C7C7CC; }
.hi-analisis .c-ok { stroke: #16A34A; background: #16A34A; } .hi-analisis .c-pend { stroke: #F59E0B; background: #F59E0B; }
.hi-analisis .an-ley { list-style: none; margin: 0; padding: 0; font-size: 12.5px; width: 100%; }
.hi-analisis .an-ley li { display: flex; align-items: center; gap: 6px; padding: 2px 0; color: var(--t-tx, inherit); }
.hi-analisis .an-ley i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hi-analisis .an-ley b { margin-left: auto; } .hi-analisis .an-ley small { color: var(--t-tx2, #888); min-width: 30px; text-align: right; }
.hi-analisis .an-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.hi-analisis .an-kpi { background: var(--t-s1, var(--surface)); border: 1px solid var(--t-s2, var(--border)); border-left: 3px solid #E31F26; border-radius: 12px; padding: 10px 12px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hi-analisis .an-kpi span { font-size: 12px; color: var(--t-tx2, #888); }
.hi-analisis .an-kpi b { font-size: 18px; color: var(--t-tx, inherit); }
.hi-analisis .an-kpi small { font-size: 12px; color: var(--t-tx2, #888); overflow-wrap: anywhere; }
.hi-analisis .an-ult { margin-top: 10px; }
.hi-analisis .an-ult ul { list-style: none; margin: 0; padding: 0; }
.hi-analisis .an-ult li { padding: 7px 0; border-top: 1px solid var(--t-s2, var(--border)); font-size: 13.5px; color: var(--t-tx, inherit); overflow-wrap: anywhere; }
.hi-analisis .an-ult li:first-child { border-top: 0; }
.hi-analisis .an-ult li b { margin-right: 6px; } .hi-analisis .an-ult li small { margin-left: 4px; }
@media (min-width: 900px) { .hi-analisis .an-grid { grid-template-columns: 2fr 1fr 1fr; } .hi-analisis .an-ancha { grid-column: auto; } .hi-analisis .an-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hi-analisis .pg-cab { display: flex; align-items: center; gap: 10px; }
.hi-analisis .pg-tit { flex: 1; min-width: 0; }
.hi-analisis .pg-n { flex: none; white-space: nowrap; }

/* J: mismo criterio que historial en el resto de pantallas del equipo */
html body:has(:is(#manual-chat, #chequeo-view, #pend-list, #close-form, #done-form, #plan-form, #mant-form):not([hidden])) #eq-card,
html body:has(:is(#manual-chat, #chequeo-view, #pend-list, #close-form, #done-form, #plan-form, #mant-form):not([hidden])) #card-back { display: none !important; }
html body :is(#manual-chat, #chequeo-view, #pend-list, #close-form, #done-form, #plan-form, #mant-form) > .btn-back { align-self: flex-start; display: inline-block; margin: 4px 0 6px; text-align: left; }
html body .eq-subt { margin: 2px 0 14px; font-size: 14px; color: var(--t-tx2, var(--muted)); overflow-wrap: anywhere; }

/* K: ordenar y agrupar pendientes */
html body .pend-orden { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
html body .pend-orden[hidden] { display: none; }
html body .pend-orden-lbl { font-size: 13px; color: var(--t-tx2, var(--muted)); margin-right: 2px; }
html body #pend-items .pend-cab { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
html body #pend-items .pend-cab:first-child { margin-top: 4px; }
html body #pend-items .pend-cab .pg-tit { flex: 1; min-width: 0; }
html body #pend-items .pend-cab .pg-n { flex: none; }

/* L: etiquetas de tipo con color (azul preventivo, naranja correctivo) */
html body .badge.preventive { color: #1D4ED8 !important; border-color: #93B4F5 !important; background: #EAF1FF !important; }
html body .badge.corrective { color: #B45309 !important; border-color: #F5C08A !important; background: #FFF3E6 !important; }
html[data-theme="dark"] body .badge.preventive { color: #93C5FD !important; border-color: #2F5AA8 !important; background: rgba(59,130,246,.16) !important; }
html[data-theme="dark"] body .badge.corrective { color: #FDBA74 !important; border-color: #9A5A1C !important; background: rgba(249,115,22,.16) !important; }

/* N: preventivo recurrente + responsable */
html body .plan-switch { display: flex !important; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; text-transform: none !important; letter-spacing: 0 !important; font-size: 15px !important; color: var(--t-tx, inherit) !important; }
html body .plan-switch input { width: 22px; height: 22px; accent-color: #E31F26; margin: 0; }
html body .plan-rec-box { margin-top: 10px; padding: 12px; border: 1px solid var(--t-s2, var(--border)); border-radius: 14px; display: flex; flex-direction: column; gap: 10px; }
html body .plan-rec-box[hidden] { display: none; }
html body .plan-rec-box .field-row, html body #plan-form .field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html body #plan-form .field-row > .field { min-width: 0; margin: 0; }
html body #plan-form select, html body #plan-form .plan-rec-box input { width: 100%; min-width: 0; }
html body .pend-rec, html body .hi-rec { margin-top: 2px; }
@media (max-width: 599px) { html body #plan-form > .field-row:has(#plan-resp) { grid-template-columns: 1fr; } }

/* 🏷️ impresión masiva desde la página principal */
.eq-print { margin: 12px 0 4px; padding: 14px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); }
.eq-print-t { margin: 0 0 10px; font-weight: 700; color: var(--text); }
.eq-print-t b { color: var(--muted); font-weight: 400; font-size: .9rem; }
.eq-print-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.eq-print-acc button { width: 100%; margin: 0; }
#eq-print-sel { display: block; margin: 8px auto 0; }
.eq-print-prog { margin: 6px 0 0; font-size: .85rem; text-align: center; }
@media (max-width: 420px) { .eq-print-acc { grid-template-columns: 1fr; } }
.et-masivo .et-fil { display: grid !important; background: none !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; }
.et-masivo .et-nom, .et-masivo .et-nom * { text-transform: none !important; letter-spacing: 0 !important; }
@media (max-width: 420px) { .et-masivo .et-fil, .et-masivo .et-acc { grid-template-columns: 1fr !important; } }
