/* Tema eFactuPy - Estilos globales, tokens de tema y utilidades Lumo */

:root {
    /* Superficies y Fondos */
    --efp-bg: #f5f6f8;
    --efp-surface: #ffffff;
    --efp-surface-subtle: #f8fafc;
    --efp-border: #e2e8f0;
    --efp-border-subtle: #f1f5f9;

    /* Tipografía */
    --efp-text: #0f172a;
    --efp-text-body: #1f2937;
    --efp-text-mono: #1e293b;
    --efp-text-muted: #64748b;
    --efp-text-tertiary: #94a3b8;
    --efp-text-code: #475569;
    --efp-text-inverse: #ffffff;

    /* Primario / Azul */
    --efp-primary: #2563eb;
    --efp-primary-text: #1d4ed8;
    --efp-primary-bg: #dbeafe;
    --efp-primary-bg-hover: #bfdbfe;
    --efp-primary-border: #dbeafe;
    --efp-primary-active-bg: rgba(37, 99, 235, 0.08);

    /* Información / Sky */
    --efp-info: #0284c7;
    --efp-info-text: #0369a1;
    --efp-info-bg: #e0f2fe;
    --efp-info-bg-hover: #bae6fd;
    --efp-info-border: #bae6fd;

    /* Éxito / Verde */
    --efp-success: #16a34a;
    --efp-success-text: #15803d;
    --efp-success-bg: #dcfce7;
    /* WhatsApp: verde de marca, distinto del verde de "aprobado" para que no se
       confundan dos acciones distintas del mismo color. */
    --efp-whatsapp-bg: #d9fdd3;
    --efp-whatsapp-bg-hover: #c3f5b8;
    --efp-whatsapp-text: #075e54;
    --efp-success-bg-hover: #bbf7d0;
    --efp-success-border: #a7f3d0;
    --efp-success-pill-bg: #ecfdf5;
    --efp-success-pill-text: #059669;
    --efp-success-pill-hover: #d1fae5;
    --efp-success-card-border: #28a745;

    /* Advertencia / Ámbar */
    --efp-warning: #f59e0b;
    --efp-warning-text: #b45309;
    --efp-warning-icon: #d97706;
    --efp-warning-bg: #fef3c7;
    --efp-warning-bg-hover: #fde68a;
    --efp-warning-border: #fde68a;

    /* Peligro / Rojo / Rechazado */
    --efp-danger: #ef4444;
    --efp-danger-text: #b91c1c;
    --efp-danger-sifen-text: #991b1b;
    --efp-danger-bg: #fee2e2;
    --efp-danger-sifen-bg: #fde8e8;
    --efp-danger-bg-hover: #fecaca;
    --efp-danger-border: #fca5a5;

    /* Naranja */
    --efp-orange: #ea580c;

    /* Violeta / Púrpura */
    --efp-violet-text: #7e22ce;
    --efp-violet-bg: #f3e8ff;
    --efp-violet-bg-hover: #e9d5ff;

    /* Pill Edit / Neutro */
    --efp-pill-edit-bg: #f1f5f9;
    --efp-pill-edit-text: #334155;
    --efp-pill-edit-border: #e2e8f0;
    --efp-pill-edit-hover: #e2e8f0;
}

