/* ===== Beta Adaptable Unificada ? Obsidian Studio Design System (oil-ui Polish) ===== */
:root {
  --obs-bg-0: #0b0d12;
  --obs-bg-1: #121620;
  --obs-bg-2: #181d2a;
  --obs-bg-3: #1e2638;
  --obs-border: #262e42;
  --obs-border-strong: #384562;
  --obs-border-focus: #38bdf8;
  --obs-text-1: #f4f6fb;
  --obs-text-2: #c6d0e6;
  --obs-text-3: #93a1be;
  --obs-accent: #2563eb;
  --obs-accent-hover: #1d4ed8;
  --obs-accent-glow: rgba(37, 99, 235, 0.28);
  --beta-shell-h: 36px;
}

body {
  background-color: var(--obs-bg-0) !important;
  color: var(--obs-text-1) !important;
}

/* Distill: hide secondary subpage bar when inside #t508 shell or iframe */
html.t508 #betaAdaptableBar,
html.beta-in-frame #betaAdaptableBar {
  display: none !important;
}

html.t508 body {
  padding-top: calc(var(--t5h, 52px) + env(safe-area-inset-top, 0px)) !important;
}
html.t508.beta-shell-on body {
  padding-top: calc(var(--t5h, 52px) + env(safe-area-inset-top, 0px)) !important;
}

/* Inside #t508frame iframes: suppress duplicate parent/legacy chrome cleanly */
html.beta-in-frame body {
  padding-top: 8px !important;
}
html.beta-in-frame #barraTareasActivasGlobal,
html.beta-in-frame #dockNavegacionMaestra,
html.beta-in-frame #top_quick_bar_f33,
html.beta-in-frame #s662bar,
html.beta-in-frame #t763bar,
html.beta-in-frame nav.nav {
  display: none !important;
}
html.beta-in-frame.beta-idx-page body > .top {
  display: none !important;
}

/* Style standalone legacy hub pills/buttons darkly (never glaring white buttons on obsidian) */
.f49-hub-pill {
  background: var(--obs-bg-2) !important;
  color: var(--obs-text-1) !important;
  border: 1px solid var(--obs-border) !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: background 0.14s ease, border-color 0.14s ease !important;
}
.f49-hub-pill:hover,
.f49-hub-pill.active {
  background: var(--obs-accent) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

/* ===== 1. Top Navigation Bar (#t508bar): single-row calm obsidian strip (<= 52px) ===== */
html.t508 body #t508bar {
  background: rgba(11, 13, 18, 0.97) !important;
  backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid var(--obs-border) !important;
  height: 52px !important;
  min-height: 50px !important;
  max-height: 54px !important;
  padding: 0 10px !important;
  gap: 6px !important;
  align-items: center !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  z-index: 100060 !important;
  overflow: visible !important;
}
html.t508 body #t508bar .t5s {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  height: 44px !important;
  max-height: 44px !important;
  gap: 5px !important;
  padding: 0 2px !important;
  scrollbar-width: thin !important;
  scrollbar-color: #334155 transparent !important;
  -webkit-mask-image: linear-gradient(90deg, #000 96%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 96%, transparent 100%);
}
html.t508 body #t508bar .t5s::-webkit-scrollbar {
  height: 3px !important;
  display: block !important;
}
html.t508 body #t508bar .t5s::-webkit-scrollbar-track {
  background: transparent !important;
}
html.t508 body #t508bar .t5s::-webkit-scrollbar-thumb {
  background: #334155 !important;
  border-radius: 99px !important;
}
html.t508 body #t508bar .t5a {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  min-width: auto !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 36px !important;
  padding: 0 9px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border) !important;
  color: var(--obs-text-2) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease !important;
}
html.t508 body #t508bar .t5a:hover {
  background: var(--obs-bg-3) !important;
  color: var(--obs-text-1) !important;
  border-color: var(--obs-border-strong) !important;
}
html.t508 body #t508bar .t5a.on {
  background: var(--obs-accent) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
  box-shadow: 0 2px 10px var(--obs-accent-glow) !important;
}
html.t508 body #t508bar .t5a .i,
html.t508 body #t508bar .t5a .t5i {
  font-size: 14px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
}
html.t508 body #t508bar .t5a .t5l,
html.t508 body #t508bar .t5a .l {
  font-size: 12px !important;
  white-space: nowrap !important;
}

