/* ==========================================================================
   Moglipuff Admin Panel — Discord-style dark theme
   All colors via CSS custom properties. No hardcoded hex anywhere else.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Custom properties (exact Discord dark mode values)
   --------------------------------------------------------------------------- */
:root {
  /* Surface layers */
  --bg-modifier-active:   #18191c;
  --bg-tertiary:          #202225;
  --bg-secondary:         #2f3136;
  --bg-primary:           #36393f;
  --bg-secondary-alt:     #292b2f;
  --bg-floating:          #18191c;

  /* Interactive surfaces */
  --bg-modifier-hover:    #32353b;
  --bg-modifier-selected: #393c43;
  --input-bg:             #202225;
  --input-border:         #040405;

  /* Text */
  --text-normal:          #dcddde;
  --text-muted:           #72767d;
  --text-link:            #00b0f4;
  --header-primary:       #ffffff;
  --header-secondary:     #b9bbbe;
  --interactive-normal:   #b9bbbe;
  --interactive-hover:    #dcddde;
  --interactive-active:   #ffffff;
  --interactive-muted:    #4f545c;

  /* Blurple accent */
  --brand-500:            #5865f2;
  --brand-560:            #4752c4;
  --brand-600:            #3c45a5;

  /* Status colors */
  --status-positive:      #3ba55c;
  --status-positive-bg:   #2d7d46;
  --status-warning:       #faa61a;
  --status-warning-bg:    #c27d0e;
  --status-danger:        #ed4245;
  --status-danger-bg:     #a12d2f;
  --status-info:          #5865f2;

  /* Borders */
  --background-modifier-accent: rgba(79, 84, 92, 0.15);
  --channeltextarea-background: #40444b;

  /* Scrollbar */
  --scrollbar-thin-thumb: #202225;
  --scrollbar-thin-track: transparent;

  /* Shadows */
  --elevation-low:    0 1px 0 rgba(4,4,5,.2), 0 1.5px 0 rgba(6,6,7,.05), 0 2px 0 rgba(4,4,5,.05);
  --elevation-medium: 0 4px 4px rgba(0,0,0,.16);
  --elevation-high:   0 8px 16px rgba(0,0,0,.24);

  /* Typography */
  --font-primary: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-code:    Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console',
                  'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Monaco, 'Courier New', monospace;

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 48px;
}

/* ---------------------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-modifier-active);
  color: var(--text-normal);
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html { scroll-behavior: smooth; }

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Scrollbar
   --------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thin-thumb);
  border-radius: 4px;
  border: 2px solid var(--bg-primary);
}

/* ---------------------------------------------------------------------------
   Layout shell
   --------------------------------------------------------------------------- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--elevation-low);
  z-index: 10;
}

.sidebar-header {
  padding: 16px 12px 8px;
  border-bottom: 1px solid var(--background-modifier-accent);
  margin-bottom: 4px;
}

.sidebar-logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--header-primary);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--brand-500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-section-label {
  padding: 16px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--header-secondary);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  margin: 1px 8px;
  border-radius: 4px;
  color: var(--interactive-normal);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg-modifier-hover);
  color: var(--interactive-hover);
  text-decoration: none;
}
.nav-item.active {
  background: var(--bg-modifier-selected);
  color: var(--interactive-active);
}
.nav-item-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 15px;
}

/* Main area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Header bar */
.header-bar {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--bg-secondary);
  box-shadow: var(--elevation-low);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 5;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--bg-secondary-alt);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-normal);
  white-space: nowrap;
}

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

.status-green  .status-dot { background: var(--status-positive); }
.status-red    .status-dot { background: var(--status-danger); animation: none; }
.status-yellow .status-dot { background: var(--status-warning); animation: pulse 1.5s infinite; }
.status-blue   .status-dot { background: var(--brand-500); animation: pulse 1.5s infinite; }
.status-grey   .status-dot { background: var(--interactive-muted); }

/* Scan progress badge */
.status-scan {
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.4);
  padding: 3px 10px 3px 6px;
  gap: 6px;
}

