:root {
    --primary: #002B49;
    --primary-light: #004F9F;
    --accent: #FFC107;
    --accent-hover: #e0a800;
    --bg-color: #F4F6F9;
    --card-bg: #FFFFFF;
    --text-color: #1E293B;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --success: #28a745;
    --danger: #dc3545;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 43, 73, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-bottom: 20px;
    -webkit-tap-highlight-color: transparent;
}

/* HEADER */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, #00192d 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-bottom: 4px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-main h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #FFFFFF;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--accent);
    margin-top: 2px;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-dashboard-nav {
    background: var(--success);
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.btn-dashboard-nav:hover {
    background: #218838;
}

.header-logo {
    background: rgba(255, 255, 255, 0.12);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 900;
    font-size: 0.8rem;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* CONTAINER */
main {
    max-width: 650px;
    margin: 0 auto;
    padding: 16px;
}

.section-badge {
    background: var(--primary);
    color: #FFF;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 5px solid var(--accent);
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 1rem;
    color: var(--primary);
    margin: 18px 0 10px 4px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* CARDS */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* INPUT GROUPS */
.input-group {
    margin-bottom: 14px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
    background-color: #FAFAFA;
    transition: all 0.2s ease;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    background-color: #FFF;
    box-shadow: 0 0 0 3px rgba(0, 79, 159, 0.12);
}

.input-uppercase {
    text-transform: uppercase;
    font-weight: 600;
}

.row {
    display: flex;
    gap: 12px;
}

.half { flex: 1; }
.third { flex: 1; }
.col-6 { width: calc(50% - 6px); }

/* CONTROL ASISTENCIA */
.workers-counter-bar {
    background: #E0F2FE;
    border: 1px solid #7DD3FC;
    color: #0369A1;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.badge-count {
    background: var(--primary);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
}

.asistencia-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.worker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #F8FAFC;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.worker-item.selected {
    background: #E8F4EA;
    border-color: #A3D9A5;
}

.worker-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
}

/* SWITCH TOGGLE */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

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

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

.slider:before {
    position: absolute;
    content: "";
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(22px); }

/* BOTONES */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #FFF;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 43, 73, 0.2);
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: #64748B;
    color: #fff;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
}

.btn-add-worker {
    background: var(--accent);
    color: var(--primary);
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(255, 193, 7, 0.3);
}

/* FOTOS GRID */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.photo-upload-box {
    position: relative;
    aspect-ratio: 4/3;
    background: #F1F5F9;
    border: 2px dashed #94A3B8;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--primary-light);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
}

.photo-placeholder i { font-size: 1.5rem; }

.img-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-photo {
    position: absolute;
    top: 4px; right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

/* GRID DE 12 PILAS */
.pilas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.pila-btn {
    background: #F8FAFC;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 10px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.pila-btn.has-data {
    background: #E8F4EA;
    border-color: #28a745;
    color: #1e7e34;
}

/* MODAL */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 43, 73, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPop 0.2s ease;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.modal-header h3 {
    color: var(--primary);
    font-size: 1.1rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted);
    cursor: pointer;
}

.form-section {
    background: #F8FAFC;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.form-section h4 {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.checkbox-container input {
    width: 18px; height: 18px;
}

/* ACTION BAR */
.action-bar {
    display: flex;
    gap: 12px;
}

.action-bar button { flex: 1; }

.hidden { display: none !important; }
.spacer-bottom { height: 40px; }

/* SPINNER OVERLAY */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 43, 73, 0.85);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    font-weight: bold;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* FOOTER CREDITS */
.author-credits {
    text-align: center;
    padding: 20px 10px 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
}

.author-email { color: var(--primary-light); text-decoration: none; }

.btn-whatsapp {
    display: inline-block;
    margin-top: 8px;
    background: #25D366;
    color: #fff;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: bold;
    font-size: 0.75rem;
}
