:root {
  --bg:      #080c10;
  --bg2:     #0d1117;
  --bg3:     #161b22;
  --bg4:     #1c2128;
  --accent:  #00ff84;
  --accent2: #38bdf8;
  --accent3: #f97316;
  --purple:  #a78bfa;
  --text:    #e6edf3;
  --text2:   #ffffff;
  --text3:   #ffffff;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --glow:    0 0 20px rgba(61,255,160,0.15);
  --mono:    'Space Mono', monospace;
  --sans:    'DM Sans', sans-serif;
  --r:       8px;
  --r2:      12px;
}

html.light-mode {
  --bg:      #fafbfc;
  --bg2:     #f0f3f7;
  --bg3:     #e6ecf3;
  --bg4:     #d9e1eb;
  --accent:  #10a860;
  --accent2: #0078d4;
  --accent3: #ff7f00;
  --purple:  #8b5cf6;
  --text:    #202124;
  --text2:   #000000;
  --text3:   #424242;
  --border:  rgba(0,0,0,0.06);
  --border2: rgba(0,0,0,0.10);
  --glow:    0 0 20px rgba(16,168,96,0.10);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }
::selection { background: rgba(61,255,160,0.2); }

body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61,255,160,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}


header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,12,16,0.92);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  height: 58px;
  display: flex; align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}
/* --- ESTILOS DEL BOTÓN TEMA --- */
.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.3s ease;
  position: relative;
}

.theme-toggle-btn:hover {
  background: var(--bg3);
  color: var(--accent);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- ESTILOS DEL BOTÓN HAMBURGUESA --- */
.hamburger-btn {
  display: none; 
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 5px;
  transition: color 0.3s ease;
}

.hamburger-btn:hover {
  color: var(--accent); 
}


.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 17, 33, 0.7); 
  backdrop-filter: blur(5px); 
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

/* --- ESTILOS DEL MENÚ LATERAL --- */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -300px; /* Escondido fuera de la pantalla */
  width: 280px;
  height: 100vh;
  background-color: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 5px 0 20px rgba(0, 0, 0, 0.6);
}

/* Clases activas inyectadas por JavaScript */
.menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu.active {
  transform: translateX(-300px); /* Desliza hacia adentro */
}

/* --- DISEÑO INTERIOR DEL MENÚ --- */
.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.menu-header h3 {
  color: var(--accent); /* Logo en Azul Cyan */
  margin: 0;
  font-family: var(--sans);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 30px;
  cursor: pointer;
  line-height: 1;
}

.menu-content {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-label {
  color: var(--text3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 20px;
  margin-bottom: 5px;
  font-family: var(--mono);
}

.menu-item {
  color: var(--text);
  text-decoration: none;
  padding: 12px 15px;
  border-radius: var(--r);
  transition: all 0.2s ease;
  font-weight: 500;
}

.menu-item.red {
  color: #f87171;
}

.menu-item.red:hover {
  background-color: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

.menu-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item:hover, .menu-item.active {
  background-color: var(--bg4);
  color: var(--accent);
}


@media (max-width: 768px) {
  .hamburger-btn {
    display: block; 
  }
    .tu-clase-sidebar-desktop {
    display: none;
  }
  .sort-sel {
    display: none;
  }
}

/* --- BARRA SUPERIOR (AJUSTADA) --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px; /* Espacio entre logo, buscador y avatar */
  padding: 12px 20px;
  background-color: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 900;
  flex-wrap: wrap; /* Permite que el buscador baje en móviles si no cabe */
}

/* --- BUSCADOR EN LA BARRA --- */
.topbar-search {
  flex: 1; /* Toma todo el espacio disponible en medio */
  max-width: 600px; /* Evita que sea gigantesco en monitores ultra anchos */
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 15px;
  color: var(--text3);
}

.topbar-search input {
  width: 100%;
  padding: 10px 15px 10px 40px; /* Espacio extra a la izquierda para la lupa */
  border-radius: 20px;
  background-color: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  transition: all 0.3s ease;
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--accent); /* Se ilumina en cyan al escribir */
  box-shadow: var(--glow);
}

.topbar-pub {
  padding: 8px 16px;
  font-size: 14px;
}

/* --- CELULARES --- */
@media (max-width: 768px) {
  

  aside.sidebar, 
  .sidebar {
    display: none !important;
  }


  .topbar {
    padding: 12px 15px;
    gap: 0; 
  }

  .brand-container {
    gap: 8px; 
  }

  .topbar-title {
    font-size: 1.2rem;
  }

  .header-right {
    gap: 8px; 
  }


  .live-badge {
    font-size: 0 !important; 
    padding: 4px 8px;
  }
  .live-badge #onlineN {
    font-size: 13px;
    font-weight: bold;
    margin-left: 4px;
  }

  .topbar-pub {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }

 
  .topbar-search {
    order: 3;
    flex: 0 0 100%; 
    margin-top: 12px;
  }
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 15px; 
}

