@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --bg-side: #06111D;
  --bg-main: #050B13;
  --bg-card: #08131F;
  --bg-card2: #0B1B2B;
  --bg-hover: #0E2236;

  --green: #25E77A;
  --green-soft: rgba(37, 231, 122, 0.12);
  --cyan: #17D8F3;
  --cyan-soft: rgba(23, 216, 243, 0.12);
  --blue: #206BFF;
  --blue-soft: rgba(32, 107, 255, 0.14);
  --amber: #FBBF24;
  --red: #F87171;
  --violet: #A78BFA;

  --text-title: #EEF5FF;
  --text-sub: #9FB2C3;
  --text-count: #6E8799;

  --border: rgba(120, 190, 220, 0.11);
  --border-strong: rgba(120, 190, 220, 0.22);

  --radius: 16px;
  --radius-sm: 10px;
  --font-head: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg-main);
  color: var(--text-sub);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px at 12% -5%, rgba(34, 211, 238, 0.07), transparent 60%),
    radial-gradient(1000px at 95% 15%, rgba(34, 197, 94, 0.06), transparent 60%),
    radial-gradient(1000px at 50% 115%, rgba(34, 211, 238, 0.05), transparent 60%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #070C14; }
::-webkit-scrollbar-thumb { background: #16283B; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #22D3EE; }

h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); color: var(--text-title); font-weight: 800; line-height: 1.2; }
button { font-family: var(--font-body); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); color: var(--text-title); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.side {
  width: 256px;
  flex-shrink: 0;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.content {
  padding: 24px 28px 80px;
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0A2A2A, #0B1F38);
  border: 1px solid rgba(34, 211, 238, 0.45);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; color: var(--cyan); font-size: 1rem;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.25), inset 0 0 12px rgba(34, 211, 238, 0.15);
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute; inset: 3px;
  border-radius: 9px;
  border: 1px dashed rgba(34, 211, 238, 0.35);
}
.brand-name { font-family: var(--font-head); font-weight: 800; letter-spacing: 1.5px; font-size: 0.98rem; color: var(--text-title); }
.brand-sub { font-size: 0.72rem; color: var(--text-count); font-family: var(--font-mono); letter-spacing: 0.4px; }

.side-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 10px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition, all 0.25s);
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-title); }
.nav-item.active {
  background: linear-gradient(90deg, var(--cyan-soft), transparent);
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.25);
}
.nav-item .nav-icon { display: grid; place-items: center; width: 20px; }

.side-foot { padding: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.lock-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(34, 197, 94, 0.07);
  border: 1px solid rgba(34, 197, 94, 0.18);
  font-size: 0.76rem;
  color: var(--green);
}
.lock-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 2s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 12, 20, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 25;
  flex-wrap: wrap;
}
.topbar-title h1 { font-size: 1.15rem; letter-spacing: 0.5px; }
.topbar-title p { font-size: 0.74rem; color: var(--text-count); font-family: var(--font-mono); margin-top: 2px; }

.topbar-controls { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 230px;
}
.search-box .mag { color: var(--text-count); display: grid; place-items: center; }
.search-box input { background: transparent; border: none; outline: none; width: 100%; font-size: 0.85rem; }

.select-ctl {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.82rem;
  color: var(--text-sub);
  outline: none;
}
.select-ctl:focus { border-color: var(--cyan); }

.range-ctl { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; color: var(--text-count); font-family: var(--font-mono); }
.range-ctl input[type=range] { width: 90px; accent-color: var(--cyan); }

