/* ============================================================
   Grupo HEMA — AI Roadmap portal · bespoke design system
   Industrial conglomerate: navy steel + amber, per-unit accent.
   Display: Space Grotesk · Text: Inter
   ============================================================ */

:root {
  --navy: #16304a;
  --navy-900: #0f2236;
  --navy-700: #1d4063;
  --amber: #e0922f;
  --amber-soft: #f6c98a;

  /* per-unit accent — overridden by [data-unit] below */
  --accent: #1f7a8c;
  --accent-soft: rgba(31, 122, 140, 0.14);

  /* phase palette (mirrors phases.json) */
  --fase-1: #1f7a8c;
  --fase-2: #e8923c;
  --fase-3: #b3423a;

  --ink: #16222e;
  --muted: #5a6b7b;
  --line: #e3e9f0;
  --line-strong: #cdd7e2;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --page: #eef2f7;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 34, 54, 0.06), 0 2px 8px rgba(15, 34, 54, 0.05);
  --shadow-md: 0 10px 30px rgba(15, 34, 54, 0.12);
  --shadow-lg: 0 24px 60px rgba(15, 34, 54, 0.22);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-text: "Inter", system-ui, sans-serif;
  --maxw: 1180px;
}

html[data-unit="restaurantes"] { --accent: #b3423a; --accent-soft: rgba(179, 66, 58, 0.14); }
html[data-unit="alchisa"]      { --accent: #1f7a8c; --accent-soft: rgba(31, 122, 140, 0.14); }
html[data-unit="dimanor"]      { --accent: #e8923c; --accent-soft: rgba(232, 146, 60, 0.16); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-text);
  color: var(--ink);
  background: var(--page);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .4em; letter-spacing: -0.01em; }
a { color: inherit; }
p { margin: 0 0 .8em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.section { padding: 40px 0; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.5rem; margin: 0; }
.section-head .eyebrow { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.section-head p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------------- Navbar ---------------- */
nav.topnav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 34, 54, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #eaf1f8;
}
.topnav .nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; height: 62px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: #fff; text-decoration: none; margin-right: 10px; white-space: nowrap; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--amber), var(--accent)); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem; }
.brand .mark-img { height: 36px; width: auto; display: block; }
.brand small { font-weight: 500; font-size: .7rem; color: var(--amber-soft); letter-spacing: .04em; display: block; margin-top: -3px; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-links a, .nav-trigger {
  color: #cddbe8; text-decoration: none; font-size: .9rem; font-weight: 500;
  padding: 8px 13px; border-radius: 9px; background: none; border: none; cursor: pointer;
  font-family: var(--font-text); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.nav-links a:hover, .nav-trigger:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-links a.active { color: #fff; background: rgba(255,255,255,0.10); }

/* dropdown */
.nav-dd { position: relative; }
.nav-trigger .chev { transition: transform .2s; font-size: .7rem; opacity: .8; }
.nav-dd.open .nav-trigger .chev { transform: rotate(180deg); }
.nav-dd .dd-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 190px;
  background: var(--surface); color: var(--ink); border-radius: 14px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: all .16s ease; z-index: 60;
}
.nav-dd.open .dd-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dd-menu .dd-label { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 6px; }
.dd-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; text-decoration: none; }
.dd-item:hover { background: var(--surface-2); }
.dd-item .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.dd-item .dd-name { font-weight: 600; font-family: var(--font-display); font-size: .96rem; }
.dd-item.current { background: var(--surface-2); outline: 1px solid var(--line-strong); }
/* dark text on the white dropdown — beats the light `.nav-links a` color */
.nav-dd .dd-menu .dd-item,
.nav-dd .dd-menu .dd-item .dd-name,
.nav-dd .dd-menu .dd-item:hover,
.nav-dd .dd-menu .dd-item:hover .dd-name { color: var(--ink); }
.nav-dd .dd-menu .dd-item.current .dd-name { color: var(--accent); }
.dd-item .dd-check { margin-left: auto; color: var(--accent); font-weight: 700; visibility: hidden; }
.dd-item.current .dd-check { visibility: visible; }

.unit-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.10); color: #fff; font-size: .82rem; font-weight: 600; }
.unit-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.btn-logout { color: #cddbe8; background: none; border: 1px solid rgba(255,255,255,.18); border-radius: 9px; padding: 7px 13px; cursor: pointer; font-family: var(--font-text); font-size: .85rem; }
.btn-logout:hover { background: rgba(255,255,255,.10); color:#fff; }

.nav-toggle { display: none; }

/* ---------------- Buttons / chips ---------------- */
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; border: none; padding: 12px 22px; border-radius: 11px; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; font-family: var(--font-text); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip.phase { color: #fff; border: none; }
.chip.qw { background: #fff6e8; color: #b5751a; border-color: #f0d9af; }
.chip.area { background: var(--accent-soft); color: var(--accent); border: none; }

/* ---------------- Hero (roadmap) ---------------- */
.hero {
  position: relative; overflow: hidden; color: #eef4fa;
  background:
    radial-gradient(1100px 420px at 85% -10%, rgba(224,146,47,0.30), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, var(--accent-soft), transparent 55%),
    linear-gradient(140deg, var(--navy-900), var(--navy) 60%, var(--navy-700));
}
.hero::after { content:""; position:absolute; inset:0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(700px 380px at 70% 20%, #000, transparent 75%); pointer-events:none; }
.hero .wrap { position: relative; padding: 56px 24px 50px; z-index: 1; }
.hero .eyebrow { color: var(--amber-soft); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; font-size: .74rem; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: 12px 0; color: #fff; }
.hero .lede { max-width: 640px; color: #cfddea; font-size: 1.05rem; }
.hero .unit-tabs { display: flex; gap: 8px; margin: 22px 0 8px; flex-wrap: wrap; }
.hero .unit-tabs a { padding: 9px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .9rem; color: #d6e3ef; background: rgba(255,255,255,.08); border: 1px solid transparent; }
.hero .unit-tabs a.active { background: #fff; color: var(--navy); }
.hero .unit-tabs a:hover:not(.active) { background: rgba(255,255,255,.16); }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.kpi { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 18px 20px; }
.kpi .num { font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; color: #fff; line-height: 1; }
.kpi .lbl { font-weight: 600; margin-top: 8px; color: #eaf1f8; }
.kpi .desc { font-size: .8rem; color: #a9bccd; margin-top: 3px; }

/* ---------------- FODA quadrants ---------------- */
.foda-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.foda { border-radius: var(--radius); padding: 20px 22px; background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line); border-top: 4px solid var(--q); }
.foda h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 9px; }
.foda h3 .tag { width: 26px; height: 26px; border-radius: 8px; background: var(--q); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.foda ul { margin: 6px 0 0; padding-left: 18px; }
.foda li { margin-bottom: 6px; font-size: .92rem; }
.foda.f { --q: #2f7d57; } .foda.o { --q: #2674b6; } .foda.d { --q: #c1822a; } .foda.a { --q: #b14a43; }
.madurez-note { margin-top: 16px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 14px 18px; font-size: .92rem; color: var(--muted); }
.madurez-note strong { color: var(--ink); }

/* ---------------- Phase strip ---------------- */
.phase-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.phase-card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--pc); border-radius: var(--radius); padding: 18px 20px; cursor: pointer; transition: transform .15s, box-shadow .15s; position: relative; }
.phase-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.phase-card.selected { box-shadow: 0 0 0 2px var(--pc), var(--shadow-md); }
.phase-card .pnum { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pc); }
.phase-card h3 { font-size: 1.08rem; margin: 4px 0 6px; }
.phase-card .tf { font-size: .8rem; font-weight: 600; color: var(--ink); background: var(--surface-2); border-radius: 999px; padding: 3px 10px; display: inline-block; margin-bottom: 8px; }
.phase-card .obj { font-size: .88rem; color: var(--muted); margin: 0; }
.phase-card .count { position: absolute; top: 16px; right: 18px; font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: var(--pc); }

.filterbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin: 4px 0 18px; }
.clear-filter { border:none; background: var(--accent-soft); color: var(--accent); font-weight:600; border-radius: 999px; padding: 6px 14px; cursor:pointer; font-family: var(--font-text); font-size:.83rem; }

/* ---------------- Matrix ---------------- */
.matrix-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }
.matrix-wrap { display: grid; grid-template-columns: 1fr 230px; gap: 22px; }
.matrix { position: relative; width: 100%; aspect-ratio: 1 / 0.74; background:
   linear-gradient(var(--line) 1px, transparent 1px) 0 0/100% 25%,
   linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0/25% 100%;
  border-left: 2px solid var(--line-strong); border-bottom: 2px solid var(--line-strong); border-radius: 6px; }
.matrix .qw-zone { position: absolute; left: 0; top: 0; width: 42%; height: 46%; background: repeating-linear-gradient(45deg, rgba(224,146,47,.10), rgba(224,146,47,.10) 8px, rgba(224,146,47,.04) 8px, rgba(224,146,47,.04) 16px); border-right: 1px dashed var(--amber); border-bottom: 1px dashed var(--amber); border-radius: 6px 0 0 0; }
.matrix .qw-zone span { position: absolute; top: 8px; left: 10px; font-size: .68rem; font-weight: 700; color: #b5751a; letter-spacing: .04em; }
.matrix .axis-y, .matrix .axis-x { position: absolute; font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.matrix .axis-y { left: -34px; top: 50%; transform: rotate(-90deg) translateX(50%); transform-origin: left; }
.matrix .axis-x { bottom: -26px; left: 50%; transform: translateX(-50%); }
.matrix .ylo { position:absolute; left:6px; bottom:4px; font-size:.62rem; color:var(--muted);}
.matrix .yhi { position:absolute; left:6px; top:4px; font-size:.62rem; color:var(--muted);}
.matrix .dot { position: absolute; width: 30px; height: 30px; border-radius: 50%; transform: translate(-50%, 50%); display: grid; place-items: center; color: #fff; font-size: .62rem; font-weight: 700; cursor: pointer; border: 2px solid #fff; box-shadow: var(--shadow-sm); transition: transform .14s, opacity .2s, box-shadow .14s; }
.matrix .dot:hover { transform: translate(-50%, 50%) scale(1.28); box-shadow: var(--shadow-md); z-index: 5; }
.matrix .dot.qw::after { content:"★"; position:absolute; top:-9px; right:-7px; font-size:.66rem; color: var(--amber); text-shadow: 0 0 2px #fff; }
.matrix .dot.dim { opacity: .18; }
.matrix-legend { align-self: center; }
.matrix-legend .lg { display:flex; align-items:center; gap:9px; margin-bottom:10px; font-size:.84rem; }
.matrix-legend .sw { width: 14px; height: 14px; border-radius: 4px; flex:none; }
.matrix-legend .hint { font-size:.78rem; color: var(--muted); margin-top: 14px; border-top:1px solid var(--line); padding-top:12px; }

/* ---------------- Initiative grid / cards ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.icard { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pc, var(--accent)); border-radius: var(--radius); padding: 18px 20px; cursor: pointer; transition: transform .15s, box-shadow .15s; display:flex; flex-direction:column; }
.icard:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.icard .id { font-family: var(--font-display); font-weight: 700; font-size: .76rem; color: var(--muted); }
.icard h3 { font-size: 1.04rem; margin: 4px 0 10px; }
.icard .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.icard .prob { font-size: .88rem; color: var(--muted); margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.icard.hidden { display: none; }

.group-head { display:flex; align-items:center; gap:12px; margin: 28px 0 14px; }
.group-head .bar { width: 5px; height: 26px; border-radius: 3px; background: var(--pc); }
.group-head h2 { font-size: 1.25rem; margin:0; }
.group-head .gtf { font-size:.82rem; color: var(--muted); }

/* ---------------- Detail popup ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(12, 24, 38, 0.5); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .2s; z-index: 80; }
.overlay.open { opacity: 1; visibility: visible; }
.panel { position: fixed; top: 0; right: 0; height: 100%; width: min(480px, 92vw); background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .26s cubic-bezier(.16,.84,.44,1); z-index: 81; display: flex; flex-direction: column; border-left: 6px solid var(--pc, var(--accent)); }
.overlay.open + .panel, .panel.open { transform: translateX(0); }
.panel .ph { padding: 22px 26px 16px; border-bottom: 1px solid var(--line); }
.panel .close { position: absolute; top: 16px; right: 18px; border: none; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.panel .close:hover { background: var(--line); color: var(--ink); }
.panel .pid { font-family: var(--font-display); font-weight: 700; color: var(--muted); font-size: .8rem; }
.panel .pt { font-size: 1.4rem; margin: 4px 0 12px; padding-right: 30px; }
.panel .pchips { display: flex; gap: 7px; flex-wrap: wrap; }
.panel .pbody { padding: 20px 26px 40px; overflow-y: auto; }
.panel .pblock { margin-bottom: 20px; }
.panel .pblock h4 { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 7px; }
.panel .pblock p { font-size: .94rem; margin: 0; color: var(--ink); }
.panel .pblock ul { margin: 0; padding-left: 18px; font-size: .92rem; }
.syn-links { display: flex; flex-wrap: wrap; gap: 8px; }
.syn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer; color: var(--ink); }
.syn:hover { border-color: var(--accent); color: var(--accent); }
.syn.plain { cursor: default; color: var(--muted); }
.syn .sid { font-family: var(--font-display); font-size: .72rem; opacity: .7; }
.tech-tags { display:flex; flex-wrap:wrap; gap:7px; }
.tech-tags .t { font-size:.82rem; padding:5px 11px; border-radius:8px; background: var(--surface-2); border:1px solid var(--line); }

/* ---------------- Benchmark ---------------- */
.bench-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.bench-table th, .bench-table td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: top; }
.bench-table thead th { background: var(--navy); color: #eaf1f8; font-family: var(--font-display); font-weight: 600; font-size: .82rem; position: sticky; top: 62px; }
.bench-table tbody tr:hover { background: var(--surface-2); }
.bench-table .co { font-weight: 700; font-family: var(--font-display); white-space: nowrap; }
.score { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-weight: 700; font-size: .82rem; color: #fff; }
.bench-note { color: var(--muted); font-size: .85rem; max-width: 420px; }
.reco { margin-top: 18px; background: linear-gradient(120deg, var(--accent-soft), transparent); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 18px 22px; }
.reco h4 { margin: 0 0 6px; color: var(--accent); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }
.sw-inline { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:8px; vertical-align:middle; }

/* radar */
.radar-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }
.radar-wrap { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: center; }
.radar-wrap svg { width: 100%; height: auto; }
.radar-side .radar-legend-title { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.radar-legend { display: flex; flex-direction: column; gap: 8px; }
.radar-chip { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-family: var(--font-text); font-size: .88rem; font-weight: 600; color: var(--muted); text-align: left; transition: all .14s; }
.radar-chip .sw { width: 12px; height: 12px; border-radius: 4px; flex: none; opacity: .35; }
.radar-chip.on { color: var(--ink); border-color: var(--line-strong); background: #fff; box-shadow: var(--shadow-sm); }
.radar-chip.on .sw { opacity: 1; }
.radar-chip:hover { border-color: var(--accent); }
@media (max-width: 760px){ .radar-wrap { grid-template-columns: 1fr; } }

/* ---------------- Technologies ---------------- */
.tech-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.tech-col h3 { display:flex; align-items:center; gap:10px; font-size:1.1rem; }
.tech-col h3 .pic { width: 30px; height:30px; border-radius:9px; display:grid; place-items:center; color:#fff; font-size:.9rem; }
.tech-list { display:flex; flex-direction:column; gap:12px; }
.tech-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px 18px; box-shadow: var(--shadow-sm); }
.tech-item.actual { border-left: 4px solid var(--muted); }
.tech-item.propuesta { border-left: 4px solid var(--accent); }
.tech-item .tn { font-weight: 700; font-family: var(--font-display); }
.tech-item .td { font-size: .88rem; color: var(--muted); margin: 4px 0 8px; }
.tech-item .areas { display:flex; gap:6px; flex-wrap:wrap; }
.tech-item .areas span { font-size:.72rem; background: var(--surface-2); border:1px solid var(--line); border-radius:6px; padding:3px 8px; color: var(--muted); }

/* constellation graph */
.graph-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.graph-legend { display:flex; gap:18px; flex-wrap:wrap; }
.graph-legend .lg { display:flex; align-items:center; gap:8px; font-size:.85rem; color: var(--muted); font-weight:600; }
.graph-legend .sw { width:13px; height:13px; border-radius:50%; }
.graph-legend .sw-prop { display:inline-grid; place-items:center; width:15px; height:15px; border-radius:50%; border:1.4px dashed var(--muted); color: var(--muted); font-size:9px; font-weight:700; }
.graph-legend .lg-sep { width:1px; height:18px; background: var(--line-strong); margin:0 4px; }
.graph-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px; }
.graph-card svg { width: 100%; height: auto; display:block; }
#constellation { touch-action: none; }
#constellation .tech-node, #constellation .hub-node { cursor: grab; }
#constellation .lbl { cursor: grab; }
#constellation.grabbing, #constellation.grabbing * { cursor: grabbing !important; }
.graph-hint { text-align:center; color: var(--muted); font-size:.84rem; margin:6px 0 4px; }
.cedge { transition: opacity .18s, stroke .18s; }
.cedge.hl { stroke: var(--accent); stroke-width: 2.4; opacity: 1; }
.cedge.dim { opacity: .12; }
.cnode { transition: opacity .18s; }
.cnode.dim { opacity: .22; }
.cnode circle { transition: transform .14s; transform-box: fill-box; transform-origin: center; }
.cnode:hover circle, .cnode.hl-hover circle, .cnode.hl-hover .prop-ring { transform: scale(1.22); }
.cnode.sel circle { stroke-width: 3.5; }
.hub-node circle { transition: transform .14s; }

/* constellation labels — text is the primary, always-readable layer */
.lbl {
  fill: #16222e; font-family: "Inter", sans-serif; font-size: 12.5px; font-weight: 600;
  paint-order: stroke; stroke: #ffffff; stroke-width: 3.6px; stroke-linejoin: round;
  transition: font-size .14s, fill .14s;
}
.lbl-prop { font-style: italic; }
.lbl.hl-hover { font-size: 14.5px; font-weight: 700; fill: #0f2236; }
.lbl { opacity: 1; }
.lbl.dim { opacity: .2; }

/* ---------------- Segundo Cerebro (knowledge graph) ---------------- */
.brain-toolbar { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.brain-search-wrap { position:relative; }
#brainSearch { width:240px; max-width:60vw; padding:10px 14px; border:1px solid var(--line-strong); border-radius:11px; font-family:var(--font-text); font-size:.9rem; }
#brainSearch:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.brain-results { display:none; position:absolute; top:calc(100% + 6px); left:0; right:0; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; z-index:40; max-height:320px; overflow-y:auto; }
.brain-results button { display:flex; align-items:center; gap:9px; width:100%; text-align:left; border:none; background:none; padding:9px 10px; border-radius:8px; cursor:pointer; font-family:var(--font-text); font-size:.9rem; color:var(--ink); }
.brain-results button:hover { background:var(--surface-2); }
.brain-results .sw, .type-chip .sw { width:11px; height:11px; border-radius:50%; flex:none; }
.type-chip { display:inline-flex; align-items:center; gap:8px; padding:8px 13px; border-radius:999px; border:1px solid var(--line); background:var(--surface-2); cursor:pointer; font-family:var(--font-text); font-size:.85rem; font-weight:600; color:var(--muted); transition:all .14s; }
.type-chip.on { color:var(--ink); background:#fff; border-color:var(--line-strong); box-shadow:var(--shadow-sm); }
.type-chip:hover { border-color:var(--accent); }
.brain-card { padding:0; overflow:hidden; }
#brainGraph { width:100%; height:70vh; min-height:520px; display:block; background:radial-gradient(900px 600px at 50% 40%, #fbfcfe, var(--surface-2)); touch-action:none; cursor:grab; }
#brainGraph.panning { cursor:grabbing; }
.brain-card .graph-hint { padding:10px 14px; margin:0; border-top:1px solid var(--line); }
.bn { cursor:pointer; }
.bn circle { stroke:#fff; stroke-width:1.6; transition:transform .14s, opacity .18s; transform-box:fill-box; transform-origin:center; }
.bn:hover circle { transform:scale(1.25); }
.bn.sel circle { stroke:#16222e; stroke-width:2.6; }
.bn.dim { opacity:.12; }
.bedge { stroke:#c4d0dc; stroke-width:1; transition:opacity .18s, stroke .18s; }
.bedge.dim { opacity:.06; }
.bedge.hl { stroke:var(--accent); stroke-width:1.8; }
.bn-label { font-family:"Inter",sans-serif; font-size:11px; font-weight:600; fill:#16222e; paint-order:stroke; stroke:#fff; stroke-width:3px; stroke-linejoin:round; pointer-events:none; opacity:0; transition:opacity .15s; }
.bn-label.show { opacity:1; }
/* wiki links inside the reading panel */
.panel .pbody .wl { color:var(--accent); cursor:pointer; font-weight:600; border-bottom:1px dashed var(--accent); text-decoration:none; }
.panel .pbody .wl:hover { border-bottom-style:solid; }
.panel .pbody .wl-dead { color:inherit; }
.panel .pbody h4 { color:var(--accent); font-size:.74rem; letter-spacing:.1em; text-transform:uppercase; margin:18px 0 6px; }
.panel .pbody h5 { font-size:.95rem; margin:14px 0 4px; }
.panel .pbody ul { margin:0 0 10px; padding-left:18px; } .panel .pbody li { margin-bottom:5px; font-size:.92rem; }
.panel .pbody p { font-size:.93rem; }
.panel .pbody code { background:var(--surface-2); border:1px solid var(--line); border-radius:5px; padding:1px 5px; font-size:.85em; }

/* dimension diagnosis grid */
.dim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.dim-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.dim-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dim-name { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.dim-badge { color: #fff; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.dim-card p { margin: 0; font-size: .88rem; color: var(--muted); }
@media (max-width: 860px){ .dim-grid { grid-template-columns: 1fr; } }

/* ---------------- Home / login ---------------- */
.home { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.home .left {
  position: relative; overflow: hidden; color: #fff; padding: 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 460px at 80% 0%, rgba(224,146,47,.34), transparent 60%),
    radial-gradient(700px 500px at 10% 100%, rgba(31,122,140,.4), transparent 55%),
    linear-gradient(150deg, var(--navy-900), var(--navy) 60%, var(--navy-700));
}
.home .left::after { content:""; position:absolute; inset:0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(600px 420px at 75% 30%, #000, transparent 78%); }
.home .left > * { position: relative; z-index:1; }
.home .brand-lg { display:flex; align-items:center; gap:12px; font-family: var(--font-display); font-weight:700; font-size:1.2rem; }
.home .brand-lg .mark { width:42px; height:42px; border-radius:11px; background: linear-gradient(135deg, var(--amber), #1f7a8c); display:grid; place-items:center; font-size:1.1rem; }
.home .brand-lg .mark-img { height: 52px; width: auto; display: block; }
.home h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); margin: 0 0 14px; }
.home .left .lede { color:#cfddea; max-width: 460px; font-size:1.08rem; }
.home .units-preview { display:flex; gap:10px; margin-top: 26px; flex-wrap:wrap; }
.home .units-preview .u { background: rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 12px 16px; min-width: 150px; }
.home .units-preview .u b { font-family: var(--font-display); display:flex; align-items:center; gap:8px; font-size:.98rem; margin-bottom:3px; }
.home .units-preview .u .dot { width:10px; height:10px; border-radius:50%; flex:none; }
.home .units-preview .u span { font-size:.78rem; color:#a9bccd; }
.home .right { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 1.6rem; }
.login-card p.sub { color: var(--muted); margin-bottom: 22px; }
.login-card label { font-size: .82rem; font-weight: 600; color: var(--ink); display:block; margin: 14px 0 6px; }
.login-card input { width: 100%; padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 11px; font-size: .95rem; font-family: var(--font-text); }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 22px; background: var(--navy); }
.login-card .btn:hover { background: var(--navy-700); }
.login-err { color: #b14a43; font-size: .86rem; margin-top: 12px; background: #fbecea; border-radius: 9px; padding: 10px 12px; }

/* ---------------- Placeholder (grafo) ---------------- */
.placeholder { text-align:center; max-width: 560px; margin: 60px auto; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 50px 40px; }
.placeholder .ic { font-size: 2.4rem; }
.placeholder h2 { margin-top: 14px; }

/* ---------------- Chat widget ---------------- */
#chatWidget { position: fixed; bottom: 22px; right: 22px; z-index: 70; }
#chatToggle { width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--accent); color: #fff; font-size: 1.4rem; cursor: pointer; box-shadow: var(--shadow-md); }
#chatToggle:hover { transform: scale(1.06); }
#chatPanel { position: absolute; bottom: 70px; right: 0; width: 350px; max-width: 88vw; height: 460px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); }
#chatPanel[hidden] { display: none; }
#chatPanel::before { content: "Asistente HEMA · AI Roadmap"; display:block; background: var(--navy); color:#fff; padding: 13px 16px; font-family: var(--font-display); font-weight:600; font-size:.92rem; }
#chatMessages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.chat-msg { padding: 9px 13px; border-radius: 13px; font-size: .9rem; max-width: 84%; }
.chat-msg-user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-msg-bot { background: var(--surface-2); color: var(--ink); align-self: flex-start; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
#chatForm { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
#chatForm input { flex: 1; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 10px; font-family: var(--font-text); }
#chatForm input:focus { outline: none; border-color: var(--accent); }
#chatForm button { background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: 0 16px; cursor: pointer; font-weight: 600; }

/* ---------------- Footer ---------------- */
.foot { background: var(--navy-900); color: #9fb3c6; padding: 28px 0; font-size: .85rem; margin-top: 40px; }
.foot .wrap { display:flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .matrix-wrap { grid-template-columns: 1fr; }
  .tech-cols, .home { grid-template-columns: 1fr; }
  .home .left { padding: 40px 28px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .foda-grid { grid-template-columns: 1fr; }
  .phase-strip { grid-template-columns: 1fr; }
  .nav-links { position: fixed; top: 62px; left: 0; right: 0; background: var(--navy-900); flex-direction: column; align-items: stretch; padding: 10px; gap: 4px; display: none; }
  .nav-links.open { display: flex; }
  .nav-dd .dd-menu { position: static; opacity:1; visibility:visible; transform:none; box-shadow:none; background: rgba(255,255,255,.06); }
  .nav-dd .dd-menu .dd-item, .nav-dd .dd-menu .dd-item .dd-name, .nav-dd .dd-menu .dd-item:hover .dd-name { color:#dce7f1; } .nav-dd .dd-menu .dd-item:hover{ background: rgba(255,255,255,.08);}
  .nav-dd .dd-menu .dd-label{ color:#9fb3c6;}
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .bench-table thead th { position: static; }
}