.scan-ring {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.scan-ring-bg {
  fill: none;
  stroke: var(--bg-modifier-selected);
  stroke-width: 3.5;
}

.scan-ring-fill {
  fill: none;
  stroke: var(--brand-500);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Per-mod "hold" pin toggle in the Mod Manager name cell */
.mod-pin {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  margin-left: 4px;
  opacity: 0.3;            /* faint until hovered or active */
  filter: grayscale(1);
  vertical-align: middle;
}
.mod-pin:hover { opacity: 0.8; }
.mod-pin.pinned { opacity: 1; filter: none; }

/* Sidebar build-version label, pinned to the bottom */
.sidebar-version {
  margin-top: auto;
  padding: 10px 16px;
  font-size: 11px;
  opacity: 0.6;
}

/* Dashboard "CONTROLS" subsection inside the server-info card */
.card-controls {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--bg-modifier-selected, rgba(255,255,255,.08));
}
.card-controls-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Header activity badges (scans, uploads, downloads, compression jobs) */
.activity-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* Badges are clickable anchors → strip link styling, keep badge look */
a.status-badge { text-decoration: none; cursor: pointer; }
a.status-badge:hover { filter: brightness(1.15); }

/* Completion colour variants for the scan-style badge background/border */
.status-scan.status-green {
  background: rgba(59, 165, 92, 0.14);
  border-color: rgba(59, 165, 92, 0.5);
}
.status-scan.status-green .scan-ring-fill { stroke: var(--status-green); }
.status-scan.status-red {
  background: rgba(237, 66, 69, 0.14);
  border-color: rgba(237, 66, 69, 0.5);
}

/* Indeterminate spinner for activities with no known total */
.activity-spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(88, 101, 242, 0.3);
  border-top-color: var(--brand-500);
  flex-shrink: 0;
  animation: activity-spin 0.8s linear infinite;
}
@keyframes activity-spin { to { transform: rotate(360deg); } }

/* Indeterminate progress bar — for downloads where the source doesn't report
   byte-level progress. A sliver slides back and forth to signal "working". */
.progress-indeterminate { overflow: hidden; position: relative; }
.progress-indeterminate .progress-bar-fill {
  width: 35% !important;
  position: absolute;
  animation: progress-indeterminate 1.2s ease-in-out infinite;
}
@keyframes progress-indeterminate {
  0%   { left: -35%; }
  100% { left: 100%; }
}

/* Page content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ---------------------------------------------------------------------------
   Typography helpers
   --------------------------------------------------------------------------- */
.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--header-primary);
  margin-bottom: 16px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--header-secondary);
  margin-bottom: 8px;
  margin-top: 16px;
}

.text-muted { color: var(--text-muted); font-size: 12px; }
.text-normal { color: var(--text-normal); }

/* ---------------------------------------------------------------------------
   Cards / Panels
   --------------------------------------------------------------------------- */
.card {
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: var(--elevation-low);
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--header-primary);
  margin-bottom: 12px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--background-modifier-accent);
}
.card-row:last-child { border-bottom: none; }
.card-row-label { color: var(--text-muted); font-size: 14px; }
.card-row-value { color: var(--text-normal); font-size: 14px; font-weight: 500; }

/* Status card (Steam-style with colored left border) */
.status-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: var(--elevation-low);
  padding: 16px;
  border-left: 4px solid var(--interactive-muted);
  margin-bottom: 12px;
}
.status-card.online  { border-left-color: var(--status-positive); }
.status-card.offline { border-left-color: var(--status-danger); }
.status-card.warning { border-left-color: var(--status-warning); }
.status-card.updating { border-left-color: var(--brand-500); }

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 16px;
  min-height: 38px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.17s ease;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-primary);
}

.btn-primary {
  background: var(--brand-500);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-560); }
.btn-primary:active:not(:disabled) { background: var(--brand-600); }