.btn {
  background: linear-gradient(135deg, var(--cyan), #0EA5B7);
  color: #04151c;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.15s ease, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.25);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(34, 211, 238, 0.35); }
.btn.ghost { background: transparent; color: var(--text-sub); border: 1px solid var(--border-strong); box-shadow: none; }
.btn.ghost:hover { color: var(--text-title); border-color: var(--cyan); }
.btn.quick-new {
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: #04110a;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}
.btn.quick-new:hover { box-shadow: 0 6px 22px rgba(34, 197, 94, 0.42); }

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: var(--text-count);
  transition: all 0.2s;
}
.icon-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ============================================================
   SVG ICONS  (fix iconos negros)
   ============================================================ */
.ico {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.nav-icon .ico { width: 19px; height: 19px; }
.kpi-icon .ico { width: 18px; height: 18px; }
.icon-btn .ico { width: 18px; height: 18px; }
.search-box .mag .ico { width: 16px; height: 16px; display: block; }
.to-top .ico { width: 20px; height: 20px; }
.gate-lock .ico { width: 26px; height: 26px; color: var(--cyan); }
.eye .ico { width: 18px; height: 18px; display: block; }

.user-chip {
  font-size: 0.72rem;
  color: var(--text-count);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}

/* ============================================================
   TICKER
   ============================================================ */
.ticker {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}
.ticker::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--cyan), var(--green));
}
.live-tag {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan);
  letter-spacing: 1px;
  flex-shrink: 0;
}
.live-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: blink 1.4s infinite; }
.ticker-msg { font-size: 0.86rem; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-msg.pulse { animation: feedPulse 0.6s ease; }
@keyframes feedPulse { 0% { opacity: 0.2; transform: translateY(3px); } 100% { opacity: 1; } }

/* ============================================================
   KPIs
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s;
}
.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.kpi-card::after {
  content: '';
  position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px;
  background: radial-gradient(circle, var(--cyan-soft), transparent 70%);
  opacity: 0.5;
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 0.76rem; color: var(--text-count); text-transform: uppercase; letter-spacing: 0.8px; font-family: var(--font-mono); }
.kpi-icon { color: var(--cyan); }
.kpi-value { font-family: var(--font-head); font-weight: 900; font-size: 2rem; color: var(--text-title); }
.kpi-value.cyan { color: var(--cyan); }
.kpi-delta { font-size: 0.76rem; margin-top: 6px; }
.kpi-delta .pill { background: var(--bg-card2); border: 1px solid var(--border); padding: 3px 9px; border-radius: 999px; font-size: 0.7rem; color: var(--text-count); }
.kpi-delta b { color: var(--green); }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.sec-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 16px;
}
.sec-index {
  font-family: var(--font-mono);
  color: var(--cyan);
  font-size: 0.8rem;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 8px;
  padding: 4px 9px;
  letter-spacing: 1px;
}
.sec-head h2 { font-size: 1.25rem; letter-spacing: 0.5px; }
.sec-head .sub { font-size: 0.78rem; color: var(--text-count); margin-top: 3px; }
.sec-head .spacer { flex: 1; }
.sec-count { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-count); }

/* ============================================================
   MATRIX 2x2
   ============================================================ */
.matrix-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}
.matrix-card::before {
  content: 'RADAR';
  position: absolute;
  top: 14px; right: 20px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 3px;
  color: var(--cyan);
  opacity: 0.5;
}
.matrix-wrap { margin-top: 6px; }
.matrix-svg { width: 100%; height: auto; display: block; }
.mat-bubble { transition: opacity 0.2s; }
.mat-bubble:hover { opacity: 1; }
.mat-ping { animation: ping 1.6s ease-out infinite; transform-origin: center; }
@keyframes ping { 0% { opacity: 0.9; } 100% { opacity: 0; transform: scale(1.6); } }
.mat-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 0.74rem; color: var(--text-count); flex-wrap: wrap; }
.mat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mat-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ============================================================
   GALLERY
   ============================================================ */
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.78rem;
  color: var(--text-sub);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}
.chip i { font-style: normal; font-family: var(--font-mono); color: var(--text-count); font-size: 0.7rem; }
.chip:hover { border-color: var(--cyan); color: var(--text-title); }
.chip.on { background: var(--cyan-soft); border-color: var(--cyan); color: var(--cyan); }
.chip.on i { color: var(--cyan); }

.offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover, .card.sel-card {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(34, 211, 238, 0.12);
}
.card:hover::before, .card.sel-card::before { opacity: 1; }
.card.sel-card { box-shadow: 0 0 0 1px var(--cyan), 0 14px 34px rgba(0, 0, 0, 0.45); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.stb {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-count);
}
.stb.new { color: var(--green); border-color: rgba(34, 197, 94, 0.35); background: var(--green-soft); }
.stb.watched { color: var(--cyan); border-color: rgba(34, 211, 238, 0.35); background: var(--cyan-soft); }
.niche-chip { font-size: 0.72rem; color: var(--text-sub); }
.price-tag {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--amber);
  background: rgba(251, 191, 36, 0.09);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 9px;
  padding: 4px 10px;
  white-space: nowrap;
}
.card-title { font-size: 1.02rem; line-height: 1.25; }
.card-url {
  font-size: 0.72rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}
