/* Blockout NoMa como artifact: menú principal (proyectos y generaciones), candado de edición y roles.
   Mismo mundo que el editor: fondo casi negro de marca, vidrio y brillos NoMa. Diseño oscuro a propósito (un solo tema). */
:root {
  color-scheme: dark;
  --st-gr: rgba(115,238,27,0.14); --st-gr-bd: rgba(115,238,27,0.4);
  --st-cy: rgba(51,245,255,0.1); --st-cy-bd: rgba(51,245,255,0.4);
  --st-vi: rgba(140,17,228,0.2); --st-vi-bd: rgba(204,102,255,0.5);
  --st-mg: rgba(221,0,93,0.16); --st-mg-bd: rgba(221,0,93,0.5);
  --set-sky: #aeb6bf; --set-ground: #8e8e89;
}
body { background: var(--bg); color: var(--ink); }

/* ---------- menú ---------- */
#home { position: fixed; inset: 0; z-index: 40; overflow-y: auto; overflow-x: hidden; background: var(--bg); -webkit-overflow-scrolling: touch; }
#home[hidden] { display: none !important; }
#home.opening { cursor: progress; }
#home.opening .pgrid, #home.opening .ggrid { opacity: .55; pointer-events: none; transition: opacity .2s; }
.home-fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.home-fx i { position: absolute; border-radius: 50%; }
.home-fx .hg1 { width: 900px; height: 900px; right: -360px; top: -440px; background: radial-gradient(circle, rgba(140,17,228,0.38) 0%, rgba(140,17,228,0) 66%); }
.home-fx .hg2 { width: 820px; height: 820px; left: -420px; bottom: -460px; background: radial-gradient(circle, rgba(221,0,93,0.26) 0%, rgba(221,0,93,0) 66%); }
.home-fx .hg3 { width: 560px; height: 560px; right: -220px; bottom: -220px; background: radial-gradient(circle, rgba(51,245,255,0.10) 0%, rgba(51,245,255,0) 66%); }

