/* FiveLogs dashboard, styled on the DashStack admin UI kit (dark). */

@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/nunito-sans-latin.woff2?v=ee7f58b309e6") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #1b2431;
  --surface: #273142;
  --surface-2: #323d4e;
  --surface-3: #3a4659;
  --line: #313d4f;
  --line-soft: rgba(151, 151, 151, 0.18);

  /* Text */
  --text: #ffffff;
  --text-2: #d5d5d5;
  --muted: #a3a9b6;
  --faint: #7c8594;

  /* Brand + kit palette */
  --primary: #4880ff;
  --primary-hover: #3b70eb;
  --purple: #8280ff;
  --yellow: #fec53d;
  --green: #4ad991;
  --orange: #ff9066;
  --teal: #00b69b;
  --red: #f93c65;
  --violet: #6226ef;
  --magenta: #ba29ff;
  --status-red: #ef3826;
  --status-orange: #ffa756;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 6px 6px 54px rgba(0, 0, 0, 0.12);

  --sidebar-w: 240px;
  --topbar-h: 70px;

  font-family: "Nunito Sans", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Clicking around the panel must never look like editing text. A text caret
   only belongs in a field you can type into (the browser's caret-browsing
   mode, toggled by F7, otherwise drops one wherever you click), and the
   controls, nav and clickable rows should not start a text selection or draw
   a focus box on a mouse click. Log messages and metadata stay selectable so
   they can be copied. */
body { caret-color: transparent; }
input, textarea, select, [contenteditable] { caret-color: auto; }
:focus:not(:focus-visible) { outline: none; }
.sidebar, .topbar, .btn, .icon-btn, .tabs, .filterbar, .qbar-row, .qbar-chips, .qb-fields, .qb-actions,
.pager, th, tr.clickable > td, .stat-card, .card-head, .bar-row, .kv-key, button {
  user-select: none;
  -webkit-user-select: none;
}
.icon { flex: none; display: block; }
code, .mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- layout */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  /* Paints the sidebar column the full page height, past the sticky panel. */
  background: linear-gradient(to right, var(--surface) var(--sidebar-w), transparent 0);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 30;
  /* Scrolls with the wheel when the nav outgrows the window, but without
     drawing a scrollbar over the kit's sidebar. */
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.2px;
  flex: none;
}
.brand span { color: var(--primary); }

.nav { padding: 6px 0 12px; }
.nav-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.26px;
  color: var(--faint);
  text-transform: uppercase;
  padding: 18px 40px 10px;
}
.nav-sep { height: 1px; background: var(--line); margin: 12px 0; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 50px;
  margin: 2px 24px;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  color: var(--text);
  transition: background 0.15s;
}
.nav-item:hover { background: rgba(72, 128, 255, 0.1); }
.nav-item.active { background: var(--primary); color: #fff; }
/* The kit's signature accent bar on the sidebar edge. */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--primary);
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
}
.nav-bottom { margin-top: auto; padding-bottom: 16px; }

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

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); }

.nav-toggle { display: none; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 26px; }

.bell { position: relative; }
.bell .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}

.org-select {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-2);
  position: relative;
}
.org-select .org-dot {
  width: 30px;
  height: 22px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
}
.org-select select {
  appearance: none;
  border: 0;
  background: transparent;
  padding-right: 22px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.org-select select option { background: var(--surface); }
.org-select .icon { position: absolute; right: 0; pointer-events: none; color: var(--muted); }
/* One server only (or an owner mid-preview): a label, not a dropdown. */
.org-select.static { cursor: default; }
.org-select.static .org-name { padding-right: 4px; }

.profile { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--primary);
  flex: none;
}
.profile-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.profile-role { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.profile .icon-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0.6px solid var(--muted);
}