.card-url:hover { text-decoration: underline; }
.det-link { color: var(--cyan); text-decoration: none; word-break: break-all; }
.det-link:hover { text-decoration: underline; }
.panel-url { font-size: 0.7rem; color: var(--cyan); font-family: var(--font-mono); word-break: break-all; margin-bottom: 14px; text-decoration: none; display: inline-block; }
.panel-url:hover { text-decoration: underline; }
.note-link {
  font-size: 0.72rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}
.note-link:hover { text-decoration: underline; }

.card-body { display: flex; gap: 14px; align-items: center; }
.score-ring {
  --p: 50; --c: var(--cyan);
  width: 74px; height: 74px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(140, 176, 190, 0.12) 0);
  position: relative;
}
.score-ring::before {
  content: '';
  position: absolute; inset: 7px;
  border-radius: 50%;
  background: var(--bg-card);
}
.score-ring-in { position: relative; text-align: center; }
.score-ring-in b { display: block; font-family: var(--font-head); font-size: 1.45rem; color: var(--text-title); line-height: 1; }
.score-ring-in span { font-size: 0.58rem; letter-spacing: 1.5px; color: var(--text-count); font-family: var(--font-mono); }

.card-meta { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.meta-row { display: grid; grid-template-columns: 72px 34px 1fr; align-items: center; gap: 8px; font-size: 0.74rem; }
.meta-row span { color: var(--text-count); }
.meta-row b { font-size: 0.8rem; color: var(--text-title); font-family: var(--font-mono); }
.meta-row b.angle { color: var(--violet); font-family: var(--font-body); font-size: 0.74rem; }
.mini-track { height: 4px; background: rgba(140, 176, 190, 0.1); border-radius: 999px; overflow: hidden; }
.mini-track i { display: block; height: 100%; background: var(--green); border-radius: 999px; }

.card-insights { display: flex; flex-direction: column; gap: 8px; }
.ins { display: flex; gap: 9px; align-items: flex-start; }
.ins-k {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--cyan);
  background: var(--cyan-soft);
  border-radius: 5px;
  padding: 2px 6px;
  margin-top: 1px;
  flex-shrink: 0;
}
.ins p { font-size: 0.79rem; color: var(--text-sub); line-height: 1.45; }

.card-skills { display: flex; gap: 6px; flex-wrap: wrap; }
.skill-chip {
  --c: var(--cyan);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(140, 176, 190, 0.07);
  border: 1px solid rgba(140, 176, 190, 0.14);
  color: var(--text-sub);
}
.skill-chip i { font-style: normal; font-family: var(--font-mono); color: var(--c); }
.skill-chip.more { color: var(--text-count); }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.scanned { font-size: 0.68rem; color: var(--text-count); font-family: var(--font-mono); }
.card-actions { display: flex; gap: 6px; }
.btn-mini {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-sub);
  padding: 6px 9px;
  font-size: 0.72rem;
  transition: all 0.2s;
}
.btn-mini:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-mini.on { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }

.empty-state { grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--text-count); font-size: 0.9rem; }

/* ============================================================
   SKILLS GRID
   ============================================================ */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color 0.2s;
}
.skill-card:hover { border-color: var(--border-strong); }
.skill-ico {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.skill-txt h4 { font-size: 0.88rem; margin-bottom: 3px; }
.skill-txt p { font-size: 0.74rem; color: var(--text-count); line-height: 1.45; }
.skill-uses { font-family: var(--font-mono); font-size: 0.64rem; color: var(--cyan); margin-left: auto; white-space: nowrap; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 60;
  padding: 40px 18px;
  overflow-y: auto;
}
.modal.open { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--bg-card2);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 1.02rem; }
.modal-head .sub { font-size: 0.74rem; color: var(--text-count); font-family: var(--font-mono); margin-top: 3px; }

