@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #060a07;
  --surface: #0c1310;
  --surface2: #111a14;
  --border: rgba(255,255,255,.07);
  --border-g: rgba(255,30,39,.22);
  --text: #f8f7f8;
  --muted: #9b969f;
  --subtle: #69636d;
  --green: #ff1e27;
  --green-dim: rgba(255,30,39,.1);
  --danger: #f87171;
  --radius: 12px;
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

/* ── Gate ────────────────────────────────────────────────── */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 700px 400px at 50% 20%, rgba(255,30,39,.06), transparent 70%),
    var(--bg);
}
.gate-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-g);
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 32px 100px rgba(0,0,0,.5);
  text-align: center;
}
.gate-mark {
  width: 52px; height: 52px;
  margin: 0 auto 18px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff3b43, #b80d15);
  color: #240306;
  font-size: 20px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: .12em;
  font-weight: 800;
  color: var(--green);
  text-transform: uppercase;
}
.gate-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -.04em; margin: 8px 0 6px; }
.gate-card p  { color: var(--muted); font-size: 12px; line-height: 1.65; margin-bottom: 22px; }

.pw-field {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(4,8,5,.8);
  transition: border-color .15s, box-shadow .15s;
}
.pw-field:focus-within {
  border-color: var(--border-g);
  box-shadow: 0 0 0 3px rgba(255,30,39,.08);
}
.pw-field i { color: var(--subtle); font-size: 13px; flex-shrink: 0; }
.pw-field input { width: 100%; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.pw-field input::placeholder { color: var(--subtle); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn, .btn-primary, .btn-ghost, .btn-danger, .btn-warn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #ff3b43, #d4141d);
  color: #240306;
  border: 0;
  box-shadow: 0 8px 24px rgba(255,30,39,.15);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { color: var(--muted); background: transparent; }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.04); }
.btn-danger { color: var(--danger); background: rgba(248,113,113,.06); border-color: rgba(248,113,113,.15); }
.btn-danger:hover { background: rgba(248,113,113,.12); }
.btn-warn { color: #fbbf24; background: rgba(251,191,36,.06); border-color: rgba(251,191,36,.15); }
.btn-warn:hover { background: rgba(251,191,36,.12); }
.btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 7px; }
.btn:disabled, .btn-primary:disabled { opacity: .5; cursor: wait; }

.gate .btn-primary { width: 100%; justify-content: center; margin-top: 14px; padding: 12px 16px; font-size: 13px; }

/* ── Error box ───────────────────────────────────────────── */
.err-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #ffb9b9;
  background: rgba(248,113,113,.07);
  border: 1px solid rgba(248,113,113,.14);
  font-size: 11px;
  text-align: left;
}

/* ── App shell ───────────────────────────────────────────── */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  background: rgba(6,10,7,.95);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.side-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff3b43, #b80d15);
  display: grid;
  place-items: center;
  color: #240306;
  font-size: 12px;
  flex-shrink: 0;
}
.side-brand strong { display: block; font-size: 13px; font-weight: 700; }
.side-brand small  { display: block; font-size: 9px; color: var(--muted); margin-top: 1px; }

.side nav { display: grid; gap: 2px; }
.side-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--subtle);
  text-transform: uppercase;
  padding: 14px 9px 5px;
}
.side nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 9px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .12s;
}
.side nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.side nav a.active {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(255,30,39,.16);
}
.side nav a i { font-size: 11px; width: 14px; text-align: center; flex-shrink: 0; }

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}
.online-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--green-dim);
  border: 1px solid rgba(255,30,39,.12);
  font-size: 10px;
  color: #8af5b5;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Main content ────────────────────────────────────────── */
.main { padding: 32px 36px 70px; min-width: 0; }
.main-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}
.main-head h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.04em;
  margin-top: 6px;
}
.main-head small { font-size: 10px; letter-spacing: .1em; color: var(--muted); font-weight: 700; text-transform: uppercase; }

/* ── Stats bar ───────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-card > span  { display: block; font-size: 10px; color: var(--muted); font-weight: 600; }
.stat-card > strong { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.06em; margin: 6px 0 3px; }
.stat-card > small  { display: block; font-size: 10px; color: var(--subtle); }

/* ── Section ─────────────────────────────────────────────── */
.section { margin-top: 32px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-top: 5px; }
.section-head p  { font-size: 11px; color: var(--muted); margin-top: 3px; }
.section-head .actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }

