/* ============================================================
   Asociación Primavera Negra — OCDH
   Sistema de estilos institucional
   ============================================================ */

:root {
  --c-primary: #7a1a1a;       /* burdeos institucional */
  --c-primary-dark: #5a0f0f;
  --c-accent: #c4a437;        /* dorado para destacar */
  --c-text: #1c1c1c;
  --c-muted: #5b5b5b;
  --c-bg: #fafaf7;
  --c-bg-soft: #f1ecdf;
  --c-border: #e0d9c8;
  --c-ok: #1f6e3f;
  --c-error: #a01c1c;
  --c-warn: #b8741a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 6px;
  --max-width: 1180px;
  --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.25; color: var(--c-primary-dark); }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 1rem; font-weight: 900; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 2rem 0 1rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
p { margin: 0 0 1rem; }
a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--c-primary-dark); }
ul, ol { padding-left: 1.4rem; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 780px; }
.center { text-align: center; }
.muted { color: var(--c-muted); }
.pre { white-space: pre-wrap; word-wrap: break-word; }
.req { color: var(--c-primary); font-weight: 700; }
.overline {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-primary);
  margin: 0 0 0.5rem;
}
.lead { font-size: 1.1rem; color: var(--c-muted); }

/* Skip link */
.skip-link {
  position: absolute; left: -10000px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  position: fixed; top: 1rem; left: 1rem;
  width: auto; height: auto; padding: 0.5rem 1rem;
  background: var(--c-primary); color: white; z-index: 999;
}

/* ============ HEADER ============ */
.site-header {
  background: white;
  border-bottom: 3px solid var(--c-primary);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.75rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--c-text); }
.brand-logo { display: block; }
.brand-name { display: block; font-weight: 700; font-family: var(--font-serif); font-size: 1.05rem; color: var(--c-primary-dark); }
.brand-tag { display: block; font-size: 0.75rem; color: var(--c-muted); }

.main-nav ul {
  list-style: none; display: flex; gap: 0.25rem; margin: 0; padding: 0;
  align-items: center; flex-wrap: wrap;
}
.main-nav a {
  text-decoration: none; color: var(--c-text);
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  font-size: 0.94rem; font-weight: 500;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  background: var(--c-bg-soft); color: var(--c-primary-dark);
}
.nav-toggle, .nav-toggle-label { display: none; }

@media (max-width: 880px) {
  .nav-toggle-label {
    display: inline-block; width: 36px; height: 28px; cursor: pointer;
    position: relative;
  }
  .nav-toggle-label span,
  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    display: block; position: absolute; left: 0; right: 0; height: 3px;
    background: var(--c-primary-dark); border-radius: 2px;
    content: ''; transition: transform 0.2s;
  }
  .nav-toggle-label span { top: 12px; }
  .nav-toggle-label span::before { top: -10px; }
  .nav-toggle-label span::after { top: 10px; }
  .main-nav ul {
    display: none; flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; right: 0; left: 0;
    background: white; border-top: 1px solid var(--c-border);
    padding: 0.5rem 1rem 1rem;
  }
  .main-nav { position: relative; }
  .nav-toggle:checked ~ ul { display: flex; }
  .main-nav a { display: block; padding: 0.75rem; }
}

/* ============ HERO ============ */
.hero {
  background: linear-gradient(135deg, var(--c-primary-dark) 0%, var(--c-primary) 100%);
  color: white;
  padding: 4rem 0 4.5rem;
}
.hero-inner { max-width: 920px; }
.hero h1 { color: white; font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 1rem; }
.hero-overline { color: var(--c-accent); margin: 0 0 0.75rem; }
.hero-lead { font-size: 1.15rem; opacity: 0.95; max-width: 720px; margin-bottom: 2rem; }
.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-cta .btn-ghost { color: white; border-color: white; }
.hero-cta .btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* ============ STATS ============ */
.stats { background: white; border-bottom: 1px solid var(--c-border); padding: 2rem 0; }
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem; text-align: center;
}
.stat { padding: 1rem; }
.stat-num {
  display: block; font-family: var(--font-serif); font-size: 2.6rem; font-weight: 900;
  color: var(--c-primary-dark); line-height: 1;
}
.stat-label { display: block; color: var(--c-muted); margin-top: 0.5rem; font-size: 0.95rem; }

/* ============ SECCIONES ============ */
.section { padding: 3.5rem 0; }
.section.bg-soft { background: var(--c-bg-soft); }
.section-title { text-align: center; margin: 0 0 0.5rem; }
.section-lead { text-align: center; color: var(--c-muted); margin-bottom: 2rem; }

.two-col {
  display: grid; grid-template-columns: 2fr 1fr; gap: 2.5rem;
  align-items: start;
}
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } }

