/* ============================================================
   VALGO · Design System
   Paleta extraída del logo oficial (ver db/PALETA.md)
   Light = default · Dark disponible en toda vista
   ============================================================ */

/* ---------- TOKENS ---------- */
:root,
[data-theme="light"] {
  --gold:          #E8B32B;
  --gold-hover:    #C4931B;
  --gold-soft:     #FBF1D8;
  --gold-text:     #7A5B0A;
  --on-gold:       #14161C;

  --steel:         #6B7078;
  --steel-soft:    #EEF0F3;

  --bg-primary:    #FFFFFF;
  --bg-secondary:  #F5F6F8;
  --bg-tertiary:   #EAECF0;
  --surface:       #FFFFFF;
  --surface-alt:   #FAFBFC;

  --text-primary:  #14161C;
  --text-secondary:#4C525C;
  --text-muted:    #868C96;
  --text-invert:   #FFFFFF;

  --border:        #DCDFE5;
  --border-strong: #C2C7D0;

  --danger:        #C0392B;
  --success:       #1A7A4A;
  --warning:       #B8650A;
  --info:          #1B4FD4;

  --shadow-sm:     0 1px 2px rgba(20,22,28,.06);
  --shadow-md:     0 4px 16px rgba(20,22,28,.10);
  --shadow-lg:     0 12px 40px rgba(20,22,28,.16);

  --header-bg:     #14161C;
  --header-fg:     #F2F3F5;
  --grid-line:     rgba(20,22,28,.045);

  --radius:        12px;
  --cut:           14px;
}

[data-theme="dark"] {
  --gold:          #F0BE3C;
  --gold-hover:    #FFD264;
  --gold-soft:     #2A2312;
  --gold-text:     #F0BE3C;
  --on-gold:       #14161C;

  --steel:         #9AA0AA;
  --steel-soft:    #1D2027;

  --bg-primary:    #0E0F13;
  --bg-secondary:  #14161C;
  --bg-tertiary:   #1B1E26;
  --surface:       #14161C;
  --surface-alt:   #191C23;

  --text-primary:  #F0F1F4;
  --text-secondary:#A8AEB8;
  --text-muted:    #6E747E;
  --text-invert:   #14161C;

  --border:        #262A33;
  --border-strong: #363B46;

  --danger:        #E86B5C;
  --success:       #3DBE7A;
  --warning:       #E8900A;
  --info:          #5B84F0;

  --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,.45);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.6);

  --header-bg:     #0A0B0E;
  --header-fg:     #F0F1F4;
  --grid-line:     rgba(255,255,255,.035);
}

/* ---------- RESET ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text; -moz-user-select: text; user-select: text;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.6;
  background: var(--bg-secondary);
  color: var(--text-primary);
  overscroll-behavior-y: none;
  transition: background .2s ease, color .2s ease;
}
h1,h2,h3,h4 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; } h4 { font-size: 15px; }
p  { margin: 0 0 1rem; }
a  { color: var(--gold-text); text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; }
svg { flex-shrink: 0; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* ---------- TIPOGRAFÍA UTIL ---------- */
.label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); font-weight: 600; margin: 0 0 .35rem;
}
.label-gold { color: var(--gold-text); }
.mono { font-family: "SF Mono", ui-monospace, "Roboto Mono", monospace; letter-spacing: .02em; }
.txt-sec { color: var(--text-secondary); }
.txt-muted { color: var(--text-muted); }
.txt-sm { font-size: 13px; }
.txt-xs { font-size: 12px; }

