:root {
  --bg-main: #0a0e17;
  --bg-sidebar: #0f1523;
  --bg-card: #141b2d;
  --bg-card-hover: #192238;
  --bg-input: #0b101c;
  --border-color: #1e293b;
  --border-focus: #10b981;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --accent-blue: #3b82f6;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --terminal-bg: #070a10;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: #2a374f;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4c6b;
}

/* =========================================================
   LOGIN SCREEN
   ========================================================= */
#login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #152238 0%, #080c14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(20, 27, 45, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 40px rgba(16, 185, 129, 0.1);
  text-align: center;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--primary-glow);
}

.brand-icon svg {
  width: 26px;
  height: 26px;
  color: #fff;
}

.login-brand h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}

.login-brand span {
  color: var(--primary);
}

.login-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.default-credentials-hint {
  background: rgba(16, 185, 129, 0.1);
  border: 1px dashed var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #34d399;
  text-align: left;
}

.login-form .form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-with-icon,
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg,
.search-input-wrap svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
}

.input-with-icon input,
.search-input-wrap input {
  padding-left: 42px !important;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

/* =========================================================
   APP LAYOUT
   ========================================================= */
#app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header .brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.sidebar-header .brand-title span {
  color: var(--primary);
}

.sidebar-server-chip {
  margin: 14px 16px 8px 16px;
  padding: 10px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.server-chip-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}

.status-dot.starting {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
  animation: pulse 1s infinite;
}

.status-dot.stopping {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.chip-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}

.chip-type {
  font-size: 11px;
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 700;
  margin: 12px 8px 6px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  position: relative;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 14px;
  line-height: 1;
  color: #64748b;
  opacity: 0.25;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.18s ease;
  user-select: none;
  margin-left: auto;
}

.nav-item:hover .nav-fav-btn {
  opacity: 0.75;
}

.nav-fav-btn:hover {
  opacity: 1 !important;
  color: #fbbf24;
  transform: scale(1.25);
}

.nav-fav-btn.is-fav {
  opacity: 1 !important;
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.nav-fav-section {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.nav-mc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-right: 4px;
}

.nav-mc-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item:hover .nav-mc-icon svg {
  transform: scale(1.18);
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.nav-item:hover svg {
  color: var(--primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary);
  font-size: 13px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: capitalize;
}

.btn-icon-logout {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.btn-icon-logout:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* MAIN CONTENT */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-main);
}

/* TOP HEADER */
.top-header {
  height: 68px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title-wrap h1 {
  font-size: 18px;
  font-weight: 700;
}

.server-ip-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.2s;
}

.server-ip-badge:hover {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.08);
}

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

