/* ═══════════════════════════════════════════════════════════════════
   CONSERVA App – Estilos Principales  (Prototipo 3 · Sidebar + Acordeón)
   Target: Samsung Galaxy Tab A9 / Android 14 · 1340×800 dp
   ═══════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --sb-w: 72px;
  --topbar-h: 54px;

  /* Paleta */
  --violet:   #5b21b6;  --violet-d: #4c1d95;  --violet-l: #ede9fe;
  --blue:     #0369a1;  --blue-d:   #075985;   --blue-l:   #e0f2fe;
  --green:    #16a34a;  --green-d:  #15803d;   --green-l:  #dcfce7;
  --orange:   #d97706;  --orange-l: #fef3c7;
  --red:      #dc2626;  --red-l:    #fee2e2;
  --yellow:   #ca8a04;  --yellow-l: #fefce8;

  /* Neutros */
  --bg:       #fafbff;
  --white:    #ffffff;
  --brd:      #e5e7eb;
  --gray:     #6b7280;
  --gray-l:   #f3f4f6;
  --gray-xl:  #f9fafb;
  --text:     #111827;
  --text-d:   #374151;
  --text-m:   #9ca3af;

  /* Sombras */
  --sh-sm:  0 1px 3px rgba(0,0,0,.08);
  --sh-md:  0 2px 8px rgba(0,0,0,.10);
  --sh-lg:  0 4px 20px rgba(0,0,0,.12);

  /* Radio */
  --r:   12px;
  --rs:   8px;
  --rxs:  6px;
  --rpill: 999px;
}

/* ── Reset / Base ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; font-family: inherit; }
input  { font-family: inherit; }

/* ── Scrollbar fina ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--brd); border-radius: 4px; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL
   ═══════════════════════════════════════════════════════════════ */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── SIDEBAR ───────────────────────────────────────────────────── */
#sidebar {
  width: var(--sb-w);
  background: var(--violet-d);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 14px;
  gap: 4px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 2px 0 8px rgba(0,0,0,.15);
}

.sb-logo {
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .6px;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 12px;
  padding: 0 4px;
}
.sb-logo-ico { font-size: 22px; display: block; margin-bottom: 2px; }

.sb-item {
  width: 56px;
  height: 54px;
  border-radius: var(--rs);
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.5);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  transition: background .18s, color .18s;
  position: relative;
}
.sb-item .sb-ico { font-size: 22px; line-height: 1; }
.sb-item:hover  { background: rgba(255,255,255,.08); color: rgba(255,255,255,.75); }
.sb-item.active { background: rgba(255,255,255,.18); color: #fff; }
.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 32px;
  background: #fff;
  border-radius: 0 3px 3px 0;
}

.sb-spacer { flex: 1; }

.sb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ── MAIN ──────────────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ────────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--brd);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--sh-sm);
  z-index: 5;
}

#topbarTitle {
  font-size: 16px;
  font-weight: 800;
  color: var(--violet-d);
  line-height: 1.2;
}
#topbarSub {
  font-size: 11px;
  color: var(--text-m);
  margin-top: 1px;
}

.tb-spacer { flex: 1; }

.sync-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--green-l);
  border-radius: var(--rpill);
  padding: 5px 12px;
  font-size: 11px;
  color: var(--green);
  font-weight: 700;
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulseDot 1.8s ease infinite;
  flex-shrink: 0;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .35; transform: scale(.8); }
}

#clienteTag {
  background: var(--violet-l);
  color: var(--violet-d);
  border-radius: var(--rpill);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── VIEWS ─────────────────────────────────────────────────────── */
#views {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: row;
}
.view.active { display: flex; }

/* ── SPLIT PANELS ──────────────────────────────────────────────── */
.split-left {
  width: 47%;
  border-right: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.split-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── PANEL HEADER ──────────────────────────────────────────────── */
.panel-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--white);
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
  min-height: 52px;
}
.ph-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--rxs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.ico-violet  { background: var(--violet-l); }
.ico-blue    { background: var(--blue-l); }
.ico-green   { background: var(--green-l); }
.ico-orange  { background: var(--orange-l); }

