:root {
  --bg:        #15161a;
  --bg-2:      #1b1d23;
  --bg-3:      #22252c;
  --bg-hover:  #282c34;
  --line:      #31353f;
  --line-soft: #272a31;
  --text:      #e7e9ee;
  --text-dim:  #9aa1af;
  --text-faint:#6e7585;
  --rust:      #cd412b;
  --rust-soft: #e3613f;
  --rust-dim:  rgba(205, 65, 43, .14);
  --green:     #4caf6d;
  --amber:     #d9a441;
  --blue:      #4c8bd9;
  --radius:    10px;
  --radius-sm: 7px;
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --mono:      ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win over any display rule below (an author
   `display: grid` on .modal otherwise beats the browser's [hidden] rule,
   which would leave the dialog permanently on screen). */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

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

a { color: var(--rust-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ----------------------------------------------------------- topbar ------ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(21,22,26,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1600px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--rust);
  display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff;
}
.brand-text { font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.brand-text strong { font-weight: 800; }

.topstats { display: flex; gap: 18px; margin-left: 8px; flex-wrap: wrap; }
.topstat { font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.topstat b { display: block; font-size: 15px; color: var(--text); font-weight: 600; }

.topnav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip {
  font-size: 13px; color: var(--text-dim); padding: 6px 10px;
  background: var(--bg-3); border-radius: 999px; border: 1px solid var(--line);
}

/* ----------------------------------------------------------- buttons ---- */
.btn {
  font: inherit; font-size: 14px; cursor: pointer;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text);
  transition: background .13s, border-color .13s, color .13s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--rust); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--rust-soft); }
.btn-outline { border-color: var(--line); }
.btn-outline:hover { border-color: var(--text-faint); }
.btn-ghost { color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }
.btn-link { background: none; border: none; color: var(--rust-soft); padding: 4px 2px; font-size: 13px; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-danger { color: #e8705c; border-color: rgba(232,112,92,.35); }
.btn-danger:hover { background: rgba(232,112,92,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.is-active { background: var(--rust-dim); color: var(--rust-soft); border-color: rgba(205,65,43,.4); }

/* ----------------------------------------------------------- layout ----- */
.layout {
  max-width: 1600px; margin: 0 auto; padding: 22px 20px 60px;
  display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 24px; align-items: start;
}
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static !important; max-height: none !important; }
}

/* ----------------------------------------------------------- filters ---- */
.filters {
  position: sticky; top: 76px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; max-height: calc(100vh - 100px); overflow-y: auto;
}
.filters::-webkit-scrollbar { width: 8px; }
.filters::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filters-head h2 { margin: 0; font-size: 15px; font-weight: 700; }

.facet { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 14px; }
.facet h3 {
  margin: 0 0 9px; font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-faint);
}
.hint { margin: 8px 0 0; font-size: 11.5px; color: var(--text-faint); line-height: 1.45; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }

input[type=text], input[type=search], input[type=number], input[type=email],
input[type=password], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--rust); box-shadow: 0 0 0 3px var(--rust-dim);
}
textarea { resize: vertical; min-height: 86px; line-height: 1.5; }
select { cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 12.5px; cursor: pointer;
  padding: 5px 10px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text-dim);
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip.is-active { background: var(--rust-dim); border-color: rgba(205,65,43,.5); color: var(--rust-soft); font-weight: 600; }
.chip .count { opacity: .6; margin-left: 4px; font-size: 11px; }

