/* --- Variables y Reseteo --- */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #059669;
    --text-dark: #111827;
    --text-light: #4b5563;
    --background-light: #f3f4f6;
    --background-white: #ffffff;
    --border-color: #d1d5db;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --font-family: 'Poppins', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-family); background-color: var(--background-light); color: var(--text-dark); line-height: 1.6; }

/* --- Layout Principal --- */
.container { max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem; }
header { text-align: center; margin-bottom: 2.5rem; }
header h1 { font-size: 2.5rem; font-weight: 600; color: var(--text-dark); }
header .subtitle { font-size: 1.1rem; color: var(--text-light); }
main { display: flex; flex-direction: column; gap: 2rem; }

/* --- Estilo de Tarjetas (Cards) --- */
.card { background-color: var(--background-white); border-radius: 0.75rem; box-shadow: var(--shadow); padding: 1.5rem; border: 1px solid var(--border-color); }
.card h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem; color: var(--primary-dark); }

/* --- Grid de Proyecciones --- */
.projection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1.25rem; }
.stat-card { background-color: var(--background-light); padding: 1rem; border-radius: 0.5rem; text-align: center; border: 1px solid #e5e7eb; position: relative; }
.stat-card h4 { font-size: 0.9rem; font-weight: 500; color: var(--text-light); margin-bottom: 0.5rem; }
.stat-card p { font-size: 2rem; font-weight: 700; color: var(--primary-color); }
.stat-card.total p { color: var(--secondary-color); }
.stat-card.daily-goal p { color: #d97706; }
.stat-card.person-goal p { color: #c026d3; }

/* --- Panel de Configuración --- */
.settings-panel { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; }
.setting-item { display: flex; align-items: center; gap: 1rem; }
.setting-item label { font-weight: 500; }
#personnel-count, #deadline-days { width: 80px; padding: 0.5rem; font-size: 1.1rem; text-align: center; border: 1px solid var(--border-color); border-radius: 0.375rem; }
#deadline-container { transition: opacity 0.3s ease; }
#deadline-container.disabled { opacity: 0.5; pointer-events: none; }
.setting-item.lock-control { padding: 0.5rem 1rem; border-radius: 8px; background-color: #eef2ff; border: 1px solid #c7d2fe; }

/* --- Icono de Candado --- */
.stat-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1rem;
    opacity: 0.6;
}

/* --- Toggle Switch --- */
.switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--secondary-color); }
input:checked + .slider:before { transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* --- Sección de Avance --- */
.progress-section h4 { font-size: 1rem; font-weight: 500; margin-bottom: 0.75rem; text-align: center; color: var(--text-light); }
.global-progress-bar { width: 100%; background-color: #e5e7eb; border-radius: 8px; height: 30px; position: relative; overflow: hidden; }
.global-progress-bar .progress-fill { height: 100%; background-color: var(--secondary-color); border-radius: 8px; transition: width 0.5s ease-in-out; }
.global-progress-bar .progress-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; text-shadow: 1px 1px 2px rgba(0,0,0,0.4); }
#client-progress-table { width: 100%; border-collapse: collapse; }
#client-progress-table th, #client-progress-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
#client-progress-table thead th { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; color: var(--text-light); background-color: var(--background-light); }
#client-progress-table td:not(:first-child) { text-align: center; font-weight: 500; }

/* --- Desglose de Metas Diarias --- */
.daily-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; text-align: center; }
.day-card { background-color: var(--background-light); padding: 1rem; border-radius: 0.5rem; border: 1px solid #e5e7eb; }
.day-card.is-today { border: 2px solid var(--primary-color); background-color: #eef2ff; }
.day-card .day-name { font-weight: 600; color: var(--text-light); text-transform: capitalize; }
.day-card .day-goal { font-size: 1.8rem; font-weight: 700; color: var(--primary-dark); margin-top: 0.25rem; }
.day-card.weekend { background-color: #fffbeb; border-color: #fde68a; }
.day-card.weekend .day-goal { color: #b45309; }

/* --- Tabla de Metas por Cliente --- */
#client-goals-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
#client-goals-table th, #client-goals-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
#client-goals-table thead th { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; color: var(--text-light); background-color: var(--background-light); }
#client-goals-table td:not(:first-child) { text-align: center; font-weight: 500; }
.percentage-bar { background-color: #e0e7ff; border-radius: 4px; height: 20px; width: 100%; position: relative; overflow: hidden; }
.percentage-fill { background-color: var(--primary-color); height: 100%; position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; color: white; font-size: 0.8rem; font-weight: 600; }

/* --- Contenedor de Formularios --- */
.forms-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
form { display: flex; flex-direction: column; }
form label { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.5rem; }
form input, form select { width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 0.375rem; font-size: 1rem; font-family: inherit; margin-bottom: 1rem; background-color: #f9fafb; }
form button { background-color: var(--primary-color); color: white; padding: 0.75rem 1rem; border: none; border-radius: 0.375rem; cursor: pointer; font-size: 1rem; font-weight: 600; transition: background-color 0.2s; margin-top: auto; }
form button:hover { background-color: var(--primary-dark); }
.form-description { font-size: 0.85rem; color: var(--text-light); margin-bottom: 1rem; background-color: #eef2ff; padding: 0.75rem; border-radius: 0.375rem; }

/* --- Tabla de Dashboard --- */
.table-wrapper { overflow-x: auto; }
#dashboard-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
#dashboard-table th, #dashboard-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
#dashboard-table thead th { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; color: var(--text-light); background-color: var(--background-light); }
#dashboard-table tbody tr:hover { background-color: #eff6ff; }
#dashboard-table tbody td:nth-child(2), #dashboard-table tbody td:nth-child(3) { text-align: center; font-weight: 500; font-size: 1.1rem; }

/* --- Elementos de UI Auxiliares --- */
#status-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(17, 24, 39, 0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; cursor: pointer; }
#status-message { background: var(--background-white); padding: 2rem 3rem; border-radius: 0.5rem; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); font-size: 1.1rem; cursor: default; }
.hidden { display: none !important; }