:root {
  --black: #1b1a19;
  --bg: #151413;
  --panel: #1f1d1c;
  --panel-2: #282624;
  --panel-3: #33302d;
  --line: rgba(232, 228, 227, 0.1);
  --line-2: rgba(232, 228, 227, 0.18);
  --taupe: #46423f;
  --gold: #cd8f23;
  --gold-2: #dea23c;
  --bone: #e8e4e3;
  --muted: rgba(232, 228, 227, 0.6);
  --faint: rgba(232, 228, 227, 0.38);
  --danger: #e5776d;
  --font-h: "Tomorrow", system-ui, sans-serif;
  --font-b: "Arimo", system-ui, sans-serif;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--bone); font-family: var(--font-b); font-size: 14px; -webkit-font-smoothing: antialiased; }
body.booting { visibility: hidden; }
[hidden] { display: none !important; }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: rgba(205, 143, 35, 0.4); }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.big { width: 40px; height: 40px; stroke-width: 1.2; }
.spacer { flex: 1; }
.eyebrow { font-family: var(--font-h); text-transform: uppercase; letter-spacing: 0.22em; font-size: 11px; color: var(--gold); font-weight: 600; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); font-family: var(--font-h); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11.5px; font-weight: 600; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--black); }
.btn.primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .i { width: 16px; height: 16px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); flex: none; transition: color .15s, background .15s; }
.icon-btn:hover { color: var(--bone); background: var(--panel-2); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.icon-btn.recording { color: #fff; background: #b3261e; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(179, 38, 30, 0.25); } }
.link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; }
.link-btn:hover { color: var(--bone); }
.link-btn .i { width: 15px; height: 15px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line-2); background: none; color: var(--muted); font-size: 12px; }
.toggle .i { width: 15px; height: 15px; }
.toggle[aria-pressed="true"] { color: var(--black); background: var(--gold); border-color: var(--gold); }

/* Login */
#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--black); }
.login-bg { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21,20,19,.55), rgba(21,20,19,.92)), url("https://images.squarespace-cdn.com/content/v1/678622ece9ac2475e7416d2b/16763a5c-5670-4337-805d-133c502461fc/AE6A7684_smaller.JPG?format=2500w") center/cover; }
.login-card { position: relative; width: 100%; max-width: 380px; background: rgba(27, 26, 25, 0.86); backdrop-filter: blur(10px); border: 1px solid var(--line-2); border-top: 3px solid var(--gold); border-radius: 10px; padding: 32px 28px; display: flex; flex-direction: column; gap: 10px; }
.login-logo { height: 44px; align-self: flex-start; filter: invert(1); margin-bottom: 6px; }
.login-card h1 { font-family: var(--font-h); text-transform: uppercase; font-size: 24px; margin: 0; letter-spacing: .02em; }
.login-card p { color: var(--muted); margin: 0 0 10px; line-height: 1.5; }
.login-card label { font-size: 12px; color: var(--muted); }
.login-card input { height: 42px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 12px; outline: none; }
.login-card input:focus { border-color: var(--gold); }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* Layout */
#app { display: grid; grid-template-columns: 248px minmax(380px, 1fr) minmax(0, 1.35fr); height: 100vh; height: 100dvh; overflow: hidden; }
#app.no-viewer { grid-template-columns: 248px 1fr 0; }
#app.no-viewer #viewer { display: none; }
.bar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }

/* Sidebar */
#sidebar { background: #111010; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; padding: 16px 12px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 6px; }
.brand-logo { height: 28px; filter: invert(1); }
.brand span { font-family: var(--font-h); text-transform: uppercase; letter-spacing: .22em; font-size: 11px; color: var(--gold); font-weight: 700; padding-left: 10px; border-left: 1px solid var(--line-2); }
#sidebar .brand span { letter-spacing: .08em; font-size: 10px; line-height: 1.35; min-width: 0; }
@media (max-width: 600px) {
  .home-bar .brand span { display: none; }
}
.side-label { font-family: var(--font-h); text-transform: uppercase; letter-spacing: .18em; font-size: 10.5px; color: var(--faint); padding: 0 6px; margin-top: 4px; }
#projects { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 1px; }
#projects li { display: flex; align-items: center; gap: 4px; border-radius: 6px; color: var(--muted); }
#projects li button.open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; }
#projects li .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
#projects li .d { font-size: 11px; color: var(--faint); }
#projects li:hover { background: var(--panel); color: var(--bone); }
#projects li.active { background: var(--panel-2); color: var(--bone); box-shadow: inset 2px 0 0 var(--gold); }
#projects li .icon-btn { width: 30px; height: 30px; opacity: 0; }
#projects li:hover .icon-btn, #projects li.active .icon-btn { opacity: 1; }
#projects .empty-list { color: var(--faint); font-size: 12.5px; padding: 8px 10px; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 6px 0; display: flex; flex-direction: column; gap: 10px; font-size: 11.5px; color: var(--faint); }
.side-foot .warn { color: var(--danger); }

