:root {
  --bg: #0a0b0f;
  --bg-elev: #0f1117;
  --panel: #12151c;
  --panel-2: #171b24;
  --panel-3: #1d222d;
  --border: #242936;
  --border-soft: #1a1e28;
  --text: #e8eaf0;
  --text-dim: #a2a9ba;
  --muted: #767e91;
  --accent: #e11d2e;
  --accent-soft: rgba(225, 29, 46, 0.14);
  --accent-2: #ff5566;
  --green: #2fd07a;
  --green-soft: rgba(47, 208, 122, 0.13);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, 0.14);
  --blue: #5b8dff;
  --blue-soft: rgba(91, 141, 255, 0.14);
  --danger: #ff4d5e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --sidebar-w: 246px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 500px at 8% -10%, rgba(225, 29, 46, 0.12), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(91, 141, 255, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2a3040;
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: #394157;
}

/* ------------------------------------------------------------------ */
/* Boot + login                                                        */
/* ------------------------------------------------------------------ */
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
}

.boot-mark {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -1px;
  font-size: 21px;
  color: #fff;
  background: linear-gradient(150deg, var(--accent), #8f0f1c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 50px rgba(225, 29, 46, 0.28);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 50px rgba(225, 29, 46, 0.24);
  }
  50% {
    transform: translateY(-4px);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 30px 70px rgba(225, 29, 46, 0.4);
  }
}

.boot-text {
  color: var(--muted);
  letter-spacing: 0.04em;
  font-size: 13px;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  z-index: 100;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(460px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 38px 34px 32px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.auth-brand .mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(150deg, var(--accent), #8f0f1c);
  box-shadow: 0 10px 30px rgba(225, 29, 46, 0.3);
}

.auth-brand .wordmark {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.auth-brand .wordmark b {
  color: var(--text);
}

.auth-title {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.auth-sub {
  color: var(--text-dim);
  margin: 0 0 26px;
  font-size: 14px;
}

.auth-list {
  display: grid;
  gap: 10px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
}

.auth-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-dim);
  font-size: 13px;
}

.auth-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(225, 29, 46, 0.8);
  flex: 0 0 auto;
}

.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid #4752c4;
  border-radius: 11px;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.discord-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.discord-btn svg {
  width: 22px;
  height: 22px;
}

.auth-foot {
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-error {
  border: 1px solid rgba(255, 77, 94, 0.35);
  background: rgba(255, 77, 94, 0.08);
  color: #ffb3bb;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

.auth-error b {
  color: #ffd5d9;
}

.auth-denied {
  border: 1px solid rgba(245, 165, 36, 0.35);
  background: rgba(245, 165, 36, 0.08);
  color: #ffd9a0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* ------------------------------------------------------------------ */
/* App shell                                                           */
/* ------------------------------------------------------------------ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 30%), var(--bg-elev);
  padding: 20px 14px 14px;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 20px;
}

.brand .mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(150deg, var(--accent), #8f0f1c);
  box-shadow: 0 10px 26px rgba(225, 29, 46, 0.25);
  flex: 0 0 auto;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 12px;
  text-transform: uppercase;
}

.brand-title b {
  color: var(--accent-2);
}

.brand-sub {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.nav-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 9px;
  color: var(--text-dim);
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: rgba(225, 29, 46, 0.32);
  color: #fff;
}

.nav-item.active .nav-icon {
  color: var(--accent-2);
}

.nav-icon {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-status {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 11px;
  padding: 11px 12px;
  margin: 10px 2px;
}

.sidebar-status .row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.sidebar-status .meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 10px rgba(47, 208, 122, 0.7);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 77, 94, 0.6);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border-soft);
  padding: 12px 6px 2px;
  margin-top: 4px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-3);
  object-fit: cover;
  flex: 0 0 auto;
}

.user-meta {
  min-width: 0;
  flex: 1;
}

.user-name {
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: var(--green);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: 0.12s;
}

.icon-btn:hover {
  color: var(--text);
  border-color: #384054;
  background: var(--panel-2);
}

/* ------------------------------------------------------------------ */
/* Main                                                                */
/* ------------------------------------------------------------------ */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 11, 15, 0.82);
  backdrop-filter: blur(14px);
}

.page-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}

.page-sub {
  color: var(--muted);
  font-size: 12px;
  margin: 1px 0 0;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 99px;
  padding: 6px 11px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}

.live-pill .status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  animation: blink 2.2s infinite;
}

