/* Reset */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
}

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   Topbar — diseño claro (rediseñada 2026-05-12)
   ============================================================ */
.topbar {
    background: #ffffff;
    color: #1a3a8c;
    padding: 0.6rem 1.25rem;
    box-shadow: 0 1px 0 #e6edf7;
    border-bottom: 1px solid #e6edf7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    z-index: 50;
    position: relative;
    min-height: 60px;
}

/* Bloque izquierdo: botón hamburguesa + marca */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 0 0 auto;
}

.btn-toggle-sidebar {
    background: #f0f6ff;
    color: #1a3a8c;
    border: 1px solid #d6e6fb;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.05s;
}
.btn-toggle-sidebar:hover  { background: #e3f2fd; }
.btn-toggle-sidebar:active { transform: scale(0.96); }

/* Logo de la app en la barra superior */
.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    flex-shrink: 0;
    padding: 4px 6px;
    border-radius: 8px;
}
.logo-link:hover { background: #f5f9ff; }
.logo-icono {
    width: 32px;
    height: 32px;
    display: block;
}
.logo-texto {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a3a8c;
    letter-spacing: -0.01em;
}

/* Bloque derecho: usuario/empresa + rol + salir */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 0 0 auto;
}

/* Bloque destacado: nombre de la empresa */
.topbar-empresa {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: linear-gradient(135deg, #f0f6ff 0%, #e3f2fd 100%);
    border: 1px solid #c5d7f5;
    border-radius: 10px;
    padding: 0.42rem 0.85rem;
    max-width: 280px;
    box-shadow: 0 1px 2px rgba(26, 58, 140, 0.04);
}
.topbar-empresa-icono {
    font-size: 1rem;
    line-height: 1;
    filter: saturate(0.85);
}
.topbar-empresa-nombre {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1a3a8c;
    letter-spacing: -0.005em;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Separador vertical entre bloques de la topbar */
.topbar-divider {
    width: 1px;
    height: 28px;
    background: #d6e6fb;
    margin: 0 0.15rem;
    flex: 0 0 auto;
}

.usuario-bloque {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    text-align: right;
}
.usuario-empresa {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a3a8c;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.usuario-email {
    font-size: 0.78rem;
    font-weight: 500;
    color: #5b8def;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rol-tag {
    background: #e3f2fd;
    color: #1a3a8c;
    border: 1px solid #d6e6fb;
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1;
}
/* Variantes de color por rol */
.rol-tag.rol-administrador { background: #e3f2fd; color: #1a3a8c; border-color: #d6e6fb; }
.rol-tag.rol-responsable   { background: #fff3e0; color: #e65100; border-color: #ffcc80; }
.rol-tag.rol-empleado      { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.rol-tag.rol-superadmin    { background: #f0f6ff; color: #1a3a8c; border-color: #c5d7f5; }
.rol-tag.rol-super         { background: #f0f6ff; color: #1a3a8c; border-color: #c5d7f5; }

.btn-logout {
    background: #ffffff;
    color: #1a3a8c;
    border: 1.5px solid #c5d7f5;
    padding: 0.42rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.btn-logout:hover  { background: #f0f6ff; border-color: #1e88e5; }
.btn-logout:active { background: #e3f2fd; }

@media (max-width: 600px) {
    .topbar { padding: 0.5rem 0.85rem; min-height: 56px; }
    .usuario-empresa { font-size: 0.85rem; max-width: 150px; }
    .usuario-email { font-size: 0.7rem; max-width: 150px; }
    .logo-texto { display: none; }
    .topbar-empresa { display: none; }
    .topbar-divider { display: none; }
    .btn-toggle-sidebar { width: 36px; height: 36px; }
}

/* Compatibilidad con código antiguo (queda en el CSS por si alguna vista lo usa) */
.usuario { font-size: 0.9rem; opacity: 0.9; display: inline-flex; align-items: center; gap: 0.5rem; }
.nav-links { display: flex; gap: 1rem; }
.nav-links a { color: rgba(255,255,255,0.9); text-decoration: none; font-size: 0.95rem; }
.nav-links a:hover { color: white; text-decoration: underline; }

/* ------------- Sidebar ------------- */
.layout-main {
    display: flex;
    flex: 1;
    min-height: 0;
}

.sidebar {
    width: 220px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    flex-shrink: 0;
    overflow-y: auto;
    transition: width 0.18s ease;
}

.sidebar-nav {
    padding: 0.75rem 0;
    display: flex;
    flex-direction: column;
}

.sidebar-grupo {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem 0.4rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 1rem;
    color: #555;
    text-decoration: none;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-nav a:hover {
    background: #f5f9fd;
    color: #1565c0;
}
.sidebar-nav a.active {
    background: #e3f2fd;
    color: #1565c0;
    border-left-color: #1e88e5;
    font-weight: 600;
}
.sidebar-nav .ico {
    width: 1.4rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}
.sidebar-nav .lbl { transition: opacity 0.15s; }

/* ----- Sidebar colapsada (solo iconos) ----- */
.sidebar-colapsada .sidebar { width: 56px; }
.sidebar-colapsada .sidebar-nav .lbl { display: none; }
.sidebar-colapsada .sidebar-grupo { display: none; }

/* Overlay para drawer en móvil */
.sidebar-overlay {
    display: none;
}

/* ------------- Main ------------- */
main {
    flex: 1;
    padding: 1.5rem 2rem;
    width: 100%;
    overflow-x: auto;
    min-width: 0;
}

h1 { margin-top: 0; color: #1e88e5; }

/* ------------- Botones ------------- */
.btn-primary {
    background: #1e88e5;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
}
.btn-primary:hover { background: #1976d2; }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

/* ------------- Login ------------- */
.login-card {
    max-width: 420px;
    margin: 3rem auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.field {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.field label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.field input {
    padding: 0.65rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.field input:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 3px rgba(30,136,229,0.15);
}

.error {
    color: #c62828;
    background: #ffebee;
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.exito {
    color: #2e7d32;
    background: #e8f5e9;
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.ayuda {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.4;
}
.ayuda code {
    background: #f5f5f5;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

/* ------------- Precio editable inline en grid de empresas ------------- */
.precio-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    color: #1565c0;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}
.precio-link:hover {
    background: #e3f2fd;
    text-decoration: underline;
}
.precio-edit-ico {
    font-size: 0.75em;
    opacity: 0.55;
}
.precio-link:hover .precio-edit-ico { opacity: 1; }

/* ------------- Fila destacada (precio vigente) ------------- */
.tabla tr.fila-vigente {
    background: #e8f5e9 !important;
    font-weight: 500;
}
.tabla tr.fila-vigente td:first-child {
    border-left: 4px solid #43a047;
}

/* ===============================================================
   Kiosco de fichaje (pantalla completa, optimizada para tablet 10")
   =============================================================== */
.kiosco-root {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 16px;
    overflow-x: hidden;
}

.k-loading, .k-error, .k-vacio {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 80vh; text-align: center;
    color: white;
}
.k-error h1 { font-size: 2rem; }

.k-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; margin-bottom: 24px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
}
.k-empresa { font-size: 1.6rem; font-weight: 600; color: white; }
.k-reloj { text-align: right; }
.k-hora { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.k-fecha { font-size: 0.95rem; opacity: 0.75; text-transform: capitalize; margin-top: 4px; }

/* ---- Grid de empleados ---- */
.k-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 0 8px;
}
.k-empleado {
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 16px 12px;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 200px;
    font-family: inherit;
}
.k-empleado:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}
.k-empleado:active { transform: translateY(0); }
.k-foto, .k-avatar {
    width: 90px; height: 90px; border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.25);
}
.k-avatar {
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; color: white;
}
.k-nombre {
    font-size: 1.1rem; font-weight: 600; text-align: center;
    line-height: 1.2;
}
.k-badge {
    font-size: 0.78rem; padding: 3px 10px; border-radius: 999px;
    font-weight: 600;
}
.k-badge-dentro { background: #16a34a; color: white; }
.k-badge-fuera  { background: rgba(148,163,184,0.5); color: white; }
.k-badge-enpausa{ background: #f59e0b; color: white; }

.k-estado-dentro  { border-color: rgba(22,163,74,0.5); }
.k-estado-enpausa { border-color: rgba(245,158,11,0.5); }

/* ---- Modal overlay ---- */
.k-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.k-modal {
    background: white; color: #111;
    border-radius: 16px;
    padding: 28px;
    min-width: 360px;
    max-width: 520px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.k-modal-grande { max-width: 680px; min-width: 480px; }
.k-modal h2 { color: #1e293b; }
.k-modal-empleado {
    color: #1e88e5; font-size: 1.2rem; font-weight: 600;
    margin-bottom: 1rem;
}
.k-modal-estado { color: #555; font-size: 1.05rem; margin-bottom: 1.5rem; }
.k-cerrar {
    position: absolute; top: 12px; right: 12px;
    background: transparent; border: none; font-size: 1.6rem;
    cursor: pointer; color: #999;
}
.k-cerrar:hover { color: #c62828; }

/* ---- PIN display ---- */
.k-pin-display {
    display: flex; justify-content: center; gap: 14px;
    margin: 1.5rem 0;
}
.k-pin-digit {
    display: flex; align-items: center; justify-content: center;
    width: 60px; height: 76px;
    border: 2px solid #ddd; border-radius: 10px;
    font-size: 2rem; color: #1e88e5;
    background: #fafafa;
}
.k-pin-digit.k-pin-filled {
    border-color: #1e88e5; background: #e3f2fd;
}
.k-pin-error {
    color: #c62828; font-weight: 600; text-align: center;
    background: #ffebee; padding: 0.6rem; border-radius: 6px;
    margin: 0.5rem 0;
}

/* ---- Numpad ---- */
.k-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 1rem;
}
.k-numpad-btn {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1.8rem;
    font-weight: 600;
    color: #1e293b;
    padding: 18px;
    cursor: pointer;
    transition: all 0.1s;
    user-select: none;
}
.k-numpad-btn:hover { background: #e3f2fd; border-color: #1e88e5; }
.k-numpad-btn:active { transform: scale(0.96); background: #bbdefb; }
.k-numpad-aux {
    background: #eceff1; color: #607d8b; font-size: 1.4rem;
}
.k-numpad-aux:hover { background: #cfd8dc; }

.k-numpad-ok {
    background: #43a047; color: #fff; font-weight: 700;
}
.k-numpad-ok:hover { background: #2e7d32; }
.k-numpad-ok:disabled { background: #c8e6c9; color: #fff; cursor: not-allowed; }

/* ---- Pantalla de PIN del kiosco (acceso a la tablet) ---- */
.k-pin-kiosco-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a3a8c 0%, #0d1b3d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.k-pin-kiosco-card {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    max-width: 420px;
    width: 100%;
    text-align: center;
}
.k-pin-kiosco-sub {
    color: #5b6b7f;
    margin: 0 0 0.4rem;
}

/* ---- Botones de fichar (grandes) ---- */
.k-botones {
    display: grid; gap: 14px;
    grid-template-columns: 1fr;
    margin-top: 1rem;
}
.k-btn {
    border: none; border-radius: 14px;
    padding: 24px;
    font-size: 1.5rem; font-weight: 700;
    color: white; cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    font-family: inherit;
}
.k-btn:active { transform: scale(0.98); }
.k-btn:disabled { opacity: 0.5; cursor: wait; }
.k-btn-entrada { background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); }
.k-btn-salida  { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }
.k-btn-pausa   { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

/* Tipos de pausa */
.k-tipos-pausa {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin-top: 1rem;
}
.k-btn-pausa-tipo {
    background: #fff3e0; border: 2px solid #fb8c00;
    color: #bf360c;
    border-radius: 12px;
    padding: 18px 14px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.k-btn-pausa-tipo:hover { background: #ffe0b2; }

/* ---- Confirmación ---- */
.k-modal-confirmacion {
    text-align: center;
    border-top: 4px solid #16a34a;
}
.k-modal-confirmacion h2 { color: #15803d; margin: 0.5rem 0; }
.k-check {
    width: 90px; height: 90px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem; font-weight: 900;
}
.k-confirm-hora {
    font-size: 2rem; font-weight: 700;
    color: #1e88e5; font-variant-numeric: tabular-nums;
    margin-top: 0.75rem;
}

/* Responsive — tablet 10" en horizontal vs vertical */
@media (max-width: 900px) {
    .k-empresa { font-size: 1.2rem; }
    .k-hora { font-size: 1.8rem; }
    .k-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .k-foto, .k-avatar { width: 70px; height: 70px; }
    .k-modal { min-width: auto; }
}

/* =============== Planning Gantt =============== */
.plng-toolbar {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, #f5faff 0%, #e3f2fd 100%);
    border: 1px solid #bbdefb;
    border-radius: 8px;
}
.plng-grupo {
    display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap;
}
.plng-grupo > .ayuda {
    color: #1565c0; font-weight: 600;
    text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px;
    margin-right: 0.25rem;
}
.plng-rango {
    min-width: 180px; text-align: center;
    color: #0d47a1; font-size: 1.1rem; font-weight: 600;
    padding: 0 0.5rem;
    text-transform: capitalize;
}

/* Botones del toolbar — coherentes con el estilo */
.plng-toolbar .btn-secundario {
    background: white;
    border: 1px solid #cfd8dc;
    color: #1565c0;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
    font-weight: 500;
}
.plng-toolbar .btn-secundario:hover {
    border-color: #1e88e5;
    background: #e3f2fd;
}
.plng-zoom-sel {
    background: #1e88e5 !important;
    color: white !important;
    border-color: #1565c0 !important;
    box-shadow: 0 2px 4px rgba(30,136,229,0.3);
}

/* Pills de tipos */
.plng-tipo-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: white;
    border: 2px solid #cfd8dc;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem; font-weight: 600;
    color: #455a64;
    cursor: pointer;
    transition: all 0.15s;
}
.plng-tipo-btn:hover {
    border-color: var(--plng-color, #1e88e5);
    transform: translateY(-1px);
}
.plng-tipo-btn .plng-tipo-color {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--plng-color, #9e9e9e);
    display: inline-block;
    box-shadow: 0 0 0 2px white, 0 0 0 3px rgba(0,0,0,0.1);
}
.plng-tipo-sel {
    background: var(--plng-color, #1e88e5) !important;
    border-color: var(--plng-color, #1565c0) !important;
    color: white !important;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}
.plng-tipo-sel .plng-tipo-color {
    background: white !important;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.plng-modo-borrar-sel {
    background: #c62828 !important;
    color: white !important;
    border-color: #b71c1c !important;
    box-shadow: 0 3px 8px rgba(198,40,40,0.3);
}

/* Filtro centro */
.plng-toolbar select {
    padding: 0.4rem 0.7rem;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    background: white;
    font-size: 0.88rem;
}

/* ----- Banner de acción tras preseleccionar rango ----- */
.plng-accion-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #fb8c00;
    border-radius: 10px;
    padding: 0.85rem 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(251,140,0,0.2);
    animation: plng-banner-aparece 0.2s ease-out;
}
@keyframes plng-banner-aparece {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}
.plng-accion-info {
    display: flex; align-items: center; gap: 0.85rem;
    color: #5d4037;
}
.plng-accion-info strong { color: #bf360c; }
.plng-accion-info .ayuda { display: block; font-size: 0.82rem; }
.plng-accion-icono { font-size: 1.6rem; }
.plng-accion-botones {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.plng-accion-botones .ayuda {
    color: #6d4c41; font-weight: 600;
    text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px;
}

/* ----- Wrapper de tabla ----- */
.plng-wrapper {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    user-select: none;
}
.plng-tabla {
    border-collapse: collapse;
    font-size: 0.78rem;
    table-layout: fixed;
    background: white;
}
.plng-tabla th, .plng-tabla td {
    padding: 0;
    border: 1px solid #eceff1;
    width: var(--plng-cell-w, 32px);
    height: 34px;
    text-align: center;
    box-sizing: border-box;
}

/* ----- Cabeceras ----- */
.plng-tabla thead th {
    background: #f5f5f5;
    font-weight: 600;
    position: sticky; top: 0; z-index: 4;
}
.plng-cabecera-meses th {
    height: 28px;
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%) !important;
    color: white;
    border-color: #1565c0 !important;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: capitalize;
    z-index: 5;
}
.plng-cabecera-dias th {
    color: #455a64;
    font-size: 0.75rem;
    font-weight: 600;
    background: #fafafa;
    z-index: 4;
}
.plng-th-finde {
    background: #cfd8dc !important;
    color: #455a64 !important;
}
.plng-th-hoy {
    background: #ffd54f !important;
    color: #5d4037 !important;
    box-shadow: inset 0 -3px 0 #f57c00;
}

/* ----- Columna empleado sticky ----- */
.plng-emp-col {
    width: 220px !important;
    text-align: left !important;
    padding: 8px 12px !important;
    background: white;
    position: sticky; left: 0; z-index: 3;
    border-right: 2px solid #cfd8dc !important;
    font-size: 0.88rem;
}
.plng-tabla thead .plng-emp-col {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%) !important;
    color: white;
    z-index: 6;
    border-right-color: #1565c0 !important;
}
.plng-tabla tbody tr:nth-child(even) .plng-emp-col { background: #fafbfc; }
.plng-tabla tbody tr:hover .plng-emp-col { background: #e3f2fd; }

/* ----- Filas alternadas para contraste ----- */
.plng-tabla tbody tr:nth-child(even) td { background: #fafbfc; }
.plng-tabla tbody tr:hover td { background: #f5faff; }

/* ----- Celdas ----- */
.plng-celda {
    background: white;
    cursor: crosshair;
    transition: background 0.1s;
    position: relative;
}
.plng-celda:hover {
    background: #fff3e0 !important;
    box-shadow: inset 0 0 0 1px #fb8c00;
}
.plng-celda-finde {
    background: #eceff1 !important;
}
.plng-celda-finde:hover {
    background: #cfd8dc !important;
}
.plng-celda-hoy {
    box-shadow: inset 0 0 0 2px #1e88e5 !important;
}

/* CELDA ASIGNADA — alto contraste */
.plng-celda-asig {
    cursor: pointer;
    background-clip: padding-box;
    position: relative;
    border: 1px solid rgba(0,0,0,0.25) !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -2px 0 rgba(0,0,0,0.2);
}
.plng-celda-asig:hover {
    filter: brightness(1.15);
    z-index: 2;
    transform: scale(1.05);
}

/* ---- Selección de rango ----
   .plng-sel       → rango pre-seleccionado (estático, esperando acción del usuario)
   .plng-sel-dragging → mientras el usuario está arrastrando (con animación) */
.plng-sel { z-index: 2; }
.plng-sel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 167, 38, 0.55);   /* naranja: "preseleccionado, esperando" */
    border: 2px solid #e65100;
    z-index: 10;
    pointer-events: none;
}
.plng-sel-dragging::before {
    background: rgba(30, 136, 229, 0.55);
    border-color: #0d47a1;
    animation: plng-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes plng-pulse {
    0%   { background: rgba(30, 136, 229, 0.45); }
    100% { background: rgba(30, 136, 229, 0.70); }
}

/* Contador flotante mientras seleccionamos (lo añade el JS al primer y último elemento) */
.plng-sel-borde-izq::after {
    content: attr(data-rango);
    position: absolute;
    top: -28px;
    left: 0;
    background: #0d47a1;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ----- Leyenda ----- */
.plng-leyenda {
    display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: #fafbfc;
    border: 1px solid #eceff1;
    border-radius: 8px;
    font-size: 0.9rem;
}
.plng-leyenda > strong { color: #1565c0; }
.plng-leyenda-item {
    display: inline-flex; align-items: center; gap: 0.5rem;
    color: #455a64;
}
.plng-leyenda-color {
    display: inline-block; width: 20px; height: 20px;
    border-radius: 4px;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.1);
}

/* =============== Mi planning (empleado) =============== */
.mi-plng-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.mi-plng-mes {
    background: white; border: 1px solid #eee; border-radius: 6px;
    padding: 0.85rem;
}
.mi-plng-mes h3 { margin: 0 0 0.5rem; color: #1565c0; font-size: 1rem; }
.mi-plng-cab {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2px; font-size: 0.75rem; font-weight: 600; color: #888;
    text-align: center; margin-bottom: 0.3rem;
}
.mi-plng-cab .mi-plng-finde { color: #c62828; }
.mi-plng-dias {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.mi-plng-dia, .mi-plng-dia-vacio {
    aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; border-radius: 4px;
    background: #fafafa;
}
.mi-plng-dia-vacio { background: transparent; }
.mi-plng-finde { color: #c62828; }
.mi-plng-hoy { border: 2px solid #1e88e5; font-weight: 700; }

/* =============== Mensajería interna =============== */
.msg-badge-sidebar {
    background: #c62828;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px white;
}

.msg-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.msg-lista {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 70vh; overflow-y: auto;
    padding-right: 4px;
}

.msg-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    cursor: pointer;
    transition: all 0.1s;
}
.msg-item:hover {
    border-color: #1e88e5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.msg-item-sel {
    border-color: #1e88e5 !important;
    background: #f5faff;
    box-shadow: 0 2px 6px rgba(30,136,229,0.15);
}
.msg-item-noleido { border-left: 4px solid #c62828 !important; }
.msg-item-noleido .msg-asunto { font-weight: 700; }

.msg-item-cab {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.75rem; margin-bottom: 0.3rem;
}
.msg-fecha { color: #888; }
.msg-asunto { font-size: 0.95rem; color: #1e293b; margin-bottom: 0.2rem; }
.msg-preview {
    font-size: 0.82rem; color: #666;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-bottom: 0.4rem;
}
.msg-item-pie {
    display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap;
    font-size: 0.75rem;
}
.msg-punto-rojo {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: #c62828; margin-right: 4px;
}

/* Categoría pills */
.msg-cat {
    display: inline-block;
    padding: 2px 8px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600;
}
.msg-cat-sugerencia { background: #e8f5e9; color: #2e7d32; }
.msg-cat-peticion   { background: #e3f2fd; color: #1565c0; }
.msg-cat-pregunta   { background: #ede7f6; color: #5e35b1; }
.msg-cat-queja      { background: #ffebee; color: #c62828; }
.msg-cat-otros      { background: #eceff1; color: #455a64; }

/* Detalle */
.msg-detalle .card { min-height: 500px; }
.msg-detalle-cab {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 1rem; flex-wrap: wrap;
    padding-bottom: 0.85rem; margin-bottom: 0.85rem;
    border-bottom: 1px solid #eee;
}
.msg-acciones-cab { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.msg-acciones-cab select {
    padding: 0.4rem 0.6rem; border: 1px solid #ccc; border-radius: 5px;
    font-size: 0.88rem;
}

.msg-hilo {
    display: flex; flex-direction: column; gap: 12px;
    max-height: 50vh; overflow-y: auto;
    padding: 0.5rem 0.25rem;
}

.msg-burbuja {
    max-width: 75%;
    padding: 0.7rem 1rem;
    border-radius: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.msg-burb-mio {
    background: #1e88e5; color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.msg-burb-otro {
    background: #eceff1; color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.msg-burb-nota {
    background: #fff8e1 !important;
    color: #5d4037 !important;
    border: 1px dashed #fb8c00;
}
.msg-burb-meta {
    font-size: 0.72rem; margin-bottom: 0.3rem; opacity: 0.85;
}
.msg-burb-mio .msg-burb-meta { color: rgba(255,255,255,0.9); }
.msg-burb-mio .ayuda { color: rgba(255,255,255,0.75); }
.msg-burb-texto { white-space: pre-wrap; word-wrap: break-word; }

.msg-responder {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #eee;
    display: flex; flex-direction: column; gap: 0.6rem;
}
.msg-responder textarea {
    width: 100%; padding: 0.6rem; border: 1px solid #ccc; border-radius: 6px;
    font-family: inherit; resize: vertical;
}

.msg-vacio {
    text-align: center; padding: 4rem 1rem; color: #888;
    background: #fafafa; border-radius: 8px;
    min-height: 400px;
    display: flex; align-items: center; justify-content: center;
}

@media (max-width: 900px) {
    .msg-layout { grid-template-columns: 1fr; }
}

/* ------------- Banner de estado de suscripción ------------- */
.sus-banner {
    padding: 0.7rem 1rem;
    margin: 0 0 1rem 0;
    border-radius: 6px;
    font-size: 0.92rem;
    border-left: 4px solid;
}
.sus-banner.sus-prueba {
    background: #e3f2fd;
    color: #0d47a1;
    border-color: #1e88e5;
}
.sus-banner.sus-pruebaexpirada {
    background: #fff3e0;
    color: #bf360c;
    border-color: #f57c00;
}
.sus-banner.sus-suspendida,
.sus-banner.sus-cancelada,
.sus-banner.sus-vencida {
    background: #ffebee;
    color: #b71c1c;
    border-color: #c62828;
}
/* Variante urgente cuando la prueba está a punto de expirar (≤4 días) */
.sus-banner.sus-urgente {
    background: #fff3e0;
    color: #bf360c;
    border-color: #ef6c00;
}

/* Layout: texto + botón CTA en la misma fila */
.sus-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.sus-banner-texto { flex: 1; min-width: 200px; }

.btn-sus-cta {
    background: #1e88e5;
    color: #fff !important;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.btn-sus-cta:hover { background: #1565c0; text-decoration: none; }
.sus-banner.sus-pruebaexpirada .btn-sus-cta,
.sus-banner.sus-urgente .btn-sus-cta {
    background: #e65100;
}
.sus-banner.sus-pruebaexpirada .btn-sus-cta:hover,
.sus-banner.sus-urgente .btn-sus-cta:hover {
    background: #bf360c;
}
.sus-banner.sus-suspendida .btn-sus-cta,
.sus-banner.sus-cancelada .btn-sus-cta,
.sus-banner.sus-vencida .btn-sus-cta {
    background: #c62828;
}
.sus-banner.sus-suspendida .btn-sus-cta:hover {
    background: #8e0000;
}

/* ------------- Onboarding wizard ------------- */
.onb-wrap { max-width: 820px; margin: 0 auto; }

.onb-pasos {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}
.onb-paso {
    flex: 1;
    min-width: 130px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    background: #f5f5f5;
    border: 1px solid transparent;
}
.onb-paso-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #bdbdbd;
    color: white;
    font-weight: 700;
}
.onb-paso-lbl { font-weight: 500; color: #555; }
.onb-paso.onb-paso-ok { background: #e8f5e9; border-color: #c8e6c9; }
.onb-paso.onb-paso-ok .onb-paso-num { background: #43a047; }
.onb-paso.onb-paso-ok .onb-paso-lbl { color: #2e7d32; }
.onb-paso.onb-paso-curr { background: #e3f2fd; border-color: #90caf9; box-shadow: 0 2px 4px rgba(30,136,229,0.15); }
.onb-paso.onb-paso-curr .onb-paso-num { background: #1e88e5; }
.onb-paso.onb-paso-curr .onb-paso-lbl { color: #1565c0; font-weight: 600; }

.onb-plantillas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.onb-plantilla {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.onb-plantilla:hover { border-color: #1e88e5; background: #f5faff; }
.onb-plantilla input { display: none; }
.onb-plantilla-sel {
    border-color: #1e88e5;
    background: #e3f2fd;
    box-shadow: 0 2px 4px rgba(30,136,229,0.15);
}
.onb-plantilla-titulo { font-weight: 600; font-size: 1.05rem; color: #1565c0; }
.onb-plantilla-desc { color: #444; font-weight: 500; font-variant-numeric: tabular-nums; }

.onb-plan-reco {
    margin-top: 1rem;
    background: #fff3e0;
    border-left: 4px solid #fb8c00;
    padding: 0.85rem 1rem;
    border-radius: 4px;
}
.onb-plan {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
}
.onb-plan-free    { background: #e8f5e9; color: #2e7d32; }
.onb-plan-starter { background: #e3f2fd; color: #1565c0; }
.onb-plan-pro     { background: #ede7f6; color: #5e35b1; }

/* Banner del Dashboard cuando el onboarding no está completo */
.onb-banner {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.onb-banner-texto { flex: 1; }
.onb-banner-titulo { font-weight: 600; font-size: 1.05rem; }
.onb-banner-sub { font-size: 0.88rem; opacity: 0.92; }
.onb-banner button {
    background: white;
    color: #1565c0;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.onb-banner .onb-banner-cerrar {
    background: transparent;
    color: white;
    opacity: 0.7;
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
}

/* ------------- Dashboard admin ------------- */
.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.kpi-card {
    background: white;
    border-radius: 8px;
    padding: 1.1rem 1.3rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #1e88e5;
}
.kpi-card.kpi-azul    { border-left-color: #1e88e5; }
.kpi-card.kpi-verde   { border-left-color: #43a047; }
.kpi-card.kpi-amarillo{ border-left-color: #fb8c00; }
.kpi-card.kpi-morado  { border-left-color: #8e24aa; }
.kpi-card.kpi-rojo    { border-left-color: #c62828; }
.kpi-card.kpi-gris    { border-left-color: #9e9e9e; }

.kpi-titulo {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.kpi-valor {
    font-size: 2rem;
    font-weight: 700;
    color: #222;
    line-height: 1.1;
}
.kpi-card.kpi-azul    .kpi-valor { color: #1e88e5; }
.kpi-card.kpi-verde   .kpi-valor { color: #43a047; }
.kpi-card.kpi-amarillo .kpi-valor { color: #fb8c00; }
.kpi-card.kpi-morado  .kpi-valor { color: #8e24aa; }
.kpi-card.kpi-rojo    .kpi-valor { color: #c62828; }
.kpi-card.kpi-gris    .kpi-valor { color: #757575; }
.kpi-extra {
    font-size: 0.78rem;
    color: #888;
    margin-top: 0.3rem;
}

.dash-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.dash-acciones { display: flex; gap: 0.5rem; }
.dash-select {
    padding: 0.45rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95rem;
}
.dash-filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
}
.dash-campo {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 140px;
}
.dash-campo label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}
.dash-campo select, .dash-campo input {
    padding: 0.45rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.92rem;
}

.dash-grafico-wrapper {
    position: relative;
    height: 360px;
    width: 100%;
}

.dash-resumen {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.92rem;
    color: #444;
}
.dash-resumen strong { color: #1e88e5; }

/* ----- Tabla pivotante ----- */
.pivot-totales {
    display: flex;
    gap: 2rem;
    background: #e3f2fd;
    border-left: 4px solid #1e88e5;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.pivot-totales strong { color: #1565c0; }

.pivot-wrapper {
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.pivot-tabla {
    border-collapse: collapse;
    font-size: 0.85rem;
    width: 100%;
}
.pivot-tabla th, .pivot-tabla td {
    padding: 4px 6px;
    border: 1px solid #e8e8e8;
    text-align: right;
    white-space: nowrap;
    min-width: 40px;
}
.pivot-tabla thead th {
    background: #1e88e5;
    color: white;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}
.pivot-tabla tbody tr:nth-child(even) { background: #fafafa; }
.pivot-tabla tbody tr:hover { background: #fff8e1; }

.pivot-empleado-col {
    text-align: left !important;
    font-weight: 500;
    background: #f5f5f5;
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 180px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pivot-tabla thead .pivot-empleado-col {
    background: #1565c0;
    z-index: 3;
}
.pivot-tabla tbody tr:hover .pivot-empleado-col { background: #fff8e1; }

.pivot-total-col {
    background: #fff3e0;
    font-weight: 700;
    color: #e65100;
    position: sticky;
    right: 0;
    z-index: 1;
    min-width: 70px;
}
.pivot-tabla thead .pivot-total-col {
    background: #ef6c00;
    color: white;
    z-index: 3;
}

.pivot-num { text-align: right; font-variant-numeric: tabular-nums; }
.pivot-pos { background: #e8f5e9 !important; }
.pivot-pos .pivot-celda-link { color: #2e7d32; }
.pivot-neg { background: #ffebee !important; }
.pivot-neg .pivot-celda-link { color: #c62828; }
.pivot-totales .pivot-pos, .pivot-totales .pivot-neg {
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
}
.pivot-totales .pivot-pos { color: #2e7d32; background: #e8f5e9 !important; }
.pivot-totales .pivot-neg { color: #c62828; background: #ffebee !important; }
.pivot-celda-link {
    display: inline-block;
    width: 100%;
    text-align: right;
    color: #1565c0;
    text-decoration: none;
}
.pivot-celda-link:hover {
    text-decoration: underline;
    color: #0d47a1;
}
.pivot-celda-link-total {
    color: #e65100;
}
.pivot-celda-link-total:hover {
    color: #bf360c;
}

.pivot-finde { background: #f0f0f0; }
.pivot-tabla thead .pivot-finde { background: #546e7a; }

.pivot-tabla tfoot td {
    background: #fff3e0;
    color: #e65100;
    font-weight: 700;
    border-top: 2px solid #ef6c00;
}
.pivot-tabla tfoot .pivot-empleado-col {
    background: #ef6c00;
    color: white;
}

/* ------------- Fichar ------------- */
.fichar {
    text-align: center;
    padding: 2rem 1rem;
}

/* Banner de instalación PWA */
.install-banner {
    margin: 2rem auto 0;
    max-width: 480px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    display: flex;
    gap: 0.85rem;
    align-items: center;
    text-align: left;
}
.install-texto {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.install-texto strong { color: #0d47a1; font-size: 0.95rem; }
.install-texto .ayuda { font-size: 0.8rem; color: #555; }
.btn-instalar {
    background: #1e88e5;
    color: white;
    border: none;
    padding: 0.55rem 0.95rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.9rem;
}
.btn-instalar:hover { background: #1565c0; }

/* Modal con instrucciones para iOS */
.modal-ios { max-width: 460px; }
.ios-pasos {
    margin: 0.5rem 0 0.75rem;
    padding-left: 1.25rem;
    line-height: 1.7;
}
.ios-pasos li { margin-bottom: 0.5rem; }
.ios-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e3f2fd;
    border-radius: 4px;
    padding: 1px 4px;
    vertical-align: middle;
    margin: 0 2px;
}

.reloj {
    font-size: 4rem;
    font-weight: 700;
    color: #1e88e5;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.fecha {
    font-size: 1rem;
    color: #666;
    text-transform: capitalize;
    margin-bottom: 2rem;
}

.botones {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn-grande {
    border: none;
    padding: 1.5rem 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    min-width: 220px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.05s;
}

.btn-grande:active { transform: scale(0.98); }
.btn-entrada { background: #2e7d32; }
.btn-entrada:hover { background: #1b5e20; }
.btn-salida { background: #c62828; }
.btn-salida:hover { background: #8e0000; }

.btn-grande:disabled,
.btn-secundario:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}
.btn-grande:disabled:hover,
.btn-secundario:disabled:hover {
    background: inherit;
}

/* Indicador de estado encima de los botones */
.estado-fichaje {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    background: #eee;
    color: #555;
}
.estado-fichaje .estado-extra {
    font-weight: 400;
    font-size: 0.85rem;
    opacity: 0.85;
}
.estado-fuera   { background: #ffebee; color: #c62828; }
.estado-dentro  { background: #e8f5e9; color: #2e7d32; }
.estado-pausa   { background: #fff8e1; color: #b27000; }

.botones-secundarios {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.btn-secundario {
    background: #eceff1;
    color: #455a64;
    border: 1px solid #cfd8dc;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-secundario:hover { background: #cfd8dc; }

.estado {
    color: #666;
    font-style: italic;
}

/* ------------- Tabla historial ------------- */
.filtros {
    display: flex;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filtros label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    color: #666;
}

.filtros input {
    padding: 0.4rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.tabla {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-radius: 6px;
    overflow: hidden;
}

.tabla th, .tabla td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.tabla th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
}

.tabla tbody tr:hover { background: #fafafa; }

/* ---------- Tabla con columnas redimensionables ---------- */
.tabla-redimensionable {
    table-layout: fixed;
    width: 100%;
}
.tabla-redimensionable th,
.tabla-redimensionable td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tabla-redimensionable td.wrap,
.tabla-redimensionable th.wrap {
    white-space: normal;
    word-wrap: break-word;
}

.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    background: transparent;
    transition: background-color 120ms;
}
.col-resizer:hover { background: #1e88e5; }

body.redimensionando { cursor: col-resize !important; user-select: none; }
body.redimensionando * { cursor: col-resize !important; }

.tabla-redimensionable th {
    user-select: none;
}

/* ---------- Modal genérico ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal-content {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

/* Botones de selección de tipo de pausa */
.tipos-pausa-grid {
    display: grid;
    gap: 0.6rem;
}
.btn-tipo-pausa {
    background: #e3f2fd;
    color: #1565c0;
    border: 2px solid transparent;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: all 0.1s;
}
.btn-tipo-pausa:hover {
    background: #bbdefb;
    border-color: #1e88e5;
    transform: translateY(-1px);
}
.btn-tipo-pausa .tipo-desc {
    font-size: 0.8rem;
    color: #555;
    font-weight: 400;
    margin-top: 0.2rem;
}

/* ------------- Admin ------------- */
.admin-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.tabla tr.inactivo { opacity: 0.55; }

.pill {
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.pill-ok { background: #c8e6c9; color: #1b5e20; }
.pill-ko { background: #ffcdd2; color: #b71c1c; }
.pill-aviso { background: #fff3cd; color: #856404; }
.pill-prueba { background: #e3f2fd; color: #1565c0; }
.pill-warn { background: #ffe0b2; color: #b35200; }

/* Días restantes de prueba en /super/empresas */
.dias-rest {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.05rem 0.45rem;
    border-radius: 8px;
    margin-top: 0.15rem;
}
.dias-verde { background: #e8f5e9; color: #2e7d32; }
.dias-ambar { background: #fff3e0; color: #e65100; }
.dias-rojo  { background: #ffebee; color: #c62828; }

.link { color: #1e88e5; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

.link-peligro { color: #c62828; }
.link-peligro:hover { color: #8e0000; }

.btn-peligro {
    background: #c62828;
    color: white;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
}
.btn-peligro:hover { background: #8e0000; }
.btn-peligro:disabled { opacity: 0.6; cursor: wait; }

.btn-aviso {
    background: #f9a825;
    color: white;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
}
.btn-aviso:hover { background: #c17900; }
.btn-aviso:disabled { opacity: 0.6; cursor: wait; }

.form-admin { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.form-grid .field-check { grid-column: 1 / -1; }

.acciones {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Resumen / dashboard cards */
.resumen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}
.resumen-card {
    background: white;
    padding: 1rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.resumen-card.destacada {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
    color: white;
}
.resumen-card.destacada .resumen-titulo,
.resumen-card.destacada .resumen-extra { color: rgba(255,255,255,0.85); }
.resumen-extra { font-size: 0.75rem; color: #888; margin-top: 0.25rem; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.card {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card h2 { margin-top: 0; font-size: 1.1rem; color: #1e88e5; }

.form-cambio-plan {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}
.form-cambio-plan h3 { margin-top: 0; font-size: 1rem; }

/* Bloque de datos de facturación en el detalle de empresa */
.datos-fact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.6rem 1.5rem;
    font-size: 0.92rem;
}
.datos-fact > div {
    line-height: 1.4;
}
.datos-fact strong {
    display: block;
    color: #666;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.datos-fact span { font-weight: 500; }

/* Totales en detalle de factura */
.totales {
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    max-width: 380px;
    margin-left: auto;
}
.totales > div {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}
.totales .total-final {
    border-top: 2px solid #1e88e5;
    padding-top: 0.6rem;
    margin-top: 0.4rem;
    font-size: 1.1rem;
    color: #1e88e5;
}

/* Resultados de generación masiva */
.resumen-mensajes {
    margin-top: 0.75rem;
    padding-left: 1.2rem;
    font-size: 0.85rem;
    color: #555;
    max-height: 200px;
    overflow-y: auto;
}
.resumen-mensajes li { margin: 0.15rem 0; }

/* Acciones específicas de la página de licencias */
.acciones-licencias {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
    flex-wrap: wrap;
}

/* Logo de empresa */
.logo-empresa-bloque {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.logo-preview {
    width: 160px;
    height: 160px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    overflow: hidden;
    flex-shrink: 0;
}
.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.logo-placeholder {
    color: #999;
    font-size: 0.85rem;
}
.logo-acciones {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Tabs en página de geografía */
.tabs-geografia {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
}
.tabs-geografia button {
    background: transparent;
    border: none;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    border-bottom: 3px solid transparent;
}
.tabs-geografia button.tab-activa {
    color: #1e88e5;
    border-bottom-color: #1e88e5;
    font-weight: 600;
}
.tabs-geografia button:hover { color: #1565c0; }

/* Tabs genéricos para páginas con secciones */
.tabs-pagina {
    display: flex;
    gap: 0.25rem;
    margin: 0.75rem 0 1.25rem;
    border-bottom: 1px solid #e0e0e0;
}
.tabs-pagina a {
    padding: 0.6rem 1.25rem;
    color: #666;
    text-decoration: none;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.1s;
}
.tabs-pagina a:hover { color: #1565c0; }
.tabs-pagina a.active {
    color: #1e88e5;
    border-bottom-color: #1e88e5;
    font-weight: 600;
}

/* Días de la semana en formulario de asignación */
.dias-semana {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}
.dias-semana label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    background: #f9f9f9;
}
.dias-semana label:hover { background: #f0f0f0; }

/* Chips de horario semanal en listado de asignaciones */
.horario-chips {
    display: inline-flex;
    gap: 3px;
}
.chip-dia {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e0e0e0;
    color: #555;
}
.chip-dia.chip-libre {
    background: #f5f5f5;
    color: #aaa;
    border: 1px dashed #ccc;
}

/* ===== Vista mensual del calendario (estilo Outlook) ===== */
.vista-controles {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    background: white;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.vista-controles .field { display: flex; flex-direction: column; gap: 0.25rem; }
.vista-controles label { font-size: 0.78rem; color: #666; font-weight: 600; text-transform: uppercase; }
.vista-controles select { padding: 0.5rem 0.7rem; border: 1px solid #ccc; border-radius: 5px; min-width: 240px; font-size: 0.95rem; }

.vista-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.vista-nav strong {
    min-width: 200px;
    text-align: center;
    color: #1e88e5;
    font-size: 1.25rem;
    font-weight: 500;
    text-transform: lowercase;
}
.vista-nav button {
    padding: 0.35rem 0.7rem;
    font-size: 0.95rem;
}

/* Marco general del calendario */
.cal-mes {
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    overflow: hidden;
}

/* Cabecera con días de la semana (1 fila, una vez) */
.cal-cabecera {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fafafa;
    border-bottom: 1px solid #d0d0d0;
}
.cal-cab-celda {
    padding: 0.55rem 0.85rem;
    border-right: 1px solid #e8e8e8;
    text-align: left;
}
.cal-cab-celda:last-child { border-right: none; }
.cal-cab-dia {
    font-size: 0.78rem;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Cada semana es una fila de 7 columnas */
.cal-fila {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e8e8e8;
}
.cal-fila:last-child { border-bottom: none; }

.cal-celda {
    position: relative;
    border-right: 1px solid #e8e8e8;
    padding: 24px 0 6px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: white;
    min-height: 135px;
}
.cal-celda:last-child { border-right: none; }
.cal-celda.cal-fuera { background: white; }
.cal-celda.cal-fuera .cal-num { color: #c0c0c0; }
.cal-celda.cal-festivo { background: #fffaf0; }
.cal-celda.cal-hoy { background: #f0f7ff; }

/* Número del día (esquina superior derecha) */
.cal-num {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.82rem;
    color: #888;
    font-weight: 400;
}
.cal-celda.cal-hoy .cal-num { color: #1e88e5; font-weight: 600; }

/* Bandas de turno: ancho completo, azul marino sólido, texto blanco */
.cal-bloque {
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 5px 8px;
    background: #1a3a8c;
    border-radius: 0;
    line-height: 1.3;
    margin: 0 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.cal-bloque + .cal-bloque {
    margin-top: 2px;
}
.cal-bloque-horas {
    font-weight: 600;
    white-space: nowrap;
}
.cal-bloque-duracion {
    font-size: 0.72rem;
    opacity: 0.85;
    font-weight: 400;
}
.cal-bloque-total {
    font-size: 0.72rem;
    color: #1a3a8c;
    font-weight: 600;
    text-align: center;
    margin: 2px 4px 0 4px;
    padding: 2px 4px;
    border-top: 1px dashed #c8d4e8;
}

.cal-libre {
    color: #aaa;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

.cal-festivo-tag {
    font-size: 0.85rem;
    color: white;
    background: #c62828;
    padding: 6px 10px;
    margin: 0 4px;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toolbar de asignación masiva */
.masiva-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #eee;
}
.masiva-toolbar input[type="text"] {
    flex: 1;
    min-width: 220px;
    padding: 0.5rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.masiva-contador {
    margin-left: auto;
    color: #555;
    font-size: 0.9rem;
}
.masiva-contador strong {
    color: #1e88e5;
    font-size: 1.1rem;
}
.masiva-fila-sel {
    background: #e3f2fd;
}
.masiva-fila-sel:hover {
    background: #bbdefb;
}

p.ok {
    color: #2e7d32;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    padding: 0.6rem 0.85rem;
    border-radius: 4px;
}

/* Totalizador del mes */
.cal-totalizador {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    background: linear-gradient(135deg, #1e88e5 0%, #1a3a8c 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px rgba(26,58,140,0.2);
}
.cal-total-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.cal-total-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    font-weight: 500;
}
.cal-total-valor {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1;
}

.vista-leyenda {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: 0.85rem;
    color: #555;
    background: white;
    padding: 0.6rem 0.85rem;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}
.leyenda-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.leyenda-color {
    display: inline-block;
    width: 18px;
    height: 14px;
    background: #1a3a8c;
}
.leyenda-color.leyenda-festivo {
    background: #c62828;
}

/* Acciones de test SMTP */
.acciones-test {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}
.acciones-test input[type="email"] {
    flex: 1;
    padding: 0.55rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* Tarjetas de planes en /admin/mi-suscripcion */
.planes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.plan-card {
    background: white;
    padding: 1.25rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
}
.plan-card.plan-actual {
    border-color: #1e88e5;
    background: linear-gradient(180deg, #e3f2fd 0%, white 30%);
}
.plan-card h3 {
    margin: 0 0 0.5rem 0;
    color: #1e88e5;
}
.plan-precio {
    font-size: 2rem;
    font-weight: 700;
    color: #222;
}
.plan-eur {
    font-size: 0.95rem;
    color: #888;
    font-weight: 400;
}
.plan-desc {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0;
}
.plan-features {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    flex: 1;
}
.plan-features li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}
.plan-features li.ok::before { content: '✓ '; color: #2e7d32; font-weight: 700; }
.plan-features li.no::before { content: '✗ '; color: #c62828; opacity: 0.5; }
.plan-features li.no { color: #aaa; }
.plan-card button { margin-top: 0.5rem; }
.resumen-titulo {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
.resumen-valor { font-size: 1.5rem; font-weight: 700; }
.resumen-valor.positivo { color: #2e7d32; }
.resumen-card.destacada .resumen-valor.positivo { color: #c8e6c9; }
.resumen-valor.negativo { color: #c62828; }

.acciones-export {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .admin-cabecera { flex-direction: column; align-items: stretch; }
}

/* ------------- Footer ------------- */
.footer {
    text-align: center;
    padding: 1rem;
    color: #888;
    font-size: 0.85rem;
    background: #eee;
}

/* ------------- Móvil ------------- */
@media (max-width: 768px) {
    /* Sidebar pasa a modo drawer fuera de pantalla */
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 200;
        width: 240px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 4px 0 12px rgba(0,0,0,0.15);
    }
    .sidebar-movil-abierta .sidebar {
        transform: translateX(0);
    }
    .sidebar-movil-abierta .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 150;
    }
    .sidebar-colapsada .sidebar { width: 240px; }    /* en móvil ignoramos colapso */
    .sidebar-colapsada .sidebar-nav .lbl { display: inline; }
    .sidebar-colapsada .sidebar-grupo { display: block; }

    /* En móvil ocultamos toda la administración del usuario */
    .solo-escritorio { display: none !important; }
    .rol-tag { display: none; }

    .usuario-empresa { font-size: 0.7rem; }
}

@media (max-width: 600px) {
    main { padding: 1rem; }
    .topbar { padding: 0.55rem 0.85rem; gap: 0.5rem; }
    .reloj { font-size: 3rem; }
    .btn-grande { min-width: 100%; padding: 1.25rem; font-size: 1.25rem; }
    .botones { flex-direction: column; }
    .login-card { margin: 1rem; padding: 1.5rem; }
    .usuario-email { font-size: 0.8rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
}

/* Errores de Blazor */
#blazor-error-ui {
    display: none;
    background: #ffeeee;
    color: #b00;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ============================================================
   Modificación de fichajes (/admin/fichajes)
   ============================================================ */
.tag {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    background: #888;
    letter-spacing: 0.02em;
}
.tag-entrada    { background: #2e7d32; }
.tag-salida     { background: #c62828; }
.tag-pausa-ini  { background: #ef6c00; }
.tag-pausa-fin  { background: #6a1b9a; }

.badge-manual {
    display: inline-block;
    margin-left: 0.3rem;
    padding: 0.05rem 0.45rem;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-vigente {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-anulado {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.row-anulado { background: #fafafa; color: #888; text-decoration: line-through; }
.row-anulado .badge-anulado { text-decoration: none; }
.row-vigente { background: #f1f8e9; }

.btn-mini {
    background: #fff;
    border: 1px solid #bbb;
    color: #333;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.25rem;
}
.btn-mini:hover { background: #f0f0f0; }
.btn-mini-danger { color: #c62828; border-color: #ef9a9a; }
.btn-mini-danger:hover { background: #ffebee; }

.btn-danger {
    background: #c62828;
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover { background: #a01b1b; }
.btn-danger:disabled { background: #e57373; cursor: not-allowed; }

.modal-back {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}
.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    z-index: 1000;
    width: 95%;
    max-width: 560px;
    max-height: 90vh;
    overflow: auto;
}
.modal h3 { margin-top: 0; }
.modal-ancho { max-width: 1000px; }

.td-obs { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   Legal pages (/legal/*) — MinimalLayout
   ============================================================ */
.minimal-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}
.minimal-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.minimal-marca {
    text-decoration: none;
    color: #1a3a8c;
    font-weight: 700;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.minimal-logo { font-size: 1.4rem; }
.minimal-nav {
    display: flex;
    gap: 1rem;
}
.minimal-nav a {
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
}
.minimal-nav a:hover { color: #1a3a8c; text-decoration: underline; }
.minimal-main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}
.minimal-footer {
    background: #eee;
    border-top: 1px solid #ddd;
    padding: 1rem 1.5rem;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
}
.minimal-footer a {
    color: #1a3a8c;
    text-decoration: none;
}
.minimal-footer a:hover { text-decoration: underline; }

.legal-pagina {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.legal-contenido h2 {
    color: #1a3a8c;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 0.5rem;
}
.legal-contenido h3 {
    color: #333;
    margin-top: 1.5rem;
}
.legal-contenido p, .legal-contenido li {
    line-height: 1.65;
    color: #444;
}
.legal-contenido table {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}
.legal-contenido strong { color: #1a3a8c; }

/* Footer mejorado (MainLayout) */
.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem 1rem;
}
.footer a {
    color: #1a3a8c;
    text-decoration: none;
    font-size: 0.85rem;
}
.footer a:hover { text-decoration: underline; }
.footer-sep { color: #aaa; }

/* ============================================================
   Pantalla bloqueante de aceptación de documentos
   ============================================================ */
.aceptar-pagina {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}
.aceptar-cabecera h1 { color: #1a3a8c; margin-bottom: 0.5rem; }
.aceptar-doc {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid #e0e0e0;
}
.aceptar-doc h2 {
    color: #1a3a8c;
    margin-top: 0;
    font-size: 1.2rem;
}
.aceptar-contenido {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #ddd;
    background: #fafafa;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.aceptar-contenido h2 { font-size: 1.1rem; border-bottom: 1px solid #ccc; padding-bottom: 0.3rem; }
.aceptar-contenido h3 { font-size: 1rem; }
.aceptar-marca {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}
.aceptar-leido { color: #2e7d32; font-weight: 600; }
.aceptar-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0f4ff;
    border-radius: 6px;
    cursor: pointer;
}
.aceptar-check input[type="checkbox"]:disabled + * { color: #999; }
.aceptar-acciones {
    text-align: right;
    margin-top: 1.5rem;
}

/* ============================================================
   Editor de documentos legales (/super/documentos-legales/{id})
   ============================================================ */
.legal-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.legal-editor-form { min-width: 0; }
.legal-editor-preview { position: sticky; top: 1rem; min-width: 0; }
.legal-preview-card { max-height: calc(100vh - 6rem); overflow: auto; }

.textarea-html {
    width: 100%;
    font-family: 'Consolas', 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.75rem;
    background: #fafafa;
    line-height: 1.45;
    box-sizing: border-box;
    resize: vertical;
    min-height: 320px;
}
.textarea-html:disabled {
    background: #f0f0f0;
    color: #777;
    cursor: not-allowed;
}

@media (max-width: 1100px) {
    .legal-editor { grid-template-columns: 1fr; }
    .legal-editor-preview { position: static; }
    .legal-preview-card { max-height: 600px; }
}

/* ============================================================
   Filtros de facturas (/super/facturas) — estilo dashboard SaaS
   ============================================================ */
.fac-filtros-panel {
    background: #fff;
    border: 1px solid #e6edf7;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.chips-filtros {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* ---- Chip (pill de filtro rápido) ---- */
.chip {
    background: #f0f6ff;
    border: 1px solid transparent;
    color: #1a3a8c;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.1;
    font-family: inherit;
}
.chip:hover {
    background: #dbeafe;
    transform: translateY(-1px);
}
.chip:active { transform: translateY(0); }
.chip-ico { font-size: 0.95rem; line-height: 1; }

.chip-activo {
    background: #1e88e5;
    color: #fff;
    box-shadow: 0 4px 10px rgba(30, 136, 229, 0.35);
}
.chip-activo:hover { background: #1565c0; }

/* Variantes — solo se ven cuando están activas (look discreto en reposo) */
.chip-naranja        { background: #fff3e0; color: #bf360c; }
.chip-naranja:hover  { background: #ffe0b2; }
.chip-naranja.chip-activo { background: #ef6c00; color: #fff; box-shadow: 0 4px 10px rgba(239, 108, 0, 0.35); }
.chip-naranja.chip-activo:hover { background: #bf360c; }

.chip-verde          { background: #e8f5e9; color: #1b5e20; }
.chip-verde:hover    { background: #c8e6c9; }
.chip-verde.chip-activo { background: #2e7d32; color: #fff; box-shadow: 0 4px 10px rgba(46, 125, 50, 0.35); }
.chip-verde.chip-activo:hover { background: #1b5e20; }

.chip-rojo           { background: #ffebee; color: #b71c1c; }
.chip-rojo:hover     { background: #ffcdd2; }
.chip-rojo.chip-activo  { background: #c62828; color: #fff; box-shadow: 0 4px 10px rgba(198, 40, 40, 0.35); }
.chip-rojo.chip-activo:hover { background: #8e0000; }

.chip-gris           { background: #eceff1; color: #37474f; }
.chip-gris:hover     { background: #cfd8dc; }
.chip-gris.chip-activo  { background: #546e7a; color: #fff; box-shadow: 0 4px 10px rgba(84, 110, 122, 0.35); }
.chip-gris.chip-activo:hover { background: #37474f; }

/* Separador visual entre el grupo de chips y los selectores */
.chip-sep {
    width: 1px;
    height: 24px;
    background: #e0e7f0;
    margin: 0 0.35rem;
}

/* Selector tipo "chip" con label + control inline */
.chip-select {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #f6f9fd;
    border: 1px solid #e6edf7;
    border-radius: 999px;
    padding: 0.25rem 0.85rem 0.25rem 0.85rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.chip-select:hover, .chip-select:focus-within {
    background: #fff;
    border-color: #1e88e5;
}
.chip-select-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #5b6b7f;
    text-transform: lowercase;
}
.chip-select select,
.chip-select input {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    color: #1a3a8c;
    font-weight: 600;
    outline: none;
    padding: 0.25rem 0;
    cursor: pointer;
    font-family: inherit;
    min-width: 80px;
}
.chip-select-wide select {
    min-width: 180px;
    max-width: 280px;
}
.chip-select select:focus,
.chip-select input:focus { outline: none; box-shadow: none; }

/* Botón "limpiar filtros" — chip discreto */
.chip-clear {
    background: transparent;
    border: none;
    color: #b71c1c;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    transition: background 0.15s ease;
    margin-left: auto;  /* lo empuja al final */
    font-family: inherit;
}
.chip-clear:hover { background: #ffebee; }

@media (max-width: 700px) {
    .chip-sep { display: none; }
    .chip-clear { margin-left: 0; }
}

/* Tarjeta visual en /admin/mi-empresa/pago */
.card-actual {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #1e88e5 0%, #1a3a8c 100%);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(30, 136, 229, 0.25);
}
.card-actual .card-icon {
    font-size: 2.2rem;
    line-height: 1;
}
.card-actual .card-info {
    flex: 1;
    line-height: 1.35;
}
.card-actual .card-numero {
    font-size: 1.05rem;
    letter-spacing: 0.04em;
}
.card-actual .card-numero strong {
    text-transform: uppercase;
    margin-right: 0.6rem;
    letter-spacing: 0.08em;
    font-weight: 700;
}
.card-actual .card-exp {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 0.2rem;
}
.card-actual .card-check {
    background: rgba(255,255,255,0.2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Lista de tarjetas — separación entre ellas */
.tarjetas-lista {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
/* Tarjeta principal (la default) — mantiene el gradiente azul fuerte */
.card-actual.card-default {
    /* sigue usando los estilos base de .card-actual */
}
/* Tarjetas secundarias — fondo más suave y borde gris */
.card-actual.card-secundaria {
    background: linear-gradient(135deg, #f5f7fa 0%, #e2e8f0 100%);
    color: #1a3a8c;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #d6e6fb;
}
.card-actual.card-secundaria .card-numero { color: #1a3a8c; }
.card-actual.card-secundaria .card-exp { color: #5b8def; opacity: 1; }
.card-actual.card-secundaria .card-check { display: none; }

.card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-end;
}
.card-badge-default {
    background: rgba(255,255,255,0.25);
    color: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.card-actual.card-default .card-actions .btn-mini {
    background: rgba(255,255,255,0.95);
    color: #1a3a8c;
    border-color: rgba(255,255,255,0.6);
}
.card-actual.card-default .card-actions .btn-mini-danger {
    color: #c62828;
    background: rgba(255,255,255,0.95);
}

/* Aviso suave informativo (azul) */
.aviso-suave {
    background: #e3f2fd;
    border-left: 4px solid #1e88e5;
    color: #0d47a1;
    padding: 0.7rem 1rem;
    border-radius: 4px;
    margin: 0.5rem 0;
}

/* ============================================================
   Aviso de email no verificado en pantalla de login
   ============================================================ */
.aviso-verificacion {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-left: 4px solid #ff8f00;
    border-radius: 6px;
    color: #4e342e;
}
.aviso-verificacion p {
    margin: 0.4rem 0 0.8rem 0;
    font-size: 0.9rem;
}
.aviso-verificacion .exito {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* ============================================================
   Banner de cookies (informativo, solo cookies técnicas)
   ============================================================ */
.cookies-banner {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 900;
    font-size: 0.9rem;
}
.cookies-texto { flex: 1; color: #333; }
.cookies-texto a { color: #1a3a8c; font-weight: 600; }
.cookies-cerrar {
    background: #1a3a8c;
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.cookies-cerrar:hover { background: #142a64; }
@media (max-width: 600px) {
    .cookies-banner { flex-direction: column; align-items: stretch; }
    .cookies-cerrar { width: 100%; }
}

/* Chips de color rápido (selector de paleta) */
.color-chip {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s;
}
.color-chip:hover { transform: scale(1.1); }

/* ============================================================
   Vista de organización — árbol jerárquico de empleados
   ============================================================ */
.org-grupos {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.org-grupos .org-grupos {
    padding-left: 1.5rem;
    border-left: 2px solid #e6edf7;
    margin: 0.25rem 0 0.25rem 0.5rem;
}
.org-grupo { margin: 0.25rem 0; }
.org-grupo-cabecera {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: #f5f7fa;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.org-grupo-cabecera:hover { background: #e8eef7; }
.org-toggle {
    color: #5b6b7f;
    font-size: 0.85rem;
    width: 1rem;
}
.org-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.org-etiqueta { color: #1a3a8c; flex: 1; }
.org-contador {
    background: #1a3a8c;
    color: #fff;
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
}

.org-empleados {
    list-style: none;
    padding-left: 1.75rem;
    margin: 0.25rem 0 0.5rem 0.5rem;
    border-left: 2px solid #e6edf7;
}
.org-empleado {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}
.org-empleado a { color: #1a3a8c; }
.org-inactivo { opacity: 0.55; }

/* ============================================================
   Editor de plantillas de email (/super/plantillas-email/{codigo})
   ============================================================ */
.plantilla-editor {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.plantilla-editor-form { min-width: 0; }
.plantilla-editor-side { position: sticky; top: 1rem; min-width: 0; }

.plantilla-vars {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.plantilla-vars li code {
    display: inline-block;
    background: #f0f6ff;
    border: 1px solid #c5d7f5;
    color: #1a3a8c;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}

.meta-tabla { width: 100%; font-size: 0.85rem; }
.meta-tabla td { padding: 0.25rem 0.5rem; vertical-align: top; }
.meta-tabla td:first-child { color: #5b6b7f; width: 40%; }

@media (max-width: 1100px) {
    .plantilla-editor { grid-template-columns: 1fr; }
    .plantilla-editor-side { position: static; }
}

/* Modal genérico (usado por la vista previa de plantillas) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 42, 100, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 950;
    padding: 1rem;
}
.modal-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    width: min(720px, 100%);
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #e6edf7;
    background: #f0f6ff;
}
.modal-cabecera h3 { margin: 0; color: #1a3a8c; font-size: 1.05rem; }
.btn-cerrar {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: #5b6b7f;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}
.btn-cerrar:hover { background: #e3f2fd; color: #1a3a8c; }
.modal-cuerpo {
    padding: 1rem;
    overflow: auto;
    flex: 1;
}
.preview-iframe {
    width: 100%;
    min-height: 480px;
    border: 1px solid #e6edf7;
    border-radius: 8px;
    background: #fff;
}