/* Right utility cluster: unified height (34px), subtle semantic restraint */
html.t508 body #t1299mas,
html.t508 body #t1091top,
html.t508 body #t508tk,
html.t508 body #t508RemotoBtn,
html.t508 body #t508bar .t5k {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 36px !important;
  min-width: auto !important;
  padding: 0 10px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}
html.t508 body #t1299mas {
  background: var(--obs-bg-2) !important;
  border: 1px solid #4c5b80 !important;
  color: var(--obs-text-1) !important;
}
html.t508 body #t1299mas:hover {
  background: var(--obs-bg-3) !important;
  border-color: #60a5fa !important;
}
html.t508 body #t1091top {
  background: #23121b !important;
  border: 1px solid #7f1d3a !important;
  color: #fecdd3 !important;
}
html.t508 body #t1091top:hover {
  background: #3a1727 !important;
  border-color: #fb7185 !important;
}
html.t508 body #t508tk {
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border) !important;
  color: #86efac !important;
}
html.t508 body #t508tk.act {
  background: #2b2109 !important;
  border-color: #d97706 !important;
  color: #fde68a !important;
}
html.t508 body #t508tk .n {
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}
html.t508 body #t508tk .l {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}
html.t508 body #t508RemotoBtn {
  background: #0d221c !important;
  border: 1px solid #059669 !important;
  color: #a7f3d0 !important;
}
html.t508 body #t508RemotoBtn:hover {
  background: #064e3b !important;
}
@media (max-width: 640px) {
  html.t508 body #t508bar { padding: 0 6px !important; gap: 4px !important; }
  html.t508 body #t508tk .l,
  html.t508 body #t508RemotoBtn span { display: none !important; }
  html.t508 body #t1299mas,
  html.t508 body #t1091top,
  html.t508 body #t508tk,
  html.t508 body #t508RemotoBtn { padding: 0 8px !important; }
}

/* ===== 2. Contextual Area Strip (#t508head): single-line 42px strip (zero overlap with #t508frame) ===== */
html.t508 body #t508head {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border) !important;
  border-radius: 10px !important;
  margin: 6px 10px 4px !important;
  padding: 5px 10px !important;
  min-height: 42px !important;
  max-height: 46px !important;
  box-sizing: border-box !important;
}
html.t508 body #t508head .t5chips {
  display: flex !important;
  flex-wrap: nowrap !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  gap: 5px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  align-items: center !important;
}
html.t508 body #t508head .t5chips::-webkit-scrollbar {
  display: none !important;
}
html.t508 body #t508head .t5nav,
html.t508 body #t508head .t5c {
  flex: 0 0 auto !important;
  height: 30px !important;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border-radius: 7px !important;
  background: var(--obs-bg-2) !important;
  border: 1px solid var(--obs-border) !important;
  color: var(--obs-text-1) !important;
  white-space: nowrap !important;
}
html.t508 body #t508head .t5nav:hover,
html.t508 body #t508head .t5c:hover {
  background: var(--obs-bg-3) !important;
  border-color: var(--obs-border-strong) !important;
}
html.t508 body #t508head #betaChipStudio11 {
  background: #1b152a !important;
  border-color: #7c3aed !important;
  color: #e9d5ff !important;
}
html.t508 body #t508head #betaChipLoUltimo {
  background: #231810 !important;
  border-color: #b45309 !important;
  color: #fde68a !important;
}
html.t508 body #t508head #betaChipVisorVideos {
  background: #111d36 !important;
  border-color: #2563eb !important;
  color: #bfdbfe !important;
}

