/* CSS/nomina.css — Módulo de Nómina y RRHH.
   Usa los tokens del sistema (--card-bg, --card-border, --primary-color...) para funcionar en claro y oscuro. */

/* ================================================================ */
/* 1. ESTRUCTURA GENERAL                                            */
/* ================================================================ */
.nm-root { display: flex; flex-direction: column; gap: 1.1rem; }
.nm-root, .nm-overlay { --nm-violet: #7c4dff; --nm-teal: #14b8a6; --nm-amber: #f59e0b; --nm-red: var(--danger-color, #dc3545); --nm-green: #16a34a; --nm-soft: rgba(128, 128, 128, 0.12); }

.nm-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nm-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.nm-title h2 { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.01em; }
.nm-title p { margin: 3px 0 0; color: var(--text-secondary); font-size: 0.92rem; }
.nm-title-icon {
    width: 54px; height: 54px; flex-shrink: 0; border-radius: 17px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, #0d6efd, #7c4dff); box-shadow: 0 10px 26px rgba(13, 110, 253, 0.35);
}
.nm-title-icon .lucide { width: 26px; height: 26px; }
.nm-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Botones */
.nm-btn, .nm-overlay .nm-btn {
    height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--card-bg);
    color: var(--text-primary); font: inherit; font-size: 0.9rem; font-weight: 700; display: inline-flex; align-items: center;
    justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.nm-btn .lucide { width: 17px; height: 17px; flex-shrink: 0; }
.nm-btn:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(13, 110, 253, 0.5); }
.nm-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.nm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.nm-btn:focus-visible, .nm-icon-btn:focus-visible, .nm-input:focus-visible { outline: 2px solid #0d6efd; outline-offset: 2px; }
.nm-btn.primary { background: linear-gradient(135deg, #0d6efd, #3b82f6); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(13, 110, 253, 0.32); }
.nm-btn.success { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(22, 163, 74, 0.3); }
.nm-btn.danger-solid { background: linear-gradient(135deg, #dc3545, #ef4444); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(220, 53, 69, 0.3); }
.nm-btn.sm { height: 34px; padding: 0 12px; font-size: 0.8rem; border-radius: 10px; }
.nm-btn.lg { height: 50px; padding: 0 26px; font-size: 1rem; border-radius: 14px; }
.nm-icon-btn {
    width: 34px; height: 34px; border-radius: 10px; border: none; background: transparent; color: var(--text-secondary);
    display: inline-grid; place-items: center; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease;
}
.nm-icon-btn .lucide { width: 18px; height: 18px; }
.nm-icon-btn:hover { background: var(--nm-soft); color: var(--text-primary); }
.nm-icon-btn.danger:hover { background: rgba(220, 53, 69, 0.14); color: var(--danger-color); }

/* Franja de ley y banners */
.nm-law-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.nm-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 0.78rem;
    background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text-secondary);
}
.nm-chip b { color: var(--text-primary); font-weight: 700; }
.nm-chip .lucide { width: 14px; height: 14px; color: var(--primary-color); }

.nm-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; border: 1px solid; }
.nm-banner > .lucide { width: 22px; height: 22px; flex-shrink: 0; }
.nm-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--text-primary); }
.nm-banner div span { color: var(--text-secondary); font-size: 0.8rem; }
.nm-banner.warn { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.4); }
.nm-banner.warn > .lucide { color: var(--nm-amber); }
.nm-banner.info { background: rgba(13, 110, 253, 0.08); border-color: rgba(13, 110, 253, 0.3); margin-bottom: 14px; }
.nm-banner.info > .lucide { color: var(--primary-color); }

