@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Michroma&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #050505;
  --panel: rgba(5, 5, 5, 0.95);
  --panel-strong: rgba(5, 5, 5, 0.98);
  --line: rgba(255, 7, 58, 0.45);
  --line-strong: rgba(255, 7, 58, 0.65);
  --text: #FFFFFF;
  --muted: #b0b0b0;
  --accent: #FF073A;
  --accent-2: #ff3366;
  --accent-3: #ff6699;
  --danger: #ff4455;
  --gold: #FFD700;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(255,7,58,0.25), transparent 28%),
    radial-gradient(circle at 90% 15%, rgba(255,7,58,0.18), transparent 25%),
    radial-gradient(circle at 50% 100%, rgba(255,7,58,0.15), transparent 30%),
    linear-gradient(180deg, #050505 0%, #1a0000 48%, #0a0000 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 100%);
  opacity: 0.3;
}

a { color: inherit; text-decoration: none; }
h1,h2,h3,h4,h5,h6 { margin: 0; font-family: 'Orbitron', sans-serif; letter-spacing: -0.03em; font-weight: 700; }
p { margin: 0; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.top-header {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
}

.content {
  grid-column: 2;
  grid-row: 2;
}

.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  padding: 20px 16px;
  background: linear-gradient(180deg, rgba(20,0,0,0.95), rgba(5,5,5,0.98));
  backdrop-filter: blur(18px);
  border-right: 1px solid rgba(255,7,58,0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,7,58,0.6); border-radius: 2px; }

.content {
  padding: 30px;
  display: grid;
  gap: 22px;
  align-content: start;
}

/* ─── Brand ──────────────────────────────────────────────────────────────── */

.brand-block {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: start;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255,7,58,0.7), rgba(255,7,58,0.5)), rgba(5,5,5,0.95);
  border: 1px solid rgba(255,7,58,0.7);
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  color: #FFFFFF;
  font-size: 1.4rem;
  box-shadow: inset 0 0 25px rgba(255,7,58,0.25), 0 0 20px rgba(255,7,58,0.3);
}

.brand-block h2 { font-size: 1.3rem; margin-bottom: 4px; }
.brand-copy { margin-top: 8px; color: var(--muted); line-height: 1.5; font-size: 0.92rem; }

/* ─── Typography ─────────────────────────────────────────────────────────── */

.overline {
  color: #FF073A;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  margin-bottom: 8px;
  display: block;
  font-family: 'Michroma', sans-serif;
  font-weight: 400;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  border: 1px solid;
}

.badge-ok   { background: rgba(255,7,58,0.2); color: #FFFFFF; border-color: rgba(255,7,58,0.45); }
.badge-err  { background: rgba(255,7,58,0.25); color: #ffaaaa; border-color: rgba(255,7,58,0.5); }
.badge-warn { background: rgba(255,7,58,0.22); color: #ffcccc; border-color: rgba(255,7,58,0.45); }
.badge-info { background: rgba(255,7,58,0.2); color: #ffdddd; border-color: rgba(255,7,58,0.45); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  background: rgba(255,7,58,0.25);
  color: #ffcccc;
  border: 1px solid rgba(255,7,58,0.5);
}

/* ─── Sidebar Card ───────────────────────────────────────────────────────── */

.sidebar-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,7,58,0.45);
  background: linear-gradient(180deg, rgba(40,0,0,0.95), rgba(20,0,0,0.98));
  padding: 18px;
  box-shadow: inset 0 0 32px rgba(255,7,58,0.15);
}

.sidebar-card strong { display: block; margin: 4px 0 6px; font-size: 1.3rem; word-break: break-word; overflow-wrap: break-word; white-space: normal; }
.sidebar-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }

/* ─── Navigation ─────────────────────────────────────────────────────────── */

.nav-links { display: grid; gap: 10px; }

.nav-links a {
  display: block;
  padding: 14px 16px;
  border-radius: 16px;
  color: #e0e0e0;
  background: rgba(255,7,58,0.08);
  border: 1px solid rgba(255,7,58,0.2);
  transition: transform 0.24s ease, background 0.24s ease, border-color 0.24s ease;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,7,58,0.3);
  border-color: rgba(255,7,58,0.65);
  transform: translateX(4px);
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(255,7,58,0.25), transparent 34%),
    radial-gradient(circle at bottom left, rgba(255,7,58,0.18), transparent 30%),
    linear-gradient(180deg, rgba(20,0,0,0.98), rgba(10,0,0,0.98));
  border: 1px solid rgba(255,7,58,0.45);
  box-shadow: var(--shadow);
  animation: riseIn 0.6s ease;
}

