/* ══════════════════════════════════════════════════════════════════════════
   DROPLINE — Panel Admin. Paleta "Field Manual" (bone-on-black + ámbar),
   tomada de frontend/style.css (--fm-*). Herramienta interna: funcional y
   densa en datos, sin el pulido del cliente de juego.
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg-0: #0B0C0A;
  --bg-panel: #141512;
  --bg-well: #080907;
  --bg-row: #101210;
  --line: rgba(201, 195, 180, 0.14);
  --line-strong: rgba(201, 195, 180, 0.28);
  --bone-100: #EDE8DA;
  --bone-200: #C9C3B4;
  --bone-400: #9B968A;
  --bone-600: #7C7A6E;
  --bone-700: #5E5C52;
  --amber: #C6943A;
  --amber-bright: #fbbf24;
  --hostile: #B05A48;
  --hostile-text: #C97F6E;
  --ok: #86efac;
  --info: #38bdf8;
  --font-head: 'Rajdhani', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--bone-200);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar / conexión ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line-strong);
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; }
.brand-mark {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--bone-100);
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--bone-600);
}
.conn { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.conn-field { display: flex; flex-direction: column; gap: 3px; }
.conn-field span {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--bone-600);
}
.conn-field input {
  background: var(--bg-well);
  border: 1px solid var(--line);
  color: var(--bone-100);
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 240px;
  border-radius: 2px;
}
.conn-field input:focus { outline: none; border-color: var(--amber); }

.pill {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 5px 10px;
  border-radius: 2px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill-ok { color: var(--ok); border-color: rgba(134,239,172,0.4); }
.pill-bad { color: var(--hostile-text); border-color: rgba(176,90,72,0.5); }
.pill-unknown { color: var(--bone-600); }

/* ── Tabs ──────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line-strong);
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--bone-400);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 1.5px;
  padding: 12px 18px;
  cursor: pointer;
  text-transform: uppercase;
}
.tab:hover { color: var(--bone-100); }
.tab.active { color: var(--amber-bright); border-bottom-color: var(--amber); }
.tab-doc { margin-left: auto; color: var(--info); }

/* ── View ──────────────────────────────────────────────────────────── */
.view { flex: 1; padding: 20px; overflow: auto; }
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.view-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--bone-100);
}
.view-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Panels / grid ─────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-well);
}
.panel-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--bone-200);
  text-transform: uppercase;
}
.panel-body { padding: 14px; }

/* Stat tiles */
.stat {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 3px;
  padding: 12px 14px;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--bone-600);
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 28px;
  color: var(--bone-100);
  line-height: 1.1;
  margin-top: 4px;
}
.stat-sub { font-family: var(--font-mono); font-size: 11px; color: var(--bone-400); }
.stat.ok { border-left-color: var(--ok); }
.stat.bad { border-left-color: var(--hostile); }
.stat.info { border-left-color: var(--info); }