.ph-title { font-size: 13px; font-weight: 800; color: var(--text-d); }
.ph-sub   { font-size: 10px; color: var(--text-m); margin-top: 1px; }
.ph-action { margin-left: auto; }

/* ── SCROLL AREA ───────────────────────────────────────────────── */
.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES REUTILIZABLES
   ═══════════════════════════════════════════════════════════════ */

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.card-body { padding: 14px; }

/* ── Botones ───────────────────────────────────────────────────── */
.btn-primary {
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: var(--rs);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity .15s;
}
.btn-primary:active { opacity: .8; }

.btn-secondary {
  background: var(--gray-l);
  color: var(--text-d);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity .15s;
}
.btn-secondary:active { opacity: .8; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gray);
  margin-left: auto;
  transition: background .15s;
}
.btn-icon:hover { background: var(--gray-l); }

.btn-full { width: 100%; justify-content: center; }

/* ── Pill / Badge ──────────────────────────────────────────────── */
.pill {
  border-radius: var(--rpill);
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}
.pill-ok     { background: var(--green-l);  color: var(--green); }
.pill-warn   { background: var(--orange-l); color: var(--orange); }
.pill-err    { background: var(--red-l);    color: var(--red); }
.pill-info   { background: var(--blue-l);   color: var(--blue); }
.pill-pend   { background: var(--gray-l);   color: var(--gray); }

/* ── Label de sección ──────────────────────────────────────────── */
.section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 2px 6px;
}

/* ── Placeholder mensaje ───────────────────────────────────────── */
.placeholder-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-m);
  flex: 1;
}
.ph-big-icon { font-size: 48px; margin-bottom: 12px; opacity: .6; }
.ph-big-text { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.ph-big-sub  { font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════
   MÓDULO A: CÍRCULO DE CRÉDITO
   ═══════════════════════════════════════════════════════════════ */

/* ── Upload zone ───────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--brd);
  border-radius: var(--r);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--gray-xl);
  transition: border-color .2s, background .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-zone:hover { border-color: var(--violet); background: var(--violet-l); }

.upload-icon { font-size: 32px; }
.upload-text { font-weight: 700; color: var(--violet); font-size: 14px; }
.upload-hint { font-size: 11px; color: var(--text-m); line-height: 1.5; }
.btn-upload {
  margin-top: 6px;
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: var(--rpill);
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 700;
  transition: opacity .15s;
}
.btn-upload:active { opacity: .8; }

/* ── Archivo item ──────────────────────────────────────────────── */
.archivo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  box-shadow: var(--sh-sm);
}
.archivo-item:hover  { border-color: var(--violet); background: var(--violet-l); }
.archivo-item.active { border-color: var(--violet); background: var(--violet-l); }

.archivo-ico  { font-size: 24px; flex-shrink: 0; }
.archivo-info { flex: 1; min-width: 0; }
.archivo-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.archivo-meta { font-size: 10px; color: var(--text-m); margin-top: 2px; }

/* ── Semáforo ──────────────────────────────────────────────────── */
.semaforo-block {
  border-radius: var(--rs);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.semaforo-block.verde   { background: var(--green-l);  border: 1px solid rgba(22,163,74,.25); }
.semaforo-block.amarillo{ background: var(--orange-l); border: 1px solid rgba(217,119,6,.25); }
.semaforo-block.rojo    { background: var(--red-l);    border: 1px solid rgba(220,38,38,.25); }

.semaforo-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  box-shadow: var(--sh-md);
}
.semaforo-orb.verde   { background: var(--green); }
.semaforo-orb.amarillo{ background: var(--orange); }
.semaforo-orb.rojo    { background: var(--red); }

.semaforo-txt { flex: 1; }
.semaforo-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .3px;
}
.semaforo-title.verde   { color: var(--green); }
.semaforo-title.amarillo{ color: var(--orange); }
.semaforo-title.rojo    { color: var(--red); }
.semaforo-reason { font-size: 12px; color: var(--gray); margin-top: 3px; line-height: 1.4; }

