:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --panel: #141922;
  --panel-hover: #1b222d;
  --border: #262e3a;
  --text: #dbe2ee;
  --muted: #7d8798;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.12);
  --danger: #f85149;
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "Cascadia Code", Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Custom scrollbars for every scrollable panel, menu and dialog (the page
   itself stays scrollbar-free - see the html rules further down). */
* { scrollbar-width: thin; scrollbar-color: rgba(125, 135, 152, 0.35) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(125, 135, 152, 0.3);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: rgba(125, 135, 152, 0.55); }
*::-webkit-scrollbar-thumb:active { background-color: rgba(88, 166, 255, 0.7); }
*::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-button { display: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.1rem; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--panel); padding: 0.1rem 0.4rem; border-radius: 4px; }
button, input, textarea { font-family: inherit; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; }
.page-subtitle { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.9rem; }

/* Rotating background */
body.has-bg { background: #05070b; }
.bg-stage { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-slide, .bg-slide-leaving {
  position: absolute;
  inset: -3%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 2.4s ease;
  will-change: opacity, transform;
}
.bg-slide.active { opacity: 1; animation: kenburns 30s ease-in-out infinite alternate; }
@keyframes kenburns {
  from { transform: scale(1.02) translate(0, 0); }
  to { transform: scale(1.12) translate(-1.5%, -1%); }
}
.bg-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 10, 15, 0.45) 0%, rgba(8, 10, 15, 0.15) 45%, rgba(8, 10, 15, 0.15) 100%),
    linear-gradient(180deg, rgba(8, 10, 15, 0.25) 0%, rgba(8, 10, 15, 0.4) 60%, rgba(8, 10, 15, 0.7) 100%);
}

/* Frosted-glass surfaces so the background shows through */
body.has-bg {
  --glass: rgba(15, 19, 27, 0.72);
  --glass-strong: rgba(15, 19, 27, 0.86);
}
body.has-bg .sidebar,
body.has-bg .fb-list,
body.has-bg .server-card,
body.has-bg .side-card,
body.has-bg .card,
body.has-bg .empty-state,
body.has-bg .jar-upload-panel,
body.has-bg .term-header,
body.has-bg .selection-bar {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
}
body.has-bg .sidebar { background: var(--glass-strong); border-right-color: rgba(255, 255, 255, 0.06); }
body.has-bg .term-window { background: rgba(6, 9, 17, 0.9); }
body.has-bg .fb-head { background: rgba(255, 255, 255, 0.02); }
body.has-bg .dd-button, body.has-bg .btn-ghost { background: rgba(15, 19, 27, 0.55); }
body.has-bg .login-box {
  padding: 2.25rem 2rem;
  border-radius: 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border);
}

/* Tooltip (replaces the browser's native title popup) */
.tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 260px;
  padding: 0.4rem 0.65rem;
  border-radius: 7px;
  background: #1f2733;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  transition: opacity 0.14s ease, transform 0.18s var(--ease-out);
}
.tooltip.show { opacity: 1; transform: translateY(0) scale(1); }
.tooltip.below { transform: translateY(-4px) scale(0.97); }
.tooltip.below.show { transform: translateY(0) scale(1); }

/* Modal dialog */
dialog.modal {
  width: min(440px, calc(100vw - 2rem));
  padding: 0;
  border: none;
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--border);
}
dialog.modal::backdrop { background: rgba(5, 7, 11, 0.65); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: modalIn 0.22s var(--ease-out); }
dialog.modal:focus { outline: none; }
dialog.modal[open]::backdrop { animation: fadeIn 0.2s ease; }
.modal-body { padding: 1.4rem 1.5rem 1rem; }
.modal-body h2 { margin: 0 0 0.35rem; }
.modal-body p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1rem 1.5rem 1.4rem; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }

.text-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Toast notifications */
.toast-stack { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 900; display: flex; flex-direction: column; gap: 0.6rem; }
.toast {
  min-width: 260px;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-pop);
  font-size: 0.85rem;
  animation: toastIn 0.25s var(--ease-out);
}
.toast.leaving { animation: toastOut 0.2s ease forwards; }
.toast .progress { height: 4px; margin-top: 0.55rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.toast .progress > div { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }
.toast.error { box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(248, 81, 73, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.9rem;
  background: var(--panel);
  border-right: 1px solid var(--border);
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.3rem 0.6rem 1.4rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #071018;
  font-size: 0.85rem;
  font-weight: 800;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.2rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a span { flex: 1; }
.sidebar-nav a:hover { background: var(--panel-hover); color: var(--text); }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-nav a.nav-locked { opacity: 0.45; }
.sidebar-nav a.nav-locked:hover { background: none; color: var(--muted); }
.icon-sm { width: 14px; height: 14px; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 0.5rem 0;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  margin-left: -0.5rem;
  background: transparent;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
  text-align: left;
}
.sidebar-user:hover { background: var(--panel-hover); filter: none; }
.sidebar-user:active { transform: none; }
.sidebar-user .settings-gear { margin-left: auto; color: var(--muted); transition: transform 0.4s var(--ease-out), color 0.15s ease; }
.sidebar-user:hover .settings-gear { color: var(--text); transform: rotate(60deg); }

/* Settings dialog */
dialog.settings-modal { width: min(520px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow-y: auto; overscroll-behavior: contain; }
.settings-modal .modal-body { padding-bottom: 1.5rem; }
.settings-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.5rem; }
.settings-head h2 { margin: 0; }
.settings-close { margin-left: auto; align-self: flex-start; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.avatar-editor { display: flex; align-items: center; gap: 1.1rem; padding: 0.9rem; border-radius: 12px; background: var(--bg); }
.avatar-xl { position: relative; width: 76px; height: 76px; font-size: 1.8rem; flex-shrink: 0; cursor: pointer; }
.avatar-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 11, 0.6);
  color: #fff;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.avatar-drop:hover .avatar-overlay, .avatar-drop.dragging .avatar-overlay { opacity: 1; }
.avatar-drop.dragging { box-shadow: 0 0 0 3px var(--accent); }
.avatar-editor-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.avatar-editor-text b { font-size: 0.9rem; }
.avatar-editor-text small { color: var(--muted); font-size: 0.8rem; }
.avatar-editor-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.avatar-editor-actions .btn-ghost { padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.avatar-remove:hover { border-color: var(--danger); color: var(--danger); }
.settings-section {
  margin: 1.5rem 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}
.toggle-row + .toggle-row { margin-top: 0.5rem; }
.toggle-row b { display: block; font-size: 0.9rem; font-weight: 600; }
.toggle-row small { color: var(--muted); font-size: 0.8rem; }
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: #2b3340;
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.22s var(--ease-out);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shortcut-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; }
.shortcut-list div { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.shortcut-list dt { display: flex; align-items: center; gap: 0.25rem; white-space: nowrap; font-size: 0.8rem; color: var(--muted); }
.shortcut-list dd { margin: 0; font-size: 0.83rem; text-align: right; }
@media (max-width: 560px) { .shortcut-list { grid-template-columns: 1fr; } }

/* Appearance preferences */
html.pref-no-bg .bg-stage { display: none; }
html.pref-no-motion *, html.pref-no-motion *::before, html.pref-no-motion *::after {
  animation: none !important;
  transition: none !important;
}
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--panel-hover);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
}
.sidebar-username { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout { display: inline-flex; padding: 0.4rem; border-radius: 6px; color: var(--muted); }
.sidebar-logout:hover { background: var(--panel-hover); color: var(--danger); }

main {
  padding: 2rem 1.75rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}
body.has-sidebar main {
  margin-left: 240px;
  max-width: none;
  padding: 2rem 2.5rem 3rem;
}

/* (responsive sidebar: see "Responsive layout" at the end of this file) */
}

.login-box {
  max-width: 340px;
  margin: 6rem auto;
  text-align: center;
}

.login-box h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }

.login-box input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.login-box input:focus { outline: none; border-color: var(--accent); }

button {
  padding: 0.55rem 1.1rem;
  background: var(--accent);
  border: none;
  border-radius: 7px;
  color: #071018;
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}

button:hover { filter: brightness(1.1); }
button:active { transform: scale(0.97); }
button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
.btn-ghost:active { transform: scale(0.97); }
button:disabled { opacity: 0.35; cursor: not-allowed; filter: none; }

button.btn-danger { background: var(--danger); color: #fff; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn-icon:hover { background: var(--accent-soft); color: var(--accent); filter: none; }
.btn-icon-danger:hover { background: rgba(248, 81, 73, 0.12); color: var(--danger); }
.btn-icon:active { transform: scale(0.92); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  display: block;
  padding: 1.4rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h2 { margin-top: 0; margin-bottom: 0.4rem; color: var(--text); font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.card-locked { opacity: 0.55; }
.card-locked:hover { border-color: var(--border); transform: none; }
.lock-badge {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.2rem 0.55rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
}

.toolbar { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
form.inline { display: inline-flex; gap: 0.5rem; align-items: center; margin: 0; }
form.inline input[type="text"] {
  padding: 0.5rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}
form.inline input[type="file"] { font-size: 0.82rem; color: var(--muted); max-width: 160px; }

.file-table { width: 100%; border-collapse: collapse; }
.file-table th, .file-table td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
.file-table th { color: var(--muted); font-weight: 500; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* File browser */
.fb-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.breadcrumbs { display: flex; align-items: center; gap: 0.1rem; margin-top: 0.45rem; font-family: var(--font-mono); font-size: 0.83rem; color: var(--muted); flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); text-decoration: none; padding: 0.15rem 0.4rem; border-radius: 5px; transition: background 0.15s ease, color 0.15s ease; }
.breadcrumbs a:last-child { color: var(--text); }
.breadcrumbs a:hover { background: var(--panel-hover); color: var(--accent); }
.breadcrumbs .icon { opacity: 0.5; }

.fb-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.fb-list {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fb-head, .fb-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 100px 170px 110px;
  align-items: center;
  gap: 1rem;
  padding: 0 1.1rem;
}
.fb-head {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.fb-head span:nth-child(3), .fb-head span:nth-child(4) { text-align: right; }

/* Row selection */
.fb-item { cursor: default; }
.fb-item.selected { background: rgba(56, 139, 253, 0.12); }
.fb-item.selected:hover { background: rgba(56, 139, 253, 0.17); }
.fb-item.focused { box-shadow: inset 2px 0 0 var(--accent); }
.fb-item.selected .fb-row-actions { opacity: 1; }

.check { position: relative; display: inline-flex; width: 18px; height: 18px; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check span {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #3a4454;
  background: var(--bg);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease-out);
}
.check:hover span { border-color: var(--accent); }
.check input:checked + span, .check input:indeterminate + span { background: var(--accent); border-color: var(--accent); }
.check input:checked + span::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2.5px;
  width: 5px;
  height: 10px;
  border-right: 2px solid #071018;
  border-bottom: 2px solid #071018;
  transform: rotate(45deg);
}
.check input:indeterminate + span::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 10px;
  height: 2px;
  background: #071018;
  border-radius: 1px;
}
.check input:disabled + span { opacity: 0.35; cursor: default; }
.check:active span { transform: scale(0.88); }
.fb-item:not(.selected) .check { opacity: 0.55; transition: opacity 0.15s ease; }
.fb-item:hover .check, .fb-list:has(.fb-item.selected) .check { opacity: 1; }

/* Drag-to-move */
.fb-item[draggable="true"] { -webkit-user-drag: element; }
.fb-item.drag-source { opacity: 0.4; }
.fb-row.drop-target,
.fb-item.drop-target {
  background: rgba(56, 139, 253, 0.16) !important;
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: 8px;
}
.fb-row.drop-target .icon-dir { transform: scale(1.15); }
.icon-dir { transition: transform 0.2s var(--ease-out); }
.breadcrumbs a.drop-target { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.drag-chip {
  position: fixed;
  top: -200px;
  left: -200px;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  background: var(--accent);
  color: #071018;
  font: 600 0.82rem var(--font-sans);
  white-space: nowrap;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.6);
}

/* Floating bulk-action bar */
.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem 0.45rem 1rem;
  border-radius: 12px;
  background: #1a212c;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--border);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.25s var(--ease-out);
}
body.has-sidebar .selection-bar { left: calc(50% + 120px); }
.selection-bar.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0) scale(1); }
.selection-count { font-size: 0.85rem; color: var(--muted); padding-right: 0.3rem; white-space: nowrap; }
.selection-count b { color: var(--text); font-variant-numeric: tabular-nums; }
.selection-divider { width: 1px; height: 20px; background: var(--border); margin: 0 0.25rem; }
.sel-btn {
  padding: 0.4rem 0.75rem;
  background: transparent;
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 500;
  border-radius: 8px;
}
.sel-btn:hover { background: var(--panel-hover); filter: none; }
.sel-btn .icon { width: 16px; height: 16px; }
.sel-danger { color: var(--danger); }
.sel-danger:hover { background: rgba(248, 81, 73, 0.14); }

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  text-align: center;
}

