/* ═══════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#root { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#root.login-mode { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Home / Inicio — botones de acción rápida */
.inicio-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 16px 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 12px; font-weight: 700;
  cursor: pointer; transition: border-color var(--ease-fast), transform var(--ease-fast);
}
.inicio-action:hover { border-color: var(--accent); }
.inicio-action:active { transform: scale(0.97); }

/* ═══════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════ */
:root {
  /* ── Brand colors (Proventsa dark / corporativo) ── */
  --bg:           #0A0A0A;
  --surface:      #1A1A1A;
  --surface-2:    #222222;
  --input-bg:     #1A1A1A;
  --border:       #222222;
  --border-lt:    #2A2A2A;
  --nav-bg:       #111111;
  --card-bg:      #1A1A1A;
  --accent:       #F5C300;
  --accent-dim:   rgba(245,195,0,0.12);
  --accent-hover: #E5B400;
  --on-accent:    #0A0A0A;
  --text:         #FFFFFF;
  --muted:        #9C9C9C;
  --muted-2:      #444444;
  --green:        #22c55e;
  --orange:       #f97316;
  --red:          #E53935;
  /* ── Alias de compatibilidad (heredan el tema activo) ── */
  --card:         var(--card-bg);
  --bg-input:     var(--input-bg);
  --text-muted:   var(--muted);
  --yellow:       var(--accent);
  /* ── Typography (Barlow — Proventsa brand) ── */
  --font:         'Barlow', 'Arial Black', Arial, sans-serif;
  /* ── Spacing · base 8px (Proventsa grid) ── */
  --sp-1:  8px;
  --sp-2:  16px;
  --sp-3:  24px;
  --sp-4:  32px;
  --sp-6:  48px;
  --sp-8:  64px;
  /* ── Border radius ── */
  --radius-sm:  2px;
  --radius:     4px;
  --radius-lg:  8px;
  --radius-btn: 0px;
  /* ── Motion ── */
  --ease-fast: 150ms ease;
  --ease:      250ms ease;
  /* ── Z-index scale ── */
  --z-base:    0;
  --z-above:   100;
  --z-overlay: 200;
  --z-modal:   300;
  --z-toast:   400;
}
:root[data-theme="light"] {
  /* ── Brand light / canal de campo ── */
  --bg:           #F5F5F5;
  --surface:      #FFFFFF;
  --surface-2:    #EEEEEE;
  --input-bg:     #FFFFFF;
  --border:       #D0D0D0;
  --border-lt:    #E8E8E8;
  --nav-bg:       #FFFFFF;
  --card-bg:      #FFFFFF;
  --accent:       #0A0A0A;
  --accent-dim:   rgba(10,10,10,0.07);
  --accent-hover: #333333;
  --on-accent:    #FFFFFF;
  --text:         #0A0A0A;
  --muted:        #666666;
  --muted-2:      #AEAEAE;
  --green:        #16a34a;
  --orange:       #ea6c00;
  --red:          #dc2626;
}

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
.hdr {
  height: 58px;
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  flex-shrink: 0;
  user-select: none;
  z-index: 100;
}
.hdr-logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}
.hdr-info { flex: 1; min-width: 0; }
.hdr-name { font-size: 17px; font-weight: 900; color: var(--accent); letter-spacing: 0.04em; }
.hdr-sub  { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 1px; }

.hdr-badge {
  background: var(--accent-dim);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 9px; font-weight: 800;
  padding: 3px 9px; border-radius: 20px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.hdr-actions { display: flex; gap: 6px; align-items: center; }

.btn-icon {
  width: 34px; height: 34px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
  flex-shrink: 0;
  position: relative;
}
.btn-icon:hover  { background: rgba(255,255,255,0.07); color: var(--text); border-color: var(--muted); }
.btn-icon:active { transform: scale(0.88); }

.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--surface);
}

/* ═══════════════════════════════════════
   BOTTOM NAV
═══════════════════════════════════════ */
.bottom-nav {
  height: 56px;
  background: var(--nav-bg);
  border-top: 1px solid var(--border-lt);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}
.nav-tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none; background: none;
  transition: color 0.15s;
  user-select: none;
}
.nav-tab .nav-icon { font-size: 20px; line-height: 1; position:relative; display:inline-block; }
.nav-tab.active { color: var(--accent); }
.nav-tab:active { opacity: 0.7; }
.nav-badge {
  position:absolute; top:-4px; right:-8px;
  background:var(--accent); color:var(--on-accent);
  font-size:10px; font-weight:900;
  min-width:14px; height:14px; border-radius:7px;
  display:flex; align-items:center; justify-content:center;
  padding:0 3px; line-height:1;
}

/* ═══════════════════════════════════════
   PAGE CONTENT
═══════════════════════════════════════ */
.page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════ */
.login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px 40px;
  gap: 22px;
  overflow-y: auto;            /* si el contenido es alto, hace scroll en vez de cortar */
}
@media (max-height: 720px) { .login-screen { justify-content: flex-start; } }

.login-logo-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
/* Logo completo (sin recorte circular). Se adapta al ancho del teléfono. */
.login-logo { width: auto; max-width: 200px; max-height: 110px; height: auto; object-fit: contain; }
.login-brand { font-size: 38px; font-weight: 900; color: var(--accent); letter-spacing: 0.08em; }
.login-tagline { font-size: 12px; color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase; }

.login-pin-section {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; width: 100%; max-width: 320px;
}
.login-pin-label {
  font-size: 12px; font-weight: 800;
  color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase;
}

/* Login PIN keypad fills section */
.login-pin-section .pin-keypad { width: 100%; }
.login-pin-section .pin-dots { justify-content: center; }

