/* ===================== EMPRESAS MODULE CSS ===================== */
.emp-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    font-family: 'Inter', sans-serif;
}

/* Hero */
.emp-hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    border-radius: 20px;
    padding: 2rem 2.5rem;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.emp-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.emp-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.5);
    display: block;
    margin-bottom: 0.5rem;
}
.emp-hero h2 {
    font-size: 1.5rem;
    font-weight: 900;
    margin: 0 0 0.5rem 0;
}
.emp-hero p {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.65);
    margin: 0;
    max-width: 600px;
    line-height: 1.5;
}
.emp-hero-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 240px;
}
.emp-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
}
.emp-hero-chip .material-symbols-outlined {
    font-size: 18px;
}

/* Toolbar */
.emp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.emp-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.emp-search-wrap > .material-symbols-outlined {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #94a3b8;
    pointer-events: none;
}
.emp-search-wrap input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    background: white;
    transition: border-color 0.2s;
    outline: none;
    box-sizing: border-box;
}
.emp-search-wrap input:focus {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.08);
}

/* Botones */
.emp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.emp-btn.primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}
.emp-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37,99,235,0.35);
}
.emp-btn.secondary {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}
.emp-btn.secondary:hover {
    background: #e2e8f0;
}
.emp-btn.ghost {
    background: transparent;
    color: #64748b;
}
.emp-btn.ghost:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.emp-btn.danger {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.emp-btn.danger:hover {
    background: #fecaca;
}
.emp-btn.small {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 8px;
}
.emp-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Stats */
.emp-stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 1.5rem;
}
.emp-stat {
    flex: 1;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.emp-stat strong {
    font-size: 1.8rem;
    font-weight: 900;
    color: #0f172a;
}
.emp-stat small {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid de tarjetas */
.emp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}
.emp-card {
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.emp-card:hover {
    border-color: var(--primary, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.1);
}
.emp-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.emp-card-icon .material-symbols-outlined {
    font-size: 24px;
    color: var(--primary, #2563eb);
}
.emp-card-body {
    flex: 1;
    min-width: 0;
}
.emp-card-body h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.emp-card-body > p {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
}
.emp-card-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.emp-card-kpis div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
}
.emp-card-kpis small {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
}
.emp-card-kpis strong {
    display: block;
    margin-top: 6px;
    font-size: 0.88rem;
    color: #0f172a;
}
.emp-card-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.emp-card-meta span {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.emp-card-arrow {
    color: #cbd5e1;
    font-size: 20px;
    flex-shrink: 0;
}

/* Empty state */
.emp-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #f8fafc;
    border-radius: 16px;
    border: 2px dashed #e2e8f0;
}
.emp-empty .material-symbols-outlined {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 0.8rem;
    display: block;
}
.emp-empty strong {
    display: block;
    font-size: 1rem;
    color: #475569;
    margin-bottom: 0.3rem;
}
.emp-empty p {
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
}
.emp-empty.small {
    padding: 1.5rem 1rem;
}
.emp-empty.small .material-symbols-outlined { font-size: 2rem; }

/* Formulario */
.emp-form-card {
    background: white;
    border: 2px solid var(--primary, #2563eb);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 24px rgba(37,99,235,0.08);
}
.emp-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.emp-form-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}
.emp-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
}
.emp-form-grid .full {
    grid-column: 1 / -1;
}
.emp-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}
.emp-field input,
.emp-field textarea,
.emp-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    background: #f8fafc;
    transition: border-color 0.2s;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}
.emp-field input:focus,
.emp-field textarea:focus,
.emp-field select:focus {
    border-color: var(--primary, #2563eb);
    background: white;
}
.emp-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Detalle */
.emp-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 10px;
}
.emp-detail-actions {
    display: flex;
    gap: 8px;
}
.emp-detail-card {
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 2rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    justify-content: space-between;
    flex-wrap: wrap;
}
.emp-detail-main {
    flex: 1;
    min-width: 240px;
}
.emp-detail-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.emp-detail-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.emp-detail-icon .material-symbols-outlined {
    font-size: 32px;
    color: var(--primary, #2563eb);
}
.emp-detail-card h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 900;
}
.emp-detail-card p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #64748b;
}
.emp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.74rem;
    font-weight: 800;
    border: 1px solid transparent;
}
.emp-badge.dark {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.emp-badge.success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}
.emp-badge.warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
.emp-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}
.emp-panel {
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 18px;
    padding: 1.2rem;
}
.emp-vendedores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.emp-vendedor-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 1rem;
}
.emp-vendedor-rank {
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.68rem;
    font-weight: 800;
    margin-bottom: 8px;
}
.emp-vendedor-card strong {
    display: block;
    font-size: 0.9rem;
    color: #0f172a;
}
.emp-vendedor-card span {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #64748b;
}
.emp-vendedor-total {
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 900;
    color: #0f172a;
}
.emp-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.emp-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
}
.emp-history-item strong {
    display: block;
    font-size: 0.86rem;
    color: #0f172a;
}
.emp-history-item p {
    margin: 4px 0 0;
    font-size: 0.76rem;
    color: #64748b;
}
.emp-history-metrics {
    text-align: right;
}
.emp-history-metrics span {
    display: block;
    font-size: 0.74rem;
    color: #64748b;
}
.emp-history-metrics strong {
    margin-top: 6px;
    font-size: 0.92rem;
}
.emp-history-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Sección */
.emp-section {
    margin-top: 1.5rem;
}
.emp-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 10px;
}
.emp-section-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}
.emp-section-head h3 .material-symbols-outlined {
    font-size: 22px;
    color: var(--primary, #2563eb);
}

/* Tabla pacientes */
.emp-patients-table-wrap {
    overflow-x: auto;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    background: white;
}
.emp-patients-table {
    width: 100%;
    border-collapse: collapse;
}
.emp-patients-table th {
    padding: 12px 14px;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    color: #64748b;
    background: #f8fafc;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.emp-patients-table td {
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}
.emp-patients-table tr:last-child td {
    border-bottom: none;
}
.emp-patients-table tr:hover {
    background: #f8fafc;
}
.emp-sales-table td .emp-badge {
    white-space: nowrap;
}
.emp-muted-row {
    margin-top: 4px;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}
.emp-table-wrap {
    overflow-x: auto;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    background: white;
}
.emp-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}
.emp-sales-table tr.is-related {
    opacity: 0.82;
}