html[theme~="dark"] {
    /* Superficies y Fondos */
    --efp-bg: #14161a;
    --efp-surface: #1e2128;
    --efp-surface-subtle: #262a33;
    --efp-border: #2d323b;
    --efp-border-subtle: #22262e;

    /* Tipografía */
    --efp-text: #e5e7eb;
    --efp-text-body: #e5e7eb;
    --efp-text-mono: #f3f4f6;
    --efp-text-muted: #9ca3af;
    --efp-text-tertiary: #6b7280;
    --efp-text-code: #cbd5e1;
    --efp-text-inverse: #ffffff;

    /* Primario / Azul */
    --efp-primary: #3b82f6;
    --efp-primary-text: #93c5fd;
    --efp-primary-bg: #1e3a5f;
    --efp-primary-bg-hover: #254b7a;
    --efp-primary-border: #2563eb;
    --efp-primary-active-bg: rgba(59, 130, 246, 0.15);

    /* Información / Sky */
    --efp-info: #38bdf8;
    --efp-info-text: #7dd3fc;
    --efp-info-bg: #0c4a6e;
    --efp-info-bg-hover: #075985;
    --efp-info-border: #0284c7;

    /* Éxito / Verde */
    --efp-success: #4ade80;
    --efp-success-text: #86efac;
    --efp-success-bg: #143d24;
    --efp-whatsapp-bg: #123b2f;
    --efp-whatsapp-bg-hover: #17513f;
    --efp-whatsapp-text: #7ee2b8;
    --efp-success-bg-hover: #194d2e;
    --efp-success-border: #166534;
    --efp-success-pill-bg: #143d24;
    --efp-success-pill-text: #86efac;
    --efp-success-pill-hover: #194d2e;
    --efp-success-card-border: #4ade80;

    /* Advertencia / Ámbar */
    --efp-warning: #fbbf24;
    --efp-warning-text: #fde68a;
    --efp-warning-icon: #f59e0b;
    --efp-warning-bg: #3d2b0f;
    --efp-warning-bg-hover: #4d3714;
    --efp-warning-border: #78350f;

    /* Peligro / Rojo / Rechazado */
    --efp-danger: #f87171;
    --efp-danger-text: #fca5a5;
    --efp-danger-sifen-text: #fca5a5;
    --efp-danger-bg: #3b1a1a;
    --efp-danger-sifen-bg: #3b1a1a;
    --efp-danger-bg-hover: #4a2020;
    --efp-danger-border: #7f1d1d;

    /* Naranja */
    --efp-orange: #fb923c;

    /* Violeta / Púrpura */
    --efp-violet-text: #d8b4fe;
    --efp-violet-bg: #3b1d5c;
    --efp-violet-bg-hover: #50247d;

    /* Pill Edit / Neutro */
    --efp-pill-edit-bg: #2d323b;
    --efp-pill-edit-text: #e2e8f0;
    --efp-pill-edit-border: #3f4756;
    --efp-pill-edit-hover: #3f4756;
}

/* ==========================================================================
   KPIs Dashboard
   ========================================================================= */
.kpis-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--lumo-space-m);
    width: 100%;
    margin-bottom: var(--lumo-space-m);
    box-sizing: border-box;
}

.kpi-card {
    background: var(--efp-surface);
    border: 1px solid var(--efp-border);
    border-radius: var(--lumo-border-radius-m, 10px);
    padding: var(--lumo-space-m);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--lumo-space-s);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.kpi-default {
    border-left: 4px solid var(--efp-text-tertiary) !important;
}

.kpi-success {
    border-left: 4px solid var(--efp-success) !important;
}

.kpi-warning {
    border-left: 4px solid var(--efp-warning) !important;
}

.kpi-error {
    border-left: 4px solid var(--efp-danger) !important;
}

.kpi-info {
    border-left: 4px solid var(--efp-primary) !important;
}

.kpi-active {
    outline: 2px solid var(--efp-primary);
    background: var(--efp-primary-active-bg);
}

.kpi-content-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.kpi-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--efp-text-muted);
    display: block;
    margin: 0;
    line-height: 1.2;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    margin: 2px 0;
    color: var(--efp-text);
}

.kpi-subtitle {
    font-size: 12px;
    color: var(--efp-text-tertiary);
    display: block;
    line-height: 1.2;
}

.kpi-icon-circle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.kpi-icon-circle-error, .kpi-icon-circle-red {
    background-color: var(--efp-danger-bg);
    color: var(--efp-danger);
}

.kpi-icon-circle-warning, .kpi-icon-circle-amber {
    background-color: var(--efp-warning-bg);
    color: var(--efp-warning-icon);
}