.btn-danger {
  background: var(--status-danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #c03537; }

.btn-success {
  background: var(--status-positive);
  color: #fff;
}
.btn-success:hover:not(:disabled) { background: #2d7d46; }
.btn-success:active:not(:disabled) { background: #25683a; }

.btn-secondary {
  background: #4f545c;
  color: #fff;
}
.btn-secondary:hover:not(:disabled) { background: #5d6269; }

.btn-ghost {
  background: transparent;
  color: var(--text-normal);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-modifier-hover); }

.btn-sm {
  min-height: 28px;
  padding: 2px 10px;
  font-size: 12px;
}

.btn:disabled, .btn[disabled] {
  background: var(--bg-modifier-active);
  color: var(--interactive-muted);
  cursor: not-allowed;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ---------------------------------------------------------------------------
   Inputs / Forms
   --------------------------------------------------------------------------- */
input, textarea, select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 3px;
  color: var(--text-normal);
  padding: 10px;
  font-size: 16px;
  font-family: var(--font-primary);
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand-500);
  outline: none;
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.3);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}
select option {
  background: var(--bg-secondary);
}

/* Live mod-list search (public home page) — right-aligned above the table. */
.mod-search-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.mod-search-input {
  width: 260px;
  max-width: 100%;
  padding: 8px 12px;
  font-size: 14px;
}
@media (max-width: 600px) {
  .mod-search-input { width: 100%; }
}

.form-row {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--header-secondary);
  margin-bottom: 6px;
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Checkbox */
input[type="checkbox"] {
  width: auto;
  accent-color: var(--brand-500);
  cursor: pointer;
}

/* Masked input (API keys) */
input.masked { font-family: var(--font-code); letter-spacing: 2px; }

/* ---------------------------------------------------------------------------
   Tables (Steam-inspired, Discord colors)
   --------------------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
}

/* Compact, fits-at-100%-zoom variant for wide tables (mod manager). The default
   table forces a min-width because headers are `white-space:nowrap`; that's what
   pushed the 8-column table off-screen. Here we let headers wrap, use a fixed
   layout so columns share the available width, and shrink the text/padding. */
.mods-compact { table-layout: fixed; width: 100%; }
.mods-compact thead th {
  padding: 6px 6px;
  font-size: 10px;
  letter-spacing: 0.2px;
  white-space: normal;        /* allow header text to wrap instead of forcing width */
  word-break: break-word;
  vertical-align: bottom;
}
.mods-compact tbody td {
  padding: 6px 6px;
  font-size: 12px;
  word-break: break-word;
}
/* The "(MC x.x.x)" sub-labels are redundant once the column header says MC —
   drop them in compact mode to reclaim horizontal space. */
.mods-compact .mc-sublabel { display: none; }
/* Give the name column the slack and keep version columns narrow. */
.mods-compact th:nth-child(1), .mods-compact td:nth-child(1) { width: 22%; }
.mods-compact th:nth-child(3), .mods-compact td:nth-child(3),
.mods-compact th:nth-child(4), .mods-compact td:nth-child(4),
.mods-compact th:nth-child(8), .mods-compact td:nth-child(8) { width: 8%; }

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

thead tr {
  background: var(--bg-secondary-alt);
}
thead th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--header-secondary);
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--background-modifier-accent);
  transition: background-color 0.1s ease;
}
tbody tr:nth-child(even) { background: rgba(0,0,0,.06); }
tbody tr:hover { background: var(--bg-modifier-hover); }
tbody td {
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-normal);
}

/* ---------------------------------------------------------------------------
   Sortable table headers (generic, reusable)

   Opt a table in with class="sortable-table"; main.js (initSortableTables)
   wires up the headers. Each sortable <th> declares data-sort-type
   ("text" | "number" | "version"; default "text"), and exactly one column is
   marked data-sort-default (sorted ascending on load and used as the secondary
   tiebreaker when another column is active). A header opts out with
   data-sort-type="none". Inactive columns show a small up/down arrow pair;
   the active column shows a single larger arrow — down = ascending (standard),
   up = descending (reverse).
   --------------------------------------------------------------------------- */
th.th-sortable { padding: 0; }   /* the inner button supplies the padding */

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 8px 12px;
  margin: 0;
  background: none;
  border: 0;
  cursor: pointer;
  /* match the static thead th typography */
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: inherit;
  text-align: left;
  white-space: nowrap;
  user-select: none;
}
.th-sort:hover { color: var(--text-normal); }
.th-sort:focus-visible {
  outline: 2px solid var(--brand, #5865f2);
  outline-offset: -2px;
}

.th-sort-arrows {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 0.65;
  flex-shrink: 0;
}
.th-arrow {
  font-size: 7px;
  color: var(--text-muted);
  opacity: 0.45;
  transition: opacity 0.1s ease, color 0.1s ease;
}
.th-sort:hover .th-arrow { opacity: 0.75; }

/* Active column → a single larger arrow. */
th.sort-asc  .th-arrow-up,
th.sort-desc .th-arrow-down { display: none; }
th.sort-asc  .th-arrow-down,
th.sort-desc .th-arrow-up {
  font-size: 11px;
  opacity: 1;
  color: var(--text-normal);
}

/* ---------------------------------------------------------------------------
   Badges (inline status pills)
   --------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.badge-green  { background: var(--status-positive-bg); color: #57f287; }
.badge-red    { background: var(--status-danger-bg);   color: #ff5c5c; }
.badge-yellow { background: var(--status-warning-bg);  color: #fee75c; }
.badge-blue   { background: rgba(88,101,242,.2);        color: #8b9cf8; }
.badge-grey   { background: #4f545c;                   color: #b9bbbe; }

/* ---------------------------------------------------------------------------
   Dividers
   --------------------------------------------------------------------------- */
hr, .divider {
  border: none;
  border-top: 1px solid var(--background-modifier-accent);
  margin: 12px 0;
}

/* ---------------------------------------------------------------------------
   Progress bars
   --------------------------------------------------------------------------- */
.progress-bar {
  background: var(--bg-modifier-active);
  border-radius: 2px;
  overflow: hidden;
  height: 6px;
  width: 100%;
}
.progress-bar-fill {
  height: 100%;
  background: var(--brand-500);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.progress-bar-fill.danger { background: var(--status-danger); }
.progress-bar-fill.success { background: var(--status-positive); }

/* Storage bar */
.storage-bar {
  display: flex;
  height: 10px;
  border-radius: 4px;
  overflow: hidden;
  gap: 1px;
  margin: 8px 0;
}
.storage-bar-segment { height: 100%; }

/* ---------------------------------------------------------------------------
   Console / Log panel
   --------------------------------------------------------------------------- */
.console-panel {
  background: var(--channeltextarea-background);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-code);
  font-size: 13px;
  color: var(--text-normal);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 300px;
  max-height: calc(100vh - 260px);
  line-height: 1.3;
}

/* Each console line is its own block — keep them tight so output reads like a
   real terminal instead of double-spaced (the panel's pre-wrap + per-div line
   height previously left big gaps). */
.console-line {
  margin: 0;
  padding: 0;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-input-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.console-input {
  background: var(--channeltextarea-background);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text-normal);
  font-family: var(--font-code);
  font-size: 14px;
  flex: 1;
}
.console-input:focus {
  border-color: var(--brand-500);
  outline: none;
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.3);
}