/* ── KPI Grid ──────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.kpi {
  background: var(--gray-l);
  border-radius: var(--rxs);
  padding: 10px 12px;
  text-align: center;
}
.kpi-label { font-size: 9px; color: var(--text-m); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.kpi-value { font-size: 17px; font-weight: 900; margin-top: 3px; }
.kpi-value.violet { color: var(--violet); }
.kpi-value.blue   { color: var(--blue); }
.kpi-value.green  { color: var(--green); }
.kpi-value.orange { color: var(--orange); }
.kpi-value.red    { color: var(--red); }

/* ── Cuenta card ───────────────────────────────────────────────── */
.cuenta-card {
  border-radius: var(--rs);
  padding: 10px 12px;
  background: var(--gray-xl);
  border-left: 3px solid var(--blue);
  margin-bottom: 6px;
}
.cuenta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cuenta-nombre { font-weight: 800; font-size: 13px; }
.cuenta-datos  { display: flex; gap: 12px; flex-wrap: wrap; }
.cuenta-dato   { font-size: 11px; color: var(--text-m); }
.cuenta-dato b { color: var(--text); font-weight: 700; }

/* ── Integrante acordeón ───────────────────────────────────────── */
.int-acc {
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--sh-sm);
}
.int-acc-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.int-acc-hdr:hover { background: var(--gray-xl); }

.int-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.int-info   { flex: 1; min-width: 0; }
.int-name   { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-meta   { font-size: 10px; color: var(--text-m); margin-top: 1px; }
.int-arrow  { font-size: 12px; color: var(--text-m); transition: transform .22s; flex-shrink: 0; }
.int-arrow.open { transform: rotate(180deg); }

.int-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease;
  background: var(--gray-xl);
}
.int-body.open { max-height: 300px; }
.int-body-inner { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.mini-kpi-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-kpi {
  background: var(--white);
  border: 1px solid var(--brd);
  border-radius: var(--rxs);
  padding: 6px 10px;
  text-align: center;
  min-width: 80px;
}
.mini-kpi b { display: block; font-size: 13px; font-weight: 800; margin-bottom: 1px; }
.mini-kpi small { font-size: 9px; color: var(--text-m); }

.btn-sel-cliente {
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: var(--rs);
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  width: 100%;
  transition: opacity .15s;
}
.btn-sel-cliente:active { opacity: .8; }

/* ═══════════════════════════════════════════════════════════════
   MÓDULO B: CAPTURA / OCR
   ═══════════════════════════════════════════════════════════════ */

/* ── Doc type tabs ─────────────────────────────────────────────── */
.doc-tabs {
  display: flex;
  background: var(--gray-l);
  border-radius: var(--rs);
  padding: 3px;
  gap: 3px;
}
.doc-tab {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: var(--rxs);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-m);
  transition: all .18s;
}
.doc-tab-ico { font-size: 18px; }
.doc-tab.active { background: var(--white); color: var(--violet); box-shadow: var(--sh-sm); }

/* ── Cámara ────────────────────────────────────────────────────── */
.cam-card .card-body { padding: 12px; }

.cam-container {
  position: relative;
  width: 100%;
  height: 200px;
  background: #111827;
  border-radius: var(--rs);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,.4);
  z-index: 1;
}
.cam-placeholder-ico  { font-size: 38px; }
.cam-placeholder-txt  { font-size: 13px; font-weight: 600; }
.cam-placeholder-sub  { font-size: 10px; text-align: center; }

.cam-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.cam-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--blue-l);
  border-style: solid;
  opacity: .8;
}
.cam-corner.tl { top: 14px;    left: 14px;  border-width: 2px 0 0 2px; }
.cam-corner.tr { top: 14px;    right: 14px; border-width: 2px 2px 0 0; }
.cam-corner.bl { bottom: 14px; left: 14px;  border-width: 0 0 2px 2px; }
.cam-corner.br { bottom: 14px; right: 14px; border-width: 0 2px 2px 0; }

.cam-controls { margin-top: 10px; }

.btn-action {
  background: var(--gray-l);
  border: 1px solid var(--brd);
  border-radius: var(--rpill);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-d);
  transition: background .15s;
}
.btn-action:hover   { background: var(--brd); }
.btn-action:active  { opacity: .8; }
.btn-action:disabled { opacity: .4; cursor: not-allowed; }