/* ── Tables ────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--bone-600);
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: var(--bg-well);
}
tbody tr:hover { background: var(--bg-row); }
td.mono, th.mono { font-family: var(--font-mono); font-size: 12px; }
td.num { text-align: right; font-family: var(--font-mono); }
.row-click { cursor: pointer; }

/* ── Buttons / inputs ──────────────────────────────────────────────── */
.btn {
  background: var(--bg-well);
  border: 1px solid var(--line-strong);
  color: var(--bone-100);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 7px 14px;
  border-radius: 2px;
  cursor: pointer;
  text-transform: uppercase;
}
.btn:hover { border-color: var(--amber); color: var(--amber-bright); }
.btn-amber { border-color: var(--amber); color: var(--amber-bright); }
.btn-danger { border-color: rgba(176,90,72,0.6); color: var(--hostile-text); }
.btn-danger:hover { border-color: var(--hostile); background: rgba(176,90,72,0.12); }
.btn-sm { padding: 4px 9px; font-size: 11px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

input.inp, select.inp {
  background: var(--bg-well);
  border: 1px solid var(--line);
  color: var(--bone-100);
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 2px;
}
input.inp:focus, select.inp:focus { outline: none; border-color: var(--amber); }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid var(--line);
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-mock { color: #0B0C0A; background: var(--amber-bright); border-color: var(--amber-bright); font-weight: 700; }
.badge-live { color: var(--ok); border-color: rgba(134,239,172,0.4); }
.badge-ok { color: var(--ok); border-color: rgba(134,239,172,0.4); }
.badge-warn { color: var(--amber-bright); border-color: rgba(251,191,36,0.4); }
.badge-bad { color: var(--hostile-text); border-color: rgba(176,90,72,0.5); }
.badge-info { color: var(--info); border-color: rgba(56,189,248,0.4); }
.badge-muted { color: var(--bone-600); }

/* Mock notice banner inside a panel */
.mock-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: rgba(251,191,36,0.08);
  border: 1px dashed rgba(251,191,36,0.4);
  border-radius: 3px;
  font-size: 12px;
  color: var(--amber-bright);
}
.mock-note code { font-family: var(--font-mono); color: var(--bone-100); }

/* ── Detail / drawer ───────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.detail-grid dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; color: var(--bone-600); text-transform: uppercase; }
.detail-grid dd { font-family: var(--font-mono); font-size: 13px; color: var(--bone-100); text-align: right; }

.hint { color: var(--bone-600); font-size: 12px; }
.empty { padding: 24px; text-align: center; color: var(--bone-600); font-family: var(--font-mono); }
.err { color: var(--hostile-text); font-family: var(--font-mono); font-size: 12px; }
.mono-block {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-well);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--bone-200);
}

/* ── Footer ────────────────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--bone-600);
}

/* ── Toast ─────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 48px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
.toast-item {
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--amber);
  padding: 10px 14px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--bone-100);
  max-width: 360px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}
.toast-item.ok { border-left-color: var(--ok); }
.toast-item.bad { border-left-color: var(--hostile); }

/* progress bar for xp / weights */
.bar { height: 8px; background: var(--bg-well); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--amber); }
.bar.info > span { background: var(--info); }
.bar.ok > span { background: var(--ok); }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--bone-700); }

/* ── Armas · catálogo con icono + live-ops ─────────────────────────── */
/* Los iconos son renders 3D->2D horneados en Unity sobre fondo transparente: necesitan un
   pozo oscuro propio para leerse (el arma es gris sobre gris si se pone al aire). */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#weapons-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; }

.wicon-td { width: 84px; padding: 6px 10px; }
.wicon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-well);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.wicon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wicon-ph {
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.2;
  letter-spacing: 0.5px;
  color: var(--bone-700);
  text-align: center;
  padding: 4px;
  word-break: break-all;
}

.wname { display: flex; flex-direction: column; gap: 2px; }
.wname-main { color: var(--bone-100); font-weight: 600; }
.wname .mono { font-family: var(--font-mono); font-size: 11px; }

.wstate { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wtrace { font-size: 10px; font-family: var(--font-mono); width: 100%; }

/* Fila apagada: se atenúa entera (el arma sigue en la tabla — la decisión es reversible),
   salvo el control, que debe seguir legible para volver a encenderla. */
tbody tr.row-off { background: rgba(176, 90, 72, 0.05); }
tbody tr.row-off td:not(:last-child) { opacity: 0.55; }

.wtoggle { display: flex; align-items: center; gap: 8px; }
.inp-sm { padding: 3px 6px; font-size: 11px; min-width: 68px; }

.switch { position: relative; display: inline-flex; width: 40px; height: 20px; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--bg-well);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: background 0.12s, border-color 0.12s;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bone-600);
  transition: transform 0.12s, background 0.12s;
}
.switch input:checked + .switch-track { border-color: rgba(134, 239, 172, 0.55); background: rgba(134, 239, 172, 0.14); }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: var(--ok); }
.switch input:focus-visible + .switch-track { border-color: var(--amber); }
.switch.is-busy { opacity: 0.45; cursor: progress; }

th.th-sort { cursor: pointer; user-select: none; }
th.th-sort:hover { color: var(--bone-200); }
th.is-sorted { color: var(--amber-bright); }

/* SKINS (Usuario · detalle) — el id es CLAVE DE PERSISTENCIA: se muestra bajo el nombre
   bonito en monoespaciada porque es lo que se copia a mano en un grant por curl. */
.skin-id { font-family: var(--font-mono); font-size: 10px; color: var(--bone-600); }