/* Log level colors */
.log-info    { color: var(--text-normal); }
.log-warning { color: var(--status-warning); }
.log-error   { color: var(--status-danger); }
.log-debug   { color: var(--text-muted); }

/* ---------------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg-primary);
  border-radius: 4px;
  box-shadow: var(--elevation-high);
  padding: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-header {
  font-size: 20px;
  font-weight: 600;
  color: var(--header-primary);
  margin-bottom: 4px;
}
.modal-subheader {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text-normal); }

/* Update progress list */
.progress-list {
  list-style: none;
  margin-bottom: 12px;
}
.progress-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--background-modifier-accent);
}
.progress-list li:last-child { border-bottom: none; }
.progress-list .step-icon { width: 18px; text-align: center; }
.step-pending  { color: var(--text-muted); }
.step-active   { color: var(--status-warning); }
.step-complete { color: var(--status-positive); }
.step-failed   { color: var(--status-danger); }

/* ---------------------------------------------------------------------------
   Login page
   --------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-modifier-active);
}
.login-box {
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: var(--elevation-high);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--header-primary);
  text-align: center;
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}
.login-error {
  background: var(--status-danger-bg);
  color: #ff5c5c;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------------------
   Dashboard grid
   --------------------------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   Notification / Alert banners
   --------------------------------------------------------------------------- */
.banner {
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner-info    { background: rgba(88,101,242,.15); color: #8b9cf8; border: 1px solid rgba(88,101,242,.3); }
.banner-success { background: var(--status-positive-bg); color: #57f287; border: 1px solid var(--status-positive); }
.banner-warning { background: var(--status-warning-bg);  color: #fee75c; border: 1px solid var(--status-warning); }
.banner-danger  { background: var(--status-danger-bg);   color: #ff5c5c; border: 1px solid var(--status-danger); }

/* ---------------------------------------------------------------------------
   Tabs (Plex sub-navigation)
   --------------------------------------------------------------------------- */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--background-modifier-accent);
  margin-bottom: 20px;
  gap: 4px;
}
.tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--interactive-normal);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.tab:hover { color: var(--interactive-hover); text-decoration: none; }
.tab.active {
  color: var(--interactive-active);
  border-bottom-color: var(--brand-500);
}

/* ---------------------------------------------------------------------------
   File browser
   --------------------------------------------------------------------------- */
.file-tree { font-size: 14px; }
.file-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
}
.file-entry:hover { background: var(--bg-modifier-hover); }
.file-icon { width: 16px; flex-shrink: 0; color: var(--text-muted); }
.file-name { flex: 1; }
.file-size { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.file-actions { opacity: 0; transition: opacity 0.1s; }
.file-entry:hover .file-actions { opacity: 1; }

/* ---------------------------------------------------------------------------
   Session cards
   --------------------------------------------------------------------------- */
.session-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}
.session-card-title {
  font-weight: 600;
  color: var(--header-primary);
  margin-bottom: 4px;
}
.session-progress {
  margin-top: 8px;
}

/* ---------------------------------------------------------------------------
   Utility classes
   --------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--header-secondary); margin-bottom: 6px; }
.empty-state-text { font-size: 14px; }

/* HTMX loading indicator */
.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator { opacity: 1; }

/* ---------------------------------------------------------------------------
   Alerts / notices
   --------------------------------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 4px solid transparent;
}
.alert a { color: var(--text-link); text-decoration: underline; }
.alert-warning  { background: rgba(250,166,26,.12);  border-color: var(--status-yellow); color: var(--text-normal); }
.alert-danger   { background: rgba(237,66,69,.12);   border-color: var(--status-red);    color: var(--text-normal); }
.alert-success  { background: rgba(59,165,92,.12);   border-color: var(--status-green);  color: var(--text-normal); }
.alert-info     { background: rgba(0,176,244,.1);    border-color: var(--text-link);     color: var(--text-normal); }

/* ---------------------------------------------------------------------------
   Settings page
   --------------------------------------------------------------------------- */
.settings-section { margin-bottom: 16px; }
.settings-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--header-primary);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg-modifier-hover);
}
.settings-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--header-secondary);
}
.form-hint { font-size: 12px; color: var(--text-muted); margin: 0; }
.form-hint code { background: var(--input-bg); padding: 1px 4px; border-radius: 3px; }
.form-select { appearance: none; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.current-session { background: var(--bg-modifier-selected) !important; }

/* ---------------------------------------------------------------------------
   Logs page
   --------------------------------------------------------------------------- */
.logs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg-modifier-hover);
  flex-wrap: wrap;
  gap: 8px;
}
.logs-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: 12px; color: var(--text-muted); margin-right: 4px; }
.logs-meta { font-size: 12px; color: var(--text-muted); }
.logs-table { font-size: 13px; }
.col-time   { width: 130px; white-space: nowrap; color: var(--text-muted); }
.col-level  { width: 80px; }
.col-logger { width: 160px; color: var(--text-muted); font-size: 12px; }
.log-message { font-family: monospace; word-break: break-all; }

