/* ─────────────────────────────────────────────────────────────
 * style-shell.css — layout Discord-like (Fase 1)
 *
 * Estructura:
 *   ┌─────────────────────────────────────────────────────┐
 *   │ shell-header                                        │
 *   ├──────┬─────────┬────────────────────┬───────────────┤
 *   │ rail │ threads │ main               │ participants  │
 *   │ 72px │ 280px   │ 1fr                │ 240px         │
 *   └──────┴─────────┴────────────────────┴───────────────┘
 *
 * Modos:
 *   .shell-thread   → 4 cols (default en hilos)
 *   .shell-board    → 3 cols (sin participants)
 *   .shell-wide     → 2 cols (sin threads ni participants)
 *
 * Mobile (≤900px): single column, rails como drawers.
 * ───────────────────────────────────────────────────────── */

:root {
  --rail-boards-w:       72px;
  --rail-threads-w:      280px;
  --rail-participants-w: 240px;
  --shell-header-h:      44px;
  /* shell-bg-rail/main/border removed — use theme vars directly to avoid premature resolution */
  --shell-breakpoint:    900px;
}

/* ── Body en modo shell ─────────────────────────────────── */
body.in-shell {
  margin: 0;
  padding: 0;
  overflow: hidden;          /* el scroll vive dentro de las columnas */
  height: 100vh;
  height: 100dvh;            /* mejor en mobile (barra de URL) */
}

.shell {
  display: grid;
  grid-template-columns:
    var(--rail-boards-w)
    var(--rail-threads-w)
    1fr
    var(--rail-participants-w);
  grid-template-rows: var(--shell-header-h) 1fr;
  grid-template-areas:
    "header header  header  header"
    "boards threads main    participants";
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background: var(--bg);
}

/* Mode: board — esconder participants */
.shell[data-mode="board"] {
  grid-template-columns:
    var(--rail-boards-w)
    var(--rail-threads-w)
    1fr;
  grid-template-areas:
    "header header  header"
    "boards threads main";
}
.shell[data-mode="board"] .participants-rail { display: none; }

/* Mode: wide — solo boards + main */
.shell[data-mode="wide"] {
  grid-template-columns: var(--rail-boards-w) 1fr;
  grid-template-areas:
    "header header"
    "boards main";
}
.shell[data-mode="wide"] .threads-rail,
.shell[data-mode="wide"] .participants-rail { display: none; }

