:root {
  /* Kit de marca Repositoria */
  --brand-navy: #1B2A6B;
  --brand-blue: #1F529E;
  --brand-steel: #268CB8;
  --brand-teal: #2EC4C6;
  --blue-900: #1B2A6B;
  --blue-700: #1F529E;
  --blue-600: #268CB8;
  --blue-500: #2EC4C6;
  --blue-100: #e5f6f7;
  --blue-50: #f3fafb;
  --nav-navy: #15245C;
  --nav-indigo: #1B2A6B;
  --nav-blue: #1F529E;
  --nav-steel: #268CB8;
  --nav-teal: #2EC4C6;
  --nav-teal-soft: #8ad4d6;
  --nav-ink: #f4f7fb;
  --ink: #121a33;
  --muted: #5b6b86;
  --surface: #ffffff;
  --bg: #eef3fb;
  --ok: #0d9488;
  --danger: #dc2626;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(27, 42, 107, 0.08);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-nav: "Space Grotesk", "Plus Jakarta Sans", system-ui, sans-serif;
  --sidebar-width: 268px;
  --sidebar-collapsed: 78px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #cfe0ff 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #dbe7ff 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 2rem;
  border: 1px solid rgba(27, 42, 107, 0.08);
}
.auth-card--wide { width: min(520px, 100%); }
.auth-alt {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: .9rem;
  color: var(--muted);
}
.signup-steps {
  list-style: none;
  display: flex;
  gap: .5rem;
  padding: 0;
  margin: 0 0 1.15rem;
}
.signup-steps li {
  flex: 1;
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--blue-50);
  border-radius: 999px;
  padding: .45rem .6rem;
  border: 1px solid transparent;
}
.signup-steps li.is-active {
  color: var(--brand-navy);
  background: var(--blue-100);
  border-color: rgba(46, 196, 198, .35);
}
.signup-steps li.is-done {
  color: #047857;
  background: #ecfdf5;
}
.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}
img.brand-mark {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
.brand-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
}
.brand--auth {
  margin-bottom: 1.5rem;
  justify-content: flex-start;
}
.brand h1 {
  font-size: 1.35rem;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--brand-navy);
}
.brand p { margin: .15rem 0 0; color: var(--muted); font-size: .9rem; }

