/* ============================================================================
   DESIGN TOKENS — flatter, cleaner "product dashboard" feel: neutral chrome
   everywhere, red reserved for the brand and for things that are actually
   active/interactive (buttons, active tabs, section labels, badges).
============================================================================ */
:root {
  --bg: #0b0b0e;
  --card: #16161c;
  --card-border: #232330;
  --card-border-hover: #33333f;
  --divider: #232330;
  --input-bg: #0d0d11;
  --input-border: #2a2a36;
  --text: #e7e7ea;
  --text-dim: #8c8c98;
  --text-faint: #6a6a76;
  --red: #e53935;
  --red-bright: #ff6b6b;
  --red-wash: rgba(229, 57, 53, 0.14);
  --radius-card: 14px;
  --radius-pill: 999px;
}

/* ============================================================================
   GLOBAL RESET + BASE
============================================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
}

/* Page Wrapper */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

/* ============================================================================
   LOGIN PAGE
============================================================================ */
.login-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-card {
  background: rgba(22, 22, 28, 0.88);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 40px 50px;
  width: 360px;
  text-align: center;
  box-shadow: 0 0 25px rgba(229, 57, 53, 0.2);
  backdrop-filter: blur(6px);
}

.logo-top {
  width: 160px;
  margin-bottom: 30px;
}

.login-button {
  margin-top: 10px;
  padding: 10px 28px;
  font-size: 16px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  border: 1px solid var(--red);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: 0.2s ease;
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-button:hover {
  background: #ff4a44;
  border-color: #ff4a44;
  box-shadow: 0 0 18px rgba(229, 57, 53, 0.5);
}

.discord-icon {
  width: 18px;
  height: 18px;
  margin-right: 10px;
}

.login-footer {
  margin-top: 35px;
  font-size: 13px;
  color: #888;
}

/* ============================================================================
   HEADER — one slim top bar, built by nav.js on every dashboard page
   (logo + title, Overview, dropdown tabs, avatar + username + Log out)
============================================================================ */
.rf-header {
  position: sticky;
  top: 0;
  z-index: 5000;
  background: #0a0a0d;
  border-bottom: 1px solid #1d1d24;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.rf-bar {
  display: flex;
  align-items: center;
  gap: 8px 22px;
  max-width: 1400px;
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 24px;
}

.rf-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

/* The logo is shown whole: no fixed square, no clipping, no radius. Height is
   fixed, width follows the artwork's own proportions. */
.rf-logo-wrap {
  display: inline-flex;
  align-items: center;
  height: 44px;
  flex-shrink: 0;
}
.rf-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  object-position: left center;
  background: none;
  border-radius: 0;
  filter: drop-shadow(0 0 8px rgba(229, 57, 53, 0.35));
}
/* Only shown when the image file is missing. */
.rf-logo-wrap.rf-logo-missing { width: 40px; height: 40px; }
.rf-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e53935, #8e1b19);
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.35);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
}

.rf-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}
.rf-title-sub { font-weight: 700; opacity: 0.6; }

/* ---- nav tabs ---- */
.rf-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.rf-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: #9a9aa6;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.rf-tab:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.rf-tab.active {
  background: var(--red);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(229, 57, 53, 0.35);
}
.rf-tab:focus-visible,
.rf-item:focus-visible,
.rf-burger:focus-visible,
.rf-logout:focus-visible,
.rf-brand:focus-visible {
  outline: 2px solid #e53935;
  outline-offset: 2px;
}