/* Login por nombre (modo nube): lista de vendedoras */
.login-roster {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 340px;
}
.roster-list {
  display: flex; flex-direction: column; gap: 8px; width: 100%;
  max-height: 52vh; overflow-y: auto; padding: 2px;
}
.roster-name {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; cursor: pointer; text-align: left;
  transition: border-color 0.12s, transform 0.08s;
}
.roster-name:hover { border-color: var(--accent); }
.roster-name:active { transform: scale(0.985); }
.roster-avatar {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--accent);
  font-size: 17px; font-weight: 900;
}
.roster-label {
  flex: 1; min-width: 0; color: var(--text);
  font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.roster-arrow { flex-shrink: 0; color: var(--muted); font-size: 22px; font-weight: 700; }
.login-link { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 700; padding: 10px; margin-top: 4px; }
.login-link:active { color: var(--accent); }
#loginForceUpdate {
  margin-top: 14px; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  opacity: 0.6; padding: 6px;
}
#loginForceUpdate:active { opacity: 1; color: var(--accent); }

/* Tarjetas KPI compactas (inicio máster / dashboard) */
.kpi-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 10px; text-align: center;
}
.kpi-val { font-size: 24px; font-weight: 900; color: var(--accent); line-height: 1; }
.kpi-lbl { font-size: 10.5px; color: var(--muted); margin-top: 4px; line-height: 1.2; }

/* PIN overlay */
.pin-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 24px;
}
.pin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 20px;
}
.pin-title { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.pin-user  { font-size: 20px; font-weight: 900; color: var(--text); }
.pin-dots  { display: flex; gap: 10px; justify-content: center; }
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.1s;
}
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.pin-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.pin-key {
  height: 56px; border-radius: var(--radius);
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--text); font-size: 20px; font-weight: 700;
  cursor: pointer; transition: all 0.1s;
}
.pin-key:active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); transform: scale(0.95); }
.pin-key.del { font-size: 16px; color: var(--muted); }
.pin-error { font-size: 12px; color: var(--red); text-align: center; font-weight: 600; }

/* Scale selector */
.scale-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 24px;
}
.scale-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%; max-width: 320px;
  display: flex; flex-direction: column; gap: 16px;
}
.scale-title { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.scale-desc  { font-size: 14px; color: var(--text); }
.scale-list  { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-btn {
  flex: 1; min-width: 80px; height: 52px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 18px; font-weight: 900;
  cursor: pointer; transition: all 0.12s;
}
.scale-btn:hover  { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.scale-btn:active { transform: scale(0.95); }

/* ═══════════════════════════════════════
   FORM ELEMENTS (shared)
═══════════════════════════════════════ */
.sec-lbl {
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px;
}
.fld-lbl {
  display: block;
  font-size: 12px; color: var(--muted); font-weight: 600;
  margin-bottom: 3px;
}

input[type="text"],
input[type="number"],
input[type="search"],
select, textarea {
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 600;
  height: 40px; padding: 0 10px; outline: none;
  width: 100%; font-family: inherit;
  transition: border-color 0.12s;
  border-radius: var(--radius);
  -webkit-appearance: none; appearance: none;
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select { cursor: pointer; }
option { background: var(--surface); }
textarea { height: auto; padding: 8px 10px; resize: none; }

.iw { display: flex; align-items: stretch; }
.pfx, .sfx {
  background: var(--input-bg); border: 1px solid var(--border);
  height: 40px; padding: 0 10px;
  display: flex; align-items: center;
  font-size: 11px; color: var(--muted); white-space: nowrap;
  flex-shrink: 0; user-select: none;
}
.pfx { border-right: none; border-radius: var(--radius) 0 0 var(--radius); }
.sfx { border-left:  none; border-radius: 0 var(--radius) var(--radius) 0; }
.iw input, .iw select { border-radius: 0; }
.iw input:last-child, .iw select:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.iw input:first-child, .iw select:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.iw input:only-child, .iw select:only-child   { border-radius: var(--radius); }

.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gu { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; height: 44px; padding: 0 18px; border-radius: var(--radius-btn);
  font-size: 13px; font-weight: 700; cursor: pointer;
  border: none; transition: all 0.12s; white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--input-bg); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #1ebe5b; }
.btn-full { width: 100%; }
.btn-sm { height: 34px; font-size: 12px; padding: 0 12px; }

/* ═══════════════════════════════════════
   SEARCH BAR
═══════════════════════════════════════ */
.search-wrap {
  position: relative; width: 100%;
}
.search-wrap .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 16px; pointer-events: none;
}
.search-input {
  padding-left: 36px !important;
  height: 44px !important;
  font-size: 14px !important;
  background: var(--input-bg) !important;
}
.search-input::placeholder { color: var(--muted); font-weight: 500; }
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--border); border: none; color: var(--muted);
  cursor: pointer; font-size: 12px;
  display: none; align-items: center; justify-content: center;
}
.search-clear.visible { display: flex; }

/* Search results dropdown */
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: min(240px, 40svh); overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.search-result-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px;
  cursor: pointer; border-bottom: 1px solid var(--border-lt);
  transition: background 0.1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(255,255,255,0.04); }
.search-result-item:active { background: var(--accent-dim); }
.sri-name { font-size: 13px; font-weight: 700; color: var(--text); }
.sri-code { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; }
.sri-desc { font-size: 10px; color: var(--muted); }
.search-no-results { padding: 16px; text-align: center; font-size: 12px; color: var(--muted); }

/* ═══════════════════════════════════════
   MATERIAL CARD (selected)
═══════════════════════════════════════ */
.material-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.material-card-info { flex: 1; min-width: 0; }
.mc-name { font-size: 14px; font-weight: 700; color: var(--text); }
.mc-code { font-size: 10px; color: var(--muted); font-weight: 600; }
.mc-cat  { font-size: 10px; color: var(--muted); }
.mc-change { font-size: 11px; color: var(--accent); cursor: pointer; font-weight: 700; flex-shrink: 0; }