.content { padding: 30px; flex: 1; min-width: 0; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -0.11px; margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; font-weight: 600; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.crumb:hover { color: var(--text); }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.card-title { font-size: 22px; font-weight: 700; margin: 0; }
.card-title.sm { font-size: 18px; }

.grid { display: grid; gap: 28px; margin-bottom: 28px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.stat {
  padding: 16px 16px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 26px;
}
.stat-label { font-size: 16px; font-weight: 600; color: var(--text-2); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: 1px; margin-top: 12px; }
.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 23px;
  display: grid;
  place-items: center;
}
.stat-icon.purple { background: rgba(130, 128, 255, 0.21); color: var(--purple); }
.stat-icon.yellow { background: rgba(254, 197, 61, 0.21); color: var(--yellow); }
.stat-icon.green  { background: rgba(74, 217, 145, 0.21); color: var(--green); }
.stat-icon.orange { background: rgba(255, 144, 102, 0.21); color: var(--orange); }
.stat-icon.blue   { background: rgba(72, 128, 255, 0.21); color: var(--primary); }
.stat-icon.red    { background: rgba(249, 60, 101, 0.21); color: var(--red); }
.stat-trend {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.stat-trend b { font-weight: 700; }
.up { color: var(--teal); }
.down { color: var(--red); }

/* ---------------------------------------------------------------- controls */

.select {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select select {
  appearance: none;
  height: 28px;
  border-radius: 4px;
  border: 0.6px solid rgba(207, 207, 207, 0.2);
  background: var(--surface-2);
  padding: 0 30px 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  outline: none;
  cursor: pointer;
}
.select select:focus { border-color: var(--primary); }
.select select option { background: var(--surface); }
.select .icon { position: absolute; right: 8px; pointer-events: none; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.btn:hover { background: var(--primary-hover); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 0.6px solid rgba(207, 207, 207, 0.12); }
.btn.ghost:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: default; }

.input {
  height: 38px;
  border-radius: var(--radius-sm);
  border: 0.6px solid rgba(207, 207, 207, 0.12);
  background: var(--surface-2);
  padding: 0 14px;
  outline: none;
  min-width: 0;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--muted); }

/* The kit's segmented "Filter By | Date | Order Type | Reset Filter" bar. */
.filterbar {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: wrap;
  background: var(--surface);
  border: 0.6px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
  max-width: 100%;
}
.filterbar > * {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  min-height: 70px;
  border-right: 0.6px solid var(--line);
  font-weight: 700;
}
.filterbar > *:last-child { border-right: 0; }
.filterbar .fb-icon { padding: 0 24px; color: var(--text-2); }
.filterbar select, .filterbar input {
  appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  font-weight: 700;
  cursor: pointer;
  padding-right: 4px;
}
.filterbar select option { background: var(--surface); }
.filterbar input { cursor: text; min-width: 150px; font-weight: 600; }
.filterbar input::placeholder { color: var(--muted); font-weight: 700; }
.filterbar .fb-field .icon { color: var(--muted); }
.filterbar .reset { color: var(--status-red); background: transparent; border: 0; border-right: 0; }
.filterbar .reset:hover { background: rgba(239, 56, 38, 0.08); }

/* Log search bar: browse controls on top, active filters as chips, and the
   inline field / condition / value builder underneath. */
.qbar {
  background: var(--surface);
  border: 0.6px solid var(--line);
  border-radius: 14px;
  margin-bottom: 24px;
}
.qbar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
}
.qbar-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px 0 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 0.6px solid rgba(207, 207, 207, 0.12);
  color: var(--muted);
  cursor: pointer;
}
.qbar-pick:focus-within { border-color: var(--primary); }
.qbar-pick select {
  appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding-right: 22px;
  cursor: pointer;
  max-width: 240px;
}
.qbar-pick select option { background: var(--surface); }
.qbar-pick > .icon:last-child { position: absolute; right: 10px; pointer-events: none; }
.qbar-add { height: 38px; }
.qbar-search {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 0.6px solid rgba(207, 207, 207, 0.12);
  color: var(--muted);
}
.qbar-search:focus-within { border-color: var(--primary); }
.qbar-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font-weight: 600; }
.qbar-search input::placeholder { color: var(--muted); }
.qbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 0.6px solid rgba(207, 207, 207, 0.12);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}
.qbar-toggle:hover { background: var(--surface-3); }
.qbar-toggle.on { background: rgba(72, 128, 255, 0.18); border-color: rgba(72, 128, 255, 0.5); color: #7ea5ff; }
.qbar-reset {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--status-red);
  font-weight: 700;
}
.qbar-reset:hover { background: rgba(239, 56, 38, 0.08); }

