/* ==========================================================================
   ESOC Prevención · Identidad Visual Corporativa 2026
   Colores corporativos:
     - Principal (Cyan): #48BFE9 (Pantone 2985 UP)
     - Secundario (Azul claro): #B6E4FA
     - Acento (Magenta): #EC008B (Magenta 100%)
     - Texto (Negro corporativo): #231F20
     - Blanco puro app: #FFFFFF
     - Blanco roto diferenciado (Header y Banner): #F4F6F9
   ========================================================================== */

:root {
  /* Paleta Corporativa ESOC */
  --c-cyan: #48BFE9;
  --c-cyan-hover: #269ec8;
  --c-cyan-light: #B6E4FA;
  --c-magenta: #EC008B;
  --c-magenta-light: #F6ADCD;
  --c-magenta-bg: rgba(236, 0, 139, 0.08);
  --c-magenta-border: rgba(236, 0, 139, 0.35);
  --c-black: #231F20;

  /* Estructura y Temas Claro */
  --bg-app: #FFFFFF;
  --bg-offwhite: #F4F6F9;
  --bg-offwhite-hover: #E9EDF2;
  --bg-card: #FFFFFF;

  --border: #E2E8F0;
  --border-input: #CBD5E1;
  --border-focus: #48BFE9;

  --txt-main: #231F20;
  --txt-mut: #64748B;
  --txt-label: #475569;

  /* Estados */
  --warn: #FAAA1C;
  --ok: #10B981;
  --bad: #EC008B;

  /* Tipografías corporativas */
  --font-title: 'Barlow Condensed', 'Work Sans', system-ui, sans-serif;
  --font-body: 'Work Sans', system-ui, -apple-system, sans-serif;

  --r: 16px;
  --shadow-sm: 0 2px 8px rgba(35, 31, 32, 0.04);
  --shadow-md: 0 10px 30px -5px rgba(35, 31, 32, 0.06), 0 4px 12px -2px rgba(35, 31, 32, 0.02);
  --shadow-lg: 0 16px 36px rgba(72, 191, 233, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--txt-main);
  background-color: var(--bg-app);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: #0284C7;
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--c-cyan-hover);
  text-decoration: underline;
}

/* ==========================================================================
   BANDA SUPERIOR (HEADER) EN BLANCO ROTO DIFERENCIADO
   ========================================================================== */
header.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  background: var(--bg-offwhite);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(35, 31, 32, 0.03);
}

/* Logo transparente: solo se ve la 'o' con la raya encima (el isotipo oficial) */
header.top img {
  height: 38px;
  width: auto;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: block;
}

header.top h1 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--c-black);
  margin: 0;
  line-height: 1.2;
}

header.top .sp {
  flex: 1;
}

.pill {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 16px;
  border: 1.5px solid var(--border-input);
  border-radius: 99px;
  color: var(--txt-main);
  background: #FFFFFF;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.pill:hover {
  color: #0284C7;
  border-color: var(--c-cyan);
  background: rgba(182, 228, 250, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(72, 191, 233, 0.15);
  text-decoration: none;
}

/* ==========================================================================
   CONTENIDO PRINCIPAL & HERO
   ========================================================================== */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.hero {
  text-align: center;
  margin: 18px 0 28px;
}

/* Frase solicitada en azul corporativo #48bfe9 */
.hero h2 {
  font-family: var(--font-title);
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--c-cyan);
  line-height: 1.2;
}

.hero p {
  color: var(--txt-mut);
  font-size: 1.05rem;
  margin: 0;
  font-weight: 400;
}

/* ==========================================================================
   BANNER DE POBLACIÓN Y ACTIVIDAD EN BLANCO ROTO
   ========================================================================== */
.card {
  background: var(--bg-offwhite);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 26px;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s ease;
}

/* Barra de opción para empresas sin centro de trabajo */
.sin-centro-wrap {
  background: #FFFFFF;
  border: 1.5px solid var(--border-input);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  font-size: 0.94rem;
  color: var(--txt-main);
  text-transform: none;
  letter-spacing: normal;
}
.sin-centro-wrap:hover {
  border-color: var(--c-cyan);
}
.sin-centro-wrap.active {
  background: rgba(182, 228, 250, 0.22);
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 3px rgba(72, 191, 233, 0.18);
}
.sin-centro-wrap input[type="checkbox"] {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--c-cyan);
  cursor: pointer;
  flex-shrink: 0;
}
.sin-centro-wrap small {
  color: var(--txt-mut);
  font-size: 0.82rem;
  margin-left: 4px;
}

input:disabled, input.disabled {
  background: #F1F5F9 !important;
  color: #64748B !important;
  border-color: #CBD5E1 !important;
  cursor: not-allowed;
  font-style: italic;
}

label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--txt-label);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border-input);
  background: #FFFFFF;
  color: var(--c-black);
  font-family: var(--font-body);
  font-size: 0.98rem;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

input:focus, select:focus {
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 4px rgba(72, 191, 233, 0.22);
}

input::placeholder {
  color: #94A3B8;
}

input[type=checkbox] {
  width: auto;
  accent-color: var(--c-cyan);
  cursor: pointer;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}
.grid .full {
  grid-column: 1 / -1;
}
@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
  header.top {
    padding: 12px 18px;
  }
  .hero h2 {
    font-size: 1.85rem;
  }
}