/* ═══════════════════════════════════════
   RESULT CARD (consulta)
═══════════════════════════════════════ */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
/* Hero — precio total prominente */
.result-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0 6px; gap: 3px;
}
.result-hero-lbl {
  font-size: 10px; color: var(--muted); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.result-hero-price {
  font-size: 48px; font-weight: 900; color: var(--accent);
  line-height: 1; letter-spacing: -0.02em;
}
.result-hero-unit {
  font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px;
}
/* Fila secundaria (margen, etc.) */
.result-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0; border-top: 1px solid var(--border-lt);
}
.result-lbl { font-size: 11px; color: var(--muted); font-weight: 600; }
.result-val { font-size: 14px; font-weight: 800; color: var(--text); }
.result-val.big { font-size: 26px; color: var(--accent); }
.result-iva { font-size: 10px; color: var(--muted); text-align: center; }
.result-iva span { color: var(--accent); font-weight: 700; }

/* ═══════════════════════════════════════
   NO-PRICE STATE
═══════════════════════════════════════ */
.no-price-card {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  align-items: flex-start;
}
.no-price-title { font-size: 13px; font-weight: 800; color: var(--red); }
.no-price-desc  { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Placeholder empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 40px; }
.empty-text { font-size: 12px; text-align: center; max-width: 180px; line-height: 1.6; }

/* ═══════════════════════════════════════
   COTIZACIÓN ITEMS
═══════════════════════════════════════ */
.quote-items { display: flex; flex-direction: column; gap: 8px; }
.quote-item {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}
.qi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.qi-name { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; }
.qi-del {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 0 0 0 8px;
  flex-shrink: 0;
}
.qi-del:active { color: var(--red); transform: scale(0.9); }
.qi-edit-desc {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 11px; font-weight: 700; padding: 0 0 8px 0; text-align: left;
}
.qi-edit-desc:active { opacity: 0.7; }
.qi-descedit-row { margin: 0 0 10px 0; }
.qi-desc-text {
  width: 100%; font-size: 13px; padding: 8px 10px;
  background: var(--bg); border: 1px solid var(--accent); border-radius: 8px;
  color: var(--text);
}
.qi-desc-hint { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.qi-desc-hint span { color: var(--accent); font-weight: 700; }
.qi-details { display: flex; gap: 12px; flex-wrap: wrap; }
.qi-detail { font-size: 11px; color: var(--muted); }
.qi-detail span { color: var(--text); font-weight: 700; }
.qi-total { margin-top: 8px; text-align: right; font-size: 15px; font-weight: 900; color: var(--accent); }

.quote-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-top: 2px solid var(--border);
  margin-top: 4px;
}
.qt-lbl { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.qt-val { font-size: 24px; font-weight: 900; color: var(--accent); }

/* ═══════════════════════════════════════
   MASTER MODULE
═══════════════════════════════════════ */
.master-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border-lt);
  background: var(--surface);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;               /* Firefox */
  -webkit-overflow-scrolling: touch;
}
.master-tabs::-webkit-scrollbar { display: none; }   /* Chrome/Safari */
.master-tab {
  flex: 0 0 auto; height: 44px; min-width: 60px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  border: none; background: none; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.15s; padding: 0 12px;
  white-space: nowrap;
}
.master-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.master-tab:active { opacity: 0.7; }

.master-section { padding: 12px; display: flex; flex-direction: column; gap: 12px; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  text-align: left; padding: 8px 10px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--border-lt);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 10px; border-bottom: 1px solid var(--border-lt);
  vertical-align: middle; color: var(--text); font-weight: 600;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.tbl-wrap {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden; overflow-x: auto;
}
.tbl-code { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; }
.tbl-actions { display: flex; gap: 4px; }
.tbl-btn {
  height: 28px; padding: 0 10px; border-radius: 6px;
  font-size: 10px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--muted);
  transition: all 0.1s;
}
.tbl-btn:hover { color: var(--text); border-color: var(--muted); }
.tbl-btn.del:hover { color: var(--red); border-color: var(--red); background: rgba(239,68,68,0.08); }
.tbl-btn:active { transform: scale(0.94); }

/* Notification cards */
.notif-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.notif-card.pending { border-color: rgba(245,195,0,0.3); background: rgba(245,195,0,0.04); }
.notif-card.resolved { opacity: 0.5; }
.notif-header { display: flex; align-items: flex-start; gap: 8px; }
.notif-dot-y { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 4px; }
.notif-info { flex: 1; }
.notif-title { font-size: 13px; font-weight: 700; color: var(--text); }
.notif-meta  { font-size: 10px; color: var(--muted); margin-top: 2px; }
.notif-time  { font-size: 10px; color: var(--muted); white-space: nowrap; }
.notif-temp-form { display: flex; gap: 8px; align-items: flex-end; }

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 900; padding: 0;
}
@media (min-width: 480px) {
  .modal-overlay { align-items: center; padding: 24px; }
}
.modal-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 480px;
  max-height: 90dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
@media (min-width: 480px) {
  .modal-sheet { border-radius: 16px; }
}
.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 10px auto 0;
  flex-shrink: 0;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-lt);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 900; color: var(--text); }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--border); border: none; color: var(--muted);
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--muted); color: var(--text); }
.modal-body {
  padding: 16px 20px 24px;
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 14px;
}

/* ═══════════════════════════════════════
   TOGGLE / COLLAPSIBLE
═══════════════════════════════════════ */
.collapse-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none; padding: 4px 0;
}
.collapse-chevron { font-size: 10px; color: var(--muted); transition: transform 0.2s; }
.collapse-chevron.open { transform: rotate(180deg); }
.collapse-body { overflow: hidden; transition: max-height 0.25s ease; }
.collapse-body.closed { max-height: 0; }

