/* ============================================================================
   V22.0 INTEGRAL :: tanda-g3-componentes.css
   Estilos para TODOS los componentes nuevos de la tanda G3:
   - PrecioMultiUnidad (.g3-pmu)
   - MargenBadge (.g3-mbg)
   - UpdateBtnTopbar (.g3-ubt)
   - HistorialPreciosUnificado (.g3-hp)
   - FichaCliente (.g3-fc)
   - SucursalDetalle (.g3-sd)
   ============================================================================ */


/* ─────────────────────────────────────────────────────────────────────────
   PRECIO MULTI UNIDAD
   ───────────────────────────────────────────────────────────────────────── */
.g3-pmu {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: 1.1;
}
.g3-pmu-compact {
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
}
.g3-pmu-main {
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.g3-pmu-money {
    font-weight: 800;
    font-size: 1em;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
}
.g3-pmu-unit {
    font-size: 0.75em;
    color: #94a3b8;
    font-weight: 600;
}
.g3-pmu-alt {
    display: flex;
    align-items: baseline;
    gap: 2px;
    opacity: 0.7;
}
.g3-pmu-alt-money {
    font-size: 0.78em;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
}
.g3-pmu-alt-unit {
    font-size: 0.7em;
    color: #94a3b8;
}


/* ─────────────────────────────────────────────────────────────────────────
   MARGEN BADGE
   ───────────────────────────────────────────────────────────────────────── */
.g3-mbg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    border: 1px solid transparent;
    cursor: help;
}
.g3-mbg-compact {
    padding: 1px 6px;
    font-size: 0.7em;
}
.g3-mbg-low { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.g3-mbg-mid { background: rgba(251, 191, 36, 0.15); color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); }
.g3-mbg-high { background: rgba(34, 197, 94, 0.15); color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
.g3-mbg-na { background: rgba(148, 163, 184, 0.1); color: #94a3b8; border-color: rgba(148, 163, 184, 0.2); }
.g3-mbg-ico { font-size: 0.9em; }
.g3-mbg-lbl { font-size: 0.85em; opacity: 0.85; font-weight: 600; }


/* ─────────────────────────────────────────────────────────────────────────
   UPDATE BTN TOPBAR (mini boton actualizar al lado del avatar)
   ───────────────────────────────────────────────────────────────────────── */
.g3-ubt {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.g3-ubt-idle {
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.3);
    animation: g3UbtPulseIdle 3s ease-in-out infinite;
}
.g3-ubt-idle:hover {
    background: rgba(251, 191, 36, 0.25);
    color: #fde68a;
    transform: translateY(-1px);
}
.g3-ubt-nueva {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    border-color: #991b1b;
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.4);
    animation: g3UbtPulseNueva 1.2s ease-in-out infinite;
}
.g3-ubt-nueva:hover {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.7);
    transform: translateY(-1px);
}
.g3-ubt-ico {
    font-size: 1.1em;
    line-height: 1;
}
.g3-ubt-txt {
    letter-spacing: 0.4px;
    font-size: 11px;
}
@keyframes g3UbtPulseIdle {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0); }
}
@keyframes g3UbtPulseNueva {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}


/* ─────────────────────────────────────────────────────────────────────────
   HISTORIAL PRECIOS UNIFICADO
   ───────────────────────────────────────────────────────────────────────── */
