/* NebulaPay — estilos del panel (temas Galaxia Turquesa y Galaxia Morada). */

/* ---------- Tokens ---------- */
:root,
html[data-theme="turquesa"] {
  --bg: #050816;
  --surface: rgba(8, 15, 34, 0.8);
  --surface-strong: rgba(7, 13, 30, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --line: rgba(150, 205, 235, 0.2);
  --line-strong: rgba(120, 215, 235, 0.5);
  --text: #f1f5ff;
  --muted: #a8b7cf;
  --faint: #7f8ea8;
  --accent: #3ee0c5;
  --accent-strong: #67f0e4;
  --accent-ink: #032621;
  --accent-soft: rgba(62, 224, 197, 0.14);
  --glow: rgba(46, 230, 214, 0.28);
  --gold: #f0c56a;
  --ok: #8ef6df;
  --warn: #ffd27a;
  --bad: #ff8dad;
  --danger: #ff5d8f;
  --focus: #f7f3ff;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --sky: url("/assets/galaxy-turquesa-bg.jpg");
  color-scheme: dark;
}

html[data-theme="morada"] {
  --surface: rgba(20, 10, 40, 0.8);
  --surface-strong: rgba(17, 8, 34, 0.95);
  --line: rgba(190, 150, 255, 0.22);
  --line-strong: rgba(190, 140, 255, 0.55);
  --accent: #b58cff;
  --accent-strong: #cdb0ff;
  --accent-ink: #1b0b3a;
  --accent-soft: rgba(181, 140, 255, 0.16);
  --glow: rgba(176, 92, 255, 0.3);
  --gold: #e7b15a;
  --sky: url("/assets/galaxy-morada-bg.jpg");
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(5, 8, 22, 0.55), rgba(5, 8, 22, 0.78)),
    var(--sky) center / cover no-repeat;
}
h1, h2, h3 { margin: 0; color: #fff; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0 0 10px; color: var(--muted); }
a { color: var(--accent-strong); }
code, pre { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
code { font-size: 0.86em; color: var(--muted); }
pre {
  white-space: pre-wrap;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ---------- Controles ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
button,
.as-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(10, 22, 44, 0.6);
  color: var(--text);
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}
button:hover:not(:disabled),
.as-button:hover { background: var(--surface-hover); border-color: var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost, .as-button.ghost { background: transparent; border-color: var(--line); }
button.danger, .as-button.danger { color: #ffd0e0; border-color: rgba(255, 93, 143, 0.7); background: rgba(80, 10, 30, 0.35); }
button.danger:hover:not(:disabled) { background: rgba(120, 15, 45, 0.5); border-color: var(--danger); }
button.icon-button { min-height: 34px; padding: 6px 8px; }
button.link {
  min-height: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-weight: 550;
}
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }

/* Acciones principales: aprobar y armar. */
button[data-authorize],
button[data-authorize-all],
button[data-authorize-batch],
button[type="submit"]:not(.ghost):not(.danger),
.rx-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
button[data-authorize]:hover:not(:disabled),
button[data-authorize-all]:hover:not(:disabled),
button[data-authorize-batch]:hover:not(:disabled),
button[type="submit"]:not(.ghost):not(.danger):hover:not(:disabled),
.rx-primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 0 18px var(--glow);
}

input, select, textarea {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(4, 10, 24, 0.65);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select option { background: #0b1430; color: var(--text); }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
input[type="date"] { color-scheme: dark; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
label:has(> input[type="checkbox"]) { display: inline-flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.error { color: var(--bad); }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(400px, 100%);
  padding: 32px 28px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 40px var(--glow);
  backdrop-filter: blur(14px);
}
.login-card h1 { font-size: 30px; margin-bottom: 20px; }
.login-card form { display: grid; gap: 14px; }
.login-card button[type="submit"] { width: 100%; height: 44px; margin-top: 4px; }
.login-card .theme-switch { margin-top: 20px; }

/* ---------- Estructura ---------- */
.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}
.sidenav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 12px 14px;
  background: var(--surface-strong);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  overflow-y: auto;
}
.side-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 4px; }
.side-brand strong { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; color: #fff; }
.side-brand .logo-dot {
  display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
#side-collapse { display: none; }
.side-links { display: grid; gap: 14px; }
.nav-group { display: grid; gap: 2px; }
.nav-title {
  margin: 0 0 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.side-links button {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #dfe7f7;
  font-weight: 500;
  text-align: left;
}
.side-links button:hover:not(:disabled) { background: var(--surface-hover); }
.side-links button.active {
  background: var(--accent-soft);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 650;
}
.side-links .nav-icon { flex: none; opacity: 0.85; }
.side-links .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: var(--surface-hover);
  color: var(--muted);
}
.nav-count.is-hot { background: var(--accent); color: var(--accent-ink); }
.nav-count.is-warn { background: rgba(255, 210, 122, 0.2); color: var(--warn); }
.nav-count:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.side-status { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.status-dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 8px var(--ok);
}
.menu-backdrop { display: none; }

.workspace { min-width: 0; display: flex; flex-direction: column; padding: 0 28px 24px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0 14px;
  background: linear-gradient(180deg, rgba(5, 8, 22, 0.92) 70%, rgba(5, 8, 22, 0));
}
.brand-block { flex: 1; min-width: 0; }
.brand-block h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav-toggle { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.updated-label { margin: 0; font-size: 12px; color: var(--faint); white-space: nowrap; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
#user-label { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.user-chip button { min-height: 30px; padding: 4px 12px; border-radius: 999px; font-size: 13px; }

/* Tema */
.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}
.theme-switch button {
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.theme-switch button::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: #3ee0c5; box-shadow: 0 0 6px #3ee0c5;
}
.theme-switch button[data-theme-choice="morada"]::before { background: #b58cff; box-shadow: 0 0 6px #b58cff; }
.theme-switch button[aria-checked="true"] { background: var(--surface-hover); color: #fff; }
.theme-full { display: inline; }
.theme-short { display: none; }
.sidenav .theme-full { display: none; }
.sidenav .theme-short { display: inline; }

/* ---------- Resumen (chips de estado) ---------- */
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.stats:empty { display: none; }
.stat-card {
  min-height: 36px;
  padding: 6px 12px 6px 10px;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  backdrop-filter: blur(10px);
}
.stat-card .stat-icon { width: 18px; height: 18px; opacity: 0.85; }
.stat-card strong {
  min-width: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-hover); font-size: 13px; text-align: center;
}
.stat-card .stat-arrow { display: none; }
.stat-card.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 14px var(--glow); }
.stat-card.is-selected strong { background: var(--accent); color: var(--accent-ink); }

/* ---------- Contenido ---------- */
.content { display: grid; gap: 16px; align-content: start; }
.content > *, .rx, .rx-body, .rx-step, .rx-head > div { min-width: 0; }
.panel-card,
.message-card {
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.panel-card > p, .message-card > p { max-width: 75ch; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.search-field { min-width: min(320px, 100%); }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.toolbar label { flex: 1 1 140px; max-width: 220px; font-size: 12px; }
.toolbar input, .toolbar select { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.toolbar button { min-height: 36px; }
.empty, .status-line { margin: 0; padding: 26px 8px; text-align: center; color: var(--muted); }
.page-foot { margin: auto 0 0; padding-top: 20px; text-align: center; font-size: 12px; color: var(--faint); }

/* Tablas */
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
}
td { padding: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; color: var(--text); }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.order-table td:first-child { font-weight: 600; }
.order-table td code { font-weight: 400; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions a { color: var(--accent-strong); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid currentColor; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.pager p { margin: 0; font-size: 13px; }
.pager div { display: flex; gap: 8px; }

/* Enviados */
.sent-table { border-collapse: separate; border-spacing: 0 6px; }
.sent-table td { background: var(--surface-soft); border: 0; padding: 11px 12px; white-space: nowrap; color: var(--muted); }
.sent-table td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.sent-table td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sent-table .sent-name { color: #fff; font-weight: 650; }
.sent-table .sent-amount { color: #fff; font-weight: 700; }

/* Listas simples (encargados) */
.operator-list { display: grid; gap: 10px; }
.operator-job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  box-shadow: none;
}
.operator-job h2 { grid-column: 1; font-size: 17px; }
.operator-job .amount { grid-column: 2; grid-row: 1; margin: 0; font-size: 18px; font-weight: 750; color: #fff; text-align: right; }
.operator-job .account, .operator-job .job-note, .operator-job .row-actions { grid-column: 1 / -1; margin: 0; }
.operator-job .account { font-size: 14px; overflow-wrap: anywhere; color: var(--text); }
.operator-job .job-note { font-size: 13.5px; }
.operator-job .row-actions { margin-top: 6px; }
.operator-job .row-actions button, .operator-job .row-actions a { min-height: 42px; padding: 8px 16px; }
.message-card .operator-job { background: transparent; }

/* Formularios */
.message-card form { display: grid; gap: 14px; max-width: 560px; margin-top: 8px; }
.message-card textarea { min-height: 140px; resize: vertical; }
.message-card form button { justify-self: start; min-width: 180px; }
.account-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; margin: 8px 0 14px; }
.account-form button { min-width: 0; }
#sim-result:empty { display: none; }

/* PIN */
#pin-dialog {
  width: min(440px, 92vw);
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow), 0 0 40px var(--glow);
}
#pin-dialog::backdrop { background: rgba(2, 4, 12, 0.75); backdrop-filter: blur(3px); }
#pin-form { display: grid; gap: 14px; }
#pin-form p { margin: 0; }
#pin-dialog menu { display: flex; justify-content: flex-end; gap: 10px; margin: 6px 0 0; padding: 0; }
#pin-dialog menu button { min-width: 120px; }
#pin-confirm { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* Avisos */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; }
.toast {
  margin: 0; max-width: 360px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: #0f2a2a; border: 1px solid var(--accent); color: #fff; box-shadow: var(--shadow);
}
.toast.error { background: #3a0f1d; border-color: var(--danger); }

/* ---------- Comprobantes ---------- */
.rx { display: grid; gap: 16px; }
.rx-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 24px; flex-wrap: wrap;
  padding: 18px 22px; border-radius: var(--radius-lg); background: var(--surface-strong); border: 1px solid var(--line);
}
.rx-head p { margin: 6px 0 0; max-width: 70ch; }
.rx-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); }
.rx-tabs button { min-height: 34px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); }
.rx-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.rx-body { display: grid; gap: 16px; }
.rx-step {
  display: grid; gap: 12px; padding: 18px 22px; border-radius: var(--radius-lg);
  background: var(--surface-strong); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.rx-step h3 { display: flex; align-items: center; gap: 10px; }
.rx-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; font-weight: 800;
}
.rx-hint { margin: 0; font-size: 13.5px; }
.rx-muted { color: var(--faint); font-size: 13px; }
.rx-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.rx-empty { margin: 0; padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.rx-icon { flex: none; }

.rx-platforms { display: flex; flex-wrap: wrap; gap: 10px; }
.rx-platform {
  position: relative; flex-direction: column; gap: 8px; width: 150px; min-height: 0; padding: 10px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-soft); white-space: normal;
}
.rx-platform.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset, 0 0 18px var(--glow); }
.rx-platform-thumb { display: grid; place-items: center; width: 100%; height: 44px; }
.rx-platform-thumb img { max-width: 100%; max-height: 44px; object-fit: contain; }
.rx-platform-name { font-weight: 650; font-size: 14px; text-align: center; }
.rx-check {
  position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink);
}
.rx-missing { font-size: 12px; color: var(--faint); border: 1px dashed var(--line); border-radius: 8px; padding: 4px 8px; }

.rx-drop {
  display: grid; justify-items: center; gap: 6px; padding: 28px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-soft); color: var(--muted);
  transition: background 0.15s, border-color 0.15s;
}
.rx-drop strong { color: var(--text); font-size: 15px; }
.rx-drop span { font-size: 13px; }
.rx-drop:hover, .rx-drop.is-over, .rx-library.is-over { border-color: var(--accent); background: var(--accent-soft); }

.rx-results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.rx-results-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rx-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.rx-card {
  display: grid; gap: 10px; padding: 12px; border-radius: var(--radius);
  background: var(--surface-soft); border: 1px solid var(--line);
}
.rx-card.is-error { border-color: rgba(255, 93, 143, 0.6); }
.rx-card-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rx-card-stage { width: min(100%, var(--rx-max-w, 100%)); justify-self: center; }
.rx-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rx-card-actions button { min-height: 36px; padding: 6px 12px; }
.rx-card-actions .rx-primary { flex: 1; }
button.icon-only, .as-button.icon-only { padding: 6px 9px; }
.rx-card-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; min-height: 20px; }
.rx-card-extra button.link { font-size: 13px; gap: 4px; }
.rx-tag { padding: 2px 8px; border-radius: 999px; background: rgba(255, 210, 122, 0.16); color: var(--warn); font-size: 12px; font-weight: 600; }
.rx-skeleton {
  display: grid; place-items: center; aspect-ratio: 9 / 16; max-height: 320px; border-radius: var(--radius-sm);
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.03) 30%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 70%) 0 0 / 300% 100%;
  animation: rx-shine 1.4s linear infinite; color: var(--muted); font-size: 13px;
}
@keyframes rx-shine { to { background-position: -150% 0; } }
.is-busy { cursor: progress !important; }