.facet-search { margin-bottom: 8px; font-size: 13px !important; padding: 6px 9px !important; }
.checklist { max-height: 212px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.checklist::-webkit-scrollbar { width: 7px; }
.checklist::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.check {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; color: var(--text-dim); padding: 4px 6px; border-radius: 5px;
}
.check:hover { background: var(--bg-3); color: var(--text); }
.check input { accent-color: var(--rust); margin: 0; cursor: pointer; flex: none; }
.check .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check .count { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.check.is-checked { color: var(--text); }

/* ----------------------------------------------------------- list ------- */
.listbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.listbar-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.listbar-right { display: flex; gap: 8px; }
.listbar-right select { width: auto; font-size: 13px; padding: 7px 10px; }
.result-count { font-size: 14px; color: var(--text-dim); }
.result-count b { color: var(--text); font-weight: 700; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
  background: var(--rust-dim); color: var(--rust-soft); border: 1px solid rgba(205,65,43,.3);
  cursor: pointer;
}
.pill:hover { background: rgba(205,65,43,.25); }

.page-title { font-size: 22px; margin: 0 0 18px; }

.server-list { display: flex; flex-direction: column; gap: 9px; }

.card {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 0;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: border-color .13s, transform .13s;
}
.card:hover { border-color: #414754; transform: translateY(-1px); }
.card.is-offline { opacity: .55; }
.card-accent { background: var(--rust); }
.card.is-offline .card-accent { background: var(--text-faint); }
.card-main { padding: 13px 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.card-name {
  font-size: 15.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-dim); }
.card-side {
  padding: 13px 18px; text-align: right; border-left: 1px solid var(--line-soft);
  display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 128px;
}
.players { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.players .max { font-size: 13px; color: var(--text-faint); font-weight: 500; }
.players-bar { height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; margin-top: 2px; }
.players-bar i { display: block; height: 100%; background: var(--rust); }
.queued { font-size: 11.5px; color: var(--amber); }

.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--bg-3); color: var(--text-dim); border: 1px solid var(--line-soft);
  white-space: nowrap;
}
.tag-modded  { background: rgba(217,164,65,.14); color: var(--amber);  border-color: rgba(217,164,65,.3); }
.tag-vanilla { background: rgba(76,175,109,.13); color: var(--green);  border-color: rgba(76,175,109,.3); }
.tag-official{ background: rgba(76,139,217,.14); color: var(--blue);   border-color: rgba(76,139,217,.3); }
.tag-verified{ background: var(--rust-dim); color: var(--rust-soft); border-color: rgba(205,65,43,.35); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.dot.off { background: var(--text-faint); }
.flag { font-size: 14px; line-height: 1; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--text-faint);
  background: var(--bg-2); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty h3 { color: var(--text-dim); margin: 0 0 8px; font-size: 16px; }
.empty p { margin: 0 auto; max-width: 440px; font-size: 14px; line-height: 1.6; }

.skeleton { background: var(--bg-2); border-radius: var(--radius); height: 72px; animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .45; } 50% { opacity: .8; } }

.pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 20px; }
.pager span { font-size: 13px; color: var(--text-dim); }

/* ----------------------------------------------------------- modal ----- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); }
.modal-box {
  position: relative; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
  width: 100%; max-width: 680px; max-height: 88vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  background: none; border: none; color: var(--text-faint);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }
.modal-content { padding: 24px; }
.modal-content h2 { margin: 0 0 6px; font-size: 20px; }
.modal-content h3 { margin: 22px 0 10px; font-size: 14px; color: var(--text-dim); }
.modal-sub { margin: 0 0 18px; color: var(--text-faint); font-size: 13.5px; }

.kv { display: grid; grid-template-columns: 136px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.banner { width: 100%; border-radius: var(--radius-sm); margin-bottom: 16px; display: block; border: 1px solid var(--line); }
.desc-box {
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.55;
  max-height: 220px; overflow-y: auto; color: var(--text-dim);
}
.code {
  font-family: var(--mono); font-size: 13px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  overflow-wrap: anywhere;
}
.token {
  font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .06em;
  color: var(--rust-soft); text-align: center; padding: 16px;
  background: var(--bg); border: 1px dashed rgba(205,65,43,.45); border-radius: var(--radius-sm);
  user-select: all;
}
.steps { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.75; color: var(--text-dim); }
.steps li + li { margin-top: 5px; }
.steps code {
  font-family: var(--mono); font-size: 12.5px; background: var(--bg);
  padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line-soft); color: var(--text);
}

.note {
  font-size: 13px; line-height: 1.6; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-3); color: var(--text-dim);
}
.note-warn  { border-color: rgba(217,164,65,.35); background: rgba(217,164,65,.08); color: #e4c585; }
.note-ok    { border-color: rgba(76,175,109,.35); background: rgba(76,175,109,.08); color: #8fd3a5; }
.note-error { border-color: rgba(232,112,92,.35); background: rgba(232,112,92,.08); color: #eba093; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dt { margin-top: 8px; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; }
.tab {
  font: inherit; font-size: 14px; cursor: pointer; padding: 9px 14px;
  background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--rust-soft); border-bottom-color: var(--rust); font-weight: 600; }

/* ----------------------------------------------------------- my servers - */
.owned-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px;
}
.owned-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.owned-head h3 { margin: 0; font-size: 16px; }
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); margin: 24px 0 10px;
}