/* ── Header de la shell ────────────────────────────────── */
.shell-header {
  grid-area: header;
  background: var(--bg-panel);
  border-bottom: 2px solid var(--border-strong);
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 14px;
  height: var(--shell-header-h);
  overflow: hidden;
}
.shell-brand { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.shell-brand-link {
  font-family: var(--sans); font-weight: 700; font-size: 1.2rem;
  color: var(--accent); text-decoration: none; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.shell-brand-link .navicon { height: 22px; width: 22px; object-fit: contain; }
.shell-brand-name { display: inline; }
@media (max-width: 540px) { .shell-brand-name { display: none; } }

.shell-context {
  font-family: var(--mono); font-size: 0.8667rem; color: var(--text-dim);
  flex-shrink: 0;
}
.shell-context-sep { color: var(--text-dim); opacity: 0.5; flex-shrink: 0; }
.shell-thread-title {
  color: var(--text); font-weight: 600; font-size: 0.8667rem; font-family: var(--sans);
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.shell-tagline {
  margin-left: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
@media (max-width: 720px) { .shell-tagline { display: none; } }

.shell-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.shell-header-right .lang-selector { gap: 6px; }
@media (max-width: 540px) { .shell-header-right .lang-selector-label { display: none; } }

.shell-admin-link {
  font-family: var(--mono); font-size: 0.8rem;
  text-decoration: none;
}

/* Mobile menu buttons (hidden on desktop) */
.shell-mobile-btn {
  display: none;
  background: transparent; border: 1px solid var(--border-strong);
  width: 32px; height: 32px;
  cursor: pointer; font-size: 1.2rem; line-height: 1;
  color: var(--text);
}
.shell-mobile-btn:hover { background: var(--bg-post); }

/* ── Boards rail (izquierda) ───────────────────────────── */
.boards-rail {
  grid-area: boards;
  background: var(--bg-op);
  border-right: 1px solid var(--border-strong);
  overflow: hidden;              /* la rail no scrollea — lo hace .br-boards-scroll */
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.br-nav {
  flex: 1;
  min-height: 0;                 /* imprescindible para que el flex child scrollee */
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; gap: 4px;
  overflow: hidden;
}

/* Zona scrolleable: solo los boards dinámicos */
.br-boards-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0 0 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.br-boards-scroll::-webkit-scrollbar { width: 4px; }
.br-boards-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Zona fija inferior: ⓘ y admin siempre visibles */
.br-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0 4px;
  border-top: 1px solid var(--border);
  width: 100%;
  flex-shrink: 0;
}

.br-spacer { display: none; }   /* sustituido por .br-boards-scroll flex:1 */
.br-sep {
  width: 36px; height: 2px;
  background: var(--border-strong);
  margin: 6px 0;
  border-radius: 1px;
  opacity: 0.5;
}
.br-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; min-height: 52px;
  padding: 4px;
  background: var(--bg-post);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  font-family: var(--mono);
  position: relative;
  transition: background 0.12s, border-color 0.12s;
  gap: 2px;
}
.br-item:hover {
  background: white;
  border-color: var(--border-strong);
}
.br-item.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.br-item.active .br-icon { color: white; }
.br-item.active::before {
  content: ""; position: absolute; left: -8px; top: 50%;
  width: 4px; height: 28px; background: var(--accent);
  border-radius: 0 2px 2px 0;
  transform: translateY(-50%);
}
.br-icon {
  font-size: 0.8667rem; font-weight: 600;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.br-item-home .br-icon, .br-item-overboard .br-icon { font-size: 1.2rem; }
.br-item-info .br-icon, .br-item-admin .br-icon { font-size: 1.0667rem; }
.br-label {
  font-size: 0.6rem; font-weight: 500; color: var(--text-dim);
  text-transform: lowercase;
}
.br-item.active .br-label { color: rgba(255,255,255,0.85); }

/* ── Tooltip: board name aparece a la derecha al hacer hover ── */
.br-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-op, #1e232b);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.8667rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  box-shadow: 2px 2px 8px rgba(0,0,0,0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 200;
}
/* Triángulo apuntando al botón */
.br-item[data-tooltip]::before {
  content: '';
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--border-strong);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 200;
}
.br-item[data-tooltip]:hover::after,
.br-item[data-tooltip]:hover::before {
  opacity: 1;
}

/* ── Threads rail (centro-izquierda) ──────────────────── */
.threads-rail {
  grid-area: threads;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-strong);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex; flex-direction: column;
  min-height: 0;                 /* sin esto el flex child no colapsa y el scroll no activa */
}
.tr-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  position: sticky; top: 0; z-index: 2;
}
.tr-header-empty { justify-content: center; color: var(--text-dim); }
.tr-header-title { display: flex; flex-direction: column; min-width: 0; }
.tr-header-board {
  font-family: var(--mono); font-size: 0.9333rem; font-weight: 600; color: var(--accent);
}
.tr-header-name {
  font-family: var(--sans); font-size: 0.7333rem; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tr-nsfw-badge {
  font-family: var(--mono); font-size: 0.6rem;
  background: var(--danger); color: white;
  padding: 2px 5px; border-radius: 2px;
  font-weight: 700; letter-spacing: 0.05em;
}

.tr-actions {
  display: flex; gap: 6px; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.tr-action-btn {
  flex: 1; padding: 6px 8px;
  background: var(--bg-post); border: 1px solid var(--border-strong);
  font-family: var(--mono); font-size: 0.7333rem; font-weight: 600;
  color: var(--accent);
  text-decoration: none; text-align: center;
  cursor: pointer;
  border-radius: 3px;
}
.tr-action-btn:hover { background: white; }
.tr-action-new { color: var(--greentext); }

.tr-section-label {
  font-family: var(--mono); font-size: 0.6667rem; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 12px 4px;
}

.tr-list {
  list-style: none; margin: 0; padding: 0 6px 12px;
}
.tr-empty {
  padding: 14px 12px; font-size: 0.8667rem; color: var(--text-dim);
  font-style: italic; text-align: center;
}
.tr-empty-hint { font-size: 0.8rem; }

.tr-item {
  margin: 2px 0;
  border-radius: 4px;
  position: relative;
}
.tr-item:hover { background: rgba(255,255,255,0.5); }
.tr-item.active {
  background: var(--accent);
}
.tr-item.active::before {
  content: ""; position: absolute; left: -6px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 24px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}
.tr-item.active .tr-item-text,
.tr-item.active .tr-item-meta,
.tr-item.active .tr-item-replies,
.tr-item.active .tr-item-time,
.tr-item.active .tr-item-sep { color: white; }
.tr-item.locked .tr-item-text { font-style: italic; opacity: 0.85; }

.tr-item-link {
  display: flex; gap: 8px; align-items: stretch;
  padding: 7px 8px;
  text-decoration: none; color: inherit;
}
.tr-avatar {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-post);
  border: 1px solid var(--border);
}
.tr-avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.tr-avatar-text {
  font-family: var(--sans); font-weight: 700; font-size: 0.9333rem;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* ── Live rail: new-reply badge + bump highlight ── */
.tr-item { position: relative; }
.tr-live-badge {
  position: absolute;
  top: 5px; right: 7px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #d23b3b; color: #fff;
  font: 700 10px/17px var(--sans, sans-serif);
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-panel, #232428);
  pointer-events: none;
  z-index: 2;
}
@keyframes trBumpFlash {
  from { box-shadow: inset 3px 0 0 var(--accent, #b89848), inset 0 0 24px -10px var(--accent, #b89848); }
  to   { box-shadow: inset 3px 0 0 transparent, inset 0 0 24px -10px transparent; }
}
.tr-bumped { animation: trBumpFlash 1.4s ease-out; }

.tr-item-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  justify-content: center;
}
.tr-item-title {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--sans); font-size: 0.8667rem; font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}
.tr-item-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex: 1;
}
.tr-flag { font-size: 0.7333rem; flex-shrink: 0; }
.tr-item-meta {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 0.6667rem; color: var(--text-dim);
}
.tr-item-sep { opacity: 0.5; }
.tr-item-replies { font-weight: 600; }
.tr-item-bumped { color: var(--warn); }

/* ── Main column ─────────────────────────────────────── */
.main-col {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;                 /* grid child debe colapsar para que overflow-y active */
  background: var(--bg);
  scroll-padding-top: 60px;
  overscroll-behavior-y: contain; /* evita que el wheel se escape al body */
  overscroll-behavior-x: none;
}
/* The main column gets its own padding instead of the old .container max-width.
   Templates inside the shell render their content directly into .main-col. */
.main-col > .main-inner {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  padding: 20px 28px 120px;      /* 120px: espacio suficiente para la paginación */
}
@media (max-width: 1100px) {
  .main-col > .main-inner { padding: 16px 16px 100px; }
}

/* Paginación: margen propio para que nunca quede pegada al borde */
.pagination {
  margin-top: 32px;
  margin-bottom: 40px;
}

/* ── Participants rail (derecha) ─────────────────────── */
.participants-rail {
  grid-area: participants;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-strong);
  overflow-y: auto;
  overflow-x: hidden;
}
.pr-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  position: sticky; top: 0; z-index: 2;
}
.pr-header-title {
  font-family: var(--mono); font-size: 0.7333rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim);
}
.pr-empty {
  padding: 20px 14px;
  font-size: 0.8rem; color: var(--text-dim);
  text-align: center;
}
.pr-empty-text { font-style: italic; }