/* ---------- LAYOUT ---------- */
.vista { animation: fadeUp .28s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.container { max-width: 1180px; margin: 0 auto; padding: 2rem 1.5rem; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem; }
@media (max-width: 768px) {
  .container, .container-sm { padding: 1.25rem 1rem; }
}

.main-content { padding-bottom: 2rem; min-height: calc(100vh - 60px); }
@media (max-width: 768px) { .main-content { padding-bottom: 84px; } }

.stack   { display: flex; flex-direction: column; gap: 1rem; }
.row     { display: flex; align-items: center; gap: .75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; min-width: 0; }
.grid    { display: grid; gap: 1rem; }
.grid-2  { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3  { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4  { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 768px) { .grid-3, .grid-4 { gap: .6rem; } }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.75rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.75rem}
.hide { display: none !important; }
@media (max-width: 768px) { .desktop-only { display: none !important; } }
@media (min-width: 769px) { .mobile-only  { display: none !important; } }

/* ---------- HEADER ---------- */
.app-header {
  position: sticky; top: 0; z-index: 900;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 2px 0 var(--gold), var(--shadow-sm);
}
.app-header-inner {
  max-width: 1180px; margin: 0 auto; height: 60px;
  display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
}
@media (max-width: 768px) { .app-header-inner { padding: 0 1rem; height: 56px; } }
.brand { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.brand img { height: 34px; width: auto; display: block; }
.brand-txt { display: flex; flex-direction: column; line-height: 1; }
.brand-name { color: var(--header-fg); font-weight: 700; font-size: 15px; letter-spacing: .12em; }
.brand-sub  { color: var(--steel); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; margin-top: 3px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.header-nav { display: flex; gap: .15rem; margin-left: 1.25rem; }
.header-nav a {
  color: #A8AEB8; font-size: 13.5px; font-weight: 500;
  padding: .45rem .8rem; border-radius: 8px; position: relative;
}
.header-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.header-nav a.active { color: var(--gold); background: rgba(232,179,43,.11); }

.icon-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: #A8AEB8; position: relative; overflow: hidden;
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .badge-dot {
  position: absolute; top: 7px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--gold); color: var(--on-gold); border-radius: 8px;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
#theme-toggle .icon-light { display: flex; }
#theme-toggle .icon-dark  { display: none; }
[data-theme="dark"] #theme-toggle .icon-light { display: none; }
[data-theme="dark"] #theme-toggle .icon-dark  { display: flex; }

.header-cuenta {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: #A8AEB8; position: relative; overflow: hidden;
}
.header-cuenta .hc-icon svg { width: 19px; height: 19px; }
.header-cuenta .hc-desktop { display: flex; align-items: center; gap: .55rem; }
.header-cuenta .hc-av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--on-gold);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px;
  overflow: hidden; flex-shrink: 0;
}
.header-cuenta .hc-av img { width: 100%; height: 100%; object-fit: cover; }
.header-cuenta .hc-tx { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.header-cuenta .hc-nm {
  color: #fff; font-size: 12.5px; font-weight: 600; max-width: 130px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header-cuenta .hc-rl { color: #8A8F98; font-size: 10.5px; }
@media (min-width: 769px) {
  .header-cuenta { width: auto; height: auto; padding: .3rem .8rem .3rem .3rem; border-radius: 24px; }
  .header-cuenta:hover { background: rgba(255,255,255,.08); }
}

/* ---------- BOTONES ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .7rem 1.25rem;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; letter-spacing: .01em;
  transition: background .15s ease, border-color .15s ease, transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: .4rem .8rem; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 52px; padding: .9rem 1.6rem; font-size: 16px; }

.btn-gold   { background: var(--gold); color: var(--on-gold); }
.btn-gold:hover { background: var(--gold-hover); }
.btn-dark   { background: var(--header-bg); color: #F2F3F5; }
.btn-dark:hover { background: #23262F; }
.btn-ghost  { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-tertiary); }
.btn-soft   { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-soft:hover { background: var(--border); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-link   { background: none; border: none; color: var(--gold-text); min-height: 0; padding: .3rem; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

/* ---------- RIPPLE ---------- */
.ripple { position: relative; overflow: hidden; }
.ripple-wave {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(255,255,255,.4); animation: ripple-anim .6s linear; pointer-events: none;
}
.ripple-wave.dark { background: rgba(20,22,28,.18); }
@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

/* ---------- SUPERFICIES ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm);
}
/* Card con esquina cortada — identidad técnica, no rectángulo genérico */
.card-cut {
  background: var(--surface); border: 1px solid var(--border);
  padding: 1.25rem; position: relative;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.card-cut::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: var(--cut); height: var(--cut);
  background: linear-gradient(225deg, var(--gold) 50%, transparent 50%);
}
.card-hover { transition: border-color .15s, transform .15s, box-shadow .15s; cursor: pointer; }
.card-hover:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.panel-head {
  padding: .85rem 1.15rem; border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.panel-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: .5rem; }
.panel-head svg { width: 16px; height: 16px; color: var(--gold-text); }
.panel-body { padding: 1.15rem; }

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--gold); border-radius: 10px; padding: .9rem 1rem;
}
.stat-val { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); font-weight: 600; margin-top: .2rem; }

/* ---------- KPI (panel admin) ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; box-shadow: var(--shadow-sm);
}
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .85rem; }
.kpi-ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.kpi-ic svg { width: 19px; height: 19px; }
.kpi-trend { font-size: 11px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.kpi-val { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -.02em; margin-bottom: .3rem; }
.kpi-lbl { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.kpi-success .kpi-ic { background: rgba(26,122,74,.1); color: var(--success); }
.kpi-gold    .kpi-ic { background: var(--gold-soft); color: var(--gold-text); }
.kpi-info    .kpi-ic { background: rgba(27,79,212,.09); color: var(--info); }
.kpi-warning .kpi-ic { background: rgba(184,101,10,.1); color: var(--warning); }
@media (max-width: 768px) {
  /* En el teléfono estas tarjetas entran de a dos y ocupaban media pantalla
     antes de que se viera un solo pedido. Misma información, menos aire. */
  .kpi { padding: .8rem .85rem; }
  .kpi-top { margin-bottom: .5rem; }
  .kpi-ic { width: 32px; height: 32px; border-radius: 9px; }
  .kpi-ic svg { width: 16px; height: 16px; }
  .kpi-val { font-size: 22px; }
  .kpi-lbl { font-size: 11.5px; line-height: 1.35; }
}