.modal-body { padding: 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.72rem; color: var(--text-count); text-transform: uppercase; letter-spacing: 0.7px; font-family: var(--font-mono); }
.field input, .field select, .field textarea {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cyan); }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* Detail modal */
#detail-modal .modal-card { max-width: 760px; }
.det-body { padding: 20px; }
.det-head { display: flex; gap: 18px; justify-content: space-between; align-items: flex-start; }
.det-kicker { font-family: var(--font-mono); font-size: 0.7rem; color: var(--cyan); letter-spacing: 0.6px; margin-bottom: 6px; }
.det-head h2 { font-size: 1.3rem; }
.det-hook {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-sub);
  font-style: italic;
  background: var(--bg-main);
  border-left: 3px solid var(--cyan);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
}
.det-score {
  --p: 50; --c: var(--cyan);
  width: 96px; height: 96px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(140, 176, 190, 0.12) 0);
  position: relative;
}
.det-score::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--bg-card2); }
.det-score .score-ring-in b { font-size: 1.8rem; }

.det-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.det-stat {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
}
.det-stat span { display: block; font-size: 0.66rem; color: var(--text-count); text-transform: uppercase; letter-spacing: 0.7px; font-family: var(--font-mono); margin-bottom: 4px; }
.det-stat b { font-size: 0.86rem; color: var(--text-title); font-family: var(--font-mono); }

.det-trigs {
  display: flex; align-items: center; gap: 10px;
  background: var(--green-soft);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 9px;
  padding: 9px 12px;
  margin-bottom: 6px;
}
.det-trigs .lbl { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 1px; color: var(--green); }
.det-trigs .val { font-size: 0.78rem; color: var(--text-sub); }

.det-sec { font-size: 0.95rem; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.det-skill { padding: 11px 0; border-bottom: 1px dashed var(--border); }
.det-skill:last-of-type { border-bottom: none; }
.det-skill-head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.sk-ico { font-size: 1rem; }
.det-skill-head b { font-size: 0.85rem; }
.sk-conf { margin-left: auto; font-family: var(--font-mono); font-size: 0.74rem; }
.det-skill p { font-size: 0.8rem; color: var(--text-sub); line-height: 1.5; }
.sk-bar { height: 4px; background: rgba(140, 176, 190, 0.1); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.sk-bar i { display: block; height: 100%; border-radius: 999px; }

.det-plan { display: flex; flex-direction: column; gap: 8px; }
.plan-row { display: flex; gap: 10px; align-items: flex-start; }
.plan-row span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 6px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.plan-row p { font-size: 0.8rem; color: var(--text-sub); line-height: 1.5; }

.det-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.det-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   TOAST / TOP
   ============================================================ */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #0D1A29;
  border: 1px solid var(--border-strong);
  color: var(--text-title);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  z-index: 80;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--bg-card2);
  border: 1px solid var(--border-strong);
  color: var(--cyan);
  display: grid; place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: all 0.25s;
  z-index: 40;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { border-color: var(--cyan); }

/* ============================================================
   NOTES / LIBRARY
   ============================================================ */
.notetaker-composer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.notetaker-composer input, .notetaker-composer textarea {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 0.88rem;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}
.notetaker-composer input:focus, .notetaker-composer textarea:focus { border-color: var(--cyan); }
.notetaker-composer textarea { min-height: 90px; resize: vertical; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-hint { font-size: 0.7rem; color: var(--text-count); font-family: var(--font-mono); }

.note-list { display: flex; flex-direction: column; gap: 8px; }
.note-date-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  color: var(--cyan);
  margin: 14px 0 2px;
}
.note-date-head::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.note-date-head i { font-style: normal; color: var(--text-count); background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.note-time { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-count); }
.note-bigdate { display: flex; align-items: baseline; gap: 7px; }
.note-bigdate .nd-day { font-family: var(--font-mono); font-weight: 800; font-size: 0.82rem; color: var(--cyan); letter-spacing: 1px; }
.note-bigdate .nd-date { font-size: 0.76rem; color: var(--text-count); font-family: var(--font-mono); }
.note-bigdate .nd-time { font-size: 1rem; font-weight: 800; color: var(--text-title); font-family: var(--font-mono); }
.note-card .note-top { justify-content: space-between; }

.notes-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.notes-toolbar .btn { margin-left: auto; }
.notes-toolbar .sec-count { font-size: 0.76rem; }

.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.22s ease, border-color 0.22s, box-shadow 0.25s;
}
.note-card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.note-card.is-win { border-color: rgba(34, 197, 94, 0.45); background: linear-gradient(180deg, var(--bg-card), rgba(34, 197, 94, 0.05)); }
.note-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.win-badge { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.1); color: var(--amber); }
.note-ai { display: flex; gap: 12px; align-items: center; background: rgba(140, 176, 190, 0.05); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.note-score {
  --p: 50; --c: var(--cyan);
  width: 58px; height: 58px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(140, 176, 190, 0.12) 0);
  position: relative;
}
.note-score::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg-card); }
.note-score .score-ring-in b { font-size: 1.15rem; }
.note-score .score-ring-in span { font-size: 0.52rem; }
.note-ai-meta { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.note-ai-row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.72rem; }
.note-ai-row span { color: var(--text-count); }
.note-ai-row b { color: var(--text-title); font-family: var(--font-mono); font-weight: 600; font-size: 0.74rem; text-align: right; }
.note-insight { display: flex; gap: 8px; align-items: flex-start; }
.note-insight p { font-size: 0.76rem; color: var(--text-sub); line-height: 1.45; }
.win-callout {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--amber);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 14px 0;
}
.note-view-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   MATRIX DE INTELIGENCIA · GRAPH
   ============================================================ */
