:root {
  --stage-bg: #111110;
  --glass: rgba(22, 22, 20, 0.66);
  --glass-hover: rgba(38, 38, 35, 0.86);
  --glass-border: rgba(255, 255, 255, 0.16);
  --sheet-bg: #FAF7F2;
  --sheet-border: #E5DDD0;
  --ink: #1C231F;
  --muted: #646E68;
  --primary: #245B43;
  --primary-hover: #1B4734;
  --record: #D13F32;
  --record-hover: #B13024;
  --amber: #F59E0B;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--stage-bg);
  color: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.88rem;
}

/* ==================== LOGIN ==================== */
.login-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #FAF6F0;
  color: var(--ink);
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #FFFFFF;
  border: 1px solid var(--sheet-border);
  border-radius: 22px;
  padding: 34px 28px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
}

.login-logo {
  margin-bottom: 12px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
}

.login-form {
  margin-top: 22px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==================== ESCENARIO PRINCIPAL (FOTO EN GRANDE) ==================== */
.stage-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: var(--stage-bg);
  overflow: hidden;
  user-select: none;
}

.photo-viewport {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  touch-action: none;
}

.photo-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100vw;
  max-height: 100dvh;
  transform-origin: center center;
  will-change: transform;
}

.stage-img {
  display: block;
  max-width: 100vw;
  max-height: 100dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.18s ease;
}

.stage-img.fading {
  opacity: 0.25;
}

.photo-wrapper.zoomed {
  cursor: grab;
}

.photo-wrapper.zoomed.dragging {
  cursor: grabbing;
}

.photo-wrapper.circle-mode {
  cursor: crosshair;
}

.photo-wrapper.circle-mode .stage-img {
  outline: 2px solid rgba(255, 255, 255, 0.75);
}

.empty-stage {
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  padding: 24px;
}

/* ==================== CÍRCULOS FINOS PARA PERSONAS ==================== */
.circles-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.28s ease;
}

.circles-layer.circles-hidden {
  opacity: 0;
}

.face-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.face-ring {
  width: clamp(46px, 6.8vw, 68px);
  height: clamp(46px, 6.8vw, 68px);
  border-radius: 50%;
  border: 1.8px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.48), inset 0 0 0 1px rgba(0, 0, 0, 0.28), 0 3px 12px rgba(0, 0, 0, 0.32);
  background: transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.face-marker.pending .face-ring {
  border-color: #FDE68A;
  transform: scale(1.06);
}

.face-name-tag {
  margin-top: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(16, 16, 15, 0.72);
  backdrop-filter: blur(6px);
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.face-del {
  pointer-events: auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.circles-layer.circles-hidden .face-del {
  pointer-events: none;
}
.face-del:hover {
  color: #FCA5A5;
}

.circle-guide {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  background: rgba(20, 20, 19, 0.88);
  border: 1px solid rgba(253, 230, 138, 0.65);
  color: #FEF3C7;
  padding: 9px 14px 9px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
  max-width: 90vw;
}

.guide-cancel {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #FFFFFF;
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

/* ==================== CONTROLES DISCRETOS ARRIBA IZQUIERDA ==================== */
.top-left-bar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 14px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.glass-pill {
  min-height: 36px;
  min-width: 36px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s ease;
}

.glass-pill:hover {
  background: var(--glass-hover);
}

.glass-static {
  cursor: default;
}
.glass-static:hover {
  background: var(--glass);
}

.link-create-form {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 560px) {
  .link-create-form {
    grid-template-columns: 1fr;
  }
}

.generated-link-box {
  background: #E8F5EE;
  border: 2px solid #86C5A2;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.generated-link-title {
  font-weight: 800;
  color: #164430;
  margin-bottom: 4px;
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--sheet-border);
  background: #FAF7F2;
}

.link-row.revoked {
  opacity: 0.55;
  background: #F3EFE8;
}

.link-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-row-name {
  font-weight: 800;
  font-size: 0.96rem;
}

.link-row-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.link-row-actions {
  display: flex;
  gap: 6px;
}

.btn-revoke {
  background: #FDF2F1;
  color: var(--record);
  border: 1px solid #F1C4C0;
  min-height: 36px;
  padding: 5px 10px;
  font-size: 0.84rem;
}
.btn-revoke:hover {
  background: #FBE4E2;
}

.glass-pill.priv-on {
  background: rgba(146, 64, 14, 0.85);
  border-color: rgba(251, 191, 36, 0.65);
  color: #FEF3C7;
}

/* ==================== FLECHAS ARRIBA Y ABAJO ==================== */
.nav-arrow {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  width: 52px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 20, 19, 0.5);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.86);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.12s ease;
}

