/* Kaliope: misma familia visual que Pandora AI Video (tema oscuro, acento carmesí,
   cabecera pegada, tarjetas con borde y chips con led). */

:root {
  --bg: #0f1117;
  --panel: #171a22;
  --panel-2: #1e2230;
  --border: #272c3a;
  --text: #eef1f7;
  --muted: #98a1b4;
  --accent: #ff2d55;
  --ok: #2ecc71;
  --warn: #ffb300;
  --err: #ff6b81;
  --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

* { scrollbar-color: #3a4152 transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #3a4152; border-radius: 8px; border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #4b5468; background-clip: content-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.ok-text { color: var(--ok); }
.error-text { color: var(--err); }

code {
  background: #0b0d12; border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-size: 12px;
}

/* ---------- cabecera ---------- */

.top { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--border); }

.menu {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 14px; background: rgba(11, 13, 18, .96); backdrop-filter: blur(8px);
}

.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: .3px; font-size: 13.5px; flex: 0 0 auto;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; display: block; flex: 0 0 auto;
  color: var(--accent);
}

.menu-items { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.menu-items a {
  padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--muted);
}
.menu-items a:hover { color: var(--text); background: rgba(255, 255, 255, .05); text-decoration: none; }
.menu-items a.activo { color: var(--text); background: var(--panel-2); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 12px; white-space: nowrap;
}
.chip strong { color: var(--text); font-weight: 600; }
.chip .led { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: 0 0 auto; }
.chip:hover { border-color: var(--muted); text-decoration: none; }

/* menú de usuario */
.usermenu { position: relative; }
.usermenu summary {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; list-style: none;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { border-color: var(--border); background: var(--panel-2); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
}
.uname { font-size: 13px; color: var(--text); }

.um-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px; display: grid; gap: 2px; z-index: 20;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.um-panel a, .um-panel button {
  text-align: left; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: var(--text); background: none; border: none; width: 100%;
  font-weight: 500;
}
.um-panel a:hover, .um-panel button:hover {
  background: var(--panel-2); text-decoration: none;
}
.um-panel .separator { height: 1px; background: var(--border); margin: 4px 2px; }
.um-panel .danger:hover { color: var(--err); }

/* conmutador de espacio */
.tenants { display: grid; gap: 2px; }
.tenants .label {
  padding: 6px 10px 2px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.tenants button {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.tenants button.current { color: var(--accent); font-weight: 600; }
.tenants small { color: var(--muted); font-weight: 400; }

/* ---------- estructura ---------- */

.um-account { display: grid; gap: 4px; padding: 8px 10px; }
.um-account .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.um-link { display: block; margin-top: 6px; padding: 7px 9px; border-radius: 8px; background: var(--panel-2); }
.um-link:hover { text-decoration: none; background: rgba(255,255,255,.06); }

.sitebar, .subbar { border-bottom: 1px solid var(--border); background: var(--panel); }
.subbar { background: rgba(255,255,255,.015); }
.sitebar-in { padding: 8px 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-title { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; }
.site-title:hover { text-decoration: none; color: var(--accent); }
.sitebar .range { flex-wrap: wrap; }
.sitebar-sub { border-top: 1px solid var(--border); background: rgba(255,255,255,.02); }
.sitebar-sub .range { padding: 6px 14px; }
.sitebar-sub .chip { font-size: 12px; padding: 4px 10px; }

main {
  margin: 0; padding: 22px 24px; display: grid; gap: 18px; min-width: 0;
  /* Sin esto, las filas automáticas se reparten el alto de la ventana y las
     cajas quedan separadas por huecos enormes. */
  align-content: start;
}
@media (min-width: 1700px) { main { padding: 26px 36px; } }

footer {
  padding: 0 24px 28px; color: var(--muted); font-size: 12px;
}

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.hero p { margin: 0; max-width: 92ch; }

/* ---------- tarjetas ---------- */

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: grid; gap: 12px; min-width: 0;
}
.card h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card.narrow { max-width: 460px; margin: 40px auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; min-width: 0; }
.grid > * { min-width: 0; }

/* métricas de cabecera */
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; min-width: 150px;
}
.stat strong { display: block; font-size: 24px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 12px; }

/* serie dibujada en SVG, sin ejes */
.spark { width: 100%; height: 48px; display: block; margin-top: 10px; }
.stat .spark { margin-top: 12px; }
.stat span { display: block; }
.stat strong { margin-top: 2px; }

.range { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.activo { border-color: var(--accent); color: var(--text); }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

table.compact th, table.compact td { padding: 7px 6px; font-size: 12.5px; }
table.compact .badge { font-size: 10.5px; padding: 2px 7px; }

.ellipsis { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Las tablas anchas se desplazan dentro de su tarjeta, nunca la página. */
.tablewrap { overflow-x: auto; }
.tablewrap table { min-width: 640px; }

pre.mono {
  background: #0b0d12; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; overflow-x: auto; margin: 0;
}

/* ---------- etiquetas ---------- */

.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.badge.ok { color: var(--ok); border-color: rgba(46, 204, 113, .35); }
.badge.warn { color: var(--warn); border-color: rgba(255, 179, 0, .35); }
.badge.err { color: var(--err); border-color: rgba(255, 107, 129, .35); }

/* ---------- formularios ---------- */

label, .field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
label > span { font-weight: 600; color: #cfd6e4; }

input, select, textarea {
  font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(255, 45, 85, .35); outline-offset: 1px; border-color: var(--accent);
}
input::placeholder { color: #6b7385; }

form.grid { display: grid; gap: 12px; }
form.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }

button {
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.06); }
button.ghost { background: transparent; }
button.danger:hover { border-color: var(--err); color: var(--err); }
button.link {
  background: none; border: none; padding: 0; color: var(--accent); font-weight: 500;
}
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--err); }

/* ---------- tablas ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); }
th {
  color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
.actions { text-align: right; white-space: nowrap; }

ul.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.findings li { display: flex; gap: 10px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
ul.findings li strong { color: var(--text); }

table.kvs th { width: 40%; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--muted); }
table.kvs td { font-size: 13px; }
table.kvs td.state { width: 90px; text-align: right; }

/* ---------- avisos ---------- */

.flash {
  padding: 10px 14px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--border); background: var(--panel-2);
}
.flash.ok { border-color: rgba(46, 204, 113, .35); color: var(--ok); }
.flash.err { border-color: rgba(255, 107, 129, .35); color: var(--err); }

/* ---------- adaptación ---------- */

@media (max-width: 700px) {
  .menu { padding: 8px 12px; }
  .menu-items { order: 3; width: 100%; }
  .top-right { gap: 6px; }
  .uname { display: none; }
  main { padding: 16px; }
  .stats { flex-direction: column; }
  .hero { flex-direction: column; align-items: flex-start; }
}

.range .chip.lang { min-width: 38px; justify-content: center; text-transform: uppercase; letter-spacing: .04em; }
.range .sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; display: inline-block; }