#matriz { margin-top: 6px; }
.matrix-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 24px 0 16px; }
.matrix-head h2 { font-size: 1.3rem; }
.matrix-head .sub { font-size: 0.8rem; color: var(--text-count); margin-top: 4px; }
.matrix-head .view-switch { margin-left: auto; display: flex; gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.view-btn {
  background: transparent; border: none; color: var(--text-sub);
  padding: 8px 12px; font-size: 0.78rem; border-radius: 8px; font-weight: 600;
  transition: all 0.2s;
}
.view-btn:hover { color: var(--text-title); }
.view-btn.on { background: var(--blue-soft); color: #7FB0FF; box-shadow: inset 0 0 0 1px rgba(32, 107, 255, 0.4); }
.gold-btn { background: linear-gradient(135deg, #F59E0B, #B45309); color: #1c1200; }
.gold-btn.active { box-shadow: 0 0 22px rgba(245, 158, 11, 0.5); }

.graph-wrap { position: relative; background: #04090F; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; height: 720px; }
.graph-wrap.hidden { display: none; }
.graph-canvas { position: absolute; inset: 0; cursor: grab; }
.graph-canvas:active { cursor: grabbing; }
.graph-svg { display: block; }
.graph-svg line, .graph-svg text { user-select: none; }
.g-ping { animation: gPing 1.8s ease-out infinite; transform-origin: center; }
@keyframes gPing { 0% { opacity: 0.9; } 100% { opacity: 0; transform: scale(1.5); } }

.graph-controls {
  position: absolute; right: 14px; top: 14px;
  display: flex; flex-direction: column; gap: 6px; z-index: 5;
}
.graph-controls button {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--bg-card2); border: 1px solid var(--border-strong);
  color: var(--cyan); font-size: 1.05rem; font-weight: 800;
  transition: all 0.2s;
}
.graph-controls button:hover { border-color: var(--cyan); box-shadow: 0 0 12px rgba(23, 216, 243, 0.25); }

.graph-legend {
  position: absolute; left: 14px; bottom: 12px; z-index: 5;
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 0.68rem; color: var(--text-count);
  background: rgba(5, 11, 19, 0.7); padding: 7px 11px; border-radius: 9px;
  border: 1px solid var(--border); backdrop-filter: blur(4px);
}
.graph-legend span { display: inline-flex; align-items: center; gap: 5px; }
.graph-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.graph-legend .dash { font-family: var(--font-mono); }
.graph-legend .kw-hint { color: var(--cyan); }

.graph-tooltip {
  position: absolute; z-index: 20; pointer-events: none;
  max-width: 260px; padding: 10px 12px;
  background: #0B1B2B; border: 1px solid var(--border-strong);
  border-radius: 10px; font-size: 0.76rem; color: var(--text-sub);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  opacity: 0; transition: opacity 0.15s;
}
.graph-tooltip.show { opacity: 1; }

.gold-overlay {
  position: absolute; right: 14px; bottom: 52px; z-index: 6;
  width: 320px; max-height: 60%; overflow-y: auto;
  background: rgba(5, 11, 19, 0.92); border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px; padding: 14px; backdrop-filter: blur(6px);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.15);
}
.gold-overlay.hidden { display: none; }
.gold-title { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 1.5px; color: #FBBF24; margin-bottom: 10px; }
.gold-item { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.gold-item:last-child { border-bottom: none; }
.gold-item span { font-size: 0.72rem; font-weight: 800; color: #25E77A; text-transform: uppercase; letter-spacing: 0.5px; }
.gold-item p { font-size: 0.76rem; color: var(--text-sub); margin-top: 3px; line-height: 1.45; }

/* Panel lateral */
.intel-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 55;
  width: 400px; max-width: 92vw;
  background: var(--bg-card2); border-left: 1px solid var(--border-strong);
  transform: translateX(105%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto; box-shadow: -20px 0 60px rgba(0, 0, 0, 0.55);
}
.intel-panel.open { transform: none; }
.panel-body { padding: 18px; }
.panel-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-status { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 1.5px; border: 1px solid; border-radius: 6px; padding: 4px 9px; }
.panel-close {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-count);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.74rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.panel-close:hover { color: var(--red); border-color: var(--red); }
.panel-body h3 { font-size: 1.15rem; margin-bottom: 4px; }
.panel-img img { width: 100%; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 12px; }
.panel-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.ps { background: var(--bg-main); border: 1px solid var(--border); border-radius: 10px; padding: 9px; text-align: center; }
.ps span { display: block; font-size: 0.6rem; color: var(--text-count); text-transform: uppercase; letter-spacing: 0.5px; font-family: var(--font-mono); margin-bottom: 3px; }
.ps b { font-size: 1.05rem; font-family: var(--font-mono); color: var(--text-title); }
.panel-ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.pf-row { background: var(--bg-main); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; }
.pf-row span { display: block; font-size: 0.62rem; color: var(--text-count); text-transform: uppercase; letter-spacing: 0.5px; font-family: var(--font-mono); margin-bottom: 2px; }
.pf-row b { font-size: 0.76rem; color: var(--text-title); font-weight: 600; }
.panel-sec { font-size: 0.76rem; font-weight: 800; color: var(--cyan); text-transform: uppercase; letter-spacing: 1px; margin: 16px 0 8px; }
.panel-signals { display: flex; flex-wrap: wrap; gap: 6px; }
.panel-signals .sig { font-size: 0.68rem; color: var(--green); background: var(--green-soft); border: 1px solid rgba(37, 231, 122, 0.25); padding: 4px 8px; border-radius: 6px; }
.panel-links { display: flex; flex-direction: column; gap: 5px; }
.panel-links a { font-size: 0.74rem; color: var(--cyan); text-decoration: none; word-break: break-all; }
.panel-links a:hover { text-decoration: underline; }
.panel-ins { display: flex; flex-direction: column; gap: 7px; }
.panel-next { background: var(--blue-soft); border: 1px solid rgba(32, 107, 255, 0.3); color: #AFCBFF; font-size: 0.8rem; border-radius: 9px; padding: 10px 12px; line-height: 1.5; }
.ai-resumen {
  background: linear-gradient(135deg, rgba(37, 231, 122, 0.08), rgba(23, 216, 243, 0.06));
  border: 1px solid rgba(37, 231, 122, 0.25);
  color: var(--text-sub);
  font-size: 0.88rem;
  line-height: 1.6;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 4px;
}
.panel-ai .det-sec { margin-top: 16px; }
.panel-ai .det-sec:first-child { margin-top: 0; }
.panel-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 18px; }
.mini-cta { padding: 8px 11px; font-size: 0.74rem; }
.panel-gen { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.gen-row { display: flex; gap: 8px; font-size: 0.76rem; color: var(--text-sub); background: var(--bg-main); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.gen-row span { color: var(--cyan); font-family: var(--font-mono); font-size: 0.68rem; }

/* Patrones */
.patterns-grid { padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.pat-card:hover { border-color: rgba(37, 231, 122, 0.35); }
.pat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.pat-head span { font-size: 0.82rem; font-weight: 800; color: var(--text-title); }
.pat-head b { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 1px; color: var(--green); border: 1px solid rgba(37, 231, 122, 0.3); border-radius: 6px; padding: 3px 7px; }
.pat-card p { font-size: 0.78rem; color: var(--text-sub); line-height: 1.5; }

/* cards ofertas mejoradas */
.card-topline {
  font-size: 0.76rem;
  color: var(--text-sub);
  line-height: 1.5;
  background: rgba(23, 216, 243, 0.05);
  border-left: 2px solid var(--cyan);
  border-radius: 0 8px 8px 0;
  padding: 7px 10px;
}
.card-line { display: flex; gap: 8px; font-size: 0.76rem; }
.card-line span { color: var(--text-count); font-family: var(--font-mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.5px; flex-shrink: 0; padding-top: 1px; }
.card-line p { color: var(--text-sub); line-height: 1.4; }
.card-signals { display: flex; flex-wrap: wrap; gap: 5px; }
.card-signals span { font-size: 0.64rem; color: var(--green); background: var(--green-soft); border: 1px solid rgba(37, 231, 122, 0.2); border-radius: 5px; padding: 2px 7px; }

/* formulario oferta */
.modal-lg { max-width: 860px; }
.link-row { margin-bottom: 4px; }
.link-actions { display: flex; gap: 8px; }
.link-actions input { flex: 1; }
.ck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.ck { display: flex; align-items: center; gap: 6px; font-size: 0.74rem; color: var(--text-sub); background: var(--bg-main); border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px; cursor: pointer; }
.ck input { accent-color: var(--cyan); }
.note-ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ficha-row { background: var(--bg-main); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; }
.ficha-row span { display: block; font-size: 0.64rem; color: var(--text-count); text-transform: uppercase; letter-spacing: 0.6px; font-family: var(--font-mono); margin-bottom: 3px; }
.ficha-row b { font-size: 0.82rem; color: var(--text-title); font-weight: 600; }
.note-avatar { display: grid; grid-template-columns: 1fr; gap: 8px; background: var(--bg-main); border: 1px solid rgba(251, 191, 36, 0.2); border-radius: 10px; padding: 12px; }
.avatar-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.78rem; }
.avatar-row span { color: var(--text-count); flex-shrink: 0; }
.avatar-row b { color: var(--text-sub); font-weight: 500; text-align: right; }
.note-badges { font-size: 0.66rem; color: var(--cyan); font-family: var(--font-mono); letter-spacing: 0.4px; }
.note-thumb { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.note-thumb img { width: 100%; max-height: 150px; object-fit: cover; display: block; }
.note-card h4 { font-size: 0.98rem; line-height: 1.3; }
.note-preview { font-size: 0.8rem; color: var(--text-sub); line-height: 1.45; }
.note-link {
  font-size: 0.72rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto; }
.note-foot > span { font-size: 0.66rem; color: var(--text-count); font-family: var(--font-mono); }
.note-actions { display: flex; gap: 5px; }
.btn-mini.danger:hover { border-color: var(--red); color: var(--red); }

.note-view-title { margin-bottom: 16px; }
.note-view-title h3 { font-size: 1.3rem; margin-bottom: 6px; }
.note-view-img { margin: 14px 0; }
.note-view-img img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.note-view-text { font-size: 0.9rem; color: var(--text-sub); line-height: 1.65; background: var(--bg-main); border-radius: 10px; padding: 14px; margin: 14px 0; white-space: pre-wrap; }
.note-view-doc { margin: 14px 0; }
.note-view-doc a {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--cyan-soft);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--cyan);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  text-decoration: none;
  font-weight: 600;
}
.note-view-doc a:hover { border-color: var(--cyan); }
.note-view-link { display: flex; flex-direction: column; gap: 4px; margin: 14px 0; font-size: 0.78rem; }
.note-view-link span { color: var(--text-count); }
.note-view-link a { color: var(--cyan); word-break: break-all; }
.note-view-foot { margin-top: 18px; font-size: 0.7rem; color: var(--text-count); font-family: var(--font-mono); }

/* ============================================================
   GATE LOGIN
   ============================================================ */
.gate-field { text-align: left; margin-bottom: 12px; }
.gate-field label { display: block; font-size: 0.72rem; color: var(--text-count); text-transform: uppercase; letter-spacing: 0.7px; font-family: var(--font-mono); margin-bottom: 6px; }
.gate-field > input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.9rem;
  outline: none;
}
.gate-field > input:focus { border-color: var(--cyan); }
.gate-field .gate-input { display: flex; align-items: center; gap: 8px; background: var(--bg-main); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; }
.gate-field .gate-input:focus-within { border-color: var(--cyan); }
.gate-field .gate-input input { flex: 1; background: transparent; border: none; outline: none; padding: 12px 0; font-size: 0.9rem; }

/* ============================================================
   CHATBOT
   ============================================================ */
.chat-fab {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), #16a34a);
  border: 1px solid rgba(37, 231, 122, 0.5);
  color: #04110a;
  font-size: 1.4rem;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 26px rgba(37, 231, 122, 0.35);
  z-index: 70;
  transition: transform 0.2s;
}
.chat-fab:hover { transform: scale(1.08); }
.chat-panel {
  position: fixed;
  left: 24px;
  bottom: 90px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 130px);
  background: var(--bg-card2);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 75;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-main);
}
.chat-head-txt b { font-size: 0.95rem; display: block; }
.chat-head-txt span { font-size: 0.68rem; color: var(--text-count); font-family: var(--font-mono); }
.chat-close { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-count); width: 28px; height: 28px; border-radius: 8px; }
.chat-close:hover { color: var(--red); border-color: var(--red); }
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--blue-soft);
  border: 1px solid rgba(32, 107, 255, 0.3);
  color: #cfe0ff;
  border-bottom-right-radius: 4px;
}
.chat-msg.ai {
  align-self: flex-start;
  background: var(--bg-main);
  border: 1px solid var(--border);
  color: var(--text-sub);
  border-bottom-left-radius: 4px;
}
.chat-msg.typing::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  margin-left: 6px;
  animation: blink 1s infinite;
}
.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
}
.chat-input input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.84rem;
  outline: none;
}
.chat-input input:focus { border-color: var(--cyan); }
.chat-input .btn { padding: 10px 14px; }