.g3-hp-page { padding: 16px; max-width: 1400px; margin: 0 auto; }
.g3-hp-sub { color: #94a3b8; font-size: 0.95em; margin: 4px 0 0; }
.g3-hp-codigo { font-family: 'JetBrains Mono', monospace; background: rgba(148, 163, 184, 0.1); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; color: #cbd5e1; margin-left: 8px; }
.g3-hp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.g3-hp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.g3-hp-stat-card { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(148, 163, 184, 0.15); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.g3-hp-stat-lbl { font-size: 0.75em; color: #94a3b8; text-transform: uppercase; font-weight: 600; letter-spacing: 0.4px; }
.g3-hp-stat-val { font-size: 1.4em; font-weight: 800; color: #f8fafc; font-variant-numeric: tabular-nums; }
.g3-hp-empty { background: rgba(15, 23, 42, 0.4); border: 1px dashed rgba(148, 163, 184, 0.2); border-radius: 8px; padding: 32px; text-align: center; color: #94a3b8; }
.g3-hp-empty p { font-size: 1.2em; margin: 0 0 8px; }
.g3-hp-table-wrap { background: rgba(15, 23, 42, 0.4); border-radius: 8px; padding: 8px; overflow-x: auto; }
.g3-hp-table { width: 100%; }
.g3-hp-link { color: #93c5fd; text-decoration: none; }
.g3-hp-link:hover { color: #bfdbfe; text-decoration: underline; }
.g3-hp-delta-up { color: #fca5a5; font-weight: 700; font-variant-numeric: tabular-nums; }
.g3-hp-delta-down { color: #86efac; font-weight: 700; font-variant-numeric: tabular-nums; }
.g3-hp-delta-zero { color: #94a3b8; font-variant-numeric: tabular-nums; }


/* ─────────────────────────────────────────────────────────────────────────
   FICHA CLIENTE
   ───────────────────────────────────────────────────────────────────────── */
.g3-fc-page { padding: 16px; max-width: 1200px; margin: 0 auto; }
.g3-fc-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.g3-fc-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #1e40af); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.6em; font-weight: 800; flex-shrink: 0; }
.g3-fc-name { flex: 1; min-width: 200px; }
.g3-fc-name h1 { margin: 0; color: #f8fafc; }
.g3-fc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.g3-fc-tag { padding: 3px 10px; border-radius: 10px; font-size: 0.75em; font-weight: 700; letter-spacing: 0.3px; }
.g3-fc-tag-manolito { background: rgba(251, 191, 36, 0.2); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.4); }
.g3-fc-tag-jubilado { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.4); }
.g3-fc-tag-incompleto { background: rgba(251, 146, 60, 0.2); color: #fdba74; border: 1px solid rgba(251, 146, 60, 0.4); }
.g3-fc-tag-inactivo { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.g3-fc-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; color: #cbd5e1; font-size: 0.9em; }
.g3-fc-tabs { display: flex; gap: 4px; border-bottom: 1px solid rgba(148, 163, 184, 0.2); margin-bottom: 16px; flex-wrap: wrap; }
.g3-fc-tab { background: transparent; border: none; padding: 10px 16px; color: #94a3b8; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s ease; }
.g3-fc-tab:hover { color: #cbd5e1; }
.g3-fc-tab-on { color: #f8fafc; border-bottom-color: #3b82f6; }
.g3-fc-content { background: rgba(15, 23, 42, 0.4); border-radius: 8px; padding: 16px; min-height: 200px; }
.g3-fc-content h2 { margin: 0 0 16px; color: #f8fafc; }
.g3-fc-empty { background: rgba(15, 23, 42, 0.4); border: 1px dashed rgba(148, 163, 184, 0.2); border-radius: 8px; padding: 32px; text-align: center; color: #94a3b8; }
.g3-fc-table { width: 100%; }
.g3-fc-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.g3-fc-stat-card { background: rgba(15, 23, 42, 0.5); border: 1px solid rgba(148, 163, 184, 0.15); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.g3-fc-stat-lbl { font-size: 0.75em; color: #94a3b8; text-transform: uppercase; font-weight: 600; letter-spacing: 0.4px; }
.g3-fc-stat-val { font-size: 1.5em; font-weight: 800; color: #f8fafc; font-variant-numeric: tabular-nums; }
.g3-fc-contact { display: flex; flex-direction: column; gap: 12px; }
.g3-fc-contact-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.1); }
.g3-fc-contact-lbl { min-width: 140px; color: #94a3b8; font-weight: 600; }
.g3-fc-contact-val { color: #f8fafc; }
.g3-fc-contact-val a { color: #93c5fd; text-decoration: none; }
.g3-fc-contact-val a:hover { text-decoration: underline; }
.g3-link-ficha { color: #93c5fd !important; text-decoration: none; font-weight: 600; }
.g3-link-ficha:hover { color: #bfdbfe !important; text-decoration: underline; }


/* ─────────────────────────────────────────────────────────────────────────
   SUCURSAL DETALLE
   ───────────────────────────────────────────────────────────────────────── */
.g3-sd-page { padding: 16px; max-width: 1400px; margin: 0 auto; }
.g3-sd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.g3-sd-title h1 { margin: 0; color: #f8fafc; }
.g3-sd-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.g3-sd-tag { padding: 3px 10px; border-radius: 10px; font-size: 0.78em; font-weight: 700; background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.25); }
.g3-sd-tag-tipo { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.4); }
.g3-sd-tag-on { background: rgba(34, 197, 94, 0.2); color: #86efac; border-color: rgba(34, 197, 94, 0.4); }
.g3-sd-tag-off { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
.g3-sd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.g3-sd-kpi { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(148, 163, 184, 0.15); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.g3-sd-kpi-lbl { font-size: 0.7em; color: #94a3b8; text-transform: uppercase; font-weight: 600; letter-spacing: 0.4px; }
.g3-sd-kpi-val { font-size: 1.6em; font-weight: 800; color: #f8fafc; font-variant-numeric: tabular-nums; }
.g3-sd-kpi-val.g3-sd-kpi-warn { color: #fca5a5; }
.g3-sd-kpi-sub { font-size: 0.75em; color: #94a3b8; }
.g3-sd-block { background: rgba(15, 23, 42, 0.4); border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.g3-sd-block h2 { margin: 0 0 14px; color: #f8fafc; font-size: 1.15em; }
.g3-sd-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px; }
.g3-sd-info-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.08); }
.g3-sd-info-lbl { min-width: 120px; color: #94a3b8; font-weight: 600; }
.g3-sd-info-val { color: #f8fafc; }
.g3-sd-info-val a { color: #93c5fd; text-decoration: none; }
.g3-sd-info-val a:hover { text-decoration: underline; }
.g3-sd-horarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.g3-sd-hrw { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: rgba(0, 0, 0, 0.3); border-radius: 6px; border-left: 2px solid #3b82f6; }
.g3-sd-hrw span:first-child { font-size: 0.7em; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.g3-sd-hrw span:last-child { color: #f8fafc; font-size: 0.95em; font-family: 'JetBrains Mono', monospace; }
.g3-sd-modulos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.g3-sd-mod { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(148, 163, 184, 0.15); }
.g3-sd-mod.on { border-color: rgba(34, 197, 94, 0.4); }
.g3-sd-mod.off { opacity: 0.5; }
.g3-sd-mod-ico { font-size: 1.1em; }
.g3-sd-mod span:nth-child(2) { flex: 1; color: #f8fafc; font-weight: 600; }
.g3-sd-mod-state { font-size: 0.7em; padding: 2px 8px; border-radius: 10px; font-weight: 800; letter-spacing: 0.5px; }
.g3-sd-mod.on .g3-sd-mod-state { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.g3-sd-mod.off .g3-sd-mod-state { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.g3-sd-hint { margin-top: 12px; color: #94a3b8; font-size: 0.85em; }
.g3-sd-hint a { color: #93c5fd; }
.g3-sd-notas { color: #cbd5e1; line-height: 1.6; white-space: pre-wrap; }


/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE MOBILE (<768px)
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .g3-fc-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .g3-fc-tab { white-space: nowrap; padding: 10px 12px; font-size: 0.85em; }
    .g3-fc-contact-lbl { min-width: 100px; font-size: 0.85em; }
    .g3-sd-info-lbl { min-width: 100px; font-size: 0.85em; }
    .g3-hp-stats, .g3-fc-stats-grid, .g3-sd-kpis { grid-template-columns: repeat(2, 1fr); }
    .g3-ubt-txt { display: none; } /* en mobile solo el icono */
    .g3-pmu { font-size: 0.95em; }
}