.badge-level-debug   { background: var(--interactive-muted); color: var(--text-normal); }
.badge-level-info    { background: var(--status-green); }
.badge-level-warning { background: var(--status-yellow); color: #000; }
.badge-level-error   { background: var(--status-red); }

/* ---------------------------------------------------------------------------
   Console page additions
   --------------------------------------------------------------------------- */
.console-wrapper { padding: 0; overflow: hidden; }
.console-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary-alt);
  border-bottom: 1px solid var(--bg-modifier-hover);
  flex-wrap: wrap;
  gap: 8px;
}
.console-label { font-size: 12px; color: var(--text-muted); margin-right: 8px; }
.console-actions { display: flex; align-items: center; gap: 12px; }
.toggle-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; color: var(--text-muted); }
.console-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary-alt);
  border-top: 1px solid var(--bg-modifier-hover);
}
.console-prompt { color: var(--text-muted); font-family: monospace; font-size: 14px; }
.console-input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 6px 10px;
  font-family: monospace;
  font-size: 13px;
  color: var(--text-normal);
  outline: none;
}
.console-input:focus { border-color: var(--brand-500); }
.console-info-line { color: var(--text-muted); font-style: italic; }
.console-cmd-line  { color: var(--brand-500); }
.console-help { }
.quick-commands { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-cmd { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.quick-cmd code { font-size: 12px; }
.quick-cmd-label { font-size: 11px; color: var(--text-muted); }

/* ---------------------------------------------------------------------------
   Plex overview / sessions
   --------------------------------------------------------------------------- */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-hint { font-size: 12px; color: var(--text-muted); }
.active-sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.session-card {
  background: var(--bg-secondary-alt);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.session-header { display: flex; justify-content: space-between; align-items: center; }
.session-user { font-weight: 600; font-size: 14px; color: var(--header-primary); }
.session-title { font-size: 13px; color: var(--text-normal); }
.session-show { font-size: 11px; color: var(--text-muted); display: block; }
.session-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.session-quality { display: flex; gap: 8px; font-size: 12px; color: var(--text-muted); }
.badge-session-playing { background: var(--status-green); }
.badge-session-paused  { background: var(--status-yellow); color: #000; }

/* History table */
.text-muted { color: var(--text-muted); }
.progress-bar-mini {
  width: 80px;
  height: 4px;
  background: var(--bg-modifier-hover);
  border-radius: 2px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.progress-bar-fill {
  height: 100%;
  background: var(--brand-500);
  transition: width .3s;
}
.progress-bar-error .progress-bar-fill { background: var(--status-red); }
.empty-state-inline { color: var(--text-muted); font-size: 14px; padding: 16px 0; }

/* ---------------------------------------------------------------------------
   Plex library / file browser
   --------------------------------------------------------------------------- */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-bottom: 12px; font-size: 13px; }
.breadcrumb-item { color: var(--text-link); text-decoration: none; }
.breadcrumb-item:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-muted); padding: 0 2px; }
.file-table { font-size: 13px; }
.file-dir .file-link-dir { color: var(--text-link); text-decoration: none; font-weight: 500; }
.file-dir .file-link-dir:hover { text-decoration: underline; }
.file-icon { margin-right: 6px; }
.col-time { width: 140px; }
.file-size { width: 90px; color: var(--text-muted); text-align: right; }
.file-mtime { width: 130px; color: var(--text-muted); }
.file-actions { width: 80px; text-align: right; }
.file-path-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------------------
   Upload page
   --------------------------------------------------------------------------- */
.upload-zone {
  border: 2px dashed var(--bg-modifier-hover);
  border-radius: 8px;
  transition: border-color .2s, background .2s;
  cursor: pointer;
  margin-bottom: 16px;
}
.upload-zone.drag-over {
  border-color: var(--brand-500);
  background: rgba(88,101,242,.08);
}
.upload-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 8px;
}
.upload-icon { font-size: 40px; opacity: .7; }
.upload-label { font-size: 16px; color: var(--header-secondary); margin: 0; }
.upload-link { color: var(--text-link); cursor: pointer; text-decoration: underline; }
.upload-hint { font-size: 12px; color: var(--text-muted); margin: 0; }
.upload-queue-header { display: flex; align-items: center; border-bottom: 1px solid var(--bg-modifier-hover); }
.upload-list { }
.upload-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg-modifier-hover);
  font-size: 13px;
}
.upload-list-item:last-child { border-bottom: none; }
.upload-filename { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-filesize { width: 80px; text-align: right; color: var(--text-muted); }
.upload-progress { width: 120px; }
.upload-speed { width: 80px; text-align: right; font-size: 11px; color: var(--text-muted); }
.upload-actions { padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.upload-status-text { font-size: 13px; color: var(--text-muted); }
.loading-spinner-sm {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--text-muted);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-spinner {
  display: block;
  width: 32px; height: 32px;
  border: 3px solid var(--bg-modifier-hover);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 32px auto;
}

/* ---------------------------------------------------------------------------
   Compression page
   --------------------------------------------------------------------------- */
.table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.table-toolbar-actions { display: flex; gap: 8px; }
/* CompressionTier enum values: uncompressed, lossless, high_bitrate_intra, lossy, unknown */
.badge-tier-uncompressed      { background: var(--status-danger-bg);  color: #ff5c5c; }
.badge-tier-lossless          { background: var(--status-warning-bg); color: #fee75c; }
.badge-tier-high_bitrate_intra{ background: var(--status-warning-bg); color: #fee75c; }
.badge-tier-high_bitrate      { background: #3a2d52; color: #c4a7ff; }
.badge-tier-lossy             { background: var(--interactive-muted);  color: var(--text-muted); }
.badge-tier-unknown           { background: var(--interactive-muted);  color: var(--text-muted); }

/* Compression scan scope options */
.scan-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-normal);
}
.scan-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin: 0;
}
.scan-options input[type="checkbox"] { margin: 0; }
/* JobState enum values: queued, encoding, verifying, complete, failed */
.badge-job-queued    { background: var(--interactive-muted); }
.badge-job-encoding  { background: var(--brand-500); }
.badge-job-verifying { background: var(--status-info); }
.badge-job-complete  { background: var(--status-positive-bg); color: #57f287; }
.badge-job-failed    { background: var(--status-danger-bg);   color: #ff5c5c; }
.badge-job-cancelled { background: var(--interactive-muted);  color: var(--text-muted); }

/* Compression run-control bar + multi-select toolbar */
.compression-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 1rem;
}
.compression-control-bar .control-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.compression-control-bar .control-actions { display: flex; gap: 8px; }
.status-dot-running { background: var(--status-positive); animation: pulse 1.5s infinite; }
.status-dot-paused  { background: var(--status-warning); animation: none; }

.compression-select-bar {
  align-items: center;
  padding-right: 1rem;
}
.compression-select-bar .select-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem 0 0;
}
.compression-select-bar #sel-count { font-size: 13px; }

/* Compact checkbox column for the candidate table */
.table th.checkbox-col,
.table td.checkbox-col {
  width: 36px;
  text-align: center;
  padding-left: 12px;
  padding-right: 0;
}
.table td.checkbox-col input[type="checkbox"] { margin: 0; cursor: pointer; }

.badge-op-pending     { background: var(--interactive-muted); }
.badge-op-in_progress { background: var(--brand-500); }
.badge-op-complete    { background: var(--status-green); }
.badge-op-failed      { background: var(--status-red); }
.badge-op-cancelled   { background: var(--interactive-muted); }

/* ---------------------------------------------------------------------------
   Update progress partial
   --------------------------------------------------------------------------- */
.update-progress { display: flex; flex-direction: column; gap: 8px; }
.progress-header { display: flex; justify-content: space-between; align-items: center; }
.progress-title { font-weight: 600; font-size: 14px; color: var(--header-primary); }
.progress-message { font-size: 13px; color: var(--text-muted); margin: 0; }
.progress-success { font-size: 13px; color: var(--status-green); display: flex; flex-direction: column; gap: 4px; }
.progress-error   { font-size: 13px; color: var(--status-red); display: flex; flex-direction: column; gap: 4px; }
.progress-error code { font-size: 12px; background: var(--input-bg); padding: 4px 8px; border-radius: 4px; display: block; }

/* ---------------------------------------------------------------------------
   Pagination
   --------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--bg-modifier-hover);
}
.page-info { font-size: 13px; color: var(--text-muted); }

/* Infinite-scroll sentinel row — appears briefly while the next page loads. */
.infinite-loading {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.infinite-loading .loading-spinner-sm {
  vertical-align: middle;
  margin-right: 6px;
}

/* ---------------------------------------------------------------------------
   Responsive tweaks
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar { width: 72px; min-width: 72px; }
  .nav-item span:not(.nav-item-icon) { display: none; }
  .sidebar-logo-icon + * { display: none; }
  .page-content { padding: 12px; }
}

/* ---------------------------------------------------------------------------
   Public landing page — single-column layout
   --------------------------------------------------------------------------- */
.landing-body {
  background: var(--bg-modifier-active);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Landing header */
.landing-header {
  background: var(--bg-secondary);
  box-shadow: var(--elevation-low);
  position: sticky;
  top: 0;
  z-index: 10;
}
.landing-header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.landing-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.landing-logo-icon { font-size: 22px; }
.landing-logo-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--header-primary);
}
.landing-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Landing main content */
.landing-main {
  flex: 1;
  padding: 32px 24px 64px;
}
.landing-content {
  max-width: 860px;
  margin: 0 auto;
}

/* Sections */
.landing-section {
  padding: 24px 0;
}
/* Landing-page section headers — bigger and brighter than admin panel labels
   to function as real section headings, with tighter spacing to their content */
.landing-section .section-label {
  font-size: 15px;
  letter-spacing: 0.9px;
  color: var(--header-primary);
  margin-top: 0;
  margin-bottom: 4px;
}
/* Tighten the gap that the address block and download cards add on top of
   the label's bottom margin — otherwise the label "floats" above content. */
.landing-section .server-address-block { margin-top: 6px; }
.landing-section .download-cards { margin-top: 0; }
.landing-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--header-primary);
  margin-bottom: 10px;
}
.landing-blurb {
  font-size: 16px;
  color: var(--text-normal);
  max-width: 640px;
  line-height: 1.6;
}
.landing-divider {
  border: none;
  border-top: 2px solid rgba(79, 84, 92, 0.35);
  margin: 16px 0;
}
.landing-helper {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Server address block */
.server-address-block {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--channeltextarea-background);
  border-radius: 4px;
  padding: 10px 14px;
  margin-top: 12px;
}
.server-address-code {
  font-family: var(--font-code);
  font-size: 15px;
  color: var(--text-normal);
  background: none;
  border: none;
  padding: 0;
  letter-spacing: 0.3px;
}
.inline-code {
  font-family: var(--font-code);
  font-size: 13px;
  background: var(--channeltextarea-background);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--text-normal);
}

