:root {
  color-scheme: dark;
  --bg: #101312;
  --panel: #181d1b;
  --panel-2: #202723;
  --line: #334038;
  --text: #edf4ee;
  --muted: #9dad9f;
  --accent: #d0ef57;
  --danger: #ff6d6d;
  --ok: #58d68d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: #151800;
  border-color: var(--accent);
  font-weight: 700;
}

button.danger {
  border-color: #7a3636;
  color: #ffd8d8;
}

input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #0c0f0e;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login form {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.nav {
  background: #0b0e0d;
  border-right: 1px solid var(--line);
  padding: 18px;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 22px;
}

.nav button {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  background: transparent;
}

.nav button.active {
  background: var(--panel-2);
  border-color: var(--accent);
}

.content {
  padding: 22px;
  max-width: 1680px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1, h2, h3 {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.span-3 > .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
}

.id-cell {
  font-family: Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
}

.actions {
  white-space: nowrap;
}

.panel:has(#scanPlayerLogsOld) {
  display: none;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--danger);
}

.status-dot.ok {
  background: var(--ok);
}

.log {
  height: 360px;
  overflow: auto;
  background: #090b0a;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font-family: Consolas, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.progress {
  margin: 12px 0;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-bar {
  height: 12px;
  border: 1px solid var(--line);
  background: #0c0f0e;
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.toast {
  margin: 12px 0;
  color: #ffe5a1;
}

.discord-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.discord-preview {
  background: #202225;
  border: 1px solid #2b2d31;
  border-left: 4px solid #3498db;
  border-radius: 4px;
  padding: 12px;
  min-height: 112px;
}

.discord-preview-title {
  color: #f2f3f5;
  font-weight: 700;
  margin-bottom: 8px;
}

.discord-preview-body {
  color: #dbdee1;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.discord-preview-meta {
  color: #949ba4;
  font-size: 12px;
  margin-top: 10px;
}

.discord-presence-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  margin-top: 14px;
  padding: 12px;
  background: #1e1f22;
  border: 1px solid #2b2d31;
  border-radius: 6px;
}

.discord-presence-preview p {
  margin: 3px 0 0;
  color: #b5bac1;
  font-size: 14px;
}

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

  .nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .grid, .form-grid, .discord-preview-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .span-3 {
    grid-column: auto;
  }
}