.matrix th, .matrix td { text-align: center; padding: 5px 6px; }
.matrix tbody th { text-align: left; font-weight: 500; color: var(--muted); }
.matrix .yes { color: var(--ok); font-weight: 700; }
.matrix .no  { color: var(--err); font-weight: 700; }
.matrix .diag { color: #3a4152; }

.articleinfo { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.articleinfo .ai-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 10px; }
.articleinfo .ai-head .mono { font-size: 12px; overflow-wrap: anywhere; }
.articleinfo .ai-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.articleinfo .ai-cell { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; }
.articleinfo .ai-cell .k { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.articleinfo .ai-cell .v { font-size: 15px; font-weight: 600; }
.articleinfo .ai-cell .v.warn { color: var(--warn); }
.articleinfo .ai-cell .v.ok { color: var(--ok); }

.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.cat-item { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; }
.cat-name { font-weight: 600; font-size: 13px; }
.cat-regs { margin-top: 3px; line-height: 1.4; }
.periodbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; margin: 4px 0 14px; }
.periodbar .pill { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); font-size: 12px; text-decoration: none; }
.periodbar .pill.on { color: #fff; border-color: var(--accent); background: rgba(255,45,85,.14); }
.periodbar .pill:hover { border-color: var(--muted); text-decoration: none; }
.periodbar .psep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.periodbar .pdate { width: auto; min-width: 132px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 12px; font-family: inherit; }
.periodbar .pbtn { background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 11px; font-size: 12px; cursor: pointer; }
.periodbar .pbtn:hover { border-color: var(--accent); }
.periodbar .pcheck { display: inline-flex; flex-direction: row; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12px; white-space: nowrap; cursor: pointer; }
.periodbar .prange { margin-left: auto; color: var(--muted); font-size: 12px; }
.delta { font-size: 11.5px; font-weight: 600; }
.delta.up { color: #2ecc71; }
.delta.down { color: #ff6b81; }

.rgrid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); grid-auto-rows: 116px; gap: 10px; margin: 16px 0; }
.rcard, .rgroup { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rcard { cursor: pointer; }
.rcard:hover, .rgroup .rsub:hover { border-color: var(--accent); }
.rcard .k, .rgroup .k, .rsub .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rcard .v { font-size: 20px; font-weight: 650; white-space: nowrap; }
.rcard .sub { font-size: 11.5px; color: var(--muted); }
.rcard svg { display: block; width: 100%; margin-top: auto; }
.rcard.c2 { grid-column: span 2; }
.rcard.c3, .rgroup.c3 { grid-column: span 3; }
.rhero { grid-column: span 5; grid-row: span 2; padding: 14px 16px;
  background: linear-gradient(180deg, #1b1220 0%, var(--panel) 72%); border-color: #3a2230; }
.rhero .k { color: #f7a8c0; }
.rhero .v { font-size: 40px; line-height: 1.05; letter-spacing: -.5px; }
.rhero .sub { color: #c9a3b4; }
.rhero svg { height: 96px; }
.rgroup { justify-content: center; }
.rsubs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 4px; }
.rsub { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 9px; cursor: pointer; }
.rsub .v { font-size: 17px; font-weight: 650; }
@media (max-width: 1100px) {
  .rhero { grid-column: span 12; grid-row: span 2; }
  .rcard.c2, .rcard.c3, .rgroup.c3 { grid-column: span 6; }
}

.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--accent); }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-close { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.chart-head h2 { margin: 0; font-size: 17px; }
.chart-controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.chart-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.series-picker { position: relative; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); border-radius: 9px; padding: 7px 12px; font-size: 12.5px; cursor: pointer; }
.btn .count { background: rgba(255,45,85,.16); color: #ffb3c1; border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.series-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.series-chips .chip { font-size: 12px; padding: 4px 10px; }
.series-chips .chip .rm { color: var(--muted); cursor: pointer; }
.series-chips .chip .rm:hover { color: var(--text); }
.series-pop { position: absolute; top: 42px; left: 0; width: 330px; background: #171c26;
  border: 1px solid #2f3648; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.6); padding: 8px; z-index: 5; }
.series-pop h4 { margin: 6px 8px 8px; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.series-pop .row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.series-pop .row:hover { background: #1e2431; }
.series-pop .row .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.series-pop .row .name { flex: 1 1 auto; font-size: 13px; }
.series-pop .row .val { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.series-pop .row .box { width: 16px; height: 16px; border-radius: 5px; border: 1px solid #3a4152;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.series-pop .row.on .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.series-pop .row.off .name { color: var(--muted); }
.series-pop .pop-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 6px; padding: 8px; }
.series-pop .link { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; }
.series-pop .link:hover { color: var(--text); }
.period { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 12px; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.chart-controls select { min-width: 150px; }
.chart-series { display: flex; gap: 12px; flex-wrap: wrap; }
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: auto; aspect-ratio: 1100 / 350; display: block; }
.chart-tip .tiprow { display: block; white-space: nowrap; }
.chart-tip .tipdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; }
.chart-tip { position: absolute; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.5; pointer-events: none; min-width: 150px; }

dialog.modal { border: 1px solid var(--border); border-radius: 14px; background: var(--panel);
  color: var(--text); padding: 18px 20px; max-width: 460px; width: calc(100vw - 40px); }
dialog.modal::backdrop { background: rgba(0,0,0,.55); }
dialog.modal h2 { margin: 0 0 8px; font-size: 17px; }
dialog.modal p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.5; }
dialog.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* El modal de gráficas necesita ganar a dialog.modal: misma especificidad, va después. */
dialog.modal.chart-modal { max-width: 1040px; width: 92vw; max-height: 92vh; overflow: auto; }

.evol th { text-align: left; font-weight: 500; }
.evol td.evol-spark { width: 42%; min-width: 180px; }
.evol .spark { width: 100%; height: 34px; display: block; }
.evol tbody tr:hover { background: transparent; }

.provider { margin-bottom: 14px; }
.provider > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.secretfield { display: flex; gap: 8px; align-items: center; }
.secretfield input { flex: 1 1 auto; }
.secretfield .eye { flex: 0 0 auto; }

.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }
/* El input global ocupa el 100%: en un checkbox eso empuja el texto debajo. */
input[type="checkbox"], input[type="radio"] { width: auto; flex: 0 0 auto; accent-color: var(--accent); }
.articlebody { white-space: pre-wrap; line-height: 1.65; font-size: 14.5px; max-height: 620px; overflow: auto; }
pre.markdown { white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.55;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 12px;
  max-height: 420px; overflow: auto; }
a.primary, a.primary:hover { color: #fff; }

/* ---------- Nuevo contenido ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat.acc .n { color: var(--accent); }
.stat.ok .n { color: var(--ok); }
.stat.warn .n { color: var(--warn); }

.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.cols2 > * { min-width: 0; }
@media (max-width: 980px) { .cols2 { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, 1fr); } }

.tree { padding: 8px 6px; }
.tree a.seed, .tree a.kid { color: inherit; text-decoration: none; }
.tree a.seed:hover .kw, .tree a.kid:hover .kw { text-decoration: underline; text-decoration-color: var(--border); }
.tree .seed { padding: 8px 10px; border-radius: 9px; display: grid; cursor: pointer;
  grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; row-gap: 4px; }
.tree .seed .metrics, .tree .kid .metrics { grid-column: 1 / -1; justify-self: end; }
.tree .seed:hover { background: var(--panel-2); }
.tree .seed.sel { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.tree .seed .kw { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 9ch; }
.tree .kids { padding-left: 18px; }
.tree .kid { padding: 7px 10px; border-radius: 9px; display: grid; cursor: pointer;
  grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 7px; row-gap: 4px; }
.tree .kid:hover { background: var(--panel-2); }
.tree .kid.sel { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.tree .kid .kw { font-weight: 500; font-size: 13px; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 9ch; }
.tree .metrics { margin-left: auto; display: flex; gap: 5px; align-items: center; white-space: nowrap; flex: 0 0 auto; }
.act { font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; white-space: nowrap; flex: 0 0 auto; }
.act.amplify { background: rgba(255,45,85,.14); color: #ff94a7; border: 1px solid rgba(255,45,85,.42); }
.act.create { background: rgba(46,204,113,.12); color: #83e0ab; border: 1px solid rgba(46,204,113,.38); }
.act.discard { background: #171b24; color: #7d8698; border: 1px solid var(--border); }
.act.outline { background: transparent; }
.kb .u { color: var(--muted); font-size: 9.5px; margin-left: 1px; }
.kb.kd.easy { color: var(--ok); border-color: rgba(46,204,113,.35); }
.kb.kd.mid { color: var(--warn); border-color: rgba(255,179,0,.35); }
.kb.kd.hard { color: var(--err); border-color: rgba(255,107,129,.35); }
.kb.pos { color: var(--ok); border-color: rgba(46,204,113,.35); }
.kb.dim { color: #6b7487; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.dot.amp { background: var(--accent); } .dot.new { background: var(--ok); } .dot.no { background: #3a4152; }
.kb { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); background: #12151d; }
.kb.vol { color: #c9d3e6; }
.kb.kd0 { color: var(--ok); border-color: rgba(46,204,113,.35); }
.kb.kd-mid { color: var(--warn); border-color: rgba(255,179,0,.35); }
.kb.kd-high { color: var(--err); border-color: rgba(255,107,129,.35); }
.kb.pos { color: var(--ok); border-color: rgba(46,204,113,.35); }

.ficha { padding: 16px 18px; }
.ficha h3 { margin: 0 0 2px; font-size: 19px; font-weight: 600; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
@media (max-width: 720px) { .grid4 { grid-template-columns: repeat(2, 1fr); } }
.m { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.m .v { font-size: 18px; font-weight: 600; }
.m .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.m .url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }

.reco { display: flex; gap: 12px; align-items: flex-start; border-radius: 10px; padding: 12px 14px; margin: 14px 0;
  background: rgba(255,45,85,.07); border: 1px solid rgba(255,45,85,.28); }
.reco.create { background: rgba(46,204,113,.07); border-color: rgba(46,204,113,.28); }
.reco .tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 6px; background: var(--accent); color: #fff; white-space: nowrap; }
.reco.create .tag { background: var(--ok); color: #06240f; }
.reco p { margin: 0; font-size: 13px; }

.fuentes { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.fuentes .f { font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); }
.fuentes .f b { color: var(--text); font-weight: 600; }

/* Artículos: texto a la izquierda, decisiones a la derecha. */
.cols2.article { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); }
@media (max-width: 1100px) { .cols2.article { grid-template-columns: 1fr; } }
.article-body { line-height: 1.72; font-size: 14.5px; color: #dfe6f2; }
.article-body h2 { font-size: 18px; margin: 22px 0 8px; }
.article-body h3 { font-size: 16px; margin: 18px 0 6px; }
.article-body p { margin: 0 0 12px; }
.article-body ul, .article-body ol { margin: 0 0 12px 20px; }
.article-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(255,45,85,.4); }
.article-body a:hover { border-bottom-color: var(--accent); }
.checks { display: flex; flex-direction: column; }
.checks .row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.checks .row:last-child { border-bottom: 0; }
.checks .ok { color: var(--ok); }
.checks .warn { color: var(--warn); }
.checks .err { color: var(--err); }
.tablewrap .links-table { min-width: 0; }
.links-table { table-layout: fixed; width: 100%; }
.links-table th:first-child, .links-table td:first-child { overflow-wrap: break-word; }
.links-table th:nth-child(2), .links-table td:nth-child(2) { width: 52px; text-align: right; }
.links-table th:nth-child(3), .links-table td:nth-child(3) { width: 96px; text-align: right; }
.links-table th { font-size: 10.5px; letter-spacing: .04em; }
.pubbox { border: 1px solid rgba(46,204,113,.35); background: rgba(46,204,113,.06); border-radius: 10px; padding: 12px; }
.pubbox .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Mi cuenta ---------- */

.account-cols { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px;
  align-items: start; max-width: 1040px; }
.account-cols > div > .card + .card { margin-top: 16px; }
@media (max-width: 860px) { .account-cols { grid-template-columns: 1fr; } }

.ident { padding: 22px 18px; text-align: center; }
.ident .avatar { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 600;
  color: #fff; background: linear-gradient(140deg, #ff2d55, #a1123a); }
.ident .name { font-size: 17px; font-weight: 600; }
.ident .mail { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.ident .roles { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ident .role { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; font-size: 12.5px; }
.ident .role .r { color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em; }
.ident .since { margin-top: 14px; font-size: 11.5px; color: var(--muted); }

.account-cols .card-body { padding: 16px 18px; }
.account-cols .field { margin-bottom: 14px; }
.account-cols .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-cols .hint { font-size: 11.5px; color: var(--muted); }

/* Clusters: sugerencias de enlace */
.miss-list { display: grid; gap: 8px; }
.miss { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; }
.miss-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.miss-apply { margin-top: 8px; }
.miss-apply summary { cursor: pointer; color: var(--muted); }
.miss-apply textarea { width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: #12151d; color: var(--text); font: inherit; font-size: 13px; }
.miss-apply button { margin-top: 8px; }

.install-box { display: flex; gap: 14px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel-2); }

/* Diff de la reescritura */
.diff-modal { width: min(1100px, 92vw); max-height: 92vh; padding: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--panel); color: var(--text); overflow: hidden; }
.diff-modal::backdrop { background: rgba(8,10,15,.72); }
.diff-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.diff-head h2 { margin: 0; font-size: 17px; }
.diff-head .close { margin-left: auto; background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 8px; width: 32px; height: 32px; font-size: 18px; cursor: pointer; }
.diff-tools { display: flex; align-items: center; gap: 14px; padding: 8px 20px; border-bottom: 1px solid var(--border); }
.diff-tools .grow { flex: 1; }
.diff-tools .legend { font-size: 12px; color: var(--muted); }
.diff-tools i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.diff-tools .sw-del { background: rgba(255,107,129,.45); }
.diff-tools .sw-ins { background: rgba(46,204,113,.45); }
.diff-body { padding: 20px 24px 26px; overflow: auto; max-height: 62vh; }
.diff-body del { color: #ffb3bf; background: rgba(255,107,129,.13); text-decoration: line-through;
  text-decoration-color: rgba(255,107,129,.75); border-radius: 3px; padding: 0 2px; user-select: none; }
.diff-body ins { color: #a9f0c6; background: rgba(46,204,113,.13); text-decoration: none; border-radius: 3px; padding: 0 2px; }
.diff-body .diff-del { border-left: 3px solid rgba(255,107,129,.6); padding-left: 10px; margin: 8px 0; }
.diff-body .diff-ins { border-left: 3px solid rgba(46,204,113,.6); padding-left: 10px; margin: 8px 0; }
.diff-body h1, .diff-body h2 { margin: 14px 0 8px; }
.diff-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); }
.diff-foot .grow { flex: 1; }

/* Barra de secciones dentro de una pantalla */
.page-sections { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; padding: 0;
  align-items: center; align-content: start; align-self: start; }
.page-sections a.chip { font-size: 12.5px; }
.page-sections a.chip.activo { border-color: var(--accent); color: var(--text); }
section.card { scroll-margin-top: 16px; }

/* Pestañas de una pantalla: solo se enseña la caja elegida */
main[data-tab]:not([data-tab="encargo"]) #encargo,
main[data-tab]:not([data-tab="trabajos"]) #trabajos,
main[data-tab]:not([data-tab="nuevo-perfil"]) #nuevo-perfil,
main[data-tab]:not([data-tab="perfiles"]) #perfiles,
main[data-tab]:not([data-tab="catalogo"]) #catalogo { display: none; }

/* ---------- armazón: barra lateral + contenido ---------- */

.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px; padding: 14px 10px 12px;
  background: var(--panel); border-right: 1px solid var(--border);
}
.sidebrand {
  display: flex; align-items: center; gap: 9px; padding: 2px 8px 12px;
  font-weight: 700; letter-spacing: .3px; font-size: 14px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.sidebrand svg { width: 22px; height: 22px; color: var(--accent); flex: 0 0 auto; }
.sidebrand:hover { text-decoration: none; }

.sidenav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sidenav a {
  padding: 7px 10px; border-radius: 8px; font-size: 13px; color: var(--muted);
  border-left: 2px solid transparent;
}
.sidenav a:hover { color: var(--text); background: rgba(255, 255, 255, .05); text-decoration: none; }
.sidenav a.active { color: var(--text); background: var(--panel-2); border-left-color: var(--accent); font-weight: 500; }
.sidenav .sec {
  margin: 12px 0 3px; padding: 0 10px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.sidenav a.sitecurrent { color: var(--text); font-weight: 600; }

.sidefoot {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.tspace summary {
  display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 8px;
  cursor: pointer; font-size: 12px; color: var(--muted); list-style: none;
  border: 1px solid var(--border); background: var(--panel-2);
}
.tspace summary::-webkit-details-marker { display: none; }
.tspace summary strong { color: var(--text); font-weight: 600; }
.tspace summary .led { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.tslist { display: grid; gap: 2px; margin-top: 4px; }
.tslist form { margin: 0; }
.tslist button {
  display: flex; justify-content: space-between; gap: 10px; width: 100%;
  padding: 6px 9px; border-radius: 7px; background: none; border: none;
  color: var(--text); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
}
.tslist button:hover { background: var(--panel-2); }
.tslist button.current { color: var(--accent); font-weight: 600; }
.tslist small { color: var(--muted); font-weight: 400; }

.sideuser { display: flex; align-items: center; gap: 9px; padding: 2px 4px; }
.sidetext { min-width: 0; }
.sidetext .uname { font-size: 12.5px; font-weight: 600; color: var(--text); }
.umail { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidefoot form { margin: 0; }
.sidefoot button.link {
  width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px;
  background: none; border: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer;
}
.sidefoot button.link:hover { background: rgba(255, 255, 255, .04); }
.sidefoot button.link.danger:hover { color: var(--err); }
.sidever { padding: 0 4px; font-size: 10.5px; color: var(--muted); }

.content { min-width: 0; display: flex; flex-direction: column; }
.content main { flex: 1; }
.content footer { padding: 4px 24px 22px; }

/* acceso sin sesión: tarjeta centrada */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.authwrap .card { width: min(420px, 100%); }

@media (max-width: 700px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .sidenav { flex-direction: row; flex-wrap: wrap; }
  .sidenav .sec { width: 100%; }
  .sidefoot { margin-top: 0; }
}

/* ---------- cabecera del contenido ---------- */

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 24px; border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 18, .7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 8;
}
.searchbox {
  display: flex; align-items: center; gap: 9px; flex: 0 1 560px;
  padding: 8px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border);
}
.searchbox:focus-within { border-color: var(--accent); }
.searchbox svg { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.searchbox input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 13px;
}
.searchbox input::placeholder { color: var(--muted); }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }
.iconbtn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; position: relative;
}
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn:hover { color: var(--text); border-color: var(--muted); text-decoration: none; }
.iconbtn .badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
}

.bell { position: relative; }
.bell summary { list-style: none; }
.bell summary::-webkit-details-marker { display: none; }
.bellpanel.legacy {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px; display: grid; gap: 4px; align-content: start; z-index: 20;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.bellpanel h4 {
  margin: 2px 4px 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); font-weight: 600;
}
.bellrow {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  padding: 7px 8px; border-radius: 8px; background: rgba(255,255,255,.02);
}
.bellrow .mono { flex: 0 0 auto; }
.bellrow .when { margin-left: auto; flex: 0 0 auto; }

@media (max-width: 700px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .searchbox { flex: 1 1 auto; }
  .bellpanel { width: min(340px, calc(100vw - 28px)); }
}

/* resultados del buscador */
.hits { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hits li {
  display: grid; grid-template-columns: 78px minmax(0, 1fr) 150px; gap: 12px;
  align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--border);
}
.hits li:last-child { border-bottom: none; }
.hit-main { display: grid; gap: 2px; min-width: 0; }
.hit-main a { font-weight: 500; }
.hit-detail { overflow-wrap: anywhere; }
.hit-site { text-align: right; }
@media (max-width: 800px) {
  .hits li { grid-template-columns: 70px minmax(0, 1fr); }
  .hit-site { grid-column: 2; text-align: left; }
}

/* menú de usuario de la cabecera */
.usermenu2 { position: relative; }
.usermenu2 summary { list-style: none; }
.usermenu2 summary::-webkit-details-marker { display: none; }
.umpanel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px; display: grid; gap: 2px; align-content: start; z-index: 20;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.umhead { display: flex; align-items: center; gap: 9px; padding: 4px 6px 10px; }
.umlabel {
  padding: 6px 6px 2px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.umsep { height: 1px; background: var(--border); margin: 6px 2px; }
.umpanel form { margin: 0; }
.umrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 7px 9px; border-radius: 8px; background: none; border: none;
  color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.umrow:hover { background: rgba(255, 255, 255, .05); text-decoration: none; }
.umrow small { color: var(--muted); }
.umrow.current { color: var(--accent); font-weight: 600; }
.umrow.danger:hover { color: var(--err); }

/* áreas del sitio: acordeón, solo se despliega la que estamos viendo */
.sidenav .sitecurrent { margin-top: 14px; }
.area { border: none; }
.area summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer; list-style: none;
  font-size: 13px; color: var(--muted); border-left: 2px solid transparent;
}
.area summary::-webkit-details-marker { display: none; }
.area summary:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.area summary.active { color: var(--text); background: var(--panel-2); border-left-color: var(--accent); font-weight: 500; }
.area summary .chev { width: 13px; height: 13px; flex: 0 0 auto; transition: transform .15s ease; color: var(--muted); }
.area[open] summary .chev { transform: rotate(90deg); }
.arealist { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 6px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.arealist a { padding: 5px 8px; border-radius: 7px; font-size: 12.5px; color: var(--muted); border-left: none; }
.arealist a:hover { color: var(--text); background: rgba(255, 255, 255, .05); text-decoration: none; }
.arealist a.active { color: var(--accent); background: rgba(255, 45, 85, .08); font-weight: 500; }

/* ---------- portada de sitios ---------- */

.sitecards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1180px) { .sitecards { grid-template-columns: 1fr; } }

.sitecard {
  display: grid; grid-template-columns: 190px minmax(0, 1fr);
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.sitecard .shot {
  display: block; position: relative; overflow: hidden; background: #10131a;
  border-right: 1px solid var(--border); min-height: 190px;
}
.sitecard .shot img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top center; display: block;
}
.sitecard .shot-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center; text-align: center; padding: 10px;
  color: var(--muted); font-size: 11.5px;
}
.sitecard:hover { border-color: #3a4152; }

.sitebody { padding: 14px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.sitename { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sitename a { font-weight: 600; font-size: 14.5px; }
.sitename a:hover { color: var(--accent); text-decoration: none; }
.chip .led.off { background: var(--warn); }

.sitechips { display: flex; gap: 6px; flex-wrap: wrap; }
.sitemetrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  padding: 9px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.sitemetrics div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sitemetrics .k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sitemetrics .v { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sitefoot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.sitefoot form { margin: 0; }
.sitefoot button.chip { cursor: pointer; }
.sitefoot button.chip[disabled] { opacity: .55; cursor: default; }
.sitefoot .danger { margin-left: auto; }

.addcard {
  min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; border: 1px dashed var(--border); border-radius: 14px; background: rgba(255, 255, 255, .012);
  color: var(--muted); font: inherit; cursor: pointer; text-align: center; padding: 16px;
}
.addcard:hover { border-color: var(--accent); color: var(--text); }
.addcard .plus { font-size: 22px; line-height: 1; }
.addcard strong { color: var(--text); font-weight: 600; font-size: 13.5px; }

dialog.modal .mfields { display: grid; gap: 12px; margin-bottom: 16px; }
dialog.modal .mfields label { display: grid; gap: 5px; }
dialog.modal .mfields span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
dialog.modal .mfields input, dialog.modal .mfields select {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; color: var(--text); font: inherit; font-size: 13px;
}
dialog.modal button.danger {
  background: rgba(255, 107, 129, .12); border: 1px solid rgba(255, 107, 129, .4); color: var(--err);
  border-radius: 9px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
dialog.modal button.danger[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- cola de tareas ---------- */

.taskbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.taskbar .chip.activo { border-color: var(--accent); color: var(--text); }
.taskbar .chip .n { color: var(--muted); font-size: 11px; font-weight: 600; }
.taskbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.taskactions { display: flex; gap: 6px; justify-content: flex-end; }
.taskactions form { margin: 0; }

/* ---------- imágenes: acciones y revisión ---------- */

.imgactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.imgactions form { margin: 0; }
.imglist { display: flex; flex-direction: column; }
.imgitem { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); }
.imgitem:last-child { border-bottom: none; }
.imgph { width: 74px; height: 56px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.imgctx { color: var(--muted); font-size: 11.5px; margin-bottom: 6px; }
.imgform { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.imgform input[type="text"] { flex: 1; min-width: 260px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; color: var(--text);
  font: inherit; font-size: 13px; }
.imgwarn { color: var(--warn); font-size: 11.5px; margin-top: 5px; }
.imgempty { color: var(--err); font-size: 11.5px; margin-top: 5px; }

/* ---------- edición del texto de un encargo ---------- */

/* Una fila por párrafo: el texto a la izquierda y sus comentarios al lado,
   para que no haya duda de a qué párrafo pertenece cada uno. */
.edwrap { display: flex; flex-direction: column; gap: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.edrow { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0;
  border-bottom: 1px solid var(--border); }
.edrow:last-child { border-bottom: none; }
.edrow.con-comentarios { background: rgba(255, 179, 0, .03); }
@media (max-width: 1100px) {
  .edrow { grid-template-columns: 1fr; }
  .ecol-comments { border-left: none !important; border-top: 1px solid var(--border); }
}

.ecol-text { padding: 16px 20px; min-width: 0; }
.etext { font-size: 14.5px; line-height: 1.75; }
.ebar { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; flex-wrap: wrap; }

.echip {
  cursor: pointer; list-style: none; font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; background: var(--panel-2);
  display: inline-block;
}
.echip::-webkit-details-marker { display: none; }
.echip:hover { color: var(--text); border-color: var(--muted); }

/* El formulario ocupa todo el ancho del párrafo: nada de cajitas de tres
   letras donde no se cabe escribir. */
.eact[open] { width: 100%; }
.eform { margin-top: 8px; display: grid; gap: 8px; width: 100%; }
.eform textarea, .einput-full {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.6; padding: 10px 12px; resize: vertical;
}
.eform textarea:focus, .einput-full:focus { outline: none; border-color: var(--accent); }
.eactions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eactions form { margin: 0; }

/* La columna de comentarios, pegada a su párrafo. */
.ecol-comments { border-left: 1px solid var(--border); padding: 12px; display: flex;
  flex-direction: column; gap: 8px; background: rgba(0, 0, 0, .12); }
.ecol-comments:empty { border-left: none; background: none; }

.ecomment { border: 1px solid var(--border); border-radius: 11px; padding: 10px; background: var(--panel-2); }
.ecomment.done { border-color: rgba(46,204,113,.35); background: rgba(46,204,113,.06); }
.equote { border-left: 2px solid var(--warn); padding-left: 8px; color: var(--muted); font-size: 11.5px; margin-bottom: 6px; }
.einstruction { font-size: 13px; margin-bottom: 6px; }
.estate { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.eresult { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.eresult .k { font-size: 10.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.rtext { font-size: 13px; line-height: 1.6; background: rgba(46,204,113,.08); border-radius: 8px; padding: 8px 10px; }

/* La propuesta se enseña en el propio párrafo: viejo tachado, nuevo en verde,
   y los botones al lado. Se acepta donde se lee. */
.eold {
  color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255,107,129,.6);
  background: rgba(255,107,129,.07); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px;
  font-size: 13.5px; line-height: 1.6;
}
.enew {
  border-left: 3px solid var(--ok); background: rgba(46,204,113,.10); border-radius: 8px;
  padding: 10px 12px; font-size: 14.5px; line-height: 1.7;
}
.eaccept { margin-top: 10px; }

/* acciones de la lista de trabajos */
.jactions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.jactions form { margin: 0; }
.jactions button.chip { cursor: pointer; }
.jactions button.chip.danger:hover { color: var(--err); border-color: rgba(255,107,129,.5); }

/* editor del artículo: portada y propiedades */
.covergrid { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 980px) { .covergrid { grid-template-columns: 1fr; } }
.coverpreview { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; aspect-ratio: 16/9; background: var(--bg); }
.coverpreview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.coverempty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 12.5px; }
.covercontrols { display: flex; flex-direction: column; gap: 12px; }
.coverfield { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.coverfield .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.coverfield textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 13px; padding: 9px 11px; resize: vertical; }
.propsgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .propsgrid { grid-template-columns: 1fr; } }
.connrow { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.connrow:last-of-type { border-bottom: none; }

/* pestañas del artículo, con subrayado como en el mockup */
.arttabs { display: flex; gap: 4px; margin: 4px 0 14px; border-bottom: 1px solid var(--border); }
.arttabs a { padding: 10px 14px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0; }
.arttabs a:hover { color: var(--text); background: rgba(255,255,255,.03); text-decoration: none; }
.arttabs a.on { color: var(--text); background: var(--panel); border-bottom-color: var(--accent); font-weight: 500; }

/* propiedades del artículo, apiladas como en el mockup */
.metafields { display: grid; gap: 14px; }
.metafields .fieldline { display: grid; gap: 5px; }
.metafields .fieldline > span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.metafields input, .metafields textarea { width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font: inherit; font-size: 13.5px; padding: 10px 12px; }
.metafields input:focus, .metafields textarea:focus { outline: none; border-color: var(--accent); }
.metafields .count { float: right; color: var(--muted); font-size: 11px; }
.propsside { min-width: 0; }

/* especificaciones de portada, en parejas clave/valor */
.coverspecs { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 12.5px; margin-top: 4px; }
.coverspecs .sk { color: var(--muted); }
.coverspecs .sv { color: var(--text); }

/* variantes de portada */
.variants { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; margin: 0 0 14px; }
@media (max-width: 1100px) { .variants { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.variant { margin: 0; }
.variant img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); display: block; }
.variant figcaption { margin-top: 6px; display: flex; justify-content: center; }
.variant form { margin: 0; }

/* cabecera de las propuestas de portada */
.variantshead { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.variantshead form { margin: 0 0 0 auto; }

/* cada propuesta con sus acciones */
.variant figcaption { flex-wrap: wrap; gap: 6px; }

/* borrar bloque y procedencia del párrafo */
.echip.danger { color: var(--err); border-color: rgba(255,107,129,.35); background: rgba(255,107,129,.08); }
.echip.danger:hover { color: #fff; background: rgba(255,107,129,.35); border-color: var(--err); }
.blockmark { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* número de bloque y su procedencia */
.blocknum { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.blockmark { text-transform: none; letter-spacing: 0; color: var(--warn); font-size: 11px; }

/* ideas: cabecera compacta y tabla */
.headchips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.viewtoggle { display: flex; gap: 2px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 2px; margin-left: auto; }
.viewtoggle button { background: none; border: none; color: var(--muted); font: inherit; font-size: 12px;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.viewtoggle button.on { background: var(--panel); color: var(--text); }
.tablewrap table.sortable th { cursor: pointer; user-select: none; }
.tablewrap table.sortable th.sorted { color: var(--text); }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.pager:first-child { border-top: 0; border-bottom: 1px solid var(--border); }
.pager .psearch { display: flex; flex-direction: row; align-items: center; gap: 7px; flex: 0 1 240px; height: 30px;
  padding: 0 9px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.pager .psearch input { flex: 1; min-width: 0; height: 28px; background: none; border: 0; outline: none;
  color: var(--text); font: inherit; font-size: 12px; padding: 0; }
.pager .psearch input::placeholder { color: #6f788c; }
.pager .psearch svg { flex: 0 0 13px; width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.pager input[type="search"]::-webkit-search-decoration,
.pager input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.pager .pinfo { font-size: 12px; color: var(--muted); margin-right: auto; white-space: nowrap; }
.pager button { background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; font: inherit; font-size: 12px; padding: 5px 10px; cursor: pointer; }
.pager button[disabled] { color: #555c6b; background: var(--panel); border-color: #222631; cursor: default; }
.pager .pnum { font-size: 12px; color: var(--muted); }

/* planes de keyword: marca y caja de propuestas */
.planmark { color: var(--ok); font-size: 12px; }
.plantool { display: flex; align-items: center; gap: 12px; padding: 11px 12px; margin: 12px 0;
  border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); }
.plantool b { display: block; font-size: 13px; }
.plantool button { margin-left: auto; }
.planbox { margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); }
.planbox .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.planrow { padding: 6px 8px; border-left: 2px solid var(--border); font-size: 13px; margin-bottom: 4px; }
.planrow b { border-left-color: var(--accent); }
.planoutline { margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.6; }

/* modal de relaciones del inventario */
.relmodal { max-width: 720px; }
.relList { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; margin: 6px 0 12px; }
.relItem { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--panel-2); cursor: pointer; }
.relItem input { margin-top: 3px; accent-color: var(--accent); }
.relTitle { display: block; font-size: 13px; }
.planrow { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-left: 2px solid var(--border); font-size: 13px; margin-bottom: 4px; }
.planrow span:first-child { flex: 1; }
.planrow.elegido { border-left-color: var(--accent); background: var(--panel); }
.planrow button { padding: 3px 8px; font-size: 11px; }

/* artículos: solapas sobre la tabla y acciones con icono */
.articlescard { display: block; padding: 0; gap: 0; }
.articlescard .tabbar { padding: 16px 16px 0; margin-bottom: -16px; }
.articlescard .tablewrap { border-top: 1px solid var(--border); border-radius: 14px; padding-top: 16px; }
.tabbar { display: flex; align-items: center; gap: 8px; position: relative; z-index: 2; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 15px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.tab b { font-weight: 600; opacity: .75; }
.tab.on { background: var(--panel); border-color: var(--accent); color: var(--text);
  box-shadow: 0 4px 14px rgba(0,0,0,.45), 0 0 0 3px rgba(255,45,85,.10); }
.tab.on b { opacity: 1; }
.tabbar .tabcount { margin-left: auto; padding-bottom: 2px; }
.clustpill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255,45,85,.08); border: 1px solid rgba(255,45,85,.35); color: #ffd7e0;
  font-size: 11.5px; white-space: nowrap; }
.clustpill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.rev { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px;
  padding: 0 7px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); font-size: 11.5px; }
.jactions { display: flex; gap: 6px; justify-content: flex-end; }
.jactions form { display: inline-flex; }
.jactions .act { width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; padding: 0; }
.jactions .act:hover { color: var(--text); border-color: #3a4152; }
.jactions .act.danger:hover { color: var(--err); border-color: rgba(255,107,129,.55); background: rgba(255,107,129,.08); }
.jactions .act svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }

/* panel de la keyword: dos columnas, acciones a la izquierda y plan a la derecha */
.kwcols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 14px;
  margin-top: 14px; align-items: start; }
@media (max-width: 1100px) { .kwcols { grid-template-columns: 1fr; } }
.kwbox { border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); padding: 13px; min-width: 0; }
.kwmetrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kwmetrics .m { background: var(--panel); }
.klabel { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.kwactions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.kwactions form { display: block; }
.kwactions .wide { width: 100%; }
a.kcta { display: inline-flex; align-items: center; justify-content: center; width: 100%;
  padding: 9px 13px; border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600; }
a.kcta:hover { filter: brightness(1.06); }
.ktitle { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit;
  font-size: 13px; color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-left: 2px solid var(--border); border-radius: 9px; padding: 9px 11px; margin-bottom: 6px; cursor: pointer; }
.ktitle:hover { border-color: var(--border); border-left-color: var(--accent); }
.ktitle.on { border-left-color: var(--accent); background: #1b1f29; }
.ktitle .kpick { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #4a5265; flex: 0 0 auto; }
.ktitle.on .kpick { border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 4px, transparent 5px); }
.ktitle .kt { flex: 1; line-height: 1.4; }
.ktitle .ksel { font-size: 11px; color: var(--muted); }
.koutline { margin: 0; padding: 0; list-style: none; counter-reset: ko; font-size: 13px; }
.koutline li { counter-increment: ko; display: flex; gap: 10px; padding: 4px 0; color: #dfe4ee; }
.koutline li::before { content: counter(ko); color: var(--muted); font-size: 12px; min-width: 14px;
  text-align: right; font-variant-numeric: tabular-nums; }
.kempty b { display: block; font-size: 13px; margin-bottom: 3px; }

/* árbol: una línea por keyword, cinco por rama */
.tree .branch { border-top: 1px solid var(--border); padding: 6px 0 2px; }
.tree .krow::before { content: ""; position: absolute; left: -7px; top: 0; bottom: 0; width: 1px;
  background: #262b38; }
.tree .branch:first-child { border-top: 0; }
.tree .bhead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center;
  padding: 7px 8px; border-radius: 8px; }
.tree .bhead:hover { background: var(--panel-2); }
.tree .bhead.sel { background: #1b1f29; box-shadow: inset 2px 0 0 var(--accent); }
.tree .bkw { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .bsum { font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.tree .act { width: auto; height: auto; min-width: 0; padding: 2px 7px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.tree .krow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 9px;
  align-items: center; padding: 7px 8px 7px 12px; border-radius: 8px; margin-left: 12px;
  position: relative; }
.tree .krow.extra { display: none; }
.tree .branch.open .krow.extra { display: grid; }
.tree .krow:hover { background: var(--panel-2); }
.tree .krow.sel { background: #1b1f29; box-shadow: inset 2px 0 0 var(--accent); }
.tree .kkw { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .kvol { text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tree .kkd { text-align: center; }
.tree .kpos { text-align: right; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tree .kbadge { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border);
  color: var(--muted); background: #12151d; white-space: nowrap; }
.tree .kbadge.easy { color: #83e0ab; border-color: rgba(46,204,113,.35); }
.tree .kbadge.mid { color: #ffd27a; border-color: rgba(255,179,0,.35); }
.tree .kbadge.hard { color: #ff94a7; border-color: rgba(255,107,129,.35); }
.tree .more { display: flex; align-items: center; gap: 6px; width: calc(100% - 12px); margin: 4px 0 6px 12px;
  padding: 6px 10px; background: none; border: 1px dashed var(--border); border-radius: 8px;
  color: var(--muted); font-size: 12px; font-weight: 400; text-align: left; }
.tree .more:hover { color: var(--text); border-color: #3a4152; }
.tree .more b { color: var(--accent); font-weight: 600; }
.tree .more .ar { margin-left: auto; }
@media (max-width: 900px) {
  .tree .krow { grid-template-columns: 62px minmax(0, 1fr) 88px 58px; }
  .tree .kpos { display: none; }
}
/* enlaces de acción con el mismo aspecto que los botones del panel */
.kwactions a.knor { display: inline-flex; align-items: center; justify-content: center; width: 100%;
  padding: 8px 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font-size: 13px; font-weight: 600; }
.kwactions a.knor:hover { border-color: var(--muted); }

/* núcleo emocional: solo aparece si el perfil elegido lo exige */
.corebox { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
  padding: 12px 14px; margin: 4px 0; }
.corebox .corehead { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.corebox .corehead span { font-weight: 400; margin-left: 6px; }

/* portada: rueda de espera mientras el generador trabaja */
.spinner { display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 7px; }
.spinner.big { width: 28px; height: 28px; border-width: 3px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.coverpreview { position: relative; }
.coverpreview.busy img, .coverpreview.busy .coverempty { opacity: .3; }
.coverbusy { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; text-align: center; padding: 20px;
  background: rgba(15,17,23,.74); border-radius: 12px; color: var(--text); font-size: 13px; }
button.isbusy { cursor: progress; }

/* cabecera de Ideas: idiomas y Analizar arriba, fecha del análisis debajo */
.analyzebox { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.analyzebox .arow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.analyzebox .when { white-space: nowrap; }

/* espera a pantalla completa para acciones largas */
.coverbusy.fixed { position: fixed; inset: 0; border-radius: 0; background: rgba(8,10,14,.78);
  z-index: 1000; font-size: 14px; gap: 14px; cursor: progress; }

/* la rejilla de métricas no puede empujar la caja de al lado */
.kwmetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kwmetrics .m { min-width: 0; overflow: hidden; }
.kwmetrics .m .v { overflow: hidden; text-overflow: ellipsis; }
.kwmetrics .m .url { max-width: 100%; }

/* nada de una sola pieza puede ensanchar la ficha: URL y tablas se parten */
.ficha, .kwcols, .kwbox, .articleinfo, .articleinfo .ai-head { min-width: 0; }
.articleinfo .ai-head a.mono { min-width: 0; max-width: 100%; white-space: normal;
  overflow-wrap: anywhere; word-break: break-word; }
.articleinfo .tablewrap { min-width: 0; }

/* sin plan no hay segunda columna: el aviso va en la columna de decisiones,
   encima de la recomendación, como en el mockup */
.kwcols.solo { grid-template-columns: 1fr; }
.kempty { border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  padding: 12px 14px; margin: 0 0 12px; }
.kempty b { display: block; font-size: 13.5px; margin-bottom: 4px; }

/* aviso de análisis en curso dentro del panel */
.kpending b { display: flex; align-items: center; gap: 9px; }
.kpending .spinner { margin: 0; }
.kperr { border-color: rgba(255,107,129,.45); background: rgba(255,107,129,.06); }
.kperr b { color: var(--err); }

/* categorías del artículo: casillas en fila, con su jerarquía a la vista */
.catpick { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 2px; }
.catpick label { color: var(--text); }

/* preparación para agentes: nota por bloques y lista de comprobaciones */
.arcats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 14px; }
@media (max-width: 900px) { .arcats { grid-template-columns: repeat(2, 1fr); } }
.arcat { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); padding: 10px 12px; }
.arcat .k { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.arcat .v { font-size: 20px; font-weight: 600; margin: 2px 0; }
.arcat.ok .v { color: var(--ok); } .arcat.mid .v { color: var(--warn); } .arcat.bad .v { color: var(--err); }
.archecks { display: flex; flex-direction: column; gap: 7px; }
.archeck { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--panel); }
.archeck .ardot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--border); }
.archeck.ok .ardot { background: var(--ok); }
.archeck.fail .ardot { background: var(--err); }
.archeck.info .ardot { background: var(--muted); }
.archeck b { font-size: 13px; }
.arfix { color: #ffd27a; margin-top: 3px; }

/* bloque de agentes: separado del SEO por color y por etiqueta */
.agentsec { border-color: rgba(124,92,255,.35); box-shadow: inset 0 2px 0 rgba(124,92,255,.5); }
.agenthead { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.aitag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: rgba(124,92,255,.14); border: 1px solid rgba(124,92,255,.45); color: #cfc4ff;
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.agentscores { display: flex; gap: 10px; }
.agscore { min-width: 130px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2);
  padding: 8px 12px; }
.agscore .k { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.agscore .v { display: block; font-size: 22px; font-weight: 650; }
.arcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
@media (max-width: 900px) { .arcols { grid-template-columns: 1fr; } }
.arcatslabel { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.agenttable td.c, .agenttable th.c { text-align: center; }
.arcols .arcats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* categoría del artículo: combo estándar, una sola */
.catselect { width: 100%; }

/* acción principal del editor: subir a WordPress */
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }

/* artículos: título enlazado y keyword debajo, en mono y más pequeña */
.artlink { display: inline-block; font-size: 13.5px; color: var(--text); text-decoration: none; line-height: 1.35; }
.artlink:hover { text-decoration: underline; text-decoration-color: var(--border); }
.artkw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.8px;
  color: var(--muted); margin-top: 3px; line-height: 1.3; }

/* ajustes del sitio: ventana modal sobre la página */
.modalpage { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.modalscrim { position: absolute; inset: 0; background: rgba(8,10,14,.72); }
.modalbox { position: relative; width: min(980px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 40px 90px rgba(0,0,0,.6); }
.sitemodal .mhead { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sitemodal .thumb { width: 104px; height: 66px; object-fit: cover; border-radius: 9px; border: 1px solid var(--border);
  background: linear-gradient(135deg,#2a3142,#1b2030); }
.sitemodal .thumb.empty { display: grid; place-items: center; color: #6f788c; font-size: 11px; }
.sitemodal .who { min-width: 0; }
.sitemodal .who .n { font-size: 17px; font-weight: 650; }
.sitemodal .who .u { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.sitemodal .lock { opacity: .7; font-size: 11px; }
.sitemodal .mhead-actions { margin-left: auto; display: flex; gap: 8px; }
.sitemodal .mhead-actions form { display: inline-flex; }
.sitemodal .mtabs { display: flex; gap: 6px; padding: 10px 20px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sitemodal .mtab { padding: 7px 13px; border-radius: 9px 9px 0 0; color: var(--muted); font-size: 12.5px;
  border: 1px solid transparent; border-bottom: 0; }
.sitemodal .mtab.on { background: var(--panel-2); border-color: var(--border); color: var(--text); }
.sitemodal .mbody { padding: 18px 20px 16px; }
.sitemodal .mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
@media (max-width: 760px) { .sitemodal .mgrid { grid-template-columns: 1fr; } }
.sitemodal .mfield { display: flex; flex-direction: column; gap: 5px; }
.sitemodal .mfield > span { font-size: 12px; color: #cfd6e4; font-weight: 600; }
.sitemodal .mfield input, .sitemodal .mfield select { width: 100%; }
.sitemodal input.ro { background: #12151d; color: var(--muted); border-style: dashed; }
.sitemodal .mest { border: 1px solid var(--border); border-radius: 9px; background: #12151d; padding: 9px 12px;
  font-size: 12px; color: var(--muted); margin-top: 14px; }
.sitemodal .mtok { display: flex; flex-direction: column; gap: 4px; }
.sitemodal .mtok .row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid #222734; }
.sitemodal .mtok .row:last-child { border-bottom: 0; }
.sitemodal .mtok .row b { width: 170px; font-weight: 600; font-size: 12.5px; }
.sitemodal .mtok .row a { margin-left: auto; color: #ffb3c1; }
.sitemodal .mtok .ok { color: var(--ok); }
.sitemodal .mactions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--border); }
.sitemodal .mfield .small { font-weight: 400; }

/* campana: cola de tareas en un cajón a la derecha */
.bellpanel {
  position: fixed; top: 64px; right: 14px; bottom: 14px; width: min(430px, calc(100vw - 28px));
  overflow: auto; padding: 12px; display: block; z-index: 40;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
}
.bellpanel .bphead { display: flex; align-items: baseline; gap: 10px; padding: 2px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.bellpanel .bphead h4 { margin: 0; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.bellpanel .bphead a { margin-left: auto; color: #ffb3c1; text-decoration: none; }
.taskrow { display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px; border-radius: 9px; color: inherit; text-decoration: none; }
.taskrow:hover { background: var(--panel-2); }
.taskrow .tstate { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: #565f72; }
.taskrow.running .tstate { background: var(--ok); box-shadow: 0 0 0 3px rgba(46,204,113,.15); }
.taskrow.pending .tstate { background: var(--warn); }
.taskrow.failed .tstate { background: var(--err); }
.taskrow .tbody { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.taskrow .tk { font-size: 12.5px; font-weight: 600; }
.taskrow .ttarget { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskrow .tmeta { font-size: 11px; color: var(--muted); }
.taskrow .twhen { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Ideas bloqueada mientras el análisis está en la cola */
.busywrap { position: relative; }
.busyveil { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; text-align: center; padding: 24px;
  background: rgba(15,17,23,.72); border-radius: 14px; }
.busyveil .spinner.big { margin-bottom: 4px; }
.busyveil b { font-size: 15px; }

/* escaleta incumplida: aviso visible y puerta forzada con motivo */
.outlinewarn { border-color: rgba(255,107,129,.5); background: rgba(255,107,129,.05); }
.outlinewarn h2 { color: var(--err); }
.outlinelist { margin: 8px 0 8px 18px; padding: 0; font-size: 12.5px; }
.outlinelist li { margin: 3px 0; }
.outlineforce { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.outlineforce input[type=text] { flex: 1 1 320px; }

.bellpanel[hidden] { display: none; }
.bpclose { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0 4px; }
.bpclose:hover { color: var(--text); }
#bellbtn { position: relative; }
#bellbtn .badge { position: absolute; top: -6px; right: -6px; }

/* competidores: lista a la izquierda y ficha a la derecha */
.compwrap { display: grid; grid-template-columns: 320px minmax(0,1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .compwrap { grid-template-columns: 1fr; } }
.complist { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 8px; }
.compitem { display: flex; gap: 10px; padding: 9px; border-radius: 8px; color: inherit; text-decoration: none; }
.compitem:hover { background: var(--panel-2); }
.compitem.on { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.compitem .d { display: block; font-weight: 600; font-size: 12.5px; }
.compitem .p { display: block; font-size: 11px; color: var(--muted); }
.compdetail { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 14px; }
.compdetail h3 { margin: 0 0 4px; font-size: 16px; }
.compstats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.compstats .chip b { color: var(--text); }
.k { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--muted); margin: 1px 3px 1px 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* competidores: keyword con las dos posiciones, nuestra y la suya */
.kwcmp { display: flex; align-items: center; gap: 8px; padding: 2px 0; flex-wrap: wrap; }
.kwcmp .kw { font-size: 12px; color: var(--text); }
.kwcmp .ours { font-size: 11px; color: var(--ok); }
.kwcmp .theirs { font-size: 11px; color: var(--muted); }

/* ---------- Entrar: partida con titular cinético y marco de luz ---------- */
.lscene { display: grid; grid-template-columns: minmax(0,1fr) 420px; min-height: calc(100vh - 40px);
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: #090b10; }
@media (max-width: 900px) { .lscene { grid-template-columns: 1fr; min-height: 0; } }
.lleft { padding: 54px 46px; display: flex; flex-direction: column; justify-content: center; }
.llogo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; margin-bottom: 20px; }
.llogo .lmark { width: 24px; height: 24px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; font-size: 13px; color: #fff; }
.ltype { font-size: clamp(28px, 3.4vw, 44px); font-weight: 700; line-height: 1.1; min-height: 2.3em; }
.ltype .ltyped { display: inline-block; overflow: hidden; white-space: nowrap;
  border-right: 2px solid var(--accent); width: 0; animation: ltyping 7s steps(28) infinite -2s; }
@keyframes ltyping { 0% { width: 0 } 55%, 85% { width: 100% } 100% { width: 0 } }
.lmuted { color: var(--muted); }
.lsmall { font-size: 12px; color: var(--muted); }
.lleft .lmuted { max-width: 460px; }
.lright { display: grid; place-items: center; padding: 36px 28px; background: #0d1017; border-left: 1px solid var(--border); }
.lbeam { position: relative; border-radius: 16px; padding: 1px; overflow: hidden; background: #1b2030; width: 100%; max-width: 360px; }
.lbeam::before { content: ""; position: absolute; top: -60%; left: -20%; width: 40%; height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255,45,85,.85), rgba(123,92,255,.85), transparent);
  transform: rotate(18deg); animation: lbeam 4.5s linear infinite; }
@keyframes lbeam { from { left: -40% } to { left: 120% } }
.lcard { position: relative; z-index: 1; display: grid; gap: 12px; padding: 26px;
  border-radius: 15px; background: rgba(13,16,23,.97); }
.lcard h2 { margin: 0 0 4px; font-size: 20px; }
.lcard label { display: flex; flex-direction: column; gap: 5px; }
.lcard label > span { font-size: 11.5px; color: #cfd6e4; font-weight: 600; }
.lcard .lsmall { margin: 4px 0 0; text-align: center; }
@media (prefers-reduced-motion: reduce) { .ltype .ltyped, .lbeam::before { animation: none } }

/* ---------- Bienvenida cuando el espacio no tiene sitios ---------- */
.welcome { padding: 26px 10px 10px; text-align: center; }
.welcome h1 { font-size: 34px; margin: 0 0 8px; }
.welcome .sub { color: var(--muted); max-width: 640px; margin: 0 auto 26px; }
.wcols { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; max-width: 900px; margin: 0 auto; }
@media (max-width: 820px) { .wcols { grid-template-columns: 1fr; } }
.wcol { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; text-align: left; }
.wcol .ic { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,45,85,.12);
  border: 1px solid rgba(255,45,85,.35); display: grid; place-items: center; color: var(--accent); margin-bottom: 10px; }
.wcol h3 { margin: 0 0 4px; font-size: 14px; }
.wcol p { margin: 0; font-size: 12px; color: var(--muted); }
.wsteps { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.welcome .go { margin-top: 22px; }

/* keywords posicionados: tarjetas con la keyword y sus páginas debajo */
.kwswitch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  text-decoration: none; padding: 4px 6px; }
.kwswitch .track { width: 34px; height: 19px; border-radius: 999px; background: #2b3244; border: 1px solid var(--border); position: relative; transition: .15s; }
.kwswitch .track i { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #8b93a5; transition: .15s; }
.kwswitch.on { color: var(--text); }
.kwswitch.on .track { background: rgba(46,204,113,.35); border-color: rgba(46,204,113,.6); }
.kwswitch.on .track i { left: 17px; background: #eafff2; }
.kwbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.kwbar input { flex: 1 1 280px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 7px 10px; font: inherit; font-size: 12.5px; }
.kwnode { border: 1px solid var(--border); border-radius: 11px; margin-bottom: 10px; background: var(--panel); overflow: hidden; }
.kwhead { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--panel-2); }
.kwhead .kw { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kwhead .lbl { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kwhead .clics { font-size: 15px; font-weight: 650; }
.kwbody { padding: 4px 10px 8px; }
.kwrow2 { display: grid; grid-template-columns: minmax(0,1fr) 60px 100px 90px; gap: 12px; align-items: center;
  padding: 8px; border-bottom: 1px solid #1b2029; border-left: 2px solid transparent; }
.kwrow2:last-child { border-bottom: 0; }
.kwrow2.ours { border-left-color: var(--ok); background: rgba(46,204,113,.04); }
.kwrow2.rival { border-left-color: #3a4152; opacity: .85; }
.kwrow2 .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kwrow2 .u { font-size: 12.5px; color: #cfd6e4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kwrow2 .tagq { font-size: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; flex: 0 0 auto; }
.kwrow2.ours .tagq { color: #9be8b8; border-color: rgba(46,204,113,.4); }
.kwrow2 .best { font-size: 10px; color: var(--ok); border: 1px solid rgba(46,204,113,.35); border-radius: 5px; padding: 1px 5px; }
.kwrow2 .num { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.kwrow2 .num .s { display: block; font-size: 10.5px; color: var(--muted); }
.kwhead .lbl + .clics { margin-right: 10px; }
.inbchips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 12px; }

/* competidores: solapas, tabla desplegable y paginación */
.comptool { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px;
  border-bottom: 1px solid var(--border); }
.comptool form { display: flex; gap: 8px; align-items: center; }
.comptool select { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 5px 8px; font: inherit; font-size: 12px; max-width: 380px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.comptable td { vertical-align: top; }
.comptable .domlink { display: inline-flex; gap: 6px; align-items: baseline; color: var(--text); font-weight: 600; }
.comptable .tw { font-size: 9px; color: var(--muted); }
.comptable .ov { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.comptable .bar { height: 5px; width: 90px; background: #222734; border-radius: 4px; overflow: hidden; }
.comptable .bar i { display: block; height: 100%; background: var(--ok); }
.comptable tr.kids td { background: #12151d; padding: 0; }
.comptable .kidsinner { padding: 8px 10px 12px; }
.comptable .kidsinner thead th { font-size: 10px; padding: 6px 8px; }
.comptable .kidsinner tbody td { padding: 7px 8px; border-bottom: 1px solid #1b2029; font-size: 12px; }
