:root {
  --bg: #0B0B0F;
  --bg-soft: #101016;
  --card: #15151C;
  --card-hover: #1A1A23;
  --border: #26262F;
  --border-glow: rgba(246, 130, 31, 0.45);
  --text: #EDEDF2;
  --text-dim: #9B9BA8;
  --text-faint: #6B6B78;
  --orange: #F6821F;
  --cyan: #00C2FF;
  --amber: #FBAD41;
  --blue: #0051C3;
  --green: #35D07F;
  --red: #F0506E;
  --sidebar-w: 288px;
  --radius: 10px;
  --font-display: "Chakra Petch", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

[data-theme="light"] {
  --bg: #F4F4F7;
  --bg-soft: #EDEDF2;
  --card: #FFFFFF;
  --card-hover: #F7F7FB;
  --border: #DDDDE6;
  --border-glow: rgba(246, 130, 31, 0.55);
  --text: #15151C;
  --text-dim: #55556A;
  --text-faint: #8A8A9C;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.brand { padding: 4px 6px 10px; border-bottom: 1px solid var(--border); }
.brand-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--orange);
  text-shadow: 0 0 18px rgba(246, 130, 31, 0.35);
}
.brand-sub {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 2px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.searchbox:hover, .searchbox:focus-within { border-color: var(--border-glow); box-shadow: 0 0 12px rgba(246,130,31,0.12); }
.searchbox input {
  background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 13px;
  width: 100%;
}
.searchbox input::placeholder { color: var(--text-faint); }
.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

.side-actions { display: flex; gap: 8px; }
.side-btn {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11.5px;
  font-family: var(--font-body);
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}
.side-btn:hover { color: var(--text); border-color: var(--border-glow); }

.side-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 6px 6px 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--card); }
.nav-link.active {
  color: var(--orange);
  background: rgba(246, 130, 31, 0.08);
  border-color: rgba(246, 130, 31, 0.3);
}
.nav-link .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.section { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.section-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.section-head:hover { background: var(--card-hover); }
.section-head .num {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
}
.section-head .obj-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 400;
}
.section-head .chev {
  color: var(--text-faint);
  font-size: 11px;
  transition: transform 0.2s;
}
.section.open .section-head .chev { transform: rotate(90deg); }
.section-body { display: none; background: var(--bg); border-top: 1px solid var(--border); }
.section.open .section-body { display: block; }
.section-body a {
  display: block;
  padding: 7px 12px 7px 30px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
}
.section-body a:hover { color: var(--text); background: var(--card); }

/* ---------- Topbar / content ---------- */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 32px 0;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.topbar .sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
.btn:hover { border-color: var(--border-glow); box-shadow: 0 0 14px rgba(246,130,31,0.15); }
.btn-primary {
  background: linear-gradient(135deg, #F6821F, #FBAD41);
  border: none;
  color: #0B0B0F;
}
.btn-primary:hover { box-shadow: 0 0 18px rgba(246,130,31,0.45); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.content { padding: 24px 32px 60px; max-width: 1180px; width: 100%; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover {
  transform: translateY(-2px);
  border-color: var(--accent, var(--border-glow));
  box-shadow: 0 4px 24px -6px color-mix(in srgb, var(--accent, #F6821F) 35%, transparent);
}
.card-accent-top { border-top: 2px solid var(--accent); }

.card-kicker {
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent, var(--orange));
  margin-bottom: 8px;
}
.card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}
.card p { color: var(--text-dim); font-size: 13.5px; }
.card .icon { font-size: 22px; margin-bottom: 10px; display: block; }

/* corner frame detail */
.framed::before, .framed::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--accent, var(--orange));
  opacity: 0.7;
}
.framed::before { top: -1px; left: -1px; border-right: none; border-bottom: none; border-top-left-radius: var(--radius); }
.framed::after { bottom: -1px; right: -1px; border-left: none; border-top: none; border-bottom-right-radius: var(--radius); }

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}
.page-sub { color: var(--text-dim); margin-bottom: 24px; }
.section-title {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 34px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Product cards (portfolio) ---------- */
.product-card { overflow: hidden; }
.product-head { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.product-num {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 3px 7px;
  white-space: nowrap;
}
.product-head h3 { flex: 1; }
.weight-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 5px;
  padding: 2px 7px;
}
.product-body { display: none; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.product-card.open .product-body { display: block; }
.objective {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0;
  font-size: 13.5px; color: var(--text-dim);
}
.objective::before { content: "▸"; color: var(--accent); flex-shrink: 0; }
.pitch {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  font-style: italic;
  color: var(--text);
}
.meta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-faint); }