/* Frame mode: pin #t508head right below #t508bar and offset #t508frame cleanly below #t508head */
html.t508.t508-frame body #t508head {
  position: fixed !important;
  top: calc(var(--t5h, 52px) + env(safe-area-inset-top, 0px)) !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  z-index: 100040 !important;
}
html.t508.t508-frame body #t508frame {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: calc(var(--t5h, 52px) + var(--t5head-h, 44px) + env(safe-area-inset-top, 0px)) !important;
  height: calc(100dvh - var(--t5h, 52px) - var(--t5head-h, 44px) - env(safe-area-inset-top, 0px)) !important;
  max-height: calc(100dvh - var(--t5h, 52px) - var(--t5head-h, 44px) - env(safe-area-inset-top, 0px)) !important;
  background: var(--obs-bg-0) !important;
}
@media (max-width: 820px) {
  html.t508.t508-frame body #t508frame {
    bottom: calc(46px + env(safe-area-inset-bottom, 0px)) !important;
    height: calc(100dvh - var(--t5h, 52px) - var(--t5head-h, 44px) - env(safe-area-inset-top, 0px) - 46px - env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100dvh - var(--t5h, 52px) - var(--t5head-h, 44px) - env(safe-area-inset-top, 0px) - 46px - env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Search bar (#t763bar): tucked cleanly on demand via #betaToggleSearch, never floating orphaned at y=52 */
html.t508 body #t763bar {
  display: none !important;
  margin: 4px 10px !important;
  padding: 6px 10px !important;
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border-strong) !important;
  border-radius: 10px !important;
  width: auto !important;
  max-width: calc(100vw - 20px) !important;
  box-sizing: border-box !important;
}
html.t508.beta-search-open body #t763bar {
  display: flex !important;
}
html.t508.t508-frame body #t763bar {
  display: none !important;
}

/* ===== 3. Distill Gallery Chrome (#t810sec, #t1238ord, #t708blk) ===== */
#t691ord,
#t698ord,
#t605vw,
#t810sec_row #t605vw,
#t522acc,
#t810sec > div:first-child,
#tab_gal .gal-toolbar .view-toggle,
#tab_gal .gal-toolbar .live-pill {
  display: none !important;
}
#tab_gal .gal-toolbar {
  padding: 2px 10px 4px !important;
  margin: 0 !important;
  min-height: 0 !important;
}
#t810sec {
  position: static !important;
  background: transparent !important;
  border: 0 !important;
  padding: 2px 10px !important;
  margin: 0 !important;
}
#t1238ord,
#t810sec_row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px !important;
  align-items: center !important;
  margin: 4px 0 !important;
  padding: 5px 10px !important;
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border) !important;
  border-radius: 10px !important;
}
@media (max-width: 820px) {
  #t1238ord,
  #t810sec_row {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
  }
  #t1238ord::-webkit-scrollbar,
  #t810sec_row::-webkit-scrollbar {
    display: none !important;
  }
}
#t810sec_row .beta-flt-lbl {
  color: var(--obs-text-3) !important;
  font: 800 11.5px/1 system-ui, sans-serif !important;
  margin-right: 3px;
  white-space: nowrap;
}
#t810sec_row .beta-flt-sep {
  width: 1px;
  height: 18px;
  background: var(--obs-border-strong);
  margin: 0 2px;
  flex: 0 0 auto;
}
#t810sec_row .beta-flt-btn,
#t1238ord button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  height: 29px !important;
  padding: 0 10px !important;
  border-radius: 7px !important;
  background: var(--obs-bg-2) !important;
  border: 1px solid var(--obs-border) !important;
  color: var(--obs-text-2) !important;
  font: 700 11.5px/1 system-ui, sans-serif !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  transition: all 0.14s ease !important;
}
#t810sec_row .beta-flt-btn:hover,
#t1238ord button:hover {
  border-color: var(--obs-border-strong) !important;
  background: var(--obs-bg-3) !important;
  color: var(--obs-text-1) !important;
}
#t810sec_row .beta-flt-btn.beta-flt-on,
#t1238ord button.on,
#t1238ord button[aria-pressed="true"] {
  background: var(--obs-accent) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
  box-shadow: 0 1px 8px var(--obs-accent-glow) !important;
}
#t810sec_row .beta-flt-btn.beta-flt-papelera {
  border-color: #7f1d1d !important;
  color: #fecaca !important;
}
#t810sec_row .beta-flt-btn.beta-flt-papelera.beta-flt-on {
  background: #991b1b !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
}