@keyframes blink {
  0%,
  70%,
  100% {
    opacity: 1;
  }
  85% {
    opacity: 0.25;
  }
}

.content {
  padding: 26px 28px 48px;
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 14px;
  font-weight: 650;
  font-size: 13px;
  transition: 0.12s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--panel-2);
  border-color: #374055;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 22px rgba(225, 29, 46, 0.22);
}

.btn-primary:hover {
  background: #f02a3c;
  border-color: #f02a3c;
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: transparent;
  border-color: rgba(255, 77, 94, 0.4);
  color: #ff8b96;
}

.btn-danger:hover {
  background: rgba(255, 77, 94, 0.1);
  border-color: var(--danger);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Cards + grids                                                       */
/* ------------------------------------------------------------------ */
.grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 45%), var(--panel);
  border-radius: var(--radius);
  padding: 17px 18px;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0.75;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  color: var(--muted);
  font-size: 11.5px;
}

.cols-2 {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-title {
  font-size: 13.5px;
  font-weight: 750;
  margin: 0;
  letter-spacing: 0.01em;
}

.panel-sub {
  color: var(--muted);
  font-size: 11.5px;
  margin: 1px 0 0;
}

.panel-head .btn {
  margin-left: auto;
}

.panel-body {
  padding: 17px;
}

.panel-body.flush {
  padding: 0;
}

/* ------------------------------------------------------------------ */
/* Chart + ranked lists                                                */
/* ------------------------------------------------------------------ */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 168px;
  padding: 8px 2px 0;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}

.chart-bar-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-bar {
  width: min(38px, 74%);
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent-2), #9d1220);
  min-height: 3px;
  transition: height 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  position: relative;
}

.chart-bar:hover {
  filter: brightness(1.2);
}

.chart-bar[data-value]:hover::after {
  content: attr(data-value);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #05060a;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.chart-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.list {
  display: grid;
  gap: 2px;
}

.list-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.list-row:last-child {
  border-bottom: 0;
}

.list-rank {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
  text-align: right;
}

.list-main {
  min-width: 0;
}

.list-name {
  font-weight: 650;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 4px;
  background: #1d2230;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 5px;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #9d1220, var(--accent-2));
}

.list-value {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */
.table-wrap {
  overflow: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 750;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 0.1s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.022);
}

tbody tr.clickable {
  cursor: pointer;
}

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

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

.dim {
  color: var(--text-dim);
}

.cmd {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #dfe3ec;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: bottom;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-dim);
  flex: 0 0 auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chip-player {
  background: var(--blue-soft);
  color: #9dbaff;
  border-color: rgba(91, 141, 255, 0.25);
}
.chip-console {
  background: var(--amber-soft);
  color: #ffd08a;
  border-color: rgba(245, 165, 36, 0.25);
}
.chip-remote {
  background: rgba(176, 120, 255, 0.14);
  color: #d2b0ff;
  border-color: rgba(176, 120, 255, 0.25);
}
.chip-other {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-color: var(--border);
}

.status-pending {
  background: var(--amber-soft);
  color: #ffd08a;
  border-color: rgba(245, 165, 36, 0.3);
}
.status-claimed {
  background: var(--blue-soft);
  color: #9dbaff;
  border-color: rgba(91, 141, 255, 0.3);
}
.status-done {
  background: var(--green-soft);
  color: #8ff0bb;
  border-color: rgba(47, 208, 122, 0.3);
}
.status-failed,
.status-expired {
  background: rgba(255, 77, 94, 0.1);
  color: #ff9ea7;
  border-color: rgba(255, 77, 94, 0.28);
}

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
}