/* ---------- Flashcards ---------- */
.flash-stage { perspective: 1200px; max-width: 560px; margin: 0 auto; }
.flashcard {
  position: relative;
  width: 100%; height: 300px;
  transform-style: preserve-3d;
  transition: transform 0.5s;
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent, var(--orange));
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px; text-align: center;
  box-shadow: 0 6px 30px -10px rgba(0,0,0,0.5);
}
.flash-face.back { transform: rotateY(180deg); }
.flash-face .q { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.flash-face .a { font-size: 15.5px; color: var(--text-dim); }
.flash-face .hint { position: absolute; bottom: 14px; font-size: 11px; color: var(--text-faint); }
.flash-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.flash-count { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); min-width: 64px; text-align: center; }

/* ---------- Quiz ---------- */
.quiz-opt {
  display: block; width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--border-glow); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { border-color: var(--green); background: rgba(53,208,127,0.08); }
.quiz-opt.wrong { border-color: var(--red); background: rgba(240,80,110,0.08); }
.quiz-feedback {
  margin-top: 12px; padding: 12px 14px;
  border-radius: 8px; font-size: 13.5px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.quiz-feedback.ok { border-color: rgba(53,208,127,0.4); }
.quiz-feedback.bad { border-color: rgba(240,80,110,0.4); }
.quiz-q { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.progress-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 10px 0 22px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--amber)); border-radius: 3px; transition: width 0.3s; }

/* ---------- Labs ---------- */
.lab-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--card);
}
.lab-step input[type="checkbox"] { margin-top: 4px; accent-color: var(--orange); width: 16px; height: 16px; cursor: pointer; }
.lab-step .step-title { font-weight: 600; font-size: 14px; }
.lab-step .step-desc { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.lab-step .step-note {
  font-size: 12px; color: var(--text-faint);
  margin-top: 6px; padding: 7px 10px;
  background: var(--bg-soft); border-radius: 6px;
  border-left: 2px solid var(--amber);
}
.lab-step.done .step-title { text-decoration: line-through; color: var(--text-faint); }

/* ---------- Security tests ---------- */
.form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.field { flex: 1; min-width: 220px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; font-family: var(--font-display); }
.field select {
  width: 100%;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--font-body); font-size: 14px;
  padding: 10px 12px; outline: none;
}
.field select:focus { border-color: var(--border-glow); }
.allowlist-note { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.test-desc { font-size: 13px; color: var(--text-dim); margin-bottom: 14px; }
.curl-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  font-family: var(--font-mono); font-size: 12px;
  overflow-x: auto; margin-bottom: 16px;
}
.curl-box code { flex: 1; white-space: nowrap; color: var(--cyan); }
.verdict {
  margin-top: 16px; padding: 14px 16px;
  border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px;
}
.verdict.blocked { border-color: rgba(53,208,127,0.5); background: rgba(53,208,127,0.07); }
.verdict.passed { border-color: var(--border); background: var(--card); }
.verdict .v-title { font-family: var(--font-display); font-weight: 700; margin-bottom: 6px; }
.verdict.blocked .v-title { color: var(--green); }
.verdict.passed .v-title { color: var(--text-dim); }
.verdict pre {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-dim); white-space: pre-wrap;
  margin-top: 8px; max-height: 200px; overflow: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th { font-family: var(--font-display); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-faint); }