/* Likes X (#t708blk): sleek functional bar with direct Download / Import / Saved shortcuts */
#t708blk {
  position: static !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 4px 10px !important;
  padding: 5px 10px !important;
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border) !important;
  border-radius: 10px !important;
  font-size: 12px !important;
  color: var(--obs-text-1) !important;
}
#t708blk > b {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #f472b6 !important;
  margin-right: 4px !important;
  white-space: nowrap !important;
  user-select: none !important;
}
#t708blk > div:first-of-type {
  display: contents !important;
}
#t708blk #t708b1,
#t708blk #t708b2,
#t708blk #t708b3,
#t708blk [data-t958-galeria="1"],
#t708blk #betaLikesInfoBtn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex: 0 0 auto !important;
  min-width: auto !important;
  height: 27px !important;
  margin: 0 !important;
  padding: 0 9px !important;
  border-radius: 7px !important;
  font: 700 11.5px/1 system-ui, -apple-system, Segoe UI, sans-serif !important;
  color: var(--obs-text-1) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.14s ease !important;
}
#t708blk #t708b1 {
  background: #0d2620 !important;
  border: 1px solid #10b981 !important;
  color: #a7f3d0 !important;
}
#t708blk #t708b1:hover:not(:disabled) {
  background: #064e3b !important;
  color: #ffffff !important;
}
#t708blk #t708b2 {
  background: #1f1635 !important;
  border: 1px solid #8b5cf6 !important;
  color: #ddd6fe !important;
}
#t708blk #t708b2:hover:not(:disabled) {
  background: #4c1d95 !important;
  color: #ffffff !important;
}
#t708blk #t708b3 {
  background: #2b1326 !important;
  border: 1px solid #ec4899 !important;
  color: #fbcfe8 !important;
}
#t708blk #t708b3:hover:not(:disabled) {
  background: #831843 !important;
  color: #ffffff !important;
}
#t708blk [data-t958-galeria="1"] {
  background: var(--obs-bg-2) !important;
  border: 1px solid var(--obs-border-strong) !important;
  color: var(--obs-text-1) !important;
}
#t708blk [data-t958-galeria="1"]:hover {
  background: var(--obs-bg-3) !important;
  border-color: #60a5fa !important;
}
#t708blk #betaLikesInfoBtn {
  margin-left: auto !important;
  background: transparent !important;
  border: 1px solid var(--obs-border) !important;
  color: var(--obs-text-2) !important;
}
#t708blk #betaLikesInfoBtn:hover {
  background: var(--obs-bg-2) !important;
  border-color: var(--obs-border-strong) !important;
  color: var(--obs-text-1) !important;
}
#t708blk #t708est,
#t708blk #t708auto {
  flex: 1 1 100% !important;
  margin-top: 2px !important;
  padding-top: 5px !important;
  border-top: 1px solid var(--obs-border) !important;
  font-size: 11.5px !important;
  color: var(--obs-text-2) !important;
}
#t708blk:not(.beta-likes-open) #t708est,
#t708blk:not(.beta-likes-open) #t708auto {
  display: none !important;
}

/* ===== 4. Gallery Grid & Cards: typography floor >= 11.5px ===== */
.grid-gal {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important;
  gap: 10px !important;
  padding: 6px 10px 20px !important;
}
@media (max-width: 640px) {
  .grid-gal {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
}
.gcard {
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border) !important;
  border-radius: 10px !important;
  transition: transform 0.15s ease, border-color 0.15s ease !important;
}
.gcard:hover {
  border-color: var(--obs-border-strong) !important;
}
.gcard .gbadge span,
.gcard .gdate span,
.gcard .gdate button,
.gcard .t537id,
.t537id,
.revisar-ribbon,
.rt-badge {
  font-size: 11.5px !important;
  line-height: 1.25 !important;
}

/* Subpages top bar (#betaAdaptableBar) when outside main t508 shell */
#betaAdaptableBar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2147483645;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--beta-shell-h);
  padding: 5px 10px;
  background: rgba(11, 13, 18, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--obs-border);
  color: var(--obs-text-1);
  font: 700 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
#betaAdaptableBar .beta-left,
#betaAdaptableBar .beta-center,
#betaAdaptableBar .beta-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
#betaAdaptableBar .beta-center {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
#betaAdaptableBar .beta-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--obs-border);
  background: var(--obs-bg-1);
  color: var(--obs-text-1);
  font: 700 12px/1 system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
#betaAdaptableBar .beta-btn.home {
  background: var(--obs-accent);
  border-color: #60a5fa;
  color: #fff;
}
#betaAdaptableBar .beta-btn.back {
  background: var(--obs-bg-2);
  border-color: var(--obs-border-strong);
  color: var(--obs-text-1);
}

