/*
 * Account dashboard (/profile), laid out like the typical.wtf desktop app:
 * a window with a title bar, a settings-style section list, the content
 * stage, a side panel (like pot ai) and an action bar at the bottom.
 *
 * Replaces the page's old inline styles. Colours read nf-design's tokens
 * (--bg, --fg, --line, --accent…), which typical-app.css points at the app's
 * palette, so a user's own client theme still recolours the dashboard.
 * Class names and states toggled by the page script are kept: tab-panel /
 * active, modal-backdrop open / aria-hidden, download-ready open,
 * luck-card opening / revealed, nff-* open / unread / playing, fchip / active.
 */

/* ===================== window ===================== */
.dash {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100% - 2 * var(--page-pad), 1360px);
  min-height: calc(100svh - var(--header-height) - 48px);
  margin: 24px auto 48px;
  padding: 0 12px;
  border-radius: var(--r-window);
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.45);
}

/* ---------- title bar ---------- */
.dash-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  border-bottom: 1px solid var(--line-2);
}

.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  max-width: 260px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-4);
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.dash-tab i {
  color: var(--fg-3);
  font-size: 11px;
}

.dash-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-spacer {
  flex: 1;
}

.dash-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 4px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--fg-2);
  font: 400 12px var(--mono);
  white-space: nowrap;
}

.dash-user img {
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  object-fit: cover;
  background: var(--bg-3);
}

/* buttons in the title bar look like the app's window controls */
.dash-titlebar .pill-btn {
  min-height: 32px;
}

.dash-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 12px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.dash-icon-btn:hover {
  border-color: rgb(255 107 111 / 0.4);
  background: rgb(255 107 111 / 0.08);
  color: #ff6b6f;
}

/* ---------- body: nav | content | side ---------- */
.dash-body {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 280px;
  gap: 12px;
  min-height: 0;
  padding: 12px 0;
}

/* section list = the settings navigation in the app */
.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: start;
  position: sticky;
  top: calc(var(--header-height) + 12px);
}

.dash-nav-label {
  margin: 16px 0 4px;
  padding: 0 12px;
  color: var(--fg-3);
  font: 500 12px/16px var(--sans);
  opacity: 0.8;
}

.dash-nav-label:first-child {
  margin-top: 4px;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-3);
  font: 500 13px var(--sans);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.side-item:hover {
  background: var(--bg-2);
  color: var(--fg);
}

.side-item.active {
  border-color: var(--border);
  background: var(--bg-4);
  color: var(--fg);
}

.side-icon {
  width: 14px;
  flex: none;
  font-size: 12px;
  text-align: center;
}

/* game logos: small marks; in the section list they sit at the end of the row */
.mc-logo,
.brand-logo {
  width: 14px;
  height: 14px;
  flex: none;
  object-fit: contain;
}

.side-item .mc-logo,
.side-item .brand-logo {
  margin-left: auto;
  opacity: 0.7;
}

.side-item.active .mc-logo,
.side-item.active .brand-logo {
  opacity: 1;
}

#nffBadge,
#purchasesBadge {
  margin-left: auto !important;
  padding: 0 6px !important;
  border-radius: var(--r-pill) !important;
  background: var(--accent) !important;
  color: var(--accent-ink, #0a0a0a) !important;
  font: 600 10.5px/16px var(--mono) !important;
}

/* ---------- content stage ---------- */
.main,
.dash-content {
  min-width: 0;
  padding: 20px 24px 32px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: dash-in 220ms var(--ease) both;
}

@keyframes dash-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  color: var(--fg);
  font: 600 20px/1.2 var(--sans);
  letter-spacing: -0.02em;
}

.section-title > i {
  color: var(--fg-3);
  font-size: 14px;
}

.section-note {
  max-width: 620px;
  margin-bottom: 20px;
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.55;
}

/* ---------- side panel (like pot ai) ---------- */
.right-rail,
.dash-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: start;
  position: sticky;
  top: calc(var(--header-height) + 12px);
}

.avatar-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
}

.avatar {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
  object-fit: cover;
}

.avatar-card-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.avatar-card-label {
  color: var(--fg-3);
  font: 500 12px/16px var(--sans);
}