.btn-capture {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--violet);
  border: 3px solid rgba(255,255,255,.25);
  outline: 3px solid var(--violet);
  outline-offset: 3px;
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sh-md);
  transition: transform .15s, opacity .15s;
}
.btn-capture:active   { transform: scale(.9); }
.btn-capture:disabled { opacity: .4; cursor: not-allowed; }

.btn-sim {
  background: transparent;
  border: 1.5px dashed var(--violet);
  border-radius: var(--rpill);
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--violet);
  transition: background .15s;
}
.btn-sim:hover { background: var(--violet-l); }

/* ── OCR Fields ────────────────────────────────────────────────── */
.ocr-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--gray-xl);
  border-radius: var(--rxs);
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ocr-field:hover  { border-color: var(--blue); background: var(--blue-l); }
.ocr-field:active { background: var(--blue-l); }
.ocr-field.editable-field:hover { border-color: var(--violet); background: var(--violet-l); }

.ocr-label {
  font-size: 10px;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: .3px;
  font-weight: 700;
  min-width: 88px;
  flex-shrink: 0;
}
.ocr-value { flex: 1; font-size: 13px; font-weight: 700; color: var(--text); }
.ocr-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--rpill);
  flex-shrink: 0;
}
.tag-ok   { background: var(--green-l); color: var(--green); }
.tag-warn { background: var(--orange-l); color: var(--orange); }
.tag-err  { background: var(--red-l); color: var(--red); }
.copy-ico { font-size: 15px; color: var(--blue); flex-shrink: 0; }
.edit-ico { font-size: 14px; color: var(--violet); flex-shrink: 0; margin-left: 2px; }

/* ── Confianza badge ───────────────────────────────────────────── */
.confianza-badge {
  background: var(--green-l);
  color: var(--green);
  border-radius: var(--rpill);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

/* ── Validaciones ──────────────────────────────────────────────── */
.val-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--rxs);
  font-size: 12px;
  font-weight: 600;
}
.val-row.ok   { background: var(--green-l);  color: var(--green); }
.val-row.warn { background: var(--orange-l); color: var(--orange); }
.val-row.err  { background: var(--red-l);    color: var(--red); }

/* ── Copy all bar ──────────────────────────────────────────────── */
.btn-copy-all {
  width: 100%;
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: var(--rs);
  padding: 14px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(91,33,182,.3);
  transition: opacity .15s, transform .1s;
}
.btn-copy-all:active { opacity: .85; transform: scale(.99); }

/* ═══════════════════════════════════════════════════════════════
   MÓDULO C: SOLICITUD (ACORDEÓN)
   ═══════════════════════════════════════════════════════════════ */

/* ── Sync info bar ─────────────────────────────────────────────── */
.sync-info-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--green-l);
  border: 1px solid rgba(22,163,74,.2);
  border-radius: var(--rs);
  padding: 9px 14px;
  font-size: 11px;
  color: var(--green);
  font-weight: 700;
}

/* ── Sección acordeón ──────────────────────────────────────────── */
.sol-acc {
  border: 1px solid var(--brd);
  border-radius: var(--r);
  background: var(--white);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.sol-acc-hdr {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  cursor: pointer;
  background: var(--white);
  transition: background .15s;
  user-select: none;
}
.sol-acc-hdr:hover { background: var(--gray-xl); }

.sol-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
}
.sol-acc-title { font-size: 13px; font-weight: 800; flex: 1; }
.sol-count     { font-size: 10px; color: var(--text-m); }
.sol-arrow     { font-size: 12px; color: var(--text-m); transition: transform .22s; margin-left: 4px; }
.sol-arrow.open { transform: rotate(180deg); }

.sol-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.sol-body.open { max-height: 2000px; }

/* ── Solicitud grid de campos ──────────────────────────────────── */
.sol-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 10px 14px 14px;
}

.sol-f {
  background: var(--gray-xl);
  border-radius: var(--rxs);
  padding: 9px 32px 9px 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
  position: relative;
  min-width: 0;
}
.sol-f:hover  { border-color: var(--blue); background: var(--blue-l); }
.sol-f:active { background: var(--blue-l); }
.sol-f.has-value:hover { border-color: var(--violet); }

