/* ===================================================================
   Guía del Backlog · Hoja de estilos
   Identidad de marca: TEMA — Seguridad & Medio Ambiente
   Paleta cálida (rojo / vino / naranja / crema). Auto-contenida.
   =================================================================== */

:root {
  /* --- Paleta TEMA (los nombres --brand-* mapean tonos oscuro→claro) --- */
  --brand-900: #551019;   /* maroon profundo (fondos oscuros)      */
  --brand-800: #7E1621;   /* rojo vino / maroon                    */
  --brand-700: #9a1b24;   /* rojo oscuro                           */
  --brand-600: #C1272D;   /* ROJO PRIMARIO (acciones, enlaces)     */
  --brand-500: #E8531C;   /* naranja (acento secundario)           */
  --brand-100: #f3d3c9;   /* tinte cálido claro (bordes/pills)     */
  --brand-50:  #f9ede8;   /* tinte cálido muy claro (fondos suaves)*/
  --brand-tint:#f6ece7;   /* tinte de tarjeta cálido               */
  --brand-hot: #f9e7e1;   /* tinte rojo claro (recuadros destacados)*/

  --ink:      #44454A;    /* texto principal (gris cálido)         */
  --ink-soft: #55565c;    /* texto de cuerpo                       */
  --muted:    #6A6A6E;    /* texto secundario / muted              */
  --line:     #eae0d8;
  --bg:       #FBF7F1;    /* crema (fondo general)                 */
  --white:    #ffffff;
  --cream:    #FBF7F1;    /* crema para texto sobre oscuro         */

  --green:   #16a34a;     /* semántico (éxito)  — se mantiene      */
  --amber:   #d97706;     /* semántico (aviso)  — se mantiene      */
  --review:  #E0951E;     /* naranja/ámbar de estado "En revisión" */
  --violet:  #E8531C;     /* acento cálido (antes violeta)         */

  --radius:  14px;
  --radius-sm: 9px;
  --shadow:  0 1px 2px rgba(85,16,25,.06), 0 8px 24px rgba(85,16,25,.07);
  --shadow-lg: 0 12px 40px rgba(85,16,25,.16);
  --sidebar-w: 300px;
  --maxw: 860px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ============================ SIDEBAR ============================ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--brand-900), var(--brand-800));
  color: #f2e3d8;
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand-badge {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--brand-600);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; letter-spacing: .5px;
  box-shadow: 0 6px 16px rgba(193,39,45,.45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 1.05rem; }
.brand-text span { font-size: .78rem; color: #e9c9c0; }

.nav-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #d9afa6;
  margin: 0 0 10px 6px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #f2e3d8;
  text-decoration: none;
  font-size: .92rem;
  transition: background .18s, color .18s, transform .18s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(232,83,28,.32), rgba(232,83,28,.05));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-500);
}
.nav-num {
  width: 24px; height: 24px;
  flex-shrink: 0;
  border-radius: 7px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700;
}
.nav-link.active .nav-num { background: var(--brand-500); color: #fff; }

.sidebar-foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .78rem;
}
.sidebar-foot p { margin: 2px 0; }
.sidebar-foot .muted { color: #c89b92; }

/* Firma de marca TEMA */
.brand-sign {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  line-height: 1.3;
}
.brand-sign .sign-name {
  font-weight: 800;
  letter-spacing: .04em;
  color: #f4cdbf;
  font-size: .95rem;
  text-transform: lowercase;
}
.brand-sign .sign-tag {
  display: block;
  font-size: .72rem;
  color: #d9afa6;
  letter-spacing: .02em;
}

/* ============================ CONTENT ============================ */
.content {
  margin-left: var(--sidebar-w);
  padding: 0 clamp(20px, 5vw, 72px) 80px;
}

.progress-bar {
  position: sticky;
  top: 0;
  height: 4px;
  background: transparent;
  z-index: 30;
  margin: 0 clamp(-20px,-5vw,-72px) 0;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
  transition: width .1s linear;
}

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}
.section:last-of-type { border-bottom: none; }

.section-kicker {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand-600);
  background: var(--brand-50);
  padding: 4px 12px;
  border-radius: 999px;
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  line-height: 1.15;
  margin: 0 0 14px;
  color: var(--ink);
  letter-spacing: -.02em;
}
h2 {
  font-size: 1.35rem;
  margin: 40px 0 14px;
  color: var(--brand-800);
  letter-spacing: -.01em;
}
h3 { font-size: 1.06rem; margin: 0 0 6px; color: var(--ink); }
p { margin: 0 0 14px; color: var(--ink-soft); }
strong { color: var(--ink); }
em { color: inherit; }
.muted { color: var(--muted); }