.user-chip {
  overflow: hidden;
  color: var(--fg);
  font: 600 14px var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-card {
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
}

.rail-title {
  margin-bottom: 12px;
  color: var(--fg-3);
  font: 500 12px/16px var(--sans);
}

.rail-text {
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.5;
}

.subscription-list {
  display: grid;
  gap: 8px;
}

.subscription-item {
  position: relative;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
}


.subscription-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.subscription-name {
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.subscription-status {
  color: var(--fg-3);
  font: 400 12px var(--mono);
  overflow-wrap: anywhere;
}

/* ---------- action bar (like the app's) ---------- */
.dash-actionbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 0;
  border-top: 1px solid var(--line-2);
}

.dash-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
  font: 500 13px var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.dash-action:hover {
  border-color: var(--border);
  background: var(--bg-4);
  color: var(--fg);
}

.dash-action:active {
  transform: scale(0.98);
}

.dash-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* "download launcher" plays the part of execute: the highlighted action */
.dash-action--primary {
  border-color: var(--border-active, #4a4a4a);
  color: var(--fg);
}

.dash-action--primary::before {
  content: '\f019';
  font: 900 11px 'Font Awesome 6 Free';
}

.dash-action i,
.dash-action .freeze-icon {
  font-size: 11px;
  color: var(--fg-3);
}

.download-ready {
  display: none;
}

.download-ready.open {
  display: inline-flex;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
  font-weight: 600;
}

.dash-status {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 160px;
  padding: 0 8px;
}

.download-status {
  overflow: hidden;
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-status:empty {
  display: none;
}

.dash-chip {
  margin-left: auto;
  color: var(--fg-3);
  font-size: 12.5px;
  white-space: nowrap;
}

/* ===================== controls ===================== */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg-2);
  font: 500 13px var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.pill-btn:hover {
  border-color: var(--border);
  background: var(--bg-4);
  color: var(--fg);
}

.pill-btn:active {
  transform: scale(0.98);
}

/* "orange" marks each panel's main action: the app's bordered primary */
.pill-btn.orange {
  border-color: var(--border-active, #4a4a4a);
  color: var(--fg);
}

.pill-btn.primary-save {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
  font-weight: 600;
}

.pill-btn.primary-save:hover {
  background: var(--accent-deep);
}

.pill-btn.red {
  color: #ff6b6f;
}

.pill-btn.red:hover {
  border-color: rgb(255 107 111 / 0.4);
  background: rgb(255 107 111 / 0.08);
}

.pill-btn:disabled,
.outline-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.outline-btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-2);
  font: 500 13px var(--sans);
  cursor: pointer;
}

/* inputs = the app's text fields */
.config-input,
.config-textarea,
.key-input,
.nff-code-input,
.nff-chat-input,
.media-input,
.lb-select,
.lb-size-custom input {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg);
  font: 400 13px var(--mono);
  outline: none;
  transition: border-color var(--dur) var(--ease);
}