.sol-f-label {
  font-size: 9px;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: .3px;
  font-weight: 700;
  line-height: 1;
}
.sol-f-value {
  font-size: 12px;
  font-weight: 800;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.sol-f-value.empty { color: var(--text-m); font-weight: 400; font-style: italic; }
.sol-f-value.semaforo-verde   { color: var(--green); }
.sol-f-value.semaforo-amarillo{ color: var(--orange); }
.sol-f-value.semaforo-rojo    { color: var(--red); }

.sol-f-copy {
  position: absolute;
  top: 7px;
  right: 8px;
  font-size: 13px;
  color: var(--blue);
  opacity: .6;
}

/* ── Quick copy panel ──────────────────────────────────────────── */
.qc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--white);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  cursor: pointer;
  box-shadow: var(--sh-sm);
  transition: border-color .15s, background .15s;
}
.qc-item:hover  { border-color: var(--violet); background: var(--violet-l); }
.qc-item:active { background: var(--violet-l); }

.qc-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}
.qc-info  { flex: 1; min-width: 0; }
.qc-label { font-size: 10px; color: var(--text-m); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.qc-value { font-size: 13px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qc-value.empty { color: var(--text-m); font-style: italic; font-weight: 400; }

.btn-copy-todo {
  width: 100%;
  background: linear-gradient(135deg, var(--violet), var(--blue));
  color: #fff;
  border: none;
  border-radius: var(--rs);
  padding: 14px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(91,33,182,.3);
  transition: opacity .15s;
  margin-top: 4px;
}
.btn-copy-todo:active { opacity: .85; }

/* ═══════════════════════════════════════════════════════════════
   FAB (Floating Action Button) + Bottom Sheet 2 niveles
   ═══════════════════════════════════════════════════════════════ */
#fab-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 260;
}

.fab-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--violet);
  border: none;
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(91,33,182,.45);
  transition: transform .2s, background .2s;
  cursor: pointer;
}
.fab-btn.open { transform: scale(.88); background: var(--violet-d); }
.fab-btn:active { opacity: .85; }

/* ── Overlay backdrop ─────────────────────────────────────────── */
.fab-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.fab-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Bottom sheet ─────────────────────────────────────────────── */
.fab-sheet {
  background: var(--white);
  width: min(520px, 100vw);
  height: min(88vh, 700px);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 32px rgba(0,0,0,.12), 0 -4px 32px rgba(0,0,0,.14);
  transform: translateY(40px);
  transition: transform .32s cubic-bezier(.34,1.26,.64,1);
  position: relative;
}
.fab-overlay.open .fab-sheet {
  transform: translateY(0);
}

.fab-handle-bar {
  width: 42px;
  height: 4px;
  background: var(--brd);
  border-radius: 2px;
  margin: 10px auto 8px;
  flex-shrink: 0;
}

/* ── Levels container ─────────────────────────────────────────── */
.fab-levels {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.fab-level {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.fab-level.lv1 { transform: translateX(0); }
.fab-level.lv2 { transform: translateX(100%); }

.fab-levels.show-lv2 .fab-level.lv1 { transform: translateX(-100%); }
.fab-levels.show-lv2 .fab-level.lv2 { transform: translateX(0); }

/* ── Sheet header ─────────────────────────────────────────────── */
.fab-sheet-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
}
.fab-sheet-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fab-sheet-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--gray-l);
  color: var(--gray);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.fab-sheet-close:active { background: var(--brd); }
.fab-sheet-back {
  background: none;
  border: none;
  color: var(--violet);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px 4px 4px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.fab-sheet-back:active { background: var(--violet-l); }

/* ── Scrollable content ───────────────────────────────────────── */
.fab-sheet-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* ── Sheet footer ─────────────────────────────────────────────── */
.fab-sheet-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--brd);
  flex-shrink: 0;
}
.fab-copy-all {
  width: 100%;
  padding: 12px;
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.fab-copy-all:active { background: var(--violet-d); }

/* ── Nivel 1: Clientas ────────────────────────────────────────── */
.fab-clienta-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--brd);
  cursor: pointer;
  transition: background .12s;
}
.fab-clienta-item:active { background: var(--violet-l); }
.fab-clienta-item.active { background: var(--violet-l); }

