/* ============================================================
   Admin — login con Google + panel
   ============================================================ */

[hidden] { display: none !important; }

.kicker {
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: .44em;
  text-transform: uppercase;
  color: var(--red-hot);
}

.btn {
  padding: 11px 20px;
  border-radius: 99px;
  background: var(--red);
  border: 1px solid var(--red-hot);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  transition: box-shadow .25s var(--ease);
}
.btn:hover, .btn.is-hover { box-shadow: 0 0 0 6px var(--red-glow); }
.btn:disabled { opacity: .5; box-shadow: none; }

.ghost-btn {
  margin-top: 22px;
  padding: 10px 20px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 13px;
  transition: border-color .25s, color .25s;
}
.ghost-btn:hover { border-color: var(--red-hot); color: #fff; }

/* ---------- pantallas de acceso ---------- */
.gate-screen {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 90px 22px 40px;
  text-align: center;
}
.gate-card {
  width: min(400px, 100%);
  padding: 38px 30px;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--panel-2) 0%, var(--panel) 70%);
  border: 1px solid var(--line);
}
.gate-card h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.gate-note { margin: 12px 0 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.gate-note b { color: var(--text); font-weight: 500; word-break: break-all; }
.gate-err { margin: 16px 0 0; min-height: 1em; color: var(--red-hot); font-size: 13px; }
.g-btn { display: flex; justify-content: center; margin-top: 26px; min-height: 44px; }

/* ---------- panel ---------- */
.admin {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.admin-side {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: calc(84px + env(safe-area-inset-top, 0px)) 16px 20px;
  border-right: 1px solid var(--line-soft);
  background: rgba(14, 14, 17, .7);
}
.admin-brand {
  margin: 0 8px;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -.04em;
}
.admin-brand span { color: var(--red-hot); }

.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dim);
  text-align: left;
}
.admin-nav button svg { width: 18px; height: 18px; }
.admin-nav button:hover { background: var(--panel); color: #fff; }
.admin-nav button.is-active { background: var(--panel-2); color: #fff; box-shadow: inset 2px 0 0 var(--red); }

.admin-me {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line-soft);
  min-width: 0;
}
.admin-me img { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.admin-me div { min-width: 0; flex: 1; }
.admin-me b, .admin-me small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-me b { font-size: 13px; font-weight: 600; }
.admin-me small { font-size: 11px; color: var(--text-faint); }

.icon-btn {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--text-faint);
  transition: color .2s, background .2s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: #fff; background: var(--panel-2); }

.admin-main { padding: calc(84px + env(safe-area-inset-top, 0px)) clamp(20px, 5vw, 56px) 60px; min-width: 0; }
.admin-head h1 { margin: 0; font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.035em; }
.admin-head p { margin: 8px 0 0; color: var(--text-dim); font-size: 14px; }

.perm-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}
.perm-form input, .perm-form select, .perm-row select {
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.perm-form input { flex: 1 1 240px; min-width: 0; }
.perm-form input:focus, .perm-form select:focus, .perm-row select:focus { border-color: var(--red-hot); }
.perm-row select { height: 34px; }

.form-msg { margin: 12px 0 0; min-height: 1.2em; font-size: 13px; color: var(--text-dim); }
.form-msg.err { color: var(--red-hot); }

.perm-table {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}
.perm-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 130px minmax(0, 1.4fr) 80px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.perm-row--head {
  border-top: 0;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg-2);
}
.perm-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-dash-text { font-size: 12.5px; color: var(--text-faint); }
.perm-act { text-align: right; }
.perm-empty { margin: 0; padding: 18px; border-top: 1px solid var(--line-soft); color: var(--text-faint); font-size: 13px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-dim);
}
.badge--admin { border-color: var(--red-deep); color: var(--red-hot); background: rgba(224, 16, 43, .08); }

.link-btn { font-size: 13px; color: var(--text-faint); transition: color .2s; }
.link-btn:hover, .link-btn.is-hover { color: var(--red-hot); }
.link-btn:disabled { opacity: .5; }

/* ---------- dashboards ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 30px;
}
.dash-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2) 0%, var(--panel) 70%);
  border: 1px solid var(--line);
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.dash-card:hover { border-color: var(--red-hot); transform: translateY(-2px); }
.dash-ico {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(224, 16, 43, .12);
  color: var(--red-hot);
}
.dash-ico svg { width: 28px; height: 28px; }
.dash-name { font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.dash-card .dash-spent { margin-top: -12px; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.dash-ico img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.dash-ico:has(img) { background: none; overflow: hidden; }

/* ---------- ⋯ editar / eliminar un dashboard (amos): en su cabecera y en su tarjeta ---------- */
.dash-menu { position: relative; }
.dash-menu [aria-expanded="true"] { color: #fff; background: var(--panel-2); }
.dash-menu-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 170px;
  display: grid;
  padding: 6px;
  border-radius: 14px;
  background: rgba(22, 22, 27, .98);
  border: 1px solid var(--line);
  box-shadow: 0 24px 50px -20px #000;
  animation: m-in .2s var(--ease) both;
}
.dash-menu-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.dash-menu-pop button svg { width: 16px; height: 16px; color: var(--text-faint); }
.dash-menu-pop button:hover, .dash-menu-pop button:focus-visible { background: var(--panel-2); outline: none; }
.dash-menu-pop .is-danger, .dash-menu-pop .is-danger svg { color: var(--red-hot); }
.de-clear { font-size: 11.5px; margin-top: -6px; }