.config-input:focus,
.config-textarea:focus,
.key-input:focus,
.nff-code-input:focus,
.nff-chat-input:focus,
.media-input:focus,
.lb-select:focus,
.lb-size-custom input:focus {
  border-color: var(--border-active, #4a4a4a);
}

.config-input::placeholder,
.key-input::placeholder,
.nff-code-input::placeholder,
.nff-chat-input::placeholder,
.media-input::placeholder {
  color: var(--fg-3);
  opacity: 0.7;
}

.config-textarea {
  grid-column: 1 / -1;
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

/* ===================== personal data ===================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.form-row.full {
  grid-column: 1 / -1;
}

.label {
  display: block;
  margin-bottom: 8px;
  color: var(--fg-3);
  font: 500 12px/16px var(--sans);
}

.field {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.hint {
  margin: -4px 0 8px;
  color: var(--fg-3);
  font-size: 12.5px;
}

/* stats = small tiles, mono label over the value */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stats > div {
  min-width: 0;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.stat-label {
  margin-bottom: 6px;
  color: var(--fg-3);
  font: 500 12px/16px var(--sans);
}

.stat-value {
  color: var(--fg);
  font: 600 15px/1.35 var(--sans);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ===================== lists: configs, friends ===================== */
.config-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

#friendsPanel .config-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.referrals-toolbar {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.config-status {
  min-height: 0;
  margin-bottom: 8px;
  color: var(--fg-3);
  font-size: 12.5px;
  line-height: 1.45;
}

.config-status:empty {
  margin: 0;
}

.config-list,
.referral-list {
  display: grid;
  gap: 6px;
}

/* rows of a list = tree items in the app's file manager */
.config-card,
.referral-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
  transition: border-color var(--dur) var(--ease);
}

.config-card:hover,
.referral-card:hover {
  border-color: var(--border);
}

.config-name,
.referral-name {
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.config-meta {
  margin-top: 2px;
  color: var(--fg-3);
  font: 400 12px var(--mono);
  line-height: 1.45;
}

.config-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
  font: 400 11px var(--mono);
}

.config-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.config-actions .pill-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

.friend-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.friend-skin {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--r-sm);
  image-rendering: pixelated;
}

/* ===================== themes ===================== */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.theme-field {
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
  cursor: pointer;
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-color {
  width: 40px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  cursor: pointer;
}

.theme-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.theme-color::-webkit-color-swatch {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.theme-color::-moz-color-swatch {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.theme-sync-note {
  margin-top: 12px;
  color: var(--fg-3);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ===================== referrals ===================== */
.referral-progress-note {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.55;
}

/* levels = the theme cards in the app's settings */
.referral-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.referral-level {
  position: relative;
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.referral-level.active {
  border-color: var(--border-active, #4a4a4a);
  background: var(--bg-4);
}

.referral-level.active::after {
  content: '';
  position: absolute;
  top: 16px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--live);
  box-shadow: 0 0 0 3px var(--live-soft);
}

.referral-level-title {
  margin-bottom: 8px;
  color: var(--fg-3);
  font: 400 12px/16px var(--mono);
}

.referral-level-main {
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
}

.referral-level-sub {
  margin-top: 8px;
  color: var(--fg-3);
  font-size: 12px;
}

.referral-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
  color: var(--fg-3);
  font: 400 12px var(--mono);
}

/* progress = the app's slider track */
.referral-progress-bar {
  height: 6px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--bg-4);
}

.referral-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 300ms var(--ease);
}

.referrals-stats {
  margin: 16px 0;
}

.referral-card {
  grid-template-columns: 36px minmax(0, 1fr) auto;
}

.referral-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--bg-4);
  object-fit: cover;
}

.referral-earned {
  margin-top: 2px;
  color: var(--fg-3);
  font: 400 12px var(--mono);
}

.referral-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--fg-2);
  font-size: 12px;
  white-space: nowrap;
}


.withdraw-note {
  margin: -4px 0 12px;
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1.45;
}

/* ===================== try luck ===================== */
.luck-status {
  min-height: 20px;
  margin-bottom: 12px;
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.5;
}

.luck-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.luck-card {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 200px;
  padding: 12px;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform 180ms var(--ease);
}

.luck-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 30%, rgb(0 0 0 / 0.55));
  transition: background var(--dur) var(--ease);
}

.luck-card::after {
  content: '';
  position: absolute;
  inset: -12px;
  z-index: 0;
  background-image: var(--luck-bg);
  background-position: center;
  background-size: cover;
  filter: blur(4px) saturate(0.85);
  transform: scale(1.03);
}

.luck-card > div {
  position: relative;
  z-index: 2;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid rgb(255 255 255 / 0.12);
  background: rgb(10 10 10 / 0.72);
  backdrop-filter: blur(12px);
}

.luck-card:hover {
  border-color: var(--border-active, #4a4a4a);
  transform: translateY(-2px);
}

.luck-card:disabled {
  cursor: not-allowed;
  transform: none;
}

.luck-card.opening {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.luck-card.opening::before {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.04), rgb(255 255 255 / 0.3));
}

.luck-card.revealed {
  border-color: var(--accent);
}

.luck-card.revealed::before {
  background: var(--luck-card-revealed-overlay, linear-gradient(180deg, transparent, rgb(0 0 0 / 0.65)));
}