.hero-copy { display: grid; gap: 16px; }

.hero-title {
  font-size: clamp(2.2rem, 1.8rem + 1.4vw, 3.6rem);
  line-height: 0.98;
  font-family: 'Orbitron', sans-serif;
}

.hero-subtitle { color: var(--muted); line-height: 1.7; max-width: 60ch; }
.hero-rail { display: grid; gap: 14px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */

button, .button-link {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 16px;
  padding: 14px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover, .button-link:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

button, .button-link.primary {
  color: #FFFFFF;
  background: linear-gradient(135deg, #FF073A, #dd0000);
  box-shadow: 0 18px 34px rgba(255,7,58,0.5);
}

button.secondary, .button-link.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

button.small { padding: 9px 14px; font-size: 0.88rem; border-radius: 12px; }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Cards & Panels ─────────────────────────────────────────────────────── */

.feature, .panel, .card, .auth-card, .table-shell {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,7,58,0.35);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.feature { padding: 18px; display: grid; gap: 8px; min-height: 126px; }
.feature strong { font-family: 'Orbitron', sans-serif; font-size: 1.1rem; }
.feature p { color: var(--muted); line-height: 1.55; }

.panel { padding: 24px; display: grid; gap: 18px; animation: riseIn 0.7s ease; }

.panel-header { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.panel-header p { color: var(--muted); }
.panel-header h3 { margin-bottom: 4px; }

.card {
  padding: 20px;
  min-height: 148px;
  display: grid;
  align-content: start;
  gap: 8px;
  background: linear-gradient(180deg, rgba(40,0,0,0.9), rgba(20,0,0,0.95));
}

.card strong { font-size: 2rem; line-height: 1; }
.card p, .card span { color: var(--muted); line-height: 1.55; font-size: 0.9rem; }

/* ─── Grids ──────────────────────────────────────────────────────────────── */

.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.inline-stats { display: flex; flex-wrap: wrap; gap: 10px; }

.mini-stat {
  min-width: 120px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,7,58,0.1);
  border: 1px solid rgba(255,7,58,0.35);
}

.mini-stat strong { display: block; font-size: 1.1rem; }
.mini-stat span { color: var(--muted); font-size: 0.86rem; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.table-shell { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }

th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid rgba(130,167,204,0.14); }

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  background: rgba(255,255,255,0.02);
  font-weight: 600;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,7,58,0.12); }

/* ─── Forms ──────────────────────────────────────────────────────────────── */

form { display: grid; gap: 12px; }

form label { display: grid; gap: 8px; color: var(--muted); font-size: 0.88rem; font-weight: 500; }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  border-radius: 16px;
  border: 1px solid rgba(255,7,58,0.45);
  background: rgba(5,5,5,0.9);
  padding: 14px 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(255,7,58,0.8);
  box-shadow: 0 0 0 4px rgba(255,7,58,0.2);
  background: rgba(5,5,5,0.95);
}

textarea { min-height: 130px; resize: vertical; }
input[type='checkbox'], input[type='radio'] { width: auto; }

/* ─── Status Messages ────────────────────────────────────────────────────── */

