/* "My account": pedidos, chat y usuarios. Usa las variables y componentes de style.css. */
.account-page {
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% -10%, #5a2c8f 0%, var(--bg) 45%, #1d0d33 100%) fixed;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  background: rgba(20, 9, 36, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar__right { display: flex; align-items: center; gap: 10px; }
.topbar__who { font-size: 13px; color: var(--paper-dim); }

.dash { width: min(1180px, 100%); margin: 0 auto; padding: 28px var(--gutter) 60px; }
.dash__auth { max-width: 440px; margin: 6vh auto 0; }
.dash__title { margin-bottom: 18px; font: 900 34px/1 var(--display); text-transform: uppercase; }

.banner { margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.banner--ok { background: rgba(62, 240, 139, 0.12); border: 1px solid rgba(62, 240, 139, 0.4); }
.banner--error { background: rgba(255, 110, 140, 0.12); border: 1px solid rgba(255, 110, 140, 0.4); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab {
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(14, 7, 23, 0.4);
  color: var(--paper-dim);
  font: 700 12px/1 var(--display);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.tab.is-active { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.tab[hidden] { display: none; }

/* Lista de pedidos + detalle */
.orders { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.orders[hidden], .users[hidden] { display: none; }
.orders__list,
.order,
.users {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(14, 7, 23, 0.72);
}
.orders__list { display: grid; gap: 4px; padding: 8px; max-height: calc(100vh - 210px); overflow-y: auto; }
.orders__list .empty { margin: 14px; }
.order-row {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--paper);
  text-align: left;
  cursor: pointer;
}
.order-row:hover { background: rgba(255, 255, 255, 0.04); }
.order-row.is-open { background: rgba(201, 167, 255, 0.1); border-color: rgba(201, 167, 255, 0.4); }
.order-row.has-unread::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ef08b;
}
.order-row__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-right: 12px; font-size: 14px; }
.order-row__bottom { font-size: 12px; color: rgba(251, 243, 236, 0.6); }
/* Pregunta que el administrador puede borrar: la × va a la derecha, en su propio lugar. */
.order-row-wrap { position: relative; display: grid; }
.order-row--deletable { padding-right: 48px; }
.row-delete {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(14, 7, 23, 0.55);
  color: rgba(251, 243, 236, 0.75);
  font: 500 18px/1 var(--body);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.row-delete:hover, .row-delete:focus-visible { background: #ff6e8c; border-color: #ff6e8c; color: var(--ink); }
.row-delete:disabled { opacity: 0.4; cursor: default; }

.badge { flex: none; padding: 5px 8px; border-radius: 6px; font: 700 10px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.badge--pending { background: rgba(255, 196, 82, 0.16); color: #ffc452; }
.badge--paid { background: rgba(62, 240, 139, 0.14); color: #3ef08b; }
.badge--in_progress { background: rgba(90, 170, 255, 0.16); color: #7ab8ff; }
.badge--delivered { background: rgba(201, 167, 255, 0.18); color: var(--accent); }
.badge--cancelled { background: rgba(255, 255, 255, 0.08); color: rgba(251, 243, 236, 0.5); }
.badge--review { background: rgba(255, 140, 66, 0.16); color: #ff9d5c; }
/* Estado de cada comprobante enviado (PayPal a mano). */
.badge--proof-pending { background: rgba(255, 140, 66, 0.16); color: #ff9d5c; }
.badge--proof-accepted { background: rgba(62, 240, 139, 0.14); color: #3ef08b; }
.badge--proof-rejected { background: rgba(255, 110, 140, 0.16); color: #ff9db0; }

.order { display: grid; gap: 18px; padding: 22px; min-height: 420px; align-content: start; }
.order > .empty { margin: auto; text-align: center; }
.order__back { display: none; }
.order__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.order__title { font: 900 24px/1 var(--display); text-transform: uppercase; }
.order__meta { margin-top: 8px; font-size: 13px; color: var(--paper-dim); }
.order__info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.order__info .summary { margin: 0; }
.facts { display: grid; gap: 4px; align-content: start; }
.facts dt { margin-top: 8px; font: 600 11px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(251, 243, 236, 0.55); }
.facts dt:first-child { margin-top: 0; }
.facts dd { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.order__pay, .order__manage { display: grid; gap: 10px; padding: 14px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.order__pay p { font-size: 14px; }
.order__pay-btns, .order__manage-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.order__manage .label { margin: 0; }

/* El chat (y la tarjeta del producto) están en style.css: también se usan en la tienda. */

/* Panel */
.tab__count {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #3ef08b;
  color: var(--ink);
  font: 700 10px/1 var(--display);
  text-align: center;
}
.order-row__preview {
  overflow: hidden;
  font-size: 12px;
  color: rgba(251, 243, 236, 0.5);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.kind { padding: 3px 6px; border-radius: 5px; font: 700 9px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; vertical-align: 2px; }
.kind--ticket { background: rgba(90, 170, 255, 0.16); color: #7ab8ff; }
.kind--order { background: rgba(62, 240, 139, 0.14); color: #3ef08b; }
.badge--open { background: rgba(90, 170, 255, 0.16); color: #7ab8ff; }
.badge--closed { background: rgba(255, 255, 255, 0.08); color: rgba(251, 243, 236, 0.5); }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; margin-bottom: 16px; }
.filters__group { display: grid; gap: 7px; }
.filters__label { font: 600 10px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(251, 243, 236, 0.55); }
.filters__search { flex: 1; min-width: 200px; max-width: 320px; margin-left: auto; }

.order__inner { display: grid; gap: 18px; align-content: start; }
.topbar__role { white-space: nowrap; }
.gate__text { margin-bottom: 18px; font-size: 14px; line-height: 1.6; color: var(--paper-dim); }

/* Usuarios */
.users { padding: 20px; }
.users__help { max-width: 70ch; font-size: 14px; line-height: 1.6; color: var(--paper-dim); }
.users__status { min-height: 20px; margin: 10px 0; font-size: 13px; color: #a8f5c8; }
.users__wrap { overflow-x: auto; }
.users__table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users__table th { padding: 10px 12px; font: 600 11px/1.2 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(251, 243, 236, 0.6); text-align: left; white-space: nowrap; }
.users__table td { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); white-space: nowrap; }
.users__name { font-weight: 600; }
.users__table th.users__server { color: #3ef08b; text-align: center; }
.users__email { color: var(--paper-dim); }
.users__search { max-width: 360px; margin-top: 14px; }
.users__check input:disabled { cursor: not-allowed; opacity: 0.35; }
.users__check { text-align: center; }
.users__check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.role { padding: 4px 8px; border-radius: 6px; font: 700 10px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.role--buyer { background: rgba(255, 255, 255, 0.08); }
.role--seller { background: rgba(62, 240, 139, 0.14); color: #3ef08b; }
.role--admin { background: rgba(201, 167, 255, 0.2); color: var(--accent); }
.role--unverified { background: rgba(255, 196, 82, 0.14); color: #ffc452; }

@media (max-width: 860px) {
  .orders { grid-template-columns: 1fr; }
  .orders__list { max-height: none; }
  .order { display: none; }
  body.order-open .orders__list { display: none; }
  body.order-open .order { display: grid; }
  .order__back { display: inline-block; justify-self: start; }
  .order__info { grid-template-columns: 1fr; }
  .topbar__who, .topbar__role { display: none; }
  .topbar .btn { padding: 10px 12px; font-size: 11px; white-space: nowrap; }
  .filters__search { max-width: none; margin-left: 0; }
  /* En el celular, la lista o el detalle (no los dos). */
  body.order-open .filters { display: none; }
}

/* ─── Products y Deals (administrador) ─────────────────── */
.admin-shop { display: grid; gap: 16px; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-bar .chips { margin-right: auto; }
.admin-bar__select { width: auto; min-width: 180px; padding-block: 10px; }
.admin-bar__search { width: 220px; padding-block: 10px; }
.admin-bar__grow { flex: 1; min-width: 220px; width: auto; padding-block: 10px; }
.bulk {
  position: sticky;
  top: 84px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 110, 140, 0.45);
  border-radius: 12px;
  background: #2a1030;
}
.bulk__field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.bulk__pct { width: 76px; padding: 8px 10px; }
.bulk__ends { width: auto; padding: 8px 10px; color-scheme: dark; }
.admin-list { display: grid; gap: 18px; }
.admin-cat__head { display: flex; align-items: center; gap: 10px; padding: 0 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.admin-cat__head h3 { font: 700 12px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.admin-cat__head span { color: rgba(251, 243, 236, 0.5); font-size: 12px; }
.admin-cat input[type='checkbox'], .admin-row input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.admin-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.admin-row.is-out .admin-row__info, .admin-row.is-out .admin-row__price { opacity: 0.5; }
.admin-row__info { display: grid; gap: 4px; min-width: 0; }
.admin-row__info strong { font-size: 14px; overflow-wrap: anywhere; }
.admin-row__sub { font-size: 12px; color: rgba(251, 243, 236, 0.6); }
.admin-row__price { font: 700 14px/1.3 var(--display); text-align: right; white-space: nowrap; }
.admin-row__price s { display: block; font: 500 11px/1 var(--body); color: rgba(251, 243, 236, 0.5); }

/* Interruptor de stock */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(251, 243, 236, 0.75); cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__ui { position: relative; width: 34px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); transition: background 0.2s; }
.switch__ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); transition: transform 0.2s var(--ease); }
.switch input:checked + .switch__ui { background: #3ef08b; }
.switch input:checked + .switch__ui::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__ui { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cuadro para agregar o editar un producto */
.editor { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.editor__form { display: grid; }
.editor__title { margin-bottom: 18px; font: 700 18px/1.2 var(--display); }
.editor select.field, .editor input[type='datetime-local'] { color-scheme: dark; }
.editor__check { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 14px; cursor: pointer; }
.editor__check input { width: 16px; height: 16px; accent-color: #3ef08b; }
.editor__sale { display: grid; gap: 12px; margin-bottom: 8px; padding: 14px 16px; border: 1px solid rgba(255, 110, 140, 0.35); border-radius: 12px; }
.editor__sale legend { padding: 0 6px; margin: 0; }
.editor__pct { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.editor__pct .field { width: 80px; }
.editor__sale label.label { margin-bottom: 0; }
.editor__preview { font-size: 13px; color: #3ef08b; }
.editor__preview:empty { display: none; }
.editor__delete { margin-right: auto; color: #ff9db0; }

/* Lista de Deals */
.deals-admin { list-style: none; display: grid; }
.deals-admin .admin-row { grid-template-columns: 28px minmax(0, 1fr) auto auto; }
.deals-admin__n { font: 700 13px/1 var(--display); color: var(--accent); }

@media (max-width: 860px) {
  .admin-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .admin-row .switch, .admin-row > .pill-btn { grid-column: 2 / -1; justify-self: start; }
  .admin-bar__search { width: 100%; }
  .bulk { top: 70px; }
}

/* ─── PayPal a mano: instrucciones, comprobantes y revisión (ui.js) ─── */
.mpay-wrap { display: grid; gap: 12px; }
.mpay {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(201, 167, 255, 0.28);
  border-radius: 14px;
  background: rgba(201, 167, 255, 0.06);
}
.mpay__title { font: 700 14px/1.2 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.mpay__text { font-size: 14px; line-height: 1.5; }
.mpay__hint { font-size: 12px; line-height: 1.5; color: rgba(251, 243, 236, 0.65); }
.mpay__alert { padding: 10px 12px; border-radius: 10px; background: rgba(255, 110, 140, 0.12); color: #ff9db0; font-size: 13px; line-height: 1.5; }

.mpay__step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
.mpay__num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font: 700 13px/1 var(--display);
}
.mpay__body { display: grid; gap: 8px; min-width: 0; }
.mpay__step-title { padding-top: 6px; font-weight: 600; font-size: 14px; }

.mpay__copy {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border-radius: 10px;
  background: rgba(14, 7, 23, 0.45);
}
.mpay__key { font: 600 10px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(251, 243, 236, 0.55); }
.mpay__value { font-size: 15px; overflow-wrap: anywhere; }

.mpay__form { display: grid; gap: 10px; }
.mpay__form .label { margin: 0; }
.mpay__form .field { margin-top: 7px; }
.mpay__form .btn:not(.btn--wide) { justify-self: start; }
.mpay__files { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mpay__files:empty { display: none; }
.mpay__file { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 10px; background: rgba(14, 7, 23, 0.45); }
.mpay__file img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.mpay__fname { flex: 1; min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.mpay__pdf {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: rgba(255, 110, 140, 0.16);
  color: #ff9db0;
  font: 700 11px/1 var(--display);
}

.mpay__thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.mpay__thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(14, 7, 23, 0.45);
  color: var(--paper);
  text-decoration: none;
}
.mpay__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mpay__thumb .mpay__fname { flex: none; width: 100%; padding: 0 6px; font-size: 11px; text-align: center; }
.mpay__thumb:hover { border-color: var(--accent); }

.mpay__review { display: grid; gap: 12px; }
.mpay__reject { display: grid; gap: 8px; }
.mpay__reject[hidden] { display: none; }
.mpay__reject .btn { justify-self: start; }

.mpay__history { font-size: 13px; }
.mpay__history summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.mpay__proof { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.mpay__proof-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: rgba(251, 243, 236, 0.75); }

@media (max-width: 560px) {
  .mpay { padding: 14px; }
  .mpay__copy { grid-template-columns: minmax(0, 1fr) auto; }
  .mpay__key { grid-column: 1 / -1; }
}

/* ─── Settings (ajustes.js) ─── */
.settings-card {
  display: grid;
  gap: 12px;
  max-width: 560px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(14, 7, 23, 0.55);
}
.settings-card__title { font: 700 16px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.settings-card .users__help { margin: 0; }
.settings-card .label { margin: 0; }
.settings-card .field { margin-top: 7px; }
.settings-card .btn { justify-self: start; }
.settings-card__status { font-size: 13px; font-weight: 600; color: #3ef08b; }
.settings-card__status.is-off { color: #ffc452; }

/* ─── Security (seguridad.js) ─── */
#securityView, #settingsView { display: grid; gap: 16px; align-content: start; }
.security__body { display: grid; gap: 12px; }
.security__body > .btn { justify-self: start; }
.security__form { display: grid; gap: 12px; max-width: 460px; }
.security__form .label { margin: 0; }
.security__form .field { margin-top: 7px; }
.security__form .btn { justify-self: start; }
.security__step { font-size: 14px; line-height: 1.5; }
.security__key { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.08em; }
.security__codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 8px 40px;
  margin: 0;
  padding: 14px 18px;
  list-style-position: inside;
  border-radius: 10px;
  background: rgba(14, 7, 23, 0.45);
  font: 600 16px/1.4 ui-monospace, Consolas, monospace;
}
.security__sessions { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.security__session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.security__session > div { display: grid; gap: 4px; min-width: 0; }
.security__meta { font-size: 12px; color: rgba(251, 243, 236, 0.6); overflow-wrap: anywhere; }
.security__log { width: 100%; border-collapse: collapse; font-size: 12px; }
.security__log th, .security__log td { padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); text-align: left; vertical-align: top; }
.security__log th { font: 600 10px/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(251, 243, 236, 0.55); }
.security__log td { overflow-wrap: anywhere; }
.security__log .is-alert td:nth-child(3) { color: #ff9db0; font-weight: 600; }
.security__logwrap { max-height: 480px; overflow: auto; }