.luck-card-title {
  margin-bottom: 4px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.luck-card-text {
  color: rgb(255 255 255 / 0.72);
  font-size: 12.5px;
  line-height: 1.4;
}

/* ===================== friends (in-client) ===================== */
.nff-code-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.nff-code-label {
  margin-bottom: 4px;
  color: var(--fg-3);
  font: 400 12px var(--mono);
}

.nff-code-val {
  color: var(--fg);
  font: 600 18px var(--mono);
  letter-spacing: 0.2em;
}

.nff-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  flex: none;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
  font: 500 12.5px var(--sans);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.nff-copy-btn:first-of-type {
  margin-left: auto;
}

.nff-copy-btn:hover {
  border-color: var(--border);
  color: var(--fg);
}

.nff-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.nff-code-input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.nff-status {
  min-height: 18px;
  margin-bottom: 8px;
  color: var(--fg-3);
  font-size: 12.5px;
}

.nff-section-label {
  margin: 20px 0 8px;
  color: var(--fg-3);
  font: 400 12px/16px var(--mono);
}

.nff-empty {
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line);
  color: var(--fg-3);
  font-size: 12.5px;
}

.nff-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.nff-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--bg-4);
  object-fit: cover;
}

.nff-name {
  flex: 1;
  min-width: 0;
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 600;
}

.nff-sub {
  color: var(--fg-3);
  font-size: 12px;
}

.nff-actions {
  display: flex;
  flex: none;
  gap: 6px;
}

.nff-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
  font: 500 12px var(--sans);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.nff-btn:hover {
  border-color: var(--border);
  color: var(--fg);
}

.nff-btn.accept {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
}

.nff-btn.remove {
  color: #ff6b6f;
}

.nff-btn.remove:hover {
  border-color: rgb(255 107 111 / 0.4);
  background: rgb(255 107 111 / 0.08);
}

.nff-online-dot {
  display: inline-block;
  width: 12px;
  flex: none;
  margin-right: 4px;
  color: var(--fg-3);
  font-size: 9px;
  text-align: center;
}

.nff-online-dot.playing {
  color: var(--live);
}

.nff-server-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: var(--fg-3);
  font-size: 11.5px;
}

.nff-server-nick {
  color: var(--fg-2);
  font-weight: 600;
}

.nff-server-sub {
  padding: 0 6px;
  border-radius: var(--r-xs);
  background: var(--bg-4);
  color: var(--fg-2);
  font: 400 10.5px var(--mono);
}

.nff-unread {
  flex: none;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
  font: 600 10.5px/16px var(--mono);
}

/* message bell in the header */
.nff-bell-wrap {
  position: relative;
  display: inline-flex;
}

.nff-bell-btn {
  position: relative;
}

.nff-bell-btn.has-unread {
  color: var(--fg) !important;
  animation: bell-ring 600ms var(--ease);
}

@keyframes bell-ring {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-16deg); }
  40% { transform: rotate(14deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(4deg); }
}

.nff-bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  min-width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--live);
  color: transparent;
  font-size: 0;
  pointer-events: none;
}

.nff-notif-drop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 9100;
  display: none;
  flex-direction: column;
  width: 300px;
  overflow: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-3);
  box-shadow: var(--shadow-lg);
}

.nff-notif-drop.open {
  display: flex;
}

.nff-notif-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-3);
  font: 400 12px var(--mono);
}

.nff-notif-list {
  max-height: 320px;
  overflow-y: auto;
}

.nff-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.nff-notif-item:last-child {
  border-bottom: 0;
}

.nff-notif-item:hover,
.nff-notif-item.unread {
  background: var(--bg-4);
}

.nff-notif-avatar {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r-pill);
  object-fit: cover;
}

.nff-notif-body {
  flex: 1;
  min-width: 0;
}

.nff-notif-name {
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
}

.nff-notif-text {
  margin-top: 2px;
  overflow: hidden;
  color: var(--fg-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nff-notif-time {
  margin-top: 2px;
  color: var(--fg-3);
  font: 400 10.5px var(--mono);
}

.nff-notif-empty {
  padding: 20px;
  color: var(--fg-3);
  font-size: 13px;
  text-align: center;
}

/* chat = a small app panel docked bottom-right */
.nff-chat-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  width: 340px;
  height: 460px;
  overflow: hidden;
  border-radius: var(--r-window);
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-xl);
}

.nff-chat-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.nff-chat-avatar {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: var(--r-pill);
  object-fit: cover;
}

.nff-chat-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nff-chat-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.nff-chat-close:hover {
  color: var(--fg);
}

.nff-chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  overflow-y: auto;
  background: var(--bg-2);
}