/* en la tarjeta del panel: arriba a la derecha, encima del link */
.dash-tile { position: relative; display: grid; }
.dash-tile .dash-menu { position: absolute; top: 12px; right: 12px; }
.dash-tile .icon-btn { width: 30px; height: 30px; }
.dash-tile .icon-btn svg { width: 16px; height: 16px; }

/* ícono por defecto: iniciales del título */
.mono {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.02em;
  color: var(--red-hot);
}
.dash-list .mono { font-size: 14px; }

.dash-card--new {
  border-style: dashed;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.dash-card--new .dash-ico { font-size: 26px; font-weight: 300; background: rgba(255, 255, 255, .04); color: var(--text-dim); }
.dash-card--new:hover .dash-ico { color: var(--red-hot); }

.gate-card--wide { width: min(460px, 100%); }
.dash-list { display: grid; gap: 10px; margin-top: 24px; text-align: left; }
.dash-list .dash-card { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; }
.dash-list .dash-ico { width: 40px; height: 40px; }
.dash-list .dash-ico svg { width: 24px; height: 24px; }

.perm-empty--box { border: 1px dashed var(--line); border-radius: var(--radius); }

@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: calc(76px + env(safe-area-inset-top, 0px)) 16px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .admin-brand { display: none; }
  .admin-nav { flex-direction: row; }
  .admin-me { margin: 0 0 0 auto; padding: 0; border: 0; max-width: 60%; }
  .admin-main { padding-top: 28px; }
  .perm-row { grid-template-columns: minmax(0, 1fr) auto; }
  .perm-row--head span:nth-child(n+3) { display: none; }
  .perm-dash, .perm-act { grid-column: 1 / -1; text-align: left; }
  .perm-row--head { grid-template-columns: minmax(0, 1fr) auto; }
  .dash-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- usuario en la cabecera de un dashboard ---------- */
.dash-user { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.dash-user small { color: var(--text-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- modal: nuevo dashboard ---------- */
.nd-modal { width: min(380px, 100%); justify-items: center; gap: 12px; padding: 28px 24px 20px; }
.nd-icon { display: grid; justify-items: center; gap: 8px; cursor: pointer; }
.nd-icon-img {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(224, 16, 43, .12);
  border: 1.5px dashed var(--line);
  overflow: hidden;
  transition: border-color .2s;
}
.nd-icon-img svg { width: 42px; height: 42px; color: var(--red-hot); }
.nd-icon-img img { width: 100%; height: 100%; object-fit: cover; }
.nd-icon-img .mono { font-size: 28px; }
.nd-icon.has-image .nd-icon-img { border-style: solid; border-color: transparent; }
.nd-icon:hover .nd-icon-img { border-color: var(--red-hot); }
.nd-icon small { font-size: 11.5px; color: var(--text-faint); }
.nd-title {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  outline: none;
}
.nd-title:focus { border-color: var(--red-hot); }
.nd-modal .m-actions { justify-self: stretch; }

/* ---------- configuración (amo supremo) ---------- */
.cfg-card {
  max-width: 720px;
  margin-top: 28px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.cfg-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.cfg-row h2 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.cfg-row p { margin: 0; max-width: 52ch; font-size: 13px; line-height: 1.6; color: var(--text-dim); }
.cfg-value {
  flex: none;
  min-width: 64px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.03em;
  text-align: right;
  color: var(--red-hot);
  font-variant-numeric: tabular-nums;
}

.fe-preview {
  position: relative;
  height: 250px;
  margin: 20px 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  overflow: hidden;
}
.fe-preview canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fe-lens { position: absolute; inset: 0; }
.fe-card {
  position: absolute;
  left: calc(var(--x) * 100% - var(--w) / 2);
  top: calc(var(--y) * 100% - var(--h) / 2);
  width: var(--w);
  height: var(--h);
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--line-soft), var(--line-soft)) 12px 14px / 45% 7px no-repeat,
    linear-gradient(var(--line-soft), var(--line-soft)) 12px 32px / 70% 5px no-repeat,
    linear-gradient(165deg, #1b1b21, #121216);
}

.range { width: 100%; height: 28px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--line), var(--red-deep) 50%, var(--red-hot)); }
.range::-moz-range-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--line), var(--red-deep) 50%, var(--red-hot)); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--red);
  box-shadow: 0 0 0 5px var(--red-glow);
}
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--red); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 8px var(--red-glow); }
.range-marks { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-faint); }