.server-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ctrl {
  padding: 9px 16px;
  min-height: 38px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-ctrl span:last-child {
  padding: 0 4px;
  line-height: 1.3;
}

.btn-ctrl svg {
  width: 14px;
  height: 14px;
}

.btn-start {
  background: #10b981;
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-start:hover { background: #059669; }

.btn-stop {
  background: #ef4444;
  color: #fff;
}
.btn-stop:hover { background: #dc2626; }

.btn-restart {
  background: #f59e0b;
  color: #fff;
}
.btn-restart:hover { background: #d97706; }

.btn-kill {
  background: #334155;
  color: #cbd5e1;
}
.btn-kill:hover { background: #1e293b; color: #fff; }

/* VIEW CONTAINER */
.view-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   DASHBOARD CARDS & STATS
   ========================================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

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

.stat-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.dashboard-sections {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
}

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

.card-panel-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-panel-title svg {
  color: var(--primary);
}

/* MOTD PREVIEW CONTAINER */
.motd-container {
  background: #000;
  border: 2px solid #2b2b2b;
  border-radius: 8px;
  padding: 14px 18px;
  font-family: 'Minecraft', var(--font-mono);
  font-size: 14px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

/* SERVER SPECS TABLE */
.spec-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.spec-label {
  color: var(--text-muted);
}

.spec-val {
  font-weight: 600;
  color: #fff;
  font-family: var(--font-mono);
}

/* =========================================================
   LIVE CONSOLE
   ========================================================= */
.console-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 128px);
  background: var(--terminal-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.console-toolbar {
  padding: 10px 18px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.console-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.cmd-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.cmd-chip:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--primary);
  color: #fff;
}

.console-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
}

.log-line {
  margin-bottom: 2px;
  word-break: break-all;
  white-space: pre-wrap;
}

.console-input-bar {
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.console-prompt {
  color: var(--primary);
  font-weight: 700;
  font-family: var(--font-mono);
}

.console-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-family: var(--font-mono);
  font-size: 14px;
  color: #fff;
  padding: 0 !important;
}

/* =========================================================
   PAPERMC VERSION MANAGER
   ========================================================= */
.version-hero-card {
  background: linear-gradient(135deg, rgba(20, 27, 45, 0.9) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.version-current-info {
  display: flex;
  align-items: center;
  gap: 18px;
}

.paper-logo-icon {
  width: 52px;
  height: 52px;
  background: #1e293b;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.paper-logo-icon svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.version-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.builds-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
}

.build-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.15s;
}

.build-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.build-item.selected {
  background: rgba(16, 185, 129, 0.12);
  border-left: 3px solid var(--primary);
}

.download-progress-wrap {
  margin-top: 18px;
  display: none;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 16px;
}

/* =========================================================
   CONFIGURATION FORMS
   ========================================================= */
.config-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.config-tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.config-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

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

.toggle-switch-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

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

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

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

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

/* =========================================================
   FILE MANAGER & TABLES
   ========================================================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.file-row {
  cursor: pointer;
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
}

.file-name-cell svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
}

.file-name-cell.dir svg {
  color: #38bdf8;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.7);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* CODE EDITOR TEXTAREA */
.code-editor {
  width: 100%;
  height: 420px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: #e2e8f0;
  resize: vertical;
  white-space: pre;
}

/* TOAST NOTIFICATION */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.25s ease;
  min-width: 280px;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* AVATAR IMG */
.player-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  image-rendering: pixelated;
  vertical-align: middle;
}


/* =========================================================
   ADDITIONAL ENHANCEMENTS & PLUGIN MANAGER STYLES
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge-secondary {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* SUBNAV TABS */
.subnav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}
.subnav-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.subnav-tab:hover {
  color: var(--text-main);
}
.subnav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* FILE EXPLORER TOOLBAR & BREADCRUMBS */
.file-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.file-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  flex: 1;
  min-width: 200px;
  overflow-x: auto;
}
.breadcrumb-crumb {
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.breadcrumb-crumb:hover {
  color: var(--primary);
  text-decoration: underline;
}
.breadcrumb-crumb.active {
  color: #fff;
  font-weight: 600;
  cursor: default;
  text-decoration: none;
}
.breadcrumb-separator {
  color: var(--text-dim);
}
.file-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--border-focus);
}
.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: var(--danger);
}

/* PLUGINS GRID & CARDS */
.plugins-search-bar-wrap {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.cat-pills-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
}
.cat-pill {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.cat-pill:hover {
  background: var(--bg-card-hover);
  color: #fff;
}
.cat-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}
.plugins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.plugin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.plugin-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.plugin-card-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.plugin-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.plugin-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.plugin-icon-wrap svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}
.plugin-header-info {
  flex: 1;
  min-width: 0;
}
.plugin-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.plugin-author {
  font-size: 12px;
  color: var(--text-dim);
}
.plugin-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
  min-height: 56px;
}
.plugin-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.plugin-downloads {
  display: flex;
  align-items: center;
  gap: 4px;
}
.plugin-downloads svg {
  width: 13px;
  height: 13px;
}
.plugin-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.plugin-tag {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  text-transform: capitalize;
}
.plugin-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* =========================================================
   MCA SELECTOR VISUAL MAP & INACTIVITY FILTER STYLES
   ========================================================= */
.mca-map-container {
  position: relative;
  width: 100%;
  height: 380px;
  background: #080c14;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}
.mca-map-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.mca-map-canvas:active {
  cursor: grabbing;
}
.mca-map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  z-index: 10;
}
.mca-ctrl-btn {
  background: rgba(20, 27, 45, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.mca-ctrl-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.mca-map-legend {
  position: absolute;
  bottom: 12px;
  left: 14px;
  display: flex;
  gap: 14px;
  background: rgba(15, 21, 35, 0.85);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 11px;
  z-index: 10;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.mca-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.mca-filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mca-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: #fff;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: none;
  min-width: 180px;
}

/* DASHBOARD PLAYER AVATAR CHIPS */
.dash-players-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-height: 80px;
  overflow-y: auto;
}

.dash-player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 3px 8px 3px 4px;
  font-size: 11px;
  color: var(--text-main);
  transition: all 0.2s;
}

.dash-player-chip:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--primary);
  color: #fff;
}