/* Escenario: imagen con stickers que se mueven */
.rx-stage {
  position: relative; width: 100%; overflow: hidden; border-radius: 8px; background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); user-select: none; -webkit-user-select: none;
}
.rx-stage-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.rx-layer { position: absolute; cursor: grab; outline: 1px dashed transparent; outline-offset: 1px; touch-action: none; }
.rx-layer img { display: block; width: 100%; height: 100%; pointer-events: none; }
.rx-stage:not(.is-locked):hover .rx-layer, .rx-layer:focus-visible { outline-color: rgba(62, 224, 197, 0.9); }
.rx-layer:focus-visible { outline: 2px solid var(--accent); }
.rx-layer.is-dragging { cursor: grabbing; outline: 2px solid var(--accent); z-index: 5; }
.rx-layer-remove {
  position: absolute; top: -9px; right: -9px; z-index: 3; width: 22px; height: 22px; min-height: 22px;
  padding: 0; border-radius: 50%; border: 2px solid #fff; background: #6d1230; color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
}
.rx-handle {
  position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 4px;
  background: var(--accent); border: 2px solid #fff; cursor: nwse-resize; opacity: 0; transition: opacity 0.15s;
}
.rx-stage:not(.is-locked):hover .rx-handle, .rx-layer:focus-visible .rx-handle, .rx-layer.is-dragging .rx-handle { opacity: 1; }
@media (hover: none) { .rx-handle { opacity: 0.9; width: 18px; height: 18px; right: -9px; bottom: -9px; } }

