/* =====================================================================
 * GoRox panel — one stylesheet, one design system.
 * Dark, dense, keyboard friendly. No external fonts, no frameworks.
 * ===================================================================== */

:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --bg-3: #171b24;
  --line: #232936;
  --line-2: #2e3648;
  --text: #e7ebf3;
  --text-2: #a4aec1;
  --text-3: #8892a6;
  --accent: #6c8cff;
  --accent-2: #4a6bff;
  --good: #3ecf8e;
  --warn: #f0b429;
  --bad: #f2555a;
  --radius: 12px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
/* The `hidden` ATTRIBUTE is the single source of truth for visibility.
 * Without this, `.drawer{display:flex}` / `.modal{display:grid}` (class
 * selectors) beat the UA `[hidden]{display:none}` rule, so the empty
 * drawer and the modal backdrop stayed painted over the whole app. */
[hidden] { display: none !important; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ── auth ─────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2135 0%, var(--bg) 60%);
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 16px; padding: 28px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
}
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.auth-brand h1 { font-size: 20px; }
.auth-brand p { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
.mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #080b12; font-weight: 800; font-size: 20px;
  display: grid; place-items: center;
}
.auth-error { color: var(--bad); font-size: 12.5px; margin: 0; }
.auth-foot { color: var(--text-3); font-size: 11.5px; margin: 4px 0 0; text-align: center; }

/* ── form primitives ─────────────────────────────────────────────────── */
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-2); }
.fld > span { font-weight: 550; letter-spacing: .01em; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-3);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  width: 100%; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 140, 255, .16);
}
textarea { min-height: 74px; resize: vertical; }
select { cursor: pointer; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text);
  padding: 9px 14px; transition: background .12s, border-color .12s, opacity .12s;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { background: #1d2230; border-color: #3a4459; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #080b12; }
.btn.primary:hover { background: #7d99ff; }
.btn.danger { color: #ffb4b6; border-color: #4a2a2e; background: #241519; }
.btn.danger:hover { background: #2f1a1f; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); padding: 7px 10px; }
.btn.ghost:hover { background: var(--bg-3); color: var(--text); }
.btn.ghost.danger { color: #e08b8f; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── shell ───────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }

.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 8px; font-size: 16px; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 0; color: var(--text-2); font: inherit;
  padding: 9px 11px; border-radius: 9px; cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.nav button:hover { background: var(--bg-3); color: var(--text); }
.nav button.active { background: rgba(108, 140, 255, .14); color: #cfd9ff; }
.nav button .ico { width: 18px; text-align: center; opacity: .9; }
.nav .count {
  margin-left: auto; font-size: 11px; color: var(--text-3);
  background: var(--bg-3); border-radius: 20px; padding: 1px 7px;
}
.sidebar-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.who { color: var(--text-3); font-size: 11.5px; padding: 8px 10px 0; word-break: break-all; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 16px 24px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: rgba(11, 13, 18, .82); backdrop-filter: blur(8px); z-index: 5;
}
.topbar h1 { font-size: 17px; }
.actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.view { padding: 22px 24px 64px; max-width: 1400px; width: 100%; }

/* ── cards / stats ───────────────────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.card h3 { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .sub { color: var(--text-3); font-size: 12px; }

.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-head h2 { font-size: 14px; color: var(--text-2); font-weight: 600; }
.section-head .spacer { flex: 1; }

/* ── table ───────────────────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-3);
  background: var(--bg-3); padding: 9px 14px; white-space: nowrap;
}
tbody td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(255, 255, 255, .022); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-3); }
.trunc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 42px 16px; text-align: center; color: var(--text-3); }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; }

/* ── badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px;
  font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: var(--bg-3); color: var(--text-2); border: 1px solid var(--line-2);
  white-space: nowrap;
}
.badge.good { color: #8ce8bf; border-color: #1e4436; background: #10241c; }
.badge.warn { color: #f7d288; border-color: #4a3a17; background: #241d0e; }
.badge.bad { color: #ffb0b3; border-color: #4a2427; background: #241416; }
.badge.info { color: #b9c8ff; border-color: #2b3560; background: #151b33; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px rgba(62, 207, 142, .16); }

/* ── toolbar ─────────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar select, .toolbar input { width: auto; min-width: 120px; }

/* ── drawer / modal ──────────────────────────────────────────────────── */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(460px, 100%);
  background: var(--bg-2); border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(18px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head, .modal-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2, .modal-head h2 { font-size: 15px; }
.drawer-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; }

.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(4, 6, 10, .62); padding: 20px;
}
.modal-card {
  width: 100%; max-width: 520px; max-height: 88vh; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 13px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.check input { width: auto; }

/* ── audio + meta ────────────────────────────────────────────────────── */
audio { width: 100%; border-radius: 10px; background: var(--bg-3); }
.kv { display: grid; grid-template-columns: 108px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; }

/* ── toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--text);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow);
  z-index: 90; font-size: 13px; max-width: min(520px, 92vw);
}
.toast.bad { border-color: #4a2427; color: #ffb0b3; }
.toast.good { border-color: #1e4436; color: #8ce8bf; }

/* ── player row ──────────────────────────────────────────────────────── */
.play-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--bg-3); color: var(--text); cursor: pointer; display: grid;
  place-items: center; font-size: 11px; padding: 0;
}
.play-btn:hover { border-color: var(--accent); color: var(--accent); }
.play-btn.on { background: var(--accent); color: #080b12; border-color: var(--accent); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.pager .muted { font-size: 12px; }

/* ── responsive ──────────────────────────────────────────────────────── */
.only-mobile { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 60;
    transform: translateX(-100%); transition: transform .18s ease;
  }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .view { padding: 16px 14px 56px; }
  .topbar { padding: 12px 14px; }
  .kv { grid-template-columns: 92px 1fr; }
  .row-2 { grid-template-columns: 1fr; }
}