.fb-row {
  min-height: 46px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}
.fb-list > .fb-row:nth-last-child(2) { border-bottom: none; }
.fb-row:hover { background: var(--panel-hover); }

.fb-link { display: flex; align-items: center; gap: 0.7rem; min-width: 0; padding: 0.7rem 0; color: var(--text); text-decoration: none; }
.fb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.fb-link:hover .fb-name { color: var(--accent); }
.fb-size, .fb-date { text-align: right; color: var(--muted); font-size: 0.8rem; font-family: var(--font-mono); white-space: nowrap; }
.fb-row-actions { display: flex; gap: 0.2rem; justify-content: flex-end; align-items: center; opacity: 0; transition: opacity 0.15s ease; }
.fb-row:hover .fb-row-actions, .fb-row:focus-within .fb-row-actions { opacity: 1; }
.fb-up { color: var(--muted); }
.fb-up .fb-name { color: var(--muted); }

.fb-empty { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 3.5rem 1rem; color: var(--muted); text-align: center; }
.fb-empty .icon { width: 32px; height: 32px; margin-bottom: 0.4rem; opacity: 0.6; }
.fb-empty p { margin: 0; color: var(--text); font-weight: 600; }
.fb-empty span { font-size: 0.85rem; }

.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  background: rgba(11, 14, 20, 0.88);
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.drop-overlay .icon { width: 36px; height: 36px; transform: translateY(6px); transition: transform 0.3s var(--ease-out); }
.drop-overlay p { margin: 0; color: var(--text); }
.fb-list.dragging { min-height: 220px; box-shadow: 0 0 0 4px var(--accent-soft); }
.fb-list.dragging .drop-overlay { opacity: 1; }
.fb-list.dragging .drop-overlay .icon { transform: translateY(0); animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }

.modal-input { margin-top: 1rem; }

/* Page-wide JAR drop target on the console page */
.jar-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.jar-drop-overlay.show { opacity: 1; }
.jar-drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: min(560px, 100%);
  padding: 3.5rem 2rem;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: rgba(20, 25, 34, 0.9);
  text-align: center;
  transform: scale(0.96);
  transition: transform 0.25s var(--ease-out);
}
.jar-drop-overlay.show .jar-drop-card { transform: scale(1); }
.jar-drop-card .icon { width: 40px; height: 40px; color: var(--accent); animation: bob 1.2s ease-in-out infinite; }
.jar-drop-card p { margin: 0.4rem 0 0; font-size: 1.1rem; font-weight: 600; }
.jar-drop-card span { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 800px) {
  .fb-head, .fb-row { grid-template-columns: 22px minmax(0, 1fr) 80px 90px; }
  .fb-head span:nth-child(4), .fb-date { display: none; }
  body.has-sidebar .selection-bar { left: 50%; }
  .fb-row-actions { opacity: 1; }
}

.icon { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.icon-stroke { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-dir { color: var(--accent); }
.icon-file { color: var(--muted); }

/* File editor */
.editor-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  animation: riseIn 0.35s var(--ease-out) both;
}
.editor-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.editor-filename { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.05rem; }
.editor-filename .icon { color: var(--muted); }
.editor-path { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.unsaved-dot { width: 8px; height: 8px; border-radius: 50%; background: #e3a008; opacity: 0; transform: scale(0.4); transition: opacity 0.2s ease, transform 0.25s var(--ease-out); }
.unsaved-dot.show { opacity: 1; transform: scale(1); }
.editor-controls { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.select-wrap { position: relative; display: inline-flex; }
/* Fallback look if JS hasn't enhanced it yet */
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.5rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
}
.select-wrap.enhanced .dd-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Custom dropdown */
.dropdown { position: relative; }
.dd-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 132px;
  padding: 0.5rem 0.75rem 0.5rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.dd-button:hover { filter: none; background: var(--panel-hover); }
.dd-button:active { transform: none; }
.dd-button:focus-visible, .dropdown.open .dd-button { outline: none; border-color: rgba(88, 166, 255, 0.55); box-shadow: 0 0 0 3px var(--accent-soft); }
.dd-chevron {
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease-out), margin 0.2s var(--ease-out);
}
.dropdown.open .dd-chevron { transform: rotate(-135deg); margin-top: 3px; }

.dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 100%;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.14s ease, transform 0.18s var(--ease-out), visibility 0s linear 0.18s;
}
.dd-menu::-webkit-scrollbar { width: 8px; }
.dropdown.open .dd-menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.dd-item {
  position: relative;
  padding: 0.45rem 2rem 0.45rem 0.7rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.1s ease;
}
.dd-item.active { background: var(--panel-hover); }
.dd-item.selected { color: var(--accent); font-weight: 600; }
.dd-item.selected::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  width: 4px;
  height: 8px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: translateY(-60%) rotate(45deg);
}

.editor-form .CodeMirror {
  height: calc(100vh - 10rem);
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: var(--font-mono);
  line-height: 1.6;
}
.editor-form .CodeMirror-focused { border-color: rgba(88, 166, 255, 0.5); }