/* ── Backdrop para drawers en mobile ─────────────────── */
.shell-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
  display: none;
}
.shell-backdrop.show { display: block; }

/* ── Info dialog tweaks ──────────────────────────────── */
.info-disclaimer { font-size: 0.8667rem; line-height: 1.55; }
.info-disclaimer p { margin: 0 0 10px; }
.info-links {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.8rem; text-align: center;
}

/* ── Scrollbars: discreet, consistent across columns ─── */
.boards-rail::-webkit-scrollbar,
.threads-rail::-webkit-scrollbar,
.main-col::-webkit-scrollbar,
.participants-rail::-webkit-scrollbar { width: 10px; height: 10px; }
.boards-rail::-webkit-scrollbar-track,
.threads-rail::-webkit-scrollbar-track,
.main-col::-webkit-scrollbar-track,
.participants-rail::-webkit-scrollbar-track { background: transparent; }
.boards-rail::-webkit-scrollbar-thumb,
.threads-rail::-webkit-scrollbar-thumb,
.main-col::-webkit-scrollbar-thumb,
.participants-rail::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.boards-rail::-webkit-scrollbar-thumb:hover,
.threads-rail::-webkit-scrollbar-thumb:hover,
.main-col::-webkit-scrollbar-thumb:hover,
.participants-rail::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
  background-clip: content-box;
  border: 2px solid transparent;
}