.topbar-title {
  color: var(--accent); 
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}


.hamburger-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.3s ease;
}

.hamburger-btn:hover {
  color: var(--accent);
}


@media (min-width: 769px) {
  .hamburger-btn {
    display: none; 
  }
}

.logo {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
  display: flex; align-items: center; gap: 0.5rem;
}
.logo-bracket { color: var(--text3); }
.logo-tech { color: var(--accent2); }

.search-wrap { flex: 1; max-width: 400px; position: relative; }
.search-wrap input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.42rem 1rem 0.42rem 2.2rem;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.84rem;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: var(--glow); }
.search-wrap input::placeholder { color: var(--text3); }

.search-icon {
  position: absolute; left: 0.7rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: 0.9rem;
  pointer-events: none;
}

.header-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }

/*conectados */
.live-badge {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 0.68rem;
  color: var(--accent); white-space: nowrap;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.4;transform:scale(1.4)} }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.38rem 1rem;
  border-radius: var(--r);
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500;
  cursor: pointer; transition: all 0.18s; border: none; white-space: nowrap;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--accent2); color: var(--accent2); }
.btn-primary {
  background: var(--accent); color: #000; font-weight: 700;
}
.btn-primary:hover { background: #2ef090; transform: translateY(-1px); box-shadow: var(--glow); }
.btn-sm { padding: 0.28rem 0.75rem; font-size: 0.76rem; }

/* avatar d usuario */
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg3); border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: var(--accent);
  cursor: pointer; flex-shrink: 0; transition: box-shadow 0.2s;
}
.avatar:hover { box-shadow: var(--glow); }

/* layout principal */
.page { display: flex; height: calc(100vh - 58px); position: relative; z-index: 1; }

.sidebar {
  width: 210px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 0;
}
.sb-section { padding: 0 0.75rem 1rem; }
.sb-label {
  font-family: var(--mono); font-size: 0.6rem;
  color: var(--text3); letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}
.sb-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.42rem 0.6rem;
  border-radius: 6px;
  cursor: pointer; font-size: 0.84rem;
  color: var(--text2); transition: all 0.14s;
  margin-bottom: 1px;
}
.sb-item:hover { background: var(--bg3); color: var(--text); }
.sb-item.active { background: var(--bg3); color: var(--accent); }
.sb-item .ic { font-size: 0.85rem; width: 16px; text-align: center; flex-shrink: 0; }
.sb-cnt {
  margin-left: auto;
  font-family: var(--mono); font-size: 0.62rem;
  background: var(--bg4); border: 1px solid var(--border);
  color: var(--text3); padding: 1px 6px; border-radius: 10px;
}
.sb-divider { height: 1px; background: var(--border); margin: 0.5rem 0.75rem 1rem; }
.cat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.content { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem; }

/* =estadísticas*/
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 0.85rem 1rem;
  transition: border 0.2s;
}
.stat:hover { border-color: var(--border2); }
.stat-val {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
  line-height: 1;
}
.stat-val.g { color: var(--accent); }
.stat-val.b { color: var(--accent2); }
.stat-val.o { color: var(--accent3); }
.stat-val.p { color: var(--purple); }
.stat-lbl { font-size: 0.72rem; color: var(--text2); margin-top: 4px; }

/* filtros*/
.filters {
  display: flex; gap: 0.45rem; align-items: center;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}