.nff-msg {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.nff-msg.mine {
  align-self: flex-end;
  border-bottom-right-radius: var(--r-xs);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
}

.nff-msg.theirs {
  align-self: flex-start;
  border-bottom-left-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg);
}

.nff-msg-time {
  display: block;
  margin-top: 2px;
  font: 400 10px var(--mono);
  opacity: 0.6;
}

.nff-chat-empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  font-size: 13px;
}

.nff-chat-input-row {
  display: flex;
  flex: none;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.nff-chat-input {
  flex: 1;
  font-family: var(--sans);
}

.nff-chat-send {
  width: 36px;
  flex: none;
  border-radius: var(--r-md);
  border: 0;
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
  font-size: 13px;
  cursor: pointer;
}

/* accept-friend dialog */
.nff-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.7);
  backdrop-filter: blur(4px);
}

.nff-modal-backdrop[aria-hidden='true'] {
  display: none;
}

.nff-modal {
  width: 100%;
  max-width: 440px;
  padding: 24px;
  border-radius: var(--r-window);
  border: 1px solid var(--border);
  background: var(--bg-3);
  box-shadow: var(--shadow-xl);
}

.nff-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 600;
}

.nff-modal-title i,
.nff-modal-perms i {
  color: var(--fg-3) !important;
}

.nff-modal-warn {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgb(255 107 111 / 0.35);
  background: rgb(255 107 111 / 0.08);
  color: #ff8a8d;
  font-size: 13px;
  line-height: 1.55;
}

.nff-modal-warn b {
  display: block;
  margin-bottom: 4px;
  font-size: 13.5px;
}

.nff-modal-perms {
  margin: 12px 0;
  padding: 0;
  list-style: none;
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.7;
}

.nff-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.nff-modal-accept,
.nff-modal-cancel {
  flex: 1;
  height: 40px;
  border-radius: var(--r-md);
  font: 500 13.5px var(--sans);
  cursor: pointer;
}

.nff-modal-accept {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
  font-weight: 600;
}

.nff-modal-cancel {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
}

/* ===================== dialogs (= the app's dialog) ===================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.7);
  backdrop-filter: blur(4px);
}

.modal-backdrop.open,
.modal-backdrop[aria-hidden='false'] {
  display: flex;
}

.modal {
  position: relative;
  width: min(480px, 100%);
  max-height: 90vh;
  padding: 24px;
  overflow-y: auto;
  border-radius: var(--r-window);
  border: 1px solid var(--border);
  background: var(--bg-3);
  box-shadow: var(--shadow-xl);
  animation: dash-pop 200ms var(--ease) both;
}

@keyframes dash-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-title {
  margin-bottom: 4px;
  color: var(--fg);
  font: 600 18px/1.25 var(--sans);
  letter-spacing: -0.02em;
}

.modal-note {
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.5;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.modal-close:hover {
  background: var(--bg-4);
  color: var(--fg);
}

/* key types = a segmented choice */
.activation-types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.type-option {
  min-height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
  font: 500 13px var(--sans);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.type-option:hover {
  color: var(--fg);
}

.type-option.active {
  border-color: var(--border-active, #4a4a4a);
  background: var(--bg-4);
  color: var(--fg);
}

.key-input {
  min-height: 42px;
  margin-bottom: 12px;
}

.activate-submit {
  width: 100%;
  min-height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
  font: 600 13.5px var(--sans);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.activate-submit:hover {
  background: var(--accent-deep);
}

.activate-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.activation-status {
  min-height: 20px;
  margin-top: 12px;
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- loader build dialog ---------- */
.lb-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
}

.lb-tab {
  flex: 1;
  height: 32px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-3);
  font: 500 13px var(--sans);
  cursor: pointer;
}

.lb-tab.active {
  border-color: var(--border);
  background: var(--bg-4);
  color: var(--fg);
}

.lb-panel {
  display: none;
}

.lb-panel.active {
  display: block;
}

.lb-field {
  margin-bottom: 14px;
}

.lb-label {
  display: block;
  margin-bottom: 6px;
  color: var(--fg-3);
  font: 400 12px var(--mono);
}

.lb-select {
  min-height: 40px;
  padding-right: 32px;
  font-family: var(--sans);
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
}

.lb-icon-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}

.lb-icon-drop:hover {
  border-color: var(--border-active, #4a4a4a);
}

.lb-icon-drop img {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  object-fit: contain;
}

.lb-simple-info {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.6;
}

.lb-simple-info span {
  color: var(--fg);
  font-weight: 600;
}

/* hotkey capture = the app's hotkey recorder */
.lb-hotkey-capture {
  flex: 1;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font: 400 13px var(--mono);
  text-align: left;
  cursor: pointer;
}

.lb-hotkey-capture.capturing {
  border-color: var(--border-active, #4a4a4a);
  color: var(--fg);
  animation: lb-pulse 600ms infinite alternate;
}

.lb-hotkey-capture.has-key {
  border-color: var(--border);
  color: var(--fg);
}

@keyframes lb-pulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.lb-hotkey-clear {
  width: 36px;
  height: 40px;
  flex: none;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font-size: 15px;
  cursor: pointer;
}

.lb-hotkey-clear:hover {
  color: var(--fg);
}

.lb-listening-row {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--fg-2);
  font-size: 12px;
}

.lb-listening-row.active {
  display: flex;
}

.lb-listening-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--live);
  animation: lb-pulse 500ms ease-in-out infinite alternate;
}

