/* =========================================================================
   MC Manager — Modern Dashboard
   Apple-inspired: clean whitespace, subtle depth, refined typography
   ========================================================================= */

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Neutral palette */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --surface-active: #f0f0f2;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);

  /* Text */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --text-inverse: #ffffff;

  /* Accent */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-light: rgba(0, 113, 227, 0.08);

  /* Status */
  --green: #34c759;
  --green-bg: rgba(52, 199, 89, 0.1);
  --red: #ff3b30;
  --red-bg: rgba(255, 59, 48, 0.1);
  --orange: #ff9500;
  --orange-bg: rgba(255, 149, 0, 0.1);

  /* Dimensions */
  --sidebar-width: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --transition: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Layout ---- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--text-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.nav-links {
  list-style: none;
  padding: 12px 8px;
  flex: 1;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-links a:hover {
  background: var(--surface-active);
  color: var(--text-primary);
}

.nav-links a.active {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.player-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.player-count .count {
  font-weight: 600;
  color: var(--green);
}

.build-info {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: help;
  user-select: text;
}

/* ---- Content ---- */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  max-width: 1200px;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  flex: 1;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-active);
  color: var(--text-primary);
}
.btn-secondary:hover { background: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface-active); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}
.btn-danger:hover { background: var(--red); color: white; }

.btn-sm { padding: 4px 10px; font-size: 13px; }

.btn-group {
  display: flex;
  gap: 8px;
}

/* ---- mc-router banner ---- */
.mc-router-banner {
  background: var(--red-bg);
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid var(--red);
}

/* ---- Dashboard controls (search / sort / filter toolbar) ---- */
.dashboard-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dashboard-controls .control-input {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--transition);
}

.dashboard-controls .control-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.dashboard-controls .control-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.dashboard-controls .control-select {
  padding: 9px 28px 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition);
}

.dashboard-controls .control-select:hover {
  border-color: var(--border-strong);
}

.dashboard-controls .control-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- Dashboard sections (Online cards on top, Offline list below) ---- */
.dashboard-section {
  margin-bottom: 28px;
}

.dashboard-section:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 4px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: var(--surface-active);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  letter-spacing: 0;
}

/* ---- Online grid (cards, kept from previous design but slightly polished) ---- */
.online-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

/* ---- Offline list (compact rows, scales to dozens of servers) ---- */
.offline-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.server-row {
  display: grid;
  grid-template-columns: 110px 1fr 1.5fr 1.4fr 1.2fr auto;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  font-size: 13px;
}

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

.server-row:hover {
  background: var(--surface-active);
}

.row-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.row-pack {
  color: var(--text-secondary);
}

.row-address {
  color: var(--text-secondary);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}

.row-address:hover {
  color: var(--accent);
}

.row-address.copied,
.card-address.copied {
  color: var(--green);
}

.row-address.copy-failed,
.card-address.copy-failed {
  color: var(--red);
}