/* ---------- Barras de ranking (rubros más pedidos) ---------- */
.bar-row { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.bar-row:last-child { border-bottom: 0; }
.bar-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.bar-top .avatar { width: 30px; height: 30px; border-radius: 8px; }
.bar-top .avatar svg { width: 14px; height: 14px; }
.bar-name { font-weight: 500; font-size: 13px; flex: 1; min-width: 0; }
.bar-num { font-weight: 700; font-size: 14px; }
.bar-track { height: 6px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--gold); }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .65rem; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border);
}
.chip svg { width: 13px; height: 13px; }
.chip-gold    { background: var(--gold-soft); color: var(--gold-text); border-color: var(--gold); }
.chip-success { background: transparent; color: var(--success); border-color: var(--success); }
.chip-danger  { background: transparent; color: var(--danger);  border-color: var(--danger); }
.chip-muted   { background: transparent; color: var(--text-muted); }

.divider { height: 1px; background: var(--border); border: 0; margin: 1.25rem 0; }

/* ---------- FORMULARIOS ---------- */
.field { margin-bottom: 1rem; }
.field > label {
  display: block; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: .35rem;
}
.field .req { color: var(--gold-text); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: .65rem .85rem;
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 15px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,179,43,.18);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input.error, .textarea.error { border-color: var(--danger); }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: .3rem; }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: .3rem; display: none; }
.field-error.show { display: block; }

.password-field { position: relative; }
.password-field .input { padding-right: 46px; }
.toggle-password {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-muted); border-radius: 8px;
}
.toggle-password:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.toggle-password svg { width: 18px; height: 18px; }

.switch { display: inline-flex; align-items: center; gap: .65rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 50px; height: 28px; border-radius: 20px; background: var(--border-strong);
  position: relative; transition: background .2s ease; flex-shrink: 0;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: transform .2s ease; box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }

/* ---------- TABS ----------
 * Una tira que se desliza, no una grilla que se rompe.
 *
 * Antes era un flex simple. En un teléfono de 360px los cuatro filtros no
 * entraban, así que el navegador partía las etiquetas al medio —"Sin /
 * asignar", "Sin / revisar"— y al último lo dejaba cortado a la mitad de la
 * palabra. Una pestaña en dos líneas y otra cortada contra el borde no se
 * leen como un filtro: se leen como que la app está rota.
 *
 * Ahora ninguna etiqueta se parte nunca y la fila se mueve con el dedo, que
 * es lo que uno espera de una tira de filtros en un teléfono.
 */
.tabs {
  display: flex; gap: .25rem;
  border-bottom: 1px solid var(--border); margin-bottom: 1.25rem;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;              /* Firefox */
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none; padding: .7rem 1rem; font-size: 14px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: .4rem;
  white-space: nowrap;   /* la etiqueta no se parte jamás */
  flex: 0 0 auto;        /* ni se comprime hasta romperse */
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--gold); }
/* El contador viaja al lado del texto, nunca debajo */
.tab .chip { padding: .05rem .4rem; font-size: 11px; font-weight: 700; }
.tab.active .chip { background: var(--gold-soft); color: var(--gold-text); border-color: var(--gold); }

@media (max-width: 768px) {
  /* Un poco más compactas: entran tres de cuatro sin desplazar, y la cuarta
     asomando es justamente lo que avisa que la tira se corre. */
  .tabs { gap: 0; margin-bottom: 1rem; }
  .tab  { padding: .65rem .7rem; font-size: 13.5px; }
}