.fab-clienta-av {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.fab-clienta-info { flex: 1; min-width: 0; }
.fab-clienta-name {
  font-size: 13px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fab-clienta-meta { font-size: 11px; color: var(--gray); margin-top: 2px; }
.fab-clienta-pill { flex-shrink: 0; }
.fab-clienta-arrow {
  font-size: 12px;
  color: var(--gray);
  flex-shrink: 0;
}

.fab-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--gray);
}
.fab-empty-ico { font-size: 36px; margin-bottom: 10px; }
.fab-empty-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.fab-empty-sub { font-size: 12px; }

/* ── Nivel 2: Campos ──────────────────────────────────────────── */
.fab-sec-hdr {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px 6px;
  background: var(--gray-xl);
  border-bottom: 1px solid var(--brd);
  position: sticky;
  top: 0;
  z-index: 2;
}
.fab-sec-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800;
  flex-shrink: 0;
}
.fab-sec-title {
  font-size: 11px; font-weight: 700; color: var(--text-d);
  flex: 1;
}
.fab-sec-count { font-size: 10px; color: var(--gray); }

.fab-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background .1s;
}
.fab-field-row:active { background: #f0f9ff; }
.fab-field-row.no-val { opacity: .5; }

.fab-field-label {
  font-size: 10px;
  color: var(--gray);
  flex: 0 0 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fab-field-value {
  font-size: 12px; font-weight: 600; color: var(--text);
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fab-field-value.empty {
  color: var(--text-m); font-weight: 400; font-style: italic;
}
.fab-field-copy { font-size: 13px; color: var(--gray); flex-shrink: 0; }

/* ── Badges de documentos (nivel 1) ──────────────────────────── */
.fab-doc-badges { display: flex; gap: 3px; margin-top: 3px; flex-wrap: wrap; }
.fab-doc-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
}
.fab-doc-badge.comp { background: #dcfce7; color: #166534; }
.fab-doc-badge.ine  { background: #e0f2fe; color: #075985; }
.fab-doc-badge.cc   { background: #ede9fe; color: #5b21b6; }

/* ── Panel de dirección (nivel 2) ────────────────────────────── */
.fab-dir-panel {
  border-bottom: 3px solid var(--violet-l);
  background: var(--white);
}
.fab-dir-panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 5px;
  background: var(--violet-l);
  border-bottom: 1px solid #ddd6fe;
}
.fab-dir-panel-title { font-size: 12px; font-weight: 800; color: var(--violet); }
.fab-dir-panel-hint  { font-size: 10px; color: #7c3aed; }

.fab-dir-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--brd);
  cursor: pointer;
  transition: background .12s;
}
.fab-dir-opt:active       { background: var(--violet-l); }
.fab-dir-opt.selected     { background: #f5f3ff; }

.fab-dir-radio {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--gray);
  flex-shrink: 0;
  margin-top: 2px;
  transition: border-color .15s, background .15s;
}
.fab-dir-radio.on {
  border-color: var(--violet);
  background: var(--violet);
  box-shadow: inset 0 0 0 3px #fff;
}

.fab-dir-info       { flex: 1; min-width: 0; }
.fab-dir-src        { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.fab-dir-str        { font-size: 11px; color: var(--gray); word-break: break-word; line-height: 1.4; }
.fab-dir-badge      { background: var(--green-l); color: var(--green); font-size: 9px; padding: 1px 5px; border-radius: 3px; font-weight: 800; }

.fab-dir-opt.selected .fab-dir-src { color: var(--violet); }
.fab-dir-opt.selected .fab-dir-str { color: var(--text-d); font-weight: 600; }

.fab-dir-conflict {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--rs);
  margin: 8px;
  padding: 9px 11px;
  font-size: 11px;
  color: #92400e;
  font-weight: 600;
  line-height: 1.45;
}

.fab-dir-aviso {
  padding: 9px 14px;
  font-size: 11px;
  color: var(--gray);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1f2937;
  color: #fff;
  border-radius: var(--rpill);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 500;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--sh-lg);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   MODAL DE EDICIÓN
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--white);
  border-radius: var(--r);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--sh-lg);
  animation: slideUp .2s ease;
  overflow: hidden;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--brd);
  font-weight: 800;
  font-size: 14px;
}
.modal-close {
  background: var(--gray-l);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  color: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--brd); }