.home-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 14px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); padding: 10px 14px; }
.home-top .brand { text-decoration: none; color: inherit; }
.home-tabs a { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 9px; font: 600 13px var(--fb); color: var(--body); text-decoration: none; }
.home-tabs a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.home-tabs a.on { color: #fff; background: linear-gradient(135deg, rgba(221,0,93,0.85), rgba(140,17,228,0.85)); }
.home-tabs a:focus-visible, .pcard-open:focus-visible, .gcard:focus-visible, .role-chip:focus-visible { outline: 2px solid var(--cy); outline-offset: 2px; }
.seg .n, .home-tabs .n { font-size: 11px; opacity: .75; }
.home-me { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.role-chip { height: 28px; padding: 0 12px; border-radius: 99px; font: 700 11px var(--fd); letter-spacing: 1.4px; text-transform: uppercase; cursor: pointer; border: 1px solid var(--st-cy-bd); background: var(--st-cy); color: var(--cy); }
.role-chip[data-role="editor"] { border-color: var(--st-mg-bd); background: var(--st-mg); color: var(--mg-t); }
.role-chip[data-role="contributor"] { border-color: var(--st-vi-bd); background: var(--st-vi); color: var(--pl); }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.me-name { font: 600 12.5px var(--fb); color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }

.home-wrap { position: relative; z-index: 1; max-width: 1360px; margin: 0 auto;
  padding-block: 28px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hh-text { min-width: 0; }
.home-head h1 { margin: 0; font: 800 clamp(28px, 4vw, 40px)/1 var(--fd); letter-spacing: -.5px; text-wrap: balance; }
.hh-sub { margin: 8px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.hh-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hh-tools input[type=search] { width: 230px; height: 38px; }
.home-empty { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 22px; border: 1px dashed rgba(255,255,255,0.18); border-radius: 16px; background: rgba(255,255,255,0.03); margin-bottom: 16px; }
.home-empty b { font: 700 16px var(--fd); }
.home-empty span { color: var(--muted); max-width: 62ch; line-height: 1.5; }

/* ---------- tarjetas de proyecto ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.pcard { position: relative; min-width: 0; border-radius: var(--r); border: 1px solid var(--hair); overflow: hidden;
  background: linear-gradient(155deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02) 45%), rgba(16,11,30,0.62); box-shadow: 0 18px 44px rgba(0,0,0,0.38); transition: border-color .15s, transform .15s; }
.pcard:hover { border-color: rgba(204,102,255,0.55); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .pcard, .pcard:hover { transition: none; transform: none; } }
.pcard-open { display: flex; flex-direction: column; color: inherit; text-decoration: none; height: 100%; }
.pcard-cover { position: relative; aspect-ratio: 16 / 10; background: #0d0a16; overflow: hidden; }
.pcard-cover video, .pcard-cover img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: 100%; }
.pcard-cover video.gray { filter: saturate(0); }
.pcard-format { position: absolute; left: 10px; bottom: 10px; padding: 3px 8px; border-radius: 7px; font-size: 11px; color: #fff; background: rgba(7,6,13,0.72); border: 1px solid rgba(255,255,255,0.14); }
/* el set gris del blockout cuando no hay nada generado */
.pcard-set { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--set-sky) 0 56%, var(--set-ground) 56% 100%); }
.pcard-set .horizon { position: absolute; left: 0; right: 0; top: 56%; height: 1px; background: rgba(0,0,0,0.18); }
.pcard-set::before { content: ""; position: absolute; left: 44%; top: 30%; width: 7%; height: 38%; border-radius: 99px;
  background: repeating-linear-gradient(135deg, #e3261f 0 5px, #141414 5px 10px); box-shadow: 0 6px 8px rgba(0,0,0,0.25); }
.pcard-set span { position: absolute; bottom: 12px; right: 12px; font: 600 11px var(--fb); color: #2b2b2b; background: rgba(255,255,255,0.6); padding: 3px 8px; border-radius: 6px; }
.pcard-body { display: flex; flex-direction: column; gap: 9px; padding: 14px 16px 16px; }
.pcard-body h3 { margin: 0; font: 700 18px/1.2 var(--fd); padding-right: 30px; overflow-wrap: anywhere; }
.shotstrip { display: flex; gap: 2px; height: 7px; border-radius: 99px; overflow: hidden; }
.shotstrip i { display: block; min-width: 3px; }
.shotstrip i.a { background: linear-gradient(90deg, var(--mg), var(--pu)); }
.shotstrip i.b { background: linear-gradient(90deg, var(--pu), var(--bl)); }
.pcard-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11.5px; color: var(--muted); }
.pills { display: inline-flex; gap: 3px; }
.pills b { width: 9px; height: 15px; border-radius: 99px; background: repeating-linear-gradient(135deg, var(--c) 0 3px, #141414 3px 6px); border: 1px solid rgba(255,255,255,0.2); }
.pcard-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.st { padding: 3px 9px; border-radius: 99px; font: 600 11px var(--fb); border: 1px solid; white-space: nowrap; }
.st.gr { color: #c9f7a6; background: var(--st-gr); border-color: var(--st-gr-bd); }
.st.cy { color: var(--cy); background: var(--st-cy); border-color: var(--st-cy-bd); }
.st.vi { color: var(--pl); background: var(--st-vi); border-color: var(--st-vi-bd); }
.st.usd { color: var(--ink); background: rgba(255,255,255,0.06); border-color: var(--field-bd); font-family: var(--fm); }
.pcard-foot { margin-top: 2px; }
.pcard-more { position: absolute; right: 10px; top: 10px; background: rgba(7,6,13,0.7); }
.pmenu { position: absolute; right: 10px; top: 46px; z-index: 6; display: flex; flex-direction: column; padding: 6px; min-width: 170px; border-radius: 12px; }
.pmenu button { text-align: left; border: 0; background: transparent; color: var(--ink); padding: 9px 12px; border-radius: 8px; font: 600 12.5px var(--fb); cursor: pointer; }
.pmenu button:hover { background: rgba(255,255,255,0.08); }
.pmenu button.warn { color: #ffbb33; }

.archived { margin-top: 26px; padding: 6px 14px; }
.arch-head { width: 100%; display: flex; justify-content: space-between; align-items: center; background: transparent; border: 0; padding: 10px 0; cursor: pointer; color: inherit; }
.arch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--hair); }
.arch-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.arch-name b { font: 600 14px var(--fd); }
.arch-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.warn-text { color: #ffbb33; font-weight: 600; }

/* ---------- generaciones ---------- */
.gfilters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.gfilters .seg { flex-wrap: wrap; }
.gfilters select { width: auto; min-width: 200px; height: 38px; }
.gfilters input[type=search] { width: 240px; height: 38px; }
.usage { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--muted); min-width: 200px; }
.usage i { display: block; height: 6px; border-radius: 99px; background: var(--field); border: 1px solid var(--field-bd); position: relative; overflow: hidden; }
.usage i::after { content: ""; position: absolute; inset: 0; width: var(--w); background: linear-gradient(90deg, var(--cy), var(--pu)); }
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 14px; }
.gcard { display: flex; flex-direction: column; text-align: left; padding: 0; min-width: 0; border-radius: 16px; border: 1px solid var(--hair); overflow: hidden; cursor: pointer; color: inherit;
  background: linear-gradient(155deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02) 45%), rgba(16,11,30,0.62); transition: border-color .15s; }
.gcard:hover { border-color: rgba(51,245,255,0.5); }
.gcard-media { position: relative; aspect-ratio: 4 / 5; background: #0d0a16; overflow: hidden; }
.gcard-media.light { background: #d8d8d3; }
.gcard-media video, .gcard-media img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: 100%; }
.gcard-media.light img { object-fit: contain; }
.gbadge { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 99px; font: 700 10px var(--fd); letter-spacing: 1.4px; text-transform: uppercase; border: 1px solid; background: rgba(7,6,13,0.75); }
.gbadge.gr { color: #c9f7a6; border-color: var(--st-gr-bd); }
.gbadge.cy { color: var(--cy); border-color: var(--st-cy-bd); }
.gbadge.vi { color: var(--pl); border-color: var(--st-vi-bd); }
.gbadge.mg { color: var(--mg-t); border-color: var(--st-mg-bd); }
.gcard-cap { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
.gcard-cap b { font: 600 13px var(--fd); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-cap span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gen-view { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; align-items: start; }
.gen-media { display: flex; align-items: center; justify-content: center; min-height: 240px; border-radius: 12px; background: rgba(5,3,12,0.55); overflow: hidden; }
.gen-media.light { background: #d8d8d3; }
.gen-media video, .gen-media img { max-width: 100%; max-height: 68vh; display: block; }
.gen-dl { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.gen-dl dt { font: 600 10.5px var(--fd); letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
.gen-dl dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.gen-note:empty { display: none; }
@media (max-width: 820px) { .gen-view { grid-template-columns: 1fr; } }

/* ---------- roles ---------- */
.role-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.role-row { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--field-bd); background: var(--field); line-height: 1.45; }
.role-row.me { border-color: rgba(204,102,255,0.6); background: rgba(140,17,228,0.16); }
.role-name { font: 700 13px var(--fd); }
@media (max-width: 560px) { .role-row { grid-template-columns: 1fr; gap: 4px; } }
.form-col { display: flex; flex-direction: column; gap: 6px; }
.form-col .lbl { margin-top: 6px; }

/* ---------- editor dentro del artifact ---------- */
body[data-view="home"] #toast { bottom: 28px; }
.lock { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 4px 0 10px; border-radius: 99px; font: 600 11px var(--fb); white-space: nowrap;
  color: #ffd8a8; background: rgba(255,180,0,0.12); border: 1px solid rgba(255,180,0,0.4); }
.lock[hidden] { display: none !important; }
.lock::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.lock .btn.sm { height: 20px; padding: 0 8px; font-size: 11px; border-radius: 99px; }
.lock > span:empty + button[hidden] { display: none; }
.ro-val { padding: 7px 10px; border-radius: 9px; border: 1px dashed var(--field-bd); color: var(--body); overflow-wrap: anywhere; }
body.ro #btn-add, body.ro #vt-view, body.ro #vt-key, body.ro #vt-cut { opacity: .4; }
body.ro #insp input, body.ro #insp select, body.ro #insp textarea { pointer-events: none; opacity: .62; }
.ex-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ex-status { flex: 1 1 200px; min-width: 0; }
.table-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .home-top { gap: 10px; }
  .home-me { margin-left: 0; width: 100%; }
  .hh-tools, .hh-tools input[type=search], .gfilters select, .gfilters input[type=search] { width: 100%; }
  .gfilters .seg button { padding: 0 8px; }
}

/* quién entra al Blockout (solo Editor) */
.people-box { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.people-list { display: flex; flex-direction: column; gap: 6px; }
.people-row, .people-add { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.people-mail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.people-box select, .people-box input { height: 34px; border-radius: 9px; border: 1px solid var(--field-bd); background: var(--field); color: var(--ink); font: 500 13px var(--fb); padding: 0 8px; min-width: 0; }
@media (max-width: 560px) { .people-row, .people-add { grid-template-columns: 1fr auto; } .people-row > :last-child, .people-add > :last-child { grid-column: 1 / -1; justify-self: end; } }