/* Pestañas */
.nm-tabs { display: inline-flex; gap: 4px; padding: 5px; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--card-border); align-self: flex-start; max-width: 100%; overflow-x: auto; }
.nm-tabs button {
    height: 38px; padding: 0 16px; border: none; border-radius: 10px; background: transparent; color: var(--text-secondary);
    font: inherit; font-size: 0.88rem; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nm-tabs button .lucide { width: 17px; height: 17px; }
.nm-tabs button:hover { color: var(--text-primary); }
.nm-tabs button.active { background: linear-gradient(135deg, #0d6efd, #3b82f6); color: #fff; box-shadow: 0 4px 14px rgba(13, 110, 253, 0.3); }

/* ================================================================ */
/* 2. PANEL: KPIs, TARJETAS                                         */
/* ================================================================ */
.nm-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.nm-kpis.three { grid-template-columns: repeat(3, 1fr); }
.nm-kpi {
    position: relative; overflow: hidden; padding: 18px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--card-border);
    display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: transform 0.2s ease, border-color 0.2s ease;
}
.nm-kpi::after {
    content: ''; position: absolute; right: -36px; top: -36px; width: 130px; height: 130px; border-radius: 50%;
    background: radial-gradient(circle, var(--c) 0%, transparent 70%); opacity: 0.16; pointer-events: none;
}
.nm-kpi:hover { transform: translateY(-2px); border-color: var(--c); }
.nm-kpi-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); margin-bottom: 8px; }
.nm-kpi-ico .lucide { width: 20px; height: 20px; }
.nm-kpi-l { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.nm-kpi-v { font-size: 1.55rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.nm-kpi-s { font-size: 0.78rem; color: var(--text-secondary); }

.nm-two { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; margin-bottom: 14px; }
.nm-two-b { grid-template-columns: 1.6fr 1fr; }
.nm-card { padding: 20px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--card-border); min-width: 0; }
.nm-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.nm-card-h h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--text-primary); display: flex; align-items: center; gap: 9px; }
.nm-card-h h3 .lucide { width: 19px; height: 19px; color: var(--primary-color); }
.nm-count-pill { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--nm-amber); color: #000; font-size: 0.75rem; font-weight: 800; display: grid; place-items: center; }
.nm-lead { margin: 0 0 14px; color: var(--text-secondary); font-size: 0.92rem; }
.nm-lead b { color: var(--text-primary); }
.nm-hl { color: var(--primary-color) !important; font-size: 1.25rem; }
.nm-muted { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.5; margin: 0; }
.nm-muted.small { font-size: 0.78rem; }

/* Barra de composición */
.nm-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--nm-soft); gap: 2px; }
.nm-bar.thin { height: 8px; margin-top: 12px; }
.nm-bar span { display: block; height: 100%; min-width: 3px; transition: width 0.6s cubic-bezier(0.3, 1, 0.4, 1); }
.nm-legend { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 9px; }
.nm-legend li { display: grid; grid-template-columns: 12px 1fr auto 52px; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text-secondary); }
.nm-legend i { width: 12px; height: 12px; border-radius: 4px; }
.nm-legend b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.nm-legend em { font-style: normal; text-align: right; font-size: 0.78rem; opacity: 0.8; }

/* Alertas */
.nm-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nm-alerts li { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 13px; border: 1px solid; }
.nm-alerts li > .lucide { width: 20px; height: 20px; flex-shrink: 0; }
.nm-alerts li div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nm-alerts strong { font-size: 0.85rem; color: var(--text-primary); }
.nm-alerts span { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.35; }
.nm-alerts li.error { background: rgba(220, 53, 69, 0.08); border-color: rgba(220, 53, 69, 0.35); } .nm-alerts li.error > .lucide { color: var(--danger-color); }
.nm-alerts li.warn { background: rgba(245, 158, 11, 0.09); border-color: rgba(245, 158, 11, 0.35); } .nm-alerts li.warn > .lucide { color: var(--nm-amber); }
.nm-alerts li.info { background: rgba(13, 110, 253, 0.07); border-color: rgba(13, 110, 253, 0.25); } .nm-alerts li.info > .lucide { color: var(--primary-color); }
.nm-allgood { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: rgba(22, 163, 74, 0.09); border: 1px solid rgba(22, 163, 74, 0.3); }
.nm-allgood > .lucide { width: 30px; height: 30px; color: var(--nm-green); }
.nm-allgood div { display: flex; flex-direction: column; } .nm-allgood strong { color: var(--text-primary); } .nm-allgood span { font-size: 0.82rem; color: var(--text-secondary); }