/* ============================ HERO ============================ */
.hero-section { padding-top: 48px; }
.hero {
  background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
  color: #fff;
  border-radius: var(--radius);
  padding: 44px clamp(24px,4vw,48px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px; top: -60px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
  border-radius: 50%;
}
.eyebrow {
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #f4cdbf;
  margin: 0 0 12px;
  font-weight: 600;
}
.hero h1 { color: #fff; max-width: 20ch; }
.userstory {
  font-size: 1.05rem;
  color: #f8e7de;
  border-left: 3px solid var(--brand-100);
  padding-left: 16px;
  margin: 18px 0 26px;
  max-width: 62ch;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-primary {
  background: #fff;
  color: var(--brand-700);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.24); }
.btn-ghost {
  background: rgba(255,255,255,.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
}
.btn-ghost:hover { background: rgba(255,255,255,.22); }
.closing .btn-primary { background: var(--brand-600); color: #fff; }

/* ============================ CARDS ============================ */
.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 32px 0;
}
.feature-card, .role-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.feature-card:hover, .role-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.feature-ico, .role-ico { font-size: 1.8rem; margin-bottom: 10px; }
.feature-card p, .role-card p { margin: 0; font-size: .92rem; }
.role-card { text-align: center; }
.role-ico { font-size: 2.2rem; }

.note-line {
  background: var(--brand-50);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  border-left: 3px solid var(--brand-500);
}

/* ============================ LISTS ============================ */
.check-list { list-style: none; padding: 0; margin: 14px 0; }
.check-list li {
  position: relative;
  padding: 6px 0 6px 30px;
  color: var(--ink-soft);
}
.check-list li::before {
  content: "✓";
  position: absolute; left: 0; top: 6px;
  width: 20px; height: 20px;
  background: var(--brand-50);
  color: var(--brand-600);
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: .8rem; font-weight: 700;
}

/* ============================ TIP ============================ */
/* Base (informativo 💡) → rojo/maroon de marca */
.tip {
  display: flex;
  gap: 14px;
  background: linear-gradient(180deg, #fdf1ec, var(--brand-hot));
  border: 1px solid #eccfc8;
  border-left: 4px solid var(--brand-600);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 24px 0;
}
.tip-ico { font-size: 1.3rem; line-height: 1.4; }
.tip strong { display: block; margin-bottom: 2px; color: var(--ink); }
.tip p { margin: 0; font-size: .92rem; }
/* Aviso → ámbar (semántico) */
.tip-warn { background: linear-gradient(180deg,#fffaf0,#fff5e2); border-color:#f2e4c4; border-left-color: var(--amber); }
/* Éxito → verde (semántico) */
.tip-ok { background: linear-gradient(180deg,#f2fdf6,#e9fbf0); border-color:#bfe6cd; border-left-color: var(--green); }

/* ============================ FIGURE ============================ */
.figure { margin: 28px 0; }
.figure-placeholder {
  position: relative;
  border: 2px dashed var(--brand-100);
  background:
    repeating-linear-gradient(45deg, #fbf3ee, #fbf3ee 12px, #f6e9e2 12px, #f6e9e2 24px);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  min-height: 120px;
  display: grid;
  place-items: center;
}
.figure-placeholder p { margin: 0; color: var(--ink-soft); max-width: 60ch; font-size: .92rem; }
.figure-tag {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--brand-600);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.figure-caption {
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
  margin: 10px 0 0;
  font-style: italic;
}

/* ============================ STEPS ============================ */
.steps { display: flex; flex-direction: column; gap: 4px; margin: 22px 0; }
.step {
  display: flex;
  gap: 18px;
  padding: 16px 4px;
  position: relative;
}
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 18px; top: 52px; bottom: -4px;
  width: 2px;
  background: var(--line);
}
.step-num {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(193,39,45,.38);
  z-index: 1;
}
.step-body h3 { margin-bottom: 4px; }
.step-body p { margin: 0; font-size: .93rem; }

/* ============================ HIERARCHY ============================ */
.hierarchy { margin: 20px 0; display: flex; flex-direction: column; gap: 8px; }
.hier-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.hier-row p { margin: 0; font-size: .9rem; }
.hier-chip {
  flex-shrink: 0;
  font-weight: 700;
  font-size: .9rem;
  padding: 6px 12px;
  border-radius: 8px;
  min-width: 148px;
  color: #fff;
}
.lvl-1 { margin-left: 0; }   .lvl-1 .hier-chip { background: var(--brand-900); }
.lvl-2 { margin-left: 22px; } .lvl-2 .hier-chip { background: var(--brand-800); }
.lvl-3 { margin-left: 44px; } .lvl-3 .hier-chip { background: var(--brand-600); }
.lvl-4 { margin-left: 66px; } .lvl-4 .hier-chip { background: var(--green); }
.lvl-5 { margin-left: 88px; } .lvl-5 .hier-chip { background: var(--brand-500); }

/* ============================ STATES ============================ */
.states {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 26px;
}
.state-pill {
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .88rem;
}
.s-todo   { background: #ece5de; color: #5a5b60; }
.s-doing  { background: var(--brand-100); color: var(--brand-700); }
.s-review { background: #fbead0; color: #a9660c; }
.s-done   { background: #d9f5e3; color: #15803d; }
.state-arrow { color: var(--muted); font-weight: 700; }

/* ============================ TABLE ============================ */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: .92rem;
}
.table th {
  background: var(--brand-800);
  color: #fff;
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
}
.table td { padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink-soft); vertical-align: top; }
.table tbody tr:nth-child(even) { background: #fbf6f1; }

/* ============================ FORMULA ============================ */
.formula {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.formula-part {
  flex: 1;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-500);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.formula-part span {
  display: inline-block;
  font-weight: 800;
  color: var(--brand-600);
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.formula-part em { color: var(--ink-soft); font-style: normal; }

/* ============================ EXAMPLES ============================ */
.examples { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin: 20px 0; }
.example-card {
  background: linear-gradient(180deg,#fdf8f4,#f9ece6);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.example-card p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.example-badge {
  display: inline-block;
  background: var(--brand-600);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

/* ============================ CODE-NOTE ============================ */
.code-note {
  background: #3a0e13;
  color: #f0ded7;
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 18px 0;
  font-size: .92rem;
}
.code-note p { color: #d9a99f; margin: 0 0 8px; font-weight: 600; }
.code-note ul { margin: 0; padding-left: 20px; }
.code-note li { margin: 4px 0; }

/* ============================ SPRINT FLOW ============================ */
.sprint-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 22px 0;
  flex-wrap: wrap;
}
.sprint-step {
  flex: 1;
  min-width: 150px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  font-size: .88rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.sprint-step span {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--brand-600);
  color: #fff; font-weight: 700;
}
.sprint-conn {
  align-self: center;
  width: 24px; height: 2px;
  background: var(--brand-500);
  position: relative;
  flex-shrink: 0;
}
.sprint-conn::after {
  content: "›";
  position: absolute; right: -4px; top: 50%;
  transform: translateY(-50%);
  color: var(--brand-500); font-weight: 800; font-size: 1.2rem;
}

/* ============================ COLLAB ============================ */
.collab-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 18px;
  margin: 24px 0;
}
.collab-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
}
.collab-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.collab-ico {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid; place-items: center;
  font-size: 1.4rem; font-weight: 800;
  margin-bottom: 12px;
}
.collab-card p { margin: 0; font-size: .9rem; }

/* ============================ GLOSSARY ============================ */
.glossary {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 4px 22px;
  margin: 20px 0;
}
.gl-item {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.gl-item dt { font-weight: 700; color: var(--brand-800); margin-bottom: 2px; }
.gl-item dd { margin: 0; font-size: .9rem; color: var(--ink-soft); }

/* ============================ CHECKLIST ============================ */
.checklist-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 8px;
  box-shadow: var(--shadow);
  margin: 22px 0;
}
.cl-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.cl-item:hover { background: var(--brand-50); }
.cl-item + .cl-item { border-top: 1px solid var(--line); }
.cl-item input {
  width: 20px; height: 20px;
  margin-top: 2px;
  accent-color: var(--brand-600);
  flex-shrink: 0;
  cursor: pointer;
}
.cl-item span { color: var(--ink-soft); }
.cl-item input:checked + span { color: var(--muted); text-decoration: line-through; }

/* ============================ CLOSING / FOOTER ============================ */
.closing {
  background: linear-gradient(135deg, var(--brand-50), #f6e4dd);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius);
  padding: 32px;
  margin-top: 30px;
  text-align: center;
}
.closing h2 { margin-top: 0; }
.closing p { max-width: 60ch; margin: 0 auto 20px; }

.footer {
  max-width: var(--maxw);
  margin: 40px auto 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
}
.footer p { margin: 4px 0; color: var(--muted); }
.footer .footer-sign { font-weight: 700; color: var(--brand-600); letter-spacing: .03em; }
.footer .footer-sign .sep { color: var(--muted); font-weight: 400; }

/* ============================ MENU TOGGLE ============================ */
.menu-toggle {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 60;
  width: 46px; height: 46px;
  border: none;
  border-radius: 12px;
  background: var(--brand-800);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-lg);
}
.menu-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(85,16,25,.5);
  z-index: 45;
}
.overlay.show { display: block; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1024px) {
  .cards-3, .examples, .collab-grid { grid-template-columns: repeat(2,1fr); }
  .glossary { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .menu-toggle { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding-top: 76px; }
  .cards-3, .examples, .collab-grid { grid-template-columns: 1fr; }
  .hier-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hier-chip { min-width: 0; }
  .lvl-2,.lvl-3,.lvl-4,.lvl-5 { margin-left: 0; }
  .sprint-conn { display: none; }
  .sprint-step { min-width: 100%; }
  .formula-part { min-width: 100%; }
}

@media (max-width: 480px) {
  .hero { padding: 30px 22px; }
  .section { padding: 40px 0; }
}
