:root {
  --bg: #ffffff;
  --bg2: #ffffff;
  --bg3: #f3f2ee;
  --band: #f5f4f1;
  --line: #e4e2dd;
  --line2: #cfcdc7;
  --text: #111111;
  --muted: #6e6e6a;
  --accent: #111111;
  --accent2: #111111;
  --danger: #c0392b;
  --ok: #1e8e4e;
  --radius: 4px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
h1, h2, .home-head h1, .adm-head h1 { font-family: "Inter Tight", "Inter", -apple-system, sans-serif; letter-spacing: -.02em; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
a { color: var(--accent2); }

/* Top bar */
.topbar { height: 52px; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .2px; cursor: pointer; }
.logo { display: flex; }
.crumb { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; }
.crumb input { background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 4px 8px; color: var(--text); font-weight: 600; min-width: 0; width: 100%; max-width: 380px; }
.crumb input:hover, .crumb input:focus { border-color: var(--line2); outline: none; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.pill { background: var(--bg3); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.pill:hover { border-color: var(--line2); }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 4px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--line2); }

/* Buttons & form */
.btn { background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #a9a7a0; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 650; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.active { border-color: var(--accent); color: var(--accent2); }
.link-btn { background: none; border: none; color: var(--accent2); cursor: pointer; padding: 0; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { opacity: .5; }
input:not([type=checkbox]):not([type=range]):not([type=radio]), select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field > label, .label-row label, .frame-slot > label { font-size: 12.5px; font-weight: 600; color: #33332f; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin-bottom: 10px; }
.group { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; margin-bottom: 12px; background: var(--bg2); }
.group > summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 13px; color: #33332f; list-style: none; }
.group > summary::before { content: "▸ "; color: var(--muted); }
.group[open] > summary::before { content: "▾ "; }
.group[open] { padding-bottom: 4px; }

/* Home */
.view { min-height: calc(100vh - 52px); }
#home { max-width: 1200px; margin: 0 auto; padding: 32px 20px; }
.home-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.home-head h1 { margin: 0 0 4px; font-size: 26px; }
.home-head p { margin: 0; }
.new-project { display: flex; gap: 8px; width: min(520px, 100%); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.project-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.project-card .cover { aspect-ratio: 16/10; background: var(--bg3) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.project-card .meta { padding: 12px 14px; }
.project-card h3 { margin: 0 0 4px; font-size: 15px; }
.project-card .del { position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 4px; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border: 1px solid var(--line2); color: #111; box-shadow: 0 2px 10px rgba(0,0,0,0.12); opacity: 0; transition: opacity .15s, background .15s, border-color .15s; }
.project-card .del svg.ic { width: 16px; height: 16px; margin: 0; }
.project-card:hover .del, .project-card .del:focus-visible { opacity: 1; }
.project-card .del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (hover: none) { .project-card .del { opacity: 1; } }
.empty-home { grid-column: 1/-1; text-align: center; padding: 60px 20px; border: 1px dashed var(--line2); border-radius: 4px; color: var(--muted); }

/* Studio */
#studio { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - 52px); }
.panel { border-right: 1px solid var(--line); background: var(--bg2); overflow-y: auto; display: flex; flex-direction: column; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); position: sticky; top: 0; background: var(--bg2); z-index: 2; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: none; padding: 14px 6px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs button b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--bg3); font-size: 11px; margin-right: 4px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs button.active b { background: var(--accent); color: #fff; }
.tab-body { padding: 16px; }

.picker { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; border-radius: 4px; border: 2px solid var(--line); background: var(--bg3) center/cover no-repeat; cursor: pointer; position: relative; flex: none; }
.thumb:hover { border-color: var(--line2); }
.thumb.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(17,17,17,0.15); }
.thumb.sel::after { content: "✓"; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.thumb.add { display: grid; place-items: center; color: var(--muted); border-style: dashed; font-size: 22px; background: transparent; }
.thumb.add:hover, .thumb.add.drag { color: var(--accent2); border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chip { border: 1px solid var(--line2); background: var(--bg); border-radius: 4px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: #a9a7a0; }
.chip.on { border-color: var(--accent); color: var(--accent2); background: rgba(17,17,17,0.05); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 3px; margin-bottom: 14px; }
.seg button { background: none; border: none; padding: 7px 4px; border-radius: 4px; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.seg button.active { background: var(--text); color: #fff; }

.source-card { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 12px; background: var(--bg); }
.source-card .thumb { width: 64px; height: 48px; cursor: default; }
.source-card .t { font-size: 12.5px; }

.mask-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mask-tools input[type=range] { width: 90px; vertical-align: middle; }

.frames { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.frame-slot { display: flex; flex-direction: column; gap: 6px; }
.frame-box { aspect-ratio: 16/10; border: 1px dashed var(--line2); border-radius: 4px; background: var(--bg) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; position: relative; text-align: center; padding: 6px; }
.frame-box.filled { border-style: solid; border-color: var(--line2); }
.frame-box .x { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 12px; }

/* Stage */
.stage { display: grid; grid-template-rows: 1fr auto auto; grid-template-columns: minmax(0, 1fr); min-width: 0; min-height: 0; }
.viewer { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); justify-items: center; align-items: center; min-width: 0; min-height: 0; overflow: hidden; background:
  radial-gradient(circle at 50% 40%, #f7f6f3 0%, #ebe9e4 75%); padding: 16px; }
.img-wrap { position: relative; max-width: 100%; max-height: 100%; display: inline-block; line-height: 0; }
.img-wrap img#mainImg { max-width: 100%; max-height: calc(100vh - 52px - 250px); object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,0.17); display: block; }
.compare { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 50% 0 0); border-radius: 4px; }
.compare img { width: 100%; height: 100%; object-fit: fill; display: block; }
.compare-handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,0.21); pointer-events: none; }
.compare-handle .knob { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: #fff; color: #111; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,0.14); }
.compare-handle .knob svg.ic { width: 16px; height: 16px; }
#maskCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; border-radius: 4px; touch-action: none; }
#mainVideo { max-width: 100%; max-height: calc(100vh - 52px - 250px); border-radius: 4px; background: #000; }
.empty-viewer { width: 100%; height: 100%; display: grid; place-items: center; }
.drop-hero { border: 2px dashed var(--line2); border-radius: 4px; padding: 48px 60px; text-align: center; cursor: pointer; color: var(--muted); transition: border-color .15s; max-width: 90%; }
.drop-hero:hover, .drop-hero.drag { border-color: var(--accent); color: var(--accent2); }
.drop-hero h2 { color: var(--text); margin: 12px 0 4px; font-size: 18px; }
.pending-view { text-align: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.info-bar { min-width: 0; border-top: 1px solid var(--line); padding: 8px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 48px; background: var(--bg2); }
.info-bar .desc { flex: 1; min-width: 200px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-bar .desc b { color: var(--text); font-weight: 600; }
.info-bar .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.info-bar .btn { padding: 6px 10px; font-size: 12.5px; }

.gallery { min-width: 0; border-top: 1px solid var(--line); background: var(--bg2); padding: 10px 14px 12px; overflow-x: auto; display: flex; gap: 18px; height: 150px; }
.gal-sec { display: flex; flex-direction: column; gap: 6px; flex: none; }
.gal-sec h4 { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.gal-row { display: flex; gap: 8px; }
.gal-item { width: 132px; height: 96px; border-radius: 4px; border: 2px solid var(--line); background: var(--bg3) center/cover no-repeat; cursor: pointer; position: relative; flex: none; overflow: hidden; }
.gal-item:hover { border-color: var(--line2); }
.gal-item.sel { border-color: var(--accent); }
.gal-item video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.gal-item .badge { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.72); color: #ddd; font-size: 10px; padding: 2px 6px; border-radius: 3px; }
.gal-item .fav { position: absolute; right: 5px; top: 3px; color: var(--accent2); font-size: 14px; text-shadow: 0 1px 3px #000; }
.gal-item.pending { display: grid; place-items: center; }
.gal-item.pending .spinner { width: 22px; height: 22px; margin: 0; border-width: 2px; }
.gal-item.error { display: grid; place-items: center; color: var(--danger); font-size: 11px; text-align: center; padding: 6px; border-color: #f0c4c0; }
.gal-empty { color: var(--muted); font-size: 12px; align-self: center; }

/* Dialogs */
dialog { background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: 4px; padding: 22px; width: min(520px, 94vw); }
dialog::backdrop { background: rgba(17,17,17,.3); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 16px; font-size: 18px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#promptDlg { width: min(760px, 94vw); }
#promptText { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 12px; max-height: 60vh; overflow: auto; }

/* Toasts */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: 420px; }
.toast { background: var(--bg3); border: 1px solid var(--line2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 4px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); animation: tin .2s ease; word-break: break-word; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 900px) {
  #studio { grid-template-columns: 1fr; height: auto; }
  .panel { border-right: none; border-bottom: 1px solid var(--line); max-height: none; }
  .img-wrap img#mainImg, #mainVideo { max-height: 60vh; }
}

.side-by-side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; height: 100%; align-items: center; }
.side-by-side figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }
.side-by-side figcaption { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.side-by-side img { width: 100%; max-height: calc(100vh - 52px - 280px); object-fit: contain; border-radius: 4px; }
@media (max-width: 1100px) { .side-by-side { grid-template-columns: 1fr; } }
.side-by-side.stack { grid-template-columns: 1fr; align-content: center; gap: 10px; }
.side-by-side.stack img { max-height: calc((100vh - 52px - 330px) / 2); }

#editMode { grid-template-columns: repeat(3, 1fr); row-gap: 3px; }
#realismSeg button, #videoLook button { font-size: 12px; }

.vpresets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vpreset { background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 9px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; }
.vpreset .ic { font-size: 17px; line-height: 1; }
.vpreset:hover { border-color: #a9a7a0; }
.vpreset.on { border-color: var(--accent); color: var(--accent2); background: rgba(17,17,17,0.05); }
.move-group h5 { margin: 10px 0 6px; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.move-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.move { text-align: left; background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 10px; cursor: pointer; }
.move b { display: block; font-size: 12.5px; font-weight: 600; }
.move span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.move:hover:not(:disabled) { border-color: #a9a7a0; }
.move.on { border-color: var(--accent); background: rgba(17,17,17,0.06); }
.move.on b { color: var(--accent2); }
.move:disabled { opacity: .35; cursor: not-allowed; }
#moveSpeed { grid-template-columns: repeat(3, 1fr); }

/* ---------------- Board ---------------- */
.viewseg { grid-template-columns: 1fr 1fr; margin: 0 8px 0 0; width: 190px; }
.viewseg button { padding: 5px 4px; }
.stage { position: relative; }
.board { position: absolute; inset: 0; z-index: 6; background-color: #f4f3f0;
  background-image: radial-gradient(circle, #d9d7d1 1px, transparent 1px); background-size: 24px 24px; overflow: hidden; }
.board-viewport { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.board-viewport.panning { cursor: grabbing; }
.board-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.board-wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.board-wires path { fill: none; stroke: #b5b3ac; stroke-width: 2; }
.board-wires path.ref { stroke-dasharray: 6 6; stroke: #cfcdc7; }
.board-wires path.hot { stroke: var(--accent); stroke-width: 2.5; }
.board-wires circle { fill: #b5b3ac; }
.board-wires circle.hot { fill: var(--accent); }
.tile { position: absolute; width: 300px; background: var(--bg2); border: 2px solid var(--line2); border-radius: 4px; overflow: hidden; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.12); user-select: none; }
.tile:hover { border-color: #a9a7a0; }
.tile.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17,17,17,0.15), 0 8px 26px rgba(0,0,0,0.17); }
.tile-media { height: 196px; background: #ecebe7; transition: height .15s; display: grid; place-items: center; position: relative; }
.tile-media img, .tile-media video { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.tile-media .spinner { margin: 0; }
.tile-media .err { color: var(--danger); font-size: 12px; padding: 12px; text-align: center; }
.tile-media .play { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.7); border-radius: 4px; padding: 2px 9px; font-size: 11px; }
.tile-cap { display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 30px; box-sizing: border-box; font-size: 11.5px; border-top: 1px solid var(--line); min-width: 0; }
.tile-cap .tag { font-weight: 700; color: var(--text); white-space: nowrap; }
.tile-cap .meta { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tile-cap .fav { color: var(--accent2); }
.tile.kind-design .tag { color: #1f6fd1; }
.tile.kind-reference .tag, .tile.kind-element .tag { color: #6b4fd8; }
.tile.kind-video .tag { color: #c2327a; }
.note { position: absolute; width: 230px; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,0.14); color: #1d1b16; }
.note .note-bar { height: 22px; cursor: grab; display: flex; justify-content: flex-end; gap: 4px; padding: 3px 6px; }
.note .note-bar button { background: rgba(0,0,0,.12); border: none; border-radius: 50%; width: 16px; height: 16px; font-size: 10px; line-height: 16px; padding: 0; cursor: pointer; color: #1d1b16; }
.note textarea { background: transparent; border: none; color: #1d1b16; width: 100%; min-height: 110px; padding: 2px 12px 12px; font-size: 13px; resize: none; outline: none; }
.note.sel { outline: 3px solid var(--accent); }
.note-yellow { background: #f3dd8a; } .note-green { background: #b6e3b0; } .note-blue { background: #a9d2f3; } .note-pink { background: #f3b6cf; } .note-grey { background: #d9d9d9; }
.board-toolbar { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; align-items: center; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 4px; padding: 6px; backdrop-filter: blur(6px); }
.board-toolbar .btn { padding: 6px 10px; font-size: 12.5px; }
.board-toolbar .sep { width: 1px; height: 22px; background: var(--line2); margin: 0 2px; }
.board-toolbar .pill { min-width: 58px; }
.board-hint { position: absolute; top: 64px; left: 16px; pointer-events: none; opacity: .8; }
.composer { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(820px, calc(100% - 32px)); background: rgba(255,255,255,.97); border: 1px solid var(--line2); border-radius: 4px; padding: 10px 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.19); backdrop-filter: blur(8px); }
.composer .c-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; min-width: 0; }
.composer .c-thumb { width: 44px; height: 32px; border-radius: 4px; background: #000 center/cover no-repeat; flex: none; border: 1px solid var(--line2); }
.composer .c-title { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.composer .c-actions { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.composer .c-actions .chip { font-size: 11.5px; padding: 4px 9px; }
.composer .c-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 40px; max-height: 120px; resize: none; }
.composer .c-tools { display: flex; gap: 4px; }
.composer .c-tools .btn { padding: 8px 10px; }
.composer .c-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 6px; }
.composer .c-note { font-size: 11px; color: var(--muted); margin-top: 6px; }

#studio.panel-hidden { grid-template-columns: 1fr; }
#studio.panel-hidden .panel { display: none; }

#segPreview { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .45; border-radius: 4px; mix-blend-mode: screen; }
#segChips .chip.on { border-color: #ff3cc8; color: #b5179e; background: rgba(255,0,200,.1); }
.restart-banner { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 200; background: #fff8e6; border: 1px solid var(--accent); color: var(--text); border-radius: 4px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.17); max-width: calc(100% - 32px); }
.restart-banner .btn { padding: 4px 10px; font-size: 12px; }

/* ---------------- Run log ---------------- */
#runDlg { width: min(860px, 96vw); max-height: 90vh; overflow: auto; }
.rl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rl-head h2 { margin: 0 0 12px; }
.rl-sec { border-top: 1px solid var(--line); padding: 12px 0; }
.rl-sec h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.rl-kv { display: grid; grid-template-columns: 210px 1fr; gap: 6px 14px; font-size: 13px; }
.rl-kv .k { color: var(--muted); }
.rl-kv .v { word-break: break-word; }
.rl-kv q { color: var(--accent2); }
.rl-kv code, .rl-table code { font-size: 12px; background: var(--bg); padding: 1px 6px; border-radius: 3px; }
.rl-thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.rl-thumb { display: flex; flex-direction: column; gap: 4px; width: 160px; color: var(--muted); font-size: 11px; text-decoration: none; }
.rl-thumb img { width: 160px; height: 100px; object-fit: contain; background: #000; border-radius: 4px; border: 1px solid var(--line2); }
.rl-pre { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; max-height: 320px; overflow: auto; margin: 0; }
.rl-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rl-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.rl-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rl-table tr.bad td { color: #b3261e; }
.rl-steps { display: flex; flex-direction: column; gap: 6px; }
.rl-step { display: grid; grid-template-columns: 260px 1fr 80px; gap: 10px; align-items: center; font-size: 12.5px; }
.rl-step .bar { height: 8px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.rl-step .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.rl-step .t { text-align: right; color: var(--muted); }
.rl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.rl-note { background: #fbf6e6; border: 1px solid #e8d9a8; border-radius: 4px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 10px; }
@media (max-width: 700px) { .rl-kv { grid-template-columns: 1fr; } .rl-step { grid-template-columns: 1fr 60px; } .rl-step .bar { display: none; } }

a.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }

.seg-opts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.seg-opts .seg { margin: 0; width: 190px; }
.seg-opts .seg button { padding: 4px; font-size: 11.5px; }
.seg-opts .check { margin: 0; }
.seg-opts select { width: auto; padding: 4px 8px; font-size: 12px; }

.seg-text { display: flex; gap: 6px; margin-bottom: 6px; }
.seg-text input { flex: 1; min-width: 0; }
.seg-text.hidden, .seg-browser.hidden { display: none; }

.seg-layers { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; max-height: 300px; overflow: auto; }
.seg-layer { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; text-align: left; padding: 6px 8px; border-radius: 4px; border: 1px solid var(--line, #2a2a2a); background: transparent; color: inherit; cursor: pointer; font: inherit; font-size: 12.5px; }
.seg-layer:hover { background: rgba(0,0,0,.04); }
.seg-layer.on { border-color: #ff00c8; background: rgba(255,0,200,.10); }
.seg-layer .sw { width: 14px; height: 14px; border-radius: 3px; }
.seg-layer .meta { opacity: .6; font-size: 11px; white-space: nowrap; }
.seg-layer-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
#segPreview.layers { opacity: .62; mix-blend-mode: normal; }

#segOverlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; border-radius: 4px; }
.segs { border: 1px solid var(--line, #2a2a2a); border-radius: 4px; padding: 8px; margin-bottom: 8px; }
.segs-head { display: flex; align-items: center; gap: 8px; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.segcard { border: 1px solid var(--line, #2a2a2a); border-radius: 4px; padding: 7px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.segcard.active { border-color: var(--seg-c, #ff00c8); box-shadow: 0 0 0 1px var(--seg-c, #ff00c8) inset; }
.segcard .r1 { display: flex; align-items: center; gap: 6px; }
.segcard .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.segcard .nm { flex: 1; min-width: 0; background: transparent; border: none; color: inherit; font: inherit; font-weight: 600; font-size: 12.5px; padding: 2px; }
.segcard .cov { font-size: 11px; opacity: .6; white-space: nowrap; }
.segcard .ib { background: none; border: none; color: inherit; cursor: pointer; opacity: .7; padding: 2px 4px; font-size: 13px; }
.segcard .ib:hover { opacity: 1; }
.segcard input.ins { width: 100%; box-sizing: border-box; font-size: 12.5px; }
.segcard .r3 { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.segcard .edge { display: inline-flex; border: 1px solid var(--line, #2a2a2a); border-radius: 4px; overflow: hidden; }
.segcard .edge button { background: none; border: none; color: inherit; font-size: 11px; padding: 3px 7px; cursor: pointer; opacity: .65; }
.segcard .edge button.on { background: rgba(0,0,0,.06); opacity: 1; }
.segcard input[type=range] { flex: 1; min-width: 50px; }
.segcard .edge button { padding: 3px 6px; }

/* ---------- Icons ---------- */
svg.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.btn svg.ic, .link-btn svg.ic, .chip svg.ic { width: 15px; height: 15px; margin-right: 1px; }
.btn.small svg.ic { width: 13px; height: 13px; vertical-align: -2px; }
.icon-btn svg.ic { width: 17px; height: 17px; vertical-align: 0; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 4px; }
.icon-btn.sm svg.ic { width: 15px; height: 15px; }
.icon-btn.active { color: var(--accent2); border-color: rgba(17,17,17,0.35); }
svg.ic.filled { fill: currentColor; }
kbd { font: 10.5px ui-monospace, Menlo, monospace; padding: 1px 4px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); background: rgba(0,0,0,.06); margin-left: 3px; }
.btn.primary kbd { border-color: rgba(0,0,0,.2); background: rgba(0,0,0,.08); }

/* ---------- Edit tab (simplified) ---------- */
.ed-label { font-size: 11px; font-weight: 650; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.modegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.modegrid button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; transition: border-color .12s, color .12s; }
.modegrid button svg.ic { width: 19px; height: 19px; }
.modegrid button:hover { color: var(--text); border-color: var(--line2); }
.modegrid button.active { color: var(--accent2); border-color: var(--accent); background: rgba(17,17,17,0.05); }
.mode-desc { margin: 8px 2px 12px; line-height: 1.4; min-height: 17px; }
.ed-card { border: 1px solid var(--line); border-radius: 4px; background: var(--bg); padding: 12px; margin-bottom: 10px; }
.ed-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.ed-head b { font-weight: 650; }
.ed-head .step { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--bg3); border: 1px solid var(--line2); font-size: 11px; font-weight: 700; color: var(--muted); flex: none; }
.grow { flex: 1; }
.count-badge { font-size: 11px; font-weight: 650; color: var(--accent2); background: rgba(17,17,17,0.07); border-radius: 4px; padding: 1px 7px; }
.toolrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 6px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 7px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; color: #33332f; cursor: pointer; font-size: 11.5px; font-weight: 600; }
.tool svg.ic { width: 18px; height: 18px; }
.tool:hover { border-color: var(--line2); color: var(--text); }
.tool.active { border-color: var(--accent); color: var(--accent2); background: rgba(17,17,17,0.05); }
.tool:disabled { opacity: .5; cursor: progress; }
.zone-extra { margin-top: 10px; }
#zoneSection > .seg-text, #zoneSection > .brush-row, #zoneSection > .seg-status, #zoneSection > #segPtBar, #zoneSection > #segEngineNote, #zoneSection > .seg-auto, #zoneSection > .segs, #zoneSection > #segChips:not(:empty) { margin-top: 10px; }
.in-ic { flex: 1; position: relative; display: flex; min-width: 0; }
.in-ic svg.ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 14px; height: 14px; }
.in-ic input { flex: 1; min-width: 0; padding-left: 30px !important; }
.brush-row { display: flex; align-items: center; gap: 10px; }
.brush-row label { display: flex; align-items: center; gap: 8px; flex: 1; }
.brush-row input[type=range] { flex: 1; }
.seg-status { font-size: 12px; line-height: 1.45; color: #55554f; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; }
#segPtBar { display: flex; gap: 6px; }
.sub-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: #33332f; margin-bottom: 6px; }
.segs { border: none; padding: 0; }
details.mini { margin-top: 10px; }
details.mini > summary { list-style: none; cursor: pointer; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; user-select: none; }
details.mini > summary::-webkit-details-marker { display: none; }
details.mini > summary:hover { color: var(--text); }
details.mini[open] > summary { color: var(--text); margin-bottom: 8px; }
details.mini .seg-opts { display: flex; flex-direction: column; gap: 2px; }
details.mini .seg-opts .check { margin-bottom: 6px; }
#editInstrBlock textarea { width: 100%; }
.out-card > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
.out-card > summary::-webkit-details-marker { display: none; }
.out-card .chev { transition: transform .15s; color: var(--muted); }
.out-card[open] .chev { transform: rotate(90deg); }
.out-card[open] > summary { margin-bottom: 4px; }
.go-bar { position: sticky; bottom: 0; background: var(--bg2); box-shadow: 0 -14px 14px -4px var(--bg2); padding: 8px 0 4px; margin-top: 4px; z-index: 2; }
.go-bar .btn.big { margin-top: 0; }
.seg-layer .gi { display: inline-flex; align-items: center; gap: 6px; }
.seg-layer .gi svg.ic { width: 14px; height: 14px; color: var(--muted); }
.segcard .ib svg.ic { width: 14px; height: 14px; }
.segcard .ib.on { color: var(--seg-c, var(--accent2)); opacity: 1; }
.vpreset .ic svg.ic, .vpreset svg.ic { width: 18px; height: 18px; }
.badge svg.ic, .play svg.ic, .fav svg.ic { width: 11px; height: 11px; vertical-align: -1px; }
.fav svg.ic { fill: currentColor; }
.err svg.ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

/* ---------- Render / Video tabs (same card style as Editar) ---------- */
.modegrid.cols5 { grid-template-columns: repeat(5, 1fr); gap: 5px; }
.modegrid.cols5 button { padding: 9px 2px 7px; font-size: 11px; }
.modegrid.cols3 { grid-template-columns: repeat(3, 1fr); }
.modegrid.cols2 { grid-template-columns: 1fr 1fr; }
.modegrid.compact button { flex-direction: row; justify-content: center; gap: 6px; padding: 8px 6px; font-size: 12px; background: var(--bg2); }
.modegrid.compact button svg.ic { width: 16px; height: 16px; }
.sub-label { font-size: 11.5px; font-weight: 650; color: #55554f; margin: 0 0 6px 2px; }
[data-body="render"] > .ed-label:first-child, [data-body="edit"] > .ed-label { margin-top: 4px; }
[data-body="render"] .modegrid.cols5 { margin-bottom: 12px; }
.go-hint { text-align: center; margin: 0 0 6px; line-height: 1.45; }
.go-hint:empty { display: none; }
details.mini > summary .muted { margin-left: 2px; }
#sceneBox .grid2, #sceneBox .field { margin-top: 0; }
#sceneBox[open] { padding-top: 2px; }
.ed-card .frames { margin: 0; }
.ed-card .vpresets { margin: 0; }
.ed-card textarea { width: 100%; }
#movesSummary { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-card .vpreset { background: var(--bg2); border-color: var(--line); color: #33332f; font-weight: 600; font-size: 11.5px; padding: 9px 2px 7px; gap: 5px; }
.ed-card .vpreset:hover { border-color: var(--line2); color: var(--text); }
.ed-card .vpreset.on { border-color: var(--accent); color: var(--accent2); background: rgba(17,17,17,0.05); }
#presetChips button { padding: 8px 2px 6px; }
.modegrid.compact button span { white-space: nowrap; }

/* Video frames: clickable slots + picker */
.frame-box { cursor: pointer; transition: border-color .12s, background-color .12s; }
.frame-box:hover, .frame-box.drag { border-color: var(--accent); color: var(--accent2); }
.frame-box.drag { background-color: rgba(17,17,17,0.05); }
.fb-empty { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.fb-empty svg.ic { width: 20px; height: 20px; margin-bottom: 2px; }
.fb-empty b { font-size: 12px; font-weight: 600; }
.fb-empty small { font-size: 10.5px; opacity: .7; }
.fb-change { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 3px 7px; opacity: 0; transition: opacity .12s; display: inline-flex; align-items: center; gap: 4px; }
.fb-change svg.ic { width: 12px; height: 12px; }
.frame-box.filled:hover .fb-change { opacity: 1; }
.frame-box .x { display: grid; place-items: center; z-index: 1; }
.frame-box .x svg.ic { width: 12px; height: 12px; }
dialog.frame-pick { width: min(760px, 94vw); }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 62vh; overflow: auto; padding: 2px; }
.fp-item { aspect-ratio: 16/10; border: 2px solid transparent; border-radius: 4px; background: var(--bg) center/cover no-repeat; cursor: pointer; position: relative; padding: 0; outline: 1px solid var(--line); }
.fp-item:hover { border-color: var(--accent2); }
.fp-item.on { border-color: var(--accent); }
.fp-item .badge { position: absolute; left: 6px; bottom: 6px; }
.fp-sel { position: absolute; top: 6px; left: 6px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 4px; padding: 2px 6px; }
.gal-item[draggable="true"] { cursor: grab; }
.fp-item .badge { background: rgba(0,0,0,.72); color: #ddd; font-size: 10px; padding: 2px 6px; border-radius: 3px; }

.fp-zoom { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 4px; border: none; background: rgba(0,0,0,.65); color: #fff; display: grid; place-items: center; cursor: zoom-in; opacity: .85; transition: opacity .12s, background .12s; }
.fp-zoom svg.ic { width: 15px; height: 15px; }
.fp-zoom:hover { opacity: 1; background: rgba(0,0,0,.85); }
.fp-item:focus-visible { outline: 2px solid var(--accent); }
dialog.frame-pick form { position: relative; }
.fp-preview { position: absolute; inset: 0; background: var(--bg2); border-radius: 4px; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; z-index: 3; }
.fp-preview img { width: 100%; height: 100%; min-height: 0; object-fit: contain; background: #000; border-radius: 4px; }
.fp-nav { position: absolute; top: calc(50% - 40px); width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.fp-nav:hover { background: rgba(0,0,0,.85); }
.fp-nav.prev { left: 10px; } .fp-nav.prev svg.ic { transform: rotate(180deg); }
.fp-nav.next { right: 10px; }
.fp-bar { display: flex; align-items: center; gap: 10px; }
.fp-cap { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
dialog.frame-pick { width: min(1100px, 94vw); }
dialog.frame-pick .fp-grid { min-height: min(62vh, 620px); align-content: start; }

/* Compare bar + before/after tags */
.cmp-bar { position: absolute; top: 12px; left: 12px; right: 12px; margin: 0 auto; width: fit-content; z-index: 4; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border: 1px solid var(--line2); border-radius: 4px; padding: 6px 6px 6px 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.16); max-width: calc(100% - 24px); }
.cmp-lbl { font-size: 12.5px; font-weight: 600; color: #33332f; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#cmpWith { max-width: 300px; min-width: 0; padding: 5px 8px; font-size: 12.5px; }
.cmp-modes { display: inline-flex; border: 1px solid var(--line2); border-radius: 4px; overflow: hidden; }
.cmp-modes button { background: none; border: none; color: var(--muted); padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cmp-modes button svg.ic { width: 14px; height: 14px; }
.cmp-modes button.active { background: var(--bg3); color: var(--accent2); }
.cmp-tag { position: absolute; top: 10px; z-index: 2; background: rgba(0,0,0,.66); color: #eee; font-size: 11.5px; line-height: 1.3; padding: 4px 8px; border-radius: 4px; pointer-events: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-tag b { color: #fff; }
.cmp-tag.left { left: 10px; } .cmp-tag.right { right: 10px; }
.side-by-side figcaption { justify-content: flex-start; gap: 4px; }
.side-by-side figcaption b { color: var(--text); }
.viewer:has(#cmpBar:not(.hidden)) { padding-top: 62px; }
.cmp-bar > * { flex-shrink: 0; } .cmp-bar > #cmpWith { flex-shrink: 1; }

#videoDurSeg { display: grid; }
#videoFmt button span { font-size: 11.5px; }
.x2 { font-size: 10px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 5px; margin-left: 2px; }
#renderCountHint b { color: var(--text); font-weight: 600; }

dialog.defect-dlg { width: min(460px, 94vw); }
.defect-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.defect-opts label { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; font-size: 13.5px; line-height: 1.35; text-align: left; justify-content: flex-start; transition: border-color .12s, background .12s; }
.defect-opts input[type=radio] { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; min-width: 0; margin: 0; padding: 0; border: 1.5px solid var(--line2); border-radius: 50%; background: #fff; display: grid; place-items: center; cursor: pointer; }
.defect-opts input[type=radio]::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .12s; }
.defect-opts input[type=radio]:checked { border-color: var(--accent); }
.defect-opts input[type=radio]:checked::after { transform: scale(1); }
.defect-opts input[type=radio]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.defect-dlg .rl-head .icon-btn:focus:not(:focus-visible) { outline: none; box-shadow: none; }
#defectGo:disabled { opacity: .45; cursor: default; }
.defect-opts label:hover { border-color: var(--line2); }
.defect-opts label:has(input:checked) { border-color: var(--accent); background: rgba(17,17,17,0.05); }

/* ---------- Modo Sencillo ---------- */
.viewseg { grid-template-columns: repeat(3, 1fr); width: 270px; }
.simple { position: fixed; top: 52px; left: 0; right: 0; bottom: 0; z-index: 8; background: var(--bg); overflow: auto; }
.sp-wrap { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; max-width: 1400px; margin: 0 auto; padding: 24px; min-height: 100%; box-sizing: border-box; }
.sp-controls { display: flex; flex-direction: column; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; padding: 18px; align-self: start; position: sticky; top: 0; }
.sp-controls .sub-label { margin: 8px 2px 0; }
.sp-tabs button { padding: 12px 6px; font-size: 14px; }
.sp-src { aspect-ratio: 16/10; width: 100%; border: 1px dashed var(--line2); border-radius: 4px; background: var(--bg) center/cover no-repeat; color: var(--muted); cursor: pointer; display: grid; place-items: center; position: relative; padding: 0; }
.sp-src:hover { border-color: var(--accent); color: var(--accent2); }
.sp-src.filled { border-style: solid; }
.sp-src-change { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 600; border-radius: 4px; padding: 4px 8px; display: inline-flex; align-items: center; gap: 5px; }
.sp-src-change svg.ic { width: 13px; height: 13px; }
.sp-hint { margin: 4px 2px 0; line-height: 1.45; }
.modegrid.compact.sp-res button { flex-direction: column; gap: 2px; padding-top: 10px; padding-bottom: 10px; }
.sp-res .sp-res-big { font-size: 18px; font-weight: 700; line-height: 1.1; }
.sp-res small { font-size: 12px; color: var(--muted); font-weight: 500; }
.modegrid.sp-res button.active small { color: inherit; opacity: .75; }
.sp-hint b { color: var(--text); font-weight: 600; }
.sp-controls .btn.big { margin-top: 8px; }
.sp-stage { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sp-viewer { background: radial-gradient(circle at 50% 40%, #f7f6f3 0%, #ebe9e4 75%); border: 1px solid var(--line); border-radius: 4px; min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 18px; }
.sp-media { max-width: 100%; max-height: calc(100vh - 52px - 300px); border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,0.17); display: block; }
.sp-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.sp-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--text); }
.sp-empty svg.ic { width: 34px; height: 34px; color: var(--accent2); }
.sp-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.sp-thumb { flex: none; width: 150px; aspect-ratio: 16/10; border-radius: 4px; border: 2px solid transparent; outline: 1px solid var(--line); background: var(--bg3) center/cover no-repeat; cursor: pointer; display: grid; place-items: center; color: var(--muted); padding: 0; }
.sp-thumb.on { border-color: var(--accent); }
.sp-thumb .spinner { width: 22px; height: 22px; margin: 0; }
.sp-play { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.sp-play svg.ic { width: 14px; height: 14px; fill: currentColor; }
.fp-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--accent2); background: var(--bg) !important; border: 2px dashed var(--line2) !important; font-weight: 600; font-size: 13px; }
.fp-upload svg.ic { width: 22px; height: 22px; }
@media (max-width: 900px) { .sp-wrap { grid-template-columns: 1fr; } .sp-controls { position: static; } }

/* Quitar imágenes de los selectores */
.thumb .thumb-x { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; padding: 0; display: grid; place-items: center; background: rgba(255,255,255,.95); color: #111; border: 1px solid var(--line2); border-radius: 3px; cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s; z-index: 2; }
.thumb .thumb-x svg.ic { width: 13px; height: 13px; }
.thumb:hover .thumb-x, .thumb .thumb-x:focus-visible { opacity: 1; }
.thumb .thumb-x:hover { background: #111; border-color: #111; color: #fff; } /* only removes it from the list, not a delete */
@media (hover: none) { .thumb .thumb-x { opacity: 1; } }

/* Desplegables con estilo de botón: referencias, opciones de foto real, escena detallada */
#refsBox > summary, #elementsField > summary, #photoOpts > summary, #sceneBox > summary, #movesBox > summary, #videoAdv > summary , #segOptsBox > summary { border: 1px solid var(--line2); border-radius: 4px; padding: 9px 12px; background: var(--bg); color: var(--text); font-size: 13px; font-weight: 500; transition: border-color .12s, background .12s; }
#refsBox > summary:hover, #elementsField > summary:hover, #photoOpts > summary:hover, #sceneBox > summary:hover, #movesBox > summary:hover, #videoAdv > summary:hover , #segOptsBox > summary:hover { border-color: var(--text); background: var(--band); }
#refsBox > summary::after, #elementsField > summary::after, #photoOpts > summary::after, #sceneBox > summary::after, #movesBox > summary::after, #videoAdv > summary::after , #segOptsBox > summary::after { content: ''; flex: none; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
#refsBox[open] > summary::after, #elementsField[open] > summary::after, #photoOpts[open] > summary::after, #sceneBox[open] > summary::after, #movesBox[open] > summary::after, #videoAdv[open] > summary::after , #segOptsBox[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
#refsBox[open] > summary, #elementsField[open] > summary, #photoOpts[open] > summary, #sceneBox[open] > summary, #movesBox[open] > summary, #videoAdv[open] > summary , #segOptsBox[open] > summary { border-color: var(--text); margin-bottom: 10px; }
#sceneBox > summary { white-space: nowrap; }
#sceneBox > summary .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--text); }

/* Ventanas de confirmación / aviso / texto (ui.js) */
dialog.ui-dlg { width: min(460px, 94vw); padding: 24px; }
dialog.ui-dlg h2 { font-size: 18px; margin: 0 0 8px; }
.ui-msg { margin: 0 0 18px; color: var(--muted); line-height: 1.5; white-space: pre-line; }
.ui-input { margin: 0 0 8px; }
.ui-err { color: var(--danger); font-size: 12.5px; margin: 0 0 8px; }
.ui-form .dlg-actions { margin-top: 6px; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.danger-solid:hover { filter: brightness(.92); }

/* Modelo y prompt manual: nadie los ve en la app (el modelo se define en Administración → Proveedores y modelos) */
.admin-only { display: none !important; }
.adm-tag { font-size: 10.5px; font-weight: 500; color: var(--muted); border: 1px solid var(--line2); border-radius: 3px; padding: 0 5px; margin-left: 4px; }
.out-card[open] > .grid3:first-of-type { margin-top: 8px; }

/* Acceso a Librerías en la pantalla principal */
.home-actions { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.home-actions .new-project { width: min(540px, 100%); }
.home-actions .home-lib { flex: none; }
@media (max-width: 900px) { .home-actions { flex-wrap: wrap; } }
.home-actions .home-lib { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 640px) { .home-actions { width: 100%; } .home-actions .new-project { width: 100%; } }

/* Autor (planes con varios usuarios) */
.author { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; flex: none; line-height: 1; box-shadow: 0 0 0 2px #fff; }
.gal-item > .author, .sp-thumb > .author, .lib-card > .author { position: absolute; right: 5px; bottom: 5px; z-index: 2; }
.lib-card > .author { right: 8px; bottom: auto; top: 8px; }
.lib-card.sel > .author { right: 36px; }
.tile-cap .author { width: 20px; height: 20px; font-size: 9px; box-shadow: none; }
.sp-thumb { position: relative; }
.info-bar .desc .author { width: 18px; height: 18px; font-size: 8.5px; vertical-align: middle; position: relative; top: -1px; box-shadow: none; }
.lib-by { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.lib-by .author { box-shadow: none; }

/* Barra de herramientas del board: encoger / expandir */
.board-toolbar .b-collapse svg.ic { transform: rotate(180deg); transition: transform .15s; }
.board-toolbar.collapsed .b-collapse svg.ic { transform: none; }
.board-toolbar.collapsed > :not(#bPanel):not(.b-collapse):not(#bPeers) { display: none; }
.board-toolbar.collapsed { gap: 4px; }

/* Colaboración en tiempo real (Board) */
.live-cursors { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 40; }
.rcursor { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform .09s linear, opacity .3s; will-change: transform; }
.rcursor svg { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.rcursor .rtag { position: absolute; left: 14px; top: 16px; background: var(--c); color: #fff; font: 600 11.5px/1 var(--sans, Inter, sans-serif); padding: 4px 7px; border-radius: 4px 4px 4px 0; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.rcursor.gone { opacity: 0; }
.b-peers { display: inline-flex; align-items: center; padding: 0 2px; }
.b-peers .author { width: 26px; height: 26px; font-size: 10.5px; margin-left: -6px; }
.b-peers .author:first-child { margin-left: 0; }

/* ---- Board: textos (titulares) y frames */
#boardFrames { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 0; }
.item-bar { position: absolute; display: none; gap: 2px; align-items: center; background: #fff; border: 1px solid var(--line2); border-radius: 4px; padding: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.12); z-index: 5; white-space: nowrap; }
.item-bar .ib { border: 0; background: none; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 3px; cursor: pointer; font: 700 12px/1 var(--sans, Inter, sans-serif); color: var(--text); display: inline-grid; place-items: center; }
.item-bar .ib:hover { background: var(--bg3); }
.item-bar .ib.on { background: var(--accent); color: #fff; }
.item-bar .ib svg.ic { width: 15px; height: 15px; }
.item-bar .ib-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

.btext { position: absolute; min-width: 120px; cursor: grab; }
.btext textarea { display: block; width: 100%; box-sizing: border-box; background: transparent; border: 0; outline: none; resize: none; overflow: hidden; padding: 4px 6px; color: var(--text); font-family: var(--sans, Inter, sans-serif); cursor: inherit; user-select: none; }
.btext textarea::placeholder { color: #b9b7b0; }
.btext-h1 textarea { font-size: 48px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; }
.btext-h2 textarea { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.btext-p textarea { font-size: 17px; line-height: 1.5; font-weight: 400; }
.btext:hover { outline: 1px dashed var(--line2); outline-offset: 2px; }
.btext.sel { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.btext.editing { cursor: text; outline: 1.5px solid var(--accent); }
.btext.editing textarea { cursor: text; user-select: text; }
.btext.sel .item-bar, .btext.editing .item-bar { display: flex; left: 0; top: -40px; }
.item-resize-x { position: absolute; right: -6px; top: 0; bottom: 0; width: 10px; cursor: ew-resize; display: none; }
.item-resize-x::after { content: ''; position: absolute; left: 3px; top: 50%; width: 4px; height: 22px; margin-top: -11px; border-radius: 2px; background: var(--accent); }
.btext.sel .item-resize-x { display: block; }

.bframe { position: absolute; border: 1px solid var(--line2); border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.04); cursor: grab; }
.bframe-white { background: #fff; } .bframe-grey { background: #f1f0ec; } .bframe-blue { background: #eaf2fb; } .bframe-green { background: #ebf5ee; } .bframe-yellow { background: #fbf5e2; }
.bframe:hover { border-color: #a9a7a0; }
.bframe.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bframe.drop { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17,17,17,.18); }
.bframe-title { position: absolute; left: 0; bottom: calc(100% + 6px); display: flex; align-items: baseline; gap: 8px; font: 600 15px/1.2 var(--sans, Inter, sans-serif); color: var(--text); white-space: nowrap; max-width: 100%; }
.bframe-name { outline: none; border-radius: 3px; padding: 1px 3px; margin-left: -3px; overflow: hidden; text-overflow: ellipsis; }
.bframe-name[contenteditable="true"] { background: #fff; box-shadow: 0 0 0 1.5px var(--accent); cursor: text; text-overflow: clip; }
.bframe-count { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.bframe.sel .bframe-bar { display: flex; right: 0; bottom: calc(100% + 4px); }
.item-resize { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: #fff; border: 1.5px solid var(--accent); border-radius: 2px; cursor: nwse-resize; display: none; }
.bframe.sel .item-resize, .bframe:hover .item-resize { display: block; }

/* Proyectos: personas que trabajan en cada proyecto (planes Studio / Enterprise) */
.proj-people { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-width: 0; }
.proj-people .stack { display: flex; flex: none; }
.proj-people .author { width: 26px; height: 26px; font-size: 10.5px; margin-left: -7px; }
.proj-people .author:first-child { margin-left: 0; }
.proj-people .author.more { background: var(--bg3); color: var(--muted); }
.proj-people .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Reportar un error */
dialog.rep-dlg { width: min(520px, 94vw); }
.rep-form textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 110px; margin-bottom: 10px; }
.rep-form .ui-input { width: 100%; box-sizing: border-box; margin-bottom: 10px; }
.rep-lbl { display: block; font-size: 12.5px; font-weight: 600; margin: 0 0 5px; }
.rep-attach { width: 100%; justify-content: center; border: 1px dashed var(--line2); padding: 10px; margin-bottom: 8px; }
.rep-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.rep-file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
.rep-file img, .rep-vid { width: 40px; height: 30px; object-fit: cover; border-radius: 3px; flex: none; background: var(--bg3); display: grid; place-items: center; }
.rep-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.rep-limits, .rep-mail { margin: 2px 0 10px; }
.rep-done { width: 44px; height: 44px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin-bottom: 12px; }
.rep-done svg.ic { width: 22px; height: 22px; }
.defect-more { margin: -4px 0 12px; }
.defect-more textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.defect-img { margin-bottom: 14px; }
.defect-img .rep-attach { margin-bottom: 0; }

/* ---- Board: panel flotante de opciones (conectado a la barra de abajo) */
.b-insp { position: absolute; top: 12px; right: 12px; bottom: 16px; width: 340px; max-width: calc(100% - 24px); display: flex; flex-direction: column; background: rgba(255,255,255,.98); border: 1px solid var(--line2); border-radius: 4px; box-shadow: 0 12px 40px rgba(0,0,0,.16); z-index: 30; overflow: hidden; }
.b-insp-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; flex: none; }
.b-insp-head svg.ic { width: 16px; height: 16px; }
.b-insp-body { flex: 1; overflow-y: auto; padding: 12px 14px 4px; overscroll-behavior: contain; }
.b-insp-foot { flex: none; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--bg3); }
.board.insp-open .composer { left: calc((100% - 352px) / 2); width: min(820px, calc(100% - 384px)); }
.board.insp-open .board-hint { display: none; }
.board-toolbar #bPanel.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.composer .c-opts.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* inside the panel, the prompt bar replaces the Studio's own text, picker and "Generar" parts */
.b-insp .tab-body { display: block !important; padding: 0; }
.b-insp .go-bar, .b-insp .step, .b-insp #designPicker, .b-insp .ed-card:has(#designPicker) > .ed-head,
.b-insp .ed-card:has(#renderExtra), .b-insp #editSource, .b-insp #editMode, .b-insp .ed-label:has(+ #editMode),
.b-insp #editInstrBlock > .field > .ed-head, .b-insp #editInstr, .b-insp [data-body="video"] > .ed-card:has(#firstFrame),
.b-insp #videoExtra, .b-insp [data-enhance] { display: none !important; }
.b-insp .ed-card { margin-bottom: 10px; }
.b-insp .ed-card:has(#designPicker) { padding-top: 10px; }
.b-insp .mode-desc { margin-top: 0; }
@media (max-width: 900px) {
  .b-insp { top: auto; left: 12px; right: 12px; width: auto; max-width: none; height: 46%; bottom: 150px; }
  .board.insp-open .composer { left: 50%; width: calc(100% - 32px); }
}
/* the change-text card only holds the reference images in the Board: hide it when those are hidden too (Foto real, Personas, 4K…) */
.b-insp #editInstrBlock:not(:has(#elementsField:not(.hidden))):not(:has(#editChipsBox:not(.hidden))) { display: none !important; }
.b-insp #editInstrBlock #elementsField { margin-top: 8px; }

/* ---- Barra de prompt del Board: bordes redondeados y campo que crece con el texto */
.composer { border-radius: 18px; padding: 12px 14px; }
.composer .c-thumb { border-radius: 8px; }
.composer .c-actions .chip { border-radius: 999px; padding: 5px 12px; }
.composer .c-row { align-items: flex-end; }
.composer textarea { border-radius: 14px; padding: 10px 14px; min-height: 44px; max-height: 160px; line-height: 1.45; overflow-y: auto; box-sizing: border-box; }
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer .c-tools .btn, .composer .btn { border-radius: 12px; }
.composer .c-tools .btn { height: 44px; min-width: 44px; display: inline-grid; place-items: center; }
.composer .btn.primary { height: 44px; padding: 0 20px; }
.composer .c-note { padding-left: 4px; }
.b-insp .insp-empty { display: none !important; }

/* Board prompt bar: all actions on one line (scrolls sideways only if the window is very narrow) */
.composer .c-top { gap: 8px; }
.composer .c-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.composer .c-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 4px; min-width: 0; }
.composer .c-actions::-webkit-scrollbar { display: none; }
.composer .c-actions .chip { flex: none; padding: 4px 10px; font-size: 11.5px; white-space: nowrap; }

/* Board: zone marking on the big image */
.b-zone-go { display: none; }
.b-insp .b-zone-go { display: flex; width: 100%; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.b-insp #zoneSection .toolrow { margin-top: 0; }
.board.zone-mode { background: transparent !important; pointer-events: none; }
.board.zone-mode .board-viewport, .board.zone-mode .board-toolbar, .board.zone-mode .board-hint { display: none !important; }
.board.zone-mode .composer, .board.zone-mode .b-insp, .board.zone-mode .b-zone-bar { pointer-events: auto; }
.board.zone-mode .b-insp .b-zone-go { display: none; }
#studio.board-zone .viewer { padding: 64px 368px 150px 16px; box-sizing: border-box; }
#studio.board-zone .info-bar, #studio.board-zone .gallery, #studio.board-zone #cmpBar { display: none !important; }
.b-zone-bar { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 10px; background: #111; color: #fff; border-radius: 999px; padding: 6px 6px 6px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 31; }
.b-zone-bar svg.ic { width: 15px; height: 15px; }
.b-zone-bar .btn { border-radius: 999px; background: #fff; color: #111; border-color: #fff; }
.b-insp #editInstrBlock { padding-top: 6px; }

/* Cost on the generate buttons */
.composer .btn.primary.c-go { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; gap: 2px; min-width: 120px; }
.c-go .c-go-l { font-weight: 700; }
.c-go .c-go-cost:empty { display: none; }
.c-go .c-go-cost { font-size: 11px; font-weight: 500; opacity: .75; }
.go-bar .btn .go-cost { display: block; font-size: 11.5px; font-weight: 500; opacity: .75; margin-top: 2px; }
.go-bar .btn .go-cost:empty { display: none; }

/* Prompt field: bigger and easier to read / write */
.composer .c-row { align-items: stretch; }
.composer textarea { font-size: 15px; line-height: 1.5; min-height: 56px; padding: 14px 16px; color: var(--text); }
.composer textarea::placeholder { color: #9a9892; }
.composer .c-tools .btn, .composer .btn.primary { height: auto; min-height: 56px; }
.composer .c-tools { align-items: stretch; }
/* Prompt on its own full-width line; tools (left) and the generate button (right) below it */
.composer .c-row { flex-wrap: wrap; gap: 8px; align-items: center; }
.composer .c-row > textarea { flex: 1 1 100%; width: 100%; }
.composer .c-tools { flex: 1 1 auto; gap: 4px; align-items: center; }
.composer .c-tools .btn { min-height: 36px; height: 36px; min-width: 36px; padding: 0 9px; border-radius: 10px; }
.composer .btn.primary.c-go { min-height: 44px; height: 44px; margin-left: auto; padding: 0 22px; flex-direction: row; gap: 8px; }
.c-go .c-go-cost { font-size: 12px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.35); }
.composer .c-row > .c-empty { flex: 1; }

/* Board panel: "Ideas rápidas" looks like the other option buttons, with space between them */
.b-insp #editChipsBox { margin: 0; }
.b-insp #editChipsBox > summary { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line2); border-radius: 4px; padding: 9px 12px; background: var(--bg); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; list-style: none; }
.b-insp #editChipsBox > summary::-webkit-details-marker { display: none; }
.b-insp #editChipsBox > summary:hover { border-color: var(--text); background: var(--band); }
.b-insp #editChipsBox > summary::after { content: ''; flex: none; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.b-insp #editChipsBox[open] > summary { border-color: var(--text); margin-bottom: 10px; }
.b-insp #editChipsBox[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.b-insp #editInstrBlock > .field { margin: 0; }
#movesBox, #videoAdv { margin-top: 12px; }
#segOptsBox { margin-top: 12px; }

/* Moodboard images on the Board */
.tile.kind-inspiration .tag { color: #b86e00; }
.composer select.c-kind { height: 36px; border-radius: 10px; padding: 0 28px 0 10px; font-size: 12.5px; border: 1px solid var(--line2); background-color: var(--bg); width: auto; max-width: 190px; }
.plan-level { margin: 10px 0 4px; }
.seg.seg-wrap { flex-wrap: wrap; }
.seg.seg-wrap button { flex: 1 1 auto; }

/* edit tools that don't apply to the selected image */
#editMode button.blocked { opacity: .45; }
.warn-note { margin: 6px 2px 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, #f59e0b 14%, transparent); color: var(--text, inherit); }
#videoPresets .vpreset:disabled, #ambientChips .chip:disabled { opacity: .4; cursor: not-allowed; }
#optView option[hidden] { display: none; }

/* Planta 2D · Vista: two equal halves */
#planView { grid-template-columns: 1fr 1fr; }

/* Models and prompts are set in Administración, never inside the app (the server ignores these fields) */
.tech-hidden, .admin-only.tech-hidden { display: none !important; }

/* Project header: name + pencil, saved status, last edit */
.pname-box { display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 420px; }
.pname { color: var(--text); font-weight: 600; padding: 4px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.pname:hover { background: var(--bg3); }
.pname-edit { background: none; border: 1px solid transparent; border-radius: 4px; width: 26px; height: 26px; display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; }
.pname-edit:hover { color: var(--text); border-color: var(--line2); background: var(--bg2); }
.pname-edit svg.ic { width: 14px; height: 14px; }
.pname-box input { width: 320px; max-width: 100%; }
.pmeta { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 0; }
.pmeta .sync { display: inline-flex; align-items: center; gap: 5px; }
.pmeta .sync svg.ic { width: 15px; height: 15px; }
.pmeta .sync.ok { color: #1e8e3e; }
.pmeta .sync.bad { color: var(--danger, #c0392b); font-weight: 600; }
.pmeta .sync.saving { color: var(--muted); }
.pmeta .pedited::before { content: "·"; margin-right: 10px; color: var(--line2); }
.sync-spin { width: 11px; height: 11px; border: 2px solid var(--line2); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@media (max-width: 900px) { .pmeta .pedited { display: none; } }
@media (max-width: 640px) { .pmeta .sync span { display: none; } }

/* Rol Lector: puede ver y descargar, no crear, generar ni modificar (el servidor también lo bloquea) */
body.role-viewer #renderGo, body.role-viewer #editGo, body.role-viewer #videoGo, body.role-viewer .go-bar, body.role-viewer #composer,
body.role-viewer .new-project, body.role-viewer .project-card .del, body.role-viewer .thumb-x, body.role-viewer .thumb.add, body.role-viewer .thumb.lib,
body.role-viewer .sp-go, body.role-viewer #bTidy, body.role-viewer #bNote, body.role-viewer #bText, body.role-viewer #bFrame, body.role-viewer #bUpload, body.role-viewer #bInsp,
body.role-viewer #bPanel, body.role-viewer [data-enhance], body.role-viewer #heroDrop { display: none !important; }
body.role-viewer #crumb .pname-edit { display: none; }
body.role-viewer #crumb .pname { pointer-events: none; }
body.role-viewer #projMeta::after { content: "Solo lectura"; margin-left: 10px; padding: 2px 8px; border-radius: 10px; background: var(--bg3); color: var(--muted); font-size: 11.5px; font-weight: 600; }

/* Mi equipo */
dialog.tm-dlg { width: min(720px, 94vw); max-height: 88vh; }
.tm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tm-head h2 { margin: 0; }
.tm-tabs { grid-template-columns: 1fr 1fr; max-width: 320px; margin-bottom: 12px; }
.tm-body { overflow: auto; max-height: calc(88vh - 120px); }
.tm-seats { margin: 0 0 8px; }
.tm-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 14px; }
.tm-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); }
.tm-row:first-child { border-top: 0; }
.tm-row.off { opacity: .6; }
.tm-row .author { width: 30px; height: 30px; font-size: 12px; flex: none; }
.tm-ph { width: 30px; height: 30px; border-radius: 50%; background: var(--bg3); display: grid; place-items: center; color: var(--muted); flex: none; }
.tm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tm-who b, .tm-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-role { width: auto; min-width: 110px; margin: 0; }
.tm-badge { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 10px; background: var(--bg3); white-space: nowrap; }
.tm-badge.warn { background: #fff1d6; color: #8a5a00; }
.tm-actions { display: flex; gap: 4px; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.danger { color: var(--danger, #c0392b); }
.tm-invite { border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 12px; }
.tm-invite h3 { margin: 0 0 8px; font-size: 14px; }
.tm-inv-grid { display: grid; grid-template-columns: 1.4fr 1fr .8fr; gap: 8px; }
.tm-inv-grid .ui-input { margin: 0; }
.tm-invite.full { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tm-link { border: 1px solid var(--line2); background: var(--bg2); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; display: grid; gap: 8px; }
.tm-link p { margin: 0; font-size: 13px; }
.tm-help ul { margin: 6px 0 0 18px; padding: 0; font-size: 13px; }
.tm-filters { display: flex; gap: 8px; margin-bottom: 6px; }
.tm-filters .ui-input { margin: 0; width: auto; }
.tm-log { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; }
.tm-ev { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.tm-ev:first-child { border-top: 0; }
.tm-ev.bad b { color: var(--danger, #c0392b); }
.tm-ev-t { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) { .tm-inv-grid { grid-template-columns: 1fr; } .tm-row { flex-wrap: wrap; } .tm-ev { grid-template-columns: 1fr; } }

/* Continuar con Google / Microsoft */
.social { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.social-btn { justify-content: center; gap: 10px; padding: 11px 14px; background: #fff; border: 1px solid var(--line2); color: #1f1f1f; font-weight: 600; text-decoration: none; }
.social-btn:hover { background: #f7f7f5; }
.social-btn svg { flex: none; }
.social-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 6px 0 2px; }
.social-or::before, .social-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.idn-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.idn-row:first-of-type { border-top: 0; }
.idn-row .grow { flex: 1; }
