:root {
.hidden { display: none !important; }
  --bg: #0f172a;
  --bg2: #1e293b;
  --bg3: #334155;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --accent: #6366f1;
  --accent2: #818cf8;
  --red: #ef4444;
  --orange: #f59e0b;
  --green: #10b981;
  --cyan: #06b6d4;
  --border: #334155;
  --radius: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 210;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.logo svg { color: var(--accent2); }

nav { display: flex; align-items: center; gap: 16px; }
nav a {
  color: var(--text2);
  font-weight: 500;
}
nav a.active { color: var(--accent2); }

.toggle-sidebar {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--text);
  cursor: pointer;
}
.toggle-sidebar:hover { border-color: var(--accent); }

/* Main */
main { flex: 1; }

/* Footer */
footer {
  padding: 12px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text2);
  border-top: 1px solid var(--border);
}
footer p + p { margin-top: 4px; }

/* ===== MAPA ===== */
.mapa-container {
  display: flex;
  height: calc(100vh - 100px);
}

.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  margin-bottom: 8px;
}

/* Search */
.search-box { position: relative; }

.search-box input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 50;
}
.search-results.active { display: block; }

.search-result {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.search-result:hover { background: var(--bg3); }
.search-result .sr-tipo {
  font-size: 0.65rem;
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-right: 6px;
}

/* Filters */
.filter-group { margin-bottom: 8px; }
.filter-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text2);
  margin-bottom: 4px;
}
.filter-group select {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
}

/* Stats */
.stats-bar { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 12px 0; font-size: 0.8rem; color: var(--text2); flex-wrap: wrap; justify-content: center; }
.stat-item { display: inline-flex; align-items: baseline; gap: 4px; }.stat-num { font-size: 1rem; font-weight: 700; color: var(--accent2); }.stat-sep { color: var(--border); font-size: 1.1rem; }

/* Legend */
.legend-section { margin-bottom: 10px; }
.legend-section h4 { font-size: 0.7rem; color: var(--text2); margin-bottom: 4px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  padding: 2px 0;
}
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.line { width: 20px; height: 3px; border-radius: 2px; flex-shrink: 0; }

.instructions ul {
  list-style: none;
  font-size: 0.75rem;
  color: var(--text2);
}
.instructions li { padding: 2px 0; }
.instructions li::before { content: '• '; color: var(--accent2); }

