:root {
  --bg: #0b0d12;
  --surface: #12151d;
  --surface-2: #171b25;
  --border: #232838;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #9b59b6;
  --accent-soft: rgba(155, 89, 182, 0.14);
  --green: #3fb950;
  --red: #e5534b;
  --amber: #d29922;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

/* ---------- Layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #b07cd6, var(--accent));
  display: grid; place-items: center;
  font-size: 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #d9b8ec; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

.main { flex: 1; min-width: 0; padding: 28px 32px 60px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- Cards / stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 6px; letter-spacing: -0.02em; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 500; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
}

.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-body { padding: 18px; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  color: var(--muted);
  font-weight: 550;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Bits ---------- */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  border: 1px solid transparent;
}

.badge.available { background: rgba(63,185,80,0.13); color: var(--green); border-color: rgba(63,185,80,0.3); }
.badge.reserved  { background: rgba(210,153,34,0.13); color: var(--amber); border-color: rgba(210,153,34,0.3); }
.badge.sold      { background: rgba(139,147,167,0.13); color: var(--muted); border-color: var(--border); }
.badge.cat       { background: var(--accent-soft); color: #cba6e3; border-color: rgba(155,89,182,0.3); }
.badge.off       { background: rgba(229,83,75,0.13); color: var(--red); border-color: rgba(229,83,75,0.3); }

.price { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

button, .btn {
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

button:hover { background: #1e2331; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: #8b4aa6; }

.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  background: #5865f2;
  border-color: #5865f2;
  color: #fff;
  text-decoration: none;
  padding: 11px 14px;
}
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12.5px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: rgba(229,83,75,0.12); border-color: rgba(229,83,75,0.35); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

input, select, textarea {
  font: inherit;
  font-size: 14px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #0e111a;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }

.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.error {
  background: rgba(229,83,75,0.12);
  border: 1px solid rgba(229,83,75,0.35);
  color: #ff9b95;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.hidden { display: none !important; }

.transcript {
  margin: 0;
  padding: 14px;
  background: #0e111a;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow-y: auto;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); align-items: center; }
  .brand { padding: 6px 10px; }
  .sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; margin-left: auto; }
  .main { padding: 20px 16px 50px; }
}