/* Chat */
#chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); background: var(--bg); }
#projectTitle { font-family: var(--font-h); text-transform: uppercase; font-size: 14px; letter-spacing: .05em; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; padding: 4px 6px; margin-left: -6px; }
#projectTitle[contenteditable="true"] { outline: 1px solid var(--gold); background: var(--panel); text-overflow: clip; }
#projectTitle:hover { background: var(--panel); cursor: text; }
#messages { flex: 1; overflow-y: auto; padding: 28px 24px 12px; display: flex; flex-direction: column; gap: 18px; }
.welcome { margin: auto 0; max-width: 600px; }
.welcome h2 { font-family: var(--font-h); text-transform: uppercase; font-size: 40px; line-height: 1; margin: 10px 0 14px; letter-spacing: .01em; }
.welcome p { color: var(--muted); line-height: 1.6; margin: 0; max-width: 520px; }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.starters button { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s; }
.starters button:hover { border-color: var(--gold); }
.starters strong { font-family: var(--font-h); text-transform: uppercase; font-size: 12.5px; letter-spacing: .05em; }
.starters span { color: var(--muted); font-size: 12.5px; }

.msg { max-width: 94%; line-height: 1.6; font-size: 14.5px; }
.msg.user { align-self: flex-end; background: var(--panel-2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px 12px 3px 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user .atts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg.user .att { font-size: 11.5px; color: var(--gold); border: 1px solid rgba(205,143,35,.4); border-radius: 99px; padding: 1px 8px; display: inline-flex; gap: 4px; align-items: center; }
.msg.user .att .i { width: 12px; height: 12px; }
.msg.assistant { align-self: stretch; max-width: 100%; }
.msg.assistant .body p { margin: 0 0 10px; }
.msg.assistant .body :is(ul, ol) { margin: 0 0 10px; padding-left: 20px; }
.msg.assistant .body code { background: var(--panel-2); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.activity { font-size: 12px; color: var(--faint); border-left: 2px solid var(--panel-3); padding: 2px 0 2px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 3px; }
.activity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity .live { color: var(--muted); }
.activity .live::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: .2; } }
details.research { font-size: 12px; color: var(--faint); margin-bottom: 10px; }
details.research summary { cursor: pointer; user-select: none; }
details.research .activity { margin: 8px 0 0; }
details.thinking { font-size: 12px; color: var(--faint); margin-bottom: 10px; }
details.thinking summary { cursor: pointer; user-select: none; }
details.thinking div { white-space: pre-wrap; padding: 6px 0 0 12px; max-height: 220px; overflow-y: auto; line-height: 1.5; }
.doc-card { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: 12px 14px; margin: 4px 0 12px; transition: border-color .15s; }
button.doc-card:hover { border-color: var(--gold); }
.doc-card .i { width: 26px; height: 26px; color: var(--gold); stroke-width: 1.5; }
.doc-card .t { font-family: var(--font-h); text-transform: uppercase; font-weight: 700; font-size: 13px; letter-spacing: .03em; }
.doc-card .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.doc-card.building .s::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite; }
.error { color: var(--danger); font-size: 13px; margin-top: 4px; }