/* Autocomplete */
.ac {
  position: relative;
}
.ac ul {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 30;
  box-shadow: 0 12px 32px rgba(35, 31, 32, 0.12);
  display: none;
}
.ac li {
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--c-black);
  font-size: 0.94rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
}
.ac li:hover, .ac li.on {
  background: rgba(182, 228, 250, 0.35);
  color: #0284C7;
  font-weight: 600;
}
.ac small {
  color: var(--txt-mut);
  font-size: 0.82rem;
  font-weight: normal;
  margin-left: 10px;
}

.hint {
  font-size: 0.82rem;
  color: var(--txt-mut);
  margin-top: 6px;
}

/* ==========================================================================
   FICHA DE RESULTADO DE TÉCNICO
   ========================================================================== */
.result {
  margin-top: 24px;
  animation: up 0.4s ease both;
}
@keyframes up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* La tarjeta del técnico destaca sobre fondo blanco puro con borde corporativo */
.result.card {
  background: #FFFFFF;
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--c-cyan);
  box-shadow: 0 8px 24px rgba(72, 191, 233, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 24px;
}

.tec {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 700;
  font-family: var(--font-title);
  background: linear-gradient(135deg, var(--c-cyan), var(--c-cyan-light));
  color: var(--c-black);
  box-shadow: 0 4px 14px rgba(72, 191, 233, 0.4);
  flex-shrink: 0;
}

.tec h3 {
  margin: 0;
  font-size: 1.85rem;
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--c-black);
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tag {
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 99px;
  background: #F8FAFC;
  border: 1px solid var(--border);
  color: #334155;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Nota de color corporativa con Magenta #EC008B para avisos/sustituciones */
.tag.warn {
  background: var(--c-magenta-bg);
  color: var(--c-magenta);
  border-color: var(--c-magenta-border);
  font-weight: 600;
}

.tag.ok {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
  font-weight: 600;
}

.why {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  color: var(--txt-mut);
  font-size: 0.94rem;
  line-height: 1.5;
}

/* ==========================================================================
   BOTONES & CONTROLES
   ========================================================================== */
.btn {
  padding: 11px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--c-cyan);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(72, 191, 233, 0.25);
}

.btn:hover {
  background: var(--c-cyan-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(72, 191, 233, 0.35);
}

.btn.sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn.ghost {
  background: #FFFFFF;
  border: 1.5px solid var(--border-input);
  color: var(--txt-label);
  box-shadow: none;
}
.btn.ghost:hover {
  background: var(--bg-offwhite);
  border-color: var(--c-cyan);
  color: #0284C7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Botón peligro / borrar con Magenta #EC008B */
.btn.bad {
  background: var(--c-magenta-bg);
  color: var(--c-magenta);
  border: 1px solid var(--c-magenta-border);
  box-shadow: none;
}
.btn.bad:hover {
  background: var(--c-magenta);
  color: #FFFFFF;
  border-color: var(--c-magenta);
  box-shadow: 0 4px 12px rgba(236, 0, 139, 0.3);
}

/* Botón acceso directo Juan Eloy con degradado azul corporativo */
.btn-direct {
  background: linear-gradient(135deg, var(--c-cyan), #259DC9) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 14px rgba(72, 191, 233, 0.4) !important;
}
.btn-direct:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(72, 191, 233, 0.5) !important;
  filter: brightness(1.05);
}

/* ==========================================================================
   PESTAÑAS DE ADMINISTRACIÓN (TABS)
   ========================================================================== */
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.tabs button {
  padding: 9px 18px;
  border-radius: 99px;
  border: 1.5px solid var(--border-input);
  background: #FFFFFF;
  color: #475569;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.tabs button:hover {
  background: rgba(182, 228, 250, 0.35);
  border-color: var(--c-cyan);
  color: #0284C7;
}

.tabs button.on {
  background: linear-gradient(135deg, var(--c-cyan), #259DC9);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(72, 191, 233, 0.35);
}

/* ==========================================================================
   TABLAS & VISTAS ADMIN
   ========================================================================== */
#vista.card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(35, 31, 32, 0.04);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  background: var(--bg-offwhite);
  border-bottom: 2px solid var(--border);
  font-weight: 700;
}

td {
  padding: 8px 12px;
  border-top: 1px solid #F1F5F9;
  color: var(--c-black);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(182, 228, 250, 0.12);
}

td input, td select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: #FFFFFF;
  font-size: 0.88rem;
}

td input:focus, td select:focus {
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 2px rgba(72, 191, 233, 0.25);
}

.warnbox {
  background: var(--c-magenta-bg);
  border: 1px solid var(--c-magenta-border);
  color: #9D005B;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #231F20;
  color: #FFFFFF;
  border: 1.5px solid var(--c-cyan);
  padding: 11px 24px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(35, 31, 32, 0.2);
  font-weight: 500;
  font-size: 0.9rem;
}
.toast.show {
  opacity: 1;
}

.row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.row > div {
  flex: 1;
  min-width: 160px;
}

h3.sec {
  margin: 28px 0 12px;
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  color: #0284C7;
  letter-spacing: 0.01em;
}

.scroll {
  max-height: min(72vh, 620px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FFFFFF;
  position: relative;
}

.scroll table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.scroll th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-offwhite);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 6px rgba(35, 31, 32, 0.05);
}