/* Generic 2-column landing row (server address + Discord, etc.) */
.two-col-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  /* default align-items: stretch makes both columns the same height */
}
@media (max-width: 700px) {
  .two-col-row { grid-template-columns: 1fr; }
}
/* Inside a two-col-row, make the wrapper div and the card itself a flex
   column so the action button (.discord-go-btn / .mc-setup-btn) pins to
   the bottom and both cards match the taller card's height exactly. */
.two-col-row > div {
  display: flex;
  flex-direction: column;
}
.two-col-row .discord-invite-card {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.two-col-row .discord-invite-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.two-col-row .discord-go-btn {
  margin-top: auto;  /* push action button to the bottom of the body */
}

/* Public "Request to Join Whitelist" form (landing hero, right column) */
.join-request-field {
  display: flex;
  gap: 8px;
  align-items: center;
}
.join-request-input {
  flex: 1;
  min-width: 0;  /* let the input shrink inside the flex row instead of overflowing */
}

/* Discord invite preview card — mimics the embed Discord renders when you
   paste an invite link in a channel: banner header, overlapping rounded
   server icon, server name + member counts, green "Go to Server" button. */
.discord-invite-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--elevation-low);
}
.discord-invite-banner {
  height: 60px;
  background: linear-gradient(135deg, var(--brand-500) 0%, #7d87f5 100%);
  background-size: cover;
  background-position: center;
}
.discord-invite-body {
  padding: 14px 16px 16px;
}
.discord-invite-body-fallback { padding: 16px; }
.discord-server-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  margin-top: -28px;  /* lift the icon up over the banner like Discord does */
  align-items: flex-start;
}
.discord-server-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 4px solid var(--bg-secondary);
  background: var(--bg-secondary);
  flex-shrink: 0;
  display: block;
}
.discord-server-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-500);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}
.discord-server-meta {
  flex: 1;
  min-width: 0;
  padding-top: 32px;  /* push name below the banner-overlap zone */
}
.discord-server-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.discord-server-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.discord-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.discord-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}
.discord-dot.online    { background: var(--status-positive); }
.discord-dot.offline   { background: var(--status-danger); }
.discord-dot.starting,
.discord-dot.stopping  { background: var(--status-warning); }
.discord-dot.updating  { background: var(--status-info); }
.discord-dot.unknown   { background: var(--text-muted); }