/* ----------------------------------------------------------- toasts ---- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-3); border: 1px solid var(--line); border-left: 3px solid var(--rust);
  border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13.5px;
  box-shadow: var(--shadow); max-width: 380px; animation: slide .2s ease-out;
}
.toast.ok    { border-left-color: var(--green); }
.toast.error { border-left-color: #e8705c; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

.footer {
  max-width: 1600px; margin: 0 auto; padding: 0 20px 40px;
  color: var(--text-faint); font-size: 12.5px; line-height: 1.6;
}
.footer p { max-width: 760px; }

.qr-box {
  background: #fff; padding: 18px; border-radius: var(--radius-sm);
  width: 200px; height: 200px; margin: 12px auto; box-sizing: border-box;
}
.qr-box svg { display: block; width: 100%; height: 100%; }

/* ---------------------------------------------- featured / boosted ----- */
.card.is-featured { border-color: rgba(224,179,65,.55); box-shadow: inset 3px 0 0 #e0b341; }
.card.is-boosted .card-accent { background: #e0b341; }
.tag-featured { color: #e0b341; border-color: rgba(224,179,65,.5); }
.tag-boosted  { color: #f5d06f; border-color: rgba(245,208,111,.5); }

/* ----------------------------------------------- admin / support ------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; color: var(--text); font: inherit; }
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--rust-soft); }
.stat-label { display: block; font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.stat b { font-size: 22px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 180px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--text-faint); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; }
.panel h3 { margin-top: 0; }
.panel-title { margin: 26px 0 10px; font-size: 14px; color: var(--text-dim); }
.row-form { display: grid; grid-template-columns: 2fr 90px 110px 100px auto auto; gap: 10px; align-items: end; }
.row-form .field { margin-bottom: 0; }
@media (max-width: 800px) { .row-form { grid-template-columns: 1fr 1fr; } }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; max-height: 340px; overflow-y: auto; }
.msg { background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 12px; }
.msg-staff { border-color: rgba(205,65,43,.45); }
.msg-head { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.msg-body { white-space: pre-wrap; font-size: 13.5px; overflow-wrap: anywhere; }
.ticket-open, .order-pending { color: #e0b341; }
.ticket-answered, .order-paid { color: #4cc38a; }
.ticket-closed, .order-cancelled { color: var(--text-faint); }
.plan-list { display: flex; flex-direction: column; gap: 8px; }
.plan { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; }
.plan span { flex: 1; }
.plan:has(input:checked) { border-color: var(--rust-soft); }

/* Views without the filter sidebar (my servers, support, admin) use the full width. */
.layout:has(#filters[hidden]) { grid-template-columns: minmax(0, 1fr); }
.layout:has(#filters[hidden]) > .content { max-width: 1100px; width: 100%; margin: 0 auto; }