/* ── Hero card (overview) ────────────────────────────────── */
.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border-g);
  border-radius: 18px;
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 500px 250px at 80% 50%, rgba(255,30,39,.05), transparent);
  pointer-events: none;
}
.hero-card h2 { font-size: 20px; font-weight: 800; letter-spacing: -.03em; margin: 10px 0 5px; }
.hero-card p  { font-size: 12px; color: var(--muted); line-height: 1.65; }
.hero-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero-badge {
  width: 110px; height: 110px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  align-content: center;
  background: radial-gradient(circle at 30% 25%, #56ffa4, #0c9f52 70%, #064d28);
  color: #04240f;
  flex-shrink: 0;
  transform: rotate(6deg);
  box-shadow: 0 20px 60px rgba(255,30,39,.15);
  text-align: center;
}
.hero-badge strong { font-size: 48px; font-weight: 800; letter-spacing: -.08em; line-height: 1; }
.hero-badge span   { font-size: 12px; font-weight: 800; }
.hero-badge small  { font-size: 9px; }

/* ── Panel ───────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel-body { padding: 18px; }
.product-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
}
.mini-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--green-dim);
  color: var(--green);
  font-size: 13px;
}
.product-row strong { font-size: 13px; font-weight: 700; display: block; }
.product-row p { margin-top: 3px; font-size: 11px; color: var(--muted); }
.product-row code { font-size: 10px; color: #ff9da1; background: rgba(255,30,39,.06); padding: 4px 8px; border-radius: 6px; }

/* ── Gen actions ─────────────────────────────────────────── */
.gen-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.op-msg {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}
.op-msg.success { background: rgba(255,30,39,.07); border-color: rgba(255,30,39,.15); color: #ffc0c3; }
.op-msg.error   { background: rgba(248,113,113,.07); border-color: rgba(248,113,113,.15); color: #ffbaba; }

/* ── Table ───────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.search-wrap { position: relative; flex: 1; }
.search-wrap i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--subtle); font-size: 11px; }
.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  outline: 0;
  transition: border-color .15s;
}
.search-wrap input:focus { border-color: var(--border-g); }
.search-wrap input::placeholder { color: var(--subtle); }
.toolbar select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
  outline: 0;
  min-width: 130px;
}

.table-wrap { overflow-x: auto; }
.key-head {
  display: grid;
  grid-template-columns: minmax(190px,1.4fr) 70px 130px minmax(140px,1fr) 80px 130px;
  gap: 8px;
  padding: 9px 14px;
  font-size: 9px;
  font-weight: 800;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
  min-width: 820px;
}
.key-row {
  display: grid;
  grid-template-columns: minmax(190px,1.4fr) 70px 130px minmax(140px,1fr) 80px 130px;
  gap: 8px;
  padding: 11px 14px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  min-width: 820px;
  transition: background .1s;
}
.key-row:hover { background: rgba(255,255,255,.02); }
.key-row:last-child { border-bottom: 0; }
.key-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #a9f9c7;
  letter-spacing: .02em;
}
.server-col { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 10px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
}
.tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.tag.active   { color: #ffadb2; background: rgba(255,30,39,.08); }
.tag.active::before { background: var(--green); }
.tag.redeemed { color: #a8b8ff; background: rgba(120,140,255,.08); }
.tag.redeemed::before { background: #a8b8ff; }
.tag.revoked  { color: #ffb0b0; background: rgba(248,113,113,.08); }
.tag.revoked::before  { background: #f87171; }

.row-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.icon-btn {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 10px;
  cursor: pointer;
  transition: all .12s;
}
.icon-btn:hover { color: var(--text); border-color: rgba(255,255,255,.14); }
.icon-btn.danger:hover { color: var(--danger); border-color: rgba(248,113,113,.25); }
.icon-btn.warn:hover   { color: #fbbf24; border-color: rgba(251,191,36,.25); }
.icon-btn.green:hover  { color: var(--green); border-color: rgba(255,30,39,.25); }

.empty-state { padding: 32px; text-align: center; color: var(--muted); font-size: 12px; }

/* ── Tool cards ──────────────────────────────────────────── */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tool-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, transform .12s;
}
.tool-card:hover { border-color: rgba(255,30,39,.2); transform: translateY(-1px); }
.tool-card > i { color: var(--green); font-size: 15px; flex-shrink: 0; }
.tool-card strong { display: block; font-size: 12px; font-weight: 700; }
.tool-card small  { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid rgba(255,30,39,.2);
  color: #a8f5c5;
  font-size: 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: all .2s;
  pointer-events: none;
  z-index: 999;
  max-width: 280px;
}
.toast.show { opacity: 1; transform: none; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.6);
  display: grid; place-items: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none !important; }
.modal {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-g);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}
.modal h3 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.modal p  { font-size: 12px; color: var(--muted); line-height: 1.65; margin-bottom: 18px; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-size: 11px; font-weight: 700; color: #c3bec5; margin-bottom: 6px; }
.modal .field input, .modal .field select {
  width: 100%; height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface2);
  color: var(--text); font-size: 13px; outline: 0;
  transition: border-color .15s;
}
.modal .field input:focus, .modal .field select:focus { border-color: var(--border-g); }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 20;
    height: auto; flex-direction: row;
    align-items: center; padding: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .side-brand { padding: 0; border: 0; margin: 0; flex: 1; }
  .side-label, .side-foot { display: none; }
  .side nav { display: flex; flex-direction: row; gap: 2px; }
  .side nav a { padding: 8px 10px; }
  .side nav a span { display: none; }
  .side nav a i { width: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .main { padding: 22px 18px 60px; }
  .hero-badge { display: none; }
  .tool-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .main-head { flex-direction: column; align-items: flex-start; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .section-head .actions { flex-wrap: wrap; }
  .tool-grid { grid-template-columns: 1fr; }
  .hero-card { flex-direction: column; align-items: flex-start; }
  .gen-actions .btn-primary, .gen-actions .btn-ghost { flex: 1; justify-content: center; }
}
