:root {
  --navy: #151d4b;
  --navy-2: #202866;
  --cyan: #23c8f2;
  --cyan-2: #56dcff;
  --ink: #101828;
  --muted: #667085;
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e4e7ec;
  --success: #067647;
  --success-bg: #ecfdf3;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --shadow: 0 18px 50px rgba(16, 24, 40, .10);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 5% 0%, rgba(35, 200, 242, .12), transparent 28%),
    linear-gradient(180deg, #eef3ff 0, var(--bg) 340px);
}

button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.page-shell { min-height: 100vh; }
.brandbar {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 13px;
}
.brandmark {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--navy);
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  box-shadow: 0 8px 20px rgba(35, 200, 242, .28);
}
.brandmark.small { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }
.brand-name { font-weight: 900; letter-spacing: .02em; color: var(--navy); line-height: 1; }
.brand-name span { color: #159fc6; }
.brand-tag { margin-top: 5px; font-size: 12px; color: var(--muted); }

.container { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 42px; }
.hero { text-align: center; margin-bottom: 24px; }
.eyebrow { color: #118eb0; font-weight: 800; font-size: 12px; letter-spacing: .15em; }
.hero h1, .admin-title-row h1, .login-card h1 { color: var(--navy); margin: 10px 0 6px; letter-spacing: -.025em; }
.hero h1 { font-size: clamp(31px, 5vw, 50px); line-height: 1.05; }
.hero > p { max-width: 680px; margin: 0 auto; color: var(--muted); font-size: 17px; }

.deadline-card {
  width: min(600px, 100%);
  margin: 24px auto 0;
  color: white;
  background: linear-gradient(120deg, var(--navy), var(--navy-2));
  border-radius: 18px;
  padding: 18px 22px;
  box-shadow: 0 16px 42px rgba(21, 29, 75, .2);
}
.deadline-card.closed { background: linear-gradient(120deg, #344054, #475467); }
.deadline-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .8; font-weight: 700; }
.countdown { display: flex; justify-content: center; align-items: center; gap: 13px; margin: 11px 0 8px; }
.countdown > div:not(.separator) { min-width: 82px; }
.countdown strong { display: block; font-size: 34px; line-height: 1; }
.countdown span { display: block; margin-top: 5px; font-size: 11px; opacity: .8; text-transform: uppercase; }
.countdown .separator { font-size: 28px; opacity: .55; transform: translateY(-7px); }
.deadline-card small { opacity: .72; }

.card {
  background: var(--card);
  border: 1px solid rgba(228, 231, 236, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}
.section-heading, .companions-header, .admin-title-row, .table-tools {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.section-heading h2, .companions-header h2, .table-tools h2, .panel-heading h2 { margin: 4px 0 0; color: var(--navy); font-size: 20px; }
.section-description { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.step { color: #159fc6; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.required-note { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; color: #344054; }
.field input, .search-input {
  width: 100%;
  border: 1px solid #d0d5dd;
  background: #fff;
  border-radius: 11px;
  padding: 12px 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .search-input:focus { border-color: #23b8df; box-shadow: 0 0 0 4px rgba(35, 200, 242, .13); }
.field input.invalid { border-color: #f04438; box-shadow: 0 0 0 3px rgba(240, 68, 56, .08); }
.field-error { min-height: 16px; display: block; margin-top: 5px; color: var(--danger); font-size: 11px; }

.companions-header { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }
.companions-header p, .table-tools p, .admin-title-row p, .login-card > p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.companions-list { display: grid; gap: 13px; margin-top: 18px; }
.companion-card { padding: 18px; background: #f8fafc; border: 1px solid var(--line); border-radius: 15px; }
.companion-title { display: flex; justify-content: space-between; align-items: center; color: var(--navy); }
.family-kicker { display: block; margin-bottom: 3px; color: #159fc6; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.family-grid { margin-top: 15px; }
.remove-companion { border: 0; background: transparent; color: var(--danger); font-weight: 700; cursor: pointer; padding: 6px 0 6px 12px; }

.form-footer { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; max-width: 610px; font-size: 13px; color: #475467; line-height: 1.45; }
.check-row input { margin-top: 3px; accent-color: var(--navy); }
.btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, opacity .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, #1f2a70, var(--navy)); color: white; box-shadow: 0 8px 20px rgba(21, 29, 75, .2); }
.btn.secondary { background: #e8f9fe; color: #087d9e; }
.btn.ghost { background: white; color: #344054; border: 1px solid var(--line); }
.btn.danger-lite { background: var(--danger-bg); color: var(--danger); }
.btn.full { width: 100%; }

.alert { margin: 0 0 18px; padding: 14px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.alert.success { color: var(--success); background: var(--success-bg); border: 1px solid #abefc6; }
.alert.error { color: var(--danger); background: var(--danger-bg); border: 1px solid #fecdca; }
.closed-message { text-align: center; padding-block: 50px; }
.closed-icon { margin: 0 auto 14px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: var(--success-bg); color: var(--success); font-size: 24px; font-weight: 900; }
.closed-message h2 { color: var(--navy); margin: 0 0 7px; }
.closed-message p { color: var(--muted); margin: 0; }
footer { display: flex; justify-content: space-between; padding: 20px 5px 0; color: #667085; font-size: 12px; }
footer a { color: #157b99; text-decoration: none; }

/* Admin dashboard */
.admin-bg { background: #f6f8fc; }
.admin-topbar { min-height: 72px; padding: 13px max(24px, calc((100% - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--navy); color: white; }
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand strong { display: block; font-size: 13px; }
.admin-brand span { display: block; margin-top: 3px; color: rgba(255,255,255,.68); font-size: 11px; }
.admin-actions { display: flex; gap: 8px; }
.admin-container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 50px; }
.admin-title-row { align-items: center; }
.admin-title-row h1 { margin-top: 6px; font-size: 30px; }
.status-chip { padding: 8px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-chip.open { background: var(--success-bg); color: var(--success); }
.status-chip.closed { background: #f2f4f7; color: #475467; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 24px 0; }
.stat { background: white; border: 1px solid var(--line); border-radius: 15px; padding: 18px; box-shadow: 0 7px 20px rgba(16, 24, 40, .04); }
.stat.highlight-stat { background: linear-gradient(145deg, var(--navy), var(--navy-2)); border-color: var(--navy); }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat strong { display: block; margin-top: 6px; color: var(--navy); font-size: 30px; }
.stat small { display: block; margin-top: 5px; color: #98a2b3; font-size: 11px; }
.stat.highlight-stat span, .stat.highlight-stat small { color: rgba(255,255,255,.72); }
.stat.highlight-stat strong { color: white; }
.admin-card { background: white; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 7px 20px rgba(16, 24, 40, .04); overflow: hidden; }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 14px; margin-bottom: 14px; }
.insight-card { padding: 22px 24px; }
.panel-heading { margin-bottom: 20px; }
.mini-chart { display: grid; gap: 16px; }
.chart-row { display: grid; gap: 7px; }
.chart-label { display: flex; justify-content: space-between; gap: 12px; color: #475467; font-size: 12px; }
.chart-label strong { color: var(--navy); }
.chart-track { height: 10px; overflow: hidden; border-radius: 999px; background: #eef2f6; }
.chart-track span { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, var(--navy), var(--cyan)); }
.composition-wrap { min-height: 185px; display: flex; align-items: center; justify-content: center; gap: 28px; }
.donut {
  width: 142px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--navy) 0 var(--employee-pct), var(--cyan) var(--employee-pct) 100%);
  position: relative;
}
.donut::after { content: ''; position: absolute; inset: 20px; border-radius: 50%; background: white; }
.donut div { position: relative; z-index: 1; text-align: center; }
.donut strong { display: block; color: var(--navy); font-size: 28px; }
.donut span { color: var(--muted); font-size: 11px; }
.composition-legend { display: grid; gap: 12px; color: #475467; font-size: 12px; }
.composition-legend div { display: flex; align-items: center; gap: 8px; }
.composition-legend b { color: var(--navy); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.primary-dot { background: var(--navy); }
.family-dot { background: var(--cyan); }

.roster-card { margin-top: 14px; }
.table-tools { padding: 22px 24px 16px; align-items: center; }
.roster-tools { gap: 24px; }
.roster-controls { min-width: min(620px, 100%); display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.search-input { width: min(270px, 100%); }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { border: 1px solid var(--line); background: white; color: #475467; border-radius: 999px; padding: 8px 10px; font-size: 11px; font-weight: 800; cursor: pointer; }
.filter-chip span { margin-left: 4px; color: #98a2b3; }
.filter-chip.active { border-color: #b9edf9; background: #e8f9fe; color: #087d9e; }
.roster-list { border-top: 1px solid var(--line); }
.roster-item { border-bottom: 1px solid #eef1f5; }
.roster-item:last-of-type { border-bottom: 0; }
.employee-row { padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.employee-ident { display: flex; align-items: center; gap: 13px; min-width: 0; }
.avatar { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 12px; background: #e8f9fe; color: #087d9e; font-weight: 900; text-transform: uppercase; }
.role-label { color: #159fc6; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.employee-ident h3 { margin: 3px 0 3px; color: var(--navy); font-size: 15px; }
.employee-ident p { margin: 0; color: #98a2b3; font-size: 11px; }
.employee-meta { display: flex; align-items: center; gap: 10px; }
.family-count { display: inline-flex; border-radius: 999px; padding: 6px 9px; background: #f2f4f7; color: #475467; font-size: 10px; font-weight: 800; }
.family-count.has-family { background: #e8f9fe; color: #087d9e; }
.toggle-family { border: 0; background: transparent; color: #087d9e; font-size: 11px; font-weight: 800; cursor: pointer; padding: 7px; }
.alone-label { color: #98a2b3; font-size: 11px; }
.family-panel { padding: 0 24px 18px 81px; }
.family-panel-title { padding-top: 14px; border-top: 1px dashed #dce3eb; color: #667085; font-size: 11px; font-weight: 700; }
.family-members { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.family-member { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: #f8fafc; }
.family-index { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: white; border: 1px solid var(--line); color: #667085; font-size: 10px; font-weight: 800; }
.family-member strong { display: block; color: #344054; font-size: 12px; }
.family-member div span { display: block; margin-top: 2px; color: #98a2b3; font-size: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.empty { text-align: center; padding: 34px; color: var(--muted); }

.login-shell { width: min(440px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; display: grid; place-items: center; padding: 30px 0; }
.login-card { width: 100%; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 30px; }
.login-mark { margin-bottom: 24px; }
.login-card h1 { font-size: 28px; }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.back-link { display: inline-block; margin-bottom: 22px; color: #667085; font-size: 12px; text-decoration: none; }

@media (max-width: 1020px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .roster-tools { align-items: stretch; flex-direction: column; }
  .roster-controls { min-width: 0; justify-content: space-between; }
}

@media (max-width: 780px) {
  .container { width: min(100% - 22px, 980px); padding-top: 18px; }
  .brandbar { width: min(100% - 24px, 1180px); padding-top: 18px; }
  .card { padding: 20px; border-radius: 16px; }
  .grid-2 { grid-template-columns: 1fr; gap: 8px; }
  .section-heading, .companions-header, .form-footer, .table-tools, .admin-title-row { flex-direction: column; align-items: stretch; }
  .companions-header .btn, .form-footer .btn { width: 100%; }
  .form-footer { gap: 16px; }
  .countdown { gap: 7px; }
  .countdown > div:not(.separator) { min-width: 66px; }
  .countdown strong { font-size: 29px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-topbar { padding: 13px 16px; align-items: flex-start; }
  .admin-actions { flex-wrap: wrap; justify-content: flex-end; }
  .admin-actions .btn { padding: 8px 10px; font-size: 11px; }
  .roster-controls { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }
  .employee-row { align-items: flex-start; }
  .employee-meta { flex-direction: column; align-items: flex-end; }
  .family-panel { padding-left: 24px; }
  .family-members { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .brand-tag { display: none; }
  .hero h1 { font-size: 32px; }
  .hero > p { font-size: 15px; }
  .deadline-card { padding-inline: 12px; }
  .countdown > div:not(.separator) { min-width: 58px; }
  .countdown strong { font-size: 26px; }
  .countdown span { font-size: 9px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 14px; }
  .stat strong { font-size: 24px; }
  .composition-wrap { flex-direction: column; }
  .employee-row { flex-direction: column; }
  .employee-meta { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; padding-left: 57px; }
  .filter-tabs { display: grid; grid-template-columns: 1fr; }
  .filter-chip { width: 100%; }
  footer { flex-direction: column; gap: 7px; text-align: center; }
}

/* Identificación y recuperación del registro del colaborador */
.full-span { grid-column: 1 / -1; }
.lookup-status { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.lookup-status.loading { color: #475467; }
.lookup-status.found { color: var(--success); font-weight: 700; }
.lookup-status.new { color: #087d9e; font-weight: 700; }
.lookup-status.error { color: var(--danger); }