/* ============================================================
   GATE
   ============================================================ */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(700px at 50% 0%, rgba(34, 211, 238, 0.08), transparent 60%),
    #070C14;
  display: grid;
  place-items: center;
  padding: 20px;
}
.gate.hidden { display: none; }
.gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.gate-lock {
  width: 54px; height: 54px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--cyan-soft);
  border: 1px solid rgba(34, 211, 238, 0.35);
  display: grid; place-items: center;
  color: var(--cyan);
  font-size: 1.4rem;
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.2);
}
.gate-card h2 { font-size: 1.25rem; margin-bottom: 6px; }
.gate-card .sub { font-size: 0.82rem; color: var(--text-count); margin-bottom: 20px; }
.gate-input { display: flex; align-items: center; gap: 8px; background: var(--bg-main); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; margin-bottom: 12px; }
.gate-input input { flex: 1; background: transparent; border: none; outline: none; padding: 12px 0; font-size: 0.92rem; letter-spacing: 2px; }
.gate-input .eye { background: none; border: none; color: var(--text-count); display: grid; place-items: center; }
.gate-input .eye .eye-off { display: none; }
.gate-input .eye.off .eye-on { display: none; }
.gate-input .eye.off .eye-off { display: block; }
.gate-btn { width: 100%; }
.gate-error { color: var(--red); font-size: 0.78rem; margin-top: 10px; min-height: 18px; }
.gate-shake { animation: shake 0.4s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }

/* App hidden until unlocked */
.app-shell { opacity: 0; transition: opacity 0.4s ease; }
.app-shell.unlocked { opacity: 1; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .side { width: 220px; }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.3s ease; width: 260px; }
  .side.open { transform: none; }
  .topbar { padding: 14px 16px; }
  .topbar-controls { margin-left: 0; width: 100%; }
  .content { padding: 16px 14px 70px; }
  .search-box { flex: 1; min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .det-stats { grid-template-columns: 1fr 1fr; }
  .note-ficha { grid-template-columns: 1fr; }
  .card-body { flex-direction: row; }
}