.nav-arrow:hover {
  background: rgba(42, 42, 39, 0.85);
  color: #FFFFFF;
}

.nav-arrow:disabled {
  opacity: 0.2;
  cursor: default;
}

.nav-arrow-up {
  top: max(10px, env(safe-area-inset-top));
}

.nav-arrow-down {
  bottom: max(10px, env(safe-area-inset-bottom));
}

/* ==================== COLUMNA DERECHA (MOSAICO + 4 ACCIONES) ==================== */
.right-rail {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  z-index: 28;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.rail-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.rail-btn {
  background: none;
  border: none;
  padding: 0;
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-family: inherit;
}

.rail-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.rail-btn:hover .rail-circle {
  background: var(--glass-hover);
  transform: scale(1.06);
}

.rail-btn:active .rail-circle {
  transform: scale(0.95);
}

.rail-btn.active .rail-circle {
  border-color: #FDE68A;
  background: rgba(180, 83, 9, 0.85);
}

.rail-audio .rail-circle {
  background: rgba(209, 63, 50, 0.88);
  border-color: rgba(255, 255, 255, 0.28);
}

.rail-audio:hover .rail-circle {
  background: var(--record-hover);
}

.rail-audio.recording .rail-circle {
  background: #EF4444;
  animation: recPulse 1.1s infinite;
}

@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.rail-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

@media (max-width: 640px) {
  .right-rail {
    right: 8px;
    gap: 11px;
  }
  .rail-group {
    gap: 11px;
    padding-top: 9px;
  }
  .rail-circle {
    width: 48px;
    height: 48px;
  }
}

/* ==================== METADATOS Y AUDIOS ABAJO IZQUIERDA ==================== */
.bottom-info {
  position: fixed;
  left: 16px;
  bottom: max(52px, calc(env(safe-area-inset-bottom) + 46px));
  z-index: 24;
  max-width: min(520px, calc(100vw - 102px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}

.meta-pill {
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(16, 16, 15, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.meta-pill:hover {
  background: rgba(34, 34, 32, 0.88);
}

.audio-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: auto;
}

.audio-pill {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 5px 10px 5px 7px;
  border-radius: 999px;
  background: rgba(18, 18, 17, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.audio-pill-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(36, 91, 67, 0.62);
  pointer-events: none;
  transition: width 0.12s linear;
}

.audio-pill > * {
  position: relative;
  z-index: 1;
}

.audio-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #FFFFFF;
  color: #161816;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audio-pill.playing .audio-play-btn {
  background: #4ADE80;
  color: #0B2416;
}

.audio-pill-text {
  display: flex;
  align-items: baseline;
  gap: 7px;
  cursor: pointer;
  padding-right: 4px;
}

.audio-pill-speaker {
  font-weight: 700;
  font-size: 0.9rem;
}

.audio-pill-dur {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  font-variant-numeric: tabular-nums;
}

.audio-mini-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: rgba(255, 255, 255, 0.9);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.audio-mini-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.audio-mini-btn.del:hover {
  background: rgba(209, 63, 50, 0.85);
}

/* ==================== BARRA FLOTANTE DE GRABACIÓN ==================== */
.rec-dock {
  position: fixed;
  left: 50%;
  bottom: max(58px, calc(env(safe-area-inset-bottom) + 52px));
  transform: translateX(-50%);
  z-index: 40;
  width: min(460px, calc(100vw - 24px));
  background: rgba(20, 20, 19, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  padding: 14px 16px;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

.rec-live-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rec-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #EF4444;
  animation: blink 1s infinite;
  flex-shrink: 0;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.rec-status-text {
  flex: 1;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.btn-stop {
  background: #EF4444;
  color: #FFFFFF;
  min-height: 46px;
  padding: 8px 18px;
}

.rec-review-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-audio {
  width: 100%;
  height: 44px;
}

.priv-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.priv-check input {
  width: 20px;
  height: 20px;
  accent-color: #F59E0B;
}

.rec-review-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rec-review-btns .btn-primary {
  flex: 1.4;
}

/* ==================== CAJETINES / MODALES LIMPIOS ==================== */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 10, 10, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

@media (min-width: 641px) {
  .sheet {
    align-items: center;
  }
}

.sheet-card {
  width: 100%;
  max-width: 470px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--sheet-bg);
  color: var(--ink);
  border-radius: 22px;
  padding: 22px 22px 24px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.45);
}

.sheet-wide {
  max-width: 600px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.sheet-sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.sheet-x {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--sheet-border);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
}

.voice-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.voice-input-row input {
  flex: 1;
}

.input-lg, .input-md, .input-sm, .select-sm {
  width: 100%;
  border: 2px solid var(--sheet-border);
  border-radius: 12px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: inherit;
}

.input-lg {
  min-height: 54px;
  padding: 10px 14px;
  font-size: 1.1rem;
}

.input-md {
  min-height: 48px;
  padding: 9px 13px;
  font-size: 1rem;
}

.input-sm, .select-sm {
  min-height: 42px;
  padding: 7px 11px;
  font-size: 0.92rem;
}

.input-lg:focus, .input-md:focus, .input-sm:focus, .select-sm:focus {
  outline: none;
  border-color: var(--primary);
}

/* Botón Dictar por voz (invita claramente a hablar) */
.dictate-btn {
  min-height: 54px;
  padding: 0 15px;
  border-radius: 12px;
  border: 2px solid #B7DAC5;
  background: #E8F5EE;
  color: #164430;
  font-weight: 800;
  font-size: 0.96rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s ease;
}

.dictate-btn:hover {
  background: #D2ECDD;
}

.dictate-btn.listening {
  background: var(--record);
  border-color: var(--record);
  color: #FFFFFF;
  animation: recPulse 1.1s infinite;
}

.voice-hint {
  margin: -2px 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.quick-chips, .decade-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.quick-chip {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--sheet-border);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.quick-chip:hover {
  border-color: var(--primary);
  background: #E8F5EE;
}

/* Botones generales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 50px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--ink);
  border-color: var(--sheet-border);
}
.btn-secondary:hover {
  background: #F1ECE3;
}

.btn-ghost-dark {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.92rem;
}

.btn-small {
  min-height: 40px;
  padding: 6px 13px;
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-row > * {
  flex: 1;
  min-width: 140px;
}

.error-text {
  color: var(--record);
  font-weight: 600;
  margin: 4px 0;
}

.who-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.who-choice {
  min-height: 54px;
  border-radius: 14px;
  border: 2px solid var(--sheet-border);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.who-choice:hover {
  border-color: var(--primary);
  background: #E8F5EE;
}

/* ==================== MOSAICO ==================== */
.mosaic-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: #141413;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
}

.mosaic-header {
  padding: 14px 16px 12px;
  background: #1B1B19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mosaic-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.mosaic-header-top h2 {
  margin: 0;
  font-size: 1.25rem;
}

.mosaic-header-actions {
  display: flex;
  gap: 8px;
}

.mosaic-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mosaic-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mtab {
  min-height: 38px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
}

.mtab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.mosaic-selects {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 8px;
}

@media (max-width: 720px) {
  .mosaic-selects {
    grid-template-columns: 1fr 1fr;
  }
  #mosaic-search {
    grid-column: 1 / -1;
  }
}

.mosaic-grid {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  align-content: start;
}

@media (max-width: 520px) {
  .mosaic-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
  }
}

.mosaic-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  background: #232320;
  cursor: pointer;
}

.mosaic-tile.current {
  border-color: #4ADE80;
}

.mosaic-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-badges {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}

.tile-badge {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.72);
  color: #FFFFFF;
}

.tile-badge.audio {
  background: var(--record);
}

.tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 7px 5px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  color: #FFFFFF;
  font-size: 0.76rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== ADMIN ==================== */
.admin-box {
  background: #FFFFFF;
  border: 1px solid var(--sheet-border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.admin-box h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.admin-stats {
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 10px;
}

/* ==================== LIGHTBOX ZOOM NATIVO ==================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0A0A0A;
  display: flex;
  flex-direction: column;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.75);
  flex-wrap: wrap;
}

.lightbox-info {
  font-size: 0.9rem;
  color: #E2E8F0;
}

.lightbox-controls {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.lb-btn {
  min-height: 40px;
  min-width: 40px;
  padding: 5px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.lb-close {
  background: var(--record);
  border-color: var(--record);
}

.lightbox-canvas {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  touch-action: pan-x pan-y pinch-zoom;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  user-select: none;
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(20, 20, 19, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  max-width: 90vw;
  text-align: center;
}
