:root {
  --ink: #1d2939;
  --muted: #667085;
  --line: #d0d5dd;
  --soft: #f2f4f7;
  --brand: #006d77;
  --brand-strong: #00525a;
  --paper: #ffffff;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef2f3;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

:focus-visible {
  outline: 3px solid #2e90fa;
  outline-offset: 2px;
}

.skip-link {
  background: #fff;
  border: 2px solid var(--brand);
  border-radius: 6px;
  left: 12px;
  padding: 10px 14px;
  position: fixed;
  top: -80px;
  z-index: 10000;
}

.skip-link:focus {
  top: 12px;
}

a {
  color: var(--brand);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px 24px;
}

.brand {
  color: var(--brand-strong);
  display: inline-block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-name {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}

.user-context {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-toggle {
  display: none;
}

.nav a,
.button,
button {
  align-items: center;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
}

.nav a.secondary,
.button.secondary,
button.secondary {
  background: #fff;
  color: var(--brand);
}

.nav a.active {
  box-shadow: 0 0 0 2px rgba(0, 109, 119, 0.16);
}

.button.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.container {
  margin: 0 auto;
  max-width: 1180px;
  padding: 24px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 18px;
}

.panel h1,
.panel h2 {
  margin: 0 0 14px;
}

.sirge-hero {
  align-items: flex-end;
  background: linear-gradient(135deg, var(--brand-strong), var(--brand));
  border-radius: 12px;
  color: #fff;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 28px;
}

.sirge-hero h1 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.1;
  margin: 8px 0 12px;
  max-width: 760px;
}

.sirge-hero p {
  line-height: 1.55;
  margin: 0;
  max-width: 760px;
}

.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-version {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 11px;
}

.module-section {
  margin-bottom: 26px;
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 5px 0 0;
}

.module-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  display: block;
  min-height: 190px;
  padding: 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.module-card:hover,
a.module-card:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.09);
  transform: translateY(-2px);
}

.module-card h3 {
  font-size: 19px;
  margin: 18px 0 8px;
}

.module-card p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.module-action {
  color: var(--brand);
  display: block;
  font-weight: 700;
  margin-top: 18px;
}

.module-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
}

.status-ready {
  background: #ecfdf3;
  color: #067647;
}

.status-planned {
  background: #f2f4f7;
  color: #475467;
}

.status-pending {
  background: #fffaeb;
  color: #b54708;
}

.module-card.is-planned {
  background: #f8fafb;
}

.choice-card {
  align-items: flex-start;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 9px;
  margin-bottom: 10px;
  padding: 12px;
}

.choice-card input {
  min-height: auto;
  width: auto;
}

.detail-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.detail-grid div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-grid dd {
  font-weight: 700;
  margin: 5px 0 0;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field.span-2 {
  grid-column: span 2;
}

.field.span-4 {
  grid-column: span 4;
}

label {
  color: #344054;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-height: 36px;
  padding: 8px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.14);
}

.required-mark {
  color: var(--danger);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  font-size: 12px;
  text-transform: uppercase;
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  position: relative;
}

.table-wrap:focus-visible {
  border-radius: 4px;
  outline-offset: 3px;
}

.mobile-table-hint {
  color: var(--muted);
  display: none;
  font-size: 12px;
  margin: 0 0 8px;
}

.table-summary {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.novelty-cell {
  text-align: center;
}

.novelty-eye {
  align-items: center;
  color: var(--brand);
  cursor: help;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  position: relative;
  width: 28px;
}

.novelty-eye svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 20px;
}

.novelty-eye:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.novelty-tooltip {
  background: #101828;
  border-radius: 6px;
  bottom: calc(100% + 8px);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.2);
  color: #fff;
  display: none;
  font-size: 12px;
  font-weight: 400;
  left: 50%;
  line-height: 1.35;
  max-width: 360px;
  min-width: 260px;
  padding: 10px;
  position: absolute;
  text-align: left;
  transform: translateX(-50%);
  white-space: normal;
  z-index: 20;
}

.novelty-tooltip::after {
  border: 6px solid transparent;
  border-top-color: #101828;
  content: "";
  left: 50%;
  position: absolute;
  top: 100%;
  transform: translateX(-50%);
}

.novelty-eye:hover .novelty-tooltip,
.novelty-eye:focus .novelty-tooltip {
  display: block;
}

.muted {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

.page-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 36px;
  min-width: 36px;
  padding: 8px 10px;
}

.page-link.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.button.disabled {
  cursor: default;
  opacity: 0.55;
  pointer-events: none;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}

.status-alta,
.status-ok {
  background: #ecfdf3;
  color: #067647;
}

.status-media {
  background: #fffaeb;
  color: #b54708;
}

.status-revision {
  background: #fff7ed;
  color: #c2410c;
}