.checklist { list-style: none; padding: 0; }
.checklist li {
  padding-left: 1.6rem; position: relative; margin-bottom: 0.5rem;
}
.checklist li::before {
  content: '✓'; position: absolute; left: 0; top: 0; color: var(--c-primary);
  font-weight: 700;
}

.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem; margin: 2rem 0;
}
.info-card {
  background: white; border-left: 4px solid var(--c-primary);
  padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.info-card h3 { margin-top: 0; font-size: 1.05rem; }

.card {
  background: white; border-radius: var(--radius); padding: 1.75rem;
  box-shadow: var(--shadow-md); border-top: 4px solid var(--c-accent);
}
.card h3 { margin-top: 0; }

.steps {
  list-style: none; padding: 0; counter-reset: step;
}
.steps > li {
  padding-left: 3.2rem; position: relative; margin-bottom: 1.5rem;
  counter-increment: step;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: var(--c-primary); color: white; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
}
.steps h3 { margin: 0 0 0.4rem; }

/* ============ FORMULARIOS ============ */
.form { margin: 1.5rem 0; }
.form .field { margin-bottom: 1rem; }
.form label {
  display: block; margin-bottom: 0.35rem; font-weight: 500; font-size: 0.94rem;
}
.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="date"],
.form input[type="password"],
.form input[type="search"],
.form select,
.form textarea {
  width: 100%; padding: 0.65rem 0.85rem;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  font: inherit; background: white; color: var(--c-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(122,26,26,0.12);
}
.form textarea { resize: vertical; font-family: var(--font-sans); }
.form .hint { display: block; color: var(--c-muted); font-size: 0.85rem; margin-top: 0.3rem; }
.form .check label { display: flex; align-items: flex-start; gap: 0.65rem; font-weight: 400; cursor: pointer; }
.form .check input { margin-top: 0.3rem; }
.form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form .grid-2 .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form .grid-2 { grid-template-columns: 1fr; } }

.form-section {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.5rem; background: white;
}
.form-section legend {
  font-family: var(--font-serif); font-weight: 700; color: var(--c-primary-dark);
  padding: 0 0.5rem; font-size: 1.1rem;
}
.form-actions {
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
  margin-top: 2rem;
}

.cat-block {
  border: 1px dashed var(--c-border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1.25rem; background: var(--c-bg);
}
.cat-head h3 { margin: 0 0 0.3rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cat-head p { color: var(--c-muted); margin: 0 0 1rem; font-size: 0.94rem; }

.testigo-block {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1rem; background: white; margin-bottom: 1rem;
}

/* ============ BOTONES ============ */
.btn {
  display: inline-block; padding: 0.65rem 1.25rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; font: inherit;
  font-weight: 600; text-decoration: none; transition: background 0.15s, transform 0.05s;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); color: white; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-dark); color: white; }
.btn-ghost { background: transparent; color: var(--c-primary); border-color: var(--c-primary); }
.btn-ghost:hover { background: var(--c-bg-soft); }
.btn-link { background: transparent; border: none; color: var(--c-primary); padding: 0.65rem 0.5rem; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }

/* ============ ALERTAS ============ */
.alert {
  padding: 1rem 1.25rem; border-radius: var(--radius);
  margin: 1rem 0; border-left: 4px solid;
}
.alert.big { padding: 2rem; }
.alert.big h1 { margin-top: 0; }
.alert-ok { background: #e8f3ec; border-color: var(--c-ok); color: #14502b; }
.alert-error { background: #fbe9e9; border-color: var(--c-error); color: #6e1414; }
.alert ul { margin: 0.5rem 0 0 0; padding-left: 1.5rem; }

.notice {
  background: var(--c-bg-soft); border-left: 4px solid var(--c-accent);
  padding: 1.25rem 1.5rem; border-radius: var(--radius); margin: 2rem 0;
}
.notice h3 { margin-top: 0; }
.notice-warn {
  background: #fdf3ea; border-left-color: var(--c-warn);
  border: 1px solid #f0d8b8; border-left-width: 6px;
}
.notice-warn h3 { color: #7c4a14; }
.notice-warn ul, .notice-warn ol { margin: 0.4rem 0 0.8rem; padding-left: 1.4rem; }

/* ============ DOCUMENTACIÓN GUÍA ============ */
.doc-cat {
  background: white; border-radius: var(--radius); padding: 1.5rem 1.75rem;
  margin: 1.25rem 0; box-shadow: var(--shadow-sm);
}
.doc-cat h2 { margin-top: 0; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.badge {
  display: inline-block; padding: 0.2rem 0.55rem; font-size: 0.75rem;
  border-radius: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-required { background: var(--c-primary); color: white; }
.badge.estado-pendiente { background: #e0e0e0; color: #333; }
.badge.estado-en_revision { background: #dfeaf5; color: #1c4a78; }
.badge.estado-requiere_info { background: #fcecd3; color: #7c4a14; }
.badge.estado-aprobada { background: #d4edd9; color: #14502b; }
.badge.estado-rechazada { background: #fbd5d5; color: #6e1414; }

.links { list-style: none; padding: 0; }
.links li { padding: 0.5rem 0; border-bottom: 1px dashed var(--c-border); }

/* ============ CONSULTA / RESULTADO ============ */
.resultado-box {
  background: white; border-radius: var(--radius); padding: 2rem;
  box-shadow: var(--shadow-md); border-top: 4px solid var(--c-primary);
  margin: 2rem 0;
}
.resultado-box h2 { margin-top: 0; }
.estado-badge {
  display: inline-block; padding: 0.4rem 0.85rem; border-radius: var(--radius);
  background: var(--c-bg-soft); font-weight: 700; letter-spacing: 0.05em;
  font-size: 0.9rem;
}
.estado-aprobada .estado-badge { background: #d4edd9; color: #14502b; }
.estado-rechazada .estado-badge { background: #fbd5d5; color: #6e1414; }
.estado-requiere_info .estado-badge { background: #fcecd3; color: #7c4a14; }
.estado-en_revision .estado-badge { background: #dfeaf5; color: #1c4a78; }

.codigo-box {
  background: white; border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1.5rem 1.75rem; margin: 1.5rem 0;
}
.codigo-row { display: flex; gap: 0.75rem; align-items: center; margin: 0.6rem 0; flex-wrap: wrap; }
.codigo-label { color: var(--c-muted); font-weight: 500; }
.codigo-val {
  font-family: 'Courier New', monospace; background: var(--c-bg-soft);
  padding: 0.4rem 0.7rem; border-radius: 4px; font-size: 1.05rem; font-weight: 700;
  user-select: all;
}

/* ============ FOOTER ============ */
.site-footer {
  background: #1a1a1a; color: #cccccc; margin-top: 4rem;
  padding: 3rem 0 1.5rem;
}
.site-footer h3 { color: white; font-size: 1.05rem; margin: 0 0 0.75rem; font-family: var(--font-sans); font-weight: 600; }
.site-footer p { font-size: 0.92rem; }
.site-footer a { color: #e0c97a; }
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.footer-grid ul { list-style: none; padding: 0; }
.footer-grid ul li { padding: 0.25rem 0; }
.footer-bottom {
  border-top: 1px solid #333; margin-top: 2rem; padding-top: 1rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.85rem;
}

/* ============ ADMIN ============ */
.admin h1 { margin-bottom: 0.5rem; }
.admin-subnav {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  background: white; border-radius: var(--radius); padding: 0.6rem 1rem;
  margin: 1rem 0 1.5rem; border: 1px solid var(--c-border);
}
.admin-subnav a {
  text-decoration: none; padding: 0.4rem 0.85rem; border-radius: var(--radius);
  color: var(--c-text); font-weight: 500;
}
.admin-subnav a[aria-current="page"] { background: var(--c-primary); color: white; }
.logout-form { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.admin-user { color: var(--c-muted); font-size: 0.9rem; }

.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem; margin: 1rem 0 1.5rem;
}
.dash-card {
  display: block; background: white; padding: 1rem 1.25rem;
  border-radius: var(--radius); text-decoration: none; color: var(--c-text);
  border: 1px solid var(--c-border); transition: border-color 0.15s, transform 0.05s;
}
.dash-card:hover { border-color: var(--c-primary); }
.dash-card.active { border-color: var(--c-primary); background: var(--c-bg-soft); }
.dash-num { display: block; font-family: var(--font-serif); font-size: 2rem; font-weight: 900; color: var(--c-primary-dark); }
.dash-label { display: block; color: var(--c-muted); font-size: 0.88rem; }

.filtros { display: flex; gap: 0.5rem; margin-bottom: 1rem; max-width: 500px; }
.filtros input { flex: 1; }

.tabla {
  width: 100%; border-collapse: collapse; background: white;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.tabla th, .tabla td {
  padding: 0.7rem 0.85rem; text-align: left;
  border-bottom: 1px solid var(--c-border); vertical-align: top;
}
.tabla th { background: var(--c-bg-soft); font-weight: 700; font-size: 0.88rem; }
.tabla tr.leido { opacity: 0.6; }
.tabla code { background: var(--c-bg-soft); padding: 0.15rem 0.35rem; border-radius: 3px; font-size: 0.85rem; }

.caso-grid {
  display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem;
}
@media (max-width: 980px) { .caso-grid { grid-template-columns: 1fr; } }
.caso-block {
  background: white; padding: 1.5rem; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 1rem;
}
.caso-block h2 { margin-top: 0; font-size: 1.2rem; }
.datos { display: grid; grid-template-columns: 200px 1fr; gap: 0.4rem 1rem; margin: 0; }
.datos dt { color: var(--c-muted); font-weight: 500; }
.datos dd { margin: 0; }
@media (max-width: 640px) { .datos { grid-template-columns: 1fr; } .datos dt { font-weight: 700; margin-top: 0.5rem; } }
.docs { list-style: none; padding: 0; }
.docs li { padding: 0.4rem 0; border-bottom: 1px dashed var(--c-border); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.testigo { padding: 1rem; border: 1px solid var(--c-border); border-radius: var(--radius); margin-bottom: 0.75rem; }
.testigo h3 { margin: 0 0 0.3rem; }
.historial { list-style: none; padding: 0; }
.historial li { padding: 0.6rem 0; border-bottom: 1px dashed var(--c-border); }
.historial li:last-child { border-bottom: none; }

/* ============ RADIO GROUPS Y RÚBRICA ============ */
.radio-group {
  display: flex; flex-direction: column; gap: 0.4rem;
}
.radio-group label {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.5rem 0.75rem; border: 1px solid var(--c-border);
  border-radius: var(--radius); cursor: pointer; font-weight: 400;
  background: white; transition: border-color 0.15s, background 0.15s;
}
.radio-group label:hover { border-color: var(--c-primary); background: var(--c-bg-soft); }
.radio-group input[type="radio"] { margin-top: 0.2rem; }

.rubrica-item {
  padding: 1rem 0; border-bottom: 1px dashed var(--c-border);
}
.rubrica-item:last-child { border-bottom: none; }
.rubrica-item h3 {
  margin: 0 0 0.6rem; font-family: var(--font-sans); font-size: 1rem;
  font-weight: 600; color: var(--c-text);
}
.rubrica-opts {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.rubrica-opt {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.7rem; border: 1px solid var(--c-border);
  border-radius: var(--radius); cursor: pointer; font-size: 0.88rem;
  background: white;
}
.rubrica-opt input[type="radio"] { margin: 0; }
.rubrica-opt:has(input:checked) {
  background: var(--c-primary); color: white; border-color: var(--c-primary);
}
.rubrica-item textarea {
  width: 100%; padding: 0.5rem 0.7rem;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  font: inherit; font-size: 0.92rem; resize: vertical;
}

/* ============ TIMELINE DE SEGUIMIENTO ============ */
.timeline {
  display: flex; align-items: stretch; justify-content: space-between;
  gap: 0.25rem; margin: 2rem 0; padding: 1rem; background: white;
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.timeline-step {
  flex: 1; min-width: 110px; text-align: center; position: relative;
  padding: 0 0.25rem;
}
.timeline-step:not(:last-child)::after {
  content: ''; position: absolute; top: 18px; left: 60%; right: -40%;
  height: 3px; background: var(--c-border); z-index: 0;
}
.timeline-step.done::after { background: var(--c-primary); }
.timeline-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--c-bg-soft); color: var(--c-muted);
  font-weight: 700; font-family: var(--font-serif);
  border: 2px solid var(--c-border); position: relative; z-index: 1;
}
.timeline-step.done .timeline-dot {
  background: var(--c-primary); color: white; border-color: var(--c-primary);
}
.timeline-step.active .timeline-dot {
  box-shadow: 0 0 0 4px rgba(122,26,26,0.18);
}
.timeline-label {
  display: block; margin-top: 0.5rem; font-size: 0.8rem; line-height: 1.2;
  color: var(--c-muted);
}
.timeline-step.done .timeline-label { color: var(--c-text); font-weight: 500; }

.seguimiento-list {
  list-style: none; padding: 0; margin: 0;
  border-left: 3px solid var(--c-primary); padding-left: 1.5rem;
}
.seguimiento-list li {
  position: relative; padding: 0.5rem 0 1rem;
}
.seguimiento-list li::before {
  content: ''; position: absolute; left: -1.8rem; top: 0.7rem;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--c-primary); border: 2px solid white;
}
.seguimiento-list h3 { margin: 0.1rem 0 0.3rem; font-family: var(--font-sans); font-size: 1rem; }
.hito-fecha { font-size: 0.8rem; color: var(--c-muted); }

.tipif-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.4rem;
}
.inline-form {
  display: inline-flex; gap: 0.3rem; align-items: center; margin: 0;
}
.inline-form select { padding: 0.3rem 0.5rem; font-size: 0.88rem; }

.check-inline {
  display: flex; align-items: flex-start; gap: 0.5rem;
  padding: 0.4rem 0.6rem; border: 1px solid var(--c-border);
  border-radius: var(--radius); background: white; cursor: pointer;
  font-size: 0.92rem; font-weight: 400;
}
.check-inline input { margin-top: 0.15rem; }