.kpi-icon-circle-info, .kpi-icon-circle-blue {
    background-color: var(--efp-primary-bg);
    color: var(--efp-primary);
}

.kpi-icon-circle-success, .kpi-icon-circle-green {
    background-color: var(--efp-success-bg);
    color: var(--efp-success);
}

.kpi-icon-circle-default {
    background-color: var(--efp-surface-subtle);
    color: var(--efp-text-muted);
}

/* ==========================================================================
   Badges de Estado del Tenant (Semáforo suave con punto)
   ========================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.status-badge::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-badge-verde {
    background-color: var(--efp-success-bg);
    color: var(--efp-success-text);
}
.status-badge-verde::before {
    background-color: var(--efp-success);
}

.status-badge-ambar {
    background-color: var(--efp-warning-bg);
    color: var(--efp-warning-text);
}
.status-badge-ambar::before {
    background-color: var(--efp-warning);
}

.status-badge-gris {
    background-color: var(--efp-surface-subtle);
    color: var(--efp-text-muted);
}
.status-badge-gris::before {
    background-color: var(--efp-text-tertiary);
}

.status-badge-rojo {
    background-color: var(--efp-danger-bg);
    color: var(--efp-danger-text);
}
.status-badge-rojo::before {
    background-color: var(--efp-danger);
}

/* ==========================================================================
   Botones Pill de Acciones
   ========================================================================== */
.action-pill-btn {
    border-radius: 9999px !important;
    min-height: 32px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 0 12px !important;
    cursor: pointer;
    border: 1px solid transparent !important;
}

.action-pill-ver {
    background-color: var(--efp-primary-bg) !important;
    color: var(--efp-primary) !important;
    border-color: var(--efp-primary-border) !important;
}
.action-pill-ver:hover {
    background-color: var(--efp-primary-bg-hover) !important;
}

.action-pill-edit {
    background-color: var(--efp-pill-edit-bg) !important;
    color: var(--efp-pill-edit-text) !important;
    border-color: var(--efp-pill-edit-border) !important;
}
.action-pill-edit:hover {
    background-color: var(--efp-pill-edit-hover) !important;
}

.action-pill-cert {
    background-color: var(--efp-success-pill-bg) !important;
    color: var(--efp-success-pill-text) !important;
    border-color: var(--efp-success-border) !important;
}
.action-pill-cert:hover {
    background-color: var(--efp-success-pill-hover) !important;
}

/* ==========================================================================
   Cards Móviles de Tenants
   ========================================================================== */
.cards-tenants-container {
    display: flex;
    flex-direction: column;
    gap: var(--lumo-space-m);
    width: 100%;
    box-sizing: border-box;
}

.tenant-card {
    background: var(--efp-surface);
    border: 1px solid var(--efp-border);
    border-radius: var(--lumo-border-radius-m);
    padding: var(--lumo-space-m);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
}

.tenant-card-verde {
    border-left: 5px solid var(--efp-success-card-border);
}

.tenant-card-amarillo {
    border-left: 5px solid var(--efp-warning);
}

.tenant-card-rojo {
    border-left: 5px solid var(--efp-danger);
}

.tenant-card-title {
    font-size: var(--lumo-font-size-l);
    font-weight: 600;
    margin: 0;
    color: var(--efp-text);
    word-break: break-word;
    line-height: 1.3;
}

.tenant-card-ruc {
    font-size: var(--lumo-font-size-s);
    color: var(--efp-text-muted);
    font-weight: 500;
}

.tenant-card-secondary {
    font-size: var(--lumo-font-size-s);
    color: var(--efp-text-tertiary);
}

.tenant-card-info-grid {
    display: flex;
    flex-direction: column;
    gap: var(--lumo-space-xs);
    font-size: var(--lumo-font-size-s);
    color: var(--efp-text-muted);
    margin: var(--lumo-space-xs) 0;
    padding: var(--lumo-space-xs) 0;
    border-top: 1px solid var(--efp-border-subtle);
    border-bottom: 1px solid var(--efp-border-subtle);
}