.auth-card h2 { margin: 0 0 .35rem; font-size: 1.5rem; letter-spacing: -0.02em; }
.auth-card .lead { color: var(--muted); margin: 0 0 1.25rem; }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
input[type="email"], input[type="password"], input[type="text"], select {
  width: 100%;
  border: 1px solid #d7e2f5;
  border-radius: 12px;
  padding: .75rem .9rem;
  font: inherit;
  background: #fbfdff;
  margin-bottom: 1rem;
}
input:focus, select:focus {
  outline: 2px solid rgba(46, 196, 198, .35);
  border-color: var(--brand-teal);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 12px; padding: .75rem 1.1rem;
  font: inherit; font-weight: 700; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand-teal);
  color: #fff;
  box-shadow: 0 10px 20px rgba(46, 196, 198, .28);
  width: 100%;
}
.btn-primary:hover { text-decoration: none; filter: brightness(1.05); color: #fff; }
.btn-ghost {
  background: var(--blue-100); color: var(--blue-900);
}
.btn-sm { padding: .45rem .8rem; font-size: .85rem; width: auto; }

.alert {
  border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .92rem;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-info { background: var(--blue-100); color: var(--blue-900); border: 1px solid #bfdbfe; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .28s ease;
}
.shell.is-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}
.sidebar {
  position: relative;
  background:
    linear-gradient(180deg, var(--nav-navy) 0%, var(--nav-indigo) 42%, var(--nav-blue) 74%, #1a6f7a 100%);
  color: var(--nav-ink);
  padding: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  font-family: var(--font-nav);
}
.sidebar-stripe {
  width: 10px;
  flex: 0 0 10px;
  display: flex;
  flex-direction: column;
}
.sidebar-stripe span { flex: 1; display: block; }
.stripe-navy { background: var(--nav-navy); }
.stripe-blue { background: var(--nav-blue); }
.stripe-steel { background: var(--nav-steel); }
.stripe-teal { background: var(--nav-teal); }
.sidebar-inner {
  flex: 1;
  min-width: 0;
  padding: 1.1rem .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .35rem;
}
.sidebar .brand {
  color: #fff;
  margin-bottom: 0;
  min-width: 0;
}
.sidebar .brand-mark {
  width: 40px;
  height: 40px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.sidebar .brand-text h1 {
  font-family: var(--font-nav);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 1.05rem;
  color: #fff;
}
.sidebar .brand p {
  color: rgba(138, 212, 214, .9);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sidebar-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(139, 188, 185, .35);
  background: rgba(255,255,255,.06);
  color: var(--nav-teal-soft);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
}
.sidebar-toggle:hover { background: rgba(47, 158, 154, .18); }
.sidebar-toggle-icon {
  width: 14px;
  height: 12px;
  display: block;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 5px / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 10px / 100% 2px no-repeat;
}

.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav-section {
  margin: .85rem 0 .35rem;
  padding: 0 .55rem;
  font-family: var(--font-nav);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(244, 247, 251, .55);
  border-bottom: 1px solid rgba(47, 158, 154, .35);
  padding-bottom: .35rem;
}
.nav-section:first-child { margin-top: .15rem; }
.nav a {
  display: flex;
  align-items: center;
  color: rgba(244, 247, 251, .92);
  padding: .62rem .7rem;
  border-radius: 8px;
  margin-bottom: 0;
  font-family: var(--font-nav);
  font-weight: 500;
  font-size: .92rem;
  letter-spacing: .02em;
  border-left: 2px solid transparent;
}
.nav a.nav-sub {
  padding-left: 1.15rem;
  font-size: .84rem;
  color: rgba(139, 188, 185, .95);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 500;
}
.nav a:hover, .nav a.active {
  background: rgba(47, 158, 154, .16);
  text-decoration: none;
  border-left-color: var(--nav-teal);
  color: #fff;
}
.nav a.active {
  background: rgba(47, 158, 154, .22);
  box-shadow: inset 0 0 0 1px rgba(139, 188, 185, .22);
}
.nav a.nav-exit {
  margin-top: .65rem;
  color: rgba(244, 247, 251, .7);
}
.sidebar-foot {
  margin-top: auto;
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  padding: .5rem .55rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-nav);
}

/* Collapsed rail */
.shell.is-collapsed .brand-text,
.shell.is-collapsed .nav-section,
.shell.is-collapsed .sidebar-foot,
.shell.is-collapsed .nav-label {
  display: none;
}
.shell.is-collapsed .sidebar-inner { padding: .9rem .45rem; align-items: center; }
.shell.is-collapsed .sidebar-top { flex-direction: column; align-items: center; width: 100%; }
.shell.is-collapsed .brand { justify-content: center; }
.shell.is-collapsed .nav a {
  justify-content: center;
  padding: .7rem .4rem;
  position: relative;
}
.shell.is-collapsed .nav a::after {
  content: attr(data-nav);
  font-size: .58rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .85;
}
.shell.is-collapsed .nav a.nav-sub { padding-left: .4rem; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1rem 1.5rem;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(26, 109, 255, .08);
  position: sticky; top: 0; z-index: 5;
}
.topbar .who { font-weight: 700; }
.topbar .meta { color: var(--muted); font-size: .85rem; }
.content { padding: 1.25rem 1.5rem 2rem; }

.banner {
  background: #3E62A0;
  color: #fff;
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  animation: rise .45s ease both;
}
.banner h2 { margin: 0 0 .35rem; font-size: 1.55rem; letter-spacing: -0.02em; }
.banner p { margin: 0; opacity: .92; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(26, 109, 255, .06);
  padding: 1.15rem 1.25rem;
  animation: rise .5s ease both;
}
.card h3 { margin: 0 0 .35rem; font-size: 1rem; }
.card .value { font-size: 1.8rem; font-weight: 800; color: var(--blue-700); letter-spacing: -0.03em; }
.card .hint { color: var(--muted); font-size: .85rem; }
.check-label {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  margin: .85rem 0 1rem;
  font-size: .9rem;
  color: var(--text, #0f2744);
  cursor: pointer;
}
.check-label input { margin-top: .2rem; flex-shrink: 0; }
.socio-field[hidden] { display: none !important; }

.section-card { margin-top: 1rem; }
.section-card h3 { margin: 0 0 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .65rem .4rem; border-bottom: 1px solid #e8eef8; }
.table th { color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.tag {
  display: inline-block; background: var(--blue-100); color: var(--blue-900);
  border-radius: 999px; padding: .15rem .55rem; font-size: .75rem; font-weight: 700;
}
.tag-oficial { background: #dbeafe; color: #1e3a8a; }
.tag-borrador-tipo { background: #f1f5f9; color: #334155; }
.tag-alerta { background: #fef3c7; color: #92400e; margin-left: .25rem; }
.tag-vencido { background: #fee2e2; color: #991b1b; margin-left: .25rem; }
.estado-elaboracion { background: #e0e7ff; color: #3730a3; }
.estado-publicado, .estado-vigente { background: #d1fae5; color: #065f46; }
.estado-vencido-ciclo { background: #fef3c7; color: #92400e; }
.estado-renovado { background: #e0f2fe; color: #075985; }
.estado-archivado, .estado-obsoleto { background: #e2e8f0; color: #64748b; }
.estado-borrador, .estado-revision, .estado-aprobado { background: #e0e7ff; color: #3730a3; }
.cadena-list { list-style: none; padding: 0; margin: 0; }
.cadena-list li {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  padding: .55rem .35rem; border-bottom: 1px solid #e8eef8;
}
.cadena-list li.cadena-actual { background: var(--blue-100); border-radius: .5rem; padding-left: .6rem; }
.cabecera-dl { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1.25rem; margin: 0; }
.cabecera-dl dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.cabecera-dl dd { margin: .15rem 0 0; }


.form-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: .6rem;
  align-items: end;
  margin-bottom: .5rem;
}
.form-row label { margin: 0; }
.form-row input, .form-row select { margin: 0; }
.stack-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.muted { color: var(--muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.admin-subnav {
  display: flex; gap: .5rem; flex-wrap: wrap;
  margin: -.35rem 0 1.1rem;
}
.admin-subnav a {
  display: inline-flex; align-items: center;
  padding: .45rem .9rem; border-radius: 999px;
  background: var(--blue-100); color: var(--blue-900);
  font-weight: 700; font-size: .85rem;
}
.admin-subnav a.active, .admin-subnav a:hover {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: #fff; text-decoration: none;
}
.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.inline-form select { margin: 0; width: auto; min-width: 9rem; }
.demo-hint {
  margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed #d7e2f5;
  font-size: .8rem; color: var(--muted);
}
.demo-hint code { background: var(--blue-50); padding: .1rem .35rem; border-radius: 6px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .shell,
  .shell.is-collapsed { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    min-height: auto;
  }
  .sidebar-stripe { display: none; }
  .sidebar-inner { padding: .85rem; }
  .sidebar-top { width: 100%; }
  .nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .35rem;
  }
  .nav-section { width: 100%; margin: .4rem 0 .1rem; }
  .nav a { border-left: none; border-bottom: 2px solid transparent; }
  .nav a.active, .nav a:hover { border-bottom-color: var(--nav-teal); border-left-color: transparent; }
  .shell.is-collapsed .brand-text,
  .shell.is-collapsed .nav-label,
  .shell.is-collapsed .nav-section { display: initial; }
  .shell.is-collapsed .nav a::after { content: none; }
  .sidebar-foot { display: none; }
  .grid, .stack-forms, .form-row { grid-template-columns: 1fr; }
}

/* Correo / imap-mail */
.correo-status__row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}
.correo-status__actions { flex-shrink: 0; }
.correo-accounts {
  list-style: none;
  padding: 0;
  margin: .85rem 0 0;
}
.correo-accounts li { margin: .25rem 0; }
.correo-account-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.correo-account-list__item {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--blue-50);
  border-radius: 12px;
}
.correo-attach {
  margin-top: .75rem;
  padding: .75rem;
  background: var(--blue-50);
  border-radius: 12px;
}
.correo-link-form label { margin-top: .65rem; }

/* Socios — Documentos | Formularios */
.socios-tabs {
  display: flex;
  gap: .35rem;
  margin: 0 0 1.1rem;
  padding: .3rem;
  background: rgba(47, 50, 96, 0.06);
  border-radius: 14px;
  width: fit-content;
  max-width: 100%;
  font-family: var(--font-nav);
}
.socios-tabs a {
  display: inline-block;
  padding: .55rem 1.1rem;
  border-radius: 10px;
  color: var(--nav-navy);
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
}
.socios-tabs a:hover { background: rgba(47, 158, 154, 0.12); text-decoration: none; }
.socios-tabs a.is-active {
  background: var(--nav-navy);
  color: #fff;
}

/* Administración → Recursos (agrupaciones / entidades) */
.recurso-agrupacion { margin-bottom: 1.1rem; }
.recurso-agrupacion.is-marked {
  border-color: rgba(46, 155, 151, 0.45);
  box-shadow: 0 0 0 1px rgba(46, 155, 151, 0.18);
}
.recurso-agrupacion-head {
  margin-bottom: .85rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid rgba(47, 50, 96, 0.08);
}
.recurso-check-form { margin: 0; }
.recurso-check {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  cursor: pointer;
  font-family: var(--font-nav);
}
.recurso-check input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .2rem;
  accent-color: #2E9B97;
  flex-shrink: 0;
}
.recurso-check--entity {
  padding: .35rem .55rem;
  border-radius: 8px;
  background: rgba(47, 50, 96, 0.04);
}
.recurso-check--entity:hover { background: rgba(47, 158, 154, 0.12); }
.recurso-servicio { margin: .85rem 0 .35rem; }
.recurso-servicio h4 {
  margin: 0 0 .45rem;
  font-family: var(--font-nav);
  font-size: .95rem;
  color: var(--nav-navy);
}
.recurso-entidades {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .5rem;
}
.recurso-contrato-card.is-focus {
  border-color: rgba(46, 155, 151, 0.55);
  box-shadow: 0 0 0 1px rgba(46, 155, 151, 0.2);
}
@media (max-width: 800px) {
  .recurso-contrato-card .stack-forms {
    grid-template-columns: 1fr !important;
  }
}

.share-creds code {
  display: inline-block;
  margin: .15rem 0;
  padding: .15rem .4rem;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 6px;
  word-break: break-all;
}

/* Formularios — secciones PDF + highlight de duplicados */
.form-seccion-title {
  margin: 1.35rem 0 .65rem;
  padding: .55rem .75rem;
  font-family: var(--font-nav);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--nav-navy);
  background: rgba(47, 50, 96, 0.06);
  border-left: 4px solid #2E9B97;
  border-radius: 0 10px 10px 0;
}
.form-seccion-row td {
  background: rgba(47, 50, 96, 0.06);
  border-bottom: 1px solid #d7e2f5;
  padding-top: .85rem;
  padding-bottom: .85rem;
  font-family: var(--font-nav);
}
.form-campo { margin-bottom: .15rem; }
.form-campo--dup,
tr.form-campo--dup td {
  background: #fff3b0;
}
.form-campo--dup {
  padding: .55rem .65rem .15rem;
  border-radius: 10px;
  margin-bottom: .55rem;
}
.form-campo--dup label { margin-top: 0; }
.form-campo--dup input {
  background: #fffceb;
  border-color: #e6c84a;
}
.tag-dup {
  background: #fde68a;
  color: #78350f;
  margin-left: .35rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-dup-legend {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
}
.form-dup-swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 4px;
  background: #fff3b0;
  border: 1px solid #e6c84a;
  flex-shrink: 0;
}