.lb-size-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.lb-size-preset {
  flex: 1;
  height: 30px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font: 500 11.5px var(--sans);
  cursor: pointer;
}

.lb-size-preset.active {
  border-color: var(--border-active, #4a4a4a);
  background: var(--bg-4);
  color: var(--fg);
}

.lb-size-custom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-size-custom input {
  flex: 1;
}

.lb-size-custom span {
  color: var(--fg-3);
  font-size: 12px;
  white-space: nowrap;
}

/* ===================== reseller, media, staff ===================== */
.dash-content .rail-card {
  margin-bottom: 12px;
  background: var(--bg-3);
  border-color: var(--line);
}

.panel-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 420px;
  padding: 6px;
  overflow-y: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.panel-scroll-list .section-note {
  padding: 16px;
}

.panel-scroll-list .rsl-user-row,
.panel-scroll-list .rsl-key-row {
  flex-shrink: 0;
}

/* inner tabs = the app's tab strip */
.catalog-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: var(--bg-3);
}

.catalog-tab {
  height: 30px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-3);
  font: 500 12.5px var(--sans);
  cursor: pointer;
}

.catalog-tab:hover:not(.active) {
  color: var(--fg);
}

.catalog-tab.active {
  border-color: var(--border);
  background: var(--bg-4);
  color: var(--fg);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.fchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg-3);
  font: 500 11.5px var(--sans);
  cursor: pointer;
}

.fchip:hover {
  color: var(--fg);
}

.fchip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
}

.gen-type-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.gen-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg-3);
  font: 500 11.5px var(--sans);
  cursor: pointer;
  user-select: none;
}

.gen-type-btn i {
  font-size: 14px;
}

.gen-type-btn:hover:not(.active) {
  color: var(--fg);
}

.gen-type-btn.active {
  border-color: var(--border-active, #4a4a4a);
  background: var(--bg-4);
  color: var(--fg);
}

.gen-type-config-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.gen-type-config-row:last-child {
  border-bottom: 0;
}

.gen-type-config-row .rsl-badge {
  flex: none;
  min-width: 64px;
  justify-content: center;
}

.gen-type-config-row .stat-label {
  flex: none;
  margin: 0;
}

.gen-type-config-row input.config-input {
  width: 80px;
  min-height: 28px;
  flex: none;
  padding: 0 8px;
  font-size: 12px;
}

.gen-type-config-row .no-days-note {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-3);
  font-size: 12px;
}

.rsl-key-row,
.rsl-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
}

.rsl-user-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
}

.rsl-key-text {
  flex: 1;
  overflow: hidden;
  color: var(--fg);
  font: 400 12px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rsl-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--bg-4);
  object-fit: cover;
}

/* key types keep their own tint so a list reads at a glance */
.rsl-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg-2);
  font: 500 11px var(--mono);
}