.touch-btn {
    min-height: 40px;
    font-size: var(--lumo-font-size-s);
}

/* ==========================================================================
   Modal de Respuesta Cruda SIFEN
   ========================================================================== */
.raw-sifen-box {
    font-family: var(--lumo-font-family-monospace, monospace);
    font-size: var(--lumo-font-size-xs);
    background: var(--efp-danger-sifen-bg);
    color: var(--efp-danger-sifen-text);
    padding: var(--lumo-space-m);
    border-radius: var(--lumo-border-radius-m);
    border: 1px solid var(--efp-danger-border);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 240px;
    overflow-y: auto;
    user-select: text;
    margin: var(--lumo-space-xs) 0;
    box-sizing: border-box;
}

/* ==========================================================================
   Vista Facturas Tenant y Componente FacturaCard
   ========================================================================== */

.facturas-tenant-view {
    background-color: var(--efp-bg);
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

.facturas-main-content {
    background-color: var(--efp-bg);
    box-sizing: border-box;
    width: 100%;
}

/* 1. Header (sticky, blanco/dark surface) */
.facturas-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--efp-surface);
    border-bottom: 1px solid var(--efp-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
    padding: var(--lumo-space-s) var(--lumo-space-m);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--lumo-space-m);
}

.facturas-header-left {
    display: flex;
    align-items: center;
    gap: var(--lumo-space-s);
}

.header-back-btn {
    font-weight: 600;
    font-size: var(--lumo-font-size-m);
    color: var(--efp-primary);
    cursor: pointer;
}

.header-toggle-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toggle-on {
    background-color: var(--efp-primary);
    color: var(--efp-text-inverse);
}

.toggle-off {
    background-color: var(--efp-text-tertiary);
    color: var(--efp-text-inverse);
}

.pill-online {
    background-color: var(--efp-info-bg);
    color: var(--efp-info-text);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 9999px;
    letter-spacing: 0.05em;
}

.facturas-header-center {
    display: flex;
    align-items: center;
    gap: var(--lumo-space-xs);
    flex-grow: 1;
}

.header-chart-icon {
    font-size: 24px;
    line-height: 1;
}

.header-tenant-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--efp-text);
    line-height: 1.2;
    word-break: break-word;
}

.facturas-header-right {
    display: flex;
    align-items: center;
    gap: var(--lumo-space-m);
}

.header-theme-toggle-btn {
    font-size: 18px;
    cursor: pointer;
}

.header-user-box {
    text-align: right;
    align-items: flex-end;
}

.header-username {
    font-weight: 700;
    font-size: 14px;
    color: var(--efp-text);
    line-height: 1.2;
}

.header-role-operator {
    font-size: 11px;
    color: var(--efp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.header-hamburger-btn {
    background-color: var(--efp-primary) !important;
    color: var(--efp-text-inverse) !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: var(--lumo-border-radius-m, 8px) !important;
}

/* 2. Barra de filtros */
.facturas-filter-bar {
    background-color: var(--efp-surface);
    border-bottom: 1px solid var(--efp-border);
    padding: var(--lumo-space-xs) var(--lumo-space-m);
    width: 100%;
    box-sizing: border-box;
}

.facturas-filter-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--lumo-space-s);
}

.filter-label {
    font-size: var(--lumo-font-size-s);
    font-weight: 600;
    color: var(--efp-text-muted);
}

.filter-separator {
    color: var(--efp-text-tertiary);
    font-weight: bold;
}

.filter-datepicker {
    max-width: 150px;
}

.filter-select-estado {
    max-width: 160px;
}

.filter-select-ordenar {
    max-width: 180px;
}

.filter-btn-buscar {
    background-color: var(--efp-primary);
    color: var(--efp-text-inverse);
}

.filter-btn-limpiar {
    color: var(--efp-text-muted);
}