/* ═══════════════════════════════════════
   PILL / BADGE
═══════════════════════════════════════ */
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.04em;
}
.pill-yellow { background: var(--accent); color: #111214; }
.pill-red    { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.pill-green  { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.pill-muted  { background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--muted); }

/* ═══════════════════════════════════════
   CONSULTA MODULE
═══════════════════════════════════════ */
.consulta-wrap {
  padding: 12px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 600px; margin: 0 auto; width: 100%;
}

/* ═══════════════════════════════════════
   COTIZACION MODULE
═══════════════════════════════════════ */
.cotizacion-wrap {
  padding: 12px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 600px; margin: 0 auto; width: 100%;
  padding-bottom: 32px;
}

.cot-add-section {
  background: var(--input-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

/* ═══════════════════════════════════════
   QUOTES LIST (master)
═══════════════════════════════════════ */
.quote-list-item {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.qli-header { display: flex; justify-content: space-between; align-items: center; }
.qli-num { font-size: 12px; font-weight: 900; color: var(--accent); }
.qli-total { font-size: 14px; font-weight: 900; color: var(--text); }
.qli-meta { font-size: 11px; color: var(--muted); }

/* ═══════════════════════════════════════
   TOAST
═══════════════════════════════════════ */
.toast {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 18px;
  font-size: 13px; font-weight: 600; color: var(--text);
  z-index: 9999; white-space: nowrap;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.3s;
  opacity: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: rgba(34,197,94,0.4); color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,0.4); color: var(--red); }

/* ═══════════════════════════════════════
   SECTION CARD
═══════════════════════════════════════ */
.card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.cfg-backup-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.card-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}

/* ═══════════════════════════════════════
   DIVIDER
═══════════════════════════════════════ */
.divider { height: 1px; background: var(--border-lt); margin: 2px 0; }

/* ═══════════════════════════════════════
   EXCEL IMPORT
═══════════════════════════════════════ */
.import-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.import-zone:hover { border-color: var(--accent); }
.import-zone .imp-icon { font-size: 32px; }
.import-zone .imp-label { font-size: 13px; font-weight: 700; color: var(--text); }
.import-zone .imp-sub   { font-size: 11px; color: var(--muted); }

/* ═══════════════════════════════════════
   UTILITIES
═══════════════════════════════════════ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 11px; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.mb-2 { margin-bottom: 8px; }
.mt-2 { margin-top: 8px; }

.hidden { display: none !important; }

/* ═══════════════════════════════════════
   SCALE HEADER BADGE (master)
═══════════════════════════════════════ */
.hdr-badge-master {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 900;
  cursor: default;
  user-select: none;
}
/* Legacy selector kept for reference only — no longer rendered */
.scale-hdr-select {
  height: 28px; padding: 0 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(245,195,0,0.4);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px; font-weight: 900;
  cursor: pointer; width: auto;
  letter-spacing: 0.06em;
}
.scale-hdr-select:focus { border-color: var(--accent); }

/* ═══════════════════════════════════════
   SCALE PRICE TABLE (consulta master)
═══════════════════════════════════════ */
.scale-price-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.spt-title {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 12px 6px;
}
.spt-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.spt-table th {
  padding: 6px 10px; font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); border-bottom: 1px solid var(--border-lt);
  text-align: right;
}
.spt-table th:first-child { text-align: left; }
.spt-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border-lt);
  color: var(--text); font-weight: 600; text-align: right;
}
.spt-table td:first-child { text-align: left; }
.spt-table tr:last-child td { border-bottom: none; }
.spt-table tr.spt-active td { background: rgba(245,195,0,0.07); }
.spt-table tr.spt-active td:first-child { border-left: 3px solid var(--accent); }

