/* ============================================================
   vector.css — estilo vectorial para el panel (/admin)
   ------------------------------------------------------------
   Solo lo carga admin/index.html (body.vx): el lienzo de los
   dashboards también usa admin.css y no cambia.
     · formas lisas: esquinas redondeadas, bordes finos de 1,5 px,
       sombras suaves y colores planos
     · títulos en Space Grotesk, etiquetas en JetBrains Mono
     · fondo con una grilla de puntos tenue
     · un solo acento: el rojo de la marca (tokens incluidos)
   ============================================================ */

body.vx {
  --vx-head: "Space Grotesk", "Inter", sans-serif;
  --vx-mono: "JetBrains Mono", ui-monospace, monospace;
  --vx-r: 16px;
  --vx-r-sm: 11px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, .055) 1px, transparent 1.6px) 0 0 / 22px 22px,
    var(--bg);
}
body.vx::before {
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(224, 16, 43, .14), transparent 70%),
    radial-gradient(700px 500px at 100% 100%, rgba(140, 5, 24, .12), transparent 70%);
}
.vx ::selection { background: var(--red); color: #fff; }

/* ---------- tipografía ---------- */
.vx .kicker, .vx .cap-label {
  font-family: var(--vx-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red-hot);
}
.vx .gate-card h1, .vx .admin-head h1, .vx .cfg-row h2, .vx .tk-who {
  font-family: var(--vx-head);
  font-weight: 700;
  letter-spacing: -.035em;
}
.vx .admin-head h1 { font-size: clamp(30px, 4.4vw, 42px); }
.vx .admin-head h1::after { /* punto rojo final, como un logo */
  content: "";
  display: inline-block;
  width: .22em;
  height: .22em;
  margin-left: .08em;
  border-radius: 50%;
  background: var(--red-hot);
}
.vx .cfg-row h2 { font-size: 19px; letter-spacing: -.02em; }

/* ---------- marca: igual que la portada ---------- */
.vx .admin-brand {
  margin: 0 8px;
  font-family: "Archivo Black", var(--vx-head);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -.01em;
  line-height: 1;
}
.vx .admin-brand::after {
  content: "panel";
  display: block;
  margin-top: 5px;
  font-family: var(--vx-mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--red-hot);
}

/* ---------- botones ---------- */
.vx .btn {
  border-radius: 99px;
  border: 0;
  background: var(--red);
  font-family: var(--vx-head);
  font-weight: 600;
  letter-spacing: -.005em;
  box-shadow: 0 8px 20px -10px rgba(224, 16, 43, .8);
  transition: background .2s, box-shadow .2s, transform .15s var(--ease);
}
.vx .btn:hover { background: var(--red-hot); box-shadow: 0 0 0 5px var(--red-glow); }
.vx .btn:active { transform: scale(.97); }
.vx .ghost-btn, .vx .mini-btn {
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  font-family: var(--vx-head);
  font-weight: 500;
}
.vx .ghost-btn:hover, .vx .mini-btn:hover { border-color: var(--red-hot); color: #fff; }
.vx .mini-btn {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: border-color .2s, color .2s, transform .15s var(--ease);
}
.vx .mini-btn:active { transform: scale(.96); }
.vx .mini-btn:disabled { opacity: .55; cursor: progress; }
.vx .link-btn { font-family: var(--vx-head); font-weight: 500; }

/* ---------- tarjetas y cajas ---------- */
.vx .gate-card, .vx .cfg-card, .vx .perm-table, .vx .dash-card, .vx .folio-row, .vx .modal {
  border-radius: var(--vx-r);
  border: 1.5px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 40px -26px #000;
}
.vx .modal { border-radius: 22px; }
.vx .dash-card, .vx .folio-row { transition: border-color .2s, transform .2s var(--ease); }
.vx .dash-card:hover, .vx .folio-row:hover { border-color: #3a3a46; transform: translateY(-2px); }
.vx .dash-ico { border-radius: 14px; }
.vx .dash-name { font-family: var(--vx-head); font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.vx .badge { font-family: var(--vx-head); font-weight: 500; border-width: 1.5px; }
.vx .folio-thumb, .vx .pj-preview { border-radius: 10px; }

/* inputs */
.vx input:not([type="range"]):not([type="checkbox"]), .vx select, .vx textarea { border-radius: var(--vx-r-sm) !important; border-width: 1.5px !important; }
.vx input:focus, .vx select:focus, .vx textarea:focus { box-shadow: 0 0 0 4px var(--red-glow) !important; }

/* ---------- menú lateral ---------- */
.vx .admin-side { background: rgba(10, 10, 12, .78); border-right: 1.5px solid var(--line-soft); }
.vx .admin-nav button { border-radius: 12px; font-family: var(--vx-head); font-weight: 500; font-size: 14px; }
.vx .admin-nav button.is-active { background: var(--panel-2); box-shadow: none; color: #fff; }
.vx .admin-nav button.is-active svg { color: var(--red-hot); }
.vx .admin-nav button.is-active::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--red-hot);
}

/* ---------- tabla de permisos + créditos ---------- */
.vx .perm-row--head { font-family: var(--vx-mono); font-size: 9.5px; letter-spacing: .14em; }
.perm-table.has-credits .perm-row { grid-template-columns: minmax(0, 1.2fr) 120px minmax(0, .9fr) 210px 64px; }
.perm-credits[hidden], .perm-credits-col[hidden] { display: none; }
.credit { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; }
.credit-tk { font-family: var(--vx-mono); font-size: 12.5px; font-weight: 500; color: var(--red-hot); white-space: nowrap; }
.credit-tk::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--red-hot); vertical-align: 1px; }
.credit small { grid-column: 1; font-size: 11px; color: var(--text-faint); }
.credit .mini-btn { grid-row: 1 / span 2; grid-column: 2; }

/* ---------- configuración → API de OpenAI: una fila por key, con radio ---------- */
.api-list { display: grid; gap: 8px; margin-top: 18px; }
.api-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 12px 16px; border: 1.5px solid var(--line); border-radius: var(--vx-r-sm);
  cursor: pointer; transition: border-color .2s, background .2s;
}
.api-row:hover { border-color: var(--red-hot); }
.api-row:has(input:checked) { border-color: var(--red-hot); background: rgba(224, 16, 43, .08); }
.api-row.is-off { cursor: not-allowed; opacity: .55; }
.api-row.is-off:hover { border-color: var(--line); }
.api-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--red-hot); }
.api-name { display: grid; gap: 2px; min-width: 0; }
.api-name b { font-family: var(--vx-head); font-size: 14px; font-weight: 600; }
.api-name small { font-family: var(--vx-mono); font-size: 10.5px; color: var(--text-faint); }
.api-state { font-family: var(--vx-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.api-row:has(input:checked) .api-state { color: var(--red-hot); }

/* ---------- configuración → tokens ---------- */
.tk-top { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 12px; margin-top: 18px; }
.tk-top label { display: grid; gap: 6px; }
.tk-field { position: relative; display: flex; align-items: center; }
.tk-field input {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--vx-mono);
  font-size: 13px;
  outline: none;
}
.tk-field i { position: absolute; right: 12px; font-style: normal; font-family: var(--vx-mono); font-size: 10.5px; color: var(--text-faint); pointer-events: none; }
.tk-surcharge .tk-field input { color: var(--red-hot); font-size: 16px; font-weight: 500; }
.tk-rate { margin: 12px 0 0; font-size: 12.5px; color: var(--text-faint); }
.tk-rate b { font-family: var(--vx-mono); font-weight: 500; color: var(--red-hot); }

.tk-table { margin-top: 18px; border: 1.5px solid var(--line); border-radius: var(--vx-r-sm); overflow: hidden; }
.tk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px 150px 84px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
  transition: background .4s ease;
}
.tk-row--head { border-top: 0; background: var(--bg-2); font-family: var(--vx-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }
.tk-name { display: grid; gap: 2px; min-width: 0; }
.tk-name b { font-family: var(--vx-head); font-size: 14px; font-weight: 600; }
.tk-name small { font-size: 11.5px; color: var(--text-faint); }
.tk-price b { font-family: var(--vx-mono); font-weight: 500; font-size: 14px; color: var(--red-hot); }
.tk-price small { display: block; font-size: 10.5px; color: var(--text-faint); }
.tk-row.is-measuring { background: linear-gradient(90deg, transparent, rgba(224, 16, 43, .1), transparent) 0 0 / 200% 100%; animation: vx-scan 1.1s linear infinite; }
@keyframes vx-scan { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.tk-row.is-updated { background: rgba(224, 16, 43, .12); }

/* ---------- modal de créditos ---------- */
.tk-modal { width: min(380px, 100%); grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 26px 24px 20px; }
.tk-modal .cap-label { margin: 0; }
.tk-who { margin: 0; font-size: 20px; word-break: break-all; }
.tk-now { margin: 0; font-size: 12.5px; color: var(--text-faint); }
.tk-soles {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
}
.tk-soles:focus-within { border-color: var(--red-hot); box-shadow: 0 0 0 4px var(--red-glow); }
.tk-soles span { font-family: var(--vx-head); font-size: 24px; font-weight: 600; color: var(--text-faint); }
.tk-soles input {
  flex: 1;
  min-width: 0;
  height: 60px;
  border: 0 !important;
  background: none;
  color: #fff;
  font-family: var(--vx-head);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.02em;
  outline: none;
  box-shadow: none !important;
}
.tk-conv { margin: 2px 0 0; font-family: var(--vx-mono); font-size: 14px; font-weight: 500; color: var(--red-hot); }
.tk-conv.is-neg { color: #ff8a98; }
.tk-hint { margin: 0; font-size: 11.5px; color: var(--text-faint); }

/* ---------- portafolio: switch de visibilidad ---------- */
.folio-row { grid-template-columns: 26px 96px 1fr auto auto; }
.folio-row--new { grid-template-columns: 96px 1fr; }
.folio-row.is-hidden .folio-thumb, .folio-row.is-hidden .folio-info { opacity: .38; }
.folio-row.is-hidden .folio-info small::after { content: " · oculto"; color: var(--red-hot); }
.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  padding: 0;
  border-radius: 99px;
  background: #2a2a32;
  transition: background .2s;
}
.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  transition: transform .2s var(--ease);
}
.switch[aria-checked="true"] { background: var(--red); }
.switch[aria-checked="true"] span { transform: translateX(16px); }
.switch:disabled { opacity: .6; }
.switch:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--red-glow); }
@media (max-width: 520px) {
  .folio-row { grid-template-columns: 20px 72px 1fr auto; }
  .folio-row .folio-move { grid-column: 3 / -1; justify-self: end; }
}