/* Z-index hierarchy fix (F09): Secciones (#s660dlg) and Modelos IA (#panel_t801) always above #t508frame */
#s660dlg {
  z-index: 2147483000 !important;
}
html.beta-dlg-open #t508frame {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Strict Media-Type Gallery Controls: never show photo-only controls on audio/video/doc/3d */
[data-media-type="audio"] [onclick*="toggleRevisar"],
[data-media-type="audio"] [onclick*="afinarRostro"],
[data-media-type="audio"] [onclick*="abrirModalEditarFoto"],
[data-media-type="audio"] [onclick*="abrirModalQuickAnimar"],
[data-media-type="audio"] [onclick*="abrirConversorVideo"],
[data-media-type="audio"] .revisar-ribbon,
[data-t583tipo="audio"] [onclick*="toggleRevisar"],
[data-t583tipo="audio"] [onclick*="afinarRostro"],
[data-t583tipo="audio"] [onclick*="abrirModalEditarFoto"],
[data-t583tipo="audio"] [onclick*="abrirModalQuickAnimar"],
[data-t583tipo="audio"] .revisar-ribbon {
  display: none !important;
}
/* ===== 5. Desktop PC Density Refinement (>= 900px): unified 2-row Bar 1, clean Bar 2, compact Bar 3 & 1-line pagination ===== */
.t831oculto,
.t832park,
html.t508 body #t508head .t5c.t831oculto,
html.t508 body #t508head .t831oculto,
html.t508 body #t508head .beta-head-dedup {
  display: none !important;
}

@media (min-width: 900px) {
  html.t508 body #t508bar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 4px 10px !important;
    gap: 4px !important;
  }
  html.t508 body #t508bar .t5s,
  html.t508 body #t508bar #t1304pins {
    display: contents !important;
  }
  html.t508 body #t508bar .t5a,
  html.t508 body #t1299mas,
  html.t508 body #t1091top,
  html.t508 body #t508tk,
  html.t508 body #t508RemotoBtn,
  html.t508 body #t508bar .t5k,
  html.t508 body #t508bar #t1301lub,
  html.t508 body #t508bar #t1304galb {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 29px !important;
    font-size: 11.5px !important;
    border-radius: 7px !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
  }
  html.t508 body #t508bar .t5a,
  html.t508 body #t508bar #t1301lub,
  html.t508 body #t508bar #t1304galb {
    padding: 0 7px !important;
    gap: 4px !important;
  }
  html.t508 body #t508bar .t5s > .beta-bar-hide {
    display: none !important;
  }
  html.t508 body #t508bar #t1304pins > :first-child,
  html.t508 body #t508bar .t5s + #t1299mas {
    margin-left: auto !important;
  }

  /* Row 2 (#t508head): fuse back/home/title + chips + search + options + close cleanly */
  html.t508 body #t508head {
    flex-wrap: wrap !important;
    min-height: 36px !important;
    max-height: none !important;
    padding: 4px 10px !important;
    gap: 4px 5px !important;
    align-items: center !important;
  }
  html.t508 body #t508head .t5chips {
    display: contents !important;
  }
  html.t508 body #t508head .t5nav,
  html.t508 body #t508head #t1239opc,
  html.t508 body #t508head .t5c {
    height: 27px !important;
    min-height: 27px !important;
    padding: 0 8px !important;
    font-size: 11.5px !important;
  }
  html.t508 body #t508head .beta-head-dedup {
    display: none !important;
  }

  /* Row 3 (#t810sec): Vista + Orden + Filtros compact across full width */
  #t810sec {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 2px !important;
    margin: 4px 10px !important;
    padding: 3px 6px !important;
    background: var(--obs-bg-1) !important;
    border: 1px solid var(--obs-border) !important;
    border-radius: 10px !important;
  }
  #t810sec #t1238ord,
  #t810sec #t810sec_row {
    display: contents !important;
  }
  #t810sec #t1238ord::after {
    content: "";
    width: 1px;
    height: 15px;
    background: var(--obs-border-strong);
    margin: 0 1px;
    flex: 0 0 auto;
  }
}