/* Factura Relación */
.emp-factura-filters {
    display: flex;
    gap: 14px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.emp-factura-filters .emp-field {
    min-width: 160px;
}
.emp-field-grow {
    flex: 1;
    min-width: 260px;
}
.emp-factura-doc {
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.emp-factura-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #0f172a;
}
.emp-factura-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 900;
    color: #0f172a;
}
.emp-factura-header p {
    margin: 3px 0 0;
    font-size: 0.8rem;
    color: #64748b;
}
.emp-factura-title {
    text-align: right;
}
.emp-factura-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--primary, #2563eb);
    letter-spacing: 1px;
}
.emp-factura-title p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #64748b;
}
.emp-factura-empresa-info {
    background: #f8fafc;
    padding: 1rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary, #2563eb);
}
.emp-factura-empresa-info strong {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
}
.emp-factura-empresa-info p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #1e293b;
}
.emp-factura-mini-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 1rem 0 1.4rem;
}
.emp-factura-mini-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.95rem 1rem;
    background: #f8fafc;
}
.emp-factura-mini-card span {
    display: block;
    font-size: 0.74rem;
    color: #64748b;
    font-weight: 700;
}
.emp-factura-mini-card strong {
    display: block;
    margin-top: 5px;
    font-size: 0.92rem;
    color: #0f172a;
}
.emp-factura-mini-card em {
    display: block;
    margin-top: 6px;
    font-style: normal;
    font-weight: 900;
    color: #1d4ed8;
}
.emp-factura-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
.emp-factura-table th {
    background: #f1f5f9;
    padding: 10px 8px;
    text-align: left;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.7rem;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.emp-factura-table td {
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.82rem;
    color: #1e293b;
}
.emp-factura-table .emp-money {
    text-align: right;
    font-weight: 700;
    white-space: nowrap;
}
.emp-factura-total td {
    border-top: 3px double #1e293b;
    font-size: 1rem;
    padding: 12px 8px;
    font-weight: 900;
}
.emp-factura-footer {
    margin-top: 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.75rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}
.emp-period-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.emp-period-summary div {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 12px 14px;
}
.emp-period-summary span {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
}
.emp-period-summary strong {
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    color: #0f172a;
}

/* Responsive */
@media (max-width: 768px) {
    .emp-shell { padding: 1rem; }
    .emp-hero { padding: 1.5rem; border-radius: 16px; }
    .emp-hero h2 { font-size: 1.2rem; }
    .emp-hero-side { min-width: 100%; }
    .emp-grid { grid-template-columns: 1fr; }
    .emp-toolbar { flex-direction: column; }
    .emp-search-wrap { min-width: 100%; }
    .emp-detail-card { flex-direction: column; text-align: center; padding: 1.5rem; }
    .emp-detail-badges { justify-content: center; }
    .emp-factura-header { flex-direction: column; gap: 1rem; }
    .emp-factura-title { text-align: left; }
    .emp-factura-doc { padding: 1rem; overflow-x: auto; }
    .emp-form-grid { grid-template-columns: 1fr; }
    .emp-stats-row { flex-direction: column; }
    .emp-section-head { flex-direction: column; align-items: flex-start; }
    .emp-two-col { grid-template-columns: 1fr; }
    .emp-period-summary { grid-template-columns: 1fr; }
    .emp-card-kpis { grid-template-columns: 1fr; }
    .emp-history-item { flex-direction: column; align-items: flex-start; }
    .emp-history-metrics { text-align: left; }
    .emp-history-actions { justify-content: flex-start; }
}