/* ---------- editor de proyecto: nombre, año, info, etiquetas, videos ---------- */
#pj-form { width: min(540px, 100%); gap: 12px; }
#pj-form .cap-label { margin: 0; }
#pj-form .pj-head { grid-template-columns: 1fr 110px; }
.pj-boxes-note { margin: -4px 0 0; font-size: 11px; color: var(--text-faint); }
.pj-tags { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; border: 0; }
.pj-tags legend { width: 100%; margin-bottom: 6px; padding: 0; font-size: 11.5px; color: var(--text-faint); }
.pj-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.pj-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--red); cursor: pointer; }
.pj-videos-head p { margin: 4px 0 0; font-size: 11.5px; color: var(--text-faint); }
.pj-videos-head small { margin-left: 6px; }
.pj-videos { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; max-height: 240px; overflow: auto; }
.pj-video {
  display: grid;
  grid-template-columns: 18px 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 10px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-2);
}
.pj-video-n { font-family: var(--vx-mono); font-size: 11px; color: var(--text-faint); }
.pj-video .folio-thumb { width: 64px; }
.pj-video-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-video .icon-btn { width: 28px; height: 28px; font-size: 14px; }
.pj-video .icon-btn:disabled { opacity: .25; pointer-events: none; }
.pj-empty { padding: 12px; border-radius: 12px; border: 1.5px dashed var(--line); font-size: 12.5px; color: var(--text-faint); }
.pj-add { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.pj-add .pj-upload { margin: 0; white-space: nowrap; }
.pj-bar-note { min-height: 1em; font-size: 11.5px; color: var(--text-faint); }
.pj-blob { margin: 0; font-size: 11.5px; line-height: 1.4; }
.pj-blob:empty { display: none; }
.pj-blob::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; vertical-align: 1px; }
.pj-blob.is-ok { color: var(--text-faint); }
.pj-blob.is-ok::before { background: #39d98a; }
.pj-blob.is-missing { color: #ff8a98; }
.pj-blob.is-missing::before { background: var(--red-hot); }
@media (max-width: 520px) {
  #pj-form .pj-head { grid-template-columns: 1fr 90px; }
  .pj-add { grid-template-columns: 1fr; }
}


/* ---------- rango (ojo de pez, tiempo por proyecto) ---------- */
.vx .cfg-value { font-family: var(--vx-head); font-weight: 700; letter-spacing: -.03em; }
.vx .fe-preview { border-radius: 14px; }

@media (max-width: 760px) {
  .perm-table.has-credits .perm-row { grid-template-columns: minmax(0, 1fr) auto; }
  .perm-credits { grid-column: 1 / -1; }
  .tk-top { grid-template-columns: 1fr 1fr; }
  .tk-surcharge { grid-column: 1 / -1; }
  .tk-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tk-row--head span:nth-child(n+2) { display: none; }
  .tk-row .tk-field, .tk-row .tk-price { grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .tk-row.is-measuring { animation: none; }
}
