:root {
  --bg: #08080d;
  --bg-soft: #0d0d15;
  --card: rgba(18, 18, 28, 0.82);
  --card-solid: #12121c;
  --card-hover: #181824;
  --border: #222232;
  --border-soft: rgba(124, 58, 237, 0.18);
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --cyan: #22d3ee;
  --text: #e5e7f0;
  --text-dim: #8b8ba3;
  --text-faint: #5b5b72;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

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

html, body { min-height: 100%; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); text-decoration: none; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--accent-2); }

.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.right { text-align: right; }

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), rgba(0,0,0,.28));
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(124, 58, 237, 0.18), transparent 70%),
    radial-gradient(ellipse 50% 35% at 90% 70%, rgba(34, 197, 94, 0.055), transparent 70%);
}

/* ---------------- Login ---------------- */

.login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  background: linear-gradient(160deg, rgba(24, 24, 38, 0.94), rgba(12, 12, 20, 0.96));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px;
  box-shadow: var(--shadow), 0 0 80px rgba(124, 58, 237, 0.08);
  backdrop-filter: blur(18px);
}

.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 28px; }

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 24px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.9), rgba(139, 92, 246, 0.55));
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.32);
  flex: 0 0 auto;
}

.brand-title { font-weight: 800; letter-spacing: 0.4px; font-size: 17px; }
.brand-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.login-card h1 { font-size: 26px; letter-spacing: -0.4px; margin-bottom: 8px; }
.login-desc { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin-bottom: 24px; }

.login-card form { display: grid; gap: 15px; }
.login-card label, .stack label { display: grid; gap: 7px; font-size: 13px; color: var(--text-dim); }

