:root { 
  --bg: #f3f4f6;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #ef1923;
  --surface: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-sm: 10px;
  --thead-blue: #e8f1ff;
  --dayoff-bg: #fff2f2;
  --dayoff-chip: #ef4444;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =========================
   Layout
   ========================= */
.container {
  width: min(980px, calc(100% - 32px));
  margin: 22px auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =========================
   Header
   ========================= */
.app-header {
  background-color: var(--primary);
  color: white;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.header-text {
  grid-column: 2;
  text-align: center;
}

.header-text h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .2px;
}

/* botón del header (Cerrar sesión) */
.app-header button {
  grid-column: 3;
  justify-self: end;
  background-color: #111827;
  color: #fff;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.05s ease, opacity 0.2s ease, background .15s ease;
}
.app-header button:hover { opacity: .95; }
.app-header button:active { transform: translateY(1px); }

/* =========================
   Footer
   ========================= */
.app-footer {
  margin-top: auto;
  padding: 12px;
  background-color: var(--primary);
  color: white;
  text-align: center;
  font-size: 13px;
}

/* =========================
   Cards
   ========================= */
.card {
  background: var(--surface);
  padding: clamp(12px, 2.5vw, 20px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.05);
}

/* Login: centra y limita ancho */
#login-section {
  width: min(480px, 100%);
  margin: 0 auto;
}

/* =========================
   Logo
   ========================= */
.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}

.logo {
  width: 140px;
  height: auto;
  display: block;
  object-fit: contain;
}

/* =========================
   Tipografía auxiliar
   ========================= */
h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.hint {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.error {
  color: #dc2626;
  margin-top: 6px;
  font-weight: 700;
  min-height: 18px;
}

.muted {
  color: var(--muted);
  font-size: .9rem;
  margin-top: 8px;
}

/* =========================
   Forms
   ========================= */
form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-weight: 700;
  font-size: .95rem;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 1rem;
  background: #fff;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: rgba(239, 25, 35, .6);
  box-shadow: 0 0 0 3px rgba(239, 25, 35, 0.15);
}

/* =========================
   Botones
   ========================= */
button {
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  padding: 11px 12px;
  transition: transform .05s ease, background .15s ease, opacity .15s ease;
}

button:active { transform: translateY(1px); }

/* Botones principales (Ingresar / Ver datos) */
#ingresar-btn,
#cambiar-fecha-btn {
  background: #111827;
  color: #fff;
  width: 100%;
}

#ingresar-btn:hover,
#cambiar-fecha-btn:hover {
  background: #0b1220;
}

/* Botón secundario (Mostrar contraseña) */
#show-password {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid var(--border);
}
#show-password:hover { background: #e5e7eb; }

/* =========================
   Datos personales (grid)
   ========================= */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.grid p {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed rgba(107,114,128,.35);
  border-radius: 10px;
  background: rgba(249,250,251,.9);
}

/* =========================
   Filters + Table
   ========================= */
.table-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.filters label {
  font-size: .85rem;
  color: var(--muted);
}

.filters select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 10px 12px;
  white-space: nowrap;
}

thead th {
  background: var(--thead-blue);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:nth-child(even) { background: #fafafa; }

td .chip {
  display: inline-block;
  font-size: 0.75rem;
  padding: 6px 8px;
  border-radius: 999px;
  font-weight: 800;
  margin-bottom: 6px;
}

.chip-dayoff { background: var(--dayoff-chip); color: #fff; }

/* =========================
   Responsive
   ========================= */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .table-actions { flex-direction: column; align-items: stretch; }
  #cambiar-fecha-btn { width: 100%; }
}

@media (max-width: 520px) {
  .container { width: calc(100% - 20px); margin: 14px auto; }
  .app-header { grid-template-columns: 1fr; }
  .header-text { grid-column: 1; }
  .app-header button { grid-column: 1; justify-self: stretch; }
}

/* =========================
   Estados de filas
   ========================= */

/* Días realmente libres: fondo rosado + texto rojo */
tr.row--dayoff {
  background: var(--dayoff-bg) !important;
}
tr.row--dayoff td {
  color: #991b1b;
  font-weight: 600;
}

/* Días con turno pero sin marcaje / programados: fondo naranjo suave */
tr.row--missing { background: #fff7ed !important; }
tr.row--missing td { color: #9a3412; font-weight: 600; }
.chip-missing { background: #fb923c; color: #111827; }