/* SOSGroup Fichajes - Frontend (mobile first) */

/* Modo app: cuando la página es solo este shortcode, ocupar pantalla */
body.sos-app-mode {
    margin: 0;
    padding: 0;
    background: #f3f4f6;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

body.sos-app-mode .sos-app-shell {
    min-height: 100vh;
    padding: 16px 0 24px;
}

.sos-fichajes-wrapper {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937;
}

.sos-fichajes-wrapper * {
    box-sizing: border-box;
}

.sos-header {
    text-align: center;
    margin-bottom: 16px;
}

.sos-header h1 {
    font-size: 1.4rem;
    margin: 0 0 4px;
    color: #0b3d91;
}

.sos-user {
    font-weight: 600;
    margin: 0;
}

.sos-server-time {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 4px 0 0;
}

.sos-status-box {
    min-height: 0;
    margin-bottom: 12px;
}

.sos-status-box.success,
.sos-status-box.error,
.sos-status-box.info {
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 500;
    line-height: 1.35;
}

.sos-status-box.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.sos-status-box.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.sos-status-box.info    { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }

.sos-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.sos-card h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    color: #111827;
}

.sos-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin: 8px 0 4px;
}

.sos-select,
.sos-input {
    width: 100%;
    padding: 12px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}

.sos-btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 18px 14px;
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    margin-top: 12px;
    text-decoration: none;
    text-align: center;
}

.sos-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.sos-btn-icon {
    margin-right: 6px;
}

.sos-btn-in {
    background: #16a34a;
    color: #fff;
}

.sos-btn-out {
    background: #dc2626;
    color: #fff;
}

.sos-btn-primary {
    background: #0b3d91;
    color: #fff;
}

.sos-btn-secondary {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #d1d5db;
}

.sos-help {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 10px 0 0;
    text-align: center;
}

.sos-empty {
    color: #6b7280;
    font-style: italic;
}

.sos-table-wrap {
    overflow-x: auto;
}

.sos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.sos-table th,
.sos-table td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid #f1f5f9;
}