.filter-btn-sincronizar {
    background-color: var(--efp-orange) !important;
    color: var(--efp-text-inverse) !important;
}

/* 3. KPIs */
.facturas-kpis-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--lumo-space-m);
    width: 100%;
    margin-top: var(--lumo-space-s);
    margin-bottom: var(--lumo-space-xs);
    box-sizing: border-box;
}

.kpi-card-tenant {
    background: var(--efp-surface);
    border: 1px solid var(--efp-border);
    border-radius: 10px;
    padding: var(--lumo-space-m);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.kpi-card-tenant:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.kpi-card-tenant.kpi-active {
    outline: 2px solid var(--efp-primary);
    background: var(--efp-surface-subtle);
}

.kpi-border-amber {
    border-left: 6px solid var(--efp-warning);
}

.kpi-border-blue {
    border-left: 6px solid var(--efp-primary);
}

.kpi-border-green {
    border-left: 6px solid var(--efp-success);
}

.kpi-border-red {
    border-left: 6px solid var(--efp-danger);
}

.kpi-label-tenant {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--efp-text-muted);
}

.kpi-valor-tenant {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--efp-text);
    margin-top: 4px;
}

.kpi-icon-circle-amber {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--efp-warning-bg);
    color: var(--efp-warning-icon);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.kpi-icon-circle-blue {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--efp-primary-bg);
    color: var(--efp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.kpi-icon-circle-green {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--efp-success-bg);
    color: var(--efp-success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.kpi-icon-circle-red {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--efp-danger-bg);
    color: var(--efp-danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.kpi-range-text {
    color: var(--efp-warning-text);
    font-size: 13px;
    font-weight: 600;
    margin-top: var(--lumo-space-xs);
    margin-bottom: var(--lumo-space-m);
    display: block;
}

/* 4. Secciones y Cards */
.facturas-section {
    width: 100%;
    margin-bottom: var(--lumo-space-l);
    box-sizing: border-box;
}

.facturas-section-title-layout {
    margin-bottom: var(--lumo-space-s);
}

.facturas-section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.facturas-section-title-rechazadas {
    color: var(--efp-danger);
}

.facturas-section-title-generadas {
    color: var(--efp-primary);
}

.facturas-section-title-aprobadas {
    color: var(--efp-success);
}

.facturas-section-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
}

.facturas-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--lumo-space-m);
    width: 100%;
    box-sizing: border-box;
}

.facturas-empty-msg {
    color: var(--efp-text-muted);
    font-size: var(--lumo-font-size-s);
    padding: var(--lumo-space-m);
    font-style: italic;
}

/* FacturaCard */
.factura-card {
    background: var(--efp-surface);
    border: 1px solid var(--efp-border);
    border-radius: 10px;
    padding: var(--lumo-space-m);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
    width: 100%;
}

.factura-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
}

.factura-card-aprobado {
    border-top: 4px solid var(--efp-success);
}

.factura-card-generado {
    border-top: 4px solid var(--efp-primary);
}

.factura-card-rechazado {
    border-top: 4px solid var(--efp-danger);
}

.factura-card-otro {
    border-top: 4px solid var(--efp-text-tertiary);
}

