/* =============================================================
   MecsaERP — lo propio del ERP, encima de ds/shell.min.css
   Tokens y componentes: MecsaERP/replica/design (contraste AA revisado).
   Nunca un HEX en un componente: siempre var(--token).
   ============================================================= */

:root, :root[data-theme="light"] {
    --erp-border-input: #8c939d;
    --erp-focus: #013483;
    --erp-ok-text: #157347;    --erp-ok-bg: #e7f6ec;
    --erp-mal-text: #b42318;   --erp-mal-bg: #fdecec;
    --erp-alerta-text: #8a5300; --erp-alerta-bg: #fff4d6;
    --erp-info-text: #1d4ed8;  --erp-info-bg: #e8f0fe;
    --erp-neutro-text: #4b5563; --erp-neutro-bg: #f3f4f6;
    --ws-logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='10' fill='%23013483'/%3E%3Crect x='9' y='10' width='22' height='3' rx='1.5' fill='%23ffffff'/%3E%3Crect x='9' y='17' width='16' height='3' rx='1.5' fill='%23ffffff'/%3E%3Crect x='9' y='24' width='22' height='3' rx='1.5' fill='%23ffffff'/%3E%3Crect x='9' y='29.5' width='9' height='2.5' rx='1.25' fill='%23f29c2e'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
    --erp-border-input: #66758f;
    --erp-focus: #7ba4f4;
    --erp-ok-text: #6ee7a0;    --erp-ok-bg: #12301f;
    --erp-mal-text: #fca5a5;   --erp-mal-bg: #3a1717;
    --erp-alerta-text: #fcd34d; --erp-alerta-bg: #3a2c0b;
    --erp-info-text: #a5c3ff;  --erp-info-bg: #16274a;
    --erp-neutro-text: #b6c2d6; --erp-neutro-bg: #212c40;
}

body { background: var(--bg-app); color: var(--text); font-family: var(--gm-font); }
.form-control, .form-select { border-color: var(--erp-border-input); font-size: .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--erp-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--erp-focus) 18%, transparent); }
.form-label { font-size: .74rem; font-weight: 600; color: var(--text-2); margin-bottom: .3rem; }
:focus-visible { outline: 2px solid var(--erp-focus); outline-offset: 2px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.sub { display: block; font-size: .72rem; color: var(--text-muted); }

/* Pastillas de estado: ícono + texto, nunca solo color */
.pill { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--erp-neutro-bg); color: var(--erp-neutro-text); }
.pill.ok { background: var(--erp-ok-bg); color: var(--erp-ok-text); }
.pill.mal { background: var(--erp-mal-bg); color: var(--erp-mal-text); }
.pill.alerta { background: var(--erp-alerta-bg); color: var(--erp-alerta-text); }
.pill.info { background: var(--erp-info-bg); color: var(--erp-info-text); }

/* Sidebar: etapas que vienen */
.nav-link-gm.erp-pronto { opacity: .6; cursor: default; pointer-events: none; }
.nav-link-gm .etapa { margin-left: auto; font-size: .62rem; font-weight: 700; padding: .05rem .4rem; border-radius: 6px; background: var(--bg-surface-3); color: var(--text-muted); }

/* Topbar: sociedad */
.erp-sociedad { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text); border-radius: 10px; padding: .35rem .7rem; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.dropdown-item small { color: var(--text-muted); }

/* Avisos */
.erp-aviso { display: flex; gap: .7rem; align-items: center; background: var(--erp-alerta-bg); color: var(--erp-alerta-text); border-radius: 10px; padding: .6rem .9rem; font-size: .82rem; margin-bottom: 1.25rem; }
.erp-vacio { text-align: center; padding: 2.5rem 1rem; color: var(--text-2); }
.erp-vacio i { font-size: 1.8rem; color: var(--text-muted); margin-bottom: .75rem; display: block; }

/* Filas y tablas */
.erp-sin-anim tbody tr { animation: none !important; transform: none !important; }
.arbol .n1 { font-weight: 800; }
.arbol .n2 { font-weight: 700; padding-left: 1.5rem !important; }
.arbol .n3 { padding-left: 3rem !important; }
.arbol .n4 { padding-left: 4.5rem !important; }
.arbol .n5, .arbol .n6, .arbol .n7 { padding-left: 6rem !important; }
.tag { font-size: .62rem; font-weight: 700; padding: .05rem .4rem; border-radius: 6px; background: var(--bg-surface-3); color: var(--text-2); margin-left: .4rem; }

/* Pasos de la etapa 0 en el inicio */
.pasos { list-style: none; margin: 0; padding: 0; }
.pasos li { display: flex; gap: .8rem; align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.pasos li:last-child { border-bottom: none; }
.pasos .ico { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--erp-neutro-bg); color: var(--erp-neutro-text); }
.pasos .ico.ok { background: var(--erp-ok-bg); color: var(--erp-ok-text); }
.pasos .ico.alerta { background: var(--erp-alerta-bg); color: var(--erp-alerta-text); }
.pasos small { display: block; color: var(--text-muted); font-size: .76rem; }

/* Ingreso */
.erp-ingreso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; background: var(--bg-app); }
.erp-ingreso-caja { width: 100%; max-width: 400px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: 0 10px 28px var(--shadow); }
.erp-ingreso-caja h1 { font-size: 1.35rem; font-weight: 800; margin: 1.25rem 0 .25rem; color: var(--text); }
.erp-ingreso-sub, .erp-ingreso-pie { font-size: .82rem; color: var(--text-2); }
.erp-ingreso-pie { margin: 1.25rem 0 0; text-align: center; }
.erp-ingreso-marca { display: flex; align-items: center; gap: .7rem; }
.erp-ingreso-marca small { display: block; font-size: .72rem; color: var(--text-muted); }
.erp-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--ws-logo) center / cover no-repeat; display: inline-block; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
