:root {
  --bg: #09090b;
  --panel: #101013;
  --panel2: #16161b;
  --line: #20202a;
  --text: #f1f1f4;
  --muted: #8b8b97;
  --accent: #7c3aed;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 20px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* layout */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side {
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.group { font-size: 11px; letter-spacing: 0.12em; color: var(--muted); padding: 16px 10px 6px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--text); background: var(--panel2); }
.user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.user img { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.user .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.main { padding: 32px; max-width: 1120px; width: 100%; }

/* building blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-top: 16px; }
.stat .value { font-size: 26px; font-weight: 700; margin: 6px 0 2px; }
.stat .label { font-size: 12px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
.two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.actions { padding: 0; overflow: hidden; }
.actions .head { padding: 14px 18px; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.actions a {
  display: block;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.actions a:hover { background: var(--panel2); }
.actions a span { display: block; font-size: 13px; color: var(--muted); }

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: #34343f; }
.btn.primary { background: #fff; color: #000; border-color: #fff; }
.btn.primary:hover { background: #e6e6e6; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

input[type="text"] {
  width: 100%;
  background: #0c0c0f;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
input[type="text"]:focus { outline: none; border-color: #4b3a8a; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* products */
.products { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.pcard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.cover-wrap { position: relative; height: 140px; background: #0d0d11; }
.cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.empty { background: linear-gradient(135deg, #14141a, #0c0c10); }
.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(9, 9, 11, 0.85);
  border: 1px solid var(--line);
}
.badge.good { color: var(--good); border-color: rgba(52, 211, 153, 0.4); }
.badge.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.badge.bad { color: var(--bad); border-color: rgba(248, 113, 113, 0.4); }
.pbody { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.keybox { display: flex; gap: 8px; }
.keybox code {
  flex: 1;
  min-width: 0;
  background: #0c0c0f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.facts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* shop */
.shop-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.shop-head img { width: 84px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.item .price { font-weight: 600; white-space: nowrap; }

/* login + notices */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { max-width: 420px; width: 100%; text-align: center; padding: 32px 26px; display: flex; flex-direction: column; gap: 14px; }
.login .brand { border: none; margin: 0; padding: 0; font-size: 22px; }
.notice { border-color: #4b3a8a; background: #14102a; margin-bottom: 16px; }
.error { color: var(--bad); }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  max-width: 340px;
  z-index: 10;
}
.toast.bad { border-color: rgba(248, 113, 113, 0.5); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; border-right: none; border-bottom: 1px solid var(--line); padding: 12px; }
  .brand { border: none; margin: 0; padding: 6px 8px; }
  .group { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .user { margin: 0 0 0 auto; }
  .main { padding: 18px; }
  .two { grid-template-columns: 1fr; }
}