/* Obligaciones */
.nm-obs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nm-obs li { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 13px; background: var(--nm-soft); }
.nm-date { width: 48px; height: 52px; flex-shrink: 0; border-radius: 12px; background: var(--card-bg); border: 1px solid var(--card-border); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.nm-date b { font-size: 0.62rem; letter-spacing: 0.08em; color: var(--primary-color); }
.nm-date span { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); }
.nm-ob-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nm-ob-t strong { font-size: 0.87rem; color: var(--text-primary); }
.nm-ob-t span { font-size: 0.76rem; color: var(--text-secondary); line-height: 1.35; }
.nm-due { flex-shrink: 0; padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; }
.nm-due.red { background: rgba(220, 53, 69, 0.15); color: var(--danger-color); }
.nm-due.amber { background: rgba(245, 158, 11, 0.18); color: #b7791f; }
.nm-due.gray { background: var(--nm-soft); color: var(--text-secondary); }
body.dark-mode .nm-due.amber { color: var(--nm-amber); }

/* Tip */
.nm-card-tip { justify-content: center; background: linear-gradient(160deg, rgba(13, 110, 253, 0.14), rgba(124, 77, 255, 0.14)); border-color: rgba(124, 77, 255, 0.3); display: flex; flex-direction: column; gap: 8px; }
.nm-tip-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0d6efd, #7c4dff); }
.nm-tip-ico .lucide { width: 22px; height: 22px; }
.nm-tip-k { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--nm-violet); }
.nm-card-tip h4 { margin: 0; font-size: 1.05rem; color: var(--text-primary); }
.nm-card-tip p { margin: 0 0 6px; font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary); }
.nm-card-tip small { font-size: 0.7rem; color: var(--text-secondary); opacity: 0.8; }
.nm-tip-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================================================================ */
/* 3. EQUIPO                                                        */
/* ================================================================ */
.nm-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 12px; }
.nm-toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }
.nm-search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.nm-search .lucide { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-secondary); pointer-events: none; }
.nm-search input {
    width: 100%; height: 44px; border-radius: 12px; padding: 0 14px 0 42px; border: 1px solid var(--input-border);
    background: var(--card-bg); color: var(--text-primary); font: inherit; font-size: 0.9rem;
}
.nm-search input:focus { outline: 2px solid #0d6efd; outline-offset: 1px; }

.nm-team { display: grid; gap: 10px; }
.nm-row {
    display: grid; grid-template-columns: minmax(230px, 2.2fr) minmax(130px, 1fr) minmax(110px, 0.9fr) minmax(120px, 0.9fr) auto;
    align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--card-bg); border: 1px solid var(--card-border);
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.nm-row:hover { transform: translateY(-1px); border-color: rgba(13, 110, 253, 0.4); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }
.nm-row.is-off { opacity: 0.6; }
.nm-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nm-avatar {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.9rem;
    background: linear-gradient(135deg, hsl(var(--h) 75% 52%), hsl(calc(var(--h) + 40) 75% 42%));
}
.nm-person-t { display: flex; flex-direction: column; min-width: 0; }
.nm-person-t strong { color: var(--text-primary); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm-person-t span { color: var(--text-secondary); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nm-cell small { font-size: 0.72rem; color: var(--text-secondary); }
.nm-cell strong { font-size: 0.95rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.nm-cell.nm-num small { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.66rem; }
.nm-row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.nm-row-actions .nm-btn { margin-right: 6px; }

.nm-badge { align-self: flex-start; padding: 4px 10px; border-radius: 8px; font-size: 0.7rem; font-weight: 800; }
.nm-badge.blue { background: rgba(13, 110, 253, 0.14); color: #4d94ff; }
.nm-badge.amber { background: rgba(245, 158, 11, 0.16); color: #d98a06; }
.nm-badge.violet { background: rgba(124, 77, 255, 0.16); color: #9a78ff; }
.nm-badge.gray { background: var(--nm-soft); color: var(--text-secondary); }
.nm-badge.teal { background: rgba(20, 184, 166, 0.16); color: #0f9a8b; }
.nm-badge.red { background: rgba(220, 53, 69, 0.14); color: #e5525f; }
.nm-paid { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: rgba(22, 163, 74, 0.14); color: var(--nm-green); font-size: 0.72rem; font-weight: 800; margin-right: 6px; }
.nm-paid .lucide { width: 14px; height: 14px; }
.nm-paid.off { background: var(--nm-soft); color: var(--text-secondary); }

/* Sin colaboradores: solo el estado vacío */
.nm-root.is-empty #nm-kpis, .nm-root.is-empty .nm-two, .nm-root.is-empty .nm-toolbar { display: none; }

/* Estado vacío */
.nm-empty { text-align: center; padding: 3rem 1.5rem; border-radius: 22px; border: 2px dashed var(--card-border); background: var(--card-bg); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.nm-empty.slim { padding: 2rem 1rem; gap: 4px; }
.nm-empty h3 { margin: 0; font-size: 1.3rem; color: var(--text-primary); }
.nm-empty p { margin: 0; color: var(--text-secondary); max-width: 460px; font-size: 0.92rem; line-height: 1.5; }
.nm-empty-art { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0d6efd, #7c4dff); box-shadow: 0 14px 34px rgba(13, 110, 253, 0.35); animation: nmFloat 3.2s ease-in-out infinite; }
.nm-empty-art .lucide { width: 40px; height: 40px; }
.nm-empty-list { list-style: none; padding: 0; margin: 4px 0 10px; display: grid; gap: 6px; text-align: left; }
.nm-empty-list li { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 0.88rem; }
.nm-empty-list .lucide { width: 16px; height: 16px; color: var(--nm-green); }
@keyframes nmFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* ================================================================ */
/* 4. TABLAS (prestaciones, historial, masiva)                       */
/* ================================================================ */
.nm-table-wrap { border: 1px solid var(--card-border); border-radius: 16px; background: var(--card-bg); overflow-x: auto; margin: 14px 0; }
.nm-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.nm-table th { padding: 13px 14px; text-align: left; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); background: var(--input-bg); border-bottom: 1px solid var(--card-border); white-space: nowrap; }
.nm-table td { padding: 12px 14px; border-bottom: 1px solid var(--card-border); color: var(--text-primary); font-size: 0.88rem; vertical-align: middle; font-variant-numeric: tabular-nums; }
.nm-table tr:last-child td { border-bottom: none; }
.nm-table tbody tr:hover td { background: var(--nm-soft); }
.nm-table .r { text-align: right; }
.nm-table td small { display: block; color: var(--text-secondary); font-size: 0.72rem; }
.nm-table td.pos { color: var(--nm-green); } .nm-table td.neg { color: var(--danger-color); }
.nm-table tr.is-off td { opacity: 0.55; }

.nm-hero-card { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: center; background: linear-gradient(135deg, rgba(124, 77, 255, 0.14), rgba(13, 110, 253, 0.1)); border-color: rgba(124, 77, 255, 0.3); }
.nm-hero-v { display: block; font-size: 2.4rem; font-weight: 900; letter-spacing: -0.03em; color: var(--text-primary); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.nm-mini-grid, .nm-pila-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.nm-mini-grid div, .nm-pila-grid div { padding: 12px; border-radius: 13px; background: var(--card-bg); border: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 2px; }
.nm-mini-grid small, .nm-pila-grid small { font-size: 0.7rem; color: var(--text-secondary); }
.nm-mini-grid b, .nm-pila-grid b { font-size: 1rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.nm-pila-grid { grid-template-columns: repeat(3, 1fr); }
.nm-pila-total { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--card-border); }
.nm-pila-total small { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); font-weight: 700; }
.nm-pila-total strong { font-size: 1.8rem; font-weight: 900; color: var(--text-primary); }
.nm-pila .nm-muted { margin-top: 10px; }
.nm-hist-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.nm-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 6px; }
.nm-info { display: flex; gap: 12px; padding: 14px; border-radius: 15px; background: var(--card-bg); border: 1px solid var(--card-border); }
.nm-info > .lucide { width: 22px; height: 22px; flex-shrink: 0; color: var(--primary-color); margin-top: 2px; }
.nm-info div { display: flex; flex-direction: column; gap: 3px; } .nm-info strong { font-size: 0.88rem; color: var(--text-primary); } .nm-info span { font-size: 0.76rem; color: var(--text-secondary); line-height: 1.45; }

/* ================================================================ */
/* 5. MODALES                                                       */
/* ================================================================ */
body.nm-lock { overflow: hidden; }
.nm-overlay {
    position: fixed; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 20px;
    background: rgba(6, 8, 18, 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.2s ease;
}
.nm-overlay:not(:empty) { display: flex; }
.nm-overlay.open { opacity: 1; }
.nm-overlay * { box-sizing: border-box; }

.nm-sheet {
    width: min(1040px, 100%); max-height: min(92vh, 900px); display: flex; flex-direction: column; border-radius: 24px; overflow: hidden;
    background: var(--view-bg-color, var(--card-bg)); border: 1px solid var(--card-border); color: var(--text-primary);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); transform: translateY(18px) scale(0.98); transition: transform 0.28s cubic-bezier(0.3, 1.2, 0.5, 1);
}
.nm-overlay.open .nm-sheet { transform: none; }
.nm-sheet.sm { width: min(440px, 100%); } .nm-sheet.md { width: min(720px, 100%); } .nm-sheet.wide { width: min(1120px, 100%); }
.nm-sheet-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--card-border); background: var(--card-bg); flex-shrink: 0; }
.nm-sheet-head h3 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--text-primary); }
.nm-sheet-head > div > span { font-size: 0.8rem; color: var(--text-secondary); }
.nm-sheet-head h3 > span { font-size: inherit; color: inherit; }
.nm-sheet-head > div:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nm-sheet-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0d6efd, #7c4dff); flex-shrink: 0; }
.nm-sheet-ico .lucide { width: 21px; height: 21px; }
.nm-sheet-head .close { margin-left: auto; }
.nm-sheet-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; padding: 22px; overflow-y: auto; flex: 1; min-height: 0; }
.nm-sheet-body.single { grid-template-columns: minmax(0, 1fr); }
.nm-sheet-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--card-border); background: var(--card-bg); flex-shrink: 0; flex-wrap: wrap; }
.nm-foot-note { margin-right: auto; display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; color: var(--nm-amber); }
.nm-foot-note.ok { color: var(--text-primary); }
.nm-foot-note .lucide { width: 16px; height: 16px; }

/* Formularios */
.nm-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.nm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nm-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.nm-grid2.tight { gap: 10px; }
.span2 { grid-column: span 2; }
.nm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nm-field.inline { flex-direction: row; align-items: center; gap: 10px; }
.nm-field.inline .nm-input { width: auto; min-width: 200px; }
.nm-field label { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); display: flex; flex-direction: column; gap: 1px; }
.nm-field label small { font-weight: 500; font-size: 0.7rem; opacity: 0.8; }
.nm-input {
    width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--input-border); background: var(--input-bg);
    color: var(--text-primary); font: inherit; font-size: 0.92rem; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.nm-input:focus { outline: none; border-color: #0d6efd; box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2); }
.nm-input.big { height: 54px; font-size: 1.4rem; font-weight: 800; }
.nm-input.xs { width: 72px; height: 36px; padding: 0 8px; text-align: center; }
.nm-money { position: relative; }
.nm-money > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--text-secondary); pointer-events: none; }
.nm-money .nm-input { padding-left: 30px; }
.nm-inline { display: flex; gap: 10px; }
.nm-sec { margin: 8px 0 0; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--primary-color); display: flex; align-items: center; gap: 10px; }
.nm-sec::after { content: ''; flex: 1; height: 1px; background: var(--card-border); }
.nm-salary { padding: 14px; border-radius: 16px; background: rgba(13, 110, 253, 0.07); border: 1px solid rgba(13, 110, 253, 0.25); }
.nm-salary label { color: var(--primary-color); }
.nm-check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 13px; border: 1px solid var(--card-border); background: var(--card-bg); cursor: pointer; }
.nm-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: #0d6efd; flex-shrink: 0; }
.nm-check span { display: flex; flex-direction: column; gap: 2px; font-size: 0.86rem; color: var(--text-primary); }
.nm-check small { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.4; }
.nm-more { border: 1px solid var(--card-border); border-radius: 14px; background: var(--card-bg); }
.nm-more > summary { list-style: none; cursor: pointer; padding: 12px 14px; font-size: 0.85rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.nm-more > summary::-webkit-details-marker { display: none; }
.nm-more > summary .lucide { width: 16px; height: 16px; transition: transform 0.2s ease; }
.nm-more[open] > summary .lucide { transform: rotate(90deg); }
.nm-more > summary small { margin-left: auto; font-weight: 500; color: var(--text-secondary); }
.nm-more > .nm-grid2, .nm-more > .nm-grid3 { padding: 0 14px 14px; }
.ef-ret { display: flex; flex-direction: column; gap: 12px; }

/* Panel lateral: radiografía / desprendible */
.nm-side { min-width: 0; align-self: start; position: sticky; top: 0; }
.nm-side-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 34px 20px; border-radius: 20px; border: 2px dashed var(--card-border); color: var(--text-secondary); font-size: 0.85rem; }
.nm-side-empty .lucide { width: 34px; height: 34px; color: var(--primary-color); }
.nm-side-empty strong { color: var(--text-primary); }
.nm-rx { padding: 20px; border-radius: 20px; background: var(--card-bg); border: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 6px; }
.nm-rx-k { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }
.nm-rx-v { font-size: 2rem; font-weight: 900; letter-spacing: -0.03em; color: var(--text-primary); line-height: 1.1; font-variant-numeric: tabular-nums; }
.nm-rx-s { font-size: 0.78rem; color: var(--text-secondary); }
.nm-sep { height: 1px; background: var(--card-border); margin: 10px 0 4px; }
.nm-grp { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.nm-grp i { width: 10px; height: 10px; border-radius: 3px; } .nm-grp em { margin-left: auto; font-style: normal; padding: 2px 8px; border-radius: 999px; background: rgba(22, 163, 74, 0.15); color: var(--nm-green); font-size: 0.64rem; }
.nm-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 0.85rem; color: var(--text-secondary); }
.nm-line span { min-width: 0; } .nm-line span small { display: block; font-size: 0.7rem; opacity: 0.85; }
.nm-line b { color: var(--text-primary); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nm-line.neg b { color: var(--danger-color); } .nm-line.sub { font-size: 0.78rem; font-style: italic; }
.nm-line.hl { padding: 8px 10px; margin-top: 6px; border-radius: 10px; background: rgba(245, 158, 11, 0.12); }
.nm-line.total { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--card-border); } .nm-line.total span, .nm-line.total b { color: var(--text-primary); font-weight: 800; }
.nm-rx-net { padding: 14px; border-radius: 15px; background: linear-gradient(135deg, rgba(22, 163, 74, 0.16), rgba(20, 184, 166, 0.12)); border: 1px solid rgba(22, 163, 74, 0.3); display: flex; flex-direction: column; gap: 2px; }
.nm-rx-net span { font-size: 0.74rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.nm-rx-net strong { font-size: 1.6rem; font-weight: 900; color: var(--nm-green); font-variant-numeric: tabular-nums; }
.nm-rx-net small { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.4; }

.nm-slip { display: flex; flex-direction: column; gap: 10px; }
.nm-slip-sec { padding: 14px 16px; border-radius: 16px; background: var(--card-bg); border: 1px solid var(--card-border); }
.nm-slip-sec h5 { margin: 0 0 6px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary-color); }
.nm-net { padding: 16px 18px; border-radius: 18px; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: linear-gradient(135deg, #16a34a, #0f9a8b); box-shadow: 0 10px 28px rgba(22, 163, 74, 0.3); }
.nm-net span { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.9; }
.nm-net strong { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.nm-det { border: 1px solid var(--card-border); border-radius: 13px; background: var(--card-bg); padding: 0 14px; }
.nm-det > summary { cursor: pointer; padding: 11px 0; font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.nm-det[open] { padding-bottom: 10px; } .nm-det p { margin: 6px 0 0; font-size: 0.75rem; line-height: 1.5; color: var(--text-secondary); }
.nm-notes { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.nm-notes li { display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: 11px; font-size: 0.76rem; line-height: 1.4; color: var(--text-secondary); background: var(--nm-soft); }
.nm-notes li .lucide { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; color: var(--primary-color); }
.nm-notes li.warn .lucide { color: var(--nm-amber); } .nm-notes li.error { background: rgba(220, 53, 69, 0.1); } .nm-notes li.error .lucide { color: var(--danger-color); }

/* Éxito */
.nm-success { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 34px 28px; }
.nm-success h3 { margin: 6px 0 0; font-size: 1.4rem; color: var(--text-primary); } .nm-success p { margin: 0; color: var(--text-secondary); }
.nm-success strong { font-size: 2.2rem; font-weight: 900; color: var(--nm-green); letter-spacing: -0.02em; }
.nm-success > span { font-size: 0.82rem; color: var(--text-secondary); max-width: 300px; }
.nm-success-ico { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 0 0 10px rgba(22, 163, 74, 0.15); animation: nmPop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
.nm-success-ico .lucide { width: 38px; height: 38px; stroke-width: 3; }
.nm-success-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
@keyframes nmPop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.nm-spin { animation: nmSpin 1s linear infinite; } @keyframes nmSpin { to { transform: rotate(360deg); } }

/* ================================================================ */
/* 6. RESPONSIVO                                                    */
/* ================================================================ */
@media (max-width: 1100px) {
    .nm-kpis { grid-template-columns: repeat(2, 1fr); }
    .nm-info-grid { grid-template-columns: repeat(2, 1fr); }
    .nm-row { grid-template-columns: minmax(200px, 2fr) minmax(110px, 1fr) minmax(100px, 1fr) auto; }
    .nm-row .nm-cell:nth-child(4) { display: none; }
}
@media (max-width: 900px) {
    .nm-two, .nm-two-b, .nm-hero-card { grid-template-columns: 1fr; }
    .nm-sheet-body { grid-template-columns: 1fr; }
    .nm-side { position: static; }
}
@media (max-width: 768px) {
    .nm-title h2 { font-size: 1.25rem; } .nm-title-icon { width: 46px; height: 46px; border-radius: 14px; }
    .nm-actions { width: 100%; } .nm-actions .nm-btn { flex: 1; }
    .nm-kpis, .nm-kpis.three { grid-template-columns: 1fr; gap: 10px; }
    .nm-kpi { padding: 14px 16px; } .nm-kpi-v { font-size: 1.4rem; }
    .nm-tabs { width: 100%; } .nm-tabs button { flex: 1; padding: 0 10px; font-size: 0.8rem; }
    .nm-info-grid, .nm-pila-grid, .nm-mini-grid { grid-template-columns: 1fr 1fr; }
    .nm-row { grid-template-columns: 1fr 1fr; gap: 12px 10px; padding: 14px; }
    .nm-row .nm-person, .nm-row .nm-row-actions { grid-column: span 2; }
    .nm-row .nm-cell:nth-child(4) { display: flex; }
    .nm-row-actions { justify-content: flex-start; padding-top: 10px; border-top: 1px solid var(--card-border); }
    .nm-row-actions .nm-btn { flex: 1; margin-right: 4px; }
    .nm-toolbar { flex-direction: column; align-items: stretch; } .nm-search { max-width: none; } .nm-toolbar-right .nm-btn { flex: 1; }
    .nm-overlay { padding: 0; align-items: flex-end; }
    .nm-sheet, .nm-sheet.wide, .nm-sheet.md { width: 100%; max-height: 96dvh; border-radius: 22px 22px 0 0; transform: translateY(40px); }
    .nm-sheet.sm { border-radius: 22px 22px 0 0; }
    .nm-sheet-head, .nm-sheet-foot { padding: 14px 16px; } .nm-sheet-body { padding: 16px; gap: 16px; }
    .nm-grid2, .nm-grid3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
    .nm-sheet-foot .nm-btn { flex: 1; } .nm-foot-note { width: 100%; }
    .nm-rx-v { font-size: 1.7rem; } .nm-hero-v { font-size: 1.9rem; }
    .nm-legend li { grid-template-columns: 12px 1fr auto; } .nm-legend em { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .nm-empty-art, .nm-success-ico, .nm-spin { animation: none; }
    .nm-kpi, .nm-row, .nm-btn, .nm-sheet, .nm-overlay, .nm-bar span { transition: none; }
}

/* ---------- ¿De qué cuenta sale el pago? (pie de los formularios de pago y PILA) ---------- */
.nm-acc { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 260px; }
.nm-acc span { font-size: 0.8rem; font-weight: 800; color: var(--text-secondary); white-space: nowrap; }
.nm-acc select { min-width: 0; flex: 1 1 auto; min-height: 42px; font-weight: 700; }
.nm-sheet-foot .nm-acc { margin-left: auto; }
.nm-pila-pay { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
@media (max-width: 640px) {
    .nm-acc { flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 6px; }
    .nm-acc span { white-space: normal; }
    .nm-sheet-foot .nm-acc { margin-left: 0; }
    .nm-pila-pay { flex: 1 1 100%; flex-direction: column; align-items: stretch; }
}