/* Channel row: shows the specific text channel this invite drops you into.
   Matches Discord's own channel-list look — plain text with a # icon, no
   background or border. */
.discord-invite-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--interactive-normal);
}
.discord-channel-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--interactive-normal);
}
.discord-go-btn {
  display: block;
  text-align: center;
  background: var(--status-positive);
  color: #fff;
  padding: 11px 18px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.discord-go-btn:hover {
  background: #2e9050;
  text-decoration: none;
  color: #fff;
}

/* Minecraft variant of the invite card — shares structure with the Discord
   card (banner / icon / name+stats / address) so the two sit side-by-side
   with matching visual weight. Banner is grass-green and the icon is a
   pickaxe to distinguish it from the Discord blurple banner. */
.mc-card-banner {
  background: linear-gradient(135deg, #4a7c2e 0%, #7ab852 50%, #5a8a3a 100%);
}
.mc-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-modifier-active);
  font-size: 30px;
  line-height: 1;
}

/* When the server-address-block is rendered inside the Minecraft card it
   spans the card width (default is inline-flex), drops the top margin the
   standalone version uses, and becomes a click-anywhere copy target. */
.server-address-block-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 0;
  margin-bottom: 14px;
  cursor: pointer;
  user-select: none;                  /* prevent text-selection toolbar popup */
  transition: background-color 0.2s ease;
}
.server-address-block-card .server-address-code {
  color: var(--interactive-normal);   /* muted by default, not bright white */
  user-select: none;
  transition: color 0.1s ease;
}
.server-address-block-card:hover .server-address-code,
.server-address-block-card:focus .server-address-code {
  color: var(--text-normal);          /* subtle brightening of the address text only */
}
/* "Copied ✓" feedback: brief green flash on the whole box */
.server-address-block-card.copied {
  background: var(--status-positive-bg);
}
.server-address-block-card.copied .server-address-code {
  color: #57f287;
}
/* The Copy label inside the box is a visual affordance, not an actual button —
   the parent div handles the click. Prevent it from intercepting events. */