#t1238ord .l {
  color: var(--obs-text-3) !important;
  font: 800 11px/1 system-ui, sans-serif !important;
  margin-right: 0 !important;
  white-space: nowrap !important;
}
#t1238ord .sep,
#t810sec_row .beta-flt-sep {
  width: 1px !important;
  height: 15px !important;
  background: var(--obs-border-strong) !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
}
#t810sec_row .beta-flt-lbl {
  margin-right: 0 !important;
  font-size: 11px !important;
}
#t810sec_row .beta-flt-btn,
#t1238ord button {
  height: 25px !important;
  min-height: 25px !important;
  padding: 0 5px !important;
  font-size: 11px !important;
}

/* Unified Gallery Count + Pagination Bar (1 guaranteed single row on desktop) */
#tab_gal.beta-gal-paginated .gal-toolbar {
  display: none !important;
}
#tab_gal .t1265-wrap {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 5px 8px !important;
  margin: 4px 10px 6px !important;
  padding: 4px 9px !important;
  background: var(--obs-bg-1) !important;
  border: 1px solid var(--obs-border) !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
}
#tab_gal .t1265-wrap .t1265-summary {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font: 700 11px/1.2 system-ui, -apple-system, Segoe UI, sans-serif !important;
  color: var(--obs-text-2) !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
}
#tab_gal .t1265-wrap .t1265-summary .t1265-tot {
  color: var(--obs-text-1) !important;
  font-weight: 800 !important;
}
#tab_gal .t1265-wrap .t1265-summary .t1265-sep {
  color: var(--obs-text-3) !important;
}
#tab_gal .t1265-wrap .t1265-ctrl {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 4px !important;
  margin-left: auto !important;
}
#tab_gal .t1265-wrap .t1265-pager {
  display: flex !important;
  min-height: 0 !important;
  height: auto !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 2px !important;
  margin: 0 !important;
  width: auto !important;
}
#tab_gal .t1265-wrap .t1265-pager .t1265-status {
  display: none !important;
}
#tab_gal .t1265-wrap .t1265-pager .t1265-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 25px !important;
  min-height: 25px !important;
  padding: 0 6px !important;
  border-radius: 6px !important;
  background: var(--obs-bg-2) !important;
  border: 1px solid var(--obs-border) !important;
  color: var(--obs-text-1) !important;
  font: 700 11px/1 system-ui, sans-serif !important;
  white-space: nowrap !important;
}
#tab_gal .t1265-wrap .t1265-pager .t1265-btn:hover:not(:disabled) {
  background: var(--obs-bg-3) !important;
  border-color: var(--obs-border-strong) !important;
}
#tab_gal .t1265-wrap .t1265-pager .t1265-btn.t1265-cur {
  background: var(--obs-accent) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}
#tab_gal .t1265-wrap .t1265-pager .t1265-num {
  min-width: 24px !important;
  padding: 0 5px !important;
}
#tab_gal .t1265-wrap .t1265-pager .t1265-ir {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  font: 600 11px/1 system-ui, sans-serif !important;
  color: var(--obs-text-2) !important;
  margin-left: 3px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
}
#tab_gal .t1265-wrap .t1265-pager .t1265-goto {
  width: 40px !important;
  height: 25px !important;
  min-height: 25px !important;
  padding: 0 3px !important;
  border-radius: 6px !important;
  background: var(--obs-bg-0) !important;
  border: 1px solid var(--obs-border-strong) !important;
  color: var(--obs-text-1) !important;
  font: 700 11px/1 system-ui, sans-serif !important;
  text-align: center !important;
}
@media (min-width: 960px) {
  #tab_gal .t1265-wrap {
    flex-wrap: nowrap !important;
  }
  #tab_gal .t1265-wrap .t1265-ctrl,
  #tab_gal .t1265-wrap .t1265-pager {
    flex-wrap: nowrap !important;
  }
}
@media (min-width: 960px) and (max-width: 1120px) {
  #tab_gal .t1265-wrap .t1265-pager .t1265-lab {
    display: none !important;
  }
}
@media (max-width: 820px) {
  #tab_gal .t1265-wrap {
    justify-content: center !important;
  }
  #tab_gal .t1265-wrap .t1265-ctrl {
    margin-left: 0 !important;
    justify-content: center !important;
  }
}