.sos-table thead th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.sos-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sos-pill-valid    { background: #dcfce7; color: #166534; }
.sos-pill-pending  { background: #fef9c3; color: #854d0e; }
.sos-pill-approved { background: #dbeafe; color: #1e40af; }
.sos-pill-rejected { background: #fee2e2; color: #991b1b; }

.sos-form { margin-top: 12px; }

.sos-locked {
    text-align: center;
    padding: 30px 16px;
}

.sos-boot-indicator {
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 8px 0 0;
    font-style: italic;
}

.sos-boot-indicator.sos-boot-ready {
    color: #16a34a;
    font-style: normal;
}

/* ------------------------------------------------------------------ */
/* Header de app (saludo + cronómetro)                                 */
/* ------------------------------------------------------------------ */

.sos-header-app {
    background: linear-gradient(135deg, #0b3d91 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: 16px;
    padding: 20px 18px;
    margin-bottom: 14px;
    text-align: left;
}

.sos-header-app .sos-greeting {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sos-header-app .sos-hi {
    font-size: 0.9rem;
    opacity: 0.85;
}

.sos-header-app .sos-name {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.sos-header-app .sos-server-time {
    color: rgba(255,255,255,0.85);
    margin: 10px 0 0;
    font-size: 0.85rem;
}

.sos-active-shift {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    font-size: 0.95rem;
}

.sos-active-shift-label { opacity: 0.85; }
.sos-active-shift-from  { font-weight: 700; }
.sos-active-shift-elapsed {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* Botones extra grandes para app */
.sos-btn-lg {
    padding: 22px 14px;
    font-size: 1.15rem;
    border-radius: 14px;
}

/* ------------------------------------------------------------------ */
/* Login mobile-first                                                  */
/* ------------------------------------------------------------------ */

.sos-login-wrapper {
    max-width: 420px;
    padding-top: 32px;
}

.sos-login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.sos-login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.sos-login-title {
    color: #0b3d91;
    font-size: 1.6rem;
    margin: 6px 0 2px;
    font-weight: 700;
}

.sos-login-subtitle {
    margin: 0;
    color: #6b7280;
    letter-spacing: 0.2em;
    font-size: 0.85rem;
}

.sos-login-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sos-input-lg {
    padding: 14px 14px;
    font-size: 1.05rem;
    border-radius: 10px;
}

.sos-login-links {
    text-align: center;
    margin: 14px 0 0;
}
.sos-login-links a {
    color: #0b3d91;
    text-decoration: none;
    font-size: 0.9rem;
}
.sos-login-links a:hover { text-decoration: underline; }

.sos-login-foot {
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
    margin-top: 22px;
}

/* ------------------------------------------------------------------ */
/* Footer app (logout + boot)                                          */
/* ------------------------------------------------------------------ */

.sos-app-footer {
    text-align: center;
    padding-top: 14px;
    margin-top: 8px;
}

.sos-logout {
    display: inline-block;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}
.sos-logout:hover { color: #dc2626; border-color: #fecaca; }

/* Instalación fija (cuando empleado tiene una sola asignada) */
.sos-worksite-fixed {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-top: 4px;
}
.sos-worksite-icon { font-size: 1.3rem; line-height: 1; }
.sos-worksite-name { flex: 1; }
.sos-worksite-address {
    color: #6b7280;
    font-weight: normal;
    font-size: 0.82rem;
    line-height: 1.3;
}

.sos-no-worksite {
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    color: #854d0e;
}

/* Vista coordinador: empleados fichados ahora */
.sos-card-supervisor h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sos-card-supervisor .sos-live-dot {
    display: inline-block;
    width: 10px; height: 10px;
    background: #16a34a;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(22,163,74,0.15);
    animation: sosPulseLive 1.6s ease-in-out infinite;
}
@keyframes sosPulseLive {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.85; }
}
.sos-supervisor-count {
    background: #16a34a;
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 700;
    margin-left: auto;
}
.sos-supervisor-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sos-supervisor-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
}
.sos-supervisor-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.sos-supervisor-info strong {
    font-size: 0.95rem;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sos-supervisor-meta {
    font-size: 0.8rem;
    color: #6b7280;
}

/* PWA install */
.sos-pwa-install {
    margin: 12px 0;
    padding: 14px;
    background: #eff6ff;
    border: 1px dashed #bfdbfe;
    border-radius: 10px;
    text-align: center;
}
.sos-pwa-instructions {
    margin-top: 10px;
    text-align: left;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
}
.sos-pwa-instructions summary {
    cursor: pointer;
    font-weight: 600;
    color: #0b3d91;
}

/* Rangos horarios regularización */
.sos-corr-range-title {
    font-weight: 700;
    color: #0b3d91;
    margin: 8px 0 4px;
    font-size: 0.95rem;
}
.sos-corr-range-title:empty { display: none; }
.sos-corr-times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.sos-corr-times label {
    display: flex;
    flex-direction: column;
}
.sos-corr-times .sos-label {
    font-size: 0.78rem;
    margin-bottom: 2px;
}

/* Historial colapsable */
.sos-history-collapse {
    border-top: 1px dashed #e5e7eb;
    padding-top: 10px;
}
.sos-history-toggle {
    cursor: pointer;
    color: #0b3d91;
    font-weight: 600;
    font-size: 0.9rem;
    list-style: none;
    padding: 8px 12px;
    background: #eff6ff;
    border-radius: 8px;
    text-align: center;
}
.sos-history-toggle::-webkit-details-marker { display: none; }
.sos-history-collapse[open] .sos-history-toggle::after {
    content: ' ▴';
}
.sos-history-collapse:not([open]) .sos-history-toggle::after {
    content: ' ▾';
}

/* Documentos del empleado (agrupados) */
.sos-doc-group { margin-bottom: 16px; }
.sos-doc-group:last-child { margin-bottom: 0; }

.sos-doc-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 8px;
    font-size: 1rem;
    color: #0b3d91;
    border-bottom: 2px solid #eff6ff;
    padding-bottom: 6px;
}
.sos-doc-group-count {
    display: inline-block;
    min-width: 22px;
    text-align: center;
    background: #0b3d91;
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
}
.sos-doc-group-nominas .sos-doc-group-title    { color: #166534; border-bottom-color: #dcfce7; }
.sos-doc-group-nominas .sos-doc-group-count    { background: #16a34a; }
.sos-doc-group-contratos .sos-doc-group-title  { color: #5b21b6; border-bottom-color: #ede9fe; }
.sos-doc-group-contratos .sos-doc-group-count  { background: #7c3aed; }
.sos-doc-group-otros .sos-doc-group-title      { color: #92400e; border-bottom-color: #fef3c7; }
.sos-doc-group-otros .sos-doc-group-count      { background: #f59e0b; }

.sos-doc-group-empty {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85rem;
    margin: 4px 0 8px;
}

.sos-docs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sos-doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.sos-doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sos-doc-type {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 6px;
    background: #eff6ff;
    color: #1e3a8a;
}
.sos-doc-type-contrato    { background: #ede9fe; color: #5b21b6; }
.sos-doc-type-nomina      { background: #dcfce7; color: #166534; }
.sos-doc-type-certificado { background: #fef3c7; color: #92400e; }
.sos-doc-type-parte       { background: #fee2e2; color: #991b1b; }
.sos-doc-type-otro        { background: #e5e7eb; color: #374151; }

.sos-doc-title { font-size: 0.95rem; color: #111827; line-height: 1.2; }
.sos-doc-meta  { font-size: 0.78rem; color: #6b7280; }

.sos-doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sos-doc-btn {
    display: inline-block !important;
    width: auto !important;
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
    border-radius: 6px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

@media (max-width: 480px) {
    .sos-doc-item { flex-direction: column; align-items: stretch; }
    .sos-doc-actions { justify-content: flex-end; }
}

/* Registro: CTA en pantalla de login */
.sos-login-register-cta {
    margin-top: 18px;
    text-align: center;
    padding: 14px;
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
}
.sos-login-register-cta p {
    margin: 0 0 8px;
    color: #6b7280;
    font-size: 0.9rem;
}

/* ================================================================
   Split-screen login (desktop) / stacked (mobile)
   ================================================================ */

/* El wrapper ocupa toda la pantalla cuando está en modo app */
body.sos-app-mode .sos-app-shell {
    padding: 0;
}
body.sos-app-mode .sos-fichajes-wrapper {
    max-width: none;
    padding: 0;
}

.sos-split-login {
    display: flex;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── Panel izquierdo ── */
.sos-split-left {
    flex: 1 1 45%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 60px 48px;
}

.sos-split-left-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #fff;
}

.sos-split-logo-wrap {
    margin-bottom: 20px;
}
.sos-split-logo-wrap img {
    width: 90px;
    height: 90px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    object-fit: contain;
    background: rgba(255,255,255,.15);
    padding: 6px;
}
.sos-split-logo-wrap svg {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}

.sos-split-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 6px;
    color: #fff;
    letter-spacing: -0.02em;
}

.sos-split-sub {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .18em;
    color: rgba(255,255,255,.7);
    margin: 0 0 36px;
}

.sos-split-tagline {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 10px;
    font-size: 0.88rem;
    color: rgba(255,255,255,.9);
    text-align: left;
    backdrop-filter: blur(4px);
}

/* Decoraciones geométricas */
.sos-split-deco {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    pointer-events: none;
}
.sos-split-deco-1 {
    width: 340px;
    height: 340px;
    bottom: -80px;
    right: -100px;
}
.sos-split-deco-2 {
    width: 200px;
    height: 200px;
    top: -60px;
    left: -60px;
}

/* ── Panel derecho ── */
.sos-split-right {
    flex: 1 1 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 40px 24px;
}

.sos-split-form-wrap {
    width: 100%;
    max-width: 400px;
}

.sos-split-mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: 28px;
}
.sos-split-mobile-logo img,
.sos-split-mobile-logo svg {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    margin-bottom: 10px;
}
.sos-split-mobile-logo h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    color: #0f172a;
}

.sos-split-form-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.sos-split-form-sub {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0 0 28px;
}

/* Error */
.sos-split-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.875rem;
    margin-bottom: 20px;
}

/* Campos */
.sos-split-field {
    margin-bottom: 18px;
}
.sos-split-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: .01em;
}
.sos-split-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.sos-split-field-icon {
    position: absolute;
    left: 13px;
    font-size: 0.9rem;
    line-height: 1;
    pointer-events: none;
}
.sos-split-input-wrap input {
    width: 100%;
    padding: 13px 44px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #fff;
    color: #0f172a;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}
.sos-split-input-wrap input:focus {
    border-color: var(--sos-field-focus, #0b3d91);
    box-shadow: 0 0 0 3px rgba(11,61,145,.1);
}
.sos-split-eye {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    display: flex;
    align-items: center;
    opacity: 0.5;
    transition: opacity .15s;
}
.sos-split-eye:hover { opacity: 1; }

/* Botón principal */
.sos-split-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    margin-top: 8px;
    letter-spacing: .01em;
    box-shadow: 0 4px 14px rgba(11,61,145,.35);
    transition: opacity .15s, transform .1s;
    text-decoration: none;
}
.sos-split-btn:hover { opacity: .92; transform: translateY(-1px); }
.sos-split-btn:active { transform: translateY(0); }
.sos-split-btn[disabled] { opacity: .6; cursor: not-allowed; }
.sos-split-btn-arrow {
    font-size: 1.1rem;
    transition: transform .15s;
}
.sos-split-btn:hover .sos-split-btn-arrow { transform: translateX(3px); }

/* Olvidé la contraseña */
.sos-split-forgot {
    text-align: center;
    margin: 16px 0 0;
    font-size: 0.875rem;
}
.sos-split-forgot a {
    text-decoration: none;
    font-weight: 600;
}
.sos-split-forgot a:hover { text-decoration: underline; }

/* Registro */
.sos-split-register {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}
.sos-split-register a {
    font-weight: 700;
    text-decoration: none;
}
.sos-split-register a:hover { text-decoration: underline; }

/* Footer */
.sos-split-foot {
    text-align: center;
    margin-top: 24px;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ── Responsive: móvil ── */
@media (max-width: 768px) {
    .sos-split-login {
        flex-direction: column;
        min-height: auto;
    }
    .sos-split-left {
        display: none;
    }
    .sos-split-right {
        flex: none;
        min-height: 100vh;
        padding: 32px 20px 40px;
        background: #f8fafc;
    }
    .sos-split-mobile-logo {
        display: block;
    }
}

/* ════════════════════════════════════════════
   DASHBOARD v2 — Employee App (sav2-*)
   ════════════════════════════════════════════ */

.sos-app-v2 {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937;
}

/* HEADER */
.sav2-header {
    border-radius: 0 0 20px 20px;
    padding: 20px 24px 16px;
    color: #fff;
    margin-bottom: 16px;
}
.sav2-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.sav2-greeting {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sav2-hi {
    font-size: .85rem;
    opacity: .8;
}
.sav2-name {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}
.sav2-time {
    font-size: .8rem;
    opacity: .75;
    text-align: right;
    white-space: nowrap;
}
.sav2-active-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: .82rem;
    color: #fff;
}
.sav2-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: sav2-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}
.sav2-elapsed {
    font-weight: 700;
    margin-left: 4px;
}
@keyframes sav2-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(.7); }
}

/* ALERTAS */
.sav2-alerts {
    padding: 0 16px;
}
.sav2-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: .875rem;
    color: #1e40af;
}
.sav2-alert-icon { font-size: 1.1rem; flex-shrink: 0; }
.sav2-alert strong { display: block; margin-bottom: 2px; }

/* GRID PRINCIPAL */
.sav2-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0 16px;
    margin-top: 4px;
    align-items: start;
}

/* CARDS */
.sav2-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
    padding: 20px;
    margin-bottom: 0;
}
.sav2-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.sav2-card-head h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    flex: 1;
}

/* BADGE */
.sav2-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: .75rem;
    font-weight: 700;
    padding: 0 6px;
}
.sav2-badge-green { background: #dcfce7; color: #15803d; }

/* WORKSITE PILL */
.sav2-ws-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: .875rem;
}
.sav2-ws-pill > span { font-size: 1.1rem; }
.sos-worksite-name { display: block; font-weight: 700; color: #166534; }
.sos-worksite-address { display: block; color: #6b7280; font-size: .8rem; margin-top: 1px; }

/* WORKSITE SELECT */
.sav2-ws-select-wrap { margin-bottom: 16px; }
.sav2-select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: .9rem;
    background: #f9fafb;
    color: #1f2937;
    outline: none;
    transition: border-color .15s;
}
.sav2-select:focus { border-color: #6366f1; }

/* CLOCK BUTTON */
.sav2-clock-action { margin-bottom: 12px; }
.sav2-clock-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform .1s, box-shadow .1s;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.sav2-clock-btn:active { transform: scale(.97); }
.sav2-btn-out { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important; }
.sav2-clock-icon { font-size: 1rem; line-height: 1; }
.sav2-gps-note { font-size: .75rem; color: #9ca3af; text-align: center; margin: 0; }

/* EMPTY STATE */
.sav2-empty-ws, .sav2-empty-msg {
    text-align: center;
    color: #6b7280;
    font-size: .875rem;
    padding: 8px 0;
}
.sav2-empty-icon { font-size: 2rem; margin-bottom: 6px; }

/* RECORDS */
.sav2-records-list { display: flex; flex-direction: column; gap: 8px; }
.sav2-record-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #f9fafb;
}
.sav2-rec-in  { border-left: 3px solid #22c55e; }
.sav2-rec-out { border-left: 3px solid #ef4444; }
.sav2-rec-dot {
    font-size: .7rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    flex-shrink: 0;
    color: #374151;
}
.sav2-rec-in .sav2-rec-dot  { background: #dcfce7; color: #16a34a; }
.sav2-rec-out .sav2-rec-dot { background: #fee2e2; color: #dc2626; }
.sav2-rec-info { flex: 1; }
.sav2-rec-info strong { display: block; font-size: .9rem; font-weight: 700; color: #1f2937; }
.sav2-rec-info span   { font-size: .78rem; color: #6b7280; }

/* HISTORIAL COLLAPSE */
.sav2-history-collapse { margin-top: 10px; }
.sav2-history-toggle {
    font-size: .82rem;
    color: #6366f1;
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sav2-history-toggle::-webkit-details-marker { display: none; }
.sav2-history-toggle::before { content: '▸'; font-size: .7rem; }
details[open] .sav2-history-toggle::before { content: '▾'; }

/* LIVE LIST (supervisor) */
.sav2-live-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sav2-live-item { display: flex; align-items: center; gap: 10px; }

/* DOCS */
.sav2-doc-group-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #9ca3af; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.sav2-docs-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sav2-doc-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: #f9fafb; border-radius: 10px; }
.sav2-doc-info { flex: 1; min-width: 0; }
.sav2-doc-info strong { display: block; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sav2-doc-meta { font-size: .75rem; color: #9ca3af; }
.sav2-doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sav2-doc-btn {
    font-size: .75rem;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.sav2-doc-btn-view { background: #e0f2fe; color: #0369a1; }
.sav2-doc-btn-dl   { background: #ede9fe; color: #6d28d9; }

/* AUSENCIAS / CORRECCIONES */
.sav2-secondary-btn {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px dashed #d1d5db;
    border-radius: 10px;
    background: #fff;
    font-size: .875rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: left;
}
.sav2-secondary-btn:hover { background: #f9fafb; }
.sav2-form { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.sav2-date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sav2-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; }
.sav2-checkbox-row input { width: 16px; height: 16px; cursor: pointer; }

/* FOOTER CARD */
.sav2-card-footer { padding: 16px 20px; }
.sav2-app-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.sav2-logout {
    font-size: .875rem;
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 14px;
    border: 1.5px solid #fecaca;
    border-radius: 8px;
}
.sav2-logout:hover { background: #fff1f2; }

/* ACCORDION (mobile collapsible, desktop always open) */
.sav2-accordion { list-style: none; }
.sav2-accordion-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    list-style: none;
}
.sav2-accordion-head::-webkit-details-marker { display: none; }
.sav2-accordion-head h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}
.sav2-accordion-arrow {
    font-size: 1.3rem;
    font-weight: 700;
    color: #9ca3af;
    transition: transform .2s;
    display: none;
}
.sav2-accordion[open] .sav2-accordion-arrow { transform: rotate(90deg); }
.sav2-accordion-body { }

/* Desktop: accordion also collapsible, but styled differently */
@media (min-width: 821px) {
    .sav2-accordion-arrow {
        display: block;
        font-size: 1.1rem;
        color: #b0b5bf;
        transition: transform .2s;
    }
    .sav2-accordion[open] .sav2-accordion-arrow { transform: rotate(90deg); color: #6366f1; }
    .sav2-accordion-head {
        padding: 2px 0;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 0;
    }
    .sav2-accordion[open] .sav2-accordion-head {
        border-bottom: none;
        margin-bottom: 16px;
    }
}

/* ── RESPONSIVE: Móvil (dashboard v2) ── */
@media (max-width: 820px) {
    .sav2-main-grid {
        grid-template-columns: 1fr;
    }
    .sos-app-v2 {
        padding-bottom: 24px;
    }
    .sav2-card { border-radius: 12px; padding: 16px; }
    .sav2-header { border-radius: 0 0 16px 16px; padding: 16px 16px 12px; }
    .sav2-main-grid { padding: 0 10px; gap: 12px; }
    .sav2-alerts { padding: 0 10px; }

    /* Accordion: show arrow, collapse by default */
    .sav2-accordion-arrow { display: block; }
    .sav2-accordion-head { margin-bottom: 0; padding: 4px 0; }
    .sav2-accordion[open] .sav2-accordion-head { margin-bottom: 14px; }
    .sav2-accordion { padding: 16px; }
}