.qbar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 14px;
}
.chip {
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  background: rgba(72, 128, 255, 0.12);
  border: 0.6px solid rgba(72, 128, 255, 0.35);
  overflow: hidden;
  max-width: 100%;
}
.chip-body {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  min-width: 0;
}
.chip-body:hover { background: rgba(72, 128, 255, 0.14); }
.chip-field { color: #7ea5ff; font-weight: 700; }
.chip-op { color: var(--muted); font-weight: 600; }
.chip-value { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.chip-x {
  display: grid;
  place-items: center;
  width: 28px;
  border: 0;
  border-left: 0.6px solid rgba(72, 128, 255, 0.25);
  background: transparent;
  color: var(--muted);
}
.chip-x:hover { background: rgba(239, 56, 38, 0.18); color: #ff6a5b; }

.qbar-panel {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  border-top: 0.6px solid var(--line);
}
.qbar-panel[hidden] { display: none; }
.qb-fields { border-right: 0.6px solid var(--line); display: flex; flex-direction: column; }
.qb-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 0.6px solid var(--line);
  color: var(--muted);
}
.qb-search input { flex: 1; background: transparent; border: 0; outline: none; color: var(--text); font-weight: 600; min-width: 0; }
.qb-search input::placeholder { color: var(--muted); }
.qb-list { max-height: 320px; overflow-y: auto; padding: 6px 0 10px; }
.qb-group {
  padding: 12px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--faint);
}
.qb-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 18px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.qb-field:hover { background: rgba(72, 128, 255, 0.1); }
.qb-field.active { background: rgba(72, 128, 255, 0.18); }
.qb-field-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.qb-type {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(163, 169, 182, 0.16);
  color: var(--muted);
}
.qb-type.number { background: rgba(255, 167, 86, 0.2); color: var(--status-orange); }
.qb-type.text { background: rgba(0, 182, 155, 0.2); color: var(--teal); }
.qb-type.boolean { background: rgba(186, 41, 255, 0.2); color: #d27bff; }
.qb-type.choice { background: rgba(72, 128, 255, 0.2); color: #7ea5ff; }
.qb-empty { padding: 14px 18px; color: var(--muted); font-size: 13px; }
.qb-path { font-size: 11px; color: var(--faint); font-weight: 500; margin-left: 6px; }
.qb-more {
  display: block;
  width: 100%;
  padding: 10px 18px 6px;
  border: 0;
  background: transparent;
  color: #7ea5ff;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}
.qb-more:hover { text-decoration: underline; }

.qb-cond { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.qb-selected { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.qb-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.qb-row .select select { height: 38px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text); font-weight: 700; padding-right: 32px; }
.qb-row .input { flex: 1 1 240px; }
.qb-hint { font-size: 12px; color: var(--muted); min-height: 16px; }
.qb-hint.error { color: #ff6a5b; font-weight: 600; }
.qb-actions { display: flex; gap: 10px; margin-top: auto; }
.qb-placeholder { display: flex; align-items: center; gap: 16px; color: var(--muted); padding: 10px 0 14px; }
.qb-placeholder b { color: var(--text); }

.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.tabs button {
  border: 0;
  background: transparent;
  height: 32px;
  padding: 0 14px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.tabs button.on { background: var(--primary); color: #fff; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left;
  font-size: 14px;
  font-weight: 800;
  background: var(--surface-2);
  padding: 15px 16px;
  white-space: nowrap;
}
.table th:first-child { border-radius: 12px 0 0 12px; padding-left: 24px; }
.table th:last-child { border-radius: 0 12px 12px 0; }
.table td {
  padding: 16px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 0.4px solid var(--line-soft);
  vertical-align: middle;
}
.table td:first-child { padding-left: 24px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: rgba(72, 128, 255, 0.06); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
/* Click-to-sort column headers: a plain button in the kit's th style, the
   active column tinted primary with a direction arrow. */
.table th.sortable { padding: 0; }
.table th.sortable > button {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 15px 16px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.table th:first-child.sortable > button { padding-left: 24px; }
.table th.sortable > button:hover, .table th.sortable.active > button { color: var(--primary); }
.table th.sortable .sort-ind { width: 12px; color: var(--primary); }
.cell-strong { color: var(--text); font-weight: 700; }
.cell-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.msg {
  max-width: min(560px, 30vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.table.dense td { padding-top: 11px; padding-bottom: 11px; }
/* Grouped table: a heading row per group (e.g. one script's call sites). */
.table tr.group-row td { background: var(--surface-2); color: var(--text); font-weight: 800; }
.table tr.group-row .icon { color: var(--muted); }

.detail-row td { background: rgba(0, 0, 0, 0.14); padding: 16px 24px 20px; }
/* Top Earners drill-down and the player page's Money Sources card. */
.table tr[data-earner] .icon { color: var(--muted); transition: transform 0.15s; }
.table tr[data-earner].open .icon { transform: rotate(90deg); }
.player-sources .ps-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.player-sources .ps-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
.player-sources.compact .barlist { gap: 10px; }
.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 22px;
  margin: 0;
}
.meta dt { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.meta dd { margin: 0; word-break: break-word; }
pre.json {
  margin: 12px 0 0;
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  color: var(--text-2);
  max-height: 360px;
}

/* Status pills in the kit's order-list colours. */
/* Metadata as clickable path = value rows (components.js metaTree). */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 18px;
  align-items: baseline;
  margin: 12px 0 0;
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 12.5px;
  overflow-x: auto;
}
.kv-key { color: var(--muted); font-weight: 700; white-space: nowrap; }
.kv-val {
  justify-self: start;
  margin-left: -6px;
  padding: 1px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  text-align: left;
  word-break: break-word;
}
button.kv-val { cursor: pointer; }
button.kv-val:hover, button.kv-val:focus-visible { background: rgba(72, 128, 255, 0.16); color: #7ea5ff; outline: none; }
.kv-val.static { color: var(--muted); }
.filterbar input.wide { min-width: 260px; }
.raw-toggle summary { margin-top: 10px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }
.raw-toggle summary:hover { color: var(--text-2); }
/* Sidebar sub-items: a server's categories under the primary views. */
/* Category rows inside a dataset card. */
.ds-cats { margin: 4px 0 16px; }
.ds-cats .table td, .ds-cats .table th { padding-left: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 27px;
  min-width: 78px;
  padding: 0 12px;
  border-radius: 4.5px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  white-space: nowrap;
}
.pill.teal    { background: rgba(0, 182, 155, 0.2);  color: var(--teal); }
.pill.violet  { background: rgba(98, 38, 239, 0.28); color: #a07cff; }
.pill.red     { background: rgba(239, 56, 38, 0.2);  color: #ff6a5b; }
.pill.orange  { background: rgba(255, 167, 86, 0.2); color: var(--status-orange); }
.pill.magenta { background: rgba(186, 41, 255, 0.2); color: #d27bff; }
.pill.blue    { background: rgba(72, 128, 255, 0.2); color: #7ea5ff; }
.pill.grey    { background: rgba(163, 169, 182, 0.16); color: var(--muted); }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 10px; vertical-align: -1px; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 8px; box-shadow: 0 0 0 3px rgba(74, 217, 145, 0.18); }
.offline-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-right: 8px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  color: var(--muted);
  font-weight: 600;
  flex-wrap: wrap;
}
.pager-btns {
  display: inline-flex;
  border: 0.6px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.pager-btns button {
  width: 40px;
  height: 32px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
}
.pager-btns button + button { border-left: 0.6px solid var(--line); }
.pager-btns button:disabled { opacity: 0.35; cursor: default; }

/* ---------------------------------------------------------------- charts */

.chart { position: relative; width: 100%; }
.chart-wrap { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-weight: 600; }
.chart .pt { stroke: var(--surface); stroke-width: 1.5; }
.chart .hover-line { stroke: var(--muted); stroke-dasharray: 3 4; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  z-index: 5;
}
.chart-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  transform: translateX(-50%) rotate(45deg);
}
.tip-title { font-weight: 600; opacity: 0.85; margin-bottom: 3px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row b { margin-left: auto; padding-left: 12px; }
.tip-dot { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 1.5px #fff; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-weight: 600; color: var(--text-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.donut-card { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.donut .donut-value { fill: var(--text); font-size: 24px; font-weight: 800; }
.donut .donut-label { fill: var(--muted); font-size: 12px; font-weight: 700; }
.donut-legend { width: 100%; display: grid; gap: 12px; }
.donut-legend div { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-2); }
.donut-legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.donut-legend b { margin-left: auto; color: var(--text); }

.barlist { display: grid; gap: 18px; }
.bar-row-top { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; margin-bottom: 8px; }
.bar-row-top .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row-top .val { color: var(--muted); font-weight: 600; white-space: nowrap; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--primary); }
.bar-fill.err { background: var(--red); }

/* ---------------------------------------------------------------- misc */

.empty {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  padding: 44px 16px;
  color: var(--muted);
  font-weight: 600;
}
.empty .icon { color: var(--faint); }
.empty b { color: var(--text-2); font-size: 16px; }

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(255, 167, 86, 0.1);
  border: 1px solid rgba(255, 167, 86, 0.3);
  color: var(--text-2);
  border-radius: 10px;
  padding: 14px 16px;
  font-weight: 600;
  margin-bottom: 24px;
}
.notice .icon { color: var(--status-orange); }
.notice.error { background: rgba(249, 60, 101, 0.1); border-color: rgba(249, 60, 101, 0.3); }
.notice.error .icon { color: var(--red); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 8px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.profile-card { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.profile-card .avatar { width: 84px; height: 84px; font-size: 30px; }
.profile-card h2 { margin: 0 0 6px; font-size: 24px; }
.id-list { display: flex; gap: 10px; flex-wrap: wrap; }

.dataset-card { display: flex; flex-direction: column; gap: 18px; }
.dataset-card .ds-head { display: flex; align-items: center; gap: 14px; }
.dataset-card .ds-name { font-size: 18px; font-weight: 800; }
.dataset-card .ds-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dataset-card .ds-stats div { background: var(--surface-2); border-radius: 10px; padding: 12px; }
.dataset-card .ds-stats span { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.dataset-card .ds-stats b { font-size: 18px; }

.muted { color: var(--muted); }
.row-gap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 28px; }

/* Owner previewing the panel as another group: a band under the topbar so
   it is never mistaken for their real access. */
.preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 30px;
  background: rgba(254, 197, 61, 0.12);
  border-bottom: 1px solid rgba(254, 197, 61, 0.35);
  color: var(--text-2);
  font-weight: 600;
  position: sticky;
  top: var(--topbar-h);
  z-index: 19;
}
.preview-bar .icon { color: var(--yellow); }
.preview-bar span { flex: 1; min-width: 0; }
.preview-bar b { color: var(--text); }
@media (max-width: 640px) { .preview-bar { padding: 10px 16px; flex-wrap: wrap; } }

/* ---------------------------------------------------------------- forms */
/* The kit's settings form: stacked fields, a label above each control,
   checkbox tiles for option grids. Used by Members & Groups. */

.form { display: grid; gap: 24px; }
.form .card + .card, .form + .card { margin-top: 24px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > label, .field-label { font-weight: 700; font-size: 13px; color: var(--text-2); }
.field-hint { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: -4px; }
.field .input { width: 100%; max-width: 420px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 0.6px solid transparent;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.check:hover { border-color: rgba(207, 207, 207, 0.18); }
.check:has(input:checked) { border-color: rgba(72, 128, 255, 0.55); }
.check:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.check.dim { opacity: 0.45; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--primary); cursor: inherit; }
.check > span { display: grid; gap: 2px; min-width: 0; }
.check b { color: var(--text); font-size: 13.5px; }
.check span span { font-size: 12px; color: var(--muted); font-weight: 600; }
.role-rows { display: grid; gap: 10px; }
.role-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; max-width: 720px; }
.role-row.with-guild { grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 1fr) auto; max-width: 900px; }
.role-row .input { width: 100%; max-width: none; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-top: 4px; border-top: 0.6px solid var(--line); }
.form-actions > span { flex: 1; }
.btn.small { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 6px; }
.btn.danger { background: var(--status-red); }
.btn.danger:hover { background: #d32f1f; }
.btn.ghost.danger-text { color: #ff6a5b; }
.member-cell { display: flex; align-items: center; gap: 12px; }
.member-cell .avatar { width: 36px; height: 36px; font-size: 14px; }
.tag.mono { font-size: 11.5px; }

@media (max-width: 640px) {
  .role-row, .role-row.with-guild { grid-template-columns: 1fr; }
  .role-row .icon-btn { justify-self: end; }
  .role-rows > .role-row + .role-row { padding-top: 10px; border-top: 0.6px solid var(--line-soft); }
}

/* ---------------------------------------------------------------- login */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--primary);
  position: relative;
  overflow: hidden;
}
/* The kit's abstract background shapes. */
.login::before, .login::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.login::before { width: 760px; height: 760px; left: -260px; top: -300px; }
.login::after { width: 620px; height: 620px; right: -200px; bottom: -260px; }
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: 24px;
  padding: 56px 50px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}
.login-card .brand { height: auto; margin-bottom: 28px; font-size: 26px; }
.login-card h1 { font-size: 30px; margin: 0 0 12px; letter-spacing: -0.11px; }
.login-card p { color: var(--muted); font-weight: 600; margin: 0 0 34px; }
.login-card .btn { width: 100%; height: 56px; font-size: 18px; border-radius: 8px; }
.login-card .btn.discord { background: #5865f2; }
.login-card .btn.discord:hover { background: #4752e0; }
.login-foot { margin-top: 26px; font-size: 13px; color: var(--faint); font-weight: 600; }
.login-card .notice { text-align: left; }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-weight: 700; }

/* ---------------------------------------------------------------- responsive */

.scrim { display: none; }

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; background: none; }
  .sidebar {
    position: fixed;
    left: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .nav-toggle { display: grid; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .profile-text { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 20px 16px; }
  .qbar-panel { grid-template-columns: 1fr; }
  .qb-fields { border-right: 0; border-bottom: 0.6px solid var(--line); }
  .qb-list { max-height: 220px; }
  .qbar-reset { margin-left: 0; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar-right { gap: 14px; }
  .grid { gap: 16px; margin-bottom: 16px; }
  .grid-4 { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }
  .page-title { font-size: 26px; }
  .filterbar > * { min-height: 52px; padding: 0 14px; }
  .login-card { padding: 40px 24px; }
  .org-select .org-name { display: none; }
}

/* ---------------------------------------------------------------- media */
/* Gallery tiles (pages/media.js). Thumbnails are the kit's rounded cards on
   the page background; the kind pill sits on the picture like a status. */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}
.media-tile {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  background: var(--bg);
  border: 0.6px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.media-tile:hover, .media-tile:focus-visible { border-color: var(--primary); transform: translateY(-2px); outline: none; }
.media-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-glyph { color: var(--faint); }
.media-kind { position: absolute; top: 10px; left: 10px; }
.media-dim {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-2);
}
.media-tile-body { padding: 10px 12px 12px; min-width: 0; }
.media-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Viewer: the picture on a dark stage, details in a side panel. */
body.viewer-open { overflow: hidden; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(11, 15, 22, 0.82);
  display: grid;
  place-items: center;
  padding: 24px;
}
.viewer-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  width: min(1400px, 100%);
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.viewer-stage {
  position: relative;
  display: grid;
  place-items: center;
  background: #0f141c;
  min-height: 360px;
  min-width: 0;
}
.viewer-stage img, .viewer-stage video {
  max-width: 100%;
  max-height: calc(100vh - 48px);
  object-fit: contain;
  display: block;
}
.viewer-stage video { width: 100%; }
.media-audio, .media-file {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 40px;
  color: var(--text-2);
  text-align: center;
}
.media-audio audio { width: min(420px, 80vw); }
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(39, 49, 66, 0.85);
  color: var(--text);
  display: grid;
  place-items: center;
}
.viewer-nav:hover { background: var(--primary); }
.viewer-nav.prev { left: 14px; }
.viewer-nav.next { right: 14px; }
.viewer-side {
  padding: 20px 22px 24px;
  border-left: 0.6px solid var(--line);
  overflow-y: auto;
  min-width: 0;
}
.viewer-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.viewer-head > div:first-child { flex: 1; }
.viewer-title { font-weight: 800; font-size: 16px; word-break: break-word; margin-bottom: 4px; }
.viewer-section { margin: 20px 0 6px; font-weight: 700; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.viewer-side .kv { margin-top: 0; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

@media (max-width: 1024px) {
  .viewer { padding: 0; }
  .viewer-box { grid-template-columns: 1fr; max-height: 100vh; height: 100vh; border-radius: 0; overflow-y: auto; }
  .viewer-stage { min-height: 240px; max-height: 60vh; }
  .viewer-stage img, .viewer-stage video { max-height: 60vh; }
  .viewer-side { border-left: 0; border-top: 0.6px solid var(--line); }
}
@media (max-width: 640px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .media-tile-body { padding: 8px 10px 10px; }
}

/* Storage card on the Media page. */
.usage-card { margin-bottom: 28px; }
.usage-big { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.usage-big b { font-size: 28px; font-weight: 800; letter-spacing: 0.5px; }
.usage-big span { color: var(--muted); font-weight: 600; }

/* Upload panel (Media page). */
.upload-card { margin-bottom: 28px; }
.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 30px 16px;
  border: 1.5px dashed rgba(207, 207, 207, 0.22);
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone .icon { color: var(--faint); }
.dropzone b { color: var(--text); font-size: 15px; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: rgba(72, 128, 255, 0.06); }
.upload-rows { display: grid; gap: 12px; margin-top: 16px; }
.upload-rows:empty { display: none; }
.upload-row { background: var(--bg); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; }
.upload-row-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload-row-top .media-name { flex: 1; min-width: 120px; }
.upload-result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.upload-link { word-break: break-all; flex: 1; min-width: 200px; }