#composer { padding: 10px 16px 16px; flex: none; }
#editTarget { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--gold); padding: 0 4px 8px; }
#editTarget span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#attachments { display: flex; flex-wrap: wrap; gap: 6px; }
#attachments:not(:empty) { margin-bottom: 8px; }
.chip { font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px 4px 3px 10px; display: inline-flex; gap: 4px; align-items: center; }
.chip-busy { background: linear-gradient(90deg, rgba(205,143,35,.28) var(--p), var(--panel-2) var(--p)); }
.chip-error { border-color: var(--danger); color: var(--danger); }
.chip button { border: 0; background: none; color: var(--muted); display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border-radius: 50%; }
.chip button:hover { color: var(--bone); background: var(--panel-3); }
.chip .i { width: 13px; height: 13px; }
.composer-box { background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 10px 8px; transition: border-color .15s; }
.composer-box:focus-within { border-color: rgba(205, 143, 35, .7); }
#input { width: 100%; resize: none; background: none; border: 0; outline: none; padding: 2px 4px 8px; max-height: 220px; line-height: 1.5; font-size: 14.5px; }
#input::placeholder { color: var(--faint); }
.composer-tools { display: flex; align-items: center; gap: 4px; }
#lang { background: none; border: 1px solid transparent; border-radius: 6px; height: 30px; color: var(--muted); font-size: 12px; padding: 0 2px; }
#lang:hover { border-color: var(--line-2); }
.hint { font-size: 11px; color: var(--faint); margin-right: 8px; }