/* ---------- ESTADOS ---------- */
.empty-state, .error-state {
  text-align: center; padding: 2.5rem 1.25rem;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-alt);
}
.empty-state .empty-icon, .error-state .empty-icon {
  width: 52px; height: 52px; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--gold-soft); color: var(--gold-text);
}
.empty-state .empty-icon svg, .error-state .empty-icon svg { width: 24px; height: 24px; }
.error-state .empty-icon { background: rgba(192,57,43,.1); color: var(--danger); }
.empty-state h3, .error-state h3 { font-size: 16px; margin-bottom: .35rem; }
.empty-state p, .error-state p { color: var(--text-muted); font-size: 13.5px; max-width: 380px; margin: 0 auto 1.25rem; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner {
  width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- TOASTS ---------- */
#toast-wrap {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px;
  z-index: 10000; display: flex; flex-direction: column; gap: .5rem; align-items: center;
  pointer-events: none; width: calc(100% - 2rem); max-width: 420px;
}
@media (max-width: 768px) { #toast-wrap { bottom: 84px; } }
.toast {
  padding: .7rem 1.1rem; border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn .25s ease both;
  display: flex; align-items: center; gap: .55rem; max-width: 100%;
}
.toast svg { width: 17px; height: 17px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-success { background: var(--success); color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast-info    { background: var(--header-bg); color: #fff; border-left: 3px solid var(--gold); }

/* ---------- MODAL ---------- */
.modal-wrapper {
  position: fixed; inset: 0; z-index: 1000; padding: 1rem;
  background: rgba(10,11,14,.62); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body   { flex: 1; overflow-y: auto; padding: 1.25rem; -webkit-overflow-scrolling: touch; }
.modal-footer {
  padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg-primary);
  display: flex; gap: .65rem; justify-content: flex-end; flex-shrink: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
@media (max-width: 768px) {
  .modal-wrapper { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .modal-footer { border-radius: 0; padding-bottom: calc(.9rem + env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1; }
}

/* ---------- FOOTER NAV MOBILE ---------- */
.app-footer-nav { display: none; }
@media (max-width: 768px) {
  .app-footer-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 64px; z-index: 999;
    background: var(--surface); border-top: 1px solid var(--border);
    display: flex; padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(0,0,0,.07);
  }
  .app-footer-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 10px; font-weight: 600; color: var(--text-muted);
    position: relative; overflow: hidden; min-height: 44px; letter-spacing: .01em;
  }
  .app-footer-nav a svg { width: 21px; height: 21px; }
  .app-footer-nav a.active { color: var(--gold-text); }
  .app-footer-nav a.active::before {
    content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 2px; background: var(--gold);
  }
}
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.menu-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem;
  padding: 1rem .5rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-alt); color: var(--text-primary);
  font-size: 12px; font-weight: 600; text-align: center; min-height: 88px;
  position: relative; overflow: hidden;
}
.menu-item svg { width: 22px; height: 22px; color: var(--gold-text); }
.menu-item:hover { border-color: var(--gold); }

/* ---------- SPLASH ---------- */
#splash {
  position: fixed; inset: 0; z-index: 9999; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  background: #0A0B0E; transition: opacity .5s ease;
}
#splash .splash-glow {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232,179,43,.16) 0%, transparent 68%);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.12); opacity: 1; } }
#splash .splash-inner { position: relative; text-align: center; padding: 0 1.5rem; }
#splash img { width: 240px; max-width: 62vw; height: auto; animation: splashLogo .9s ease both; }
@keyframes splashLogo { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
#splash .splash-tag {
  color: #8A8F98; font-size: 11px; letter-spacing: .32em; text-transform: uppercase;
  margin: 1.25rem 0 1.75rem;
}
#splash .splash-bar-bg {
  width: 220px; max-width: 60vw; height: 3px; background: rgba(255,255,255,.12);
  border-radius: 3px; overflow: hidden; margin: 0 auto;
}
#splash-bar { height: 100%; width: 0; background: var(--gold); transition: width .1s linear; }

/* ---------- FLOTANTES ----------
 * Los botones que quedan colgados sobre el contenido viven todos en la MISMA
 * columna: abajo a la derecha, uno arriba del otro.
 *
 * Antes WhatsApp estaba solo del lado izquierdo, a media pantalla, tapando la
 * tarjeta de acceso profesional; y el asistente, del derecho. Dos cosas que
 * flotan en dos esquinas distintas se sienten como dos parches, no como una
 * app. Y cada vez que había que mover uno, el "bottom" del otro se calculaba
 * a mano y tarde o temprano se pisaban.
 *
 * Ahora la altura sale de estas tres medidas y apilar uno nuevo es sumar un
 * escalón, no recalcular todo:
 *   --fab-base : desde dónde arranca la pila (en el teléfono, arriba del
 *                footer nativo, respetando la franja del gesto del iPhone)
 *   --fab-size : cuánto mide cada botón
 *   --fab-gap  : el aire entre uno y otro
 */
:root {
  --fab-size: 54px;
  --fab-gap:  12px;
  --fab-base: 24px;
}
@media (max-width: 768px) {
  /* El footer nativo mide 64px y crece con la franja inferior del teléfono. */
  :root { --fab-base: calc(80px + env(safe-area-inset-bottom, 0px)); }
}
/* Un escalón más arriba del anterior */
:root { --fab-piso-2: calc(var(--fab-base) + var(--fab-size) + var(--fab-gap)); }

#whatsapp-float {
  position: fixed; right: 16px; bottom: var(--fab-base); z-index: 990;
  width: var(--fab-size); height: var(--fab-size); border-radius: 50%; background: #25D366;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.28); overflow: hidden;
  transition: opacity .18s ease, transform .18s ease;
}
#whatsapp-float svg { width: 27px; height: 27px; fill: #fff; }

/* Con el asistente encendido, WhatsApp sube un escalón y no lo pisa nunca. */
body.con-asistente #whatsapp-float { bottom: var(--fab-piso-2); }

/* Mientras el chat del asistente está abierto, WhatsApp se aparta: si no,
 * queda escondido detrás del panel y el usuario ve medio botón asomando. */
body.ai-abierto #whatsapp-float { opacity: 0; transform: scale(.85); pointer-events: none; }

/* ---------- HOME / ACCESOS ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--header-bg) center / cover no-repeat;
  color: #fff;
  padding: 4.5rem 1.5rem 5.5rem;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(10,11,14,.94) 0%, rgba(10,11,14,.82) 42%, rgba(10,11,14,.55) 100%);
}
.hero::after {
  content: ''; position: absolute; right: -140px; top: -120px; width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(232,179,43,.16) 0%, transparent 65%);
}
.hero.hero-img { background-image: url('/assets/img/hero-home.jpg'); }
@media (min-width: 769px) {
  .hero.hero-img { background-image: url('/assets/img/hero-home-desktop.jpg'); }
}
.hero-inner { position: relative; max-width: 1180px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold);
  border: 1px solid rgba(232,179,43,.35); background: rgba(232,179,43,.08);
  padding: .35rem .8rem; border-radius: 20px; margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.05; letter-spacing: -.03em;
  color: #fff; max-width: 15ch; margin-bottom: 1.1rem;
}
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p { color: #A8AEB8; font-size: clamp(.95rem, 2.2vw, 1.08rem); max-width: 52ch; margin-bottom: 0; }
@media (max-width: 768px) { .hero { padding: 3rem 1rem 4rem; } }

/* Panel de accesos — composición asimétrica */
.accesos { max-width: 1180px; margin: -3rem auto 0; padding: 0 1.5rem 3rem; position: relative; z-index: 2; }
@media (max-width: 768px) { .accesos { padding: 0 1rem 2rem; margin-top: -2.5rem; } }
.accesos-grid { display: grid; grid-template-columns: 1.06fr .94fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .accesos-grid { grid-template-columns: 1fr; } }
.acceso-card {
  position: relative; overflow: hidden; padding: 1.75rem; min-height: 236px;
  display: flex; flex-direction: column; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-md);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  transition: transform .18s ease, box-shadow .18s ease;
}
.acceso-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.acceso-pro  {
  background: linear-gradient(150deg, rgba(232,179,43,.93) 0%, rgba(216,165,33,.96) 100%), url('/assets/img/acceso-pro.jpg') center/cover no-repeat;
  border-color: var(--gold-hover); color: var(--on-gold);
}
.acceso-pro .acceso-desc { color: rgba(20,22,28,.78); }
.acceso-home {
  background: linear-gradient(160deg, rgba(20,22,28,.9) 0%, rgba(10,11,14,.96) 100%), url('/assets/img/acceso-home.jpg') center/cover no-repeat;
  border-color: #262A33; color: #fff; margin-top: 1.75rem;
}
@media (max-width: 860px) { .acceso-home { margin-top: 0; } }
.acceso-home .acceso-desc { color: #A8AEB8; }
.acceso-tag { font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; font-weight: 700; opacity: .72; }
.acceso-card h2 { font-size: 1.9rem; letter-spacing: -.02em; margin: .3rem 0 .6rem; }
.acceso-desc { font-size: 14px; line-height: 1.6; margin-bottom: 1.35rem; }
.acceso-card .btn { margin-top: auto; align-self: flex-start; }
.acceso-icon {
  position: absolute; right: -18px; bottom: -18px; opacity: .13;
}
.acceso-icon svg { width: 132px; height: 132px; }
.acceso-list { list-style: none; padding: 0; margin: 0 0 1.35rem; font-size: 13.5px; }
.acceso-list li { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.acceso-list svg { width: 15px; height: 15px; }

/* Bloque de acceso (login/registro) */
.acceso-shell { min-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.acceso-hero {
  padding: 2.25rem 1.5rem 2rem; position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.acceso-hero.tema-pro  { background: linear-gradient(150deg, var(--gold) 0%, #D8A521 100%); color: var(--on-gold); }
.acceso-hero.tema-home { background: var(--header-bg); color: #fff; }
.acceso-hero-inner { max-width: 720px; margin: 0 auto; position: relative; }
.acceso-hero h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin-bottom: .4rem; color: inherit; }
.acceso-hero p  { margin: 0; font-size: 14px; opacity: .82; }
.acceso-hero .back {
  display: inline-flex; align-items: center; gap: .35rem; font-size: 12.5px; font-weight: 600;
  color: inherit; opacity: .75; margin-bottom: 1rem; background: none; border: none; padding: 0;
}
.acceso-hero .back:hover { opacity: 1; }
.acceso-hero .acceso-tag { display: block; }
.acceso-hero .back svg { width: 15px; height: 15px; }
@media (max-width: 768px) { .acceso-hero { padding: 1.5rem 1rem 1.5rem; } }

/* ---------- LISTAS ---------- */
.list-item {
  display: flex; align-items: center; gap: .9rem; padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
/* La columna de texto se achica; la etiqueta de estado y la flecha, no.
 *
 * Un mail como pro4@valgo.appr3.cloud es una sola palabra que el navegador no
 * sabe dónde cortar: con min-width:0 igual desborda su columna y se mete
 * abajo de la etiqueta "En revisión", que queda pisando el texto. En un panel
 * donde el admin decide si habilita a una persona, no puede haber un dato
 * tapado por otro. Con overflow-wrap el mail se parte donde haga falta y cada
 * cosa se queda en su lugar. */
.list-item .grow { min-width: 0; overflow-wrap: anywhere; }
.list-item > .chip, .list-item > svg, .list-item > .avatar { flex-shrink: 0; }

@media (max-width: 768px) {
  /* Menos aire alrededor de la etiqueta: en pantalla angosta cada píxel que
     no gasta la etiqueta se lo queda el nombre de la persona. */
  .list-item { gap: .6rem; }
  .list-item > .chip { padding: .2rem .5rem; font-size: 11px; }
  .list-item > .chip svg { width: 12px; height: 12px; }
}
.avatar {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: var(--bg-tertiary); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-gold { background: var(--gold-soft); color: var(--gold-text); }

.cat-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  padding: 1.1rem .5rem; min-height: 96px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  position: relative; overflow: hidden; transition: border-color .15s, transform .15s;
}
.cat-tile:hover { border-color: var(--gold); transform: translateY(-2px); }
.cat-tile svg { width: 22px; height: 22px; color: var(--gold-text); }

/* ---------- ESTADOS DE SOLICITUD ---------- */
.est-espera { background: var(--bg-tertiary); color: var(--text-secondary); border-color: var(--border-strong); }
.est-gold   { background: var(--gold-soft); color: var(--gold-text); border-color: var(--gold); }
.est-activo { background: rgba(27,79,212,.09); color: var(--info); border-color: var(--info); }
.est-ok     { background: transparent; color: var(--success); border-color: var(--success); }
.est-off    { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }

/* Línea de tiempo del servicio */
.timeline { display: flex; align-items: flex-start; gap: 0; margin: 1rem 0 .25rem; }
.tl-paso { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; position: relative; }
.tl-paso::before {
  content: ''; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.tl-paso:first-child::before { display: none; }
.tl-paso.done::before, .tl-paso.now::before { background: var(--gold); }
.tl-dot {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); color: var(--text-muted); border: 2px solid var(--border);
  position: relative; z-index: 1;
}
.tl-dot svg { width: 13px; height: 13px; }
.tl-paso.done .tl-dot { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.tl-paso.now  .tl-dot { background: var(--gold); color: var(--on-gold); border-color: var(--gold);
                        box-shadow: 0 0 0 4px rgba(232,179,43,.25); }
.tl-txt { font-size: 10px; font-weight: 600; color: var(--text-muted); text-align: center; line-height: 1.2; }
.tl-paso.done .tl-txt, .tl-paso.now .tl-txt { color: var(--text-primary); }

/* ---------- RATING ---------- */
.rating { display: inline-flex; align-items: center; gap: 2px; }
.rating svg { width: 14px; height: 14px; color: var(--border-strong); }
.rating svg.on { color: #E8B32B; fill: #E8B32B; }
.rating-num { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-left: .3rem; }

/* ---------- MAPAS (Leaflet) ---------- */
.mapa {
  width: 100%; height: 360px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-tertiary); z-index: 1;
}
.mapa-sm { height: 220px; }
@media (max-width: 768px) { .mapa { height: 260px; } }
.leaflet-container { font-family: inherit; background: var(--bg-tertiary); }
.leaflet-control-attribution { font-size: 9px; }
.pin-valgo {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  font-size: 14px; font-weight: 700; box-shadow: 0 3px 10px rgba(0,0,0,.35); border: 2px solid #fff;
}
.pin-foto {
  display: block; width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--gold); box-shadow: 0 3px 12px rgba(0,0,0,.4); overflow: hidden;
  background: var(--bg-tertiary);
}
.pin-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mapa-hint { font-size: 12px; color: var(--text-muted); margin-top: .4rem; }

/* ---------- BUSCADOR / RESULTADOS ---------- */
.filtros {
  display: grid; grid-template-columns: 1.4fr 1fr .8fr auto; gap: .65rem; align-items: end;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1.25rem;
}
@media (max-width: 860px) { .filtros { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .filtros { grid-template-columns: 1fr; } }
.filtros .field { margin-bottom: 0; }

.res-card {
  display: flex; gap: .9rem; padding: 1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); align-items: flex-start;
  transition: border-color .15s, transform .15s, box-shadow .15s; cursor: pointer;
  position: relative; overflow: hidden;
}
.res-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.res-card.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,179,43,.18); }
.res-avatar { width: 52px; height: 52px; border-radius: 13px; flex-shrink: 0; font-size: 18px; }
.res-dist {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: 12px; font-weight: 700; color: var(--gold-text);
}
.res-desde { font-size: 12.5px; color: var(--text-secondary); }
.res-desde strong { color: var(--text-primary); font-size: 15px; }

/* ---------- SOLICITUDES ---------- */
.sol-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem; margin-bottom: .9rem;
}
.sol-card.destacada { border-left: 3px solid var(--gold); }
.sol-desc {
  font-size: 14px; color: var(--text-secondary); line-height: 1.55;
  background: var(--surface-alt); border-radius: 10px; padding: .7rem .85rem; margin: .6rem 0;
}
.presu-item {
  border: 1px solid var(--border); border-radius: 12px; padding: .85rem; margin-bottom: .65rem;
  background: var(--surface-alt);
}
.presu-item.ganador { border-color: var(--success); background: rgba(26,122,74,.06); }
.presu-monto { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }

/* Grilla de rubros seleccionables */
.rubros-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .6rem; }
.rubro-check { position: relative; display: block; cursor: pointer; }
.rubro-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.rubro-box {
  display: flex; align-items: center; gap: .55rem; padding: .7rem .8rem;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface);
  font-size: 13px; font-weight: 600; transition: border-color .15s, background .15s;
}
.rubro-box svg { width: 17px; height: 17px; color: var(--text-muted); }
.rubro-check input:checked + .rubro-box {
  border-color: var(--gold); background: var(--gold-soft); color: var(--gold-text);
}
.rubro-check input:checked + .rubro-box svg { color: var(--gold-text); }

/* ---------- SEGUIMIENTO EN VIVO ---------- */
.track-bar {
  display: flex; align-items: center; gap: .85rem;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--gold); border-radius: var(--radius);
  padding: .9rem 1.1rem; box-shadow: var(--shadow-sm);
}
.track-titulo { font-weight: 600; font-size: 15px; line-height: 1.3; }
.track-val { font-size: 20px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.track-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  background: var(--border-strong); position: relative;
}
.track-dot.on { background: var(--success); }
.track-dot.on::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--success); animation: latido 1.8s ease-out infinite;
}
.track-dot.off { background: var(--warning); }
@keyframes latido {
  0%   { transform: scale(.6); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .track-dot.on::after { animation: none; opacity: .5; }
}

/* ---------- NOTIFICACIONES ---------- */
.notif-item {
  display: flex; gap: .75rem; padding: .8rem .2rem; border-bottom: 1px solid var(--border);
  position: relative;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: var(--gold-soft); margin: 0 -.75rem; padding: .8rem .95rem; border-radius: 10px; }
.notif-item .avatar { width: 36px; height: 36px; flex-shrink: 0; }
.notif-txt { flex: 1; min-width: 0; }
.notif-txt .tit { font-weight: 600; font-size: 13.5px; }
.notif-txt .msg { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.notif-txt .fecha { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex-shrink: 0; margin-top: 5px; }

/* ---------- ASISTENTE IA FLOTANTE ---------- */
#ai-float-btn {
  display: none; position: fixed; bottom: var(--fab-base); right: 16px; z-index: 991;
  width: var(--fab-size); height: var(--fab-size); border-radius: 50%; background: var(--gold);
  align-items: center; justify-content: center; cursor: pointer; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.28); border: 2px solid var(--gold);
}
#ai-float-btn img { width: 100%; height: 100%; object-fit: cover; }
#ai-float-btn i { color: var(--on-gold); width: 26px; height: 26px; }
#ai-chat-panel {
  display: none; flex-direction: column; position: fixed; bottom: var(--fab-piso-2); right: 16px; z-index: 991;
  width: 328px; max-width: calc(100vw - 32px); max-height: 70vh;
  background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.ai-head {
  padding: .8rem 1rem; border-bottom: 1px solid var(--border); background: var(--header-bg);
  display: flex; align-items: center; gap: .6rem;
}
.ai-head .avatar { width: 30px; height: 30px; flex-shrink: 0; }
.ai-head strong { color: #fff; font-size: 13.5px; }
.ai-head span { color: var(--steel); font-size: 11px; }
.ai-head button { margin-left: auto; background: none; border: none; color: var(--steel); cursor: pointer; }
#ai-messages {
  flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .6rem;
  min-height: 200px; background: var(--bg-secondary);
}
.ai-msg { max-width: 84%; padding: .5rem .75rem; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.ai-msg.user { align-self: flex-end; background: var(--gold); color: var(--on-gold); border-bottom-right-radius: 3px; }
.ai-msg.bot  { align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
               color: var(--text-primary); border-bottom-left-radius: 3px; }
.ai-input-row { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--border); background: var(--bg-primary); }
.ai-input-row input {
  flex: 1; border: 1px solid var(--border-strong); border-radius: 20px; padding: .5rem .9rem;
  background: var(--bg-secondary); color: var(--text-primary); font-size: 13px; outline: none;
}
.ai-input-row button {
  width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: var(--on-gold);
  border: none; display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer;
}

