:root {
  --navy: #0d2b5e;
  --azul: #2563eb;
  --verde: #16a34a;
  --rojo: #dc2626;
  --ambar: #d97706;

  --fondo-app: #f1f5f9;
  --fondo-tarjeta: #ffffff;
  --fondo-input: #ffffff;
  --borde: #e2e8f0;
  --texto: #1e293b;
  --texto-tenue: #64748b;
  --sombra: rgba(0,0,0,.06);
}
[data-theme="dark"] {
  --fondo-app: #0f172a;
  --fondo-tarjeta: #1e293b;
  --fondo-input: #1e293b;
  --borde: #334155;
  --texto: #e2e8f0;
  --texto-tenue: #94a3b8;
  --sombra: rgba(0,0,0,.4);
}
/* alias por compatibilidad con nombres antiguos usados en el resto del código */
:root { --gris1: var(--fondo-app); --gris2: var(--borde); --gris3: var(--texto-tenue); --blanco: var(--fondo-tarjeta); }

* { box-sizing: border-box; }
body { margin:0; font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif; background:var(--fondo-app); color:var(--texto); transition:background .15s,color .15s; }
h1,h2,h3 { color:var(--navy); margin:0 0 12px; }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color:#93b4f0; }
button { cursor:pointer; font-family:inherit; }