.rf-caret { opacity: 0.75; transition: transform 0.15s ease; }
.rf-dd.open .rf-caret { transform: rotate(180deg); }
.rf-dd.open > .rf-tab:not(.active) { background: rgba(255, 255, 255, 0.06); color: #fff; }

/* ---- dropdown menu ---- */
.rf-dd { position: relative; }

.rf-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 340px;
  padding: 6px;
  background: #121218;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
  z-index: 10;
}
.rf-dd.align-right .rf-menu { left: auto; right: 0; }
.rf-dd.open .rf-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.rf-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #e0e0e0;
  text-decoration: none;
  transition: background 0.12s ease;
}
.rf-item-label { font-size: 0.92rem; font-weight: 600; }
.rf-item-desc { font-size: 0.75rem; color: #8a8a8a; line-height: 1.35; }
.rf-item:hover, .rf-item:focus-visible { background: rgba(229, 57, 53, 0.12); color: #fff; }
.rf-item.active { background: rgba(229, 57, 53, 0.18); }
.rf-item.active .rf-item-label { color: #ff6b6b; }

/* ---- right side: status chip, avatar, username, Log out ---- */
.rf-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.rf-status-slot { display: inline-flex; margin-right: 6px; }
.rf-status-slot:empty { display: none; }
.rf-status-slot .status-chip { height: 32px; }

.rf-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #ddd;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rf-avatar.loading { animation: rf-pulse 1.2s ease-in-out infinite; }
.rf-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes rf-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

.rf-username {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  color: #e0e0e0;
}

.rf-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: transparent;
  color: #ddd;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  transition: 0.15s ease;
}
.rf-logout:hover { border-color: #e53935; color: #fff; background: rgba(229, 57, 53, 0.12); }
.rf-logout-mobile { display: none; }
/* The header Log out button now lives in the profile card (and the mobile menu). */
.rf-user > .rf-logout { display: none; }

/* ---- profile button + dropdown card ---- */
.rf-profile { position: relative; }
.rf-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #e0e0e0;
  font: inherit;
  cursor: pointer;
  transition: 0.15s ease;
}
.rf-user-btn:hover, .rf-profile.open .rf-user-btn { background: rgba(255, 255, 255, 0.06); border-color: #3a3a3a; color: #fff; }
.rf-user-btn:focus-visible { outline: 2px solid #e53935; outline-offset: 2px; }
.rf-profile.open .rf-caret { transform: rotate(180deg); }
.rf-user-btn .rf-username { max-width: 140px; }
@media (max-width: 1240px) { .rf-title-sub { display: none; } }
@media (max-width: 1180px) {
  .rf-user-btn .rf-username { display: none; }
  .rf-bar { gap: 8px 12px; }
}

.rf-profile-card {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 5100;
  width: 356px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding: 16px;
  background: #151515;
  border: 1px solid #2f1a1a;
  border-top: 3px solid #e53935;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(229, 57, 53, 0.08);
  color: #e0e0e0;
  font-size: 0.85rem;
  animation: rf-pop 0.14s ease-out;
}
.rf-profile-card[hidden] { display: none; }
.rf-profile-card:focus { outline: none; }
@keyframes rf-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.rf-pc-loading { color: #888; padding: 8px 0 12px; }
.rf-pc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.rf-pc-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; flex-shrink: 0;
  border-radius: 50%; overflow: hidden;
  background: #2a2a2a; border: 2px solid #e53935;
  box-shadow: 0 0 14px rgba(229, 57, 53, 0.35);
  font-size: 1.6rem; font-weight: 700; color: #ddd;
}
.rf-pc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rf-pc-who { min-width: 0; }
.rf-pc-name { font-size: 1.1rem; font-weight: 700; color: #fff; overflow-wrap: anywhere; line-height: 1.25; }
.rf-pc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.rf-acct {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.rf-acct.admin { background: rgba(229, 57, 53, 0.18); border: 1px solid #e53935; color: #ff8a80; }
.rf-acct.member { background: rgba(255, 255, 255, 0.06); border: 1px solid #444; color: #bbb; }

.rf-chip {
  --rc: #99aab5;
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  height: 24px; padding: 0 9px 0 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rc) 55%, transparent);
  background: color-mix(in srgb, var(--rc) 14%, #151515);
  color: #eee; font-size: 0.76rem; font-weight: 600; line-height: 1;
}
.rf-chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); flex-shrink: 0; }
.rf-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-chip.top { height: 22px; }

.rf-pc-facts { margin: 0 0 4px; padding: 8px 0 4px; border-top: 1px solid #262626; }
.rf-pc-fact { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; }
.rf-pc-fact dt { color: #8a8a8a; font-size: 0.76rem; flex-shrink: 0; }
.rf-pc-fact dd { margin: 0; color: #e8e8e8; text-align: right; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.rf-pc-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; }
.rf-pc-dim { color: #8a8a8a; }
.rf-copy {
  height: 22px; padding: 0 9px; border: 1px solid #3a3a3a; border-radius: 6px;
  background: #1f1f1f; color: #ddd; font: inherit; font-size: 0.72rem; cursor: pointer; transition: 0.15s ease;
}
.rf-copy:hover { border-color: #e53935; color: #fff; }
.rf-copy.done { border-color: #43a047; color: #81c784; }
.rf-copy:focus-visible, .rf-pc-select:focus-visible, .rf-pc-link:focus-visible, .rf-pc-logout:focus-visible { outline: 2px solid #e53935; outline-offset: 2px; }

.rf-pc-sec {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid #262626;
  color: #e53935; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
}
.rf-pc-sec-note { color: #777; font-weight: 500; letter-spacing: 0; text-transform: none; }
.rf-pc-roles { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow-y: auto; padding-right: 2px; }

.rf-pc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; }
.rf-pc-rowtext { display: flex; flex-direction: column; gap: 1px; min-width: 0; cursor: pointer; }
.rf-pc-rowlabel { color: #e8e8e8; font-weight: 600; font-size: 0.84rem; }
.rf-pc-rowhint { color: #777; font-size: 0.72rem; line-height: 1.3; }
.rf-pc-select {
  width: auto; max-width: 150px; margin: 0; padding: 5px 8px; flex-shrink: 0;
  background: #0d0d0d; color: #eee; border: 1px solid #4a1c1c; border-radius: 6px; font-size: 0.8rem;
}
.rf-pc-switchrow { cursor: pointer; }
.rf-switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.rf-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.rf-switch-track { position: absolute; inset: 0; border-radius: 999px; background: #333; border: 1px solid #4a4a4a; transition: 0.15s ease; pointer-events: none; }
.rf-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #ccc; transition: 0.15s ease; }
.rf-switch input:checked + .rf-switch-track { background: #e53935; border-color: #ff6b6b; }
.rf-switch input:checked + .rf-switch-track::after { transform: translateX(16px); background: #fff; }
.rf-switch input:focus-visible + .rf-switch-track { outline: 2px solid #ff8a80; outline-offset: 2px; }

.rf-pc-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 8px; padding-top: 12px; border-top: 1px solid #262626; }
.rf-pc-link {
  display: flex; align-items: center; justify-content: center; height: 36px; padding: 0 8px;
  border: 1px solid #3a3a3a; border-radius: 8px; background: #1c1c1c;
  color: #ddd; text-decoration: none; font-size: 0.82rem; text-align: center; transition: 0.15s ease;
}
.rf-pc-link:hover { border-color: #e53935; background: rgba(229, 57, 53, 0.12); color: #fff; }
.rf-pc-logout {
  display: flex; align-items: center; justify-content: center; height: 38px;
  border: 1px solid #5a1d1d; border-radius: 8px; background: rgba(229, 57, 53, 0.1);
  color: #ff8a80; text-decoration: none; font-weight: 600; font-size: 0.85rem; transition: 0.15s ease;
}
.rf-pc-logout:hover { background: #e53935; border-color: #e53935; color: #fff; }


/* ---- hamburger (narrow screens) ---- */
.rf-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #3a3a3a;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.rf-burger span { display: block; height: 2px; border-radius: 2px; background: #ddd; transition: 0.2s ease; }
.rf-header.nav-open .rf-burger { border-color: #e53935; }
.rf-header.nav-open .rf-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.rf-header.nav-open .rf-burger span:nth-child(2) { opacity: 0; }
.rf-header.nav-open .rf-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1040px) {
  .rf-bar { flex-wrap: wrap; padding: 10px 16px; gap: 8px 12px; min-height: 60px; }
  .rf-brand { flex: 1 1 0; min-width: 0; }
  .rf-title { overflow: hidden; text-overflow: ellipsis; }
  .rf-logo-wrap { flex-shrink: 0; }
  .rf-user { order: 2; margin-left: 0; }
  .rf-burger { display: inline-flex; order: 3; }
  .rf-username, .rf-user .rf-logout, .rf-user-btn .rf-caret { display: none; }
  .rf-user-btn { padding: 0 3px; border-radius: 50%; }
  /* on phones the card is anchored to the whole header, full width */
  .rf-profile { position: static; }
  .rf-profile-card { left: 8px; right: 8px; top: calc(100% + 6px); width: auto; max-width: none; max-height: calc(100vh - 84px); }
  .rf-logout-mobile { display: inline-flex; }

  .rf-nav {
    display: none;
    order: 4;
    flex: 0 0 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 0 6px;
    border-top: 1px solid #222;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
  .rf-header.nav-open .rf-nav { display: flex; }
  .rf-tab { height: 44px; justify-content: space-between; }
  .rf-dd { width: 100%; }
  .rf-dd > .rf-tab { width: 100%; }

  /* dropdowns become inline accordions */
  .rf-menu {
    position: static;
    display: none;
    min-width: 0;
    margin: 2px 0 6px 10px;
    padding: 2px 0 2px 8px;
    border: 0;
    border-left: 2px solid #2a1616;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  .rf-dd.open .rf-menu { display: block; }
  .rf-item { padding: 10px 10px; }
  .rf-logout-mobile { margin-top: 8px; height: 42px; }
}

@media (max-width: 440px) {
  .rf-title-sub { display: none; }
}

@media (max-width: 520px) {
  .rf-title { font-size: 1rem; }
  .rf-logo-wrap, .rf-logo { height: 40px; }
  .rf-logo { max-width: 150px; }
  .rf-user { gap: 8px; }
  /* status chip collapses to just its dot */
  .rf-status-slot .status-chip { font-size: 0; gap: 0; padding: 0 10px; height: 30px; }
}

/* ---- consistent page heading + spacing under the header ---- */
.rf-pagehead { margin: 0 0 20px; }
.rf-crumb {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e53935;
  margin-bottom: 4px;
}
.rf-pagetitle { font-size: 1.7rem; font-weight: 800; color: #fff; line-height: 1.2; letter-spacing: -0.01em; }

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  box-sizing: border-box;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-pill);
  text-decoration: none;
  white-space: nowrap;
  transition: 0.2s ease;
  box-shadow: 0 0 10px rgba(229, 57, 53, 0.2);
}

.logout-btn:hover {
  background: #ff4a44;
  border-color: #ff4a44;
  box-shadow: 0 0 14px rgba(229, 57, 53, 0.4);
}

/* Secondary / outline variant — same pill shape, neutral chrome instead of
   solid red, for a page's non-primary actions (Cancel, Save as template…). */
.logout-btn.ghost {
  background: #1c1c22;
  color: #e0e0e0;
  border-color: #2e2e38;
  box-shadow: none;
}
.logout-btn.ghost:hover {
  background: #22222a;
  border-color: var(--card-border-hover);
  color: #fff;
  box-shadow: none;
}

/* ============================================================================
   SERVER STATUS CHIP (header) — a status indicator, deliberately styled
   differently from the nav buttons next to it so it doesn't read as a
   clickable action.
============================================================================ */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  box-sizing: border-box;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-chip.status-on {
  background: #113315;
  color: #00cc66;
  border: 1px solid #00cc66;
  box-shadow: 0 0 10px #00cc6688;
}

.status-chip.status-on .status-dot {
  background: #00cc66;
  box-shadow: 0 0 6px #00cc66;
  animation: status-pulse 1.6s ease-in-out infinite;
}

.status-chip.status-off {
  background: #33000055;
  color: #ff6b6b;
  border: 1px solid #e53935;
  box-shadow: 0 0 10px rgba(229, 57, 53, 0.45);
}

.status-chip.status-off .status-dot {
  background: #e53935;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ============================================================================
   GRID + CARDS
============================================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: var(--card-border-hover);
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--red-bright);
}

.card p,
.card li {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: #d0d0d0;
}

.card li {
  padding: 6px 0;
  border-bottom: 1px solid var(--divider);
}

.card li:last-child {
  border-bottom: none;
}

/* ============================================================================
   LEADERBOARD
============================================================================ */
#leaderboardCard {
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid #330000;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 0 15px rgba(229, 57, 53, 0.25);
  backdrop-filter: blur(4px);
}

#leaderboardList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#leaderboardList li {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(229, 57, 53, 0.05);
  border-left: 3px solid #e53935;
  border-radius: 6px;
  color: #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: 0.2s ease;
}

#leaderboardList li:hover {
  background: rgba(229, 57, 53, 0.15);
  transform: translateX(4px);
}

.rank-badge {
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 6px;
  margin-right: 10px;
  color: #fff;
}

.rank-1 { background: linear-gradient(90deg, #ffd700, #ffb700); }
.rank-2 { background: linear-gradient(90deg, #c0c0c0, #a8a8a8); }
.rank-3 { background: linear-gradient(90deg, #cd7f32, #b56b2a); }
.rank-default { background: rgba(229, 57, 53, 0.4); }

.lb-username { flex: 1; margin-left: 10px; }
.lb-money { font-weight: bold; color: #ff6b6b; }

/* ============================================================================
   MAP
============================================================================ */
#dayzMap {
  width: 100%;
  height: 600px;
  border-radius: 12px;
  margin-top: 30px;
  overflow: hidden;
  background: #1a1a1a;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

/* ============================================================================
   FORM FIELDS (shared across every settings page)
============================================================================ */
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  background: var(--input-bg);
  color: white;
  border: 1px solid var(--input-border);
  padding: 7px 9px;
  border-radius: 7px;
  margin-top: 4px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--red);
}

textarea {
  font-family: inherit;
  resize: vertical;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.85rem;
  color: #ccc;
  margin-bottom: 2px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

/* Economy/Casino command cards (built dynamically by settings.js) */
.settings-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.toggle-label { color: #d0d0d0; font-size: 0.9rem; }

.config-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.config-fields label {
  display: block;
  font-size: 0.8rem;
  color: #ccc;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.checkbox-row label { margin: 0; color: #d0d0d0; font-size: 0.9rem; }

/* Labeled row with a switch on the right — server-wide rules, display
   toggles, gameplay flags, all one look everywhere they appear. */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
}

.toggle-row:last-child { border-bottom: none; }

/* ============================================================================
   TOGGLE SWITCH
============================================================================ */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #26262e;
  border: 1px solid #34343f;
  border-radius: 24px;
  transition: 0.2s ease;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: #ccc;
  border-radius: 50%;
  transition: 0.2s ease;
}

.switch input:checked + .slider {
  background: #3a0000;
  border-color: #e53935;
  box-shadow: 0 0 8px rgba(229, 57, 53, 0.4);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
  background: #ff6b6b;
}

/* ============================================================================
   MINI BUTTONS (compact row actions — lists of zones, items, tasks, etc.)
============================================================================ */
.mini-btn {
  background: #1c1c22;
  border: 1px solid #2e2e38;
  color: #e0e0e0;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 6px;
  transition: 0.15s ease;
}

.mini-btn:hover { border-color: var(--card-border-hover); color: #fff; }
.mini-btn.danger { border-color: rgba(229, 57, 53, 0.5); color: #ff8a80; }
.mini-btn.danger:hover { background: rgba(229, 57, 53, 0.14); border-color: var(--red); color: #fff; }

/* ============================================================================
   TABBED CARD (settings pages with multiple sub-sections — e.g. Killfeed)
============================================================================ */
.tabbed-card {
  padding: 0;
  overflow: hidden;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  background: #121218;
  border-bottom: 1px solid var(--card-border);
}

.tab-btn {
  background: none;
  border: none;
  color: #999;
  padding: 14px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: 0.15s ease;
}

.tab-btn:hover { color: #fff; }

.tab-btn.active {
  color: #ff6b6b;
  border-bottom-color: #e53935;
}

.tab-panel { display: none; padding: 20px; }
.tab-panel.active { display: block; }

.tabbed-card .save-btn {
  display: block;
  width: calc(100% - 40px);
  margin: 4px 20px 20px;
}

/* Cluster of immediate-action buttons (Start/Stop/Restart, etc.) */
.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.button-grid .logout-btn {
  width: 100%;
}

.tab-panel .section-label {
  color: #888;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 18px 0 8px;
}

.tab-panel .section-label:first-child { margin-top: 0; }

/* ============================================================================
   LIVE LOG (mirrors log.ADM, dashboard home page)
============================================================================ */
.live-log-card {
  margin-top: 20px;
}

.live-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.live-log-header h2 { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.live-log-status {
  font-size: 0.75rem;
  color: #666;
}

#liveLog {
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 12px 14px;
  height: 260px;
  overflow-y: auto;
  font-family: "Cascadia Code", "Consolas", "SF Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #b7f5b0;
  white-space: pre-wrap;
  word-break: break-word;
}

#liveLog .log-line { border-bottom: 1px solid rgba(255,255,255,0.03); padding: 1px 0; }

/* ============================================================================
   MINI LEADERBOARD STAT CARDS (dashboard home page)
============================================================================ */
.mini-lb-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.mini-lb-player {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-lb-value {
  font-size: 0.75rem;
  color: #ff6b6b;
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================================================
   IMAGE UPLOAD BUTTONS (added next to every image URL field by upload.js)
============================================================================ */
.upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-row > input[type="text"] { flex: 1; min-width: 0; }

.upload-row .upload-btn {
  margin: 4px 0 0 0;
  padding: 6px 12px;
  white-space: nowrap;
  font-size: 0.85rem;
}

.upload-thumb {
  width: 34px;
  height: 34px;
  margin-top: 4px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #550000;
  background: #0d0d0d;
  flex-shrink: 0;
}

.upload-status {
  font-size: 0.75rem;
  color: #999;
  min-height: 1em;
  margin-top: 4px;
}

.upload-status.error { color: #ff6b6b; }

/* ============================================================================
   GAMEPLAY SETTINGS PAGE
============================================================================ */
.gp-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 4px;
  padding: 10px 0;
  background: #121212;
  border-bottom: 1px solid #2a2a2a;
}

.gp-toolbar .logout-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.gp-count { color: #ff6b6b; font-size: 0.85rem; }
.gp-search { flex: 1; min-width: 200px; max-width: 360px; margin-top: 0 !important; margin-left: auto; }
.gp-status { min-height: 1.2em; margin: 8px 0 12px; font-size: 0.9rem; }

.gp-section { margin-bottom: 18px; }
.gp-blurb { color: #999 !important; font-size: 0.85rem !important; margin-bottom: 8px; }

.gp-advanced > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.gp-advanced > summary::-webkit-details-marker { display: none; }
.gp-advanced > summary::before { content: "▸"; color: #e53935; }
.gp-advanced[open] > summary::before { content: "▾"; }
.gp-sec-title { font-size: 1.2rem; color: #e53935; }
.gp-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border: 1px solid #550000;
  border-radius: 10px;
  color: #ff9d9d;
}

.gp-setting {
  padding: 14px 0;
  border-bottom: 1px solid #2a0000;
}
.gp-setting:last-child { border-bottom: none; }
.gp-setting.gp-changed {
  border-left: 3px solid #e53935;
  padding-left: 12px;
  margin-left: -15px;
  background: rgba(229, 57, 53, 0.06);
}

.gp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.gp-headtext { min-width: 0; }
.gp-label { font-weight: 600; color: #fff; font-size: 0.95rem; }
.gp-key { font-family: ui-monospace, Consolas, monospace; font-size: 0.72rem; color: #777; margin-top: 2px; }
.gp-desc { color: #b5b5b5; font-size: 0.85rem; margin-top: 6px; line-height: 1.45; }
.gp-state { font-size: 0.8rem; color: #d7a0a0; margin-top: 6px; }
.gp-ctl-inline { flex-shrink: 0; min-width: 120px; display: flex; justify-content: flex-end; }
.gp-ctl-inline select { min-width: 200px; }
.gp-ctl-block { margin-top: 10px; }
.gp-foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.gp-default { font-size: 0.75rem; color: #888; }

.gp-reset {
  background: none;
  border: none;
  color: #ff6b6b;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.gp-num { display: flex; align-items: center; gap: 8px; }
.gp-num input { width: 110px; margin-top: 0; }
.gp-unit { color: #888; font-size: 0.75rem; white-space: nowrap; }

.gp-months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.gp-wet { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.gp-month label { display: block; font-size: 0.72rem; color: #999; }
.gp-month input { margin-top: 2px; }
.gp-chart { margin-top: 12px; max-width: 520px; }
@media (max-width: 700px) {
  .gp-months { grid-template-columns: repeat(3, 1fr); }
  .gp-wet { grid-template-columns: repeat(2, 1fr); }
  .gp-head { flex-direction: column; }
  .gp-ctl-inline { justify-content: flex-start; }
}

.gp-colorbox { display: flex; flex-direction: column; gap: 8px; }
.gp-colorrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gp-color { width: 44px; height: 30px; padding: 0; border: 1px solid #550000; background: #0d0d0d; border-radius: 4px; cursor: pointer; }
.gp-alpha { width: 180px; }
.gp-swatch { width: 60px; height: 30px; border-radius: 4px; border: 1px solid #550000; }
.gp-code { color: #ccc; font-size: 0.8rem; }

/* ============================================================================
   EMBED IMAGES PAGE
============================================================================ */
.ei-group-title { margin: 22px 0 10px; color: #ff6b6b; font-size: 1rem; }
.ei-kind { margin-bottom: 14px; }
.ei-kind h3 { font-size: 1rem; color: #fff; }
.ei-kind .ei-desc { color: #999; font-size: 0.82rem; margin: 4px 0 12px; }
.ei-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ei-slot { background: #0d0d0d; border: 1px solid #2a0000; border-radius: 8px; padding: 10px; }
.ei-slot-name { font-size: 0.8rem; font-weight: 600; color: #e0e0e0; }
.ei-slot-help { font-size: 0.7rem; color: #888; margin: 2px 0 8px; min-height: 2.6em; }
.ei-preview {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #550000;
  border-radius: 6px;
  color: #666;
  font-size: 0.75rem;
  margin-bottom: 8px;
  overflow: hidden;
  background: #121212;
}
.ei-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ei-actions { display: flex; gap: 6px; }
.ei-actions .mini-btn { margin-left: 0; }
.ei-msg { font-size: 0.7rem; margin-top: 6px; min-height: 1em; color: #999; }
.ei-msg.error { color: #ff6b6b; }

/* ============================================================================
   SHARED PANELS — Bases / Backpacks / Airdrops (settings-systems page)
============================================================================ */
.bases-table-wrap { overflow-x: auto; }
.bases-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 10px; }
.bases-table th { text-align: left; color: #e53935; font-size: 0.75rem; padding: 6px 10px; border-bottom: 1px solid #2a2a2a; white-space: nowrap; }
.bases-table td { padding: 8px 10px; border-bottom: 1px solid #222; vertical-align: top; color: #d0d0d0; }
.bases-table a { color: #ff6b6b; text-decoration: none; }
.bases-table a:hover { text-decoration: underline; }
.bases-empty { color: #888; padding: 10px 0; }

.base-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.base-pill.ok { background: #1f3a24; color: #6fdc8c; }
.base-pill.warn { background: #40361a; color: #ffd166; }
.base-pill.bad { background: #4a1f1f; color: #ff6b6b; }
.base-pill.off { background: #2a2a2a; color: #999; }

.bases-sub { margin: 26px 0 4px; color: #fff; font-size: 0.95rem; }
.bases-sub:first-child { margin-top: 0; }
.bases-note { color: #888; font-size: 0.8rem; margin: 2px 0 0; }
.bases-settings + .bases-note { margin-top: 12px; }

/* Settings grid: short labels sit directly above equal-height boxes, so every
   box lines up on one row no matter how long its explanation is (the long
   explanation lives in the hover tooltip instead). */
.bases-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; margin-top: 12px; align-items: end; }
.bases-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: #aaa; white-space: nowrap; }
.bases-settings input[type=text],
.bases-settings input[type=number],
.bases-settings select { height: 34px; margin-top: 0; background: #111; border: 1px solid #2a2a2a; color: #fff; border-radius: 6px; padding: 0 9px; }
.bases-settings .bases-check { flex-direction: row; align-items: center; gap: 8px; height: 34px; color: #ddd; font-size: 0.85rem; }

.bases-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bases-btn { background: #262626; color: #ddd; border: 1px solid #333; border-radius: 6px; padding: 4px 9px; font-size: 0.75rem; cursor: pointer; }
.bases-btn:hover { border-color: #e53935; color: #fff; }
.bases-btn.danger:hover { background: #4a1f1f; }
.bases-save { margin-top: 14px; background: #e53935; color: #fff; border: 0; border-radius: 6px; padding: 8px 16px; font-weight: 700; cursor: pointer; }
.bases-msg { margin-left: 10px; font-size: 0.8rem; color: #aaa; }

.bp-bar { width: 140px; height: 8px; background: #2a2a2a; border-radius: 999px; overflow: hidden; margin-top: 5px; }
.bp-bar > span { display: block; height: 100%; background: #e53935; }
.bp-manage { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.bp-manage select, .bp-manage input { width: auto; margin-top: 0; background: #111; border: 1px solid #2a2a2a; color: #fff; border-radius: 6px; padding: 7px 9px; }

.ap-editor { margin-top: 16px; padding: 14px; border: 1px solid #2a2a2a; border-radius: 8px; background: #141414; }
.ap-editor[hidden] { display: none; }
.ap-obj input { width: 82px; margin-top: 0; background: #111; border: 1px solid #2a2a2a; color: #fff; border-radius: 6px; padding: 5px 6px; }
.ap-obj input.ap-name { width: 260px; }
.ap-hint { color: #888; font-size: 0.78rem; margin: 6px 0 0; }
.ap-import { width: 100%; min-height: 90px; margin-top: 8px; background: #111; border: 1px solid #2a2a2a; color: #ddd; border-radius: 6px; padding: 8px; font-family: monospace; font-size: 0.75rem; }
.ap-contents { color: #aaa; font-size: 0.78rem; }

/* ============================================================================
   ANALYTICS CARDS (main dashboard — numbers only, settings live on their own page)
============================================================================ */
.community-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 20px;
  margin-top: 25px;
}

.an-card { display: flex; flex-direction: column; }

.an-card h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.an-card h2 .an-manage { font-size: 0.75rem; font-weight: 500; color: #ff6b6b; text-decoration: none; white-space: nowrap; }
.an-card h2 .an-manage:hover { text-decoration: underline; }

.an-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 6px; }
.an-tile { background: #131318; border: 1px solid var(--card-border); border-radius: 10px; padding: 9px 8px; text-align: center; min-width: 0; }
.an-tile b { display: block; font-size: 1.25rem; color: #fff; line-height: 1.2; }
.an-tile span { display: block; margin-top: 2px; font-size: 0.68rem; color: #888; text-transform: uppercase; letter-spacing: 0.04em; }
.an-tile.warn b { color: #ffd166; }
.an-tile.bad b { color: #ff6b6b; }
.an-tile.ok b { color: #6fdc8c; }

.an-sub { margin: 14px 0 6px; font-size: 0.72rem; color: #888; text-transform: uppercase; letter-spacing: 0.05em; }
.an-rows { display: flex; flex-direction: column; }
.an-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #222; font-size: 0.85rem; color: #d0d0d0; }
.an-row:last-child { border-bottom: none; }
.an-row .an-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-row .an-meta { color: #888; font-size: 0.78rem; white-space: nowrap; }
.an-empty { color: #888; font-size: 0.85rem; padding: 6px 0; }

.an-bars { display: flex; flex-direction: column; gap: 6px; }
.an-bar { display: grid; grid-template-columns: 52px 1fr 26px; align-items: center; gap: 8px; font-size: 0.78rem; color: #aaa; }
.an-bar .an-track { height: 8px; background: #2a2a2a; border-radius: 999px; overflow: hidden; }
.an-bar .an-track > span { display: block; height: 100%; background: #e53935; }
.an-bar .an-count { text-align: right; color: #ddd; }


/* ============================================================================
   USER SETTINGS (header profile card): compact density + reduced motion.
   Toggled by nav.js as classes on <html>.
============================================================================ */
html.rf-compact .card { padding: 12px 14px; }
html.rf-compact .map-view-card { padding: 0; }
html.rf-compact .card h2 { margin-bottom: 6px; padding-bottom: 3px; font-size: 1.05rem; }
html.rf-compact .card li { padding-top: 4px; padding-bottom: 4px; }
html.rf-compact .td-tile { padding: 8px 10px 7px; gap: 1px; }
html.rf-compact .td-value { min-height: 1.5rem; font-size: 1.4rem; }
html.rf-compact .td-sub { min-height: 0; }
html.rf-compact .td-grid { gap: 8px; margin-bottom: 8px; }
html.rf-compact .dash-head { margin-top: 18px; margin-bottom: 8px; }
html.rf-compact .an-row { padding: 3px 0; }
html.rf-compact .bases-table th { padding: 4px 8px; }
html.rf-compact .bases-table td { padding: 4px 8px; }
html.rf-compact #liveLog .log-line { padding: 0; }
html.rf-compact .map-toggle-row { padding: 2px 0; }
html.rf-compact .page { padding-top: 18px; padding-bottom: 32px; }

html.rf-reduce-motion *,
html.rf-reduce-motion *::before,
html.rf-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  .rf-profile-card { animation: none; }
}

/* ============================================================================
   PLAYER PROFILE PAGE (profile.html) — "Profile Mode": the signed-in
   admin/owner's own player data, read from the same services the Discord
   /profile command uses. Visual language ported from the player-dashboard
   mockup (Profile / Bank / Job & Promotion / DayZ Feed) so the real page
   matches it exactly rather than reinventing its own component set.
============================================================================ */
.h2-note { color: var(--text-faint); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: .72rem; margin-left: 6px; }
.pp-empty { color: var(--text-dim); font-size: .88rem; padding: 6px 0; }
.pp-note { color: #888; font-size: .78rem; margin-top: 10px; }

/* ---- tab bar (Profile / DayZ Feed) ---- */
.tabbar-wrap { margin-bottom: 16px; }
.tabbar {
  display: flex; gap: 4px; background: #121218; border: 1px solid var(--card-border);
  border-radius: var(--radius-pill); padding: 4px; max-width: 360px;
}
.tabbar button {
  flex: 1; border: 0; background: transparent; color: #9a9aa6;
  font-weight: 700; font-size: .82rem; padding: 10px 8px; border-radius: var(--radius-pill);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: .15s ease;
}
.tabbar button.active { background: var(--red); color: #fff; box-shadow: 0 0 14px rgba(229,57,53,.35); }
.tabpanel[hidden] { display: none; }

/* Global safety net: the browser's own [hidden] rule only lives in the UA
   stylesheet, so ANY author rule below that sets `display` on the same
   element (however it's selected) silently wins over it. That's what let a
   locked casino game's bet box/Play button stay visible+clickable even
   after JS set element.hidden = true. `!important` here restores the
   behavior "hidden" is supposed to have everywhere on this page, no matter
   what more specific display rules exist. */
[hidden] { display: none !important; }

/* ---- two-column layout for the Profile tab (renamed from the mockup's
   .grid/.grid.split so it can't collide with the site-wide .grid card grid) ---- */
.pf-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) {
  .pf-grid.split { grid-template-columns: 340px 1fr; align-items: start; }
}
.pf-col { display: flex; flex-direction: column; gap: 14px; }

/* ---- profile card (chip-based) ---- */
.p-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.p-avatar {
  width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg,#3a3a44,#222228); border: 2px solid var(--red);
  box-shadow: 0 0 14px rgba(229,57,53,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700; color: #ddd;
}
.p-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-name { font-size: 1.1rem; font-weight: 700; color: #fff; }
.p-tag { color: var(--text-dim); font-size: .78rem; margin-top: 2px; }

.p-level { margin-bottom: 16px; }
.p-level .row { display: flex; justify-content: space-between; font-size: .76rem; color: var(--text-dim); margin-bottom: 6px; }
.p-level .row b { color: #fff; }
.bar-track { height: 8px; border-radius: 999px; background: #23232c; overflow: hidden; }
.bar-fill { height: 100%; background: var(--red); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip-row:last-of-type { margin-bottom: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: #1c1c24; border: 1px solid #2c2c38; font-size: .74rem; color: #eee;
  white-space: nowrap;
}
.chip b { color: #fff; font-family: ui-monospace, Consolas, monospace; }
.chip.money { border-color: rgba(255,209,102,.35); } .chip.money b { color: #ffd166; }
.chip.kd { border-color: rgba(229,57,53,.4); } .chip.kd b { color: var(--red-bright); }

.p-facts { border-top: 1px solid var(--divider); padding-top: 12px; margin-top: 14px; }
.p-fact { display: flex; justify-content: space-between; font-size: .8rem; padding: 5px 0; gap: 10px; }
.p-fact dt { color: var(--text-dim); flex-shrink: 0; } .p-fact dd { color: #eee; text-align: right; }

.p-promo-banner { margin-bottom: 14px; }

/* ---- quick actions ---- */
.actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 520px) { .actions-grid { grid-template-columns: repeat(3, 1fr); } }
.action-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: #1c1c22; border: 1px solid #2c2c38; border-radius: 12px;
  padding: 12px 12px; min-height: 78px; transition: .15s ease; cursor: pointer;
  font: inherit; color: inherit; text-align: left; width: 100%;
}
.action-btn:active { border-color: var(--red); background: rgba(229,57,53,.08); }
.action-btn .icon { font-size: 1.15rem; }
.action-btn .lbl { font-weight: 700; font-size: .84rem; color: #fff; }
.action-btn .hint { font-size: .7rem; color: var(--text-dim); }
.action-btn .hint.ready { color: #6fdc8c; }
.action-btn .hint.cd { color: #ffb86b; }
.action-btn .hint.locked { color: var(--text-faint); }
.action-btn.locked { opacity: .5; cursor: default; }
.action-btn.loading { opacity: .65; pointer-events: none; }

/* ---- bank ---- */
.bank-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.bank-tile { background: #131318; border: 1px solid var(--card-border); border-radius: 12px; padding: 12px; }
.bank-tile .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.bank-tile .val { font-size: 1.35rem; font-weight: 800; color: #ffd166; margin-top: 2px; }
.seg { display: flex; background: #121218; border: 1px solid var(--card-border); border-radius: var(--radius-pill); padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: transparent; color: #9a9aa6; font-weight: 700; font-size: .8rem; padding: 8px; border-radius: var(--radius-pill); cursor: pointer; }
.seg button.on { background: var(--red); color: #fff; }
.amount-row { display: flex; gap: 8px; margin-bottom: 8px; }
.amount-row input {
  flex: 1; min-width: 0; background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 9px; color: #fff; padding: 10px 12px; font-size: .9rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 18px; border-radius: var(--radius-pill);
  background: var(--red); border: 1px solid var(--red); color: #fff;
  font-weight: 700; font-size: .84rem; white-space: nowrap; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: default; }
.quick-pct { display: flex; gap: 6px; }
.quick-pct button { flex: 1; background: #1c1c22; border: 1px solid #2c2c38; color: #ddd; border-radius: 999px; padding: 6px; font-size: .72rem; font-weight: 600; cursor: pointer; }
.bank-msg { font-size: .78rem; margin-top: 8px; }
.bank-msg.err { color: var(--red-bright); }
.bank-msg.ok { color: #6fdc8c; }

/* ---- job & promotion ---- */
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.job-title { font-size: 1rem; font-weight: 700; color: #fff; }
.job-title .tier { color: var(--text-dim); font-weight: 600; font-size: .8rem; }
.job-pay { background: rgba(255,209,102,.12); border: 1px solid rgba(255,209,102,.35); color: #ffd166; font-size: .76rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.promo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: rgba(229,57,53,.12); border: 1px solid rgba(229,57,53,.4); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px;
}
.promo-banner .t { font-weight: 700; color: #fff; font-size: .86rem; }
.promo-banner .t small { display: block; color: #ff9c99; font-weight: 500; font-size: .74rem; margin-top: 2px; }
.prog-row { margin-bottom: 10px; }
.prog-row .row { display: flex; justify-content: space-between; font-size: .74rem; color: var(--text-dim); margin-bottom: 5px; }
.unlock-list { border-top: 1px solid var(--divider); margin-top: 14px; padding-top: 10px; }
.unlock-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .82rem; }
.unlock-row .u-ic { width: 20px; text-align: center; flex-shrink: 0; }
.unlock-row.done { color: #ddd; } .unlock-row.done .u-ic { color: #6fdc8c; }
.unlock-row.locked { color: var(--text-dim); } .unlock-row.locked .u-ic { color: var(--text-faint); }

/* ---- backpack / starter kit (shared chip-list styling) ---- */
.bp-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.bp-badge { background: rgba(229,57,53,.12); border: 1px solid rgba(229,57,53,.4); color: var(--red-bright); font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.bp-slots { color: var(--text-dim); font-size: .78rem; }
.bp-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.bp-item { background: #1c1c22; border: 1px solid #2c2c38; border-radius: 8px; padding: 5px 10px; font-size: .76rem; color: #ddd; }
.bp-progress .row { display: flex; justify-content: space-between; font-size: .74rem; color: var(--text-dim); margin-bottom: 5px; }

/* ---- bases ---- */
.base-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.base-row:last-of-type { border-bottom: none; }
.base-name { font-weight: 700; font-size: .86rem; color: #fff; }
.base-meta { color: var(--text-dim); font-size: .74rem; margin-top: 1px; }
.base-pill { margin-left: auto; flex-shrink: 0; font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.base-pill.ok { background: rgba(111,220,140,.14); color: #6fdc8c; }
.base-pill.warn { background: rgba(255,209,102,.14); color: #ffd166; }
.base-pill.bad { background: rgba(229,57,53,.14); color: var(--red-bright); }
.bases-note { color: var(--text-faint); font-size: .76rem; margin-top: 12px; border-top: 1px solid var(--divider); padding-top: 10px; }

/* ---- casino games ---- */
.casino-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.casino-row { display: flex; align-items: center; gap: 10px; background: #1c1c22; border: 1px solid #2c2c38; border-radius: 10px; padding: 10px 12px; }
.casino-row.can-play { border-color: rgba(111,220,140,.35); }
.casino-row .cg-name { font-weight: 700; font-size: .84rem; color: #fff; flex: 1; text-transform: capitalize; }
.casino-row .cg-meta { font-size: .7rem; color: var(--text-dim); }
.casino-row .cg-badge { font-size: .66rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.casino-row .cg-badge.locked { background: rgba(140,140,152,.14); color: var(--text-dim); }
.casino-row .cg-badge.discord { background: rgba(255,209,102,.14); color: #ffd166; }
/* Only an unlocked AND live-here game ever gets a Play affordance — every
   other row is badge-only, with no play controls in the DOM at all (not
   just visually hidden), so there's nothing for a locked game to leak. */
.cg-play {
  border: 1px solid rgba(111,220,140,.4); background: rgba(111,220,140,.14); color: #6fdc8c;
  font-size: .7rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  white-space: nowrap; transition: .15s ease;
}
.cg-play:hover { background: rgba(111,220,140,.26); }

.casino-active { margin-top: 12px; border-top: 1px solid var(--divider); padding-top: 12px; }
.casino-active-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.casino-active-head .t { font-weight: 700; font-size: .9rem; color: #fff; }
.casino-close {
  border: 0; background: #1c1c22; color: var(--text-dim); width: 26px; height: 26px;
  border-radius: 50%; cursor: pointer; font-size: .78rem; line-height: 1; flex-shrink: 0;
}
.casino-close:hover { color: #fff; background: #26262e; }
.casino-bet-row { display: flex; gap: 8px; }
.casino-bet-row input {
  flex: 1; min-width: 0; background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: 9px; color: #fff; padding: 10px 12px; font-size: .9rem;
}

/* Buttons replayed live from the game's own Discord components (Hit/Stand/
   tile clicks/Cash Out/...) — rendered straight from the streamed frame's
   `components`, same shape discord.js buttons serialize to. */
.casino-buttons { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.casino-btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.casino-act-btn {
  flex: 1; min-width: 56px; border: 1px solid #2c2c38; background: #1c1c22; color: #eee;
  font-weight: 700; font-size: .78rem; padding: 9px 10px; border-radius: 9px; cursor: pointer;
  transition: .15s ease;
}
.casino-act-btn:hover:not(:disabled) { border-color: var(--red); }
.casino-act-btn:disabled { opacity: .45; cursor: default; }
.casino-act-btn.cb-style-1 { background: rgba(88,101,242,.16); border-color: rgba(88,101,242,.4); color: #8ea1ff; }
.casino-act-btn.cb-style-3 { background: rgba(111,220,140,.14); border-color: rgba(111,220,140,.4); color: #6fdc8c; }
.casino-act-btn.cb-style-4 { background: rgba(229,57,53,.14); border-color: rgba(229,57,53,.4); color: var(--red-bright); }

/* ---- live stream / "animation" display box (economy actions + casino) ---- */
.stream-card { margin-top: 14px; }
.stream-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.stream-head .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #6fdc8c; box-shadow: 0 0 6px #6fdc8c;
  flex-shrink: 0; animation: pf-pulse 1.6s ease-in-out infinite;
}
.stream-head .dot.idle { background: #4a4a56; box-shadow: none; animation: none; }
.stream-head .dot.err { background: var(--red-bright); box-shadow: 0 0 6px var(--red-bright); animation: none; }
@keyframes pf-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.stream-head .t { font-weight: 700; font-size: .86rem; color: #fff; flex: 1; }
.stream-head .status { font-size: .7rem; color: var(--text-dim); }
.stream-embed {
  border-left: 4px solid var(--red); background: #121218; border-radius: 0 10px 10px 0;
  padding: 12px 14px; min-height: 64px; transition: border-color .2s ease;
}
.stream-embed .se-title { font-weight: 700; color: #fff; font-size: .92rem; margin-bottom: 4px; }
.stream-embed .se-desc { color: #ccc; font-size: .82rem; white-space: pre-wrap; line-height: 1.5; }
.stream-embed .se-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.stream-embed .se-field-name { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 2px; }
.stream-embed .se-field-value { font-size: .82rem; color: #eee; }
.stream-empty { color: var(--text-dim); font-size: .82rem; padding: 16px 0; text-align: center; }
.stream-note { color: #ff9c99; font-size: .8rem; margin-top: 8px; }

/* ---- DayZ feed tab ---- */
.feed-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .feed-layout { grid-template-columns: 220px 1fr; align-items: start; } }

.feed-select-list { display: flex; flex-direction: column; gap: 6px; }
.feed-select-row {
  display: flex; align-items: center; gap: 10px; background: #1c1c22; border: 1px solid #2c2c38;
  border-radius: 10px; padding: 9px 12px; cursor: pointer; user-select: none; transition: .15s ease;
}
.feed-select-row:hover { border-color: #3a3a48; }
.fs-check {
  width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid #4a4a56; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .62rem; color: transparent;
  transition: .15s ease;
}
.feed-select-row.on .fs-check { background: var(--red); border-color: var(--red); color: #fff; }
.fs-name { font-size: .8rem; font-weight: 600; color: #ddd; flex: 1; }
.feed-select-row.on .fs-name { color: #fff; }

.feed-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .feed-cards { grid-template-columns: 1fr 1fr; } }

.feed-card { display: flex; flex-direction: column; height: 360px; }
.feed-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-shrink: 0; }
.feed-card-head .dot { width: 7px; height: 7px; border-radius: 50%; background: #6fdc8c; box-shadow: 0 0 6px #6fdc8c; flex-shrink: 0; animation: pf-pulse 1.6s ease-in-out infinite; }
.feed-card-head .t { font-weight: 700; font-size: .84rem; color: #fff; flex: 1; }
.feed-card-head .count { font-size: .68rem; color: var(--text-dim); }
.feed-scroll { overflow-y: auto; flex: 1; min-height: 0; padding-right: 2px; }

/* Slim, modern, collapsed-by-default event rows — click (or Enter/Space)
   expands one in place to show its full detail without navigating away or
   losing your place in the list. */
.feed-item {
  border-left: 3px solid #444; background: #121218; border-radius: 0 8px 8px 0;
  padding: 8px 10px; margin-bottom: 6px; cursor: pointer; transition: background .15s ease;
}
.feed-item:hover { background: #17171d; }
.feed-item.kill { border-left-color: var(--red-bright); }
.feed-item.event { border-left-color: #ffd166; }
.feed-item.damage { border-left-color: #ff9c4a; }
.feed-item.connect { border-left-color: #6fdc8c; }
.feed-item.bounty { border-left-color: #b98cff; }
.feed-item.admin { border-left-color: #7ab8ff; }

.fi-top { display: flex; align-items: baseline; gap: 8px; }
.fi-summary {
  font-size: .8rem; font-weight: 600; color: #eee; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-item.expanded .fi-summary { white-space: normal; }
.fi-meta { font-size: .68rem; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }
.fi-time { font-size: .66rem; color: var(--text-faint); white-space: nowrap; flex-shrink: 0; }
.fi-caret { font-size: .6rem; color: var(--text-faint); flex-shrink: 0; transition: transform .15s ease; }
.feed-item.expanded .fi-caret { transform: rotate(90deg); }

.fi-detail { display: none; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--divider); }
.feed-item.expanded .fi-detail { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.fi-detail-k { font-size: .68rem; color: var(--text-dim); }
.fi-detail-v { font-size: .74rem; color: #eee; text-align: right; word-break: break-word; }

@media (max-width: 520px) {
  .bank-tiles { grid-template-columns: repeat(2, 1fr); }
}