/* CodeMirror theme matched to the panel palette */
.cm-s-panel.CodeMirror { background: #0d1118; color: #dbe2ee; }
.cm-s-panel .CodeMirror-gutters { background: #0d1118; border-right: 1px solid var(--border); }
.cm-s-panel .CodeMirror-linenumber { color: #4a5465; padding: 0 0.8rem 0 0.6rem; }
.cm-s-panel .CodeMirror-cursor { border-left: 2px solid var(--accent); }
.cm-s-panel .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.035); }
.cm-s-panel .CodeMirror-activeline-gutter .CodeMirror-linenumber { color: var(--text); }
/* .cm-s-panel and .CodeMirror-focused sit on the same element, so the focused
   rule must be a compound selector — otherwise CodeMirror's near-white default
   selection wins whenever the editor has focus. */
.CodeMirror.cm-s-panel div.CodeMirror-selected,
.CodeMirror.cm-s-panel.CodeMirror-focused div.CodeMirror-selected {
  background: rgba(56, 139, 253, 0.34) !important;
  border-radius: 2px;
}
.CodeMirror.cm-s-panel .CodeMirror-line::selection,
.CodeMirror.cm-s-panel .CodeMirror-line > span::selection,
.CodeMirror.cm-s-panel .CodeMirror-line > span > span::selection { background: rgba(56, 139, 253, 0.34) !important; color: inherit; }
.CodeMirror.cm-s-panel .CodeMirror-line::-moz-selection,
.CodeMirror.cm-s-panel .CodeMirror-line > span::-moz-selection,
.CodeMirror.cm-s-panel .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 139, 253, 0.34) !important; color: inherit; }
.CodeMirror.cm-s-panel .CodeMirror-cursor { border-left: 2px solid #79b8ff !important; }
.cm-s-panel .CodeMirror-matchingbracket { color: #fff !important; background: rgba(88, 166, 255, 0.25); }
.cm-s-panel span.cm-comment { color: #6b7688; font-style: italic; }
.cm-s-panel span.cm-keyword { color: #ff7b72; }
.cm-s-panel span.cm-atom, .cm-s-panel span.cm-builtin { color: #79c0ff; }
.cm-s-panel span.cm-number { color: #f2cc60; }
.cm-s-panel span.cm-def { color: #d2a8ff; }
.cm-s-panel span.cm-variable { color: #dbe2ee; }
.cm-s-panel span.cm-variable-2, .cm-s-panel span.cm-variable-3, .cm-s-panel span.cm-type { color: #ffa657; }
.cm-s-panel span.cm-property { color: #79c0ff; }
.cm-s-panel span.cm-operator { color: #ff7b72; }
.cm-s-panel span.cm-string, .cm-s-panel span.cm-string-2 { color: #a5d6ff; }
.cm-s-panel span.cm-meta, .cm-s-panel span.cm-qualifier { color: #8b949e; }
.cm-s-panel span.cm-tag { color: #7ee787; }
.cm-s-panel span.cm-attribute { color: #79c0ff; }
.cm-s-panel span.cm-header { color: #79c0ff; font-weight: 600; }
.cm-s-panel span.cm-link { color: #a5d6ff; text-decoration: underline; }
.cm-s-panel span.cm-error { color: #f85149; }
.CodeMirror-dialog { background: var(--panel); color: var(--text); border-color: var(--border) !important; }
.CodeMirror-dialog input { color: var(--text); font-family: var(--font-mono); }

/* Terminal window chrome */
.term-window {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -25px rgba(0, 0, 0, 0.7);
  background: #060911;
}
.term-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.term-header .icon { color: var(--muted); }
.term-title { color: var(--muted); font-size: 0.82rem; font-family: var(--font-mono); letter-spacing: 0.01em; }
.spacer { flex: 1; }
.term-clear-btn {
  padding: 0.3rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.term-clear-btn:hover { border-color: var(--accent); color: var(--accent); }
.term-window { display: flex; flex-direction: column; }
.term-box { flex: 1; min-height: 0; padding: 0.75rem 0.4rem 0.4rem 0.85rem; }
.term-box .xterm { height: 100%; }
.term-clear-btn { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Console footer: command box + resize grip share ONE background, so focus
   glow / send flash cover the whole bottom (rounded corners included)
   instead of stopping above the grip as a separate box. */
.term-footer {
  position: relative;
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  background: rgba(20, 25, 34, 0.92);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.term-footer:focus-within { background: rgba(26, 33, 44, 0.97); box-shadow: inset 0 1px 0 rgba(88, 166, 255, 0.35); }

/* Read-only log: no text cursor, clicking it focuses the command box */
.term-box .xterm { cursor: default; }
.term-box .xterm .xterm-helper-textarea { caret-color: transparent; }

.cmd-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.55rem 0.6rem 0.55rem 0.9rem;
  background: transparent;
}
.cmd-prompt { color: var(--accent); font-family: var(--font-mono); font-size: 1.1rem; line-height: 1; }
.cmd-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.2rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.cmd-input:focus { outline: none; }
.cmd-input::placeholder { color: #566072; }
.cmd-send { padding: 0.4rem 0.95rem; font-size: 0.82rem; opacity: 0.45; transition: opacity 0.2s ease, filter 0.15s ease; }
.term-footer.has-text .cmd-send { opacity: 1; }

/* Subtle typing animation: a soft glow sweeps the top edge on each keystroke */
.term-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.85) 50%, transparent);
  background-size: 200% 100%;
  opacity: 0;
  pointer-events: none;
}
.term-footer.typing::before { animation: cmdPulse 0.55s ease-out; }
@keyframes cmdPulse {
  0% { opacity: 0.9; background-position: 100% 0; }
  100% { opacity: 0; background-position: 0% 0; }
}
.cmd-prompt { transition: transform 0.25s var(--ease-out), color 0.2s ease, text-shadow 0.2s ease; }
.term-footer.has-text .cmd-prompt { transform: translateX(2px); color: #79b8ff; text-shadow: 0 0 8px rgba(88, 166, 255, 0.55); }
.term-footer.typing .cmd-prompt { animation: promptNudge 0.25s ease-out; }
@keyframes promptNudge { 50% { transform: translateX(4px); } }
.cmd-input { caret-color: #79b8ff; }

/* Sent: brief light flash, text slides away */
.term-footer.sent { animation: cmdSent 0.45s ease-out; }
.term-footer.sent .cmd-input { animation: cmdSlide 0.3s ease-out; }
@keyframes cmdSent { 0% { background: rgba(88, 166, 255, 0.16); } 100% { background: rgba(26, 33, 44, 0.97); } }
@keyframes cmdSlide { 0% { transform: translateY(-5px); opacity: 0.2; } 100% { transform: none; opacity: 1; } }

/* Drag handle to resize the console */
.term-resize {
  position: relative;
  height: 12px;
  margin-top: -2px;
  cursor: ns-resize;
  background: transparent;
  touch-action: none;
}
.term-resize::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 42px;
  height: 4px;
  margin-left: -21px;
  border-radius: 999px;
  background: #3a4454;
  transition: background 0.15s ease, width 0.2s var(--ease-out), margin 0.2s var(--ease-out);
}
.term-resize:hover::after, body.resizing-console .term-resize::after { background: var(--accent); width: 64px; margin-left: -32px; }
body.resizing-console { cursor: ns-resize; }
body.resizing-console * { user-select: none !important; }

/* Pop-out window */
body.popout-body { height: 100vh; margin: 0; overflow: hidden; background: #060911; }
.term-window.is-popout { height: 100vh; border: none; border-radius: 0; box-shadow: none; animation: none; }

/* Thin, hidden-until-hovered scrollbar for the xterm viewport, instead of the default OS scrollbar */
.term-box .xterm-viewport { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.term-box:hover .xterm-viewport { scrollbar-color: var(--border) transparent; }
.term-box .xterm-viewport::-webkit-scrollbar { width: 7px; }
.term-box .xterm-viewport::-webkit-scrollbar-track { background: transparent; }
.term-box .xterm-viewport::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.term-box:hover .xterm-viewport::-webkit-scrollbar-thumb { background: var(--border); }
.term-box .xterm-viewport::-webkit-scrollbar-thumb:hover { background: var(--muted) !important; }

/* Upload button (styled label wrapping a hidden file input) */
.upload-btn { position: relative; overflow: hidden; cursor: pointer; }
.upload-btn input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Game servers page */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.server-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.2s ease, transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.server-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 16px 32px -18px rgba(88, 166, 255, 0.45); }
.server-card-link { position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.server-card-top { display: flex; align-items: center; justify-content: space-between; }
.server-card-delete { position: relative; z-index: 2; opacity: 0; transition: opacity 0.15s ease; }
.server-card:hover .server-card-delete, .server-card:focus-within .server-card-delete { opacity: 1; }
.server-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.server-card.running .server-icon { background: rgba(39, 201, 63, 0.12); color: #3fdc5a; }
.server-card-name { margin: 0.2rem 0 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.state-badge.running { border-color: rgba(39, 201, 63, 0.4); background: rgba(39, 201, 63, 0.1); color: #3fdc5a; }
.state-badge.needs-jar { border-color: rgba(227, 160, 8, 0.4); background: rgba(227, 160, 8, 0.1); color: #e3a008; }
.state-badge.needs-jar .status-dot { background: #e3a008; }
.server-card-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }

/* Click-to-copy server address */
.copy-chip {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.45rem 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.copy-chip:hover { border-color: var(--accent); background: var(--accent-soft); filter: none; }
.copy-chip .mono { font-size: 0.78rem; }
.copy-chip .copy-icon, .copy-chip .check-icon { transition: transform 0.25s var(--ease-out), opacity 0.2s ease; }
.copy-chip .check-icon { display: none; color: #3fdc5a; }
.copy-chip.copied { border-color: rgba(63, 220, 90, 0.5); background: rgba(63, 220, 90, 0.1); }
.copy-chip.copied .copy-icon { display: none; }
.copy-chip.copied .check-icon { display: block; animation: popIn 0.3s var(--ease-out); }
@keyframes popIn { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.copy-chip-lg { padding: 0.4rem 0.6rem 0.4rem 0.8rem; margin-left: auto; }
.copy-chip-lg .mono { font-size: 0.85rem; }

.server-card-jar { display: block; margin-top: 0.15rem; font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.usage { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 0.3rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.usage-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; font-size: 0.75rem; color: var(--muted); }
.usage-value { font-family: var(--font-mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.usage-value b { color: var(--text); font-weight: 600; }

.spark { display: block; width: 100%; height: 38px; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: d 0.6s var(--ease-out); }
.spark-area { fill: rgba(88, 166, 255, 0.14); transition: d 0.6s var(--ease-out); }
.server-card.running .spark-line { stroke: #3fdc5a; }
.server-card.running .spark-area { fill: rgba(63, 220, 90, 0.13); }
.usage.mem-warn .spark-line { stroke: #e3a008; }
.usage.mem-warn .spark-area { fill: rgba(227, 160, 8, 0.14); }
.server-card:not(.running) .spark-line { stroke: #3a4454; }
.server-card:not(.running) .spark-area { fill: rgba(125, 135, 152, 0.06); }

.usage-bar { height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.usage-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #8b5cf6); transition: width 0.6s var(--ease-out); }
.server-card-open { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.2rem; font-size: 0.82rem; font-weight: 600; color: var(--muted); transition: color 0.15s ease, gap 0.2s var(--ease-out); }
.server-card:hover .server-card-open { color: var(--accent); gap: 0.45rem; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 14px;
  animation: riseIn 0.4s var(--ease-out) both;
}
.empty-state h2 { margin: 1rem 0 0.3rem; }
.empty-state p { margin: 0 0 1.4rem; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.empty-icon .icon { width: 26px; height: 26px; }

.btn-create {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: #071018;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn-create:hover { filter: brightness(1.1); }
.btn-create:active { transform: scale(0.97); }

.server-form .field { margin-top: 1.1rem; }
.server-form label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.memory-value { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.range-scale { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); font-family: var(--font-mono); }

.jar-upload-panel {
  padding: 2.5rem;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 12px;
  animation: fadeInUp 0.3s ease both;
}
.jar-upload-panel h2 { margin-top: 0; }
.jar-upload-panel p { color: var(--muted); max-width: 440px; margin: 0 auto 1.4rem; line-height: 1.5; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.status-dot.on { background: #27c93f; box-shadow: 0 0 8px rgba(39, 201, 63, 0.6); }

/* Server console page */
.console-header { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.console-header h1 { margin: 0; font-size: 1.4rem; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.status-pill.on { border-color: rgba(39, 201, 63, 0.4); background: rgba(39, 201, 63, 0.1); color: #3fdc5a; }

.console-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.25rem;
  align-items: start;
}
.console-layout .term-window { height: calc(100vh - 8rem); min-height: 360px; }

.console-side { display: flex; flex-direction: column; gap: 1rem; animation: fadeInUp 0.3s ease both; }
.side-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}
.side-card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.side-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.stat-value { font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); letter-spacing: -0.02em; }
.stat-unit { font-size: 0.85rem; font-weight: 500; color: var(--muted); }

.meter { height: 6px; margin-top: 0.75rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.4s ease, background 0.2s ease; }
.meter-fill.warn { background: #e3a008; }

.detail-list { margin: 0; display: flex; flex-direction: column; }
.detail-row { padding: 0.6rem 0; border-bottom: 1px solid var(--border); min-width: 0; }
.detail-row:first-child { padding-top: 0; }
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-list dt { margin-bottom: 0.2rem; font-size: 0.75rem; color: var(--muted); }
.detail-list dd {
  margin: 0;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-list dd.mono { font-family: var(--font-mono); font-size: 0.82rem; }
.side-files-btn { width: 100%; justify-content: center; margin-top: 1rem; }

@media (max-width: 1100px) {
  .console-layout { grid-template-columns: 1fr; }
  .console-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .console-layout .term-window { height: 70vh; }
}

.btn-with-badge { position: relative; display: inline-flex; }
.online-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #27c93f;
  box-shadow: 0 0 0 3px var(--panel), 0 0 8px rgba(39, 201, 63, 0.75);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 3px var(--panel), 0 0 8px rgba(39, 201, 63, 0.75); }
  50% { box-shadow: 0 0 0 3px var(--panel), 0 0 12px rgba(39, 201, 63, 1); }
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  margin: 0.5rem 0 0.4rem;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--accent-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); box-shadow: 0 0 0 6px var(--accent-soft); }
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--accent-soft);
  transition: transform 0.15s ease;
}
input[type="range"]::-moz-range-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-track { background: var(--border); border-radius: 999px; height: 6px; }

/* Animation */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

main { animation: fadeIn 0.3s ease; }
.page-header { animation: riseIn 0.35s var(--ease-out) both; }
.fb-list, .editor, .term-window { animation: riseIn 0.4s var(--ease-out) both; }

/* Staggered entrance: each item delays by its --i index, capped so a big
   folder doesn't take seconds to finish animating in. */
.fb-row, .server-card, .card {
  /* "backwards" (not "both") so the finished animation doesn't pin
     transform and block the hover lift on cards. */
  animation: riseIn 0.4s var(--ease-out) backwards;
  animation-delay: calc(min(var(--i, 0), 14) * 28ms + 60ms);
}
.cards .card:nth-child(1) { --i: 0; }
.cards .card:nth-child(2) { --i: 1; }
.cards .card:nth-child(3) { --i: 2; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Page scrollbar hidden (the page still scrolls normally). */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* No stray text selection on the app chrome: dragging across the page
   shouldn't highlight buttons, cards, and the sidebar. Selection stays on
   where copying actually makes sense. */
body { -webkit-user-select: none; user-select: none; }
input, textarea, code, pre, .mono, .fb-name, .breadcrumbs, .detail-list dd,
.server-card-meta dd, .xterm, .CodeMirror, .modal-body p, .editor-path {
  -webkit-user-select: text;
  user-select: text;
}
::selection { background: rgba(88, 166, 255, 0.3); }

/* Wallpaper picker (Settings) */
.wallpaper-picker { padding: 0.75rem; border-radius: 12px; background: var(--bg); transition: box-shadow 0.2s ease; }
.wallpaper-picker.dragging { box-shadow: 0 0 0 2px var(--accent, #4f8cff) inset; }
.wallpaper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.6rem; }
.wallpaper-tile {
  position: relative; aspect-ratio: 16 / 10; border-radius: 9px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.04) center / cover no-repeat;
  color: inherit; font: inherit; font-size: 0.75rem; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.wallpaper-tile:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.22); }
.wallpaper-tile.selected { border-color: transparent; box-shadow: 0 0 0 2px var(--accent, #4f8cff); }
.wallpaper-tile.selected::after {
  content: "✓"; position: absolute; left: 6px; bottom: 6px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent, #4f8cff);
}
.wallpaper-rotate, .wallpaper-add { opacity: 0.85; }
.wallpaper-add { border-style: dashed; }
.wallpaper-add .plus { font-size: 1.3rem; line-height: 1; }
.wallpaper-add input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.wallpaper-delete {
  position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; line-height: 1; color: #fff;
  background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.15s ease, background 0.15s ease;
}
.wallpaper-tile:hover .wallpaper-delete { opacity: 1; }
.wallpaper-delete:hover { background: #d9434f; }
.wallpaper-hint { display: block; margin-top: 0.6rem; opacity: 0.65; }

.usage.disk-warn [data-disk-bar] { background: #e3a008; }

/* New-server name + random-name dice */
.name-row { display: flex; gap: 0.5rem; }
.name-row .text-input { flex: 1; min-width: 0; }
.btn-dice { flex: none; width: 42px; padding: 0; display: grid; place-items: center; }
.btn-dice.rolling .icon { animation: dice-roll 0.45s ease; }
@keyframes dice-roll { from { transform: rotate(0) scale(0.8); } to { transform: rotate(360deg) scale(1); } }

/* ---------- Plugin manager ---------- */
.plugin-tabs { display: flex; gap: 0.35rem; padding: 0.3rem; margin-bottom: 1rem; width: fit-content; border-radius: 12px; background: var(--panel); box-shadow: 0 0 0 1px var(--border); }
.plugin-tab { background: transparent; color: var(--muted); border: 0; padding: 0.5rem 0.95rem; border-radius: 9px; font-weight: 500; }
.plugin-tab:hover { color: var(--text); background: var(--panel-hover); filter: none; }
.plugin-tab.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.35); }
.tab-count { min-width: 1.4rem; padding: 0 0.4rem; border-radius: 999px; font-size: 0.72rem; line-height: 1.4rem; background: var(--border); color: var(--text); }

.restart-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.65rem 0.9rem; margin-bottom: 1rem; border-radius: 10px; background: rgba(227, 160, 8, 0.12); box-shadow: inset 0 0 0 1px rgba(227, 160, 8, 0.35); color: #f2c75c; font-size: 0.88rem; animation: fade-up 0.3s var(--ease-out); }

.plugin-toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.plugin-search { position: relative; flex: 1 1 280px; }
.plugin-search > .icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.plugin-search .text-input { width: 100%; padding-left: 2.3rem; }
.plugin-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.85rem 0 0.4rem; }
.chip { background: var(--panel); color: var(--muted); border: 1px solid var(--border); padding: 0.3rem 0.75rem; border-radius: 999px; font-size: 0.8rem; font-weight: 500; }
.chip:hover { color: var(--text); border-color: #3a4556; filter: none; }
.chip.active { color: var(--accent); border-color: rgba(88, 166, 255, 0.5); background: var(--accent-soft); }
.plugin-meta { margin: 0.4rem 0 0.8rem; min-height: 1.1em; color: var(--muted); font-size: 0.82rem; }

.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0.8rem; }
.plugin-card {
  display: flex; gap: 0.9rem; align-items: flex-start; text-align: left; width: 100%;
  padding: 0.95rem; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-weight: 400; cursor: pointer; animation: fade-up 0.35s var(--ease-out) both;
  transition: transform 0.18s var(--ease-out), border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.plugin-card:hover { transform: translateY(-2px); border-color: #3a4556; background: var(--panel-hover); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.8); filter: none; }
.plugin-icon { flex: none; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, #1f2a3a, #2a3a52); color: var(--accent); font-weight: 700; font-size: 1.2rem; }
.plugin-icon img { width: 100%; height: 100%; object-fit: cover; }
.plugin-icon-lg { width: 72px; height: 72px; border-radius: 16px; font-size: 1.6rem; }
.plugin-card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.plugin-card-head { display: flex; align-items: center; gap: 0.5rem; }
.plugin-title { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plugin-author { color: var(--muted); font-size: 0.78rem; }
.plugin-desc { margin: 0.25rem 0; color: #aeb8c8; font-size: 0.84rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plugin-stats { display: flex; gap: 0.9rem; flex-wrap: wrap; color: var(--muted); font-size: 0.76rem; }
.plugin-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.35rem; }
.tag { padding: 0.1rem 0.5rem; border-radius: 6px; font-size: 0.7rem; font-weight: 500; background: rgba(255, 255, 255, 0.06); color: #b6c0cf; }
.tag-latest { background: rgba(63, 185, 80, 0.15); color: #56d364; }
.tag-beta { background: rgba(227, 160, 8, 0.15); color: #f2c75c; }
.tag-alpha, .tag-off { background: rgba(248, 81, 73, 0.14); color: #ff7b72; }
.badge-installed { flex: none; padding: 0.08rem 0.5rem; border-radius: 999px; font-size: 0.68rem; font-weight: 600; background: rgba(63, 185, 80, 0.15); color: #56d364; }
.plugin-more { display: flex; justify-content: center; margin: 1.2rem 0 0.5rem; }
.plugin-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 2.5rem 1rem; border-radius: 14px; border: 1px dashed var(--border); color: var(--muted); text-align: center; }
.plugin-empty b { color: var(--text); }
.plugin-empty.small { padding: 1.2rem; font-size: 0.85rem; }

.plugin-card.skeleton { cursor: default; pointer-events: none; }
.plugin-card.skeleton .plugin-icon, .sk-line { background: linear-gradient(90deg, #1a212c 25%, #232c3a 50%, #1a212c 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk-line { height: 0.7rem; border-radius: 4px; margin: 0.3rem 0; }
.sk-line.w40 { width: 40%; }
.sk-line.w60 { width: 60%; }
.sk-line.w90 { width: 90%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(3, 6, 10, 0.55); backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.25s ease; }
.drawer-backdrop.open { opacity: 1; }
.plugin-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91; width: min(560px, 100vw);
  background: var(--panel); box-shadow: -30px 0 60px -20px rgba(0, 0, 0, 0.7), -1px 0 0 var(--border);
  transform: translateX(104%); transition: transform 0.3s var(--ease-out); overflow-y: auto;
}
.plugin-drawer.open { transform: none; }
.drawer-close { position: absolute; top: 0.9rem; right: 0.9rem; }
.drawer-body { padding: 1.5rem; }
.drawer-head { display: flex; gap: 1rem; align-items: center; padding-right: 2.5rem; }
.drawer-head h2 { margin: 0 0 0.2rem; font-size: 1.3rem; }
.drawer-desc { color: #aeb8c8; line-height: 1.5; margin: 1rem 0 0.6rem; }
.drawer-stats { margin-bottom: 0.9rem; }
.drawer-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.drawer-links a { text-decoration: none; font-size: 0.82rem; }
.drawer-gallery { display: flex; gap: 0.5rem; overflow-x: auto; margin-top: 1rem; padding-bottom: 0.3rem; }
.drawer-gallery img { height: 110px; border-radius: 8px; flex: none; object-fit: cover; }
.drawer-section { margin: 1.4rem 0 0.3rem; font-size: 0.95rem; }
.drawer-note { display: block; color: var(--muted); margin-bottom: 0.6rem; }
.drawer-loading { color: var(--muted); padding: 1.5rem 0; }
.version-list { display: flex; flex-direction: column; gap: 0.45rem; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.7rem 0.8rem; border-radius: 10px; background: var(--bg); border: 1px solid transparent; }
.version-row.latest { border-color: rgba(63, 185, 80, 0.3); }
.version-info { min-width: 0; }
.version-info small { color: var(--muted); font-size: 0.75rem; }
.version-top { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.15rem; }
.version-row button { flex: none; min-width: 88px; }
button.busy { opacity: 0.7; cursor: progress; }

/* installed */
.installed-list { display: flex; flex-direction: column; gap: 0.55rem; }
.installed-row { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 0.95rem; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); animation: fade-up 0.3s var(--ease-out) both; transition: opacity 0.2s ease, transform 0.2s ease; }
.installed-row .plugin-icon { width: 42px; height: 42px; border-radius: 10px; font-size: 1rem; }
.installed-row.disabled .plugin-icon, .installed-row.disabled .installed-info { opacity: 0.5; }
.installed-row.removing { opacity: 0; transform: translateX(10px); }
.installed-info { flex: 1; min-width: 0; }
.installed-info small { color: var(--muted); font-size: 0.76rem; word-break: break-all; }
.installed-actions { display: flex; align-items: center; gap: 0.6rem; }

@media (max-width: 640px) {
  .plugin-grid { grid-template-columns: 1fr; }
  .installed-row { flex-wrap: wrap; }
  .restart-banner { flex-direction: column; align-items: flex-start; }
}

/* SFTP dialog */
.sftp-modal { width: min(560px, calc(100vw - 32px)); }
.sftp-loading { color: var(--muted); padding: 1rem 0; }
.sftp-off p { margin: 0.4rem 0 1rem; }
.sftp-fields { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.9rem; padding: 0.6rem; border-radius: 12px; background: var(--bg); }
.sftp-field { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 0.6rem; padding: 0.3rem 0.4rem; border-radius: 8px; }
.sftp-field:hover { background: rgba(255, 255, 255, 0.03); }
.sftp-field > span:first-child { color: var(--muted); font-size: 0.82rem; }
.sftp-field code { background: none; padding: 0; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.sftp-field .btn-icon { width: 30px; height: 30px; }
.sftp-field-actions { display: flex; gap: 0.2rem; }
.sftp-secret { letter-spacing: 0.02em; }
.sftp-hint { margin: 0.8rem 0 0; font-size: 0.82rem; }
.sftp-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.sftp-actions a { text-decoration: none; }
.btn-ghost-danger:hover { border-color: var(--danger); color: var(--danger); }
@media (max-width: 520px) { .sftp-field { grid-template-columns: 76px 1fr auto; } }

/* Disk bar on the console side panel */
.meter-fill.meter-disk { background: linear-gradient(90deg, #8b5cf6, #c084fc); }
.meter-fill.meter-disk.warn { background: #e3a008; }

/* Network card on the console side panel */
.net-card h3 { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.net-conns { font-size: 0.7rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.net-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.2rem 0 0.6rem; }
.net-rates > div { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 0.4rem; }
.net-rates small { color: var(--muted); font-size: 0.72rem; }
.net-rates b { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
.net-dot { width: 8px; height: 8px; border-radius: 50%; }
.net-in { background: #34d399; }
.net-out { background: #f472b6; }
.net-graph { display: block; width: 100%; height: 64px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); overflow: hidden; }
.net-line { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: d 0.4s ease; }
.net-area { stroke: none; transition: d 0.4s ease; }
.net-line-in { stroke: #34d399; }
.net-area-in { fill: rgba(52, 211, 153, 0.14); }
.net-line-out { stroke: #f472b6; }
.net-area-out { fill: rgba(244, 114, 182, 0.12); }
.net-totals { margin-top: 0.45rem; color: var(--muted); font-size: 0.72rem; }

/* Combined Resources card (uptime + memory + disk + network) */
.res-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.2rem; }
.res-head h3 { margin: 0; }
.res-uptime { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: rgba(255, 255, 255, 0.05); font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; }
.res-uptime .icon { color: var(--muted); }
.res-row { padding: 0.8rem 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.res-row:first-of-type { border-top: 0; }
.res-head + .res-row { border-top: 0; padding-top: 0.6rem; }
.res-row:last-child { padding-bottom: 0; }
.res-label { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.3rem; }
.res-label .net-conns { margin-left: auto; }
.res-dot { width: 7px; height: 7px; border-radius: 50%; }
.res-mem { background: var(--accent); }
.res-disk { background: #a78bfa; }
.res-net { background: #34d399; }
.res-value { display: flex; align-items: baseline; gap: 0.35rem; margin-bottom: 0.5rem; }
.res-value b { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 700; }
.res-row .net-rates { margin-top: 0; }

/* Live stats: bars glide in step with the counters (2 s samples) */
.res-card .meter-fill { transition: width 1.8s cubic-bezier(0.33, 1, 0.68, 1), background 0.2s ease; }
.res-card .net-line, .res-card .net-area { transition: d 1.8s cubic-bezier(0.33, 1, 0.68, 1); }
.res-value b, .net-rates b { font-variant-numeric: tabular-nums; }

/* Server settings (server.properties) dialog */
.side-hint { margin: 0 0 0.7rem; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.props-modal { width: min(720px, calc(100vw - 32px)); }
.props-modal .modal-body { max-height: min(72vh, 760px); overflow-y: auto; }
.props-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; }
.props-field { display: flex; flex-direction: column; gap: 0.3rem; margin: 0; }
.props-field > label:first-child { font-size: 0.82rem; font-weight: 600; }
.props-field small { color: var(--muted); font-size: 0.74rem; line-height: 1.35; }
.props-field .text-input { width: 100%; }
.props-field .select-wrap { width: 100%; }
.props-wide { grid-column: 1 / -1; }
.props-toggle { margin: 0; padding: 0.55rem 0.7rem; border-radius: 10px; background: var(--bg); align-items: center; }
.props-field.invalid .text-input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.15); }
.props-actions { align-items: center; }
.props-status { margin-right: auto; color: var(--muted); font-size: 0.8rem; }
.props-status.dirty { color: #f2c75c; }
.motd-preview { display: flex; gap: 0.8rem; align-items: center; margin-top: 0.8rem; padding: 0.7rem 0.8rem; border-radius: 10px; background: #1b1b1b; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); font-family: var(--font-mono); }
.motd-icon { flex: none; width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; background: linear-gradient(135deg, #3b7a3b, #5aa35a); color: #fff; font-weight: 700; }
.motd-preview b { font-family: var(--font-sans); font-size: 0.9rem; }
.motd-text { color: #aaa; font-size: 0.82rem; white-space: pre-wrap; min-height: 1.1em; }
.motd-text .b { font-weight: 700; } .motd-text .i { font-style: italic; } .motd-text .u { text-decoration: underline; } .motd-text .s { text-decoration: line-through; }
@media (max-width: 600px) { .props-grid { grid-template-columns: 1fr; } }

/* Players card */
.players-count { padding: 0.15rem 0.6rem; border-radius: 999px; background: rgba(255, 255, 255, 0.05); font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.players-count.live { color: #56d364; background: rgba(63, 185, 80, 0.12); }
.players-list { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.5rem; }
.player-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.4rem; border-radius: 9px; animation: fade-up 0.25s var(--ease-out) both; }
.player-row:hover { background: rgba(255, 255, 255, 0.04); }
.player-head { width: 26px; height: 26px; border-radius: 5px; image-rendering: pixelated; flex: none; background: #2a3342; }
.player-head-fallback { display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.player-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-online-dot { width: 6px; height: 6px; border-radius: 50%; background: #4b5565; flex: none; }
.player-online-dot.on { background: #3fb950; box-shadow: 0 0 6px rgba(63, 185, 80, 0.7); }
.op-toggle { flex: none; padding: 0.2rem 0.6rem; border-radius: 7px; font-size: 0.72rem; font-weight: 600; background: transparent; color: var(--muted); border: 1px solid var(--border); }
.op-toggle:hover { color: var(--accent); border-color: var(--accent); filter: none; }
.op-toggle.is-op { color: #f2c75c; border-color: rgba(227, 160, 8, 0.45); background: rgba(227, 160, 8, 0.1); }
.op-toggle.is-op:hover { color: var(--danger); border-color: var(--danger); background: rgba(248, 81, 73, 0.08); }
.op-toggle.is-op:hover::before { content: "De-"; }
.players-empty { color: var(--muted); font-size: 0.8rem; padding: 0.3rem 0.4rem; }
.players-hidden { color: var(--muted); font-size: 0.74rem; padding: 0.2rem 0.4rem; }
.players-sub { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.players-add { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.players-add .text-input { flex: 1; min-width: 0; padding-top: 0.4rem; padding-bottom: 0.4rem; font-size: 0.85rem; }
.players-add .btn-ghost { flex: none; padding: 0.4rem 0.7rem; font-size: 0.8rem; }

/* Server Settings page */
.settings-page-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.settings-page-actions a { text-decoration: none; }
.settings-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }
.settings-side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.settings-main { padding: 1.2rem 1.4rem; }
.settings-main .settings-head h3 { margin: 0 0 0.2rem; }
.props-page-actions { position: sticky; bottom: 0; display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; margin: 1.2rem -1.4rem -1.2rem; padding: 0.9rem 1.4rem; border-top: 1px solid var(--border); background: var(--panel); border-radius: 0 0 14px 14px; }
@media (max-width: 900px) { .settings-layout { grid-template-columns: 1fr; } .settings-side { position: static; } }

/* Network: total traffic used */
.net-usage { margin-top: 0.7rem; padding: 0.7rem 0.75rem; border-radius: 10px; background: rgba(255, 255, 255, 0.035); }
.net-usage-main { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.net-usage-main small { color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.net-usage-main b { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.net-usage-split { display: flex; gap: 1rem; margin-top: 0.35rem; font-family: var(--font-mono); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.net-usage-split > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.net-usage-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.45rem; color: var(--muted); font-size: 0.72rem; }
.net-reset { padding: 0.1rem 0.5rem; border-radius: 6px; background: transparent; border: 1px solid var(--border); color: var(--muted); font-size: 0.7rem; font-weight: 500; }
.net-reset:hover { color: var(--text); border-color: #3a4556; filter: none; }

/* Top loading bar (page navigation) */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10000; pointer-events: none; opacity: 0; transition: opacity 0.35s ease; }
.topbar.active { opacity: 1; }
.topbar.finish { opacity: 0; transition-delay: 0.05s; }
.topbar-fill {
  position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, #3b82f6, var(--accent) 60%, #8ec5ff);
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.7), 0 0 4px rgba(88, 166, 255, 0.9);
  border-radius: 0 3px 3px 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.topbar.no-anim .topbar-fill { transition: none; }
.pref-no-motion .topbar-fill { transition-duration: 0.01s; }

/* =====================================================================
   Responsive layout
   > 1100px full sidebar · 801-1100px icon rail · <= 800px drawer + top bar
   ===================================================================== */
html, body { max-width: 100%; overflow-x: hidden; }
main, .sidebar, .console-layout, .settings-layout { transition: margin-left 0.25s var(--ease-out), padding 0.25s var(--ease-out), width 0.25s var(--ease-out); }
.mobile-bar, .sidebar-backdrop { display: none; }
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
#term-resize, .term-resize { touch-action: none; }

/* ---- Icon rail ---- */
@media (min-width: 801px) and (max-width: 1100px) {
  .sidebar { width: 72px; padding: 1.1rem 0.6rem; align-items: stretch; }
  .sidebar-brand { justify-content: center; padding: 0.3rem 0 1.2rem; }
  .sidebar-brand span:last-child,
  .sidebar-nav a span,
  .sidebar-nav a .icon-sm,
  .sidebar-username,
  .sidebar-user > .icon:last-child { display: none; }
  .sidebar-nav a { justify-content: center; padding: 0.7rem 0; }
  .sidebar-nav a .icon { width: 20px; height: 20px; }
  .sidebar-footer { flex-direction: column; gap: 0.3rem; padding: 0.8rem 0 0; }
  .sidebar-user { flex: none; margin: 0; padding: 0.3rem; justify-content: center; }
  body.has-sidebar main { margin-left: 72px; padding: 1.75rem 1.5rem 3rem; }
  body.has-sidebar .selection-bar { left: calc(50% + 36px); }
}

/* ---- Phones / narrow windows: top bar + slide-in drawer ---- */
@media (max-width: 800px) {
  body.has-sidebar .mobile-bar {
    display: flex; align-items: center; gap: 0.6rem;
    position: sticky; top: 0; z-index: 30;
    height: 56px; padding: 0 0.75rem;
    padding-top: env(safe-area-inset-top);
    background: rgba(20, 25, 34, 0.86);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-menu-btn, .mobile-user {
    display: grid; place-items: center; width: 42px; height: 42px; padding: 0;
    border-radius: 10px; background: transparent; color: var(--text); border: none;
  }
  .mobile-menu-btn:hover, .mobile-user:hover { background: var(--panel-hover); filter: none; }
  .mobile-menu-btn .icon { width: 22px; height: 22px; }
  .mobile-brand { display: flex; align-items: center; gap: 0.55rem; flex: 1; min-width: 0; color: var(--text); text-decoration: none; font-weight: 700; }
  .mobile-brand .brand-mark { width: 28px; height: 28px; font-size: 0.78rem; }
  .mobile-user .avatar { width: 30px; height: 30px; }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
    width: min(290px, 84vw); padding: 1.25rem 0.9rem;
    padding-top: calc(1.25rem + env(safe-area-inset-top));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease-out), box-shadow 0.28s ease;
    border-right: 1px solid var(--border);
  }
  body.drawer-open .sidebar { transform: none; box-shadow: 24px 0 60px -20px rgba(0, 0, 0, 0.8); }
  body.has-sidebar .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(3, 6, 10, 0.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  body.drawer-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .sidebar-nav a { padding: 0.75rem 0.8rem; font-size: 0.98rem; }

  body.has-sidebar main { margin-left: 0; padding: 1.1rem 0.9rem calc(2.5rem + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.3rem; }
  .page-header { margin-bottom: 1rem; align-items: flex-start; }
  .page-header > div:last-child:not(:first-child) { width: 100%; }

  /* touch: things that appear on hover are always visible */
  .fb-row-actions { opacity: 1; }
  body.has-sidebar .selection-bar { left: 50%; }

  /* bigger tap targets */
  button, .btn-ghost, .btn-create, .upload-btn { min-height: 40px; }
  .btn-icon { min-width: 38px; min-height: 38px; }

  /* iOS zooms into inputs smaller than 16px */
  input[type="text"], input[type="number"], input[type="search"], input[type="password"], textarea, select, .text-input { font-size: 16px; }

  /* dialogs become sheets that fit the screen */
  dialog.modal { width: calc(100vw - 1rem); max-width: none; max-height: calc(100dvh - 1rem); margin: auto auto 0.5rem; display: none; flex-direction: column; overflow: hidden; }
  dialog.modal[open] { display: flex; animation: sheetIn 0.28s var(--ease-out); }
  dialog.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
  dialog.modal .modal-body { overflow-y: auto; padding: 1.2rem 1.1rem 0.8rem; }
  dialog.modal .modal-actions { flex-wrap: wrap; padding: 0.8rem 1.1rem calc(1rem + env(safe-area-inset-bottom)); }
  dialog.modal .modal-actions > button { flex: 1 1 auto; }

  /* toasts span the bottom of the screen */
  .toast-stack { left: 0.75rem; right: 0.75rem; bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
  .toast-stack .toast { max-width: none; }

  /* console */
  .console-header { gap: 0.6rem; margin-bottom: 0.9rem; }
  .console-header h1 { font-size: 1.2rem; flex: 1 1 100%; order: -1; }
  .console-header .copy-chip-lg { max-width: 100%; }
  .console-header .copy-chip-lg .mono { overflow: hidden; text-overflow: ellipsis; }
  .console-layout { gap: 0.9rem; }
  .console-layout .term-window { height: 62dvh; min-height: 300px; }
  .console-side { grid-template-columns: 1fr !important; }

  /* file manager */
  .fb-actions { width: 100%; }
  .fb-actions > * { flex: 1 1 auto; }
  .fb-actions .btn-ghost, .fb-actions .btn-create, .fb-actions label { justify-content: center; }
  .breadcrumbs { flex-wrap: wrap; row-gap: 0.2rem; }

  /* plugins */
  .plugin-toolbar .select-wrap { flex: 1 1 140px; }
  .plugin-tabs { width: 100%; }
  .plugin-tab { flex: 1; justify-content: center; }
  .plugin-drawer { width: 100vw; }
  .drawer-body { padding: 1.1rem; }

  /* settings */
  .settings-main { padding: 1rem; }
  .props-page-actions { margin: 1rem -1rem -1rem; padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .props-page-actions .props-status { flex: 1 1 100%; }
  .props-page-actions button { flex: 1 1 auto; }
}

@media (max-width: 520px) {
  .fb-head, .fb-row { grid-template-columns: 22px minmax(0, 1fr) 64px; gap: 0.6rem; padding: 0 0.75rem; }
  .fb-head span:nth-child(3), .fb-size { display: none; }
  .fb-row-actions { grid-column: 3; }
  .server-grid { grid-template-columns: 1fr; }
  .plugin-card { padding: 0.8rem; }
  .plugin-icon { width: 44px; height: 44px; }
  .net-rates b { font-size: 0.95rem; }
}

@keyframes sheetIn { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }

/* Touch screens (any width): no hover-only controls */
@media (hover: none) {
  .fb-row-actions { opacity: 1; }
  .wallpaper-tile .wallpaper-delete { opacity: 1; }
}

/* Phone console header: compact back button, no wrapped labels */
@media (max-width: 800px) {
  .console-header > a.btn-ghost, .console-header .copy-chip-lg { font-size: 0.85rem; }
  .console-header .copy-chip-lg { flex: 1 1 auto; justify-content: space-between; }
  .term-window .btn-ghost, .term-window button { white-space: nowrap; }
}

/* Server Settings page: space above each group title */
.settings-main .settings-section { margin: 1.6rem 0 0.7rem; }
.settings-main .motd-preview { margin-bottom: 0.4rem; }

/* ---------- Server controls card ---------- */
.ctl-card { display: flex; flex-direction: column; gap: 0.85rem; }
.ctl-status { display: flex; align-items: center; gap: 0.7rem; }
.ctl-dot { width: 10px; height: 10px; border-radius: 50%; background: #4b5565; flex: none; }
.ctl-card.is-running .ctl-dot { background: #3fb950; box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.15), 0 0 12px rgba(63, 185, 80, 0.6); animation: ctlPulse 2.4s ease-in-out infinite; }
@keyframes ctlPulse { 50% { box-shadow: 0 0 0 7px rgba(63, 185, 80, 0.05), 0 0 16px rgba(63, 185, 80, 0.4); } }
.ctl-status-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ctl-status-text b { font-size: 0.95rem; }
.ctl-status-text small { color: var(--muted); font-size: 0.76rem; font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ctl-power {
  position: relative; display: flex; align-items: center; gap: 0.8rem; width: 100%;
  padding: 0.8rem 0.9rem; border-radius: 12px; border: 1px solid rgba(63, 185, 80, 0.35);
  background: linear-gradient(135deg, rgba(46, 160, 67, 0.28), rgba(46, 160, 67, 0.12));
  color: var(--text); text-align: left; font-weight: 500; overflow: hidden;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.ctl-power:hover { filter: none; border-color: rgba(63, 185, 80, 0.7); box-shadow: 0 10px 28px -14px rgba(46, 160, 67, 0.9); transform: translateY(-1px); }
.ctl-power:active { transform: translateY(0) scale(0.99); }
.ctl-card.is-running .ctl-power { border-color: rgba(248, 81, 73, 0.35); background: linear-gradient(135deg, rgba(248, 81, 73, 0.24), rgba(248, 81, 73, 0.08)); }
.ctl-card.is-running .ctl-power:hover { border-color: rgba(248, 81, 73, 0.75); box-shadow: 0 10px 28px -14px rgba(248, 81, 73, 0.9); }
.ctl-power-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #2ea043; color: #fff; }
.ctl-card.is-running .ctl-power-icon { background: #da3633; }
.ctl-power-icon .icon { width: 18px; height: 18px; fill: currentColor; }
.ctl-power-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ctl-power-label b { font-size: 0.98rem; }
.ctl-power-label small { color: var(--muted); font-size: 0.75rem; }
.ctl-spinner { display: none; margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin 0.8s linear infinite; }
.ctl-power.busy { pointer-events: none; opacity: 0.85; }
.ctl-power.busy .ctl-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.ctl-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.ctl-tool-form { display: contents; }
.ctl-tool {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 64px; padding: 0.6rem 0.3rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); color: var(--muted);
  font-size: 0.76rem; font-weight: 600; text-align: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s var(--ease-out);
}
.ctl-tool .icon { width: 19px; height: 19px; }
.ctl-tool:hover:not(:disabled) { filter: none; color: var(--text); border-color: #3a4556; background: rgba(255, 255, 255, 0.06); transform: translateY(-1px); }
.ctl-tool[data-action="restart"]:hover:not(:disabled) { color: var(--accent); border-color: rgba(88, 166, 255, 0.5); }
.ctl-tool-danger:hover:not(:disabled) { color: #ff7b72; border-color: rgba(248, 81, 73, 0.55); background: rgba(248, 81, 73, 0.08); }
.ctl-tool:disabled { opacity: 0.4; cursor: not-allowed; }
.ctl-tool input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ctl-tool.busy .icon { animation: spin 0.9s linear infinite; }

/* Extract archive dialog */
.btn-icon-accent:hover { color: var(--accent); }
.extract-modal { width: min(480px, calc(100vw - 2rem)); }
.extract-head { display: flex; gap: 0.9rem; align-items: center; margin-bottom: 1rem; }
.extract-head h2 { margin: 0 0 0.15rem; }
.extract-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.extract-icon .icon { width: 22px; height: 22px; }
.extract-name { font-family: var(--font-mono); font-size: 0.82rem !important; word-break: break-all; }
.extract-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.9rem; }
.extract-choice { position: relative; display: flex; cursor: pointer; }
.extract-choice input { position: absolute; opacity: 0; pointer-events: none; }
.extract-choice > span { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; padding: 0.75rem 0.85rem; border-radius: 11px; border: 1px solid var(--border); background: var(--bg); transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease; }
.extract-choice > span b { font-size: 0.9rem; }
.extract-choice > span small { color: var(--muted); font-size: 0.76rem; line-height: 1.35; word-break: break-word; }
.extract-choice:hover > span { border-color: #3a4556; }
.extract-choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.extract-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.extract-overwrite { margin: 0; padding: 0.6rem 0.75rem; border-radius: 10px; background: var(--bg); }
@media (max-width: 480px) { .extract-choices { grid-template-columns: 1fr; } }

/* File manager right-click menu */
.ctx-menu {
  position: fixed; z-index: 1000; min-width: 220px; max-width: 280px; padding: 0.35rem;
  border-radius: 12px; background: rgba(22, 27, 36, 0.96);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--border);
  opacity: 0; transform: scale(0.96); transition: opacity 0.12s ease, transform 0.12s var(--ease-out);
}
.ctx-menu.open { opacity: 1; transform: none; }
.ctx-header { padding: 0.4rem 0.65rem 0.35rem; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-item {
  display: flex; align-items: center; gap: 0.65rem; width: 100%; min-height: 34px; padding: 0.4rem 0.65rem;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 0.86rem; font-weight: 500; text-align: left;
}
.ctx-item .icon { width: 16px; height: 16px; color: var(--muted); flex: none; }
.ctx-item span { flex: 1; }
.ctx-item kbd { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); background: none; border: 0; padding: 0; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--accent-soft); color: var(--text); outline: none; filter: none; }
.ctx-item:hover .icon, .ctx-item:focus-visible .icon { color: var(--accent); }
.ctx-item:active { transform: none; }
.ctx-item.danger { color: #ff7b72; }
.ctx-item.danger .icon { color: #ff7b72; }
.ctx-item.danger:hover, .ctx-item.danger:focus-visible { background: rgba(248, 81, 73, 0.12); }
.ctx-sep { height: 1px; margin: 0.3rem 0.4rem; background: var(--border); }
.pref-no-motion .ctx-menu { transition: none; }

/* Server address inside the Controls card's status line */
.ctl-status-text { flex: 1; min-width: 0; }
.ctl-status-line { display: flex; align-items: baseline; gap: 0.35rem; min-width: 0; }
.ctl-status-line small { color: var(--muted); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl-address-text {
  display: block; max-width: 100%; margin: 0.1rem 0 0; padding: 0; border: 0; background: none;
  color: var(--text); font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; opacity: 0.85;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.ctl-address-text:hover { color: var(--accent); opacity: 1; filter: none; }
.ctl-address-text:active { transform: none; }
.ctl-address-text.copied { color: #3fdc5a; opacity: 1; }
.ctl-copy { flex: none; width: 34px; height: 34px; padding: 0; justify-content: center; align-self: center; }
.ctl-copy .icon { width: 16px; height: 16px; }

/* Console title bar doubles as the page header (back, name, status, actions) */
.term-header-main { gap: 0.6rem; padding-top: 0.55rem; padding-bottom: 0.55rem; }
.term-back {
  display: grid; place-items: center; width: 32px; height: 32px; margin-left: -0.3rem; border-radius: 9px;
  color: var(--muted); text-decoration: none; transition: background 0.15s ease, color 0.15s ease;
}
.term-back:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.term-back .icon { width: 18px; height: 18px; }
.term-name { margin: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status-pill-sm { padding: 0.12rem 0.55rem; font-size: 0.72rem; gap: 0.35rem; flex: none; }
.status-pill-sm .status-dot { width: 6px; height: 6px; }
.term-header .term-clear-btn { display: inline-flex; align-items: center; gap: 0.35rem; text-decoration: none; flex: none; }
.term-header .term-clear-btn .icon { width: 14px; height: 14px; }
.term-header-main + .term-box { border-top: 0; }
.console-layout { margin-top: 0; }
@media (max-width: 560px) {
  .term-header .term-btn-label { display: none; }
  .term-header .term-clear-btn { padding: 0.35rem 0.5rem; }
  .term-name { font-size: 0.98rem; }
}

/* Controls + Resources: one fused panel with a divider, sections kept separate.
   Only when they're stacked (wide screens and phones); on tablets they sit side by side. */
@media (min-width: 1101px), (max-width: 800px) {
  .console-side .ctl-card { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; }
  .console-side .ctl-card + .res-card {
    margin-top: -1rem;
    border-top-left-radius: 0; border-top-right-radius: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* "Not enough memory" dialog */
.oom-modal { width: min(460px, calc(100vw - 2rem)); }
.oom-head { display: flex; gap: 0.9rem; align-items: flex-start; }
.oom-head h2 { margin: 0 0 0.2rem; }
.oom-icon { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: rgba(248, 81, 73, 0.14); color: #ff7b72; animation: oomPulse 1.8s ease-in-out infinite; }
.oom-icon .icon { width: 24px; height: 24px; }
@keyframes oomPulse { 50% { box-shadow: 0 0 0 6px rgba(248, 81, 73, 0.08); } }
.oom-text { margin: 0.9rem 0 0 !important; }
.oom-slider { margin-top: 1rem; padding: 0.8rem 0.9rem; border-radius: 11px; background: var(--bg); }
.oom-slider-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; font-size: 0.85rem; color: var(--muted); }
.oom-slider-top b { color: var(--text); font-family: var(--font-mono); font-size: 1.05rem; }
.oom-slider input[type="range"] { width: 100%; }
.oom-hint { display: block; margin-top: 0.4rem; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.pref-no-motion .oom-icon { animation: none; }

/* New server dialog: EULA agreement */
.eula-check { position: relative; display: flex; gap: 0.7rem; align-items: flex-start; margin-top: 1rem; padding: 0.75rem 0.85rem; border-radius: 11px; background: var(--bg); border: 1px solid var(--border); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.eula-check:hover { border-color: #3a4556; }
.eula-check input { position: absolute; opacity: 0; pointer-events: none; }
.eula-box { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; border: 1.5px solid #4b5565; display: grid; place-items: center; transition: background 0.15s ease, border-color 0.15s ease; }
.eula-box::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform 0.15s var(--ease-out); }
.eula-check input:checked ~ .eula-box { background: var(--accent); border-color: var(--accent); }
.eula-check input:checked ~ .eula-box::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.eula-check input:focus-visible ~ .eula-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.eula-check:has(input:checked) { border-color: rgba(88, 166, 255, 0.5); background: var(--accent-soft); }
.eula-text { display: flex; flex-direction: column; gap: 0.2rem; line-height: 1.35; }
.eula-text b { font-size: 0.9rem; }
.eula-text small { color: var(--muted); font-size: 0.78rem; }
.eula-text a { color: var(--accent); text-decoration: none; white-space: nowrap; }
.eula-text a:hover { text-decoration: underline; }

/* "Start after upload" toggle (Controls card + first JAR upload) */
.jar-autostart { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0.2rem 0; cursor: pointer; color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.jar-autostart span { order: -1; }
.jar-autostart:hover { color: var(--text); }
.jar-upload-panel .jar-autostart { justify-content: center; gap: 0.7rem; margin-top: 1rem; padding: 0; }
.jar-upload-panel .jar-autostart span { order: 0; }

/* File editor: the header (and its dropdown menus) sits above CodeMirror's own z-index layers */
.editor-header { position: relative; z-index: 20; }