.factura-card-inner {
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.factura-card-num-mono {
    font-family: var(--lumo-font-family-monospace, monospace);
    font-size: 13px;
    font-weight: 700;
    color: var(--efp-text-mono);
}

.factura-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.factura-badge-aprobado {
    background-color: var(--efp-success-bg);
    color: var(--efp-success-text);
}

.factura-badge-generado {
    background-color: var(--efp-primary-bg);
    color: var(--efp-primary-text);
}

.factura-badge-rechazado {
    background-color: var(--efp-danger-bg);
    color: var(--efp-danger-text);
}

.factura-badge-otro {
    background-color: var(--efp-surface-subtle);
    color: var(--efp-text-muted);
}

.factura-badge-tipo {
    background-color: var(--efp-surface-subtle);
    color: var(--efp-text-muted);
}

.factura-icon-orange {
    color: var(--efp-orange) !important;
}

.factura-card-razon-social {
    font-weight: 700;
    font-size: 15px;
    color: var(--efp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    margin-top: 4px;
}

.factura-card-ruc {
    font-size: 12px;
    color: var(--efp-text-muted);
    font-weight: 500;
}

.factura-card-motivo-rechazo {
    background-color: var(--efp-danger-bg);
    border: 1px solid var(--efp-danger-border);
    border-radius: var(--lumo-border-radius-s, 6px);
    padding: 6px 8px;
    margin: 4px 0;
    width: 100%;
    box-sizing: border-box;
}

.factura-card-motivo-rechazo-texto {
    font-family: var(--lumo-font-family-monospace, monospace);
    font-size: 11px;
    color: var(--efp-danger-text);
    line-height: 1.35;
    display: block;
    word-break: break-word;
    user-select: text;
}

.factura-card-monto {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    margin: 4px 0;
}

.factura-monto-verde {
    color: var(--efp-success);
}

.factura-monto-azul {
    color: var(--efp-primary);
}

.factura-monto-rojo {
    color: var(--efp-danger);
}

.factura-card-fecha {
    font-size: 12px;
    color: var(--efp-text-muted);
}

.factura-card-cdc-box {
    background-color: var(--efp-surface-subtle);
    border: 1px solid var(--efp-border);
    border-radius: 6px;
    padding: 6px 8px;
    margin: 6px 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.factura-card-cdc-text {
    font-family: var(--lumo-font-family-monospace, monospace);
    font-size: 11px;
    color: var(--efp-text-code);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.factura-card-actions {
    display: flex;
    /* Cuatro acciones no entran en una card angosta ni en móvil: que bajen de
       línea en vez de encogerse hasta volverse ilegibles. */
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    box-sizing: border-box;
}

.factura-action-anchor {
    flex: 1;
    text-decoration: none;
    display: block;
    width: 100%;
}

.factura-pill-btn {
    border-radius: 20px !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    min-height: 40px !important;
    cursor: pointer;
    box-sizing: border-box;
}

.factura-pill-info {
    background-color: var(--efp-info-bg) !important;
    color: var(--efp-info-text) !important;
    border: none !important;
}

.factura-pill-info:hover {
    background-color: var(--efp-info-bg-hover) !important;
}

.factura-pill-ver {
    background-color: var(--efp-violet-bg) !important;
    color: var(--efp-violet-text) !important;
    border: none !important;
}

.factura-pill-ver:hover {
    background-color: var(--efp-violet-bg-hover) !important;
}

.factura-pill-whatsapp {
    background-color: var(--efp-whatsapp-bg) !important;
    color: var(--efp-whatsapp-text) !important;
    border: none !important;
}

.factura-pill-whatsapp:hover {
    background-color: var(--efp-whatsapp-bg-hover) !important;
}

.factura-pill-enviar {
    background-color: var(--efp-success-bg) !important;
    color: var(--efp-success-text) !important;
    border: none !important;
}

.factura-pill-enviar:hover {
    background-color: var(--efp-success-bg-hover) !important;
}

/* ==========================================================================
   Responsive: Pantallas Móviles (<= 768px y 375px)
   ========================================================================== */
@media (max-width: 768px) {
    .facturas-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--lumo-space-s);
    }

    .facturas-header-center {
        order: -1;
    }

    .facturas-filter-content {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-datepicker,
    .filter-select-estado,
    .filter-select-ordenar {
        max-width: 100%;
        width: 100%;
    }

    .facturas-kpis-container {
        grid-template-columns: 1fr;
    }

    .facturas-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 375px) {
    .facturas-cards-grid {
        grid-template-columns: 1fr;
    }

    .factura-card {
        padding: var(--lumo-space-s);
    }

    .factura-card-razon-social {
        max-width: 100%;
    }
}