.btn { border:none; border-radius:8px; padding:8px 16px; font-size:14px; font-weight:600; }
.btn-primary { background:var(--navy); color:#fff; }
.btn-danger { background:var(--rojo); color:#fff; }
.btn-ghost { background:var(--borde); color:var(--texto); }
.btn-sm { padding:5px 10px; font-size:12px; }
.btn:hover { opacity:0.9; }

.login-wrap { display:flex; align-items:center; justify-content:center; height:100vh; background:var(--fondo-app); position:relative; }
.login-box { background:#ffffff; padding:36px; border-radius:14px; box-shadow:0 4px 24px var(--sombra); width:340px; text-align:center; }
.login-logo { max-width:200px; width:100%; margin-bottom:2px; }
.login-subtitulo { font-size:13px; color:var(--texto-tenue); margin:0 0 22px; }
.login-box input { width:100%; padding:10px; border:1px solid #e2e8f0; border-radius:8px; font-size:14px; background:#ffffff !important; color:#1e293b !important; }
.campo-icono { position:relative; margin-bottom:12px; text-align:left; }
.campo-icono i { position:absolute; left:11px; top:50%; transform:translateY(-50%); font-size:14px; font-style:normal; opacity:.6 }
.campo-icono input { padding-left:34px !important; }
.campo-icono input#login-pass { padding-right:34px !important; }
.btn-ver-pass { position:absolute; right:8px; top:50%; transform:translateY(-50%); background:none; border:none; font-size:14px; padding:2px; opacity:.6 }
.login-ayuda { font-size:11px; color:var(--texto-tenue); margin:16px 0 0; line-height:1.5; }
.login-creditos { font-size:10px; color:var(--texto-tenue); opacity:.6; margin:14px 0 0; }
#login-alerta { margin-top:10px; font-size:13px; color:var(--rojo); }

/* La cabecera se queda SIEMPRE en claro, con los dos modos, porque el logo
   es azul marino y no se lee bien sobre fondo oscuro. */
.app-header { display:flex; justify-content:space-between; align-items:center; background:#ffffff; border-bottom:1px solid #e2e8f0; padding:10px 20px; }
.app-header-logo { height:32px; display:block; }
.app-header-usuario { display:flex; align-items:center; gap:12px; font-size:14px; color:#1e293b; }
.app-header-usuario .btn-ghost { background:#f1f5f9; color:#1e293b; }
.btn-tema { background:none; border:1px solid #e2e8f0; border-radius:8px; width:32px; height:32px; font-size:16px; display:flex; align-items:center; justify-content:center; }

.app-tabs { display:flex; gap:4px; background:var(--fondo-tarjeta); padding:0 20px; border-bottom:1px solid var(--borde); }
.app-tab { padding:12px 16px; font-size:14px; font-weight:600; color:var(--texto-tenue); border-bottom:3px solid transparent; background:none; border-top:none; border-left:none; border-right:none; }
.app-tab.activo { color:var(--navy); border-bottom-color:var(--navy); }
[data-theme="dark"] .app-tab.activo { color:#93b4f0; border-bottom-color:#93b4f0; }

.app-contenido { padding:20px; max-width:1300px; margin:0 auto; }
.app-contenido.sin-limite { max-width:none; padding:20px 20px 20px 0; }

.tarjeta { background:var(--fondo-tarjeta); border-radius:12px; padding:18px; margin-bottom:16px; box-shadow:0 1px 3px var(--sombra); }
.tarjeta-titulo { font-weight:700; margin-bottom:12px; font-size:15px; }
.grid-tarjetas { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; }
.metric { text-align:center; }
.metric .valor { font-size:26px; font-weight:800; color:var(--navy); }
[data-theme="dark"] .metric .valor { color:#93b4f0; }
.metric .etiqueta { font-size:12px; color:var(--texto-tenue); }

table { width:100%; border-collapse:collapse; font-size:13px; color:var(--texto); }
th,td { padding:6px 8px; text-align:left; border-bottom:1px solid var(--borde); }
th { color:var(--texto-tenue); font-weight:600; }

.chip { display:inline-block; padding:2px 8px; border-radius:12px; font-size:11px; font-weight:700; }
.chip-ok { background:#dcfce7; color:#166534; }
.chip-extra { background:#dbeafe; color:#1e40af; }
.chip-corto { background:#fef3c7; color:#92400e; }
.chip-sin_fichar { background:#fee2e2; color:#991b1b; }
.chip-ausencia { background:#ede9fe; color:#5b21b6; }
.chip-cierre_auto { background:#fce7f3; color:#9d174d; }
.chip-finde, .chip-futuro { background:#f1f5f9; color:#94a3b8; }
.chip-pendiente { background:#fef3c7; color:#92400e; }
.chip-aprobada { background:#dcfce7; color:#166534; }
.chip-rechazada { background:#fee2e2; color:#991b1b; }
.chip-registrada { background:#ede9fe; color:#5b21b6; }
.chip-vacaciones { background:#dcfce7; color:#166534; }
.chip-baja { background:#fee2e2; color:#991b1b; }
.chip-compensacion { background:#dbeafe; color:#1e40af; }

.tabla-cuadro-equipo { table-layout:fixed; width:100%; border-collapse:separate; border-spacing:2px; }
.tabla-cuadro-equipo th, .tabla-cuadro-equipo td { padding:2px 1px; font-size:10px; text-align:center; overflow:hidden; border-bottom:none; }
.tabla-cuadro-equipo th { background:#7dd3fc; color:#0c4a6e; font-weight:700; border-radius:4px; padding:4px 1px; }
[data-theme="dark"] .tabla-cuadro-equipo th { background:#0369a1; color:#e0f2fe; }
.tabla-cuadro-equipo th:first-child, .tabla-cuadro-equipo td:first-child { width:90px; text-align:left; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; background:none; color:var(--texto); padding-left:4px; }
.tabla-cuadro-equipo th:last-child, .tabla-cuadro-equipo td:last-child { width:48px; font-weight:700; background:none; color:var(--texto); }
.celda-cuadro { display:block; width:100%; height:20px; line-height:20px; border-radius:5px; font-size:9px; font-weight:700; text-align:center; overflow:hidden; }
.leyenda-cuadro { font-size:11px; color:var(--texto-tenue); margin-bottom:10px; gap:14px; }
.leyenda-cuadro i { display:inline-block; width:12px; height:12px; border-radius:3px; margin-right:4px; vertical-align:middle; }

:root { --amarillo-chronos: #d4e600; }
[data-theme="dark"] { --amarillo-chronos: #eeff00; }
.texto-fecha-grande { color:var(--navy); }
[data-theme="dark"] .texto-fecha-grande { color:#93b4f0; }

.reloj-caja { background:var(--navy); color:#fff; border-radius:12px; padding:16px; }
.reloj-numeros { font-family:monospace; font-size:40px; font-weight:700; letter-spacing:1px; color:var(--amarillo-chronos); }

.layout-lateral { display:grid; grid-template-columns:220px 1fr; gap:0; align-items:start; }
@media (max-width:720px) { .layout-lateral { grid-template-columns:1fr; } }
.menu-lateral { display:flex; flex-direction:column; gap:4px; background:var(--fondo-tarjeta); padding:14px 10px; box-shadow:0 1px 3px var(--sombra); min-height:calc(100vh - 110px); }
.item-lateral { display:flex; justify-content:space-between; align-items:center; background:none; border:none; text-align:left; padding:10px 12px; border-radius:8px; font-size:14px; color:var(--texto); cursor:pointer; }
.item-lateral:hover { background:var(--fondo-app); }
.item-lateral.activo { background:var(--navy); color:#fff; font-weight:600; }
.badge-lateral { background:var(--rojo); color:#fff; font-size:11px; font-weight:700; min-width:18px; height:18px; border-radius:9px; display:flex; align-items:center; justify-content:center; padding:0 5px; }
.titulo-seccion-lateral { font-size:11px; color:var(--texto-tenue); text-transform:uppercase; letter-spacing:.04em; font-weight:700; margin:14px 0 4px 12px; }
.contenido-lateral { min-width:0; padding:20px; }

/* Impresión: lo que no debe salir en papel (menús, filtros, botones) se oculta;
   lo que solo tiene sentido en papel (cabeceras de listado) se muestra solo ahí. */
.solo-imprimir { display:none; }
@media print {
  .app-header, .app-tabs, .menu-lateral, .no-imprimir, .btn-tema, .badge-aviso { display:none !important; }
  .solo-imprimir { display:block !important; }
  body, .app-contenido { background:#fff !important; }
  .layout-lateral { display:block; }
  .tarjeta { box-shadow:none; border:1px solid #ccc; break-inside:avoid; }
  .tabla-cuadro-equipo th, .tabla-cuadro-equipo td { font-size:8px; padding:1px; }
}

.layout-2col { display:grid; grid-template-columns:340px 1fr; gap:16px; align-items:start; }
@media (max-width:720px) { .layout-2col { grid-template-columns:1fr; } }

select, input[type=date], input[type=number], input[type=text], textarea {
  padding:7px 10px; border:1px solid var(--borde); border-radius:6px; font-size:13px; font-family:inherit;
  background:var(--fondo-input); color:var(--texto);
}

.fila { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
.modal-fondo { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; z-index:100; }
.modal { background:var(--fondo-tarjeta); border-radius:12px; padding:20px; width:min(480px,92vw); max-height:85vh; overflow:auto; color:var(--texto); }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.modal-title { font-weight:700; }
.btn-close { background:none; border:none; font-size:18px; cursor:pointer; color:var(--texto-tenue); }

.aviso { background:var(--fondo-app); border-left:4px solid var(--navy); padding:10px 14px; border-radius:6px; font-size:13px; margin-bottom:12px; }
.aviso-urgente { border-left-color:var(--rojo); background:#fef2f2; }
[data-theme="dark"] .aviso-urgente { background:#3f1d1d; }

.aviso-urgente-banner { background:var(--fill-warning,#fef3c7); color:#92400e; border-radius:10px; padding:12px 16px; margin-bottom:16px; font-size:14px; }
[data-theme="dark"] .aviso-urgente-banner { background:#4a3510; color:#fbbf24; }

.titulo-seccion { font-size:12px; color:var(--texto-tenue); text-transform:uppercase; letter-spacing:.03em; margin:18px 0 8px; font-weight:600; }
.grid-tiles { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:8px; }
@media (max-width:820px) { .grid-tiles { grid-template-columns:repeat(2,1fr); } }
.tile-gestion { position:relative; border-radius:12px; padding:16px; min-height:92px; cursor:pointer; box-shadow:0 1px 3px var(--sombra); transition:transform .1s; color:#2c2410; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; }
.tile-gestion:hover { transform:translateY(-2px); }
.badge-aviso { position:absolute; top:10px; right:10px; background:var(--rojo); color:#fff; font-size:11px; font-weight:700; min-width:20px; height:20px; border-radius:10px; display:flex; align-items:center; justify-content:center; padding:0 5px; }

.celda-soltar { border:1px dashed var(--borde); border-radius:6px; transition:background .1s,border-color .1s; }
.celda-soltar-sobre { background:var(--bg-accent,#dbeafe); border-color:var(--navy); }


/* Barra "Deshacer" que aparece unos segundos abajo del todo */
.barra-deshacer { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); z-index:200; display:flex; align-items:center; gap:12px;
  background:#1f2937; color:#fff; padding:10px 14px 10px 18px; border-radius:10px; box-shadow:0 6px 24px rgba(0,0,0,.3); font-size:14px; max-width:92vw; }
.barra-deshacer-btn { background:var(--amarillo-chronos,#e6ff00); color:#1f2937; border:none; font-weight:700; cursor:pointer; }
.barra-deshacer-x { background:none; border:none; color:#cbd5e1; font-size:16px; cursor:pointer; }

.btn:disabled { opacity:.45; cursor:not-allowed; }


/* TODOS LOS DATOS EN MAYÚSCULAS (celdas de tablas, campos de texto, listas desplegables y nombre de la cabecera).
   Las cabeceras de columna, los botones y los textos de la aplicación se quedan como están. */
td, #cabecera-usuario, textarea, select,
input:not([type=password]):not([type=file]):not([type=checkbox]):not([type=radio]):not([type=date]):not([type=time]):not([type=number]) { text-transform:uppercase; }
td button, td .btn, td a, td .btn-sm { text-transform:none; }
/* Contraseñas: distinguen mayúsculas de minúsculas, no se pueden mostrar cambiadas */
code, .sin-mayus, input[type=password] { text-transform:none !important; }

::placeholder { text-transform:none; }
