:root {
  --bg: #f7f7f9; --surface: #ffffff; --line: #e7e7ec; --line-soft: #f0f0f3;
  --text: #16161a; --muted: #6b6b76; --faint: #9a9aa5;
  --side: #17171c; --side-text: #c9c9d1; --side-muted: #7c7c88; --side-hover: #24242b;
  --pink: #d63fae; --violet: #a855f7;
  --grad: linear-gradient(90deg, #d63fae 0%, #b45ce6 100%);
  --pink-soft: #fdf0f8; --violet-soft: #f5effe;
  --ok: #16a34a; --ok-soft: #ecfdf3; --warn: #b7791f; --warn-soft: #fffaeb; --bad: #dc2626; --bad-soft: #fef2f2;
  --blue-soft: #eef4ff; --blue: #3b6fd8;
  --radius: 12px; --side-w: 228px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--pink); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Barra lateral ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 22px 10px 14px; z-index: 5; }
.logo { display: flex; align-items: center; gap: 12px; padding: 4px 14px 26px; color: #fff; font-weight: 700; font-size: 21px; letter-spacing: 1.5px; text-decoration: none; }
.logo-x { width: 28px; height: 28px; }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--side-muted); text-transform: uppercase; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; margin: 1px 0; border: 0; border-radius: 8px; background: none; color: var(--side-text); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--grad); color: #fff; font-weight: 500; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid #26262d; }
.avatar { width: 30px; height: 30px; border-radius: 8px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.side-foot b { display: block; color: #fff; font-weight: 500; font-size: 13px; }
.side-foot small { color: var(--side-muted); font-size: 12px; }

/* ---------- Cabecera ---------- */
.wrap { margin-left: var(--side-w); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid transparent; border-image: linear-gradient(90deg, rgba(214,63,174,.45), rgba(180,92,230,.25)) 1; }
.search { display: flex; align-items: center; gap: 10px; width: min(380px, 100%); height: 38px; padding: 0 12px; background: #f6f6f8; border: 1px solid var(--line); border-radius: 8px; color: var(--faint); }
.search input { border: 0; background: none; padding: 0; margin: 0; height: 100%; outline: none; color: var(--text); }
.search kbd { font: 11px/1 inherit; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; background: #fff; }
.topbar .spacer { flex: 1; }
.env { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }

main { padding: 28px 30px 80px; max-width: 1440px; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- Cabecera de sección (tipo "Centro de mando") ---------- */
.hero { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-top: 2px solid transparent; border-radius: var(--radius); background-clip: padding-box; padding: 24px 24px 22px; margin-bottom: 18px; }
.hero::before { content: ""; position: absolute; inset: -2px 0 auto 0; height: 2px; background: var(--grad); opacity: .55; }
.hero::after { content: ""; position: absolute; right: -80px; top: -60px; width: 320px; height: 200px; background: radial-gradient(closest-side, rgba(214,63,174,.10), transparent); pointer-events: none; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.hero h1 { margin: 6px 0 8px; font-size: 24px; font-weight: 600; letter-spacing: -.2px; }
.hero p { margin: 0; color: var(--muted); }
.hero-actions { position: absolute; right: 22px; top: 22px; display: flex; gap: 8px; z-index: 1; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px -24px -22px; border-top: 1px solid var(--line); }
.hero-stats > div { padding: 18px 24px; border-right: 1px solid var(--line); }
.hero-stats > div:last-child { border-right: 0; background: var(--side); color: #fff; }
.hero-stats > div:last-child .eyebrow, .hero-stats > div:last-child small { color: #a1a1aa; }
.big { font-size: 26px; font-weight: 500; letter-spacing: -.4px; margin: 6px 0 2px; }
.hero-stats small { color: var(--muted); font-size: 12px; }

/* ---------- Tarjetas de métricas ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi-head { display: flex; justify-content: space-between; align-items: center; }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.kpi-ico.pink { background: var(--pink-soft); color: var(--pink); } .kpi-ico.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-ico.green { background: var(--ok-soft); color: var(--ok); } .kpi-ico.violet { background: var(--violet-soft); color: var(--violet); }
.kpi .big { font-size: 28px; margin-top: 10px; }
.kpi small { color: var(--muted); font-size: 12px; } .kpi small b { color: var(--text); font-weight: 500; }

/* ---------- Tarjetas genéricas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head small { color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: var(--pink-soft); color: var(--pink); }
.tag.live { background: var(--ok-soft); color: var(--ok); }
.cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.cols > .card { margin-bottom: 0; }
h2 { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }
.sub { color: var(--muted); margin: 0; }
small.sub { font-size: 12px; }

/* ---------- Formularios ---------- */
label { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
input, select, textarea { width: 100%; margin-top: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(214,63,174,.12); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.drop { display: block; border: 1.5px dashed #d9d9e0; border-radius: var(--radius); padding: 34px 16px; text-align: center; cursor: pointer; background: #fcfcfd; transition: .15s; color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--pink); background: var(--pink-soft); }
.drop input { display: none; }
.drop .kpi-ico { margin: 0 auto 10px; width: 40px; height: 40px; }
.drop-text { display: block; color: var(--text); font-size: 15px; font-weight: 500; }
.drop-hint { display: block; margin-top: 2px; font-size: 12px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: .12s; }
.opt:hover { border-color: #d6d6de; }
.opt:has(input:checked) { border-color: rgba(214,63,174,.55); background: #fffafd; box-shadow: 0 0 0 3px rgba(214,63,174,.06); }
.opt.fixed { cursor: default; background: #fafafb; }
.opt.unavailable { opacity: .5; }
.opt > input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--pink); flex: none; }
.opt b { color: var(--text); font-weight: 600; font-size: 14px; }
.opt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.opt > div { flex: 1; min-width: 0; }
.inline { margin-top: 10px; }
.form-foot { display: flex; justify-content: flex-end; margin-top: 18px; }

/* ---------- Botones ---------- */
button { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
button:hover { border-color: #cfcfd8; background: #fafafb; }
button.primary { background: var(--pink); background-image: var(--grad); border-color: transparent; color: #fff; padding: 10px 18px; }
button.primary:hover { filter: brightness(1.05); }
button:disabled { opacity: .55; cursor: wait; }
button svg.i { width: 15px; height: 15px; }

/* ---------- Estados y resultados ---------- */
.status { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--pink); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.verdict { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.verdict .kpi-ico { width: 36px; height: 36px; }
.verdict.confirmed { color: var(--ok); } .verdict.probable { color: var(--warn); } .verdict.not_found { color: var(--muted); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: #f3f3f6; color: var(--muted); margin: 2px 4px 2px 0; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.warn-box { background: var(--warn-soft); color: var(--warn); font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-top: 12px; }
.error { background: var(--bad-soft); color: var(--bad); padding: 12px 14px; border-radius: 8px; margin: 0 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.asset { cursor: pointer; }
.asset:hover td { background: #fafafb; }
.type { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.empty { text-align: center; padding: 30px; color: var(--muted); }

/* Actividad reciente */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.feed li:last-child { border-bottom: 0; }
.feed .kpi-ico { background: #f4f4f6; color: var(--muted); border: 1px solid var(--line); }
.feed .t { flex: 1; min-width: 0; }
.feed .t b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .t small { color: var(--muted); font-size: 12px; }
.feed .r { color: var(--muted); font-size: 12px; white-space: nowrap; }

pre { background: #fafafb; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; font-size: 12px; margin: 10px 0 0; }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); width: min(640px, 92vw); padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
dialog::backdrop { background: rgba(23,23,28,.45); }
dialog h3 { margin: 0 0 14px; }
dialog label { margin-bottom: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .side { position: static; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 2px; }
  .logo { padding: 4px 10px 4px 4px; font-size: 17px; }
  .logo-x { width: 22px; height: 22px; }
  .side-label, .side-foot { display: none; }
  .nav-item { width: auto; padding: 7px 10px; }
  .wrap { margin-left: 0; }
  .topbar { position: static; height: auto; padding: 12px 16px; }
  main { padding: 18px 16px 60px; }
  .options, .grid3, .hero-stats { grid-template-columns: 1fr; }
  .hero-stats > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-actions { position: static; margin-top: 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .env { display: none; }
}
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } }

/* Barras de uso */
.bar { margin: 4px 0 14px; }
.bar-l { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bar-l b { font-weight: 500; }
.bar-t { height: 8px; background: #f2f2f5; border-radius: 99px; overflow: hidden; }
.bar-f { height: 100%; background: var(--grad); border-radius: 99px; min-width: 2px; }

/* Ayudas en formularios y guía */
.hint { display: block; margin-top: 6px; font-size: 11.5px; font-weight: 400; line-height: 1.45; color: var(--faint); }
.hint code, .guide-dl code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; background: #f3f3f6; padding: 1px 5px; border-radius: 4px; color: var(--text); }
.more { font-size: 12px; font-weight: 500; color: var(--pink); text-decoration: none; white-space: nowrap; }
.more:hover { text-decoration: underline; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.guide-grid .card { margin-bottom: 0; }
.guide-title { display: flex; align-items: center; gap: 12px; }
.guide-dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; font-size: 13px; line-height: 1.55; }
.guide-dl dt { color: var(--muted); font-weight: 500; }
.guide-dl dd { margin: 0; }
.guide-summary tr[data-guide] { cursor: pointer; }
.guide-summary tr[data-guide]:hover td { background: #fafafb; }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; }
.steps li { margin-bottom: 6px; }
.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(214,63,174,.35); } 100% { box-shadow: none; } }
dt .more { margin-left: 4px; }
@media (max-width: 1100px) { .guide-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .guide-dl { grid-template-columns: 1fr; gap: 2px; } .guide-dl dd { margin-bottom: 10px; } }

/* Icono "?" y su explicación emergente */
.tip { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; border: 1px solid #d4d4dc; background: #fff; color: var(--muted); font: 600 10.5px/1 "Inter", sans-serif; letter-spacing: 0; text-transform: none; vertical-align: 1px; cursor: help; flex: none; user-select: none; }
.tip:hover, .tip:focus { outline: none; border-color: var(--pink); color: var(--pink); background: var(--pink-soft); }
.hero-stats > div:last-child .tip { background: transparent; color: #a1a1aa; border-color: #3f3f46; }
#tipbox { position: fixed; z-index: 100; max-width: min(300px, calc(100vw - 24px)); padding: 9px 12px; border-radius: 8px; background: var(--side); color: #f4f4f5; font-size: 12.5px; line-height: 1.5; box-shadow: 0 8px 24px rgba(0,0,0,.18); pointer-events: none; }