td .mono { font-family: var(--font-mono); font-size: 12px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 20px; padding: 2px 9px; }
.pill.ok { background: rgba(53,208,127,0.12); color: var(--green); }
.pill.pass { background: var(--card); color: var(--text-dim); border: 1px solid var(--border); }

/* ---------- Progress ---------- */
.stat-card { text-align: center; padding: 22px; }
.stat-num { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--accent, var(--orange)); }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px; }
.mastery-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.mastery-row .name { width: 170px; font-size: 13px; font-weight: 500; }
.mastery-row .progress-track { flex: 1; margin: 0; }
.mastery-row .pct { font-family: var(--font-mono); font-size: 12px; width: 44px; text-align: right; color: var(--text-dim); }

/* ---------- Blog ---------- */
.blog-card .tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent);
  border-radius: 4px; padding: 2px 7px; margin-bottom: 10px;
}
.blog-card .date { font-size: 11.5px; color: var(--text-faint); margin-top: 12px; }

/* ---------- Placeholder ---------- */
.placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 30px;
  text-align: center;
  color: var(--text-dim);
}
.placeholder .big { font-family: var(--font-display); font-size: 20px; color: var(--text); margin-bottom: 8px; }

/* ---------- Palette ---------- */
.palette-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  display: flex; justify-content: center;
  padding-top: 14vh; z-index: 100;
}
.palette {
  width: min(560px, 92vw);
  height: fit-content;
  background: var(--card);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(246,130,31,0.12);
  overflow: hidden;
}
.palette input {
  width: 100%; border: none; outline: none;
  background: transparent; color: var(--text);
  font-family: var(--font-body); font-size: 15px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.palette-results { max-height: 320px; overflow-y: auto; }
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; cursor: pointer; font-size: 13.5px;
}
.palette-item:hover, .palette-item.sel { background: var(--card-hover); }
.palette-item .type { font-size: 10px; font-family: var(--font-display); letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); margin-left: auto; }