.chip {
  padding: 0.28rem 0.85rem; border-radius: 20px;
  font-size: 0.76rem; font-family: var(--sans);
  border: 1px solid var(--border); background: transparent;
  color: var(--text2); cursor: pointer; transition: all 0.14s;
}
.chip:hover { border-color: var(--accent2); color: var(--accent2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 600; }
.sort-sel {
  margin-left: auto;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: 0.28rem 0.75rem;
  border-radius: 6px; font-size: 0.76rem;
  font-family: var(--sans); outline: none; cursor: pointer;
}

/* grid y tarjetas */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 0.9rem; }

.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r2); overflow: hidden;
  cursor: pointer; transition: all 0.2s; position: relative;
}
.card:hover { border-color: rgba(61,255,160,0.25); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.card.fresh { animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }

.card-img {
  height: 130px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; position: relative;
}
.card-type {
  position: absolute; top: 8px; left: 8px;
  font-family: var(--mono); font-size: 0.58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 2px 7px; border-radius: 4px;
}
.t-swap  { background:rgba(61,255,160,0.12); color:var(--accent); border:1px solid rgba(61,255,160,0.25); }
.t-sale  { background:rgba(56,189,248,0.12); color:var(--accent2); border:1px solid rgba(56,189,248,0.25); }
.t-donate{ background:rgba(167,139,250,0.12); color:var(--purple); border:1px solid rgba(167,139,250,0.25); }

.card-cond {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--mono); font-size: 0.58rem;
  padding: 2px 6px; border-radius: 3px;
}
.cn { background:#0d2b0d; color:#4ade80; }
.cb { background:#0d1f2b; color:#60a5fa; }
.cr { background:#2b1a0d; color:#fb923c; }

.card-body { padding: 0.8rem; }
.card-title { font-size: 0.86rem; font-weight: 500; line-height: 1.35; margin-bottom: 0.4rem; color: var(--text); }
.card-price {
  font-family: var(--mono); font-size: 0.9rem; font-weight: 700;
  color: var(--accent2); margin-bottom: 0.4rem;
}
.card-tag {
  display: inline-block; font-size: 0.63rem;
  padding: 2px 7px; border-radius: 3px;
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border);
}
.card-foot {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  border-top: 1px solid var(--border);
}
.foot-av {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg4); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.55rem; font-weight: 700; color: var(--text2);
  flex-shrink: 0;
}
.foot-user { font-size: 0.73rem; color: var(--text2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-time { font-size: 0.63rem; color: var(--text3); font-family: var(--mono); }
.foot-btns { display: flex; gap: 0.35rem; }
.ic-btn {
  width: 24px; height: 24px; border-radius: 5px;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; cursor: pointer; transition: all 0.14s;
  color: var(--text2);
}
.ic-btn:hover { border-color: var(--accent); color: var(--accent); }

/* estado vacío */
.empty { grid-column:1/-1; text-align:center; padding:3rem; color:var(--text2); }
.empty .e-ico { font-size:2.5rem; margin-bottom:0.75rem; opacity:0.4; }

/* chat */
.chat {
  width: 260px; flex-shrink: 0;
  background: var(--bg2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.chat-hd {
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem; 
  padding: 0.5rem; 
  margin-left: -0.5rem; 
  cursor: pointer;
  border-radius: 5px;
}

.chat-close:active {
  background: rgba(255, 255, 255, 0.1); 
}
.chat-hd-title { font-family: var(--mono); font-size: 0.7rem; color: var(--accent); letter-spacing: 1.5px; }
.chat-online { font-size: 0.65rem; color: var(--text2); display: flex; align-items: center; gap: 4px; }
.msgs { flex: 1; overflow-y: auto; padding: 0.7rem; display: flex; flex-direction: column; gap: 0.55rem; }
.sys-msg { text-align: center; font-size: 0.65rem; color: var(--text3); font-family: var(--mono); padding: 2px 0; }
.msg { display: flex; flex-direction: column; gap: 2px; }
.msg.me { align-items: flex-end; }
.msg-hd { display: flex; align-items: center; gap: 4px; }
.msg-name { font-size: 0.65rem; font-weight: 600; color: var(--accent); }
.msg-name.me { color: var(--accent2); }
.msg-ts { font-size: 0.58rem; color: var(--text3); font-family: var(--mono); }
.bubble {
  padding: 0.4rem 0.65rem; border-radius: 6px;
  font-size: 0.78rem; line-height: 1.45;
  max-width: 190px; word-break: break-word;
}
.msg:not(.me) .bubble { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.msg.me .bubble { background: rgba(61,255,160,0.08); color: var(--accent); border: 1px solid rgba(61,255,160,0.2); }
.chat-in {
  padding: 0.65rem; border-top: 1px solid var(--border);
  display: flex; gap: 0.4rem;
}
.chat-in input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.38rem 0.65rem;
  color: var(--text); font-family: var(--sans); font-size: 0.78rem;
  outline: none; transition: border 0.2s;
}
.chat-in input:focus { border-color: var(--accent); }
.chat-in input::placeholder { color: var(--text3); }
.send-btn {
  width: 30px; height: 30px; flex-shrink: 0;
  background: var(--accent); border: none; border-radius: 6px;
  cursor: pointer; font-size: 0.8rem; color: #000;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.send-btn:hover { background: #2ef090; }

.donation-points-section {
  margin: 1.5rem 0;
  padding: 1.4rem 1.5rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: var(--r2);
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.75rem;
  color: var(--accent2);
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.donation-points-section h2 {
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
  color: var(--text);
}

.donation-points-section p {
  color: var(--text2);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 620px;
}

.donation-points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.donation-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r);
  padding: 1rem;
  min-height: 120px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.donation-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.12);
}

.donation-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.donation-card-title {
  font-weight: 700;
  color: var(--text);
}

.donation-badge {
  background: var(--accent2);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.donation-card-desc {
  color: var(--text2);
  font-size: 0.92rem;
  line-height: 1.45;
  margin-bottom: 0.8rem;
}

.donation-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  width: 100%;
}

.location-filter {
  margin: 0 1rem;
}

.location-sel {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.location-sel:focus {
  border-color: var(--accent);
}

/* efectos modales */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  backdrop-filter: blur(0px);
  transition: opacity 0.2s, backdrop-filter 0.2s;
}
.overlay.open { 
  opacity: 1; 
  pointer-events: all;
  backdrop-filter: blur(8px);
}
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r2); width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
  padding: 1.75rem; position: relative;
  animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-title {
  font-family: var(--mono); font-size: 0.9rem;
  color: var(--accent); letter-spacing: 1px; margin-bottom: 1.5rem;
}

.x-btn {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); width: 26px; height: 26px;
  border-radius: 5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all 0.14s;
}
.x-btn:hover { color: var(--text); border-color: var(--border2); }

/* cuando hay modal abierto, desenfoque todo */
body:has(.overlay.open) {
  overflow: hidden;
}

body:has(.overlay.open) header,
body:has(.overlay.open) .sidebar,
body:has(.overlay.open) .content {
  filter: blur(3px);
  pointer-events: none;
}

/* tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: 0.55rem 1.1rem; font-size: 0.84rem; cursor: pointer;
  color: var(--text2); border-bottom: 2px solid transparent;
  transition: all 0.18s; margin-bottom: -1px;
}
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.on { display: block; }

/* formularios */
.fg { margin-bottom: 1rem; }
.fl {
  display: block; font-family: var(--mono); font-size: 0.65rem;
  color: var(--text2); letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.fi, .fs, .fta {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.58rem 0.85rem;
  color: var(--text); font-family: var(--sans); font-size: 0.86rem;
  outline: none; transition: border 0.2s, box-shadow 0.2s;
}
.fi:focus, .fs:focus, .fta:focus { border-color: var(--accent); box-shadow: var(--glow); }
.fi::placeholder, .fta::placeholder { color: var(--text3); }
.fta { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.ferr { color: #f87171; font-size: 0.72rem; margin-top: 0.3rem; display: none; }
.ferr.show { display: block; }
.fw { width: 100%; margin-top: 0.75rem; padding: 0.68rem; font-size: 0.9rem; }
.divtxt {
  text-align: center; position: relative; margin: 1rem 0;
  font-size: 0.73rem; color: var(--text3);
}
.divtxt::before, .divtxt::after {
  content:''; position:absolute; top:50%; height:1px;
  background:var(--border); width:40%;
}
.divtxt::before { left:0; } .divtxt::after { right:0; }

/* selector de emojis */
.epick { display: grid; grid-template-columns: repeat(8,1fr); gap: 0.35rem; margin-top: 0.4rem; }
.ep {
  padding: 0.35rem; text-align: center; border-radius: 5px;
  cursor: pointer; font-size: 1.2rem;
  background: var(--bg3); border: 1px solid var(--border);
  transition: all 0.14s; line-height: 1;
}
.ep:hover, .ep.on { border-color: var(--accent); background: rgba(61,255,160,0.08); }

/* modal de detalles */
.det-img {
  height: 160px; background: var(--bg3); border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; margin-bottom: 1.1rem;
}
.det-price { font-family: var(--mono); font-size: 1.4rem; font-weight: 700; color: var(--accent2); }
.det-desc { font-size: 0.84rem; color: var(--text2); line-height: 1.65; margin: 0.75rem 0; }
.det-row { display: flex; gap: 0.65rem; margin-bottom: 1rem; flex-wrap: wrap; }
.det-btn {
  flex: 1; min-width: 110px; padding: 0.62rem 1rem;
  border-radius: var(--r); font-size: 0.84rem;
  font-weight: 600; cursor: pointer; transition: all 0.18s;
}
.db-pri { background: var(--accent); border: none; color: #000; }
.db-pri:hover { background: #2ef090; }
.db-sec { background: transparent; border: 1px solid rgba(61,255,160,0.3); color: var(--accent); }
.db-sec:hover { background: rgba(61,255,160,0.07); }

.seller-box {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.8rem; background: var(--bg3); border-radius: var(--r);
  border: 1px solid var(--border);
}
.seller-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid rgba(61,255,160,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--accent); flex-shrink: 0;
}
.seller-name { font-size: 0.84rem; font-weight: 500; }
.seller-sub { font-size: 0.7rem; color: var(--text2); margin-top: 1px; }
.stars { color: #fbbf24; font-size: 0.72rem; }

/* drop del perfil */
.pdrop {
  position: fixed; right: 1rem; top: 60px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 0.4rem;
  z-index: 150; min-width: 170px;
  display: none; animation: fadeUp 0.18s ease;
}
.pdrop.open { display: block; }
.pd-item {
  padding: 0.48rem 0.7rem; font-size: 0.8rem;
  cursor: pointer; border-radius: 5px;
  color: var(--text2); transition: all 0.14s;
  display: flex; align-items: center; gap: 0.5rem;
}
.pd-item:hover { background: var(--bg3); color: var(--text); }
.pd-item.red { color: #f87171; }
.pd-item.red:hover { background: rgba(248,113,113,0.1); }
.pd-div { height: 1px; background: var(--border); margin: 0.3rem 0; }
.pd-user { padding: 0.5rem 0.7rem; }
.pd-uname { font-size: 0.82rem; font-weight: 500; color: var(--text); }
.pd-email { font-size: 0.68rem; color: var(--text2); margin-top: 1px; }

/* toast */
.toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 300; display: flex; flex-direction: column; gap: 0.45rem; }
.toast {
  background: var(--bg2); border: 1px solid rgba(61,255,160,0.25);
  border-radius: var(--r); padding: 0.65rem 0.9rem;
  font-size: 0.8rem; color: var(--text);
  display: flex; align-items: center; gap: 0.55rem;
  max-width: 250px; animation: fadeUp 0.25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.toast.err { border-color: rgba(248,113,113,0.3); }

/* pantalla de carga */
#loading {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
}
.load-logo { font-family: var(--mono); font-size: 1.5rem; color: var(--accent); letter-spacing: 4px; animation: pulse2 1.5s ease-in-out infinite; }
@keyframes pulse2 { 0%,100%{opacity:1} 50%{opacity:0.4} }
.load-bar { width: 200px; height: 2px; background: var(--bg3); border-radius: 1px; overflow: hidden; }
.load-fill { height: 100%; width: 0; background: var(--accent); border-radius: 1px; animation: fill 1.8s ease forwards; }
@keyframes fill { to { width: 100%; } }
.load-txt { font-family: var(--mono); font-size: 0.65rem; color: var(--text3); letter-spacing: 2px; }

/* Estilos para la Bandeja de Entrada */
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inbox-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  cursor: pointer;
  transition: all 0.2s;
}

.inbox-item:hover {
  border-color: var(--accent2);
  background: var(--bg3);
  transform: translateX(4px);
}

.inbox-info {
  flex: 1;
}

.inbox-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.inbox-sub {
  font-size: 0.75rem;
  color: var(--text2);
  margin-top: 2px;
}
/* Botón Flotante Universal */
.chat-toggle {
  display: flex;
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 999;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 1.5rem;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: 0 4px 15px rgba(61, 255, 160, 0.4);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.chat-toggle:active {
  transform: scale(0.9);
}

.stats {
  overflow-x: auto;
  padding-bottom: 10px; 
}

.stats::-webkit-scrollbar {
  height: 6px; 
}

.stats::-webkit-scrollbar-track {
  background: var(--bg3); 
  border-radius: 10px; 
}


.stats::-webkit-scrollbar-thumb {
  background-color: var(--accent2); 
  border-radius: 10px; 
}


.stats::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent); 
}
/* Ajustes para PC */
@media (min-width: 901px) {

  .chat:not(.desktop-hidden) ~ .chat-toggle {
    display: none;
  }
}

/* responsive celular */
@media (max-width: 900px) {
  .toasts { bottom: 5.5rem; }
}

/*responsive global*/
@media(max-width: 900px) {
  body { overflow-x: hidden; }
.page { flex-direction: column; height: calc(100vh - 105px); z-index: auto; }
  

  header { height: auto; flex-wrap: wrap; padding: 0.75rem 1rem; gap: 0.5rem; }
  .logo { flex: 1; }
  
  .header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    order: 3;
  }
  
  .live-badge { display: none !important; }
  .theme-toggle-btn { display: none !important; }
  
  .topbar-search { order: 4; width: 100%; max-width: 100%; margin-top: 0.5rem; }
  
    /* carousel */
  .sidebar {
    width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border);
    flex-direction: row; overflow-x: auto; padding: 0.75rem 1rem; gap: 0.5rem;
  }
    /* divisores */
  .sb-divider, .sb-label { display: none; }
  .sb-section { display: flex; flex-direction: row; padding: 0; align-items: center; gap: 0.5rem; }
  .sb-item { margin: 0; white-space: nowrap; background: var(--bg3); border-radius: 20px; padding: 0.35rem 0.8rem; }
    /* contenido principal grid */  
  .content { padding: 1rem; overflow-y: auto; overflow-x: hidden; }
  .stats { display: flex; overflow-x: auto; padding-bottom: 0.5rem; gap: 0.5rem; }
  .stat { min-width: 140px; padding: 0.6rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  

  .card-img { height: 90px; font-size: 2.2rem; }
  .card-body { padding: 0.6rem; }
  .card-title { font-size: 0.75rem; }
  .card-price { font-size: 0.85rem; }
  
  /* EL CHAT */
  .chat {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1000; border-left: none;
    transform: translateX(100%); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .chat.open { transform: translateX(0); }
  
 
  #backToGlobal { 
    display: block !important; padding: 0.4rem 0.8rem; 
    background: rgba(255,255,255,0.1); border-radius: var(--r); 
    color: var(--text); font-size: 0.75rem; 
  }
}

.mobile-chat-toggle { display: none; }

@media(max-width: 900px) {
  .mobile-chat-toggle {
    display: flex;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 999; /* superior al modal */
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    font-size: 1.5rem;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 4px 15px rgba(61, 255, 160, 0.4);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
  }
  
  .mobile-chat-toggle:active {
    transform: scale(0.9);
  }
  

  .toasts { 
    bottom: 5.5rem; 
  }
}
/* Ocultar chat en PC */
@media (min-width: 901px) {
  .chat.desktop-hidden {
    display: none !important;
  }
}
@media (min-width: 901px) {
  .chat:not(.desktop-hidden) ~ .chat-toggle {
    display: none;
  }
}

/* Modal de error grande */
.error-modal {
  max-width: 500px;
  text-align: center;
}

.error-content {
  padding: 2rem 1rem;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-modal h2 {
  color: #f87171;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.error-modal p {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .chat.open ~ .chat-toggle {
    display: none;
  }
    .toasts { bottom: 5.5rem; }
}