/* ---------- INSTALAR PWA ---------- */
#install-banner {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9997;
  background: var(--header-bg); color: #fff; padding: 1rem 1.25rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  align-items: center; gap: 1rem; box-shadow: 0 -4px 20px rgba(0,0,0,.3);
}
#install-banner img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
#install-banner .grow p { margin: 0; font-size: 12px; color: var(--steel); }
#install-banner .grow strong { font-size: 14px; }
#install-banner .btn-ghost {
  background: transparent; color: rgba(255,255,255,.78); border-color: rgba(255,255,255,.24);
}
#install-banner .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
@media (max-width: 768px) { #install-banner { bottom: 64px; } }
@media (max-width: 420px) {
  #install-banner { flex-wrap: wrap; }
  #install-banner .grow { flex-basis: 100%; order: 1; }
  #install-banner .btn-ghost, #install-banner .btn-gold { order: 2; flex: 1; justify-content: center; }
}

/* ---------- ESTRELLAS INTERACTIVAS (calificar) ---------- */
.rating-input { display: flex; gap: .3rem; justify-content: center; margin: .5rem 0 1rem; }
.rating-input button {
  background: none; border: none; padding: .2rem; cursor: pointer; color: var(--border-strong);
}
.rating-input button svg { width: 34px; height: 34px; }
.rating-input button.on { color: #E8B32B; fill: #E8B32B; }
.rating-input button.on svg { fill: #E8B32B; }

/* ---------- AVATAR CON SUBIDA ---------- */
.avatar-upload { position: relative; width: 84px; height: 84px; margin: 0 auto; }
.avatar-upload .avatar {
  width: 84px; height: 84px; border-radius: 20px; font-size: 28px; overflow: hidden;
}
.avatar-upload .avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload label {
  position: absolute; right: -4px; bottom: -4px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: var(--on-gold); display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 2px solid var(--bg-primary);
}
.avatar-upload label svg { width: 15px; height: 15px; }
.avatar-upload input[type=file] { display: none; }

/* ---------- ADMIN: LISTAS DE GESTIÓN ---------- */
.admin-row {
  display: flex; align-items: center; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.admin-row:last-child { border-bottom: 0; }
.admin-row .grow { min-width: 160px; }
.admin-filtros { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.admin-filtros .input, .admin-filtros .select { min-width: 160px; width: auto; }
.paginador { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.25rem; }

/* En mobile: siempre cards, nunca tablas ni listas apretadas */
@media (max-width: 640px) {
  .admin-row {
    border: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 12px;
    background: var(--surface); box-shadow: var(--shadow-sm);
    padding: .85rem; margin-bottom: .65rem; align-items: flex-start;
  }
  .admin-row:last-child { margin-bottom: 0; }
  .admin-row .grow { min-width: 0; flex-basis: 100%; }
  .admin-row > .row { flex-basis: 100%; justify-content: flex-start !important; }
  .admin-row > .row .btn { flex: 1; }
  .admin-filtros { flex-direction: column; }
  .admin-filtros .input, .admin-filtros .select, .admin-filtros .btn { min-width: 0; width: 100%; }
}

/* ---------- BARRA DE ESTADO SUPERIOR ---------- */
#offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10001;
  background: var(--warning); color: #fff; text-align: center;
  padding: .45rem; font-size: 12.5px; font-weight: 600; display: none;
}

/* ---------- EL MUÑECO DEL MAPA ---------- */
/* El profesional en camino: casco amarillo, mameluco y caja de herramientas.
   Es una figura de frente, así que no hay un "de espaldas" posible: .mira-izq
   la espeja cuando el tramo va hacia el oeste y lo único que cambia de lado es
   la caja de herramientas. Es un guiño de dirección, no una pose distinta. */
.pin-pro {
  display: block; width: 46px; height: 59px;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.35));
  transition: transform .25s ease;
  transform-origin: 50% 100%;
}
.pin-pro img { width: 100%; height: 100%; display: block; pointer-events: none; }
.pin-pro.mira-izq { transform: scaleX(-1); }

/* Cartel de llegada: el número grande que el cliente mira de reojo. */
.eta-hero {
  display: flex; align-items: center; gap: .9rem;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: .75rem;
}
.eta-hero-num { font-size: 30px; font-weight: 700; line-height: 1; color: var(--text-primary); }
.eta-hero-num small { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-left: .2rem; }
.eta-hero-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.eta-hero-sub { font-size: 12px; color: var(--text-muted); margin-top: .15rem; }
.eta-hero.frio { border-left-color: var(--text-muted); }
@media (max-width: 480px) { .eta-hero-num { font-size: 26px; } }