.rsl-badge.invite { color: #a5b4fc; }
.rsl-badge.ext { color: #6ee7b7; }
.rsl-badge.mc { color: #fcd34d; }
.rsl-badge.internal { color: #fca5a5; }
.rsl-badge.plus { color: #d8b4fe; }
.rsl-badge.used { color: var(--live); }
.rsl-badge.unused { color: var(--fg-3); }

.staff-reseller-shell {
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.staff-reseller-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.staff-reseller-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.staff-reseller-stat {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.staff-reseller-stat strong {
  display: block;
  color: var(--fg);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.staff-reseller-stat span {
  color: var(--fg-3);
  font: 400 11px var(--mono);
}

.staff-session-status {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--fg-3);
  font: 400 11px var(--mono);
}

.staff-session-status.online {
  color: var(--live);
}

.staff-session-status.delayed {
  color: #fcd34d;
}

.staff-reseller-list {
  display: block;
  height: min(60vh, 620px);
  min-height: 380px;
  padding: 8px;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.staff-reseller-card {
  margin-bottom: 8px;
  overflow: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
  transition: border-color var(--dur) var(--ease);
}

.staff-reseller-card:hover {
  border-color: var(--border);
}

.staff-reseller-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.staff-reseller-avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-3);
  object-fit: cover;
}

.staff-reseller-name {
  flex: 1;
  min-width: 0;
}

.staff-reseller-name strong,
.staff-reseller-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-reseller-name strong {
  color: var(--fg);
  font-size: 13.5px;
}

.staff-reseller-name span {
  margin-top: 2px;
  color: var(--fg-3);
  font: 400 11px var(--mono);
}

.staff-reseller-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.staff-reseller-keys {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-3);
}

.staff-reseller-key-grid {
  min-width: 580px;
}

.media-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.media-field label {
  color: var(--fg-3);
  font: 400 12px var(--mono);
}

.media-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink, #0a0a0a);
  font: 600 13px var(--sans);
  white-space: nowrap;
  cursor: pointer;
}

.media-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--live);
  font-size: 12.5px;
}

.media-owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.media-owner-chip img {
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  object-fit: cover;
}

.media-owner-chip span {
  font-size: 13px;
}

/* old markup that the page script may still render */
.versions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.version {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--fg-2);
  font: 400 11.5px var(--mono);
}

.password-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
}

.password-grid .full {
  grid-column: 1 / -1;
}

/* ===================== responsive ===================== */
@media (max-width: 1180px) {
  .dash-body {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .dash-side {
    grid-column: 1 / -1;
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
}

@media (max-width: 860px) {
  .dash {
    width: 100%;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }

  .dash-body {
    grid-template-columns: 1fr;
  }

  /* sections become a scrolling tab strip under the title bar */
  .dash-nav {
    position: sticky;
    top: var(--header-height);
    z-index: 20;
    flex-direction: row;
    gap: 4px;
    margin: 0 -12px;
    padding: 8px 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line-2);
    background: var(--bg);
    scrollbar-width: none;
  }

  .dash-nav::-webkit-scrollbar {
    display: none;
  }

  .dash-nav-label {
    display: none;
  }

  .side-item {
    width: auto;
    flex: none;
    border-color: var(--line);
  }

  .dash-side {
    grid-template-columns: 1fr;
  }

  .main,
  .dash-content {
    padding: 16px;
  }

  .dash-user {
    display: none;
  }

  /* the action bar stays reachable at the bottom of the screen */
  .dash-actionbar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 0 -12px;
    padding: 8px 12px;
    background: var(--bg);
  }

  .dash-status {
    order: 10;
    flex-basis: 100%;
    padding: 0;
  }
}

@media (max-width: 640px) {
  .form-grid,
  .theme-grid,
  .referral-levels,
  .luck-grid,
  .config-toolbar,
  #friendsPanel .config-toolbar,
  .referrals-toolbar,
  .activation-types {
    grid-template-columns: 1fr;
  }

  .config-card,
  .referral-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .referral-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .referral-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .config-actions {
    justify-content: flex-start;
  }

  .gen-type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .staff-reseller-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-action {
    flex: 1 1 auto;
  }

  .dash-chip {
    display: none;
  }

  /* dialogs become bottom sheets */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: var(--r-window) var(--r-window) 0 0;
    padding: 20px 16px;
  }

  .nff-chat-panel {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tab-panel.active,
  .modal {
    animation: none;
  }

  .luck-card,
  .luck-card:hover {
    transition: none;
    transform: none;
  }
}
