/* ServerPanel dark theme: zinc-950 bg, zinc-900 cards, emerald accents */
:root {
  --bg: #09090b;
  --bg-soft: #101014;
  --card: rgba(24, 24, 27, 0.6);
  --border: #27272a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #52525b;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --sky: #0ea5e9;
  --rose: #f43f5e;
  --amber: #f59e0b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px;
  background: var(--bg-soft); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 18px 20px; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { color: var(--emerald); font-size: 18px; }
.nav { flex: 1; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-size: 13px; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(39, 39, 42, 0.7); color: var(--text); }
.nav-item.active { background: rgba(16, 185, 129, 0.1); color: var(--emerald); font-weight: 600; }
.nav-item.logout { margin-top: auto; }
.nav-item .ico { width: 16px; height: 16px; fill: currentColor; opacity: 0.85; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 20px; font-size: 11px; color: var(--faint); font-family: ui-monospace, monospace; }

.main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 13px 24px; border-bottom: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.85); backdrop-filter: blur(8px);
}
.page-title { font-size: 14px; font-weight: 600; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 24px; max-width: 1200px; width: 100%; }

/* cards */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { font-size: 13px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.link { color: var(--emerald); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { margin-bottom: 0; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11px; color: var(--faint); margin-top: 4px; }
.meter { height: 6px; background: #27272a; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--emerald); border-radius: 999px; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.meter-fill.warn { background: var(--amber); }
.meter-fill.bad { background: var(--rose); }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--faint); padding: 8px 12px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.table td { padding: 9px 12px; border-bottom: 1px solid rgba(39, 39, 42, 0.6); }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: rgba(39, 39, 42, 0.35); }
.ta-right { text-align: right; }

/* status dots + chips */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 999px; margin-right: 7px; }
.dot.on { background: var(--emerald); box-shadow: 0 0 6px rgba(16, 185, 129, 0.7); }
.dot.off { background: var(--rose); }
.dot.unknown { background: var(--amber); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft); font-size: 11.5px; color: var(--muted);
}
.chip.on { border-color: rgba(16, 185, 129, 0.4); color: var(--emerald); background: rgba(16, 185, 129, 0.08); }
.chip.off { border-color: rgba(244, 63, 94, 0.4); color: var(--rose); background: rgba(244, 63, 94, 0.08); }

/* buttons + forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; padding: 8px 15px; font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform 0.12s ease-out, background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-primary { background: var(--emerald); color: #09090b; }
.btn-primary:hover { background: #34d399; }
.btn-outline { border-color: #3f3f46; color: var(--text); background: transparent; }
.btn-outline:hover { background: #27272a; }
.btn-danger { background: rgba(244, 63, 94, 0.14); color: var(--rose); border-color: rgba(244, 63, 94, 0.35); }
.btn-danger:hover { background: rgba(244, 63, 94, 0.25); }
.btn-ghost { color: var(--muted); background: transparent; }
.btn-ghost:hover { background: #27272a; color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }

.input {
  width: 100%; background: var(--bg-soft); border: 1px solid #3f3f46; border-radius: 9px;
  color: var(--text); padding: 8px 12px; font-size: 13px; outline: none; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: rgba(16, 185, 129, 0.6); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.field-label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }

/* console + editor */
.console {
  background: #09090b; border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 15px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px; line-height: 1.55; color: #d4d4d8; white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow-y: auto; margin: 0 0 12px;
}
.cmd-row { display: flex; gap: 8px; align-items: center; }
.cmd-prompt { color: var(--emerald); font-family: ui-monospace, monospace; font-weight: 700; }
.cmd-input { font-family: ui-monospace, monospace; }
.player-list { list-style: none; margin: 0; padding: 0; }
.player-list li { padding: 7px 10px; border-bottom: 1px solid rgba(39, 39, 42, 0.6); font-size: 13px; }
.player-list li:last-child { border-bottom: none; }

/* two-col grid + kv rows */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 .card { margin-bottom: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid rgba(39, 39, 42, 0.5); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* quick links */
.quick-links { display: flex; flex-wrap: wrap; gap: 9px; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 9px; background: #18181b; border: 1px solid #3f3f46;
  border-radius: 10px; padding: 10px 15px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.ok { border-left: 3px solid var(--emerald); }
.toast.err { border-left: 3px solid var(--rose); }
.toast.info { border-left: 3px solid var(--sky); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade-in 0.2s ease-out;
}
.modal {
  background: #18181b; border: 1px solid #3f3f46; border-radius: 14px; padding: 20px;
  width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: scale-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-wide { max-width: 860px; }
.modal-msg { margin: 0 0 16px; font-size: 14px; }
.modal-title { font-size: 13px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.hidden { display: none !important; }
.editor-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.editor-area {
  width: 100%; min-height: 46vh; background: #09090b; color: #e4e4e7; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  line-height: 1.5; resize: vertical; outline: none;
}
.editor-area:focus { border-color: rgba(16, 185, 129, 0.6); }

/* files page */
.roots-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.root-chip {
  padding: 5px 13px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px;
  color: var(--muted); text-decoration: none; font-family: ui-monospace, monospace;
}
.root-chip:hover { border-color: #3f3f46; color: var(--text); }
.root-chip.active { border-color: rgba(16, 185, 129, 0.5); color: var(--emerald); background: rgba(16, 185, 129, 0.08); }
.breadcrumbs { font-size: 12px; color: var(--faint); margin-bottom: 10px; font-family: ui-monospace, monospace; }
.breadcrumbs a { color: var(--sky); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.files-table td:first-child { font-family: ui-monospace, monospace; font-size: 12px; }
.file-name { color: var(--text); text-decoration: none; }
.file-name:hover { color: var(--emerald); }
.file-name.dir { color: var(--sky); font-weight: 600; }
.action-link { background: none; border: none; color: var(--muted); font-size: 11.5px; cursor: pointer; padding: 2px 7px; font-family: inherit; }
.action-link:hover { color: var(--emerald); }
.action-link.danger:hover { color: var(--rose); }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.login-brand { padding: 0; justify-content: center; }
.login-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin: 10px 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-hint { margin-top: 18px; font-size: 11px; color: var(--faint); text-align: center; line-height: 1.6; }
.login-hint code { color: var(--muted); font-family: ui-monospace, monospace; }
.alert { border-radius: 9px; padding: 9px 13px; font-size: 12.5px; margin-bottom: 12px; }
.alert-error { background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(244, 63, 94, 0.35); color: var(--rose); }

/* animations */
.fade-up { animation: fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.card { transition: border-color 0.2s, box-shadow 0.2s; }
.card:hover { border-color: #3f3f46; }

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

/* responsive */
@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .brand { justify-content: center; padding: 18px 0; }
  .brand { font-size: 0; }
  .brand-mark { font-size: 20px; }
  .nav-item { justify-content: center; font-size: 0; gap: 0; padding: 10px; }
  .nav-item .ico { width: 18px; height: 18px; }
  .sidebar-foot { display: none; }
  .main { margin-left: 64px; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