.dash-player-avatar {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  image-rendering: pixelated;
  flex-shrink: 0;
  background: #1e293b;
}

/* =========================================================
   MOBILE RESPONSIVENESS & MEDIA QUERIES
   ========================================================= */

/* Desktop defaults for mobile drawer controls */
.btn-mobile-menu {
  display: none;
}
.btn-close-sidebar {
  display: none;
}
.sidebar-backdrop {
  display: none;
}
.mobile-bottom-nav {
  display: none;
}

/* Tablet & Intermediate Screens (<= 1024px) */
@media screen and (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .dashboard-sections {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .top-header {
    padding: 0 20px;
  }
}

/* Mobile Devices & Small Tablets (<= 768px) */
@media screen and (max-width: 768px) {
  /* Prevent horizontal window blowouts and support mobile address bar height */
  body, #app-container {
    height: 100vh;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
  }

  #app-container {
    position: relative;
  }

  /* Off-canvas Sliding Mobile Sidebar Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.85);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-header {
    justify-content: space-between;
    padding: 16px;
  }

  /* Dimmed Backdrop for Mobile Drawer */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Hamburger & Drawer Close Buttons */
  .btn-mobile-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
  }

  .btn-mobile-menu:hover,
  .btn-mobile-menu:active {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--primary);
  }

  .btn-close-sidebar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-dim);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    margin-left: auto;
    transition: color 0.2s, background 0.2s;
  }

  .btn-close-sidebar:hover,
  .btn-close-sidebar:active {
    color: #fff;
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
  }

  /* Mobile Top Header */
  .top-header {
    height: auto;
    min-height: 52px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
  }

  .header-left {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
  }

  .header-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .header-title-wrap h1 {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .server-ip-badge {
    font-size: 11px;
    padding: 5px 9px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .server-ip-badge:active {
    transform: scale(0.95);
    background: var(--bg-card-hover);
  }

  .header-right {
    width: 100%;
  }

  /* Stacked Mobile Server Power Controls */
  .server-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
  }

  .btn-ctrl {
    height: 52px;
    padding: 7px 6px;
    border-radius: 8px;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
  }

  .btn-ctrl span:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    line-height: 1;
    pointer-events: none;
  }

  .btn-ctrl span:last-child {
    display: inline-block;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: 0.25px;
    padding: 2px 6px !important;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
  }

  .btn-ctrl:active {
    transform: scale(0.94);
  }

  /* Viewport and Card Panels with Bottom Nav Spacing */
  .view-viewport {
    padding: 12px 10px calc(76px + env(safe-area-inset-bottom, 0px)) 10px !important;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    height: 100%;
  }

  .card-panel {
    padding: 14px 12px;
    border-radius: 12px;
    margin-bottom: 14px;
  }

  .card-panel-header {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    z-index: 1020;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item:active {
    transform: scale(0.92);
  }

  .mobile-nav-item.active {
    color: var(--primary);
  }

  .mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    transition: transform 0.2s;
  }

  .mobile-nav-item.active .mobile-nav-icon {
    transform: translateY(-2px);
    filter: drop-shadow(0 2px 8px var(--primary-glow));
  }

  .mobile-nav-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
  }

  /* Dashboard Cards */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
    margin-bottom: 14px;
  }

  .stat-card {
    padding: 12px 10px;
    border-radius: 10px;
  }

  .stat-value {
    font-size: 18px;
    font-weight: 700;
  }

  .stat-sub {
    font-size: 10.5px;
  }

  /* MOTD & Quick Terminal on Mobile */
  .motd-container {
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    padding: 10px 12px;
  }

  #dash-console-preview {
    max-height: 180px;
    font-size: 11px;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-break: break-all;
  }

  /* Setup Onboarding Banner */
  #server-setup-banner {
    padding: 16px 12px !important;
  }

  #server-setup-banner > div {
    flex-direction: column !important;
    gap: 12px;
  }

  #server-setup-banner div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Horizontal Subnav Tabs (Smooth swipe/scroll on mobile) */
  .subnav-tabs {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-bottom: 14px;
    scrollbar-width: none;
  }

  .subnav-tabs::-webkit-scrollbar {
    display: none;
  }

  .subnav-tab {
    padding: 8px 12px;
    font-size: 12px;
    flex-shrink: 0;
  }

  /* Form Layouts & Inputs */
  .form-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* Set 16px font-size to prevent unwanted mobile iOS zoom */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px;
    padding: 10px 12px;
  }

  /* Server Software & Versions Responsiveness */
  #software-types-bar {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #software-types-bar::-webkit-scrollbar {
    display: none;
  }

  .software-type-btn {
    flex-shrink: 0;
    padding: 8px 14px !important;
    font-size: 13px !important;
  }

  .version-hero-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding: 16px !important;
  }

  .version-current-info {
    gap: 12px !important;
  }

  .version-hero-card .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .version-selector-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  #btn-install-paper {
    width: 100% !important;
    justify-content: center;
  }

  /* Server Settings Config Toggle Grid */
  #tab-config div[style*="repeat(3, 1fr)"],
  #subtab-config-general div[style*="repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Console View on Mobile */
  .console-wrapper {
    min-height: 280px;
    height: calc(100vh - 250px);
    height: calc(100dvh - 250px);
  }

  .console-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }

  .console-chips {
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    width: 100%;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .console-chips::-webkit-scrollbar {
    display: none;
  }

  .console-body {
    padding: 10px 12px;
    font-size: 11.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
  }

  .console-input-bar {
    padding: 8px;
    gap: 6px;
  }

  .console-input {
    font-size: 14px !important;
  }

  #btn-send-cmd {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* Data Table Responsiveness */
  .card-panel[style*="overflow: hidden"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 480px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
    font-size: 12px;
  }

  /* Toolbars across Tabs (Files, Players, Backups, Modpacks) */
  .file-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }

  .file-actions-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
  }

  .file-actions-group .btn-secondary {
    justify-content: center;
    font-size: 12px;
    padding: 8px 10px;
  }

  .sftp-connection-banner {
    padding: 12px 14px !important;
  }

  .sftp-connection-banner > div:last-child {
    width: 100%;
    justify-content: space-between;
    font-size: 11px !important;
  }

  #tab-players .card-panel > div:first-child,
  #tab-backups > div:nth-child(2) {
    flex-wrap: wrap;
    gap: 8px;
  }

  #player-action-name {
    max-width: 100% !important;
    width: 100%;
  }

  .player-tab-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Modpacks and Plugins Responsive Grid */
  .plugins-grid,
  #plugins-results-grid,
  #modpack-cards-grid,
  #plugins-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .plugins-search-bar-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .plugins-search-bar-wrap > div:first-child {
    min-width: 0 !important;
    width: 100%;
  }

  .plugins-search-bar-wrap button {
    width: 100% !important;
    justify-content: center;
  }

  .cat-pills-bar {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .cat-pills-bar::-webkit-scrollbar {
    display: none;
  }

  .cat-pill {
    flex-shrink: 0;
  }

  /* Toast Notifications on Mobile */
  #toast-container {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }

  /* Modal Dialogs on Mobile */
  .modal-overlay {
    padding: 12px;
    align-items: center;
  }

  .modal-box {
    width: 100%;
    max-width: 96vw;
    max-height: calc(100dvh - 36px);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    padding: 14px 16px;
    flex-shrink: 0;
  }

  .modal-body {
    padding: 14px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-shrink: 0;
    display: flex;
    gap: 8px;
  }

  .modal-footer button {
    flex: 1;
    justify-content: center;
  }

  /* Subuser Permissions Grid */
  #subuser-permissions-grid {
    grid-template-columns: 1fr !important;
  }

  /* Login Screen Mobile Responsiveness */
  #login-overlay {
    padding: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
  }

  .login-card {
    padding: 26px 18px;
    margin: auto 0;
    border-radius: 14px;
    max-width: 100%;
  }

  .login-brand {
    margin-bottom: 16px;
    gap: 10px;
  }

  .login-brand h2 {
    font-size: 20px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
  }

  .brand-icon svg {
    width: 22px;
    height: 22px;
  }

  .login-desc {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .default-credentials-hint {
    font-size: 12px;
    padding: 8px 12px;
    margin-bottom: 16px;
  }
}

/* Extra Small Phones (<= 480px) */
@media screen and (max-width: 480px) {
  .header-left {
    flex-wrap: wrap;
  }

  .header-title-wrap h1 {
    font-size: 14px;
  }

  .btn-ctrl {
    height: 50px;
    padding: 6px 4px;
    gap: 3px !important;
  }

  .btn-ctrl span:last-child {
    font-size: 10.5px !important;
    padding: 2px 4px !important;
  }

  .stat-card {
    padding: 10px 8px;
  }

  .stat-value {
    font-size: 16px;
  }

  .login-card {
    padding: 22px 14px;
  }
}