/* ═══════════════════════════════════════
   DASHBOARD KPIs
═══════════════════════════════════════ */
.dash-kpis {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dash-kpi {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.dki-val {
  font-size: 18px; font-weight: 900; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dki-lbl {
  font-size: 9px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════
   CALCULADORA DE PRECIO (master)
═══════════════════════════════════════ */
.price-calc-card {
  background: var(--surface);
  border: 1px solid rgba(245,195,0,0.2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.calc-toggle {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; background: none; border: none;
  color: var(--accent); font-size: 12px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
}
.calc-toggle:active { opacity: 0.7; }
.calc-chevron { font-size: 10px; }
.calc-body { padding: 0 14px 14px; }
.calc-result {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.cr-context {
  font-size: 11px; font-weight: 800; color: var(--accent);
  letter-spacing: 0.06em; text-transform: uppercase;
  padding-bottom: 6px; border-bottom: 1px solid var(--border-lt);
}
.cr-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; border-bottom: 1px solid var(--border-lt);
  padding-bottom: 6px;
}
.cr-row:last-child { border-bottom: none; padding-bottom: 0; }
.cr-total { background: var(--accent-dim); border-radius: var(--radius); padding: 8px 10px; border: none !important; }
.cr-total span { color: var(--accent) !important; font-size: 13px; }
.cr-total b { font-size: 18px !important; color: var(--accent) !important; }
.cr-row span { color: var(--muted); font-weight: 600; }
.cr-row b { font-size: 13px; font-weight: 900; color: var(--text); }

/* ═══════════════════════════════════════
   INLINE SCALE TABS (consulta)
═══════════════════════════════════════ */
.scale-tab-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px;
}
.scale-tab-btn {
  flex: 1; min-width: 0;
  padding: 7px 4px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  text-align: center;
}
.scale-tab-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.scale-tab-btn:hover:not(.active) {
  border-color: var(--muted);
  color: var(--text);
}
.lib-chip {
  padding: 6px 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px; font-weight: 800;
  cursor: pointer; transition: all 0.15s;
}
.lib-chip:hover { border-color: var(--accent); color: var(--accent); }
.lib-chip:active { transform: scale(0.97); }
.scale-inline-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 12px; color: var(--muted);
  margin-top: 4px;
}
.scale-inline-badge b { color: var(--accent); font-weight: 900; }

/* ═══════════════════════════════════════
   BARRAS ESTÁNDAR
═══════════════════════════════════════ */
.barras-card {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.barras-title {
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 4px;
}
.barras-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; border-bottom: 1px solid var(--border-lt);
  padding-bottom: 5px;
}
.barras-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.barras-row span { color: var(--muted); font-weight: 600; }
.barras-row b { color: var(--text); font-weight: 900; }
.barras-sobrante {
  margin-top: 4px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 11px; color: var(--green); font-weight: 700;
}

/* ═══════════════════════════════════════
   SKU CHANGE CONFIRMATION SHEET
═══════════════════════════════════════ */
.sku-change-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sku-change-sheet {
  width: 100%; max-width: 480px;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px 32px;
  display: flex; flex-direction: column; gap: 10px;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sku-change-title {
  font-size: 15px; font-weight: 900; color: var(--text);
  text-align: center; margin-bottom: 4px;
}
.sku-change-body {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 4px;
}
.sku-change-current, .sku-change-next {
  width: 100%; text-align: center;
}
.scc-label {
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 3px;
}
.scc-name {
  font-size: 13px; font-weight: 700; color: var(--text);
}
.scc-price {
  font-size: 11px; color: var(--accent); font-weight: 700; margin-top: 2px;
}
.sku-change-arrow {
  font-size: 18px; color: var(--muted);
}

/* ═══════════════════════════════════════
   SCALE HEADER SELECT (master)
═══════════════════════════════════════ */
.scale-hdr-select {
  height: 28px; padding: 0 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(245,195,0,0.4);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px; font-weight: 900;
  cursor: pointer; width: auto;
  letter-spacing: 0.06em;
}
.scale-hdr-select:focus { border-color: var(--accent); }

/* ═══════════════════════════════════════
   SCALE PRICE TABLE (consulta master)
═══════════════════════════════════════ */
.scale-price-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.spt-title {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 12px 6px;
}
.spt-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.spt-table th {
  padding: 6px 10px; font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); border-bottom: 1px solid var(--border-lt);
  text-align: right;
}
.spt-table th:first-child { text-align: left; }
.spt-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border-lt);
  color: var(--text); font-weight: 600; text-align: right;
}
.spt-table td:first-child { text-align: left; }
.spt-table tr:last-child td { border-bottom: none; }
.spt-table tr.spt-active td { background: rgba(245,195,0,0.07); }
.spt-table tr.spt-active td:first-child { border-left: 3px solid var(--accent); }

/* ═══════════════════════════════════════
   DASHBOARD KPIs
═══════════════════════════════════════ */
.dash-kpis {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dash-kpi {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.dki-val {
  font-size: 18px; font-weight: 900; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dki-lbl {
  font-size: 9px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════
   MERMA TOGGLE & BADGES
═══════════════════════════════════════ */
.merma-toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0 8px; cursor: pointer; user-select: none;
  font-size: 11px; font-weight: 700; color: var(--text);
}
.tog {
  display: inline-flex; align-items: center;
  width: 36px; height: 20px;
  background: var(--border); border-radius: 10px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.tog.tog-on { background: var(--accent); }
.tog-knob {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; position: absolute; left: 2px;
  transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.tog.tog-on .tog-knob { left: 18px; }
.merma-locked {
  font-size: 10px; font-weight: 700;
  color: var(--muted); letter-spacing: 0.04em;
  padding: 5px 0 7px;
  display: flex; align-items: center; gap: 4px;
}
.merma-row-on { background: rgba(251,191,36,0.07); border-radius: 4px; padding: 4px 6px !important; }
.merma-row-on span { color: var(--yellow) !important; }
.merma-row-on b { color: var(--yellow) !important; }
.merma-badge {
  display: inline-block; font-size: 9px; font-weight: 800;
  background: rgba(251,191,36,0.15); color: var(--yellow);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  letter-spacing: 0.04em; vertical-align: middle;
}

/* ═══════════════════════════════════════
   FICHAS TÉCNICAS
═══════════════════════════════════════ */
.fichas-cats {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 8px; scrollbar-width: none;
}
.fichas-cats::-webkit-scrollbar { display: none; }
.ficha-chip {
  flex-shrink: 0; padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.ficha-chip.active { background: var(--accent); color: #000; border-color: var(--accent); }
.fichas-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 10px 14px 90px;
}
.ficha-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.ficha-card:active { transform: scale(.97); }
.ficha-card-cat {
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: #fff; padding: 5px 10px;
}
.ficha-card-code {
  font-size: 20px; font-weight: 900; color: var(--accent);
  padding: 8px 10px 2px; line-height: 1;
}
.ficha-card-name {
  font-size: 10px; color: var(--muted);
  padding: 2px 10px 12px; line-height: 1.35;
}

/* overlay / detalle */
.ficha-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  transform: translateX(100%); transition: transform .3s ease;
}
.ficha-overlay.open { transform: translateX(0); }
.ficha-detail { display: flex; flex-direction: column; height: 100%; }
.ficha-detail-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--card);
}
.ficha-back-btn {
  background: none; border: none; color: var(--accent);
  font-size: 13px; font-weight: 700; cursor: pointer;
  padding: 4px 0; flex-shrink: 0;
}
.ficha-detail-title {
  flex: 1; font-size: 12px; font-weight: 700; color: var(--text);
  text-align: center; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.ficha-share-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text); font-size: 11px; font-weight: 700;
  cursor: pointer; padding: 4px 10px; border-radius: 6px; flex-shrink: 0;
}
.ficha-detail-body { flex: 1; overflow-y: auto; background: #080808; }

/* ── Fichas sub-tabs ── */
.fichas-subtabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.fichas-subtab {
  flex: 1; padding: 10px 0; font-size: 12px; font-weight: 700;
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.fichas-subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
#fichasContent { flex: 1; overflow-y: auto; }
.ficha-guia-body { background: #080808; padding: 8px 0 80px; }
.ficha-guia-body .page { margin: 0 auto 12px; }

/* ── Guía reader ── */
.guia-reader { display: flex; flex-direction: column; min-height: 100%; }
.guia-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px; border-bottom: 1px solid var(--border);
  background: var(--card); flex-shrink: 0;
}
.guia-nav-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  font-size: 16px; font-weight: 700; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.guia-nav-btn:disabled { opacity: 0.25; cursor: default; }
.guia-nav-btn:not(:disabled):active { background: var(--border); }
.guia-dots { display: flex; align-items: center; gap: 6px; }
.guia-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border); transition: background .2s;
}
.guia-dot.active { background: var(--accent); }
.guia-page-lbl { font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.guia-page-title {
  font-size: 13px; font-weight: 900; color: var(--accent);
  padding: 10px 14px 6px; letter-spacing: .3px;
}
.guia-content { flex: 1; overflow-y: auto; padding: 0 10px 80px; background: #080808; }

/* ── Guía acordeones ── */
.guia-hero { display:flex; align-items:center; gap:10px; padding:14px 14px 8px; }
.guia-hero-icon { font-size:24px; }
.guia-hero-title { font-size:15px; font-weight:900; color:var(--text); }
.guia-accs { padding:0 14px 80px; }
.gacc { border:1px solid var(--border); border-radius:10px; margin-bottom:8px; overflow:hidden; background:var(--card); }
.gacc-hdr { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; cursor:pointer; font-size:13px; font-weight:700; color:var(--text); transition:background .15s; user-select:none; }
.gacc-hdr.open { color:var(--accent); background:rgba(245,195,0,0.05); }
.gacc-arrow { color:var(--muted); font-size:16px; transition:transform .2s; font-weight:400; line-height:1; }
.gacc-body { padding:0 14px 14px; display:none; }
.gacc-body.open { display:block; }
.gitem { padding:7px 0; border-bottom:1px solid var(--border); }
.gitem:last-child { border-bottom:none; }
.gitem-k { font-size:11px; font-weight:800; color:var(--accent); margin-bottom:2px; }
.gitem-v { font-size:11px; color:var(--muted); line-height:1.5; }
.gtrat-card { background:var(--bg); border-left:3px solid var(--accent); padding:8px 10px; margin-bottom:7px; border-radius:0 6px 6px 0; }
.gtrat-card:last-child { margin-bottom:0; }
.gtrat-nom { font-size:12px; font-weight:800; color:var(--text); margin-bottom:3px; }
.gtrat-desc { font-size:11px; color:var(--muted); line-height:1.5; }
.gsel-row { display:flex; justify-content:space-between; align-items:center; padding:6px 0; border-bottom:1px solid var(--border); gap:8px; }
.gsel-row:last-child { border-bottom:none; }
.gsel-need { font-size:11px; color:var(--text); flex:1; }
.gsel-mat { font-size:11px; font-weight:800; color:var(--accent); flex-shrink:0; }

/* ── Logo en fichas ── */
.ficha-logo-hdr { display:flex; align-items:center; justify-content:space-between; padding:12px 16px 10px; border-bottom:1px solid #222; background:#080808; }
.ficha-logo-img { height:32px; object-fit:contain; }
.ficha-logo-code { font-size:11px; font-weight:800; color:var(--muted); letter-spacing:.5px; }

/* ── Historial cotizaciones (vendedora) ── */
.cot-hist-wrap { margin-top:16px; padding-bottom:80px; }
.cot-hist-item { background:var(--card); border:1px solid var(--border); border-radius:10px;
  padding:10px 12px; margin-bottom:8px; }
.chi-hdr { display:flex; justify-content:space-between; align-items:center; margin-bottom:3px; }
.chi-num { font-size:12px; font-weight:700; color:var(--accent); }
.chi-date { font-size:11px; color:var(--text-muted); }
.chi-cliente { font-size:12px; color:var(--text); margin-bottom:2px; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
.chi-meta { font-size:11px; color:var(--text-muted); }
.chi-meta b { color:var(--text); }
/* Estado chips */
.chi-estado { display:inline-flex; align-items:center; gap:4px; font-size:10px; font-weight:700;
  padding:2px 7px; border-radius:10px; letter-spacing:0.04em; }
.estado-borrador { background:rgba(122,126,138,.18); color:var(--muted); }
.estado-enviada  { background:rgba(59,130,246,.18); color:#60a5fa; }
.estado-aprobada { background:rgba(34,197,94,.18);  color:var(--green); }
.estado-vencida  { background:rgba(239,68,68,.18);  color:var(--red); }
.estado-btn { font-size:9px; padding:2px 6px; border-radius:6px; border:1px solid var(--border);
  background:transparent; color:var(--muted); cursor:pointer; }
.estado-btn:hover { border-color:var(--accent); color:var(--accent); }


/* ── Historial filtros y toolbar ── */
.cot-hist-toolbar { display:flex; flex-direction:column; gap:6px; margin-bottom:8px; }
.cot-hist-search { width:100%; padding:6px 10px; background:var(--input-bg,#1c1d20); border:1px solid var(--border);
  border-radius:8px; color:var(--text); font-size:12px; outline:none; }
.cot-hist-search:focus { border-color:var(--accent); }
.cot-hist-filters { display:flex; flex-wrap:wrap; gap:4px; }
.cot-filt-btn { font-size:10px; font-weight:600; padding:3px 9px; border-radius:20px;
  border:1px solid var(--border); background:transparent; color:var(--muted); cursor:pointer;
  display:inline-flex; align-items:center; gap:4px; transition:all .15s; }
.cot-filt-btn:hover { border-color:var(--accent); color:var(--accent); }
.cot-filt-btn.active { background:var(--accent); color:#111; border-color:var(--accent); }
.cot-filt-cnt { background:rgba(255,255,255,.15); border-radius:20px; padding:0 4px; font-size:9px; }
.cot-hist-empty { text-align:center; padding:18px; font-size:12px; color:var(--muted); }

/* Estado por_vencer */
.estado-por-vencer { background:rgba(251,146,60,.2); color:#fb923c; }
.chi-urgente { border-color:rgba(251,146,60,.35) !important; }
/* ── Subtotal / IVA en cotización ── */
.quote-total-block { border-top:1px solid var(--border); margin-top:8px; padding-top:6px; }
.qt-sub-row { display:flex; justify-content:space-between; padding:3px 0;
  font-size:12px; color:var(--text-muted); }

/* ── Import Preview Modal ── */
.ipr-chips { display:flex; flex-wrap:wrap; gap:6px; }
.ipr-chip { font-size:11px; font-weight:700; padding:3px 8px; border-radius:20px; }
.ipr-chip-ok  { background:rgba(34,197,94,.18); color:#22c55e; }
.ipr-chip-upd { background:rgba(99,102,241,.18); color:#818cf8; }
.ipr-chip-warn{ background:rgba(251,191,36,.18); color:#fbbf24; }
.ipr-chip-err { background:rgba(239,68,68,.18);  color:#f87171; }
.ipr-error-note { font-size:11px; color:#f87171; background:rgba(239,68,68,.1); border-radius:8px; padding:6px 10px; margin-bottom:10px; }
.ipr-table { width:100%; border-collapse:collapse; font-size:12px; }
.ipr-th { text-align:left; padding:5px 8px; color:var(--text-muted); font-size:11px; border-bottom:1px solid var(--border); }
.ipr-td { padding:5px 8px; border-bottom:1px solid var(--border-lt); color:var(--text); white-space:nowrap; }
.ipr-nombre { white-space:normal; max-width:180px; }
.ipr-centro { text-align:center; }
.ipr-row.ipr-warn td { background:rgba(251,191,36,.06); }
.ipr-row.ipr-update td { background:rgba(99,102,241,.06); }
.ipr-more { font-size:11px; color:var(--text-muted); text-align:center; padding:6px; }
.ipr-section { margin-top:14px; padding-top:12px; border-top:1px solid var(--border-lt); }
.ipr-section-title { font-size:12px; font-weight:700; color:var(--text-muted); margin-bottom:8px; }
.ipr-check-wrap { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text); margin-top:8px; cursor:pointer; }
.ipr-check-wrap input { accent-color:var(--accent); width:15px; height:15px; cursor:pointer; }

/* Recent searches */
.search-recent-hdr { padding: 6px 14px 4px; font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.search-recent-item { opacity: 0.85; }
.search-recent-item:hover { opacity: 1; }

/* Match highlight */
.sri-name strong, .sri-code strong { color: var(--accent); font-weight: 800; background: rgba(245,195,0,0.12); border-radius: 2px; padding: 0 1px; }

/* Familia chip in search results */
.sri-fam { font-size: 9px; font-weight: 700; color: var(--accent); background: rgba(245,195,0,0.1); border: 1px solid rgba(245,195,0,0.25); border-radius: 4px; padding: 1px 5px; letter-spacing: 0.03em; white-space: nowrap; }

/* Master — Familias */
.fam-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 10px; }
.fam-card-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.fam-card-nombre { font-size: 13px; font-weight: 700; color: var(--text); }
.fam-section-lbl { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.fam-tags-wrap { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fam-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; border-radius: 4px; padding: 2px 7px; }
.fam-tag-pref { background: rgba(245,195,0,0.12); color: var(--accent); border: 1px solid rgba(245,195,0,0.3); }
.fam-tag-kw { background: rgba(99,102,241,0.12); color: #818cf8; border: 1px solid rgba(99,102,241,0.25); }
.fam-tag-del { cursor: pointer; opacity: 0.6; font-size: 11px; line-height: 1; }
.fam-tag-del:hover { opacity: 1; }
.fam-tag-input { background: transparent; border: 1px dashed var(--border); border-radius: 4px; color: var(--text); font-size: 10px; padding: 2px 6px; width: 120px; outline: none; }
.fam-tag-input:focus { border-color: var(--accent); }

/* ── Master Dashboard ── */
.dash-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:16px; }
.dash-kpi { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 16px; }
.dash-kpi-val { font-size:22px; font-weight:800; color:var(--accent); line-height:1.1; }
.dash-kpi-lbl { font-size:11px; color:var(--text-muted); margin-top:3px; font-weight:500; letter-spacing:0.03em; }
.dash-section { margin-bottom:18px; }
.dash-section-title { font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:10px; }
.dash-bar-row { display:flex; align-items:center; gap:8px; margin-bottom:7px; }
.dash-bar-label { font-size:12px; color:var(--text); min-width:80px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-bar-track { flex:1; background:rgba(255,255,255,0.06); border-radius:20px; height:8px; overflow:hidden; }
.dash-bar-fill { height:100%; background:var(--accent); border-radius:20px; transition:width .4s ease; }
.dash-bar-count { font-size:11px; color:var(--text-muted); min-width:28px; text-align:right; }
.dash-estado-row { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.dash-estado-chip { font-size:11px; font-weight:700; padding:4px 10px; border-radius:20px; }

/* ── Descuento por línea en cotización ── */
.qi-desc-row { display:flex; align-items:center; gap:6px; padding:4px 0 2px; }
.qi-desc-lbl { font-size:10px; color:var(--text-muted); font-weight:600; min-width:28px; }
.qi-desc-input { width:60px; padding:3px 7px; font-size:12px; background:var(--surface);
  border:1px solid var(--border); border-radius:6px; color:var(--text); outline:none; }
.qi-desc-input:focus { border-color:var(--accent); }
.qi-desc-badge { font-size:10px; font-weight:700; color:#4A9EFF;
  background:rgba(74,158,255,.12); border-radius:12px; padding:2px 7px; }

/* ── Client search in cotización ─────────────────────── */
.cot-clt-wrap { margin-bottom: 12px; }
.cot-clt-label { font-size: 11px; color: var(--text-muted, #888); margin-bottom: 4px; }
#cotCltSearch {
  width: 100%; padding: 8px 10px; border-radius: 6px;
  border: 1px solid #333; background: #1a1c1f; color: #fff;
  font-size: 13px; box-sizing: border-box;
}
#cotCltSearch:focus { outline: none; border-color: var(--accent); }
#cotCltResults {
  background: #1a1c1f; border: 1px solid #333; border-radius: 6px;
  max-height: 200px; overflow-y: auto; margin-top: 2px;
  position: relative; z-index: 50;
}
.clt-sri {
  padding: 8px 10px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid #2a2c2f; display: flex;
  justify-content: space-between; align-items: center;
}
.clt-sri:last-child { border-bottom: none; }
.clt-sri:hover { background: #252729; }
.clt-sri .clt-nit { font-size: 11px; color: #888; }
.clt-sri.inactivo { opacity: 0.55; }
.clt-sri.inactivo::after {
  content: 'inactivo'; font-size: 10px; color: #e55;
  background: rgba(229,85,85,.15); padding: 1px 5px; border-radius: 4px;
}
#cotCltClr {
  margin-top: 6px; font-size: 11px; color: #888; cursor: pointer;
  background: none; border: none; padding: 0; text-decoration: underline;
}
#cotCltClr:hover { color: var(--accent); }
.cot-clt-loaded {
  background: #1a2a1a; border: 1px solid #2a4a2a; border-radius: 6px;
  padding: 8px 10px; font-size: 12px; color: #8f8;
  margin-bottom: 8px;
}
/* Client modal */
.client-update-modal p { margin: 0 0 10px; font-size: 13px; color: #ccc; }
.client-update-modal label { font-size: 11px; color: #888; display: block; margin-bottom: 3px; }
.client-update-modal input {
  width: 100%; padding: 7px 9px; border-radius: 5px;
  border: 1px solid #333; background: #111214; color: #fff;
  font-size: 13px; box-sizing: border-box; margin-bottom: 10px;
}
/* Master clientes tab */
.mclientes-wrap { padding: 16px; }
.mclientes-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.mclientes-actions button {
  padding: 8px 16px; border-radius: 6px; font-size: 13px;
  border: none; cursor: pointer;
}
.btn-import-clients { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-export-delta  { background: #2a3a2a; color: #8f8; border: 1px solid #3a5a3a !important; }
.mclientes-stat { font-size: 13px; color: var(--muted); }
.mclientes-stat strong { color: var(--accent); }

/* ─── Templates de cotización ─── */
.cot-section { margin-bottom:10px; }
.cot-notes-ta {
  width:100%; box-sizing:border-box;
  background:var(--surface); color:var(--text);
  border:1px solid var(--border); border-radius:8px;
  padding:8px 10px; font-size:12px; font-family:inherit;
  resize:vertical; min-height:52px;
  transition:border-color 0.15s;
}
.cot-notes-ta:focus { outline:none; border-color:var(--accent); }
.cot-notes-ta::placeholder { color:var(--muted); }
.tpl-section { margin-top:12px; border-top:1px solid var(--border); padding-top:10px; }
.tpl-hdr { font-size:11px; font-weight:700; color:var(--muted); letter-spacing:.05em; text-transform:uppercase; margin-bottom:8px; }
.tpl-card { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 10px; background:var(--card-bg); border:1px solid var(--border); border-radius:8px; margin-bottom:6px; }
.tpl-info { display:flex; flex-direction:column; gap:2px; min-width:0; }
.tpl-name { font-size:12px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tpl-meta { font-size:10px; color:var(--muted); }
.tpl-actions { display:flex; gap:4px; flex-shrink:0; }


/* ─── Theme toggle button ─── */
#btnTheme {
  font-size: 16px;
  line-height: 1;
  padding: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
#btnTheme:active { transform: rotate(20deg); }

/* ─── Tablet / PC layout (768px+) ─── */
@media (min-width: 768px) {
  body { display: flex; align-items: center; justify-content: center; padding: 16px; }
  #root {
    width: min(100%, 760px);
    height: min(100dvh, 1000px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
  }
  :root[data-theme="light"] #root {
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  }
  .hdr { padding: 0 20px; }
  .nav-tab { font-size: 12px; gap: 4px; }
  .nav-tab .nav-icon { font-size: 22px; }
  .page { padding: 0; }
  .bottom-nav { height: 62px; }
  .modal-overlay { align-items: center; }
  .modal-sheet { border-radius: 16px; max-width: 560px; }
}

/* ─── PC grande (1100px+): más ancho para tablas/master ─── */
@media (min-width: 1100px) {
  #root { width: 940px; }
  /* el contenido de consulta/cotización se mantiene legible y centrado */
  .consulta-wrap, .cotizacion-wrap { max-width: 660px; margin-left: auto; margin-right: auto; }
}


/* ─── Esmeralda: microinteractions ─── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.material-card,
.quote-item,
.result-card { animation: slideUp 0.16s ease-out; }

.qt-val { transition: color 0.25s, transform 0.15s; }

/* Nav active pill indicator */
.nav-tab { position: relative; }
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 2px;
  background: var(--accent);
  border-radius: 1px;
  animation: slideUp 0.18s ease-out;
}

/* ─── Bruno: SVG empty icons ─── */
.empty-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.empty-icon svg { opacity: 0.35; }

/* ─── Lorena: draft saved chip warm ─── */
#draftSavedChip { color: var(--green) !important; }