/* tarjetas de configuración, una debajo de otra */
.cfg-card + .cfg-card { margin-top: 16px; }

/* ---------- formularios del panel (proyecto del portafolio, YO) ---------- */
.app-modal { width: min(500px, 100%); gap: 12px; max-height: calc(100dvh - 40px); overflow: auto; }
.app-row { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 8px; }
.app-row label { display: grid; gap: 5px; font-size: 11.5px; color: var(--text-faint); letter-spacing: .02em; }
.app-row input, .app-link select, .app-link input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.app-row input:focus, .app-link select:focus, .app-link input:focus { border-color: var(--red-hot); }
.app-links-title { margin: 4px 0 0; font-size: 11.5px; color: var(--text-faint); }
.app-links { display: grid; gap: 8px; }
.app-link { display: grid; grid-template-columns: 128px 1fr 32px; gap: 8px; align-items: center; }
.app-link .icon-btn { width: 32px; height: 32px; font-size: 20px; color: var(--text-faint); }
.app-link .icon-btn:hover { color: var(--red-hot); }
.app-add-link { justify-self: start; }
.app-modal .m-actions { flex-wrap: wrap; }
.app-del { margin-right: auto; color: var(--red-hot); }
@media (max-width: 520px) {
  .app-row { grid-template-columns: 1fr 1fr; }
  .app-row label:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .app-link { grid-template-columns: 1fr 32px; }
  .app-link input { grid-column: 1 / -1; grid-row: 2; }
}


/* ---------- portafolio (amo supremo) ---------- */
.folio-list { display: grid; gap: 8px; max-width: 720px; margin-top: 22px; }
.folio-row {
  display: grid;
  grid-template-columns: 26px 96px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 8px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
  transition: border-color .2s;
}
.folio-row:hover { border-color: #3a3a46; }
.folio-row--new { grid-template-columns: 96px 1fr; padding-left: 50px; border-style: dashed; }
.folio-row--new:hover { border-color: var(--red-hot); }
.folio-n { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.folio-thumb { width: 96px; aspect-ratio: 16 / 9; border-radius: 8px; object-fit: cover; background: linear-gradient(140deg, #ff6a1f55, #8c051855 60%, #121216); display: block; }
.folio-thumb--add { display: grid; place-items: center; background: rgba(255, 255, 255, .04); font-size: 24px; font-weight: 300; color: var(--text-dim); }
.folio-row--new:hover .folio-thumb--add { color: var(--red-hot); }
.folio-info { display: grid; gap: 3px; min-width: 0; text-align: left; }
.folio-info b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folio-info small { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folio-row:not(.folio-row--new) .folio-info:hover b { color: var(--red-hot); }
.folio-move { display: flex; gap: 2px; }
.folio-move .icon-btn { width: 30px; height: 30px; font-size: 14px; }
.folio-move .icon-btn:disabled { opacity: .25; pointer-events: none; }

.pj-media { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: center; }
.pj-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--text-faint);
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
  padding: 0;
}
.pj-preview span { padding: 10px; }
.pj-preview small { font-size: 10.5px; }
.pj-preview video, .pj-preview img { width: 100%; height: 100%; object-fit: cover; }
.pj-media-actions { display: grid; gap: 8px; justify-items: start; }
.pj-upload { cursor: pointer; font-size: 13px; padding: 9px 14px; }
.pj-url, .pj-field input, .pj-field textarea {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color .2s;
}
.pj-field textarea { height: auto; padding: 9px 12px; line-height: 1.45; resize: vertical; font-family: inherit; }
.pj-url:focus, .pj-field input:focus, .pj-field textarea:focus { border-color: var(--red-hot); }
.pj-field { display: grid; gap: 5px; font-size: 11.5px; color: var(--text-faint); }
.pj-bar { width: 100%; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pj-bar i { display: block; height: 100%; width: 0; background: var(--red-hot); transition: width .2s; }
.pj-bar[hidden] { display: none; }
#pj-form .pj-date { grid-template-columns: 1fr 1.4fr .8fr; }
#pj-form .pj-meta { grid-template-columns: 1.6fr 1fr; }
#pj-form select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); color: var(--text); font-size: 14px; outline: none; }
#pj-day:disabled { opacity: .4; }
/* YouTube: la miniatura del video, con una etiqueta */
.pj-yt, .folio-thumb--yt { position: relative; display: block; width: 100%; height: 100%; padding: 0 !important; }
.pj-yt img, .folio-thumb--yt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-yt b {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 6px;
  background: #e0102b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.folio-thumb--yt { width: 96px; overflow: hidden; }
@media (max-width: 520px) {
  .pj-media { grid-template-columns: 1fr; }
  .folio-row { grid-template-columns: 20px 72px 1fr auto; gap: 10px; }
  .folio-thumb { width: 72px; }
  .folio-row--new { grid-template-columns: 72px 1fr; padding-left: 42px; }
}