.status-sin_coincidencia {
  background: #f2f4f7;
  color: #344054;
}

.audit-option {
  border-bottom: 1px solid var(--line);
  padding: 4px 0;
}

.audit-option:last-child {
  border-bottom: 0;
}

.food-check {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.food-check input {
  min-height: auto;
  width: auto;
}

.login-page {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 380px;
  padding: 24px;
  width: 100%;
}

.alert {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #9a3412;
  margin-bottom: 12px;
  padding: 10px;
}

.success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

.connection-status {
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 700;
  padding: 12px 24px;
  text-align: center;
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
  margin-top: 6px;
}

.analytics-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-panel {
  margin-bottom: 0;
}

.bar-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 1.1fr) 2fr 48px;
  margin: 8px 0;
}

.bar-label {
  overflow-wrap: anywhere;
}

.bar-track {
  background: #e4e7ec;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.bar-fill {
  background: var(--brand);
  height: 100%;
}

.bar-total {
  font-weight: 700;
  text-align: right;
}

.dual-bar-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 0.9fr) 2fr;
  margin: 10px 0;
}

.dual-bars {
  display: grid;
  gap: 5px;
}

.mini-bar {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 64px 1fr 42px;
}

.mini-bar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.mini-bar strong {
  text-align: right;
}

.family-fill {
  background: var(--brand);
}

.map-canvas {
  background: #eef2f4;
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 520px;
  overflow: hidden;
  width: 100%;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 12px 0;
}

.map-legend span {
  align-items: center;
  display: inline-flex;
  font-size: 14px;
  gap: 7px;
}

.map-legend i {
  background: var(--legend-color);
  border: 2px solid var(--legend-color);
  border-radius: 50%;
  display: inline-block;
  height: 14px;
  width: 14px;
}

.map-legend i.affected {
  background: #fff;
  border: 4px solid #b42318;
}

.map-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
}

.integral-needs-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.integral-need {
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
}

.integral-need label {
  display: grid;
  gap: 5px;
}

.table-primary-link {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.table-primary-link span {
  font-size: 12px;
  font-weight: 600;
}

.button.compact {
  padding: 7px 10px;
  white-space: nowrap;
}

.people-fill {
  background: #475467;
}

@media (max-width: 820px) {
  .map-canvas {
    height: 380px;
  }
  .grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .analytics-grid,
  .module-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .dual-bar-row {
    grid-template-columns: 1fr;
  }

  .field.span-2,
  .field.span-4 {
    grid-column: auto;
  }

  .topbar {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .brand-name {
    display: none;
  }

  .user-context {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-toggle {
    display: inline-flex;
    min-height: 44px;
  }

  .nav {
    background: #fff;
    border-top: 1px solid var(--line);
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0,1fr));
    margin: 10px -16px -12px;
    max-height: calc(100vh - 75px);
    overflow-y: auto;
    padding: 12px 16px 18px;
  }

  .nav.is-open {
    display: grid;
  }

  .nav a {
    justify-content: center;
    min-height: 46px;
    text-align: center;
  }

  .container {
    padding: 16px;
  }

  .panel {
    margin-bottom: 14px;
    padding: 16px;
  }

  body {
    font-size: 15px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    min-height: 46px;
    padding: 10px 12px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    min-height: 22px;
    min-width: 22px;
    width: 22px;
  }

  .button,
  button,
  .page-link {
    justify-content: center;
    min-height: 44px;
  }

  form > .actions {
    background: rgba(255,255,255,.96);
    border-top: 1px solid var(--line);
    bottom: 0;
    margin: 16px -16px -16px;
    padding: 12px 16px;
    position: sticky;
    z-index: 20;
  }

  .table-wrap table {
    min-width: 720px;
  }

  .table-wrap th:first-child,
  .table-wrap td:first-child {
    background: #fff;
    box-shadow: 2px 0 0 var(--line);
    left: 0;
    position: sticky;
    z-index: 2;
  }

  .table-wrap th:first-child {
    background: var(--soft);
    z-index: 3;
  }

  .mobile-table-hint {
    display: block;
  }

  .sirge-hero,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .nav {
    grid-template-columns: 1fr;
  }

  .actions .button,
  .actions button {
    flex: 1 1 100%;
    width: 100%;
  }

  .sirge-hero {
    padding: 20px;
  }

  .module-card {
    min-height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
.migration-progress{margin:1.25rem 0;padding:1rem;border:1px solid #cbd5e1;border-radius:12px;background:#f8fafc}.migration-progress-heading{display:flex;justify-content:space-between;gap:1rem;margin-bottom:.65rem}.migration-progress progress{display:block;width:100%;height:1.25rem;accent-color:#007f86}.migration-progress .muted{margin:.65rem 0 0}
