/* Fichaje — UI clara estilo Fornia */
:root {
  --color-bg: #ffffff;
  --color-surface: #f7f8fa;
  --color-border: #e4e7ec;
  --color-text: #1a2332;
  --color-muted: #6b7a8d;
  --color-primary: #0d9488;
  --color-primary-hover: #0f766e;
  --color-success: #2ead6f;
  --color-warning: #f0a030;
  --color-danger: #e05050;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 10px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.5rem; }
.muted { color: var(--color-muted); }
.layout-app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 1rem 0.75rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; color: var(--color-primary);
  padding: 0.5rem 0.75rem 1rem;
  font-size: 1.05rem;
}
.sidebar .brand img { width: 28px; height: 28px; }
.sidebar .empresa { font-size: 0.75rem; color: var(--color-muted); padding: 0 0.75rem 1rem; margin-top: -0.5rem; }
.sidebar nav a {
  display: block; padding: 0.5rem 0.75rem; border-radius: 8px;
  color: var(--color-text); margin-bottom: 2px;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: #e8eef2; text-decoration: none; color: var(--color-primary);
}
.sidebar .back-home {
  margin-top: auto; padding: 0.75rem; font-size: 0.85rem;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.sidebar .back-home a { display: block; }
.layout-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; background: #fff;
}
.topbar .user { font-size: 0.9rem; color: var(--color-muted); }
.content { padding: 1.25rem 1.5rem 2rem; flex: 1; background: var(--color-bg); }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}
.btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: none; border-radius: 8px; padding: 0.5rem 1rem;
  font-weight: 600; font-size: 0.875rem; cursor: pointer;
  background: var(--color-primary); color: #fff;
}
.btn:hover { background: var(--color-primary-hover); text-decoration: none; color: #fff; }
.btn.secondary { background: #eef1f5; color: var(--color-text); }
.btn.secondary:hover { background: #e0e5eb; color: var(--color-text); }
.btn.danger { background: var(--color-danger); color: #fff; }
.btn.sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
label { display: block; font-size: 0.8rem; color: var(--color-muted); margin-bottom: 0.25rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], select, textarea,
.ss-input, .fp-input {
  width: 100%; max-width: 440px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text);
  margin-bottom: 0.85rem;
  font: inherit;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.25rem 1.25rem;
}
.form-grid .full { grid-column: 1 / -1; }
.alert {
  padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem;
}
.alert.ok { background: #e8f8ef; color: #1a6b3c; }
.alert.err { background: #fdecec; color: #8b1e1e; }
.alert.warn { background: #fff6e5; color: #8a5a00; border: 1px solid #f0d9a8; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td {
  text-align: left; padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
}
.table th { color: var(--color-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.badge {
  display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px;
  font-size: 0.72rem; background: #eef1f5; color: var(--color-muted);
}
.badge.on { background: #d8f3e4; color: #1a6b3c; }
.badge.off { background: #f0eeeb; color: #6b6358; }
.badge.sla-ok { background: #d8f3e4; color: #1a6b3c; }
.badge.sla-warn { background: #fef3c7; color: #92400e; }
.badge.sla-vencido { background: #fee2e2; color: #991b1b; }
.filters {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1rem;
  align-items: flex-end; margin-bottom: 1rem;
}
.filters .field { min-width: 140px; }
.filters .field input, .filters .field select, .filters .field .ss-wrap { margin-bottom: 0; max-width: 200px; }

/* Seguimiento: tira de 7 días */
.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.day-strip__item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: inherit;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.day-strip__item:hover {
  border-color: var(--color-primary);
  text-decoration: none;
}
.day-strip__item.is-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.18);
  background: #e8f5f3;
}
.day-strip__dow { font-size: 0.72rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.day-strip__date { font-weight: 700; font-size: 0.95rem; }
.day-strip__stats {
  display: flex; justify-content: center; gap: 0.35rem;
  font-size: 0.72rem; font-weight: 600; margin-top: 0.25rem;
}
.day-strip__stats .ok { color: var(--color-success); }
.day-strip__stats .open { color: #92600a; }
.day-strip__stats .bad { color: var(--color-danger); }
.turno-cell { line-height: 1.25; }
.turno-cell__date { display: block; font-weight: 600; }
.turno-cell__hours { display: block; font-size: 0.85rem; color: var(--color-muted); }
@media (max-width: 900px) {
  .day-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .day-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.module-card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  background: var(--color-surface);
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.module-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
  text-decoration: none;
}
.module-card h2 { color: var(--color-primary); margin-bottom: 0.35rem; }
.module-card p { margin: 0; color: var(--color-muted); font-size: 0.875rem; }
.login-wrap { max-width: 400px; margin: 12vh auto; padding: 0 1rem; }
.login-wrap .card { box-shadow: 0 8px 30px rgba(26, 35, 50, 0.06); }
.avatar-preview {
  width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--color-border);
  background: #eee;
}
.toggle-grid {
  display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1rem; align-items: center;
}
.toggle-grid label.title { color: var(--color-text); font-size: 0.95rem; margin: 0; }

/* Searchable select */
.ss-wrap { position: relative; max-width: 440px; margin-bottom: 0.85rem; }
.ss-wrap input.ss-input { margin-bottom: 0; }
.ss-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: 100%;
  max-height: 220px; overflow: auto;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 8px; margin-top: 2px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  display: none;
}
.ss-list.open { display: block; }
.ss-list button {
  display: block; width: 100%; text-align: left;
  border: none; background: none; padding: 0.45rem 0.7rem;
  cursor: pointer; font: inherit; color: var(--color-text);
}
.ss-list button:hover, .ss-list button.active { background: #e8f5f3; }
.ss-list .empty { padding: 0.5rem 0.7rem; color: var(--color-muted); font-size: 0.85rem; }

/* Perillas (switch) */
.switch-stack { display: flex; flex-direction: column; gap: 0.65rem; max-width: 360px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 0; font-weight: 500; cursor: pointer;
}
.switch-row span { color: var(--color-text); }
input.switch {
  appearance: none; -webkit-appearance: none;
  width: 46px; height: 26px; flex-shrink: 0;
  background: #c5cdd6; border-radius: 999px;
  position: relative; cursor: pointer;
  transition: background 0.2s ease;
  outline: none; border: none; margin: 0; padding: 0;
  vertical-align: middle;
}
input.switch::after {
  content: ""; position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}
input.switch:checked {
  background: var(--color-success);
}
input.switch:checked::after {
  transform: translateX(20px);
}
input.switch:focus-visible {
  box-shadow: 0 0 0 3px rgba(46, 173, 111, 0.35);
}

.punto-map {
  height: 320px; width: 100%; max-width: 720px;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  margin-top: 0.5rem; background: #e8eef2;
}
.geo-toolbar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}

/* Portal móvil */
.m-shell { max-width: 480px; margin: 0 auto; padding: 0.75rem; }
.m-nav {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  margin-bottom: 1rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.m-nav a {
  font-size: 0.85rem; padding: 0.35rem 0.65rem;
  border-radius: 999px; background: var(--color-surface);
  color: var(--color-text); text-decoration: none;
  border: 1px solid var(--color-border);
}
.m-nav a.active {
  background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}
.m-nav a:hover { text-decoration: none; }

/* Dashboards Ops / RRHH */
.dash-section { margin-bottom: 1.75rem; }
.dash-section h2 {
  font-size: 1.05rem; font-weight: 600; margin: 0 0 0.75rem;
  color: var(--color-text);
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.75rem;
}
a.dash-card {
  display: flex; flex-direction: column; gap: 0.25rem;
  padding: 0.9rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
a.dash-card:hover {
  text-decoration: none;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.12);
}
.dash-card__label {
  font-size: 0.78rem; color: var(--color-muted); line-height: 1.25;
}
.dash-card__value {
  font-size: 1.55rem; font-weight: 700; line-height: 1.15;
  letter-spacing: -0.02em;
}
.dash-card__meta {
  font-size: 0.75rem; color: var(--color-muted);
}
a.dash-card.ok .dash-card__value { color: var(--color-success); }
a.dash-card.warn .dash-card__value { color: var(--color-warning); }
a.dash-card.bad .dash-card__value { color: var(--color-danger); }

.dash-charts {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.4fr);
  gap: 0.85rem;
  align-items: stretch;
}
.dash-chart-card { padding: 1rem; }
.dash-chart-card h3 {
  margin: 0 0 0.65rem; font-size: 0.95rem; font-weight: 600;
}
.dash-grid--compact { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.dash-top-list {
  list-style: none; margin: 0.75rem 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.dash-top-list li {
  display: flex; justify-content: space-between; gap: 0.5rem;
  font-size: 0.85rem;
}
.chart-box { width: 100%; }

/* Day strip semanal */
.day-strip-nav {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap;
}
.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}
a.day-strip__item {
  display: flex; flex-direction: column; gap: 0.25rem;
  padding: 0.55rem 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  min-height: 88px;
}
a.day-strip__item:hover { border-color: var(--color-primary); text-decoration: none; }
a.day-strip__item.is-selected {
  border-color: var(--color-primary);
  background: #e8f5f3;
  box-shadow: 0 0 0 1px var(--color-primary);
}
.day-strip__head {
  display: flex; flex-direction: column; align-items: center; gap: 0.05rem;
  font-size: 0.78rem; color: var(--color-muted);
}
.day-strip__dow { font-weight: 600; color: var(--color-text); }
.day-strip__total {
  font-size: 1.35rem; font-weight: 700; text-align: center; line-height: 1.1;
}
.day-strip__meta {
  display: flex; justify-content: center; gap: 0.45rem; font-size: 0.72rem;
}
.day-strip__meta .bad { color: var(--color-danger); font-weight: 600; }
.day-strip__meta .open { color: var(--color-warning); font-weight: 600; }
.day-strip__bar {
  height: 4px; border-radius: 99px; background: #e5e7eb; overflow: hidden; margin-top: 0.15rem;
}
.day-strip__bar > span {
  display: block; height: 100%; background: var(--color-success);
}

.badge.warn { background: #fff3d6; color: #9a6b00; }
.badge.off { background: #fde8e8; color: #a33; }
.badge.on { background: #d8f3e4; color: #1a7a4c; }

.rev-ok { color: var(--color-success); font-weight: 600; }
.rev-bad { color: var(--color-danger); font-weight: 600; }
.rev-stack { display: flex; flex-direction: column; line-height: 1.25; font-size: 0.85rem; }

.cuadrante-nav {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem;
}
.cuadrante-grid th.weekend { background: #f3f4f6; }
.cuadrante-grid th.today { background: #e8f5f3; color: var(--color-primary); }
.cuadrante-grid td.weekend { background: #fafafa; }
.cuadrante-grid td.today { background: #f2fbf9; }
.turno-chip {
  display: block;
  background: #e8f5f3;
  border: 1px solid #b7e4dc;
  border-radius: 6px;
  padding: 0.2rem 0.35rem;
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
  line-height: 1.25;
}

@media (max-width: 900px) {
  .dash-charts { grid-template-columns: 1fr; }
  .day-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .layout-app { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); }
}