.empty b {
  display: block;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.skeleton {
  height: 13px;
  border-radius: 5px;
  background: linear-gradient(90deg, #171b24, #232937, #171b24);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ------------------------------------------------------------------ */
/* Filters + forms                                                     */
/* ------------------------------------------------------------------ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: flex-end;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elev);
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field.grow {
  flex: 1;
  min-width: 180px;
}

.label {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 750;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  font-size: 13px;
}

.input::placeholder,
.textarea::placeholder {
  color: #5e6678;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(225, 29, 46, 0.6);
  box-shadow: 0 0 0 3px rgba(225, 29, 46, 0.12);
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

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

.input-sm {
  padding: 6px 9px;
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
}

.pagination .spacer {
  flex: 1;
}

.pagination .page-info {
  font-family: var(--mono);
  font-size: 11px;
}

/* ------------------------------------------------------------------ */
/* Actions                                                             */
/* ------------------------------------------------------------------ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.action-card {
  text-align: left;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--panel);
  border-radius: 12px;
  padding: 15px;
  transition: 0.14s;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.action-card:hover {
  border-color: rgba(225, 29, 46, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
}

.action-card.destructive:hover {
  border-color: rgba(255, 77, 94, 0.55);
}

.action-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-2);
  flex: 0 0 auto;
  font-size: 16px;
}

.action-card.destructive .action-icon {
  background: rgba(255, 77, 94, 0.12);
  color: #ff8b96;
}

.action-name {
  font-weight: 750;
  font-size: 13px;
  margin-bottom: 2px;
}

.action-desc {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.server-list {
  display: grid;
  gap: 10px;
}

.server-row {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  background: var(--bg-elev);
}

.server-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 8px;
}

.server-top .muted {
  margin-left: auto;
  font-weight: 500;
  font-size: 11px;
}

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

.kv {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 7px 9px;
}

.kv .k {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.kv .v {
  font-family: var(--mono);
  font-size: 11.5px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(6px);
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  animation: fade 0.12s ease-out;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(540px, 100%);
  max-height: min(88vh, 780px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.16s ease-out;
}

.modal.wide {
  width: min(760px, 100%);
}

@keyframes rise {
  from {
    transform: translateY(8px) scale(0.985);
    opacity: 0.4;
  }
}

.modal-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-head .icon-btn {
  margin-left: auto;
}

.modal-body {
  padding: 18px 20px;
}

.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  border-top: 1px solid var(--border-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid rgba(255, 77, 94, 0.3);
  background: rgba(255, 77, 94, 0.06);
  padding: 11px 12px;
  border-radius: 9px;
  font-size: 12px;
  color: #ffc3c8;
}

.check-row input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.form-hint {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

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

.detail-item {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 9px 11px;
  min-width: 0;
}

.detail-item .k {
  color: var(--muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.detail-item .v {
  font-size: 12px;
  margin-top: 3px;
  word-break: break-word;
}

.detail-item.full {
  grid-column: 1 / -1;
}

.detail-item pre {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
  max-height: 220px;
  overflow: auto;
}

/* ------------------------------------------------------------------ */
/* Toasts                                                              */
/* ------------------------------------------------------------------ */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 40px));
}

.toast {
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  background: var(--panel-2);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: toastIn 0.18s ease-out;
}

.toast.success {
  border-left-color: var(--green);
}
.toast.error {
  border-left-color: var(--danger);
}
.toast.warn {
  border-left-color: var(--amber);
}

@keyframes toastIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
.menu-btn {
  display: none;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: 30px 0 60px rgba(0, 0, 0, 0.45);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .menu-btn {
    display: grid;
  }
  .cols-2,
  .cols-3 {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 14px 18px;
  }
  .content {
    padding: 20px 18px 40px;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .top-actions .live-pill {
    display: none;
  }
  .page-title {
    font-size: 17px;
  }
  .action-grid {
    grid-template-columns: 1fr;
  }
  .kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
