:root {
  color-scheme: dark;
  --bg: #0c0e14;
  --card: #161922;
  --field: #10131a;
  --line: #2a3142;
  --text: #eef2f7;
  --muted: #9aa3b5;
  --accent: #818cf8;
  --accent-soft: #232742;
  --sans: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

aside {
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card);
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 4px 8px 12px;
}

.mark {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.side-name {
  margin: 0 8px 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

nav { display: grid; gap: 2px; }
nav a, #logout, button, .ghost {
  font: inherit;
  text-decoration: none;
  color: var(--text);
  border-radius: 8px;
}

nav a { padding: 9px 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
nav a:hover { background: var(--bg); color: var(--text); }
nav a.active { background: var(--accent-soft); color: var(--accent); }

#logout {
  margin-top: auto;
  background: transparent;
  border: 1px solid var(--line);
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
}

main { padding: 28px 32px; }

header { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
h1, h2 { font-weight: 700; letter-spacing: -0.04em; margin: 0; }
h1 { font-size: 32px; }
h2 { font-size: 16px; margin-bottom: 12px; }
#who { color: var(--muted); margin: 0; font-size: 14px; }

.stats, .split { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(3, 1fr); }
.split { grid-template-columns: 0.85fr 1.15fr; margin-top: 12px; }

.stats article, .panel, .vouch {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stats article { padding: 16px; }
.stats span, .muted { color: var(--muted); }
.stats strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.panel { padding: 16px; }
.admin-table { margin-top: 12px; overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.admin-table a { color: var(--accent); text-decoration: none; }
.owner-pill { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.admin-table select { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.billing-card { max-width: 560px; }
.billing-card h2 { margin: 4px 0 8px; font-size: 32px; }
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ltc-box { margin-top: 16px; display: grid; gap: 8px; }
.ltc-box code { display: block; overflow-wrap: anywhere; color: var(--accent); font-weight: 600; }
#checks { margin: 0; padding-left: 18px; line-height: 1.7; }
.link-row { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
#profile-url { display: block; margin-top: 8px; overflow-wrap: anywhere; color: var(--accent); font-weight: 600; }

.form, .row { display: grid; gap: 12px; }
.row { grid-template-columns: 1fr auto; align-items: center; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

input, textarea, button { font: inherit; color: var(--text); }

input, textarea {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--accent);
}

input[type="file"] { padding: 8px; }

input:focus, textarea:focus { outline: 2px solid #4338ca; border-color: var(--accent); }

button, .ghost {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  width: fit-content;
}

.ghost, #disconnect {
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--line);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.vouch { padding: 12px 14px; margin-top: 8px; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.vouch p { margin: 6px 0 0; }
.vouch .meta { color: var(--muted); font-size: 13px; }
.error { color: #f87171; margin: 0; }
.status-pill { margin: 0; color: var(--muted); font-weight: 700; }
.status-pill::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-1px);
}
.status-pill[data-state="on"] { color: #86efac; }
.status-pill[data-state="off"] { color: #fbbf24; }

.bot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.bot-form h2, #bot-form h2 {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-hint { font-weight: 500; color: var(--muted); }
.bot-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bot-help { position: sticky; top: 16px; }
.bot-help ol { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.55; }
.bot-help li + li { margin-top: 10px; }
#disconnect { color: #f87171; border-color: #7f1d1d; }

.embed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; margin-top: 16px; }
.embed-preview-panel { position: sticky; top: 16px; }
#embed-preview, #stats-preview {
  background: #2b2d31;
  border-radius: 8px;
  padding: 12px 14px 12px 16px;
  border-left: 4px solid var(--embed-color, #ed4245);
  display: grid;
  gap: 8px;
}
.embed-title { margin: 0; color: #00a8fc; font-size: 16px; font-weight: 700; }
.embed-stars { color: #faa61a; letter-spacing: 1px; font-size: 16px; }
.embed-label { margin-top: 8px; color: #f2f3f5; font-size: 14px; font-weight: 700; }
.embed-body { margin: 2px 0 0; color: #dbdee1; font-size: 14px; line-height: 1.45; }
.embed-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.embed-author { display: flex; align-items: center; gap: 8px; }
.embed-fields strong, .embed-fields span { display: block; }
.embed-fields strong { color: #b5bac1; font-size: 12px; }
.embed-footer { display: flex; align-items: center; gap: 8px; color: #b5bac1; font-size: 12px; border-top: 1px solid #3f4147; padding-top: 8px; }
.embed-avatar, .embed-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #5865f2;
  display: grid;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
}
.embed-top { display: flex; justify-content: space-between; gap: 12px; }
.embed-thumb { width: 48px; height: 48px; border-radius: 8px; font-size: 18px; }
img.embed-thumb { object-fit: cover; }
.embed-discord strong, .embed-discord span { display: block; }
.embed-discord strong { color: #b5bac1; font-size: 12px; }
.embed-discord span { color: #00a8fc; font-size: 14px; }

#vouch-list .vouch button {
  background: #1c1214;
  color: #f87171;
  border: 1px solid #7f1d1d;
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); }
  nav { grid-template-columns: repeat(2, 1fr); }
  #logout { margin-top: 8px; }
  .stats, .split, .row { grid-template-columns: 1fr; }
  main { padding: 18px; }
}

.customize { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.identity { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; }
.avatar-pick {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}
.avatar-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.uploads { display: grid; gap: 8px; }
.uploads label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.uploads input { flex: 1; min-width: 160px; }
#customize-url { display: block; margin: -4px 0 8px; color: var(--accent); overflow-wrap: anywhere; }
.color-row { grid-template-columns: 1fr auto; align-items: center; }
.color-row input { width: 48px; height: 36px; padding: 2px; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-weight: 600;
}
.preview-panel { position: sticky; top: 16px; }
#live-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg) center/cover no-repeat;
  display: grid;
  gap: 8px;
}
.mini-banner { height: 72px; border-radius: 8px; background: center/cover no-repeat #161922; }
.mini-head { display: flex; align-items: center; gap: 8px; }
.mini-head img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.mini-head span { margin-left: auto; color: var(--preview-accent, var(--accent)); font-weight: 700; }
.mini-vouch { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.mini-vouch span, .mini-vouch p { color: var(--muted); font-size: 12px; }
.mini-vouch p { margin: 4px 0 0; }

@media (max-width: 860px) {
  .customize, .toggles, .identity, .bot-layout, .embed-layout, .embed-fields { grid-template-columns: 1fr; }
  .preview-panel, .bot-help, .embed-preview-panel { position: static; }
}