.row-meta {
  color: var(--text-tertiary);
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Responsive: collapse address + meta into a stacked row on narrow widths */
@media (max-width: 900px) {
  .server-row {
    grid-template-columns: 100px 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 4px;
  }
  .row-status { grid-row: 1; grid-column: 1; }
  .row-name { grid-row: 1; grid-column: 2; }
  .row-actions { grid-row: 1; grid-column: 3; }
  .row-pack { grid-row: 2; grid-column: 2 / 4; font-size: 12px; }
  .row-address, .row-meta { display: none; }
}

/* ---- Server card (online section) ---- */
/* .server-grid kept as legacy alias in case other call sites reference it */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.server-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.server-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.online {
  background: var(--green-bg);
  color: var(--green);
}

.status-badge.offline {
  background: var(--surface-active);
  color: var(--text-tertiary);
}

.status-badge.loading {
  background: var(--orange-bg);
  color: var(--orange);
}

.status-badge.loading .status-dot {
  animation: pulse 1.5s ease-in-out infinite;
}

.status-badge.frozen {
  background: rgba(64, 156, 255, 0.12);
  color: #409cff;
}

.status-badge.frozen .status-dot {
  animation: pulse 3s ease-in-out infinite;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.online .status-dot {
  animation: pulse 2s ease-in-out infinite;
}

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

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-meta-row svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

.card-players {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.player-avatars {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.player-avatar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-light);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.player-avatar.player-avatar-more {
  background: var(--surface-active);
  color: var(--text-tertiary);
}

/* Card pack + address rows (dashboard online cards) */
.card-pack {
  font-weight: 500;
  color: var(--text);
}

.card-address {
  cursor: pointer;
  transition: color var(--transition);
}

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

.card-address-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.card-active {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Card action row (Get-client-mods CTA) */
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.card-actions .btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
}

/* ---- Forms ---- */
.create-form {
  max-width: 720px;
}

.form-section {
  margin-bottom: 32px;
}

.form-section h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-bg);
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.form-hint.error {
  color: var(--red);
}

/* Toggle switch */
.toggle-group {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-strong);
  border-radius: 24px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Mod checkboxes */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.mod-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
}

.mod-checkbox:hover {
  border-color: var(--border-strong);
}

.mod-checkbox input {
  accent-color: var(--accent);
}

.mod-checkbox span {
  font-size: 13px;
  font-weight: 500;
}

.mod-checkbox .mod-side {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ---- Deploy Progress ---- */
.deploy-progress {
  max-width: 720px;
}

.progress-header {
  margin-bottom: 16px;
}

.progress-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-active);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-fill.indeterminate {
  width: 30%;
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { margin-left: -30%; }
  100% { margin-left: 100%; }
}

/* ---- Terminal ---- */
.terminal {
  background: #1a1a2e;
  color: #c8d6e5;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  border-radius: var(--radius-sm);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal .line-error { color: var(--red); }
.terminal .line-warning { color: var(--yellow, #f0ad4e); }
.terminal .line-success { color: var(--green); }
.terminal .line-info { color: var(--accent); }

/* ---- Console ---- */
.console-wrapper {
  display: flex;
  flex-direction: column;
}

.console-input {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #1a1a2e;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.console-prompt {
  color: var(--green);
  font-family: 'SF Mono', monospace;
  font-size: 14px;
  font-weight: 600;
}

.console-input input {
  flex: 1;
  background: transparent;
  border: none;
  color: #c8d6e5;
  font-family: 'SF Mono', monospace;
  font-size: 13px;
  outline: none;
}

/* ---- Detail Page ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.detail-card.wide {
  grid-column: 1 / -1;
}

.detail-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Collapsible detail cards — <details class="detail-card"> with <summary>.
   Hides the native disclosure triangle and renders our own chevron so the
   header stays consistent with the non-collapsible cards. */
details.detail-card {
  padding: 0;
}
details.detail-card > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 20px;
  border-radius: var(--radius);
}
details.detail-card > summary::-webkit-details-marker { display: none; }
details.detail-card > summary::before {
  content: "›";
  color: var(--text-tertiary);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s ease;
  display: inline-block;
  width: 12px;
}
details.detail-card[open] > summary::before { transform: rotate(90deg); }
details.detail-card > summary:hover { background: var(--surface-active); }
details.detail-card > summary > h3 {
  display: inline;
  margin: 0;
}
details.detail-card[open] > summary {
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--border);
}
details.detail-card > .detail-card-body {
  padding: 16px 20px 20px;
}
.card-tag {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.status-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.stat-label { color: var(--text-secondary); }
.stat-value { font-weight: 500; }

.connection-address {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-active);
  border-radius: var(--radius-xs);
  font-family: 'SF Mono', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition);
}

.connection-address:hover {
  background: var(--accent-light);
}

.copy-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* ---- Player List ---- */
.player-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.player-name { font-weight: 500; flex: 1; }
.player-server {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---- Player Stats (server detail) ---- */
.player-stats-list {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.player-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.player-stat-name {
  font-weight: 500;
}

.player-stat-total {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---- Player Tables (players page) ---- */
.player-section-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0 4px;
}

.player-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 14px;
}

.player-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hover);
  user-select: none;
}

.player-table th.sortable {
  cursor: pointer;
}

.player-table th.sortable:hover {
  color: var(--accent);
}

.player-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.player-table tbody tr:last-child td {
  border-bottom: none;
}

.player-table td .status-dot {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.player-table .session-tick {
  font-variant-numeric: tabular-nums;
}

/* ---- Backup list ---- */
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.backup-name { font-weight: 500; }
.backup-size { color: var(--text-secondary); }

/* ---- Loading ---- */
.loading {
  display: flex;
  justify-content: center;
  padding: 40px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.loading-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
  padding: 8px 0;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ---- Inline icon button ---- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition);
  vertical-align: middle;
  margin-left: 4px;
}

