/* OrbexMC Staff — tema espacial (fondo oscuro, morado #7b2eff, acentos cian) · mobile-first */
:root {
  --bg: #07070f; --bg2: #0d0d1a; --surface: #12121f; --surface2: #181829; --line: #25253d;
  --text: #e8e8f4; --muted: #8d8da8; --primary: #7b2eff; --primary2: #9d5cff; --cyan: #22d3ee;
  --ok: #2ecc71; --warn: #f1c40f; --err: #ff4d6d; --radius: 12px;
  --font: 'Exo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Orbitron', 'Exo 2', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(123, 46, 255, .18), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, .08), transparent 60%), var(--bg);
  background-attachment: fixed; color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5;
}
a { color: var(--cyan); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: .5px; }
h1 { font-size: 1.35rem; } h3 { font-size: 1rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: 260px; background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .2s; z-index: 40; overflow-y: auto;
}
.side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55); }
.logo { font-family: var(--display); font-weight: 800; font-size: 2rem; letter-spacing: 3px; text-align: center; }
.logo span { color: var(--primary2); text-shadow: 0 0 18px rgba(123, 46, 255, .7); }
.logo.sm { font-size: 1.25rem; padding: 18px 16px 8px; text-align: left; }
.nav { flex: 1; padding: 6px 10px; }
.nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 14px 8px 6px; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; color: var(--text); }
.nav a:hover { background: var(--surface); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(123, 46, 255, .35), rgba(123, 46, 255, .08)); box-shadow: inset 3px 0 0 var(--primary); }
.side-foot { display: flex; gap: 10px; align-items: center; padding: 12px; border-top: 1px solid var(--line); }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.who strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.main { flex: 1; min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(7, 7, 15, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top h2 { font-size: 1rem; }
.burger { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 9px; font-size: 1.2rem; padding: 6px 11px; cursor: pointer; }
#content { padding: 16px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 900px) {
  .side { transform: none; position: sticky; top: 0; height: 100vh; }
  .burger { display: none; }
  #content { padding: 24px 28px; }
}

/* ---------- piezas ---------- */
.page { display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; }
.page-actions, .toolbar, .row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar { justify-content: space-between; margin-bottom: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .n { font-family: var(--display); font-size: 1.7rem; color: var(--primary2); }
.stat .l { color: var(--muted); font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; border: 1px dashed var(--line); border-radius: var(--radius); }
.loading { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 30px; color: var(--muted); }
.spin { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--primary2); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.error-box, .info-box, .form-error { padding: 11px 14px; border-radius: 10px; margin: 8px 0; }
.error-box, .form-error { background: rgba(255, 77, 109, .12); border: 1px solid rgba(255, 77, 109, .4); color: #ff9db0; }
.info-box { background: rgba(34, 211, 238, .1); border: 1px solid rgba(34, 211, 238, .35); color: #9eeaf7; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; background: var(--surface2); border: 1px solid var(--line); color: var(--text); }
.badge.ok { background: rgba(46, 204, 113, .15); border-color: rgba(46, 204, 113, .5); color: #7be0a4; }
.badge.warn { background: rgba(241, 196, 15, .13); border-color: rgba(241, 196, 15, .5); color: #f3d86b; }
.badge.err { background: rgba(255, 77, 109, .13); border-color: rgba(255, 77, 109, .5); color: #ff93a8; }
.badge.info { background: rgba(34, 211, 238, .12); border-color: rgba(34, 211, 238, .45); color: #86e7f8; }
.rank-badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--surface2); flex: none; }
.avatar.ph { display: grid; place-items: center; color: var(--primary2); font-weight: 700; border: 1px solid var(--line); }
.idbox { display: block; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 14px; user-select: all; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.cols { display: grid; gap: 16px; grid-template-columns: 1fr; } @media (min-width: 900px) { .cols.two { grid-template-columns: 1fr 1fr; } }
.preview { background: #2b2d31; border-radius: 8px; padding: 12px; border-left: 4px solid var(--primary); color: #dbdee1; white-space: pre-wrap; word-break: break-word; }
.preview h4 { margin: 0 0 6px; color: #fff; } .preview img { max-width: 100%; border-radius: 6px; margin-top: 8px; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface2); color: var(--text); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { border-color: var(--primary2); text-decoration: none; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); border-color: transparent; color: #fff; }
.btn.danger { background: rgba(255, 77, 109, .14); border-color: rgba(255, 77, 109, .5); color: #ff93a8; }
.btn.ok { background: rgba(46, 204, 113, .15); border-color: rgba(46, 204, 113, .5); color: #7be0a4; }
.btn.small { padding: 4px 9px; font-size: .85rem; border-radius: 8px; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; width: 100%; padding: 12px; margin: 16px 0 10px; font-weight: 600; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; padding: 8px 14px; cursor: pointer; border-radius: 9px 9px 0 0; white-space: nowrap; }
.tab:hover { color: var(--text); } .tab.active { color: #fff; background: var(--surface2); box-shadow: inset 0 -2px 0 var(--primary2); }

/* ---------- tablas (en móvil se vuelven tarjetas) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; } .tbl tr.clickable { cursor: pointer; } .tbl tr.clickable:hover td { background: var(--surface2); }
td.actions { text-align: right; white-space: nowrap; }
@media (max-width: 700px) {
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .tbl td { border: 0; padding: 3px 12px; display: flex; gap: 10px; justify-content: space-between; align-items: center; text-align: right; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; text-align: left; flex: none; }
  .tbl td.actions { justify-content: flex-end; } .tbl td.actions::before { content: none; }
  .kv { grid-template-columns: 1fr; }
}

/* ---------- formularios ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; } .field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field label { font-size: .85rem; color: var(--muted); } .field .req { color: var(--err); }
input[type=text], input[type=number], input[type=url], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary2); box-shadow: 0 0 0 3px rgba(123, 46, 255, .25); }
textarea { resize: vertical; }
.switch { appearance: none; width: 42px; height: 24px; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; flex: none; transition: .15s; border: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; }
.switch:checked { background: var(--primary); } .switch:checked::after { transform: translateX(18px); }
.colorrow { display: flex; gap: 8px; } .colorpick { width: 46px; height: 38px; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.chip { display: flex; gap: 6px; align-items: center; background: var(--surface2); padding: 4px 9px; border-radius: 999px; font-size: .85rem; color: var(--text) !important; cursor: pointer; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; } .filters > * { flex: 1 1 160px; }

/* ---------- modal / toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: grid; place-items: center; padding: 12px; z-index: 100; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1rem; } .x { background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.modal-body { padding: 18px; overflow-y: auto; } .modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: calc(100vw - 28px); }
.toast { background: var(--surface2); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 10px; animation: in .2s; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.toast.err { border-left-color: var(--err); } .toast.out { opacity: 0; transition: .4s; }
@keyframes in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- login / postulaciones ---------- */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; text-align: center; box-shadow: 0 0 60px rgba(123, 46, 255, .15); }
.apply { max-width: 760px; margin: 0 auto; padding: 18px; }
.apply-top { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 18px; }

/* ---------- mensajes ---------- */
.chat { display: grid; grid-template-columns: 1fr; gap: 12px; height: calc(100vh - 150px); min-height: 420px; }
@media (min-width: 800px) { .chat { grid-template-columns: 260px 1fr; } }
.chat-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; padding: 8px; }
.chat-list .item { display: flex; gap: 9px; align-items: center; padding: 8px; border-radius: 9px; cursor: pointer; }
.chat-list .item:hover { background: var(--surface2); } .chat-list .item.active { background: rgba(123, 46, 255, .25); }
.chat-list h4 { margin: 10px 8px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.chat-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 10px; } .msg .bubble { min-width: 0; } .msg .meta { font-size: .78rem; color: var(--muted); }
.msg .text { white-space: pre-wrap; word-break: break-word; } .msg.mine .text { color: #d9c6ff; }
.msg .del { opacity: 0; background: none; border: 0; cursor: pointer; color: var(--muted); } .msg:hover .del { opacity: 1; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); } .composer textarea { resize: none; height: 44px; }
.back { display: inline-flex; } @media (min-width: 800px) { .back { display: none; } }
@media (max-width: 799px) { .chat.show-chat .chat-list { display: none; } .chat:not(.show-chat) .chat-box { display: none; } }

/* ---------- varios ---------- */
.q-item { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.q-item > .grow { flex: 1; min-width: 0; }
.setting { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); } .setting:last-child { border-bottom: 0; }
.setting .key { font-size: .75rem; color: var(--muted); }
.save-bar { position: sticky; bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--primary); border-radius: 12px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.answer { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; white-space: pre-wrap; word-break: break-word; }
.answer b { display: block; color: var(--primary2); font-size: .85rem; margin-bottom: 3px; }