.status {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status.error   { background: rgba(255,7,58,0.25); border: 1px solid rgba(255,7,58,0.45); color: #ffcccc; }
.status.success { background: rgba(255,7,58,0.15); border: 1px solid rgba(255,7,58,0.35); color: #FFFFFF; }
.status.info    { background: rgba(255,7,58,0.2); border: 1px solid rgba(255,7,58,0.4); color: #ffdddd; }
.status.warn    { background: rgba(255,7,58,0.22); border: 1px solid rgba(255,7,58,0.45); color: #ffcccc; }

/* ─── Flash Toast ────────────────────────────────────────────────────────── */

.flash-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 280px;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 16px;
  font-weight: 500;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: slideInRight 0.4s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Auth Pages ─────────────────────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: min(560px, 100%);
  padding: 32px;
  background:
    radial-gradient(circle at top left, rgba(255,7,58,0.12), transparent 24%),
    linear-gradient(180deg, rgba(10,0,0,0.97), rgba(5,5,5,0.99));
}

.auth-card .hero-title { font-size: clamp(2rem, 1.8rem + 0.8vw, 2.8rem); }
.auth-card .hero-subtitle { margin-top: 8px; margin-bottom: 20px; }

.hint { color: var(--muted); line-height: 1.6; font-size: 0.9rem; }
.hint a { color: #FF073A; font-weight: 600; }

/* ─── Empty State ────────────────────────────────────────────────────────── */

.empty-state {
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(130,167,204,0.22);
  color: var(--muted);
  background: rgba(255,255,255,0.02);
  text-align: center;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */

.footer {
  color: var(--muted);
  padding-top: 16px;
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

/* ─── Progress Bar ───────────────────────────────────────────────────────── */

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(130,167,204,0.14);
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF073A, #ff3366);
  border-radius: 3px;
  transition: width 1s linear;
}

/* ─── Copy Button ────────────────────────────────────────────────────────── */

.copy-btn {
  padding: 10px 14px;
  background: rgba(255,7,58,0.2);
  border: 1px solid rgba(255,7,58,0.45);
  color: #FF073A;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.copy-btn:hover { background: rgba(255,7,58,0.3); transform: none; }
.copy-btn.copied { background: rgba(255,7,58,0.15); border-color: rgba(255,7,58,0.35); color: #FFFFFF; }

/* ─── Gold Accent (for coins) ────────────────────────────────────────────── */

.gold-text { color: var(--gold); }
.gold-bg { background: rgba(255,215,0,0.1); }
.gold-border { border-color: rgba(255,215,0,0.3); }

/* ─── Utility ────────────────────────────────────────────────────────────── */

.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ─── Mobile Menu Toggle ─────────────────────────────────────────────────── */

.menu-toggle {
  display: none;
  position: fixed;
  top: 72px;
  left: 12px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(20,0,0,0.95);
  border: 1px solid rgba(255,7,58,0.55);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
  box-shadow: 0 0 15px rgba(255,7,58,0.2);
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.3s ease;
  display: block;
}

.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ─── Animations ─────────────────────────────────────────────────────────── */

@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .hero, .grid-two, .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 64px 1fr; }

  .top-header { grid-column: 1; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    width: 260px;
    height: calc(100vh - 64px);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    border-right: 1px solid var(--line);
    border-bottom: none;
    overflow-y: auto;
  }

  .sidebar.active { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .content { grid-column: 1; grid-row: 2; padding: 18px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background:
      radial-gradient(circle at 20% 0%, rgba(255,7,58,0.18), transparent 34%),
      linear-gradient(180deg, #050505 0%, #140000 100%);
  }

  .shell {
    grid-template-rows: 56px 1fr;
    width: 100%;
    max-width: 100%;
  }

  .top-header {
    height: 56px !important;
    padding: 0 8px !important;
  }

  .top-header .th-logo img {
    height: 34px !important;
    max-width: 120px;
  }

  .top-header .th-right {
    gap: 6px !important;
    min-width: 0;
  }

  .top-header .th-user {
    padding: 5px 7px !important;
    gap: 5px !important;
    min-width: 0;
  }

  .top-header .th-user .th-username {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-header .th-user .th-coins {
    padding: 2px 6px !important;
    white-space: nowrap;
  }

  .top-header .th-logout {
    padding: 6px 8px !important;
    border-radius: 8px !important;
  }

  .sidebar {
    top: 56px;
    width: min(82vw, 280px);
    height: calc(100vh - 56px);
  }

  .menu-toggle {
    top: 64px;
    left: 10px;
    width: 38px;
    height: 38px;
  }

  .content {
    width: 100%;
    max-width: 100vw;
    padding: 14px 10px;
    gap: 14px;
  }

  .stats-grid { grid-template-columns: 1fr; }
  .grid-two { grid-template-columns: 1fr; }
  .hero {
    grid-template-columns: 1fr;
    padding: 16px;
    border-radius: 18px;
    gap: 14px;
  }
  .hero-title {
    font-size: 1.55rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }
  .hero-subtitle {
    font-size: 0.92rem;
    line-height: 1.55;
  }
  .panel, .card, .auth-card, .feature, .table-shell {
    padding: 14px;
    border-radius: 16px;
    width: 100%;
    max-width: 100%;
  }
  .panel-header {
    display: grid;
    align-items: start;
  }
  .inline-stats, .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .mini-stat {
    width: 100%;
    min-width: 0;
  }
  .table-shell {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table {
    font-size: 0.82rem;
    min-width: 620px;
  }
  th, td { padding: 9px 10px; }
  input, select, textarea {
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
  }
  button, .button-link {
    width: 100%;
    min-height: 44px;
    padding: 12px 14px;
    border-radius: 12px;
  }
  .actions { flex-direction: column; }
  .actions a, .actions button { width: 100%; }
  .flash-toast { right: 10px; left: 10px; min-width: unset; }
}

@media (max-width: 420px) {
  .top-header .th-user .th-username { display: none; }
  .hero-title { font-size: 1.35rem; }
  .panel, .card, .auth-card, .feature, .table-shell { padding: 12px; }
}