.input, .login-card input, .stack input, textarea {
  width: 100%;
  background: rgba(8, 8, 14, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.login-card input:focus, .input:focus, .stack input:focus, textarea:focus {
  border-color: rgba(139, 92, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}

.form-error {
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

.login-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------- Layout ---------------- */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  background: rgba(11, 11, 18, 0.86);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 4px; }
.sidebar-brand .brand-mark { width: 40px; height: 40px; font-size: 21px; border-radius: 12px; }
.sidebar-brand .brand-title { font-size: 15px; }
.sidebar-brand .brand-sub { font-size: 11px; }
.sidebar .sidebar-close { display: none; margin-left: auto; }
.sidebar-backdrop { display: none; }

.nav { display: grid; gap: 5px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  padding: 11px 12px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.nav-item:hover { background: rgba(255, 255, 255, 0.035); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.18), rgba(124, 58, 237, 0.04));
  border-color: rgba(124, 58, 237, 0.28);
  color: #d8c9ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-status {
  margin-top: auto;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.sidebar-status-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.sidebar-status-sub { color: var(--text-dim); font-size: 12px; margin-top: 5px; padding-left: 16px; }
.sidebar-footer {
  display: flex;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 11px;
  padding: 0 4px;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 13, 0.8);
  backdrop-filter: blur(18px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { font-size: 22px; letter-spacing: -0.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar p { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.icon-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); border-color: #33334a; }
.mobile-menu { display: none; }

.content { padding: 26px 28px 46px; }

/* ---------------- Common components ---------------- */

.card {
  background: linear-gradient(160deg, rgba(19, 19, 30, 0.9), rgba(13, 13, 21, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
  min-height: 24px;
}
.card-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: #c9c9dc; }
.card-hint { color: var(--text-faint); font-size: 11.5px; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.card-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 15px;
  font-weight: 650;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  line-height: 1.2;
}
.btn:hover { background: rgba(255, 255, 255, 0.07); border-color: #34344a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border-color: rgba(167, 139, 250, 0.45);
  color: white;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.22);
}
.btn-primary:hover { background: linear-gradient(135deg, #8b5cf6, #7c3aed); border-color: rgba(196, 181, 253, 0.6); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; padding: 12px; }
.btn-small { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-power { width: 36px; height: 36px; padding: 0; font-size: 14px; border-radius: 10px; }
.btn-start { color: #86efac; border-color: rgba(34, 197, 94, 0.3); background: var(--green-soft); }
.btn-start:hover { background: rgba(34, 197, 94, 0.24); }
.btn-restart { color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); background: var(--orange-soft); }
.btn-restart:hover { background: rgba(245, 158, 11, 0.24); }
.btn-stop { color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); background: var(--red-soft); }
.btn-stop:hover { background: rgba(239, 68, 68, 0.24); }

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.state-pill.small { padding: 5px 9px; font-size: 11px; }
.state-pill.online { border-color: rgba(34, 197, 94, 0.32); background: var(--green-soft); color: #86efac; }
.state-pill.offline { border-color: rgba(239, 68, 68, 0.3); background: var(--red-soft); color: #fca5a5; }
.state-pill.starting { border-color: rgba(245, 158, 11, 0.32); background: var(--orange-soft); color: #fcd34d; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); display: inline-block; flex: 0 0 auto; }
.dot.green { background: var(--green); box-shadow: 0 0 10px rgba(34, 197, 94, 0.75); }
.dot.red { background: var(--red); box-shadow: 0 0 10px rgba(239, 68, 68, 0.7); }
.dot.orange { background: var(--orange); box-shadow: 0 0 10px rgba(245, 158, 11, 0.7); }
.dot.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------- Stats ---------------- */

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { display: flex; flex-direction: column; min-height: 178px; }
.stat-main { display: flex; align-items: baseline; gap: 5px; margin: 2px 0 10px; flex-wrap: nowrap; }
.stat-main > span:first-child { font-size: clamp(30px, 3vw, 40px); font-weight: 800; letter-spacing: -1.5px; line-height: 1; white-space: nowrap; }
.stat-unit { color: var(--text-dim); font-size: 13px; font-weight: 600; white-space: nowrap; }
.meter { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.055); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0%; border-radius: inherit; transition: width 0.5s ease; }
.meter-fill.accent { background: linear-gradient(90deg, #7c3aed, #c4b5fd); box-shadow: 0 0 16px rgba(124, 58, 237, 0.5); }
.meter-fill.green { background: linear-gradient(90deg, #16a34a, #86efac); box-shadow: 0 0 16px rgba(34, 197, 94, 0.35); }
.meter-fill.orange { background: linear-gradient(90deg, #d97706, #fcd34d); box-shadow: 0 0 16px rgba(245, 158, 11, 0.32); }
.stat-foot { display: flex; justify-content: space-between; gap: 10px; color: var(--text-dim); font-size: 11.5px; margin-top: 9px; }
.cores { display: grid; grid-template-columns: repeat(auto-fit, minmax(34px, 1fr)); gap: 5px; margin-top: auto; padding-top: 12px; }
.core { display: grid; gap: 4px; }
.core-bar { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.core-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6d28d9, #a78bfa); border-radius: inherit; transition: width 0.45s; }
.core-label { font-size: 9px; color: var(--text-faint); text-align: center; }

.net-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
.net-item { display: flex; align-items: center; gap: 9px; }
.net-arrow { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.net-arrow.down { color: #67e8f9; background: rgba(34, 211, 238, 0.1); }
.net-arrow.up { color: #c4b5fd; background: rgba(167, 139, 250, 0.1); }
.net-value { font-size: 15.5px; font-weight: 750; letter-spacing: -0.3px; white-space: nowrap; }
.net-label { color: var(--text-faint); font-size: 10.5px; }

/* ---------------- Charts ---------------- */

.charts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.chart-card { padding: 18px 18px 12px; }
.chart-card canvas { width: 100%; height: 110px; display: block; }

/* ---------------- Overview grid ---------------- */

.overview-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-top: 16px; }
.mc-motd { font-size: 16px; font-weight: 700; color: #e9e4ff; margin: -2px 0 16px; line-height: 1.4; min-height: 22px; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; }
.info-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.info-grid > div { display: grid; gap: 3px; min-width: 0; }
.info-label { color: var(--text-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 650; }
.info-value { font-size: 13.5px; font-weight: 650; color: #d7d7e6; overflow-wrap: anywhere; }
.player-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11.5px;
}
.chip.online { border-color: rgba(34, 197, 94, 0.25); color: #86efac; background: var(--green-soft); }

.proc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; }

.list { display: grid; gap: 1px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.045); font-size: 12.5px; }
.list-row:last-child { border-bottom: 0; }
.list-row .name { display: flex; align-items: center; gap: 8px; min-width: 0; color: #cfcfe0; }
.list-row .name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { color: var(--text-faint); font-size: 11px; text-align: right; white-space: nowrap; }
.state-text { font-size: 11px; font-weight: 650; }
.state-text.active { color: #86efac; }
.state-text.inactive { color: #fca5a5; }
.state-text.other { color: #fcd34d; }

/* ---------------- Console ---------------- */

.console-shell { padding: 0; overflow: hidden; display: flex; flex-direction: column; min-height: calc(100vh - 170px); }
.console-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.console-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; }
.console-tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.input-small { width: 210px; padding: 8px 11px; font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; user-select: none; }
.check input { accent-color: var(--accent); }
.console-log {
  flex: 1;
  min-height: 360px;
  max-height: calc(100vh - 330px);
  overflow-y: auto;
  padding: 14px 18px;
  background: #07070b;
  font-family: var(--mono);
  font-size: 12.2px;
  line-height: 1.62;
  color: #c9c9d8;
  scrollbar-width: thin;
}
.console-line { display: flex; gap: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-line .ts { color: #4e4e63; flex: 0 0 auto; }
.console-line .msg { min-width: 0; }
.console-line.info .lvl { color: #67e8f9; }
.console-line.warn .lvl { color: #fcd34d; }
.console-line.error .lvl { color: #fca5a5; }
.console-line.panel .msg { color: #c4b5fd; }
.console-line.console-out .msg { color: #86efac; }
.console-line .lvl { color: #8b5cf6; font-weight: 700; }
.console-input-row { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--border); background: rgba(255, 255, 255, 0.02); }
.console-prompt { color: var(--accent-2); font-family: var(--mono); font-weight: 800; }
.console-input { flex: 1; background: #07070b; border: 1px solid var(--border); border-radius: 9px; color: #e5e7f0; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; outline: none; }
.console-input:focus { border-color: rgba(139, 92, 246, 0.6); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12); }
.console-hint { padding: 0 18px 14px; color: var(--text-faint); font-size: 11.5px; }

/* ---------------- Tables / files / players ---------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--text-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.65px; font-weight: 700; padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.045); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .right { text-align: right; }
.file-name { display: flex; align-items: center; gap: 9px; min-width: 220px; }
.file-icon { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; background: rgba(255, 255, 255, 0.04); flex: 0 0 auto; }
.file-icon.dir { color: #fcd34d; background: rgba(245, 158, 11, 0.1); }
.file-icon.jar { color: #86efac; background: rgba(34, 197, 94, 0.1); }
.file-icon.yml, .file-icon.json, .file-icon.properties { color: #67e8f9; background: rgba(34, 211, 238, 0.1); }
.file-name button { background: none; border: 0; color: #dcdcf0; padding: 0; text-align: left; font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.file-name button:hover { color: white; text-decoration: underline; text-underline-offset: 3px; }
.files-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.files-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); }
.breadcrumb button { border: 0; background: none; color: var(--accent-2); font-weight: 650; padding: 2px 1px; }
.breadcrumb span { color: var(--text-faint); }
.empty { padding: 32px 12px; text-align: center; color: var(--text-faint); font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 8px; font-size: 10.5px; font-weight: 700; border: 1px solid var(--border); color: var(--text-dim); background: rgba(255, 255, 255, 0.03); }
.badge.online { color: #86efac; border-color: rgba(34, 197, 94, 0.28); background: var(--green-soft); }
.badge.op { color: #fcd34d; border-color: rgba(245, 158, 11, 0.28); background: var(--orange-soft); }
.badge.white { color: #c4b5fd; border-color: rgba(139, 92, 246, 0.3); background: rgba(124, 58, 237, 0.1); }
.row-actions { display: inline-flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------- Settings ---------------- */

.settings-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
.settings-main { grid-column: 1 / -1; }
.props-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.props-form label, .stack label { display: grid; gap: 6px; color: var(--text-dim); font-size: 12px; }
.props-form .input, .props-form select { padding: 9px 11px; font-size: 12.5px; }
.props-form select { background: #08080e; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
.stack { display: grid; gap: 13px; }
.audit-list { display: grid; gap: 6px; max-height: 330px; overflow-y: auto; }
.audit-row { display: grid; grid-template-columns: 116px 1fr; gap: 8px; font-size: 11.5px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.audit-row time { color: var(--text-faint); font-family: var(--mono); font-size: 10.5px; }
.audit-row .act { color: #cfcfe0; overflow-wrap: anywhere; }
.audit-row .act b { color: var(--accent-2); font-weight: 650; }
.backups-list { margin-top: 10px; max-height: 250px; overflow-y: auto; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.045); font-size: 12px; }
.backup-row .bname { overflow-wrap: anywhere; color: #d7d7e6; }
.backup-row .bmeta { color: var(--text-faint); font-size: 10.5px; white-space: nowrap; }
.backup-row .bactions { display: flex; gap: 4px; flex: 0 0 auto; }

/* ---------------- Modal / toast ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 3, 7, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #101018;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal.narrow { width: min(440px, 100%); }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; flex-wrap: wrap; }
.modal textarea { width: 100%; min-height: 420px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.55; margin-top: 14px; }
.modal .file-meta { color: var(--text-faint); font-size: 11px; margin-top: 3px; }
.modal .editor-info { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--text-faint); font-size: 11px; }

.toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 9px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  background: #171724;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  color: #dedeec;
  font-size: 12.5px;
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
  animation: toast-in .18s ease-out;
  overflow-wrap: anywhere;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.noscript { position: fixed; inset: 0; z-index: 300; background: #08080d; color: white; display: grid; place-items: center; padding: 24px; text-align: center; }

/* ---------------- Scrollbars ---------------- */

* { scrollbar-width: thin; scrollbar-color: #2b2b3e transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #2b2b3e; border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Responsive ---------------- */

@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-grid .chart-card:last-child { grid-column: 1 / -1; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .mc-card { grid-row: auto; grid-column: 1 / -1; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-main { grid-column: auto; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 270px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 20px 0 60px rgba(0,0,0,.45);
  }
  .sidebar.open { transform: none; }
  .sidebar .sidebar-close { display: grid; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0,0,0,.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .mobile-menu { display: grid; }
  .topbar { padding: 14px 16px; align-items: flex-start; }
  .topbar-right { gap: 7px; }
  .content { padding: 18px 16px 40px; }
  .topbar h1 { font-size: 19px; }
  .topbar p { display: none; }
  .state-pill { padding: 7px 9px; font-size: 11.5px; }
  .btn-power { width: 33px; height: 33px; }
  .charts-grid { grid-template-columns: 1fr; }
  .charts-grid .chart-card:last-child { grid-column: auto; }
  .overview-grid { grid-template-columns: 1fr; }
  .mc-card { grid-column: auto; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .props-form { grid-template-columns: 1fr; }
  .console-shell { min-height: calc(100vh - 160px); }
  .console-log { max-height: calc(100vh - 330px); }
}

@media (max-width: 620px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 150px; }
  .info-grid, .proc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-right .btn-ghost { display: none; }
  .login-card { padding: 26px 22px; }
  .login-card h1 { font-size: 22px; }
  .files-toolbar { align-items: flex-start; flex-direction: column; }
  .console-toolbar { align-items: flex-start; }
  .input-small { width: 100%; }
  .console-tools { width: 100%; }
  .console-tools .input-small { flex: 1; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
  .modal textarea { min-height: 300px; }
  .audit-row { grid-template-columns: 1fr; gap: 2px; }
}