.modal-body { padding: 16px; }
.modal-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}
.modal-input {
  width: 100%;
  border: 1.5px solid var(--brd);
  border-radius: var(--rs);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.modal-input:focus { border-color: var(--violet); }

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--brd);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════
   SPINNER / LOADING
   ═══════════════════════════════════════════════════════════════ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--brd);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--text-m);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   UTILIDADES
   ═══════════════════════════════════════════════════════════════ */
.flex-row     { display: flex; align-items: center; gap: 8px; }
.flex-col     { display: flex; flex-direction: column; gap: 8px; }
.text-center  { text-align: center; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }
.fs-12        { font-size: 12px; }
.fs-11        { font-size: 11px; }
.c-gray       { color: var(--text-m); }
.c-violet     { color: var(--violet); }
.c-green      { color: var(--green); }
.c-orange     { color: var(--orange); }
.c-red        { color: var(--red); }
.mt-8         { margin-top: 8px; }
.mt-12        { margin-top: 12px; }
.gap-6        { gap: 6px; }
.gap-8        { gap: 8px; }
.p-12         { padding: 12px; }

/* ═══════════════════════════════════════════════════════════════
   SOLICITUD v2: TIPOS DE CAMPO ESPECIALES
   ═══════════════════════════════════════════════════════════════ */

/* ── Campo ancho (span 2 columnas) ────────────────────────────── */
.sol-f-wide { grid-column: span 2; }

/* ── Campo RADIO (cicla opciones con tap) ──────────────────────── */
.sol-f.radio-f .sol-f-value {
  color: var(--violet);
  font-weight: 900;
}
.radio-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--violet);
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}
.sol-f.radio-f:hover { border-color: var(--violet); background: var(--violet-l); }

/* ── Campo GEO (GPS) ───────────────────────────────────────────── */
.sol-f.geo-f {
  grid-column: span 2;
  padding-right: 44px;
}
.sol-f.geo-f .sol-f-value {
  font-size: 10px;
  font-family: 'Courier New', monospace;
  white-space: normal;
  word-break: break-all;
  line-height: 1.4;
  color: var(--blue);
}
.sol-f.geo-f .sol-f-value.empty { color: var(--text-m); font-style: italic; }

.btn-geo {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 8px;
  background: var(--blue-l);
  border: 1.5px solid var(--blue);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, transform .15s;
  flex-shrink: 0;
  z-index: 2;
}
.btn-geo:hover  { background: var(--blue); }
.btn-geo:active { transform: translateY(-50%) scale(.88); }

/* Estado cargando GPS */
.btn-geo.loading {
  animation: spin .7s linear infinite;
  pointer-events: none;
  opacity: .7;
}

/* ── Check campo (Sí/No) visual ────────────────────────────────── */
.sol-f.check-f .sol-f-value[data-val="Sí"]  { color: var(--green);  }
.sol-f.check-f .sol-f-value[data-val="No"]  { color: var(--text-m); }

/* ── Sección de checkboxes agrupados (vivienda) ────────────────── */
.check-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 8px 14px 12px;
  border-top: 1px solid var(--brd);
}
.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--rxs);
  cursor: pointer;
  border: 1.5px solid var(--brd);
  background: var(--gray-xl);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-m);
  transition: all .15s;
  user-select: none;
}
.check-item.on {
  border-color: var(--green);
  background: var(--green-l);
  color: var(--green);
}
.check-item .ci-ico { font-size: 14px; }

/* ── Estacionalidad de venta ───────────────────────────────────── */
.estac-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px 14px 12px;
}
.estac-mes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
.estac-mes-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-m);
  text-transform: uppercase;
}
.estac-badge {
  width: 32px;
  height: 22px;
  border-radius: var(--rxs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  border: 1.5px solid var(--brd);
  background: var(--gray-xl);
  color: var(--text-m);
  transition: all .15s;
}
.estac-badge.A { background: var(--green-l);  border-color: var(--green);  color: var(--green);  }
.estac-badge.M { background: var(--orange-l); border-color: var(--orange); color: var(--orange); }
.estac-badge.B { background: var(--red-l);    border-color: var(--red);    color: var(--red);    }