.rx-dialog {
  width: min(96vw, 1100px); max-height: 96dvh; padding: 14px; border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong); background: var(--surface-strong); color: var(--text);
}
.rx-dialog::backdrop { background: rgba(2, 4, 12, 0.8); }
.rx-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rx-dialog-actions { display: flex; gap: 8px; }
.rx-dialog-stage { width: min(100%, var(--rx-max-w, 100%)); margin: 0 auto; }

/* Sticker de plataforma: se pone a mano en cada comprobante */
.rx-editor-title { display: grid; gap: 2px; min-width: 0; }
.rx-editor-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rx-place {
  width: 100%; min-height: 46px; padding: 6px 12px; gap: 10px; justify-content: flex-start;
  border: 2px dashed var(--accent); background: var(--accent-soft); color: #fff; font-weight: 700; white-space: normal; text-align: left;
}
.rx-place:hover:not(:disabled) { border-style: solid; }
.rx-place-img {
  display: grid; place-items: center; flex: none; width: 64px; height: 30px; border-radius: 6px;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.08) 0 25%, transparent 0 50%) 0 0 / 10px 10px;
}
.rx-place-img img { max-width: 100%; max-height: 26px; object-fit: contain; }
.rx-dialog-actions .rx-place-img { width: 48px; height: 24px; }
.rx-dialog-actions .rx-place-img img { max-height: 20px; }
.rx-card.needs-platform { border-color: rgba(255, 210, 122, 0.55); }
.rx-layer.is-variable { outline: 2px dashed rgba(255, 210, 122, 0.95); outline-offset: 2px; }
.rx-scheme-thumb { display: grid; place-items: center; flex: none; width: 48px; height: 26px; }
.rx-scheme-thumb img { max-width: 100%; max-height: 24px; object-fit: contain; }
.rx-scheme-item { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.rx-scheme-item span:nth-child(2) { flex: 1; }

/* Biblioteca */
.rx-library {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px;
  padding: 4px; border: 2px dashed transparent; border-radius: var(--radius);
}
.rx-tile {
  display: grid; gap: 8px; padding: 10px; border-radius: var(--radius);
  background: var(--surface-soft); border: 1px solid var(--line);
}
.rx-tile.is-fixed { border-color: var(--accent); }
.rx-tile-img {
  display: grid; place-items: center; height: 84px; padding: 8px; border-radius: var(--radius-sm);
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.07) 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}
.rx-tile-img img { max-width: 100%; max-height: 68px; object-fit: contain; }
.rx-tile-name { font-weight: 650; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rx-tile-use { margin: 0; font-size: 12px; color: var(--faint); }
.rx-tile-actions { display: flex; gap: 6px; }
.rx-tile-actions > * { min-height: 32px; }
.rx-switch { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; cursor: pointer; }
.rx-rename { display: flex; gap: 6px; }
.rx-rename input { min-height: 34px; padding: 4px 8px; }
.rx-rename button { min-height: 34px; padding: 4px 10px; }

/* Plataformas */
.rx-platform-list { display: grid; gap: 8px; }
.rx-prow {
  display: grid; grid-template-columns: 120px minmax(120px, 1fr) minmax(160px, 220px) auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius); background: var(--surface-soft); border: 1px solid var(--line);
}
.rx-prow-thumb { display: grid; place-items: center; height: 40px; }
.rx-prow-thumb img { max-width: 100%; max-height: 40px; object-fit: contain; }
.rx-prow-name { color: #fff; }
.rx-prow-select select { min-height: 36px; padding: 6px 10px; }
.rx-prow-actions { display: flex; gap: 6px; justify-content: flex-end; }
.rx-prow-actions > * { min-height: 36px; }
.rx-add-platform { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(160px, 240px) auto; gap: 8px; margin-top: 4px; }

/* Esquema */
.rx-scheme { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
.rx-scheme-side { display: grid; gap: 10px; }
.rx-scheme-side .rx-platforms { gap: 6px; }
.rx-scheme-side .rx-platform { width: calc(50% - 3px); padding: 8px; }
.rx-scheme-side .rx-platform-thumb { height: 30px; }
.rx-scheme-side .rx-platform-thumb img { max-height: 30px; }
.rx-scheme-side .rx-platform-name { font-size: 12.5px; }
.rx-scheme-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rx-scheme-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-scheme-item button, .rx-scheme-list > button { min-height: 32px; padding: 4px 10px; }
.rx-scheme-list { display: grid; gap: 8px; }
.rx-scheme-stage { width: min(100%, var(--rx-max-w, 100%)); justify-self: center; }
.rx-card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rx-card-top .rx-card-name { flex: 1; min-width: 0; }
.rx-card-top button { min-height: 30px; padding: 4px 7px; }

/* ---------- Celular y pantallas chicas ---------- */
@media (max-width: 1100px) {
  .workspace { padding: 0 18px 20px; }
  .rx-prow { grid-template-columns: 90px minmax(0, 1fr) auto; }
  .rx-prow-select { grid-column: 2 / -1; grid-row: 2; }
  .rx-prow-actions { grid-column: 3; grid-row: 1; }
}

@media (max-width: 800px) {
  body { font-size: 14.5px; }
  .shell { grid-template-columns: 1fr; }
  .sidenav {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-105%); transition: transform 0.2s ease; box-shadow: var(--shadow);
  }
  .sidenav.is-open { transform: none; }
  .menu-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(2, 4, 12, 0.6); }
  #side-collapse { display: inline-flex; }
  #nav-toggle { display: inline-flex; flex: none; }
  .workspace { padding: 0 12px 16px; }
  .topbar { gap: 10px; padding: 10px 0; background: rgba(5, 8, 22, 0.94); margin: 0 -12px 10px; padding-left: 12px; padding-right: 12px; border-bottom: 1px solid var(--line); }
  .brand-block h1 { font-size: 19px; }
  .updated-label, .user-chip #user-label { display: none; }
  .user-chip { padding: 0; border: 0; background: none; }
  #refresh-btn .btn-text { display: none; }
  .topbar-actions { flex-wrap: nowrap; gap: 6px; }
  .topbar-actions button { min-height: 36px; padding: 6px 10px; }
  .stats { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 12px; padding: 0 12px 4px; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .stat-card { flex: none; }
  .panel-card, .message-card, .rx-step, .rx-head { padding: 14px; border-radius: var(--radius); }
  .panel-head { align-items: stretch; }
  .search-field { min-width: 100%; }
  .toolbar label { max-width: none; flex-basis: 45%; }
  .order-table thead { display: none; }
  .order-table, .order-table tbody, .order-table tr, .order-table td { display: block; width: 100%; }
  .order-table tr { margin: 0 0 10px; padding: 6px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
  .order-table td { border: 0; padding: 5px 12px; }
  .order-table td::before { content: attr(data-label); display: block; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
  .sent-table, .sent-table tbody, .sent-table tr, .sent-table td { display: block; width: 100%; }
  .sent-table tr { margin-bottom: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-soft); }
  .sent-table td { padding: 2px 0; background: none; white-space: normal; }
  .rx-head { align-items: stretch; }
  .rx-tabs { width: 100%; }
  .rx-tabs button { flex: 1; min-width: 0; padding: 6px 8px; font-size: 13px; white-space: normal; line-height: 1.15; }
  .rx-tabs button .rx-icon { display: none; }
  .rx-platform { width: calc(50% - 5px); }
  .rx-cards { grid-template-columns: 1fr; }
  .rx-scheme { grid-template-columns: 1fr; }

  .rx-add-platform { grid-template-columns: 1fr; }
  .rx-prow { grid-template-columns: 70px minmax(0, 1fr); }
  .rx-prow-select { grid-column: 1 / -1; grid-row: auto; }
  .rx-prow-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-start; }
  .rx-results-head { align-items: stretch; }
  .rx-results-actions { width: 100%; }
  .rx-results-actions .rx-primary { flex: 1; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Encargados: el comprobante se ve, no se toca */
.rx-stage.is-locked .rx-layer { cursor: default; outline: 0; }
