:root {
  color-scheme: dark;
  --ink-950: #06090d;
  --ink-900: #0b1017;
  --ink-850: #101722;
  --ink-800: #151e2a;
  --steel-700: #293444;
  --steel-500: #657184;
  --mist-300: #b8c1ce;
  --parchment-100: #edf0f3;
  --ember-600: #c84922;
  --ember-500: #e4652f;
  --ember-300: #f2a06f;
  --gold-500: #c7a45a;
  --arcane-500: #4b92b8;
  --success-500: #56a977;
  --danger-500: #d45e62;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-panel: 0 18px 55px rgb(0 0 0 / 34%);
  --bg: var(--ink-950);
  --bg2: var(--ink-850);
  --bg3: var(--ink-800);
  --line: #26313d;
  --fg: var(--parchment-100);
  --dim: var(--steel-500);
  --accent: var(--ember-500);
  --accent2: var(--ember-300);
  --warn: var(--gold-500);
  --danger: var(--danger-500);
  --ok: var(--success-500);
  --sidebar: 232px;
  --topbar: 72px;
  font-family: Inter, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ink-950); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--mist-300);
  background:
    radial-gradient(circle at 78% -10%, rgb(32 61 77 / 16%), transparent 34%),
    linear-gradient(180deg, #0a0f16 0%, #080c12 70%, #070a0e 100%);
  font-size: 16px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--ember-300); text-decoration: none; }
a:hover { color: var(--parchment-100); }
img, svg { display: block; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--parchment-100); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ember-300);
  outline-offset: 3px;
}
.sr-only {
  width: 1px; height: 1px; position: absolute; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px;
  background: white; color: black; transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.eyebrow {
  display: flex; align-items: center; gap: 9px; margin: 0 0 6px;
  color: var(--ember-300); font-size: 12px; font-weight: 700;
  letter-spacing: .19em; text-transform: uppercase;
}
.eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--ember-500); }

/* ---------------- brand ---------------- */
.brand {
  display: flex; align-items: center; gap: 11px; color: white;
  font-family: Cinzel, serif; font-size: 17px; letter-spacing: .08em;
}
.brand > span:last-child {
  display: grid; grid-template-columns: auto auto; column-gap: 5px; align-items: baseline;
}
.brand b { color: var(--ember-500); font-weight: 600; }
.brand small {
  grid-column: 1 / -1; color: var(--steel-500);
  font: 600 9px/1.3 Inter, sans-serif; letter-spacing: .22em; text-transform: uppercase;
}
/* El logo real, el mismo del cliente y del launcher. Antes era un rombo
   dibujado con CSS. El resplandor de brasa se conserva del diseño. */
.brand-mark {
  width: 28px; height: 28px; display: inline-block; object-fit: contain;
  filter: drop-shadow(0 0 10px rgb(228 101 47 / 30%)); flex: 0 0 auto;
}

/* El logo del login, más grande porque ahí es lo primero que se ve. */
.login-logo {
  display: block; width: 72px; height: 72px; object-fit: contain;
  margin: 0 0 14px; filter: drop-shadow(0 0 18px rgb(228 101 47 / 35%));
}