/* ─────────────────────────────────────────────────────────
 * Mobile (≤900px) — single column + drawers
 * Redesign: flex column instead of grid to guarantee 1-col layout.
 * All rails are off-canvas drawers with slide-in transitions.
 * ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {

  /* 1. Shell becomes a flex column — no grid overflow possible */
  .shell,
  .shell[data-mode="board"],
  .shell[data-mode="wide"],
  .shell[data-mode="thread"] {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    height: 100dvh !important;
    overflow: hidden !important;
    padding-top: var(--shell-header-h) !important;
    grid-template-columns: none !important;
    grid-template-areas: none !important;
  }

  /* 2. Header: fixed, always on top */
  .shell-header {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    width: 100vw !important;
    height: var(--shell-header-h) !important;
    z-index: 200 !important;
    box-sizing: border-box;
    padding: 0 10px;
    gap: 8px;
  }

  /* 3. Main column fills all remaining space */
  .main-col {
    flex: 1 1 auto !important;
    width: 100vw !important;
    min-width: 0 !important;
    height: 0 !important; /* flex child: actual height from flex: 1 */
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    grid-area: unset !important;
  }
  .main-col > .main-inner {
    padding: 12px 12px 80px !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* 4. All rails: off-canvas, position fixed */
  .boards-rail,
  .threads-rail,
  .participants-rail {
    position: fixed !important;
    top: var(--shell-header-h) !important;
    height: calc(100dvh - var(--shell-header-h)) !important;
    z-index: 150 !important;
    overflow-y: auto !important;
    transition: transform 0.22s cubic-bezier(0.4,0,0.2,1) !important;
    grid-area: unset !important;
    display: block !important;
  }

  /* Boards rail — slides in from left */
  .boards-rail {
    left: 0 !important;
    width: var(--rail-boards-w) !important;
    transform: translateX(calc(-100% - 12px)) !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }

  /* Threads rail — slides in right of boards-rail */
  .threads-rail {
    left: var(--rail-boards-w) !important;
    width: min(var(--rail-threads-w), calc(100vw - var(--rail-boards-w) - 24px)) !important;
    transform: translateX(calc(-100% - var(--rail-boards-w) - 12px)) !important;
    border-right: 1px solid var(--border-strong);
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
  }

  .shell.drawer-left-open .boards-rail,
  .shell.drawer-left-open .threads-rail {
    transform: translateX(0) !important;
  }

  /* Wide mode: no threads-rail */
  .shell[data-mode="wide"] .threads-rail { display: none !important; }
  .shell[data-mode="wide"].drawer-left-open .boards-rail {
    transform: translateX(0) !important;
  }

  /* Participants rail — slides in from right */
  .participants-rail {
    right: 0 !important;
    left: auto !important;
    width: min(var(--rail-participants-w), 85vw) !important;
    transform: translateX(calc(100% + 12px)) !important;
    box-shadow: -4px 0 20px rgba(0,0,0,0.4);
    border-left: 1px solid var(--border-strong);
  }
  .shell.drawer-right-open .participants-rail {
    transform: translateX(0) !important;
  }

  /* 5. Mobile buttons: visible */
  .shell-mobile-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .shell-mobile-left  { margin-right: 2px; }
  .shell-mobile-right { margin-left:  2px; }

  .shell[data-mode="wide"]  .shell-mobile-right,
  .shell[data-mode="board"] .shell-mobile-right { display: none !important; }

  /* 6. Backdrop */
  .shell-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.55) !important;
    z-index: 140 !important;
    opacity: 0;
    transition: opacity 0.22s;
    pointer-events: none;
  }
  .shell-backdrop.show {
    opacity: 1 !important;
    pointer-events: auto;
  }
  /* override the hidden attribute */
  .shell-backdrop[hidden] {
    display: block !important;
    visibility: hidden;
    pointer-events: none;
  }
  .shell-backdrop[hidden].show {
    visibility: visible;
  }

  /* 7. Misc mobile adjustments */
  .shell-tagline { display: none !important; }
  .shell-header-right .lang-selector-label { display: none; }

  /* Reply widget on mobile */
  .reply-widget.float-free {
    width: min(420px, 94vw) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    top: max(var(--shell-header-h), 10px) !important;
    bottom: auto !important;
    max-height: calc(90dvh - var(--shell-header-h)) !important;
    overflow-y: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   CORRECCIONES RÁPIDAS — Fase 1 ajustes
   ═══════════════════════════════════════════════════════════════ */

/* 1. Post/thread containers inside shell: full width, no 70%/80% restriction */
.in-shell .container,
.in-shell .thread-container {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
}

/* 2. Nav arrows — visibles en todos los modos.
   .thread-nav-arrows está FUERA del .shell div, usamos clases del <body>.
   - thread: boards-rail (72) + threads-rail (280) + margen
   - board:  boards-rail (72) + threads-rail (280) + margen (threads-rail también visible en board)
   - wide:   boards-rail (72) + margen (overboard/index)
*/
.in-shell .thread-nav-arrows {
  display: flex; /* visible en todos los modos por defecto */
  left: calc(var(--rail-boards-w) + 18px); /* wide: solo boards-rail */
  /* style.css usa z-index: 9999 lo cual tapa lightbox (2000), user-panel (4000)
     y cualquier dialog (1000). Bajamos para que los modales siempre ganen.
     100 sigue siendo suficiente para flotar sobre posts y otros elementos
     del main-col (que están en z-index bajo). */
  z-index: 100;
}
/* Thread y board tienen ambos rails visibles */
body.shell-thread .thread-nav-arrows,
body.shell-board  .thread-nav-arrows {
  left: calc(var(--rail-boards-w) + var(--rail-threads-w) + 18px);
}

/* ── Posición configurable (desktop only) ──────────────────────
   El usuario elige una esquina dentro del main-col vía el panel ⚙.
   Inyectamos overrides según data-nav-pos. En mobile (<=900px) las
   reglas del media query de abajo siguen ganando (esquina inferior
   derecha sobre el reply-tab).
   IMPORTANT: style.css usa !important sobre bottom/top/right en
   .thread-nav-arrows, así que aquí también necesitamos !important.
*/
@media (min-width: 901px) {
  /* bottom-right: lado derecho del main, justo antes del participants-rail */
  .in-shell .thread-nav-arrows[data-nav-pos="bottom-right"] {
    left:   auto !important;
    right:  18px !important;
    bottom: 20px !important;
    top:    auto !important;
  }
  /* En thread mode existe participants-rail (240px) → empujar a su izquierda */
  body.shell-thread .thread-nav-arrows[data-nav-pos="bottom-right"] {
    right: calc(var(--rail-participants-w) + 18px) !important;
  }

  /* top-left: bajo el header, alineado con el main */
  .in-shell .thread-nav-arrows[data-nav-pos="top-left"] {
    top:    calc(var(--shell-header-h) + 12px) !important;
    bottom: auto !important;
    /* left ya lo gestionan las reglas rail-aware de arriba */
  }

  /* top-right: bajo el header, a la derecha del main */
  .in-shell .thread-nav-arrows[data-nav-pos="top-right"] {
    top:    calc(var(--shell-header-h) + 12px) !important;
    bottom: auto !important;
    left:   auto !important;
    right:  18px !important;
  }
  body.shell-thread .thread-nav-arrows[data-nav-pos="top-right"] {
    right: calc(var(--rail-participants-w) + 18px) !important;
  }
}

/* Mobile: esquina inferior derecha, sin tapar contenido ni reply tab. */
@media (max-width: 900px) {
  body.shell-thread .thread-nav-arrows,
  body.shell-board  .thread-nav-arrows,
  .in-shell         .thread-nav-arrows {
    left:   auto;
    right:  12px;
    bottom: 40px; /* justo sobre el tab del reply-widget (32px) */
  }
}

/* ── Image size scaling (user preference) ─────────────────────
   The user can scale image/video thumbnails in posts via the ⚙ panel.
   We use `zoom` (universally supported since FF 126 / mid-2024) because
   it affects layout — surrounding text reflows correctly, unlike transform.
   Audio players stay at their fixed 200px so we exclude them.

   Two image surfaces to cover:
   1. `.thumb` — the attachment-strip thumbnails (the boxed images above the
      post body). Audio thumbs excluded.
   2. `.inline-file` — images embedded inside the post body via markup
      (float-left/right/center/inline-flow). These are the ones that wrap
      around text. inline-audio-wrap is a sibling class (not inline-file),
      so it's naturally excluded.

   `figcaption` on the strip lives outside `.thumb` so it stays unscaled. */
.in-shell .thumb:not(.audio-thumb),
.in-shell .inline-file {
  zoom: var(--img-scale, 1);
}

/* ── Board rail banner (background image on tr-header) ─────── */
.tr-header-banner {
  background-size: cover;
  background-position: center;
  min-height: 60px;
  position: relative;
}
.tr-header-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.42);
}
.tr-header-banner .tr-header-title,
.tr-header-banner .tr-nsfw-badge,
.tr-header-banner .tr-action-btn {
  position: relative;
  z-index: 1;
}
.tr-header-banner .tr-header-board { color: #fff !important; }
.tr-header-banner .tr-header-name  { color: rgba(255,255,255,0.75) !important; }

/* ── Admin shell styles ─────────────────────────────────────── */
/* Admin rail replaces the threads-rail for /admin/* pages */
.admin-nav-rail {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.admin-rail-header {
  padding: 14px 14px 10px;
  font-size: 0.7333rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.admin-rail-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  gap: 1px;
  overflow-y: auto;
  flex: 1;
}
.admin-nav-item {
  display: block;
  padding: 9px 16px;
  font-size: 0.9333rem;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 4px;
  margin: 0 6px;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.admin-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.admin-nav-item.active {
  background: var(--accent-muted, color-mix(in srgb, var(--accent) 18%, transparent));
  color: var(--accent);
  font-weight: 600;
}
.admin-nav-item.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.admin-rail-sep {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
}
.admin-nav-back {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: auto;
}
/* Admin header: show logged-in info on right */
.admin-header-who {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
}
.admin-header-who strong { color: var(--text); }
.admin-logout-btn {
  background: none;
  border: none;
  color: var(--link);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  text-decoration: underline;
}
.admin-logout-btn:hover { color: var(--link-hover); }

/* Admin content: full-width inside main-col */
.admin-container {
  padding: 20px 28px 80px;
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

/* Reports badge on admin-nav-item */
.admin-nav-badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 0.6667rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