/* Graph */
.graph-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 400px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(99,102,241,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 30%, rgba(6,182,212,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(239,68,68,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, #0c1222 0%, #060a13 100%);
}
#graph { width: 100%; height: 100%; min-height: 400px; }
#graph canvas { display: block; outline: none; }
#graph svg { display: block; }

/* Floating Search */
.floating-search {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 340px;
  transition: all 0.3s ease;
}
.floating-search:not(.focused) {
  opacity: 0.5;
}
.floating-search:hover,
.floating-search.focused {
  opacity: 1;
}
.fs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  transition: all 0.25s ease;
}
.floating-search.focused .fs-bar {
  background: rgba(15, 23, 42, 0.92);
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.15);
}
.fs-icon { color: var(--text2); flex-shrink: 0; }
.floating-search.focused .fs-icon { color: var(--accent2); }
.fs-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}
.fs-bar input::placeholder { color: #64748b; }
.fs-hint {
  font-size: 0.62rem;
  color: #475569;
  background: rgba(51, 65, 85, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.floating-search.focused .fs-hint { color: var(--accent2); background: rgba(99, 102, 241, 0.15); }

.fs-suggestions {
  margin-top: 4px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}
.fs-suggestions.active { display: block; }
.fs-suggestion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  font-size: 0.82rem;
  transition: background 0.1s;
}
.fs-suggestion:last-child { border-bottom: none; }
.fs-suggestion:hover { background: rgba(99, 102, 241, 0.1); }
.fs-suggestion .fs-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fs-suggestion .fs-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-suggestion .fs-desc { font-size: 0.68rem; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; line-height: 1.3; }
.fs-suggestion .fs-num { font-size: 0.7rem; color: var(--text2); flex-shrink: 0; }
.fs-suggestion.in-graph .fs-name { color: var(--accent2); font-weight: 600; }
.fs-suggestion.fs-active { background: rgba(99,102,241,0.2); border-left: 3px solid var(--accent2); }

.fs-ai-result {
  margin-top: 4px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
}
.fs-ai-result.hidden { display: none; }
.fs-ai-result .fs-ai-summary { color: var(--text2); font-size: 0.75rem; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }

@media (max-width: 900px) {
  .floating-search { width: calc(100% - 28px); }
}

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.8rem;
  pointer-events: none;
  display: none;
  z-index: 40;
  max-width: 300px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.tooltip.active { display: block; }
.tooltip .tt-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.tooltip .tt-meta { color: var(--text2); font-size: 0.75rem; }
.tooltip .tt-meta span { margin-right: 8px; }

/* Node Panel */
.node-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 340px;
  max-height: calc(100% - 32px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-y: auto;
  z-index: 45;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.node-panel.hidden { display: none; }
.close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.4rem;
  cursor: pointer;
}
.close-btn:hover { color: var(--text); }

/* Node Panel — Card redesign */
.np-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.np-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(6,182,212,0.1));
  border-radius: 12px;
  border: 1px solid rgba(99,102,241,0.2);
}
.np-header-text { flex: 1; min-width: 0; }
.np-title { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.np-subtitle { font-size: 0.75rem; color: var(--text2); margin-top: 2px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.np-fullname {
  font-size: 0.78rem;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.4;
  background: var(--bg);
  padding: 6px 8px;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.np-badges { display: flex; gap: 5px; margin-bottom: 12px; flex-wrap: wrap; }
.badge-cat { background: rgba(99,102,241,0.12); color: var(--accent2); border: 1px solid rgba(99,102,241,0.25); }

.np-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 14px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 6px;
}
.np-stat { text-align: center; }
.np-stat-num { font-size: 1.05rem; font-weight: 700; color: var(--accent2); line-height: 1; }
.np-stat-label { font-size: 0.6rem; color: var(--text2); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.03em; }

.np-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}
.np-info-item {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 6px;
}
.np-info-label { font-size: 0.6rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.03em; }
.np-info-value { font-size: 0.82rem; font-weight: 500; margin-top: 1px; }

.np-ai-section {
  margin-bottom: 14px;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  overflow: hidden;
}
.np-ai-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(16,185,129,0.05));
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.np-ai-icon { font-size: 0.9rem; }
.np-ai-body {
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
}
.np-ai-body p { margin: 0; }
.np-ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text2);
  font-size: 0.78rem;
}
.np-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.np-rels { margin-bottom: 14px; }
.np-rels-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text2);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  margin-top: 10px;
}
.np-rels-arrow { font-size: 0.9rem; color: var(--accent2); }
.np-rels-count {
  margin-left: auto;
  background: var(--bg);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.68rem;
  color: var(--accent2);
}
.np-rels-list { display: flex; flex-direction: column; gap: 3px; }
.np-rel-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-size: 0.78rem;
}
.np-rel-card:hover { background: var(--bg3); transform: translateX(2px); }
.np-rel-tipo {
  font-size: 0.58rem;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  flex-shrink: 0;
}
.np-rel-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-rel-num { font-size: 0.68rem; color: var(--text2); flex-shrink: 0; }
.np-rels-more { font-size: 0.72rem; color: var(--text2); text-align: center; padding: 4px 0; font-style: italic; }

/* Tabs */
.np-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.np-tab {
  appearance: none;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}
.np-tab:hover { color: var(--text); }
.np-tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }
.np-tab-content { display: none; padding: 12px 0; }
.np-tab-content.active { display: block; }

/* Timeline */
.np-timeline { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: 16px; }
.np-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
.np-timeline-item {
  display: flex;
  gap: 10px;
  position: relative;
  padding: 6px 0;
}
.np-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  position: absolute;
  left: -16px;
  z-index: 1;
}
.np-timeline-body { flex: 1; min-width: 0; padding-left: 2px; }
.np-timeline-date { font-size: 0.65rem; color: var(--text2); }
.np-timeline-text { font-size: 0.78rem; line-height: 1.4; }
.np-timeline-text a { color: var(--text); }
.np-timeline-text a:hover { color: var(--accent2); }

/* BCN Sections */
.np-bcn-section { margin-bottom: 14px; }
.np-bcn-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text2);
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.np-bcn-tree { font-size: 0.75rem; max-height: 200px; overflow-y: auto; }
.np-bcn-tree-item { padding: 2px 0; border-bottom: 1px solid rgba(51,65,85,0.3); }
.np-bcn-texto {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text2);
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 6px;
  max-height: 250px;
  overflow-y: auto;
}
.np-bcn-list { display: flex; flex-direction: column; gap: 4px; }
.np-bcn-list-item {
  font-size: 0.75rem;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 6px;
  color: var(--text2);
}
.np-btn-secondary {
  display: inline-block;
  padding: 7px 16px;
  background: var(--bg3);
  color: var(--text) !important;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.15s;
}
.np-btn-secondary:hover { background: var(--border); }