/* ---------------- login ---------------- */
body.loginpage {
  display: grid; place-items: center; min-height: 100vh; padding: 24px 16px 40px;
  background:
    radial-gradient(ellipse at 72% 18%, rgb(36 76 94 / 22%), transparent 36%),
    radial-gradient(ellipse at 28% 100%, rgb(191 64 24 / 12%), transparent 38%),
    var(--ink-950);
}
.login-shell {
  width: min(1080px, 100%);
  display: grid; grid-template-columns: 1.1fr minmax(280px, 420px);
  align-items: center; gap: 8%;
}
.login-story { max-width: 560px; }
.login-story h1 {
  margin: 0 0 18px; color: #f0f1f2;
  font: 600 clamp(40px, 6vw, 68px)/1 Cinzel, serif; letter-spacing: -.03em;
}
.login-story h1 em { color: var(--ember-500); font-style: normal; }
.login-story p { margin: 0 0 14px; color: #7c8999; font-size: 15px; line-height: 1.7; }
.login-trust {
  width: max-content; max-width: 100%; display: flex; align-items: center; gap: 13px;
  margin-top: 22px; padding: 15px 18px; border-left: 2px solid var(--success-500);
  background: #0e161e;
}
.login-trust i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success-500);
  box-shadow: 0 0 9px var(--success-500); flex: 0 0 auto;
}
.login-trust span { display: flex; flex-direction: column; gap: 4px; color: #5d6a7a; font-size: 12px; }
.login-trust b { color: #aeb8c2; font-size: 13px; font-weight: 600; }

.loginbox, .login-form {
  position: relative; width: 100%;
  padding: 38px 34px 28px;
  border: 1px solid #33404e;
  background: linear-gradient(145deg, #121b26, #0b1118);
  box-shadow: var(--shadow-panel);
  display: flex; flex-direction: column;
}
.loginbox::before, .loginbox::after,
.login-form::before, .login-form::after {
  content: ''; position: absolute; width: 26px; height: 26px;
  border-color: var(--ember-500); border-style: solid; opacity: .7;
}
.loginbox::before, .login-form::before { inset: -1px auto auto -1px; border-width: 2px 0 0 2px; }
.loginbox::after, .login-form::after { inset: auto -1px -1px auto; border-width: 0 2px 2px 0; }
.login-rune {
  width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 22px;
  border: 1px solid #6d4632; color: var(--ember-300); transform: rotate(45deg);
}
.login-rune svg { width: 20px; height: 20px; transform: rotate(-45deg); }
.loginbox h1, .login-form h2 {
  margin: 0 0 6px; font: 600 26px Cinzel, serif; color: var(--parchment-100); text-align: left;
}
.loginbox h1 span { color: var(--ember-500); }
.loginbox .sub, .login-form .sub {
  margin: 0 0 26px; color: var(--steel-500); font-size: 13px; text-align: left;
}
.loginbox label, .login-form label {
  display: grid; gap: 8px; margin-bottom: 16px;
  color: #778494; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
}
.loginbox input, .login-form input {
  width: 100%; height: 46px; margin: 0; padding: 0 12px;
  border: 1px solid #35414f; border-radius: 0; background: #0a1118; color: white;
}
.loginbox input:focus, .login-form input:focus { border-color: var(--ember-500); outline: 0; }
.loginbox button, .login-form button { width: 100%; min-height: 46px; margin-top: 6px; }
.loginerr {
  margin: 12px 0 0; min-height: 0; font-size: 13px; color: #e58689; line-height: 1.5;
}
.loginerr.on {
  background: #130f10; border-left: 2px solid var(--danger-500);
  padding: 10px 12px; color: #e58689;
}
.loginbox .foot, .login-form > small {
  display: block; margin: 16px 0 0; color: #505d6d; font-size: 12px;
  line-height: 1.5; text-align: center;
}

/* ---------------- app shell ---------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 0 16px;
  border-right: 1px solid rgb(134 151 174 / 13%);
  background: rgb(6 9 13 / 88%);
  backdrop-filter: blur(17px);
  z-index: 60;
}
.sidebar .brand { padding: 0 18px 22px; border-bottom: 1px solid #26313d; margin: 0 8px 8px; }
.sidebar nav {
  flex: 1 1 auto; overflow: auto; padding: 8px 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-label {
  margin: 14px 10px 6px; color: #8a95a4;
  font: 700 10px/1 Inter, sans-serif; letter-spacing: .16em; text-transform: uppercase;
}
.nav-label:first-child { margin-top: 6px; }
.sidebar nav button {
  width: 100%; min-height: 40px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; position: relative;
  border: 0; background: none; color: #6f7c8c;
  font-size: 13px; font-weight: 600; text-align: left; cursor: pointer;
  white-space: nowrap; border-radius: 0;
}
.sidebar nav button svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .85; }
.sidebar nav button:hover { color: white; background: #111923; }
.sidebar nav button.on { color: white; background: rgb(197 70 29 / 8%); }
.sidebar nav button.on::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--ember-500);
}
.sidebar nav button.on svg { color: var(--ember-300); }
.sidebar-foot { padding: 12px 10px 4px; border-top: 1px solid #26313d; margin: 0 8px; }
.sidebar-foot #logout {
  width: 100%; min-height: 40px;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border: 1px solid #3a3031; background: transparent; color: #806d70;
  cursor: pointer; font-size: 13px;
}
.sidebar-foot #logout:hover { border-color: #704344; color: #c28c8e; }
.sidebar-foot #logout svg { width: 15px; height: 15px; }

.workspace { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  min-height: var(--topbar);
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  border-bottom: 1px solid rgb(134 151 174 / 13%);
  background: rgb(6 9 13 / 84%);
  backdrop-filter: blur(17px);
}
.topbar-title { min-width: 0; flex: 1 1 auto; }
.topbar-title h1 {
  margin: 0; font: 600 clamp(20px, 2.2vw, 28px)/1.15 Cinzel, serif; letter-spacing: -.02em;
}
.menu-toggle {
  display: none; width: 40px; height: 40px; place-items: center;
  border: 1px solid #35404f; background: none; cursor: pointer; color: var(--parchment-100);
  flex: 0 0 auto;
}
.menu-toggle svg { width: 19px; height: 19px; }
.nav-scrim {
  display: none; position: fixed; inset: 0; background: rgb(0 0 0 / 55%); z-index: 55;
}

#status {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end;
  color: var(--steel-500); font-size: 12px; margin-left: auto;
}
#status b { color: var(--parchment-100); font-weight: 600; font-variant-numeric: tabular-nums; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; border: 1px solid #2a3542; background: #0e151e;
  color: #8fb49d; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
}
.status-pill i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--success-500);
  box-shadow: 0 0 9px var(--success-500);
}
.status-pill.is-offline { color: #9c7778; }
.status-pill.is-offline i { background: var(--danger-500); box-shadow: none; }
.status-meta { color: #5d6a79; font-size: 12px; }

main {
  padding: 28px 28px 72px;
  width: min(1400px, 100%);
}
section { display: none; animation: reveal-up 220ms ease-out both; }
section.on { display: block; }
h2.tt {
  margin: 0 0 16px; font: 400 14px/1.55 Inter, sans-serif; color: var(--steel-500);
}
h2.tt small {
  display: block; margin: 0; color: inherit; font: inherit; letter-spacing: 0;
}

/* ---------------- notes / notices ---------------- */
.note, .inline-notice {
  background: #14110c; border: 1px solid #3a3428; border-left: 2px solid var(--gold-500);
  color: #d8cba8; padding: 12px 14px; margin: 0 0 14px; font-size: 13px; line-height: 1.55;
}
.note.info, details.note.info { background: #0e151e; border-color: #2a3c4a; border-left-color: var(--arcane-500); color: #b7c9d8; }
.note.bad, details.note.bad { background: #130f10; border-color: #4a3032; border-left-color: var(--danger-500); color: #e0b6b8; }
.note.good, details.note.good { background: #0d1b16; border-color: #2f4a3a; border-left-color: var(--success-500); color: #b7d4c2; }
.note b, .inline-notice b { color: var(--parchment-100); }
.note code, .mono { font-family: ui-monospace, Consolas, 'Courier New', monospace; font-size: .92em; }
details.note { padding: 0; }
details.note summary {
  list-style: none; cursor: pointer; padding: 12px 14px;
  font-weight: 700; font-size: 13px; color: var(--parchment-100);
}
details.note summary::-webkit-details-marker { display: none; }
details.note summary::after {
  content: 'Mostrar'; float: right; color: var(--ember-300);
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
details.note[open] summary::after { content: 'Ocultar'; }
details.note .note-body { padding: 0 14px 14px; }

/* ---------------- controls ---------------- */
.bar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap;
}
.bar .sp { margin-left: auto; }
.bar input:not([type=number]):not([type=checkbox]),
.bar select { min-width: 0; flex: 1 1 180px; max-width: 28rem; }
input, select, textarea {
  background: #0a1118; border: 1px solid #35414f; color: var(--parchment-100);
  padding: .5rem .7rem; border-radius: 0; min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--ember-500); }
input[type=number] { width: 7.5rem; }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--ember-500); }

button {
  min-height: 42px; border: 1px solid #394454; background: rgb(14 21 30 / 75%);
  color: var(--parchment-100); padding: 0 16px; border-radius: 0;
  cursor: pointer; font-weight: 700; font-size: 13px; letter-spacing: .015em;
  white-space: nowrap;
  transition: border-color 120ms, background 120ms, color 120ms, box-shadow 120ms;
}
button:hover { border-color: var(--steel-500); background: var(--ink-800); color: var(--parchment-100); }
button:active { transform: translateY(1px); }
button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--ember-500), var(--ember-600));
  box-shadow: 0 10px 30px rgb(200 73 34 / 20%), inset 0 1px rgb(255 255 255 / 18%);
  color: var(--parchment-100);
}
button.primary:hover {
  background: linear-gradient(135deg, #f0773e, #d05027);
  box-shadow: 0 12px 34px rgb(200 73 34 / 32%);
  color: white;
}
button.danger {
  background: transparent; border-color: #563b34; color: #c28c8e;
}
button.danger:hover { border-color: #704344; color: #f0c4c5; background: #130f10; }
button.mini { min-height: 32px; padding: 0 10px; font-size: 12px; }
button:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------------- tables ---------------- */
.scroll {
  max-height: 52vh; overflow: auto;
  border: 1px solid #26313d; background: #0d141c;
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td {
  padding: .55rem .7rem; border-bottom: 1px solid #202a35;
  text-align: left; white-space: nowrap;
}
th {
  color: #8793a2; font-weight: 700; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; background: #0e151e; position: sticky; top: 0; z-index: 2;
}
tbody tr:hover { background: #0f161f; }
tbody tr.sel { background: #161812; box-shadow: inset 2px 0 var(--ember-500); }
tbody tr.dirty td { background: rgb(199 164 90 / 7%); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td input, td select { min-height: 34px; padding: .2rem .4rem; font-size: 13px; }
td input[type=number] { width: 5.8rem; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .15rem .45rem; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; border: 1px solid #35404f;
}
.tag.on { background: #0d1b16; border-color: #315541; color: #8fc7a3; }
.tag.off { background: transparent; border-color: #2a3542; color: var(--steel-500); }
.tag.gm { background: #17130f; border-color: #5b492d; color: var(--gold-500); }
.tag.blk { background: #130f10; border-color: #563b34; color: #e0b6b8; }
.tag.vip { background: #17130f; border-color: #5b492d; color: var(--ember-300); }
.tag.bot { background: #101322; border-color: #3a4470; color: #9aa8e8; }
.dim { color: var(--steel-500); }
.small { font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem 1rem; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.fld { display: flex; flex-direction: column; gap: .28rem; }
.fld label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7d8998; }
.fld label b { color: var(--parchment-100); font-weight: 700; text-transform: none; letter-spacing: 0; }
.fld input, .fld select { width: 100%; }
.fld input[readonly] { opacity: .55; }
.fld .hint { font-size: 12px; color: #5f6b7a; line-height: 1.4; }
.stepper {
  display: flex; align-items: stretch; width: 100%;
  border: 1px solid #35414f; background: #0a1118;
}
.stepper input[type=number] {
  width: 5rem; min-width: 0; flex: 1 1 auto; min-height: 42px;
  border: 0; text-align: center;
}
.step-btn {
  min-height: 42px; min-width: 42px; padding: 0; border: 0;
  background: #121b26; font-size: 18px; line-height: 1;
}
.stepper .step-btn:first-child { border-right: 1px solid #35414f; }
.stepper .step-btn:last-child { border-left: 1px solid #35414f; }
.seg { display: flex; width: 100%; border: 1px solid #35414f; }
.seg button {
  flex: 1; border: 0; background: #0a1118; min-height: 42px;
}
.seg button.on {
  background: #243018; color: var(--ember-300);
  box-shadow: inset 0 -2px var(--ember-500);
}
.toggle-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid #283340;
  background: #0e151e; cursor: pointer; user-select: none;
}
.toggle-card input { accent-color: var(--gold-500); }
.toggle-card b { color: var(--parchment-100); font-size: 13px; }
.toggle-card small { color: var(--steel-500); font-size: 12px; }
.mavatar {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid #344352;
  background: radial-gradient(circle, rgb(180 92 48 / 18%), #101821 70%);
  color: var(--ember-300); font: 700 14px Cinzel, serif;
}
.mob-art {
  position: relative; width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
}
.mob-art img {
  width: 36px; height: 36px; object-fit: contain;
  image-rendering: pixelated; pointer-events: none;
  filter: drop-shadow(0 3px 4px #000);
}
.mob-art img.off { display: none; }
.mob-art img:not(.off) + .mavatar { display: none; }
.sm-art .mob-art, .sm-art .mob-art img { width: 42px; height: 48px; }
#itemTip .tip-art .mob-art, #itemTip .tip-art .mob-art img { width: 50px; height: 58px; }
.spot-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 16px; align-items: start;
}
.spot-map label {
  display: block; margin-bottom: 8px; color: var(--ember-300);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.spot-map-stage {
  position: relative; width: 100%;
  border: 1px solid #33404e; background: #0a1016;
  user-select: none;
}
.spot-map-stage img {
  display: block; width: 100%; height: auto;
  image-rendering: pixelated; pointer-events: none;
}
.spot-map-stage canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: crosshair;
}
.spot-map-meta { margin-top: 8px; color: #8b98a6; font-size: 12px; font-variant-numeric: tabular-nums; }
.modal .box.spot { width: min(980px, 96vw); }
fieldset {
  border: 1px solid #283340; margin: 0 0 14px; padding: 14px 16px;
  background: #0e151e;
}
legend {
  color: var(--ember-300); font-size: 12px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; padding: 0 .4rem;
}

.panel {
  position: relative; background: linear-gradient(150deg, rgb(18 27 38 / 88%), rgb(8 13 19 / 94%));
  border: 1px solid rgb(127 147 171 / 18%); padding: 18px 18px 16px; margin-top: 16px;
  box-shadow: var(--shadow-panel);
}
.panel::before, .panel::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border-style: solid; border-color: var(--ember-500); opacity: .45;
}
.panel::before { left: -1px; top: -1px; border-width: 2px 0 0 2px; }
.panel::after { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }
.panel h3 { margin: 0 0 12px; font: 600 18px Cinzel, serif; color: var(--parchment-100); }
.qa { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .5rem; }
.qa input { width: 8rem; min-height: 34px; }

/* metrics */
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  border: solid #2b3643; border-width: 1px 0 0 1px; margin-bottom: 18px;
}
.card {
  min-height: 118px; padding: 20px 18px;
  border: solid #2b3643; border-width: 0 1px 1px 0; background: #0e151e;
}
.card .k {
  font-size: 12px; color: #758293; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.card .v {
  font: 600 30px/1.1 Cinzel, serif; margin-top: 8px; font-variant-numeric: tabular-nums; color: white;
}
.card .v.ok { color: var(--success-500); }
.card .v.bad { color: var(--danger-500); }
.card .v.acc { color: var(--gold-500); }
.card .x { font-size: 12px; color: var(--steel-500); margin-top: 6px; }

.sect {
  background: #0e151e; border: 1px solid #283340; padding: 16px 16px 14px; margin-bottom: 12px;
}
.sect > h4 { margin: 0 0 .15rem; font: 600 16px Cinzel, serif; color: var(--parchment-100); }
.sect > .sn { font-size: 13px; color: var(--steel-500); white-space: pre-wrap; margin-bottom: .7rem; line-height: 1.45; }
.sect.hide { display: none; }

.sw { position: relative; display: inline-block; width: 36px; height: 19px; flex: 0 0 auto; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw i {
  position: absolute; inset: 0; background: #39404f; border-radius: 19px;
  transition: background 120ms; cursor: pointer;
}
.sw i:before {
  content: ''; position: absolute; height: 13px; width: 13px; left: 3px; top: 3px;
  background: #c3c9d6; border-radius: 50%; transition: transform 120ms, background 120ms;
}
.sw input:checked + i { background: var(--ember-600); }
.sw input:checked + i:before { transform: translateX(17px); background: #ffd7c2; }
.swrow { display: flex; align-items: center; gap: .5rem; }

#toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 400;
  display: flex; flex-direction: column; gap: .45rem;
}
.msg {
  padding: 12px 14px; font-size: 13px; max-width: 30rem;
  box-shadow: var(--shadow-panel); border-left: 2px solid; word-break: break-word;
}
.msg.ok { background: #0d1b16; border-color: var(--success-500); color: #c6f6d5; }
.msg.err { background: #130f10; border-color: var(--danger-500); color: #f0c4c5; }
.msg.inf { background: #0e151e; border-color: var(--arcane-500); color: #bcd9f2; }

.modal {
  position: fixed; inset: 0; background: rgb(0 0 0 / 72%);
  display: none; align-items: center; justify-content: center; z-index: 300; padding: 1rem;
}
.modal.on { display: flex; }
#slotModal { z-index: 300; }
#itemModal { z-index: 500; }
.modal .box {
  background: linear-gradient(145deg, #121b26, #0b1118);
  border: 1px solid #33404e; padding: 18px 18px 16px;
  width: min(880px, 96vw); max-height: 88vh;
  display: flex; flex-direction: column; gap: .65rem;
  box-shadow: var(--shadow-panel); position: relative;
  overflow: hidden;
}
.modal-scroll { overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot {
  flex: 0 0 auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding-top: 10px; margin-bottom: 0;
  border-top: 1px solid #26313d;
  background: #0b1118;
}
.modal .hexdump { max-height: 7rem; }
#monModal { z-index: 500; }
#spotModal { z-index: 300; }
.modal .box::before, .modal .box::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border-color: var(--ember-500); border-style: solid; opacity: .55;
}
.modal .box::before { inset: -1px auto auto -1px; border-width: 2px 0 0 2px; }
.modal .box::after { inset: auto -1px -1px auto; border-width: 0 2px 2px 0; }
.modal .box.sm { width: min(560px, 96vw); }
.modal h3 { font: 600 20px Cinzel, serif; color: var(--parchment-100); margin: 0; }
.loading { color: var(--steel-500); padding: 1.1rem; font-size: 13px; }

.ipick { display: flex; flex-direction: column; gap: .5rem; min-height: 0; }
.ipick .filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.ipick .filters input { flex: 1 1 14rem; }
.ilist { overflow: auto; flex: 1 1 auto; max-height: 52vh; border: 1px solid #26313d; background: #0c131b; }
.irow {
  display: flex; gap: .6rem; align-items: center; padding: .4rem .7rem;
  cursor: pointer; border-bottom: 1px solid #202a35;
}
.irow:hover, .irow.hi { background: #161812; box-shadow: inset 2px 0 var(--ember-500); }
.irow .ithumb {
  width: 38px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid #344352;
  background: radial-gradient(circle, rgb(180 92 48 / 12%), transparent 70%);
}
.irow .ic { color: var(--steel-500); font-size: 12px; min-width: 9.5rem; }
.irow .inm { flex: 1 1 auto; font-weight: 600; color: #d2d8de; }
.irow .ilv { color: var(--gold-500); font-size: 12px; }
.irow .isz { color: var(--arcane-500); font-size: 12px; font-family: ui-monospace, Consolas, monospace; min-width: 2.6rem; text-align: right; }
.irow .isz.dim { color: #525a6b; }
.irow .icl { color: #566474; font-size: 12px; }
.cell.fp { border-color: #4a8fd4 !important; background: #1a2a3d !important; box-shadow: inset 0 0 0 1px #4a8fd4; }
.cell.fp-anchor { border-color: var(--ember-300) !important; background: #243018 !important; }
.wear.fp-anchor { border-color: var(--ember-300) !important; background: #243018 !important; }
.ipick .cnt { font-size: 12px; color: var(--steel-500); }

.invwrap { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }
.invcol { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.invcol h4 {
  margin: 0 0 .2rem; font-size: 12px; color: var(--steel-500);
  text-transform: uppercase; letter-spacing: .12em;
}
.wearlist {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  grid-auto-rows: minmax(96px, auto);
  gap: 6px;
  width: min(320px, 100%);
}
.wear {
  display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center;
  background: #0e151e; border: 1px solid #283340; padding: .45rem .4rem; cursor: pointer; font-size: 13px;
  min-height: 96px; text-align: center;
}
.wear:hover { border-color: #5a4a40; }
.wear.exc { border-color: #3f6b45; background: #0d1b16; }
.wear.anc { border-color: #6b5a2f; background: #17130f; }
.wear .ws { color: var(--steel-500); min-width: 0; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.wear .wi { flex: 0 1 auto; font-size: 11px; line-height: 1.2; }
.wear.empty .wi { color: #525a6b; font-style: italic; }
.wear .ilvl { color: var(--gold-500); font-size: 11px; font-weight: 700; }
.igrid {
  --cell: 50px;
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-auto-rows: var(--cell);
  gap: 3px;
  width: max-content;
  max-width: 100%;
}
.cell {
  width: 100%; height: 100%; min-height: 0;
  background: #0a1017; border: 1px solid #262b37;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #7f889b; padding: 1px; text-align: center; overflow: hidden; line-height: 1.05;
  z-index: 1;
}
.cell:hover { border-color: var(--ember-500); }
.cell.occ { opacity: .35; }
.cell.full { background: #151d24; border-color: #37506e; color: #cfe0f5; }
.cell.full.exc { border-color: #3f6b45; background: #0d1b16; color: #cdf0d3; }
.cell.full.anc { border-color: #6b5a2f; background: #17130f; color: #f0e3bd; }
.iblock {
  z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; overflow: hidden; padding: 2px;
  background: radial-gradient(circle, rgb(180 92 48 / 16%), #101821 72%);
  border: 1px solid #37506e;
}
.iblock:hover { border-color: var(--ember-500); }
.iblock.exc { border-color: #3f6b45; background: radial-gradient(circle, rgb(80 160 90 / 18%), #0d1b16 72%); }
.iblock.anc { border-color: #6b5a2f; background: radial-gradient(circle, rgb(180 140 40 / 18%), #17130f 72%); }
.iblock .ilvl {
  position: absolute; right: 2px; bottom: 1px;
  color: var(--gold-500); font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000;
}
.iblock { position: relative; }
.mu-item-image { display: block; object-fit: contain; pointer-events: none; filter: drop-shadow(0 5px 5px #000); }
.mu-item-image.thumb, .item-cell .mu-item-image, .item-pick .mu-item-image {
  width: 32px; height: 36px; flex: 0 0 auto;
}
.wear .mu-item-image { max-width: 48px; max-height: 52px; }
.iblock .mu-item-image { max-width: 92%; max-height: 86%; }
.item-cell, .item-pick {
  display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left;
}
.sm-art {
  width: 48px; height: 54px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid #344352;
  background: radial-gradient(circle, rgb(180 92 48 / 12%), transparent 70%);
}
.sm-art .mu-item-image { max-width: 42px; max-height: 50px; }
#itemTip {
  position: fixed; z-index: 800; display: none; pointer-events: none;
  width: min(320px, calc(100vw - 16px));
  padding: 10px 12px; gap: 10px; align-items: flex-start;
  border: 1px solid #3a4a5c;
  background: linear-gradient(155deg, #151d28, #0c1118);
  box-shadow: 0 12px 28px rgb(0 0 0 / 55%);
}
#itemTip.on { display: flex; }
#itemTip .tip-art {
  width: 56px; height: 64px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid #344352;
  background: radial-gradient(circle, rgb(180 92 48 / 12%), transparent 70%);
}
#itemTip .tip-art img { max-width: 50px; max-height: 58px; }
#itemTip .tip-body { min-width: 0; flex: 1 1 auto; }
#itemTip .tip-name { display: block; font: 600 13px Cinzel, serif; color: #d5dbe1; }
#itemTip .tip-name.exc { color: #8fd39a; }
#itemTip .tip-name.anc { color: #e3cf94; }
#itemTip .tip-desc { margin: 4px 0 0; color: #778696; font-size: 11px; line-height: 1.35; }
#itemTip .tip-opts {
  display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none;
}
#itemTip .tip-opts li {
  padding: 3px 6px; border: 1px solid #334253; color: #9aabbb; font-size: 10px;
}
#itemTip .tip-id { display: block; margin-top: 6px; color: #5f6c7b; font-size: 10px; }
.hexdump, .logbox {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--mist-300);
  background: #090f16; border: 1px solid #26313d; padding: .7rem;
  max-height: 52vh; overflow: auto; white-space: pre-wrap; line-height: 1.45;
}
.hexdump { white-space: pre; max-height: 38vh; color: var(--steel-500); }

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- tablet 640–1023 ---------------- */
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw);
    transform: translateX(-105%); transition: transform 180ms ease;
    box-shadow: var(--shadow-panel);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-scrim { display: block; }
  .menu-toggle { display: grid; }
  .topbar { padding: 10px 16px; }
  main { padding: 20px 16px 88px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-shell { grid-template-columns: 1fr; gap: 36px; }
  .login-story h1 { font-size: clamp(36px, 10vw, 52px); }
  .loginbox, .login-form { width: min(100%, 470px); justify-self: start; }
  .spot-layout { grid-template-columns: 1fr; }
  .spot-map-stage { max-width: 420px; }
}

/* ---------------- phone 360–639 ---------------- */
@media (max-width: 639px) {
  body { font-size: 15px; }
  .topbar { min-height: 64px; gap: 10px; }
  .topbar-title h1 { font-size: 18px; }
  #status .status-meta, #status .status-pill:nth-child(n+3) { display: none; }
  main { padding: 16px 13px 96px; }
  .bar { align-items: stretch; }
  .bar input, .bar select, .bar button { flex: 1 1 100%; max-width: none; width: 100%; }
  .bar .sp { margin-left: 0; }
  .grid, .grid.wide { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card .v { font-size: 24px; }
  .qa input { width: 100%; }
  .wearlist { min-width: 0; width: 100%; }
  .wear .ws { min-width: 0; }
  .igrid { --cell: 40px; width: max-content; max-width: 100%; }
  .modal .box { padding: 14px; width: 100%; max-height: 94vh; }
  .spot-layout { grid-template-columns: 1fr; }
  .loginpage { padding: 18px 13px 28px; }
  .loginbox, .login-form { padding: 28px 20px 22px; }
  .login-trust { width: 100%; }

  /* DataTable: filas tipo tarjeta */
  .scroll { max-height: none; overflow: visible; border: 0; background: transparent; }
  .scroll table { border: 0; }
  .scroll thead { display: none; }
  .scroll tbody tr {
    display: grid; gap: 4px; margin-bottom: 10px; padding: 12px 14px;
    border: 1px solid #283340; background: #0d141c; white-space: normal;
  }
  .scroll tbody tr:hover, .scroll tbody tr.sel { background: #111a23; }
  .scroll td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 4px 0; border: 0; white-space: normal; text-align: left;
  }
  .scroll td::before {
    content: attr(data-label);
    color: #5d6a79; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; flex: 0 0 42%;
  }
  .scroll td.loading, .scroll td[colspan] { display: block; justify-content: center; }
  .scroll td.loading::before, .scroll td[colspan]::before { content: none; }
  .scroll td input, .scroll td select { width: auto; min-width: 5rem; }
}

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .status-pill:nth-child(2) { display: none; }
}

@media (min-width: 1440px) {
  .topbar { padding-inline: 40px; }
  main { padding-inline: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Avisos.
 *
 * `.msg.ok/.err/.inf` ya tenian color pero faltaba lo demas: sin regla para
 * `#toast` ni base para `.msg`, el aviso se creaba como un div suelto al pie
 * del documento -- abajo de todo, fuera de la vista. La accion funcionaba y
 * no se veia ninguna confirmacion, asi que parecia que el boton no hacia
 * nada. */
#toast {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: flex-end;
  max-width: min(30rem, calc(100vw - 2.2rem));
  pointer-events: none;
}
#toast .msg {
  pointer-events: auto;
  padding: .65rem .9rem;
  border: 1px solid var(--line, #2a3542);
  border-left-width: 3px;
  background: #0e151e;
  color: #cfd7e0;
  font-size: .82rem;
  line-height: 1.45;
  box-shadow: 0 10px 24px rgb(0 0 0 / 45%);
  animation: toast-in .18s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
