/* =========================================================
   Visualizador de arquivos (lightbox)
   ========================================================= */
body.lbx-lock { overflow: hidden; }
.lbx {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; color: #f5f5f5;
  background: rgb(10 10 12 / .97); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.lbx.open { opacity: 1; pointer-events: auto; }
.lbx-top { flex-shrink: 0; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 10px 0 16px; }
.lbx-type { display: grid; place-items: center; height: 34px; width: 34px; flex-shrink: 0; border-radius: 10px; background: rgb(255 255 255 / .1); }
.lbx-type.k-image { background: rgb(14 165 233 / .25); color: #7dd3fc; }
.lbx-type.k-audio { background: rgb(34 197 94 / .22); color: #86efac; }
.lbx-type.k-video { background: rgb(249 115 22 / .22); color: #fdba74; }
.lbx-type.k-doc { background: rgb(139 92 246 / .25); color: #c4b5fd; }
.lbx-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbx-meta { font-size: 12px; color: rgb(255 255 255 / .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbx-count { flex-shrink: 0; margin-right: 6px; font-size: 12.5px; color: rgb(255 255 255 / .55); }
.lbx-btn { display: grid; place-items: center; height: 38px; width: 38px; flex-shrink: 0; border-radius: 999px; color: rgb(255 255 255 / .85); transition: background-color .15s, color .15s; }
.lbx-btn:hover { background: rgb(255 255 255 / .12); color: #fff; }
.lbx-btn.on { color: #c4b5fd; background: rgb(139 92 246 / .22); }
@media (max-width: 560px) { .lbx-count, .lbx-top [data-lbx="ask"] { display: none; } }

.lbx-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lbx-nav {
  position: absolute; top: 50%; z-index: 5; display: grid; place-items: center; height: 48px; width: 48px; margin-top: -24px; border-radius: 999px;
  background: rgb(255 255 255 / .08); color: #fff; transition: background-color .15s, opacity .2s;
}
.lbx-nav:hover { background: rgb(255 255 255 / .18); }
.lbx-nav.prev { left: 14px; } .lbx-nav.next { right: 14px; }
.lbx.single .lbx-nav { display: none; }
@media (max-width: 640px) { .lbx-nav { top: auto; bottom: 86px; margin: 0; height: 40px; width: 40px; } }

.lbx-bar { flex-shrink: 0; display: flex; justify-content: center; padding: 10px 14px 16px; min-height: 22px; }
.lbx-ctrl { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: rgb(255 255 255 / .08); }
.lbx-sep { width: 1px; height: 22px; margin: 0 4px; background: rgb(255 255 255 / .15); }
.lbx-zoom { min-width: 62px; height: 34px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lbx-zoom:hover { background: rgb(255 255 255 / .12); }
.lbx-demo { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em; background: rgb(255 255 255 / .1); color: rgb(255 255 255 / .7); pointer-events: none; }
.lbx-pill { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 999px; background: #fff; color: #111; font-size: 13.5px; font-weight: 600; }

.lbx-loading { display: grid; place-items: center; }
.lbx-loading span { height: 34px; width: 34px; border-radius: 999px; border: 3px solid rgb(255 255 255 / .15); border-top-color: #a78bfa; animation: lbx-spin .8s linear infinite; }
@keyframes lbx-spin { to { transform: rotate(360deg); } }
.lbx-gen { display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: 13.5px; color: rgb(255 255 255 / .7); }
.lbx-info { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 380px; padding: 0 20px; text-align: center; }
.lbx-info p { font-size: 13.5px; color: rgb(255 255 255 / .6); }
.lbx-info-ico { display: grid; place-items: center; height: 72px; width: 72px; border-radius: 22px; background: rgb(255 255 255 / .08); }

/* ---------- imagem ---------- */
.lbx-canvas { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: zoom-in; }
.lbx-canvas.zoomed { cursor: grab; }
.lbx-canvas.grabbing { cursor: grabbing; }
.lbx-canvas img { position: absolute; left: 50%; top: 50%; transform-origin: center; max-width: none; user-select: none; will-change: transform; box-shadow: 0 20px 60px rgb(0 0 0 / .5); border-radius: 4px; }

/* ---------- mídia ---------- */
.lbx-media { width: min(920px, 100%); display: flex; flex-direction: column; gap: 6px; }
.lbx-media-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 4px 8px; border-radius: 18px; background: rgb(255 255 255 / .07); }
.lbx-play { display: grid; place-items: center; height: 44px; width: 44px; border-radius: 999px; background: #fff; color: #111; transition: transform .15s; }
.lbx-play:hover { transform: scale(1.06); }
.lbx-time { margin-left: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: rgb(255 255 255 / .75); white-space: nowrap; }
.lbx-seek, .lbx-vol input, .lbx-speed input {
  appearance: none; height: 4px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, #a78bfa var(--p, 0%), rgb(255 255 255 / .22) var(--p, 0%));
}
.lbx-seek { width: 100%; height: 5px; }
.lbx-seek::-webkit-slider-thumb, .lbx-vol input::-webkit-slider-thumb, .lbx-speed input::-webkit-slider-thumb { appearance: none; height: 14px; width: 14px; border-radius: 999px; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .4); }
.lbx-seek::-moz-range-thumb, .lbx-vol input::-moz-range-thumb, .lbx-speed input::-moz-range-thumb { height: 14px; width: 14px; border: 0; border-radius: 999px; background: #fff; }
.lbx-vol { display: flex; align-items: center; gap: 2px; }
.lbx-vol input { width: 80px; }
@media (max-width: 640px) { .lbx-vol input { display: none; } }

.lbx-speed { position: relative; display: flex; align-items: center; gap: 4px; padding: 0 8px; height: 38px; border-radius: 999px; background: rgb(255 255 255 / .06); }
.lbx-speed input { width: 110px; background: rgb(255 255 255 / .22); }
.lbx-speed-l { display: grid; place-items: center; color: rgb(255 255 255 / .55); }
.lbx-speed b { min-width: 42px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; color: #c4b5fd; }
.lbx-speed-ticks {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px); display: flex; gap: 2px; padding: 4px; border-radius: 12px;
  background: #222; box-shadow: 0 10px 30px rgb(0 0 0 / .5); opacity: 0; pointer-events: none; transition: opacity .15s, transform .2s;
}
.lbx-speed:hover .lbx-speed-ticks, .lbx-speed:focus-within .lbx-speed-ticks { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.lbx-speed-ticks button { height: 28px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 600; color: rgb(255 255 255 / .75); white-space: nowrap; }
.lbx-speed-ticks button:hover { background: rgb(255 255 255 / .1); }
.lbx-speed-ticks button.on { background: #a78bfa; color: #111; }

/* áudio */
.lbx-audio { width: min(760px, calc(100% - 32px)); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.lbx-audio-cover { display: grid; place-items: center; height: 120px; width: 120px; border-radius: 32px; background: linear-gradient(135deg, #16a34a, #0ea5e9); box-shadow: 0 20px 50px -10px rgb(22 163 74 / .5); }
.lbx-audio-name { font-size: 16px; font-weight: 600; text-align: center; }
.lbx-wave { position: relative; width: 100%; height: 110px; cursor: pointer; }
.lbx-wave canvas { width: 100%; height: 100%; display: block; }
.lbx-wave-hint { position: absolute; left: 0; right: 0; bottom: -20px; text-align: center; font-size: 11px; color: rgb(255 255 255 / .4); }

/* vídeo */
.lbx-video { position: relative; max-width: calc(100% - 140px); max-height: 100%; display: grid; place-items: center; }
.lbx-video video { max-width: 100%; max-height: calc(var(--vh100) - 190px); border-radius: 10px; background: #000; box-shadow: 0 20px 60px rgb(0 0 0 / .5); }
.lbx-video:fullscreen video { max-height: var(--vh100); border-radius: 0; }
.lbx-bigplay { position: absolute; display: grid; place-items: center; height: 76px; width: 76px; border-radius: 999px; background: rgb(255 255 255 / .92); color: #111; box-shadow: 0 10px 30px rgb(0 0 0 / .4); transition: opacity .2s, transform .2s; }
.lbx-bigplay:hover { transform: scale(1.06); }
.lbx-bigplay.hide { opacity: 0; pointer-events: none; transform: scale(.9); }
@media (max-width: 640px) { .lbx-video { max-width: 100%; } }

/* ---------- documentos ---------- */
.lbx-doc { position: absolute; inset: 0; overflow: auto; padding: 24px 32px 40px; }
.lbx-pages { --z: 1; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.lbx-page {
  position: relative; width: calc(794px * var(--z)); min-height: calc(1123px * var(--z)); padding: calc(72px * var(--z)) calc(76px * var(--z));
  background: #fff; color: #1f2937; box-shadow: 0 10px 40px rgb(0 0 0 / .45); border-radius: 3px;
  font-size: calc(15px * var(--z)); line-height: 1.7; transition: width .15s, min-height .15s;
}
.lbx-page h1 { font-size: 2em; font-weight: 700; line-height: 1.2; margin-bottom: .6em; color: #111827; }
.lbx-page h3 { font-size: 1.15em; font-weight: 700; margin: 1.4em 0 .4em; color: #4c1d95; }
.lbx-page p { margin: .35em 0; white-space: pre-wrap; }
.lbx-page p.lead { color: #6b7280; }
.lbx-page .muted { margin-top: 2em; font-size: .85em; color: #9ca3af; }
.lbx-page .sig { display: flex; justify-content: space-between; gap: 2em; margin-top: 3em; text-align: center; color: #6b7280; font-size: .9em; }
.lbx-page pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.lbx-page.mono { min-height: 0; }
.lbx-pnum { position: absolute; bottom: calc(24px * var(--z)); left: 0; right: 0; text-align: center; font-size: .75em; color: #9ca3af; }
.lbx-pg { width: 46px; height: 28px; margin-right: 4px; border-radius: 8px; background: rgb(255 255 255 / .1); text-align: center; color: #fff; outline: none; }
.lbx-pdf { width: min(1000px, calc(100% - 140px)); height: 100%; border: 0; border-radius: 6px; background: #fff; }
@media (max-width: 640px) { .lbx-doc { padding: 16px 12px 30px; } .lbx-pdf { width: 100%; } }

/* planilha */
.lbx-sheet-wrap { position: absolute; inset: 0 0 44px; overflow: auto; padding: 24px; display: flex; justify-content: center; align-items: flex-start; }
.lbx-sheet { border-collapse: collapse; background: #fff; color: #1f2937; font-size: 13px; box-shadow: 0 10px 40px rgb(0 0 0 / .45); }
.lbx-sheet th, .lbx-sheet td { border: 1px solid #e5e7eb; padding: 7px 14px; white-space: nowrap; }
.lbx-sheet thead th, .lbx-sheet tbody th { background: #f3f4f6; color: #6b7280; font-weight: 500; font-size: 11.5px; text-align: center; }
.lbx-sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.lbx-sheet tr.hdr td { font-weight: 700; background: #f5f3ff; color: #4c1d95; }
.lbx-sheet tr.tot td { font-weight: 700; border-top: 2px solid #c4b5fd; }
.lbx-tabs { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; display: flex; justify-content: center; gap: 4px; padding: 6px; }
.lbx-tabs button { padding: 0 14px; border-radius: 8px; font-size: 12.5px; color: rgb(255 255 255 / .65); }
.lbx-tabs button.on { background: rgb(255 255 255 / .12); color: #fff; font-weight: 600; }

/* cartões da biblioteca abrem o visualizador */
.lib-card { cursor: pointer; }
.lib-drop { outline: 2px dashed rgb(124 58 237 / .6); outline-offset: -8px; border-radius: 16px; background: rgb(124 58 237 / .04); }