.hidden { display: none !important; }
.mt-2 { margin-top: 16px; }
.muted { color: var(--text-dim); font-size: 13px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 50; left: 0; transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
}
/* ---------- Producto: página didáctica + diagrama ---------- */
.product-page {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(380px, 1.15fr);
  gap: 28px;
  margin-top: 14px;
  align-items: start;
}
.product-diagram { position: sticky; top: 24px; }
.learn-h {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent, var(--orange));
  margin: 20px 0 8px;
}
.analogy {
  display: flex; gap: 12px;
  margin-top: 18px; padding: 14px 16px;
  background: rgba(251, 173, 65, 0.07);
  border: 1px solid rgba(251, 173, 65, 0.25);
  border-radius: var(--radius);
}
.analogy-icon { font-size: 20px; }
.analogy strong { font-family: var(--font-display); color: var(--amber); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.analogy p { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; font-style: italic; }

.diagram { width: 100%; height: auto; display: block; border-radius: 12px; }

/* ── Diagrama estilo Cloudflare (superficie clara) ── */
.d-bg { fill: #FBFCFE; }
.d-inet { fill: none; stroke: #BFD9EA; stroke-width: 1.5; stroke-dasharray: 7 5; }
.d-inetlabel { fill: #7FA8C9; font-size: 12px; font-family: var(--font-body); font-weight: 600; }
.d-announce .d-an-t { fill: #374151; font-size: 11px; font-weight: 700; font-family: var(--font-body); }
.d-announce .d-an-s { fill: #6B7280; font-size: 9.5px; font-family: var(--font-body); }
.d-net { fill: rgba(246, 130, 31, 0.04); stroke: #F6821F; stroke-width: 1.5; stroke-dasharray: 3 3; }
.d-site { fill: rgba(59, 130, 246, 0.04); stroke: #3B82F6; stroke-width: 1.5; stroke-dasharray: 3 3; }
.d-nettitle { fill: #374151; font-size: 15px; font-weight: 600; font-family: var(--font-display); }
.d-nettitle.sm { font-size: 9.5px; letter-spacing: 1.5px; }
.d-dc-t { fill: #92400E; font-size: 10px; font-family: var(--font-display); letter-spacing: 1px; }
.d-dcbox { fill: #FFFFFF; stroke: #F6821F; stroke-width: 1.5; }
.d-srv { fill: #FFF3E6; stroke: #F0B27A; stroke-width: 1; }
.d-srv.b { fill: #DBEAFE; stroke: #93C5FD; }
.d-dc-s { fill: #6B7280; font-size: 9px; font-family: var(--font-body); }
.d-mod-g rect { fill: #FFFDF9; stroke: #F6821F; stroke-width: 1.5; }
.d-mod-g rect.warn { stroke: #D97706; fill: #FFFBEB; }
.d-modtitle { fill: #1F2937; font-size: 12.5px; font-family: var(--font-display); font-weight: 700; }
.d-modsub { fill: #9CA3AF; font-size: 9px; font-family: var(--font-body); }
.d-cust rect:first-of-type { fill: #EFF6FF; stroke: #3B82F6; stroke-width: 1.5; }
.d-cust-t { fill: #1E3A8A; font-size: 11px; font-weight: 700; font-family: var(--font-body); }
.d-cust-s { fill: #3B5B92; font-size: 10px; font-family: var(--font-body); }
.d-blocked rect { fill: #FEF2F2; stroke: #DC2626; stroke-width: 1.5; }
.d-blocked text { fill: #DC2626; font-size: 11.5px; font-weight: 600; font-family: var(--font-body); }
.d-chk circle { fill: #ECFDF5; stroke: #10B981; stroke-width: 2; }
.d-chk text { fill: #10B981; font-size: 14px; font-weight: 700; }
.d-node rect { fill: #F1F5F9; stroke: #94A3B8; stroke-width: 1.5; }
.d-node.good rect { stroke: #3B82F6; }
.d-node.bad rect { stroke: #DC2626; }
.d-icon { font-size: 22px; }
.d-nlabel { fill: #374151; font-size: 10.5px; font-weight: 600; font-family: var(--font-body); }
.d-nlabel.sm { fill: #9CA3AF; font-size: 8.5px; font-family: var(--font-mono); }
.d-edge { stroke: #CBD5E1; stroke-width: 2; fill: none; stroke-dasharray: 5 5; }
.d-elabel { fill: #94A3B8; font-size: 9.5px; font-family: var(--font-mono); }

/* estado dim/on por paso */
.diagram [data-did] { opacity: 0.32; transition: opacity 0.3s; }
.diagram [data-did].on { opacity: 1; }
.diagram .d-edge.on { stroke-width: 2.5; animation: dashmove 0.9s linear infinite; }
.diagram .d-edge.on.good { stroke: #22C55E; }
.diagram .d-edge.on.bad { stroke: #DC2626; }
.diagram .d-elabel.on.good { fill: #16A34A; }
.diagram .d-elabel.on.bad { fill: #DC2626; }
.diagram g.on { filter: drop-shadow(0 0 10px rgba(246, 130, 31, 0.45)); }
.diagram .d-node.on.good { filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5)); }
.diagram .d-node.on.bad { filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.5)); }
.diagram .d-net.on, .diagram .d-site.on { stroke-width: 2.5; }
.diagram .d-chk.on circle { stroke-width: 3; }

@keyframes dashmove { to { stroke-dashoffset: -20; } }

.step-caption {
  min-height: 76px;
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--orange));
  border-radius: 8px;
}
.step-caption strong { font-family: var(--font-display); font-size: 14px; }
.step-caption p { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

.step-controls { display: flex; align-items: center; gap: 10px; justify-content: center; }
.step-dots { display: flex; gap: 8px; }
.step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.step-dot:hover { border-color: var(--accent, var(--orange)); }
.step-dot.on {
  background: var(--accent, var(--orange));
  border-color: var(--accent, var(--orange));
  color: #0B0B0F;
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent, #F6821F) 50%, transparent);
}

.diagram-legend {
  display: flex; gap: 18px; justify-content: center;
  margin-top: 14px; font-size: 11.5px; color: var(--text-faint);
}
.diagram-legend .lg {
  display: inline-block; width: 18px; height: 0;
  border-top: 2px dashed; vertical-align: middle; margin-right: 6px;
}
.diagram-legend .lg.good { border-color: var(--green); }
.diagram-legend .lg.bad { border-color: var(--red); }

@media (max-width: 980px) {
  .product-page { grid-template-columns: 1fr; }
  .product-diagram { position: static; }
}

/* ---------- Paquetes animados + bloqueo ---------- */
.d-packet.good { fill: #16A34A; filter: drop-shadow(0 0 4px rgba(22,163,74,0.8)); }
.d-packet.bad { fill: #DC2626; filter: drop-shadow(0 0 4px rgba(220,38,38,0.8)); }
.d-burst circle {
  fill: none;
  stroke: #DC2626;
  stroke-width: 2.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: burst 1.1s ease-out infinite;
}
.d-burst text { fill: #DC2626; font-size: 13px; font-weight: 700; }
@keyframes burst {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* ---------- Modal de diagrama (ampliar) ---------- */
.diagram-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadein 0.18s ease-out;
}
.diagram-modal-box {
  background: var(--card);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  padding: 22px 26px;
  width: min(980px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 40px rgba(246,130,31,0.08);
}
.dm-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Mapa del portafolio ---------- */
.pf-tile { cursor: pointer; transition: filter 0.2s; }
.pf-tile > rect:first-child { fill: #FFFFFF; stroke: #E2E8F0; stroke-width: 1.2; }
.pf-tile:hover { filter: drop-shadow(0 0 12px color-mix(in srgb, var(--tacc) 60%, transparent)); }
.pf-tile:hover > rect:first-child { stroke: var(--tacc); stroke-width: 2; }
.pf-ic { font-size: 18px; }
.pf-name { fill: #1F2937; font-size: 10.5px; font-weight: 700; font-family: var(--font-display); }
.pf-sub { fill: #9CA3AF; font-size: 8.5px; font-family: var(--font-body); }
.d-layer { fill: #B45309; font-size: 9px; letter-spacing: 2px; font-family: var(--font-display); font-weight: 600; }
.pf-sc rect { fill: #1F2937; stroke: #F6821F; stroke-width: 1.5; }
.pf-sc text { fill: #FDEAD7; font-size: 11px; font-weight: 600; font-family: var(--font-body); }

/* ---------- Sección "en progreso" ---------- */
.soon-pill {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--amber);
  background: rgba(251, 173, 65, 0.12);
  border: 1px solid rgba(251, 173, 65, 0.35);
  border-radius: 20px;
  padding: 1px 8px;
  white-space: nowrap;
}
.soon-note { color: var(--text-faint) !important; font-style: italic; }
.section-soon .section-head { opacity: 0.85; }

/* ---------- Tarjetas "en progreso" ---------- */
.soon-card {
  border-style: dashed;
  opacity: 0.65;
}
.soon-card h3 { color: var(--text-dim); }
.soon-card p { color: var(--text-faint) !important; }

.soon-item { cursor: pointer; opacity: 0.7; }

/* ---------- Secciones hands-on "en progreso" ---------- */
.section-soon { border-style: dashed; }
.section-soon .soon-count {
  color: var(--amber);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 9.5px;
}
.section-soon .section-head span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Las secciones dentro del sidebar flex no deben encogerse */
.sidebar > * { flex-shrink: 0; }
