@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; }
.flow-intro { margin: 0 0 4px; color: var(--muted); font-size: 0.95rem; }
.flow-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  width: 100%; text-align: left; padding: 16px 18px;
  border: 2px solid var(--border); border-radius: 14px;
  background: var(--card); color: var(--fg); cursor: pointer;
  min-height: 72px; font: inherit;
}
.flow-btn:active, .flow-btn:hover { border-color: #D2222A; background: var(--bg); }
.flow-title { font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.flow-desc { font-size: 0.9rem; color: var(--muted); line-height: 1.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 —— */
.btn-manual {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 14px;
  min-height: var(--tap); padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--bg); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.btn-manual:hover, .btn-manual:active { border-color: #D2222A; }
.manual-badge { margin-left: auto; font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.flow-btn--manual { border-style: dashed; }
.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; gap: 8px; align-items: flex-end; background: var(--bg); padding: 6px 0; }
.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; }