.copy-affordance {
  pointer-events: none;
}

/* "Setup Instructions →" button mirrors Discord's "Go to Server" CTA in
   position and size, but uses Blurple instead of green so the two cards
   are distinguishable. Anchor link to the #setup section below. */
.mc-setup-btn {
  background: var(--brand-500);
}
.mc-setup-btn:hover {
  background: var(--brand-560);
}

/* Download cards: side-by-side row */
.download-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 4px;
}
@media (max-width: 600px) {
  .download-cards { grid-template-columns: 1fr; }
}
.download-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.download-card-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
}
.download-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
.download-btn {
  align-self: flex-start;
  margin-top: 4px;
}

/* Server info */
.server-info-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
}

/* Mod table (landing page variant — no hover nav concerns) */
.mod-table {
  width: 100%;
  border-collapse: collapse;
}
.mod-table thead tr {
  background: var(--bg-secondary-alt);
}
.mod-table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--header-secondary);
  padding: 8px 12px;
  text-align: left;
}
.mod-table tbody tr {
  border-bottom: 1px solid rgba(79, 84, 92, 0.2);
}
.mod-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.08);
}
.mod-table tbody td {
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text-normal);
}
.loader-row td { color: var(--text-muted); }
.mod-link {
  color: var(--text-link);
  text-decoration: none;
}
.mod-link:hover { text-decoration: underline; }
.mod-icon { border-radius: 4px; object-fit: contain; vertical-align: middle; }
.mod-icon-cell { width: 32px; padding-right: 4px; }
.mod-description { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.mod-wiki-link { font-size: 11px; color: var(--text-link); }

/* Setup steps */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.setup-step {
  display: flex;
  gap: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--elevation-low);
}
.step-number {
  font-size: 22px;
  font-weight: 700;
  color: var(--header-secondary);
  min-width: 32px;
  padding-top: 2px;
}
.step-body { flex: 1; }
.step-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary);
  margin-bottom: 6px;
}
.step-text {
  font-size: 14px;
  color: var(--text-normal);
  line-height: 1.55;
}

/* ---------------------------------------------------------------------------
   Missing structural classes
   --------------------------------------------------------------------------- */

/* Page header row: title + action buttons */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-header .page-title { margin-bottom: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* Stat card: compact metric tile used in grids */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--header-secondary);
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--header-primary);
}

/* Update progress modal: step list + log */
.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--bg-secondary-alt);
  border-radius: 6px;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.progress-log {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg-modifier-active);
  border-radius: 4px;
  max-height: 140px;
  overflow-y: auto;
}
.log-line {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text-muted);
  padding: 1px 0;
  white-space: pre-wrap;
  word-break: break-all;
}
