/* Reset y variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --secondary: #764ba2;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --border: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.login-container {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 380px;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo h1 {
    color: var(--primary);
    font-size: 2rem;
}

.logo p {
    color: var(--gray);
    font-size: 0.9rem;
}

.footer {
    text-align: center;
    margin-top: 1.5rem;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Password toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 1;
}

/* Forgot password */
.forgot-password {
    text-align: center;
    margin-top: 1rem;
}

.forgot-password a {
    color: var(--primary);
    font-size: 0.875rem;
    text-decoration: none;
}

.forgot-password a:hover {
    text-decoration: underline;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Checkbox */
.checkbox-group {
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    color: var(--gray);
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

.checkbox-label span {
    user-select: none;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-logout {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    width: 100%;
    margin-top: 0.5rem;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
}

/* Messages */
.message {
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.message.error {
    background: #fee;
    color: #c00;
}

.message.success {
    background: #efe;
    color: #060;
}

/* Admin Panel Layout */
.admin-panel {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo {
    width: 100px;
    height: auto;
    margin-bottom: 10px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
}

.user-name {
    font-size: 0.85rem;
    opacity: 0.9;
    display: block;
    margin-top: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left: 3px solid white;
}

.nav-item .icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.nav-separator {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 0.5rem 1rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .user-info {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

/* Sidebar Trial Info */
.sidebar-trial-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 193, 7, 0.15);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: #ffc107;
}

.sidebar-trial-info.warning {
    background: rgba(255, 87, 34, 0.2);
    color: #ff7043;
    animation: pulse 2s infinite;
}

.sidebar-trial-info .trial-icon {
    font-size: 1rem;
}

/* PWA Install Banner */
.pwa-install-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    animation: pwa-slide-in 0.3s ease-out;
}

.pwa-install-banner.hidden {
    display: none;
}

.pwa-install-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.pwa-install-text {
    font-size: 0.8rem;
    color: white;
    flex: 1;
    line-height: 1.2;
}

.pwa-install-btn {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: none;
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s;
}

.pwa-install-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.pwa-install-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.pwa-install-dismiss:hover {
    color: white;
}

/* APK Download Link */
.apk-download-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.apk-download-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes pwa-slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
}

.section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h1 {
    font-size: 1.75rem;
    color: var(--dark);
}

.section-header .date {
    color: var(--gray);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2rem;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Cards */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 1rem;
    color: var(--dark);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.card-action {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}

.card-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.card-action p {
    color: var(--gray);
    font-size: 0.9rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--gray);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.table tbody tr:hover {
    background: var(--light);
}

.table-controls {
    margin-bottom: 1rem;
}

.input-search {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 300px;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--gray);
}

.filter-group input,
.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Status badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #e7f1ff;
    color: #0c5460;
}

/* Badges facturación */
.badge-emitida {
    background: #bee3f8;
    color: #2b6cb0;
}

.badge-pagada {
    background: #c6f6d5;
    color: #276749;
}

.badge-anulada {
    background: #fed7d7;
    color: #9b2c2c;
}

.badge-completado {
    background: #c6f6d5;
    color: #276749;
}

.badge-devuelto {
    background: #fed7d7;
    color: #9b2c2c;
}

/* Tabs facturación */
.tabs-facturacion {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #718096;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #4a5568;
}

.tab-btn.active {
    color: var(--primary-color, #2980b9);
    border-bottom-color: var(--primary-color, #2980b9);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Importe total factura */
.importe-total {
    font-weight: 700;
    font-size: 1rem;
}

/* Empresa info en tabla */
.empresa-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.empresa-info strong {
    color: var(--dark);
}

.empresa-info small {
    font-size: 0.8rem;
}

.usuarios-count {
    font-weight: 600;
    color: var(--primary);
}

/* Plan stats (superadmin dashboard) */
.plan-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.plan-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.plan-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.modal-content form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--dark);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .admin-panel {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ========== SECCION FICHAJE USER - DISEÑO PROFESIONAL ========== */

.fichaje-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
}

.fichaje-header {
    text-align: center;
    margin-bottom: 1rem;
}

.fichaje-fecha {
    font-size: 1rem;
    color: var(--gray);
    font-weight: 500;
    text-transform: capitalize;
}

/* Reloj principal */
.fichaje-reloj-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.fichaje-reloj {
    font-size: 3.5rem;
    font-weight: 600;
    color: #2d3748;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 2px;
}

/* Estado actual */
.fichaje-estado {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    border-radius: 50px;
    margin: 0 auto 2rem;
    width: fit-content;
}

.estado-indicador {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray);
    animation: pulse 2s infinite;
}

.estado-indicador.trabajando {
    background: var(--success);
}

.estado-indicador.pausa {
    background: var(--warning);
}

.estado-indicador.sin-fichar {
    background: var(--gray);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.estado-texto {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark);
}

.estado-desde {
    font-size: 0.85rem;
    color: var(--gray);
}

/* Botón circular principal (Entrar/Reanudar) */
.fichaje-principal,
.fichaje-reanudar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.fichaje-reanudar {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-circular {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn-circular svg {
    width: 40px;
    height: 40px;
}

.btn-circular span {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-entrar {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-entrar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4);
}

.btn-reanudar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-reanudar:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

/* Botones de acciones (Café, Comida, etc.) */
.fichaje-acciones {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.btn-accion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.btn-accion-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.btn-accion-icon svg {
    width: 28px;
    height: 28px;
}

.btn-accion-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dark);
}

/* Colores de botones de acción */
.btn-cafe .btn-accion-icon {
    background: #fff3e0;
    color: #e65100;
}
.btn-cafe:hover {
    border-color: #ffb74d;
    background: #fff8f0;
}

.btn-comida .btn-accion-icon {
    background: #e8f5e9;
    color: #2e7d32;
}
.btn-comida:hover {
    border-color: #81c784;
    background: #f1f8f2;
}

.btn-descanso .btn-accion-icon {
    background: #e3f2fd;
    color: #1565c0;
}
.btn-descanso:hover {
    border-color: #64b5f6;
    background: #f0f7fd;
}

.btn-salir .btn-accion-icon,
.btn-salir-pausa .btn-accion-icon {
    background: #ffebee;
    color: #c62828;
}
.btn-salir:hover,
.btn-salir-pausa:hover {
    border-color: #ef5350;
    background: #fff5f5;
}

.btn-salir-pausa {
    width: auto;
    padding: 1rem 1.5rem;
}

/* Timeline de fichajes */
.fichaje-timeline {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.timeline-titulo {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.timeline-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f5f5f5;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-hora {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    width: 60px;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.timeline-linea {
    width: 20px;
    display: flex;
    justify-content: center;
    position: relative;
}

.timeline-punto {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}

.timeline-punto.entrada { background: var(--success); }
.timeline-punto.salida { background: var(--danger); }
.timeline-punto.pausa { background: var(--warning); }

.timeline-descripcion {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.75rem;
}

.timeline-tipo {
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 500;
}

.timeline-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.timeline-badge.entrada {
    background: #d4edda;
    color: #155724;
}
.timeline-badge.salida {
    background: #f8d7da;
    color: #721c24;
}
.timeline-badge.pausa {
    background: #fff3cd;
    color: #856404;
}

.timeline-vacio {
    text-align: center;
    color: var(--gray);
    padding: 2rem;
    font-size: 0.9rem;
}

/* Estados de visibilidad */
.fichaje-principal { display: flex; }
.fichaje-acciones { display: none; }
.fichaje-reanudar { display: none; }

.fichaje-container.trabajando .fichaje-principal { display: none; }
.fichaje-container.trabajando .fichaje-acciones { display: grid; }
.fichaje-container.trabajando .fichaje-reanudar { display: none; }

.fichaje-container.pausa .fichaje-principal { display: none; }
.fichaje-container.pausa .fichaje-acciones { display: none; }
.fichaje-container.pausa .fichaje-reanudar { display: flex; }

/* Responsive */
@media (max-width: 480px) {
    .fichaje-reloj {
        font-size: 2.8rem;
    }

    .fichaje-acciones {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .btn-circular {
        width: 120px;
        height: 120px;
    }

    .btn-circular svg {
        width: 32px;
        height: 32px;
    }

    .btn-accion-icon {
        width: 42px;
        height: 42px;
    }

    .fichaje-reanudar {
        flex-direction: column;
    }
}

/* Stats compactas */
.stats-grid.compact {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .fichaje-time {
        font-size: 3rem;
    }

    .fichaje-buttons {
        flex-direction: column;
    }

    .btn-fichaje {
        width: 100%;
    }
}

/* ========== HISTORIAL TARJETAS MOVIL ========== */

.historial-cards {
    display: none;
}

.historial-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.historial-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.historial-card-date {
    font-weight: 600;
    color: var(--primary);
}

.historial-card-total {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--success);
}

.historial-card-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.historial-card-label {
    color: var(--gray);
}

.historial-card-value {
    font-weight: 500;
}

.historial-card-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray);
    margin: 0.5rem 0 0 0;
    opacity: 0.7;
}

.historial-card-detalles {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
}

.historial-card.expanded .historial-card-detalles {
    display: block;
}

.historial-card.expanded .historial-card-hint {
    display: none;
}

.historial-card-detalles-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.historial-card-detalle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.historial-card-detalle:last-child {
    border-bottom: none;
}

/* Ubicación en fichajes */
.ubicacion-cell {
    font-size: 0.85rem;
    color: var(--gray);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.fichaje-ubicacion {
    display: block;
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.ubicacion-icon {
    font-style: normal;
    margin-right: 0.25rem;
}

/* Indicador de estado de ubicación en fichaje */
.ubicacion-status {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.95rem;
}

.ubicacion-status.ubicacion-ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ubicacion-status.ubicacion-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ubicacion-status.ubicacion-error small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.9;
}

.ubicacion-status.ubicacion-pendiente {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.ubicacion-status .btn-sm {
    margin-left: 1rem;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.ubicacion-instrucciones {
    text-align: left;
    background: rgba(255,255,255,0.5);
    padding: 0.75rem;
    border-radius: 6px;
    margin: 0.75rem 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

.ubicacion-instrucciones strong {
    display: block;
    margin-bottom: 0.5rem;
}

.ubicacion-diagnostico {
    text-align: left;
    background: rgba(255,255,255,0.7);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
}

.ubicacion-diagnostico hr {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin: 0.75rem 0;
}

.ubicacion-diagnostico ol {
    margin: 0.5rem 0 0 1.5rem;
    padding: 0;
}

@media (max-width: 480px) {
    .ubicacion-status .btn-sm {
        display: block;
        margin: 0.75rem auto 0;
    }

    .ubicacion-instrucciones {
        font-size: 0.8rem;
    }
}

.historial-card-detalle {
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .historial-table {
        display: none;
    }

    .historial-cards {
        display: block;
    }
}

/* Foto empleado */
.foto-upload-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.foto-preview {
    width: 100px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.empleado-foto-small {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.empleado-sin-foto {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--gray);
}

/* Fotos mini en tablas */
.foto-cell {
    width: 50px;
    text-align: center;
}

.foto-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.foto-mini-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    font-size: 20px;
}

/* Checkbox label inline */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 15px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Fila de usuario inactivo */
tr.inactivo {
    opacity: 0.6;
    background-color: var(--bg-secondary);
}

/* Trial Banner */
.trial-banner {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

.trial-banner.warning {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    box-shadow: 0 2px 8px rgba(245, 101, 101, 0.3);
}

.trial-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.trial-banner-icon {
    font-size: 1.5rem;
}

.trial-banner-text {
    font-weight: 500;
}

.trial-banner-days {
    font-weight: 700;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.trial-banner-btn {
    background: white;
    color: #ed8936;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.trial-banner-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.trial-banner.warning .trial-banner-btn {
    color: #f56565;
}

/* Período de gracia - más urgente que warning */
.trial-banner.grace-period {
    background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%);
    box-shadow: 0 2px 12px rgba(197, 48, 48, 0.4);
    animation: pulse-danger 2s infinite;
}

.trial-banner.grace-period .trial-banner-days {
    background: rgba(255, 255, 255, 0.3);
    font-size: 1rem;
}

.trial-banner.grace-period .trial-banner-btn {
    color: #c53030;
    font-weight: 700;
}

/* Suscripción activa - banner verde */
.trial-banner.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.trial-banner.success .trial-banner-days {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar-trial-info.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.sidebar-trial-info.grace-period {
    background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%) !important;
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

.text-danger {
    color: #dc3545 !important;
}

/* Card Suscripción (sección Empresa) */
.card-suscripcion {
    border: 2px solid #ffc107;
    background: linear-gradient(135deg, #fffbf0 0%, #fff8e1 100%);
}

.suscripcion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.suscripcion-header h3 {
    margin: 0;
    color: #333;
}

.suscripcion-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.suscripcion-estado {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.suscripcion-estado .estado-icon {
    font-size: 2.5rem;
}

.suscripcion-estado .estado-info {
    display: flex;
    flex-direction: column;
}

.suscripcion-estado .estado-titulo {
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
}

.suscripcion-estado .estado-detalle {
    color: #666;
    font-size: 0.95rem;
}

.suscripcion-estado .estado-detalle.text-warning {
    color: #e65100;
    font-weight: 600;
}

.suscripcion-progreso {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progreso-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progreso-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progreso-fill.danger {
    background: linear-gradient(90deg, #ff9800, #f44336);
}

.progreso-text {
    font-size: 0.85rem;
    color: #666;
    text-align: right;
}

/* Trial Expired Overlay */
.trial-expired-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.trial-expired-modal {
    background: white;
    border-radius: 16px;
    padding: 48px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.trial-expired-icon {
    font-size: 4rem;
    margin-bottom: 24px;
}

.trial-expired-modal h2 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 16px;
}

.trial-expired-modal p {
    color: var(--gray);
    margin-bottom: 24px;
    line-height: 1.6;
}

.trial-expired-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.trial-expired-contact {
    font-size: 0.875rem;
    color: var(--gray);
}

.trial-expired-contact a {
    color: var(--primary);
}

@media (max-width: 768px) {
    .trial-banner {
        flex-direction: column;
        text-align: center;
    }

    .trial-banner-content {
        flex-direction: column;
    }

    .trial-expired-actions {
        flex-direction: column;
    }

    .trial-expired-modal {
        padding: 32px 24px;
    }
}

/* ==================== ITSS (Inspección de Trabajo) ==================== */

.itss-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.itss-header h3 {
    margin: 0;
}

.itss-token-display {
    margin: 1rem 0;
}

.itss-token-display label,
.itss-token-display .info-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.token-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.token-box code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--primary);
    word-break: break-all;
}

.token-box .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
}

.token-box .btn-sm:hover {
    background: var(--border);
    border-radius: 4px;
}

.itss-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.instrucciones-box {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.instrucciones-box h4 {
    margin: 0 0 1rem 0;
    color: var(--primary);
}

.instrucciones-box code {
    display: block;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin: 0.5rem 0;
}

.instrucciones-box code.ejemplo-url {
    background: #e8f4fc;
    border-color: var(--primary);
}

.instrucciones-box ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.instrucciones-box li {
    margin: 0.25rem 0;
}

.instrucciones-box li code {
    display: inline;
    padding: 0.1rem 0.4rem;
    margin: 0;
}

@media (max-width: 768px) {
    .itss-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .itss-actions {
        flex-direction: column;
    }

    .itss-actions .btn {
        width: 100%;
    }
}

/* ==================== MODAL SUSCRIPCIÓN ==================== */

/* Toggle Ciclo de Facturación */
.ciclo-toggle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.ciclo-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: 30px;
    padding: 5px;
    gap: 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

.toggle-ciclo {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-ciclo:hover {
    color: var(--primary-color);
}

.toggle-ciclo.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.25);
}

.ciclo-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Plan Cards */
.planes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.plan-card {
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: white;
}

.plan-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.15);
}

.plan-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(118, 75, 162, 0.04) 100%);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

.plan-card.selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.plan-card .plan-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.plan-card h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
}

.plan-card .plan-precio {
    font-size: 1.75rem;
    color: var(--primary-color);
    font-weight: 800;
    margin: 0.5rem 0;
    line-height: 1.2;
}

.plan-card .plan-precio small {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.plan-card .plan-limite {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 20px;
    display: inline-block;
    margin-top: 0.75rem;
}

.plan-card .plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    color: white;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 10px;
}

/* Tarjetas de Método de Pago */
.metodo-pago-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    text-align: center;
}

.metodo-pago-card:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.metodo-pago-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.metodo-pago-card .metodo-pago-icon {
    font-size: 2rem;
}

.metodo-pago-card .metodo-pago-titulo {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.metodo-pago-card .metodo-pago-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Resumen de Precio */
.precio-resumen {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    margin-top: 1.75rem;
}

.precio-resumen-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.precio-resumen-row.total {
    border-top: 2px solid var(--border-color);
    margin-top: 0.75rem;
    padding-top: 1rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.precio-resumen-row.total .precio-valor {
    color: var(--primary-color);
    font-size: 1.35rem;
}

.precio-ahorro {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 0.75rem;
    padding: 8px 12px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 10px;
    color: #166534;
    font-size: 0.875rem;
    font-weight: 600;
}

.precio-ahorro svg {
    width: 16px;
    height: 16px;
}

/* Paso indicador */
.paso-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.paso-numero {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.paso-titulo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

#formDatosFacturacion .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

#cifValidacion.valido {
    color: var(--success-color);
}

#cifValidacion.invalido {
    color: var(--danger-color);
}

/* ==================== GESTIÓN SUSCRIPCIÓN ==================== */

.gestion-info-actual {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.gestion-info-actual::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, #764ba2 100%);
}

.gestion-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.gestion-plan-actual-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
}

.gestion-info-actual h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 700;
}

.gestion-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.gestion-stat {
    background: white;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.gestion-stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.gestion-stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gestion-stat-value.highlight {
    color: var(--primary-color);
}

/* Cambio Pendiente Alert */
.cambio-pendiente {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 24px;
    position: relative;
}

.cambio-pendiente::before {
    content: '⏳';
    position: absolute;
    top: -10px;
    left: 16px;
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 1rem;
}

.cambio-pendiente-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.cambio-pendiente-header svg {
    width: 18px;
    height: 18px;
}

.cambio-pendiente p {
    margin: 0 0 14px 0;
    color: #78350f;
    font-size: 0.9rem;
    line-height: 1.5;
}

.cambio-pendiente .btn-cancelar-cambio {
    background: white;
    color: #92400e;
    border: 1px solid #fbbf24;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cambio-pendiente .btn-cancelar-cambio:hover {
    background: #fffbeb;
    border-color: #f59e0b;
}

/* Divider */
.gestion-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
}

.gestion-divider::before,
.gestion-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.gestion-divider span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Cambiar Plan Section */
.gestion-cambiar-header {
    margin-bottom: 20px;
}

.gestion-cambiar-header h4 {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gestion-cambiar-header p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Toggle Container for Gestion */
.toggle-ciclo-container {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: 25px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 20px;
}

.toggle-ciclo-container .toggle-ciclo {
    padding: 8px 18px;
    font-size: 0.85rem;
}

/* Plan Options Grid */
.gestion-planes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.gestion-plan-option {
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    position: relative;
}

.gestion-plan-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.12);
}

.gestion-plan-option.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.gestion-plan-option.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.gestion-plan-option.actual {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.03) 100%);
}

.gestion-plan-option.actual::before {
    content: 'Actual';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    font-size: 0.65rem;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gestion-plan-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.gestion-plan-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.gestion-plan-precio {
    font-size: 1.25rem;
    color: var(--primary-color);
    font-weight: 800;
    margin-bottom: 4px;
}

.gestion-plan-precio small {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.gestion-plan-limite {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 5px 10px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 8px;
}

/* Resumen Cambio */
.resumen-cambio {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid #60a5fa;
    border-radius: 14px;
    padding: 18px;
    margin-top: 20px;
}

.resumen-cambio-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.resumen-cambio p {
    margin: 0;
    color: #1e40af;
    font-size: 0.9rem;
    line-height: 1.5;
}

.resumen-cambio strong {
    color: #1d4ed8;
}

/* Cancelación Programada */
.cancelacion-programada {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 20px;
}

.cancelacion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #dc2626;
}

.cancelacion-programada p {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: #7f1d1d;
    line-height: 1.5;
}

.btn-reactivar {
    background: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reactivar:hover {
    background: #b91c1c;
}

/* Opción Cancelar */
.opcion-cancelar {
    margin-top: 12px;
}

.opcion-cancelar p {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
}

.btn-danger-outline {
    background: transparent;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

/* ==================== RESPONSIVE SUSCRIPCIÓN ==================== */

@media (max-width: 600px) {
    .planes-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .plan-card {
        padding: 1.25rem;
    }

    .plan-card .plan-precio {
        font-size: 1.5rem;
    }

    .plan-card .plan-icon {
        font-size: 2rem;
    }

    .ciclo-toggle {
        flex-direction: column;
        width: 100%;
    }

    .toggle-ciclo {
        justify-content: center;
        padding: 12px 16px;
    }

    .gestion-stats {
        grid-template-columns: 1fr 1fr;
    }

    .gestion-planes {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .gestion-plan-option {
        padding: 16px;
    }

    .gestion-plan-precio {
        font-size: 1.15rem;
    }

    .paso-header {
        gap: 10px;
    }

    .paso-numero {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .paso-titulo {
        font-size: 1.05rem;
    }

    .precio-resumen {
        padding: 1rem;
    }
}

/* ==================== SEPA / Datos Bancarios ==================== */

/* Validación IBAN */
.validacion-feedback {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.validacion-feedback.valido {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.validacion-feedback.invalido {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.validacion-feedback.cargando {
    background: #e2e8f0;
    color: #4a5568;
}

/* Banco detectado */
.banco-detectado {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 1px solid #667eea30;
    border-radius: 8px;
    margin-top: 8px;
}

.banco-detectado .banco-icon {
    font-size: 1.5rem;
}

.banco-detectado #bancoNombre {
    font-weight: 600;
    color: var(--text-primary);
}

/* Modal Mandato SEPA */
.mandato-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.mandato-header .mandato-info {
    display: flex;
    flex-direction: column;
}

.mandato-header .mandato-info strong {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.mandato-header .mandato-info small {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

.mandato-referencia {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    margin-bottom: 16px;
}

.mandato-referencia .label {
    color: #0369a1;
    font-weight: 500;
    font-size: 0.875rem;
}

.mandato-referencia .valor {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 600;
    color: #0c4a6e;
}

.mandato-texto {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.mandato-texto p {
    margin-bottom: 12px;
}

.mandato-texto p:last-child {
    margin-bottom: 0;
}

.mandato-texto .nota {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    padding: 8px 12px;
    margin-top: 12px;
    border-radius: 0 6px 6px 0;
}

.mandato-deudor {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.mandato-deudor h4 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.deudor-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.deudor-campo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.deudor-campo .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 60px;
}

.deudor-campo .valor {
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9rem;
}

.mandato-aceptaciones {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.checkbox-mandato {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.5;
}

.checkbox-mandato input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-mandato a {
    color: var(--primary);
    text-decoration: underline;
}

.mandato-firma-info {
    padding: 12px;
    background: #f1f5f9;
    border-radius: 6px;
    text-align: center;
}

.mandato-firma-info small {
    color: #64748b;
    font-size: 0.8rem;
}

/* Método de pago en gestión */
.metodo-pago-actual {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.metodo-pago-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.metodo-pago-icono {
    font-size: 1.75rem;
}

.metodo-pago-detalle {
    display: flex;
    flex-direction: column;
}

.metodo-pago-tipo {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.metodo-pago-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Panel cambiar método */
.panel-cambiar-metodo {
    padding: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
}

.metodos-pago-opciones {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.metodo-opcion {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.metodo-opcion:hover {
    border-color: var(--primary);
    background: #f0f4ff;
}

.metodo-opcion.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
}

.metodo-opcion-icon {
    font-size: 1.5rem;
}

.metodo-opcion-nombre {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

.datos-sepa-actuales {
    padding: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 12px;
}

.sepa-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.sepa-info-row .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 50px;
}

.sepa-info-row .valor {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.panel-cambiar-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* Responsive SEPA */
@media (max-width: 480px) {
    .mandato-header {
        flex-direction: column;
        text-align: center;
    }

    .deudor-campo {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .deudor-campo .label {
        min-width: auto;
    }

    .deudor-campo .valor {
        font-size: 0.85rem;
    }

    .metodo-pago-actual {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .metodos-pago-opciones {
        flex-direction: column;
    }
}

/* ==================== GESTIÓN LICENCIAS (SUPERADMIN) ==================== */

.badge-primary {
    background: #e7f1ff;
    color: #004085;
}

.btn-warning {
    background: #ffc107;
    color: #333;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.btn-warning:hover {
    background: #e0a800;
}

.licencia-empresa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.licencia-empresa-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.licencia-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.licencia-info-grid .info-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.licencia-info-grid .info-item label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    margin: 0;
}

.licencia-info-grid .info-item span {
    font-size: 0.95rem;
    color: #333;
}

.licencia-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.licencia-form-grid .form-group {
    margin-bottom: 0;
}

.licencia-acciones-rapidas {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Switch toggle para facturable */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin: 0;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.switch-toggle input:checked + .switch-slider {
    background-color: #28a745;
}

.switch-toggle input:checked + .switch-slider:before {
    transform: translateX(22px);
}

@media (max-width: 600px) {
    .licencia-info-grid {
        grid-template-columns: 1fr;
    }
    .licencia-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== CONFIGURACIÓN PLATAFORMA (SUPERADMIN) ==================== */

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.config-grid .card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.config-grid .form-group {
    margin-bottom: 1rem;
}

.config-grid .form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
}

.config-grid .form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.config-grid .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* Paginacion */
.paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}

.paginacion:empty {
    display: none;
}

.paginacion button {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border-color, #dee2e6);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: all 0.15s;
}

.paginacion button:hover:not(:disabled) {
    background: var(--primary-color, #667eea);
    color: white;
    border-color: var(--primary-color, #667eea);
}

.paginacion button.active {
    background: var(--primary-color, #667eea);
    color: white;
    border-color: var(--primary-color, #667eea);
    font-weight: 600;
}

.paginacion button:disabled {
    opacity: 0.4;
    cursor: default;
}

.paginacion .pag-info {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0.5rem;
}