.btn-icon:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.btn-icon.spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- Sleep Notifications ---- */
.sleep-notifications {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sleep-notification {
  background: var(--surface);
  border: 1px solid rgba(94, 92, 230, 0.2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

.sleep-notification.dismissing {
  animation: slideUp 0.3s ease forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

.sleep-notification-terminal {
  background: #1a1a2e;
  color: #c8d6e5;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px 16px;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.sleep-notification-terminal .line-error { color: var(--red); }
.sleep-notification-terminal .line-warning { color: var(--yellow, #f0ad4e); }
.sleep-notification-terminal .line-success { color: var(--green); }
.sleep-notification-terminal .line-info { color: var(--accent); }

/* ---- Host Resources Bar ---- */
.host-resources {
  margin-bottom: 16px;
}

.resource-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.resource-label {
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-primary);
}

.resource-meta {
  white-space: nowrap;
}

/* ---- Unified Settings Sections ---- */
.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Collapsible Settings sub-sections — <details class="settings-section">. */
details.settings-section {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
details.settings-section:first-of-type {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}
details.settings-section > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  margin-bottom: 0;
}
details.settings-section > summary::-webkit-details-marker { display: none; }
details.settings-section > summary::before {
  content: "›";
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1;
  transition: transform 0.15s ease;
  display: inline-block;
  width: 10px;
}
details.settings-section[open] > summary::before { transform: rotate(90deg); }
details.settings-section[open] > summary { margin-bottom: 10px; }
details.settings-section > summary > .settings-section-title {
  margin-bottom: 0;
  display: inline;
}
.section-tag {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.restart-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--orange);
  background: var(--orange-bg);
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: middle;
}

.props-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.raw-props-toggle {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.raw-props-toggle:hover {
  color: var(--text-primary);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }

  .sidebar .logo-text,
  .sidebar .nav-links a span:not(.logo-icon),
  .sidebar-footer {
    display: none;
  }

  .nav-links a {
    justify-content: center;
    padding: 12px;
  }

  .content {
    margin-left: 60px;
    padding: 20px;
  }

  .server-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .props-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 8px);
  width: min(560px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.modal-body { padding: 16px 18px; overflow-y: auto; color: var(--text-primary); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.we-status-line { font-size: 13px; margin-bottom: 8px; color: var(--text-secondary); }
.we-status-line.running { color: var(--green); }
.we-status-line.stopped { color: var(--text-tertiary); }
.we-players-line { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; }
.we-steps {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
}
.we-steps div { padding: 2px 0; }
.we-step-list { margin-bottom: 12px; }
.we-step-list .we-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}
.we-step .we-icon { display: inline-block; width: 16px; text-align: center; }
.we-step.pending { color: var(--text-tertiary); }
.we-step.active { color: var(--text-primary); font-weight: 500; }
.we-step.done { color: var(--green); }
.we-step.skipped { color: var(--text-tertiary); }
.we-step.error { color: var(--red); }
.we-progress-log {
  background: var(--surface-active);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  padding: 10px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  max-height: 220px;
  overflow-y: auto;
}
.we-progress-log .log-line { padding: 1px 0; white-space: pre-wrap; word-break: break-word; }
.we-progress-log .log-line.error { color: var(--red); }
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}
.form-row label {
  flex: 0 0 auto;
  min-width: 130px;
  font-size: 13px;
  color: var(--text-secondary);
}
.form-row input,
.form-row select {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  padding: 6px 8px;
  font-size: 13px;
}
.form-row input[type="number"] { width: 80px; }
.form-row input[type="text"] { flex: 1; }
.form-row input[type="range"] { padding: 0; border: none; background: transparent; flex: 1; }

.we-move-block { margin: 10px 0; }
.we-move-grid {
  display: grid;
  grid-template-columns: 130px repeat(3, 100px);
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
}
.we-move-label {
  font-size: 13px;
  color: var(--text-secondary);
}
.we-move-axis-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: center;
  font-family: ui-monospace, monospace;
}
.we-move-cell {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  background: var(--surface);
  color: var(--text-primary);
  width: 100%;
  box-sizing: border-box;
  text-align: right;
}
.we-move-cell-ro {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
#we-edit-move-btn { margin-top: 8px; }
.we-move-cheat {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.we-move-cheat > summary {
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.we-move-cheat-table {
  border-collapse: collapse;
  margin: 6px 0;
  font-family: ui-monospace, monospace;
}
.we-move-cheat-table th,
.we-move-cheat-table td {
  border: 1px solid var(--border);
  padding: 3px 8px;
  text-align: left;
}
.we-move-cheat-table th { background: var(--surface); font-weight: 600; }
.we-move-cheat-note { margin-top: 6px; }
.we-move-cheat-note code,
.we-move-cheat-formula code,
.we-move-cheat-table code {
  font-family: ui-monospace, monospace;
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 3px;
}
.we-move-cheat-formula {
  margin: 6px 0;
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

/* ---- World editor modal ---- */
.editor-modal { width: min(1100px, 96vw); max-height: 92vh; }
.editor-body { padding: 12px 18px; }
.we-editor-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.we-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.we-tab:hover { color: var(--text-primary); }
.we-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent, #0071e3);
  font-weight: 500;
}
.we-inv-grid {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}
.we-inv-slot {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.we-inv-slot-num {
  font-size: 10px;
  color: var(--text-tertiary);
  text-align: right;
  font-family: ui-monospace, monospace;
}
.we-inv-slot input {
  font-size: 11px;
  padding: 3px 5px;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs, 6px);
}
.we-inv-slot input[type="number"] { text-align: right; }
.we-inv-slot { position: relative; }
.we-inv-clear {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  padding: 0;
  font-size: 14px;
  font-weight: bold;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}
.we-inv-clear:hover {
  color: var(--danger, #d33);
  border-color: var(--danger, #d33);
  background: var(--surface);
}

.we-hold-cell {
  max-width: 280px;
  white-space: normal;
  line-height: 1.6;
}
.we-hold-chip {
  display: inline-block;
  padding: 1px 6px;
  margin: 1px 2px 1px 0;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs, 6px);
  color: var(--text-secondary);
}
.we-editor-toolbar {
  display: flex; gap: 8px; align-items: center;
  margin: 8px 0 10px; flex-wrap: wrap;
}
.we-editor-toolbar input[type="text"],
.we-editor-toolbar select {
  flex: 0 1 auto; min-width: 140px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  font-size: 13px;
}
.we-editor-toolbar input[type="text"] { flex: 1 1 220px; }
.we-editor-count { color: var(--text-secondary); font-size: 12px; margin-left: auto; }
.we-editor-table-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  max-height: 60vh; overflow-y: auto;
  background: var(--surface);
}
table.we-editor-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text-primary); }
table.we-editor-table th, table.we-editor-table td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
table.we-editor-table th {
  position: sticky; top: 0;
  background: var(--surface-active);
  cursor: pointer; user-select: none;
  font-weight: 500; color: var(--text-secondary);
}
table.we-editor-table th[data-sort-active] { color: var(--text-primary); }
table.we-editor-table tr:hover td { background: var(--surface-hover); }
table.we-editor-table td.numeric { font-variant-numeric: tabular-nums; text-align: right; }

.villager-edit-modal { width: min(820px, 96vw); max-height: 92vh; }
.we-trades {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  padding: 8px;
  margin-top: 8px;
  background: var(--surface);
}
.we-trade-row {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1.5fr 64px 56px 64px 24px;
  gap: 6px; align-items: start;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-primary);
}
.we-trade-row:last-child { border-bottom: none; }
.we-trade-row input {
  padding: 4px 6px;
  font-size: 12px;
  width: 100%; box-sizing: border-box;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
}
.we-trade-row .we-trade-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
.we-item-row {
  display: grid;
  grid-template-columns: 1fr 50px;
  gap: 4px;
  align-items: center;
}
.we-count-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.we-trade-actions { display: flex; gap: 8px; margin-top: 6px; }
.we-cure-block {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  background: var(--surface);
}
.we-cure-block input[type="text"] {
  width: 320px;
  padding: 6px 8px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  font-size: 12px;
  font-family: ui-monospace, monospace;
}
.we-gossip-list { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.we-gossip-list .gossip-row { padding: 1px 0; font-family: ui-monospace, monospace; }

.we-gossip-row {
  display: grid;
  grid-template-columns: 110px 1fr 80px 24px;
  gap: 8px;
  align-items: center;
  padding: 3px 6px;
  font-size: 12px;
  border-radius: 4px;
}
.we-gossip-row + .we-gossip-row { margin-top: 2px; }
.we-gossip-row .we-gossip-type { color: var(--text-primary); }
.we-gossip-row .we-gossip-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  text-align: right;
}
.we-gossip-row.is-negative .we-gossip-type {
  color: var(--orange, #ff9500);
}
.we-gossip-row.is-pending-remove {
  text-decoration: line-through;
  opacity: 0.55;
}
.we-gossip-pending-badge {
  grid-column: 1 / -1;
  font-size: 10px;
  color: var(--orange, #ff9500);
  padding-left: 6px;
}
.we-gossip-remove {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.we-gossip-remove:hover {
  color: var(--red, #e44);
  border-color: var(--red, #e44);
}

.we-cure-checklist {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs, 6px);
  background: var(--surface);
}
.we-cure-filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.we-cure-filter {
  flex: 1 1 180px;
  padding: 4px 6px;
  font-size: 12px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs, 6px);
}
.we-cure-selectall {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.we-cure-count { font-size: 11px; color: var(--text-tertiary); }
.we-cure-rows {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 6px;
}
.we-cure-row {
  display: grid;
  grid-template-columns: 18px 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 2px 4px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}
.we-cure-after {
  font-size: 10px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.we-cure-row:hover { background: var(--surface-strong, rgba(255,255,255,0.04)); }
.we-cure-uuid { color: var(--text-tertiary); font-family: ui-monospace, monospace; font-size: 10px; }
.we-cure-current {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--accent, #0071e3);
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.we-cure-header {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 4px;
}
.we-cure-explain {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.45;
  margin-bottom: 8px;
}
.we-cure-explain code {
  font-size: 10px;
  background: var(--surface-strong, rgba(255,255,255,0.06));
  padding: 1px 4px;
  border-radius: 3px;
}
.we-gossip-list-header {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 12px;
  margin-bottom: 4px;
}

.we-bulk-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.we-bulk-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.we-players-ref-card {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs, 6px);
  background: var(--surface);
}
.we-players-ref-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.we-players-ref-toggle {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}
.we-players-ref-title { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.we-players-ref-count { font-size: 11px; color: var(--text-tertiary); margin-left: auto; }
.we-players-ref-body { padding: 4px 10px 10px; }
.we-players-ref-uuid {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-tertiary);
}
.we-players-ref-copy {
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  margin-left: 4px;
  line-height: 1.3;
}
.we-players-ref-copy:hover { color: var(--accent, #0071e3); border-color: var(--accent, #0071e3); }
.we-players-ref-table th { font-size: 11px; }
.we-players-ref-table td { font-size: 12px; }

.we-item-cell { display: flex; flex-direction: column; gap: 4px; }
.we-item-cell.enchanted input { border-color: var(--accent, #0071e3); }
.we-ench-list { display: flex; flex-direction: column; gap: 4px; }
.we-ench-row { display: flex; gap: 4px; align-items: stretch; }
.we-ench-row select {
  flex: 1; min-width: 0;
  padding: 3px 4px;
  font-size: 11px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
}
.we-ench-row select[data-f$="EnchLvl"] { flex: 0 0 56px; }
.we-ench-remove {
  flex: 0 0 22px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  cursor: pointer;
}
.we-ench-remove:hover { color: var(--text-primary); border-color: var(--accent, #0071e3); }
.we-ench-add {
  align-self: stretch;
  padding: 3px 4px;
  font-size: 11px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  cursor: pointer;
}
.we-ench-add:hover { color: var(--text-primary); border-color: var(--accent, #0071e3); }
#we-edit-cure-picker {
  padding: 6px 8px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs, 6px);
  font-size: 13px;
  min-width: 240px;
}


/* ---- Create Server: Find Seed link + form-link buttons ---- */
.form-link {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent, #0071e3);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
.form-link:hover {
  text-decoration: underline;
}

/* ---- Create Server: mod-source side panel ---- */
.side-panel {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.side-panel-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.side-panel-body {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--surface, #fff);
  border-left: 1px solid var(--border-strong, #ddd);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}
.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.side-panel-header h2 { margin: 0; font-size: 18px; }
.side-panel-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-strong, #ddd);
  margin-bottom: 12px;
}
.side-panel-tabs .tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.side-panel-tabs .tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent, #0071e3);
}
.side-panel-tab-body input,
.side-panel-tab-body textarea {
  width: 100%;
  margin-bottom: 8px;
}
.mod-source-results {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mod-source-hit {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border-strong, #ddd);
  border-radius: 6px;
}
.mod-source-icon {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.mod-source-meta {
  flex: 1;
  min-width: 0;
}
.mod-source-meta strong { display: block; font-size: 14px; }
.mod-source-meta p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mod-source-meta small { font-size: 11px; color: var(--text-secondary); }
.empty-state.error { color: #d32f2f; }
.empty-state.success { color: #2e7d32; }

/* ---- Create Server: pack-source hint + badges ---- */
.form-hint.success { color: #2e7d32; }
.badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 500;
  background: var(--surface-hover, #eee);
  border-radius: 4px;
  margin-left: 4px;
  color: var(--text-secondary);
}
/* Client-bundle rows (client-zip-split.feature.md #8) */
.client-bundles { display: flex; flex-direction: column; gap: 8px; }
.client-bundle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-hover, #f5f5f5);
  border-radius: 6px;
}
.client-bundle-meta { display: flex; flex-direction: column; gap: 2px; }
.client-bundle-meta small { color: var(--text-secondary); font-size: 11px; }
.client-bundles-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.client-bundles-actions small { color: var(--text-tertiary); font-size: 11px; }

/* Mod-registry status badges (mod-system #7/#8 sub-bullets) */
.badge-installed { background: #c8e6c9; color: #1b5e20; }
.badge-cached    { background: #bbdefb; color: #0d47a1; }
.badge-available { background: #fff3cd; color: #5f4400; }

.detail-cached-mods-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.detail-cached-mods-actions input[type="search"] {
  flex: 1;
  padding: 4px 8px;
  font-size: 13px;
}
.mod-source-controls {
  display: flex;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
}
.mod-source-controls label {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mod-source-controls select {
  font-size: 12px;
  padding: 2px 4px;
}

/* ---- Create Server: error banner ---- */
.form-error-banner {
  background: #fbe9e9;
  color: #d32f2f;
  border: 1px solid #f5c6c6;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ---- Shared player picker (server-management criterion 9) ---- */
.player-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.player-picker-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.player-picker-row input {
  flex: 1;
}
.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 0;
}
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 8px;
  font-size: 12px;
  background: var(--surface-hover, #eee);
  border-radius: 12px;
  color: var(--text-primary);
}
.player-chip-x {
  background: transparent;
  border: none;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
}
.player-chip-x:hover {
  color: var(--text-primary);
}

/* ---- Create Server: side-aware mod lists + resource packs ---- */
.mod-sublist,
.rp-sublist {
  margin-bottom: 16px;
}
.mod-sublist h3,
.rp-sublist h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: -0.1px;
}
.mod-sublist h3 small,
.rp-sublist h3 small {
  font-weight: 400;
  color: var(--text-tertiary, #999);
}
.rp-custom-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rp-custom-row input[type="url"] {
  flex: 2;
  min-width: 200px;
}
.rp-custom-row input[type="text"] {
  flex: 1;
  min-width: 150px;
  font-family: monospace;
  font-size: 12px;
}
.rp-custom-row select {
  flex: 1;
  min-width: 120px;
}
.rp-custom-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---- Create Server: error banner with recovery action ---- */
.form-error-banner .form-error-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.form-error-banner-resolved {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #c8e6c9;
}

/* ---- Server detail: mods + resource packs cards ---- */
.detail-mods-actions { margin-bottom: 12px; }
.detail-mods-list,
#detail-rp-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.detail-mod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border: 1px solid var(--border-strong, #ddd);
  border-radius: 6px;
  font-size: 13px;
}
.detail-mod-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.detail-mod-meta strong { font-size: 13px; }
.detail-mod-meta small { font-size: 11px; color: var(--text-secondary); }
.detail-rp-add {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.detail-rp-add input[type="url"] { flex: 2; min-width: 200px; }
.detail-rp-add input[type="text"] { flex: 1; min-width: 150px; font-family: monospace; font-size: 12px; }
.detail-rp-add select { flex: 1; min-width: 120px; }
.additive-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  margin-bottom: 12px;
  background: var(--surface-hover, #f5f5f5);
  border-radius: 6px;
}

/* Mod Facts: villager Trade Pool panel (mod-facts-probe.feature.md). */
.we-trade-pool-panel {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong, rgba(255,255,255,0.03));
}
.we-trade-pool-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.we-trade-pool-tier {
  margin: 4px 0;
  font-size: 12px;
}
.we-trade-pool-tier summary {
  cursor: pointer;
  color: var(--text-secondary);
  padding: 2px 0;
}
.we-trade-pool-row {
  padding: 2px 6px 2px 16px;
  color: var(--text-primary);
  font-family: ui-monospace, monospace;
  font-size: 11px;
}