/* Visor */
#viewer { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #0f0e0e; }
#docSelect { background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; height: 34px; padding: 0 8px; max-width: 46%; min-width: 0; font-size: 13px; }
.viewer-tools { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line); flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; margin-right: 6px; }
.seg button { display: grid; place-items: center; width: 34px; height: 30px; background: none; border: 0; color: var(--muted); }
.seg button.on { background: var(--panel-3); color: var(--bone); }
.seg .i { width: 16px; height: 16px; }
#counter { font-family: var(--font-h); font-size: 12px; min-width: 52px; text-align: center; color: var(--muted); letter-spacing: .05em; }
#slideTitle { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; margin-left: 6px; }
#stage { flex: 1; position: relative; min-height: 0; background: #0b0a0a; }
#stage:fullscreen { background: #000; }
#frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.stage-empty { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 12px; color: var(--faint); text-align: center; padding: 24px; }
#viewer.empty .stage-empty { display: grid; }
#viewer.empty #frame, #viewer.empty .viewer-tools, #viewer.empty #thumbs, #viewer.empty .bar .btn { visibility: hidden; }
#building { position: absolute; top: 12px; right: 14px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-family: var(--font-h); text-transform: uppercase; letter-spacing: .1em; background: rgba(27,26,25,.9); border: 1px solid var(--line-2); border-radius: 99px; padding: 5px 12px; }
#building .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite; }
#thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 12px; border-top: 1px solid var(--line); flex: none; scrollbar-width: thin; }
#thumbs button { flex: none; width: 132px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
#thumbs button:hover { border-color: var(--line-2); }
#thumbs button.on { border-color: var(--gold); background: var(--panel-2); }
#thumbs .n { font-family: var(--font-h); font-weight: 700; color: var(--gold); font-size: 11px; letter-spacing: .08em; }
#thumbs .tt { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Edición */
#editBar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: rgba(205,143,35,.1); border-bottom: 1px solid rgba(205,143,35,.35); flex: none; }
.edit-hint { font-size: 12.5px; color: var(--muted); }
.edit-hint strong { color: var(--gold); font-weight: 600; }
#viewer.editing .viewer-tools { display: none; }
#viewer.editing #thumbs button { opacity: .85; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; }
.modal-card { width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-card header { display: flex; align-items: center; justify-content: space-between; }
.modal-card h2 { font-family: var(--font-h); text-transform: uppercase; font-size: 16px; letter-spacing: .05em; margin: 0; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.url-form { display: flex; gap: 6px; flex: 1; min-width: 260px; }
.url-form input { flex: 1; height: 36px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 10px; outline: none; }
.url-form input:focus { border-color: var(--gold); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.img-grid button { padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: var(--bg); aspect-ratio: 4/3; }
.img-grid button:hover { border-color: var(--gold); }
.img-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-status { font-size: 12.5px; color: var(--muted); min-height: 16px; }

/* Biblioteca de imágenes */
.side-link { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 13px; text-align: left; }
.side-link:hover { color: var(--bone); border-color: var(--line-2); background: var(--panel); }
.side-link span { flex: 1; }
.side-link em { font-style: normal; font-size: 11px; color: var(--faint); }
.lib-modal { padding: 24px; }
.lib-card { width: 100%; max-width: 1280px; height: min(860px, calc(100dvh - 48px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.lib-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); flex: none; }
.lib-head h2 { font-family: var(--font-h); text-transform: uppercase; font-size: 16px; letter-spacing: .05em; margin: 0; }
.lib-sub { color: var(--faint); font-size: 12.5px; }
.lib-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr auto; }
.lib-folders { border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 10px; min-height: 0; background: #181716; }
#libFolders { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 1px; }
#libFolders li { display: flex; align-items: center; border-radius: 6px; color: var(--muted); }
#libFolders li > button.f { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 8px; background: none; border: 0; text-align: left; font-size: 13px; }
#libFolders li > button.f span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#libFolders li > button.f em { font-style: normal; font-size: 11px; color: var(--faint); }
#libFolders li .i { width: 16px; height: 16px; }
#libFolders li:hover { background: var(--panel-2); color: var(--bone); }
#libFolders li.on { background: var(--panel-3); color: var(--bone); box-shadow: inset 2px 0 0 var(--gold); }
#libFolders li.drop { background: rgba(205,143,35,.18); box-shadow: inset 0 0 0 1px var(--gold); }
#libFolders li .icon-btn { width: 26px; height: 26px; opacity: 0; }
#libFolders li .icon-btn .i { width: 14px; height: 14px; }
#libFolders li:hover .icon-btn, #libFolders li.on .icon-btn { opacity: 1; }
#libFolders li.sep { height: 1px; background: var(--line); margin: 6px 4px; pointer-events: none; }
.lib-new { display: flex; gap: 4px; }
.lib-new input, .lib-toolbar input[type=search], .lib-detail input, .lib-detail select, .lib-detail textarea, .lib-toolbar select { height: 34px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 10px; outline: none; min-width: 0; }
.lib-new input { flex: 1; }
.lib-new input:focus, .lib-toolbar input:focus, .lib-detail input:focus, .lib-detail textarea:focus { border-color: var(--gold); }
.lib-main { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.lib-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lib-toolbar input[type=search] { width: 280px; max-width: 100%; }
#libSelBar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.lib-uploads { display: flex; flex-direction: column; gap: 4px; padding: 0 16px; }
.lib-uploads:not(:empty) { padding-top: 10px; }
.lib-up { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.lib-up .bar2 { flex: 0 0 160px; height: 4px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.lib-up .bar2 i { display: block; height: 100%; background: var(--gold); transition: width .2s; }
.lib-up.err { color: var(--danger); }
.lib-up .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-grid { flex: 1; overflow-y: auto; padding: 14px 16px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-content: start; }
.lib-tile { position: relative; border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; transition: border-color .15s; }
.lib-tile:hover { border-color: var(--line-2); }
.lib-tile.on { border-color: var(--gold); }
.lib-tile.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.lib-tile .ph { aspect-ratio: 4/3; background: #0e0d0d; display: grid; place-items: center; overflow: hidden; }
.lib-tile .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-tile .ph img.contain { object-fit: contain; padding: 10px; background: repeating-conic-gradient(#2a2827 0 25%, #222 0 50%) 0 0/16px 16px; }
.lib-tile .cap { padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lib-tile .cap b { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-tile .cap span { font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-tile .chk { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 5px; border: 1.5px solid rgba(255,255,255,.8); background: rgba(0,0,0,.45); display: grid; place-items: center; opacity: 0; transition: opacity .15s; padding: 0; color: var(--black); }
.lib-tile .chk .i { width: 15px; height: 15px; stroke-width: 2.6; opacity: 0; }
.lib-tile:hover .chk, .lib-grid.selecting .chk { opacity: 1; }
.lib-tile.sel .chk { background: var(--gold); border-color: var(--gold); opacity: 1; }
.lib-tile.sel .chk .i { opacity: 1; }
.lib-tile.dragging { opacity: .4; }
.lib-empty { position: absolute; inset: 120px 24px auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.lib-empty p { margin: 4px 0; max-width: 420px; line-height: 1.5; }
.lib-empty strong { color: var(--bone); }
.lib-dropzone { position: absolute; inset: 8px; border: 2px dashed var(--gold); border-radius: 10px; background: rgba(21,20,19,.85); display: none; place-items: center; font-family: var(--font-h); text-transform: uppercase; letter-spacing: .1em; color: var(--gold); pointer-events: none; }
.lib-main.dragover .lib-dropzone { display: grid; }
.lib-detail { width: 320px; border-left: 1px solid var(--line); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; background: #181716; }
.lib-detail label { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.lib-detail textarea { height: auto; padding: 8px 10px; line-height: 1.45; resize: vertical; }
.lib-preview { border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#2a2827 0 25%, #222 0 50%) 0 0/16px 16px; display: grid; place-items: center; max-height: 220px; }
.lib-preview img { max-width: 100%; max-height: 220px; display: block; }
.lib-meta { font-size: 11.5px; color: var(--faint); line-height: 1.5; margin-top: 4px; word-break: break-all; }
.lib-meta a { color: var(--muted); }
.lib-detail-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; }
.pick-lib { display: flex; flex-direction: column; gap: 8px; }
.pick-lib-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pick-lib-head select { height: 30px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 8px; }
.img-grid button.contain img { object-fit: contain; padding: 8px; }
@media (max-width: 900px) {
  .lib-modal { padding: 0; }
  .lib-card { height: 100dvh; max-width: none; border-radius: 0; border: 0; }
  .lib-sub { display: none; }
  .lib-head .btn span { display: none; }
  .lib-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lib-folders { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; flex-direction: row; align-items: center; }
  #libFolders { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  #libFolders li { flex: none; }
  #libFolders li.sep { display: none; }
  #libFolders li .icon-btn { display: none; }
  .lib-new { flex: none; width: 150px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 12px; }
  .lib-toolbar input[type=search] { width: 100%; }
  .lib-detail { position: fixed; inset: auto 0 0 0; width: auto; max-height: 82dvh; border-left: 0; border-top: 1px solid var(--line-2); border-radius: 12px 12px 0 0; z-index: 60; box-shadow: 0 -10px 40px rgba(0,0,0,.5); }
  #libUseFolder span { display: none; }
}

#scrim { display: none; }
.only-mobile { display: none !important; }

@media (max-width: 1180px) {
  #app, #app.no-viewer { grid-template-columns: 1fr; }
  #sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 20; transform: translateX(-100%); transition: transform .2s ease; }
  #app.show-sidebar #sidebar { transform: none; }
  #app.show-sidebar #scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 15; }
  #viewer { position: fixed; inset: 0; z-index: 10; }
  #app:not(.show-viewer) #viewer { display: none; }
  .only-mobile { display: inline-flex !important; }
  .hint { display: none; }
  .starters { grid-template-columns: 1fr; }
  #viewer .bar .btn span { display: none; }
  #slideTitle { display: none; }
}
@media (max-width: 520px) {
  #messages { padding: 20px 14px 8px; }
  #composer { padding: 8px 10px 12px; }
  .welcome h2 { font-size: 32px; }
  #editSlideBtn span { display: none; }
  #speakToggle span { display: none; }
  #editBar { flex-wrap: wrap; row-gap: 6px; }
  .edit-hint { flex-basis: 100%; }
  #editBar .spacer { display: none; }
  #editBar .btn { flex: 1; }
  #speakToggle { width: 32px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Plataforma: inicio, usuarios y compartir ---------- */
#home { min-height: 100%; display: flex; flex-direction: column; background: radial-gradient(1200px 500px at 85% -10%, rgba(205,143,35,.10), transparent 60%), var(--bg); }
.home-bar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--line); }
.home-bar .spacer, .modal-actions .spacer { flex: 1; }
.home-main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 56px 28px 64px; }
.home-main h1 { font-family: var(--font-h); text-transform: uppercase; font-size: clamp(34px, 5vw, 52px); line-height: 1; margin: 12px 0 12px; letter-spacing: .01em; }
.home-sub { color: var(--muted); font-size: 15px; line-height: 1.55; max-width: 620px; margin: 0 0 32px; }
.home-label { margin: 40px 0 12px; padding: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tool-grid.small { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tool-card { display: flex; gap: 16px; align-items: flex-start; text-align: left; padding: 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); transition: border-color .15s, background .15s, transform .15s; }
.tool-card:hover:not(.soon) { border-color: var(--gold); background: var(--panel-2); transform: translateY(-1px); }
.tool-card.soon { cursor: default; opacity: .62; }
.tool-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 8px; background: rgba(205,143,35,.12); color: var(--gold); }
.tool-ic .i { width: 22px; height: 22px; }
.tool-txt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tool-txt strong { font-family: var(--font-h); text-transform: uppercase; letter-spacing: .04em; font-size: 15px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tool-txt strong em { font-style: normal; font-family: var(--font-b); text-transform: none; letter-spacing: 0; font-size: 11px; font-weight: 600; color: var(--gold); border: 1px solid rgba(205,143,35,.45); border-radius: 99px; padding: 1px 8px; }
.tool-txt > span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.small .tool-card { padding: 16px; }
#homeWarn .warn { color: var(--danger); margin: -16px 0 24px; }

.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 99px; padding: 4px 12px 4px 4px; color: var(--bone); max-width: 100%; }
.user-btn:hover { border-color: var(--line-2); background: var(--panel); }
.side-foot .user-btn { border-radius: 8px; width: 100%; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--black); font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.menu { position: fixed; z-index: 60; width: 232px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; box-shadow: 0 14px 40px rgba(0,0,0,.45); display: flex; flex-direction: column; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.menu-head span { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.menu button { display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 6px; padding: 9px 10px; text-align: left; color: var(--muted); font-size: 13px; }
.menu button:hover { background: var(--panel-3); color: var(--bone); }

.tool-head { display: flex; align-items: center; gap: 10px; padding: 2px 6px; font-family: var(--font-h); text-transform: uppercase; letter-spacing: .06em; font-size: 14px; color: var(--bone); }
.tool-head .i { color: var(--gold); }
#projects .list-label { font-family: var(--font-h); text-transform: uppercase; letter-spacing: .18em; font-size: 10.5px; color: var(--faint); padding: 12px 10px 4px; }
#projects .list-label:hover { background: none; }

.ro-badge { font-size: 11px; color: var(--gold); border: 1px solid rgba(205,143,35,.45); border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
#composer.readonly .composer-box { opacity: .55; }
.msg.user .who { font-size: 11px; color: var(--gold); margin-bottom: 4px; font-weight: 600; }

.modal-card.narrow { max-width: 460px; }
.modal-card label { font-size: 12px; color: var(--muted); margin-bottom: -8px; }
.modal-card input, .modal-card select { height: 40px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 10px; outline: none; min-width: 0; }
.modal-card input:focus, .modal-card select:focus { border-color: var(--gold); }
.modal-note { color: var(--muted); margin: 0; line-height: 1.5; font-size: 13px; }
.modal-actions.end { justify-content: flex-end; }
.share-add { display: flex; gap: 8px; }
.share-add select { flex: 1; }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.share-list li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border: 1px solid var(--line); border-radius: 6px; }
.share-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.share-list li select { height: 32px; }
.share-list .empty-list { color: var(--faint); border-style: dashed; }

.user-new { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 8px; }
.user-secret { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 8px; border: 1px solid rgba(205,143,35,.45); background: rgba(205,143,35,.08); font-size: 13px; }
.user-secret code { font-size: 15px; background: var(--bg); padding: 2px 8px; border-radius: 4px; color: var(--gold-2); }
.user-secret .btn { align-self: flex-start; }
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th { text-align: left; font-weight: 600; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.users-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users-table td select { height: 30px; }
.users-table tr.off td { opacity: .45; }
.users-table .u-act { display: flex; gap: 12px; justify-content: flex-end; white-space: nowrap; }
@media (max-width: 720px) {
  .home-main { padding: 36px 16px 48px; }
  .home-bar { padding: 12px 16px; }
  .user-new { grid-template-columns: 1fr; }
  .users-table th:nth-child(4), .users-table td:nth-child(4) { display: none; }
  .users-table td { padding: 8px 4px; }
  .users-table .u-act { flex-direction: column; gap: 6px; align-items: flex-end; }
}