/* Action bar */
.np-actions-bar {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.np-btn-primary {
  flex: 1;
  display: block;
  text-align: center;
  padding: 9px 16px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff !important;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.np-btn-primary:hover { opacity: 0.85; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-constitucion { background: var(--red); color: #fff; }
.badge-codigo { background: var(--orange); color: #000; }
.badge-ley { background: var(--accent); color: #fff; }
.badge-dl { background: var(--green); color: #fff; }
.badge-dfl { background: var(--cyan); color: #000; }
.badge-decreto { background: var(--bg3); color: var(--text); }
.badge-vigente { background: #065f4620; color: var(--green); border: 1px solid var(--green); }
.badge-derogada { background: #7f1d1d20; color: var(--red); border: 1px solid var(--red); }

/* Colors for relation types */
.np-rel-tipo[data-tipo="referencia"] { background: #94a3b830; color: #94a3b8; }
.np-rel-tipo[data-tipo="modificacion"] { background: #f59e0b30; color: #f59e0b; }
.np-rel-tipo[data-tipo="derogacion"] { background: #ef444430; color: #ef4444; }
.np-rel-tipo[data-tipo="complemento"] { background: #10b98130; color: #10b981; }
.np-rel-tipo[data-tipo="reglamentacion"] { background: #06b6d430; color: #06b6d4; }

/* ===== NORMA DETAIL ===== */
.norma-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--text2);
  font-size: 0.85rem;
}

.norma-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.norma-numero { font-size: 1.1rem; font-weight: 600; color: var(--text2); }

.norma-detail h1 {
  font-size: 1.6rem;
  margin-bottom: 16px;
  line-height: 1.3;
}

.norma-meta {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.norma-meta strong { color: var(--text2); margin-right: 4px; }

.norma-desc {
  font-size: 0.95rem;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg2);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.relaciones-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.rel-column h2 {
  font-size: 1rem;
  margin-bottom: 4px;
}
.rel-subtitle {
  font-size: 0.8rem;
  color: var(--text2);
  margin-bottom: 12px;
}

.rel-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--border);
}
.rel-card a { display: block; }
.rel-card p { font-size: 0.8rem; color: var(--text2); margin-top: 4px; }

.rel-tipo {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  margin-right: 6px;
}
.rel-num { color: var(--text2); font-size: 0.8rem; margin-left: 8px; }

.rel-referencia { border-left-color: #94a3b8; }
.rel-modificacion { border-left-color: #f59e0b; }
.rel-derogacion { border-left-color: #ef4444; }
.rel-complemento { border-left-color: #10b981; }
.rel-reglamentacion { border-left-color: #06b6d4; }

.empty { color: var(--text2); font-size: 0.85rem; font-style: italic; }

.mapa-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 6px 24px;
  text-align: center;
  font-size: 0.7rem;
  color: #64748b;
  background: rgba(15,23,42,0.9);
  border-top: 1px solid #334155;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.mapa-footer p + p { margin-top: 4px; }

/* Help toggle */
.help-toggle {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 65;
}
.help-btn {
  appearance: none;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99,102,241,0.2);
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.help-btn:hover, .help-btn.active {
  background: rgba(15,23,42,0.9);
  color: #e2e8f0;
  border-color: var(--accent);
}
.help-panel {
  position: absolute;
  bottom: 36px;
  left: 0;
  width: 300px;
  background: rgba(15,23,42,0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.help-panel.hidden { display: none; }
.help-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.help-items { display: flex; flex-direction: column; gap: 10px; }
.help-item {
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.4;
}
.help-item strong { color: #e2e8f0; }
.help-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

/* Responsive */
@media (max-width: 900px) {
  header { padding: 6px 10px; flex-wrap: nowrap; gap: 6px; height: 40px; min-height: 40px; }
  header .logo { font-size: 0.8rem; gap: 5px; white-space: nowrap; }
  header .logo img { width: 22px !important; height: 22px !important; }
  header nav { gap: 6px; font-size: 0.75rem; margin-left: auto; }
  header nav a { font-size: 0.72rem; white-space: nowrap; }
  .toggle-sidebar { display: block; }
  footer, .mapa-footer { display: none !important; }
  .mapa-container { flex-direction: column; height: calc(100vh - 40px); }
  .sidebar {
    display: none;
    width: 100%; min-width: auto;
    max-height: 50vh; height: auto;
    flex-direction: column;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 10px;
    overflow-y: auto;
    position: fixed; z-index: 200;
    top: 40px; left: 0;
    background: var(--bg2);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  }
  .sidebar.open { display: flex; }
  .sidebar .legend, .sidebar .instructions, .sidebar .stats-bar { display: none; }
  .sidebar .search-box { display: none; }
  .filters { display: flex; gap: 6px; flex-wrap: wrap; }
  .filters h3 { display: none; }
  .filter-group { flex: 1; min-width: 100px; margin-bottom: 0; }
  .filter-group label { font-size: 0.65rem; }
  .filter-group select { font-size: 0.75rem; padding: 5px 6px; }
  .graph-area { flex: 1; height: 100%; }
  .floating-search { width: calc(100% - 24px); top: 8px; left: 12px; opacity: 1 !important; }
  .help-toggle { bottom: 10px; left: 10px; z-index: 100; position: fixed; }
  .help-btn { font-size: 0.65rem; padding: 5px 10px; }
  .help-panel { width: calc(100vw - 40px); max-height: 50vh; overflow-y: auto; bottom: 32px; z-index: 100; }
  .floating-search .fs-bar { padding: 8px 10px; background: rgba(15,23,42,0.95); border-color: var(--accent); }
  .floating-search .fs-bar input { font-size: 0.8rem; }
  .floating-search .fs-hint { font-size: 0.55rem; padding: 2px 4px; }
  .fs-suggestions { max-height: 200px; }
  .fs-suggestion { padding: 6px 10px; font-size: 0.78rem; }

  /* Mobile tooltip: fixed bottom card */
  .tooltip.active {
    position: fixed !important;
    bottom: 52px !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    font-size: 0.85rem;
    padding: 12px 16px;
    pointer-events: auto;
    z-index: 250 !important;
  }
  .tooltip .tt-tap-hint {
    display: block !important;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    margin-top: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-radius: 8px;
    cursor: pointer;
  }

  /* Mobile panel: slide from bottom */
  .node-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    padding: 16px;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.6);
    z-index: 300 !important;
  }
  .np-title { font-size: 0.9rem; }
  .np-fullname { font-size: 0.72rem; padding: 5px 6px; }
  .np-stats-row { grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 8px 4px; }
  .np-stat-num { font-size: 0.9rem; }
  .np-stat-label { font-size: 0.55rem; }
  .np-info-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
  .np-tabs { gap: 0; }
  .np-tab { font-size: 0.62rem; padding: 6px 6px; }
  .np-actions-bar { flex-direction: column; gap: 6px; }
  .np-btn-primary, .np-btn-secondary { font-size: 0.78rem; padding: 8px 12px; text-align: center; }
  .relaciones-grid { grid-template-columns: 1fr; }
  .norma-detail { padding: 16px 12px; }
  .norma-detail h1 { font-size: 1.1rem; }
  .norma-meta { flex-direction: column; gap: 4px; }
}

@media (max-width: 480px) {
  .search-box input { font-size: 0.8rem; padding: 7px 8px; }
  .filter-group { min-width: 80px; }
}



.disclaimer-btn {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(99,102,241,0.15) !important;
  border: 1px solid rgba(99,102,241,0.3) !important;
  color: #a5b4fc !important;
  padding: 5px 14px 5px 10px !important;
  border-radius: 20px !important;
  font-size: 0.72rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.disclaimer-btn:hover {
  background: rgba(99,102,241,0.2);
  border-color: rgba(99,102,241,0.5);
  color: #c7d2fe;
}
.disclaimer-btn svg { flex-shrink: 0; width: 14px; height: 14px; opacity: 0.7; }
.disclaimer-btn:hover svg { opacity: 1; }

.disclaimer-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.disclaimer-modal.hidden { display: none; }
.disclaimer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.disclaimer-content {
  position: relative;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.disclaimer-content h2 {
  color: #f1f5f9;
  font-size: 1.3rem;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid #334155;
}
.disclaimer-content h3 {
  color: #e2e8f0;
  font-size: 0.95rem;
  margin: 18px 0 6px 0;
}
.disclaimer-content p { margin: 0 0 12px 0; }
.disclaimer-content a { color: #60a5fa; text-decoration: none; }
.disclaimer-content a:hover { text-decoration: underline; }
.disclaimer-content strong { color: #f1f5f9; }
.disclaimer-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.disclaimer-close:hover { color: #f1f5f9; background: #334155; }
.disclaimer-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #334155;
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
}

@media (max-width: 900px) {
  .disclaimer-btn span { display: none; }
  .disclaimer-btn { padding: 6px 8px; }
  .disclaimer-btn svg { width: 16px; height: 16px; }
  .disclaimer-content { padding: 20px 16px; max-height: 85vh; }
  .disclaimer-content h2 { font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .disclaimer-content { width: 95%; padding: 16px 12px; border-radius: 8px; }
  .disclaimer-content h3 { font-size: 0.85rem; }
  .disclaimer-content p { font-size: 0.82rem; }
  .disclaimer-close { top: 8px; right: 10px; }
}
