:root {
  --bg: #121410; --panel: #1a1d16; --panel2: #22261d; --line: #2f3428; --text: #e4e6dc; --muted: #8d9282;
  --accent: #b5c46a; --accent-ink: #1a1d10; --red: #e0614f; --amber: #e3b04b; --blue: #6fa8dc; --green: #7cc46a;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1.2em; margin: 0; }
a { color: var(--accent); }

.brand { font-weight: 800; letter-spacing: .18em; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.brand.big { font-size: 22px; justify-content: center; }
.logo { color: var(--accent); }

/* login */
.login { display: grid; place-items: center; height: 100%; background: radial-gradient(ellipse at top, #23281b, var(--bg) 60%); }
.login-card { width: min(340px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 12px; text-align: center; }
.login-card p { margin: 0; }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100%; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 14px; }
.server-list { display: grid; gap: 4px; overflow: auto; }
.server-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); cursor: pointer; border: 1px solid transparent; background: none; text-align: left; width: 100%; }
.server-item:hover { background: var(--panel2); }
.server-item.active { background: var(--panel2); border-color: var(--line); }
.server-item .meta { font-size: 12px; color: var(--muted); }
.side-bottom { margin-top: auto; display: flex; justify-content: space-between; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 0; }
.link:hover { color: var(--text); }

.main { overflow: auto; padding: 24px 28px 40px; min-width: 0; }

/* status dots & badges */
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.running { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.starting, .dot.stopping, .dot.updating { background: var(--amber); animation: pulse 1s infinite; }
.dot.crashed { background: var(--red); }
.dot.offline { background: transparent; border: 1.5px solid var(--muted); }
.badge.node { text-transform: none; color: var(--muted); font-weight: 500; }
@keyframes pulse { 50% { opacity: .35; } }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); text-transform: capitalize; }
.badge.sim { color: var(--amber); border-color: #5a4a24; text-transform: none; }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: var(--radius); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: #4a5240; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--red); }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: none; border-style: dashed; color: var(--muted); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.full { width: 100%; }

/* header */
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin: 0; font-size: 22px; }
.head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; }
.tab.active { color: var(--text); border-color: var(--accent); }

/* cards */
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.bar { height: 4px; border-radius: 2px; background: var(--panel2); margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .5s; }
.two { grid-template-columns: 1fr 1fr; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); font-size: 13px; word-break: break-all; }
pre.code { background: #0d0f0b; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font: 12px/1.5 var(--mono); overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-all; }

/* console */
.console { background: #0b0d09; border: 1px solid var(--line); border-radius: 10px; height: calc(100vh - 290px); min-height: 280px; overflow: auto; padding: 10px 14px; font: 12.5px/1.55 var(--mono); }
.console.mini { height: 240px; min-height: 0; }
.ln { white-space: pre-wrap; word-break: break-word; }
.ln time { color: #555b4c; margin-right: 10px; }
.ln.panel { color: var(--accent); } .ln.error { color: var(--red); } .ln.warn { color: var(--amber); }
.ln.cmd { color: var(--blue); } .ln.rcon { color: #c4b6e6; }
.cmdbar { display: flex; gap: 8px; margin-top: 10px; }
.cmdbar input { flex: 1; font-family: var(--mono); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* forms */
input[type=text], input[type=password], input[type=number], select, textarea {
  background: #0f110d; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.secret:not(:focus) { -webkit-text-security: disc; }
.form-section { margin-bottom: 18px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; padding-top: 20px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.savebar { position: sticky; bottom: -40px; background: linear-gradient(transparent, var(--bg) 30%); padding: 20px 0 8px; display: flex; gap: 10px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
td.mono { font-family: var(--mono); font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

/* files */
.crumbs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; font-family: var(--mono); font-size: 13px; margin-bottom: 10px; }
.crumbs button { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 2px 4px; }
.file-row { cursor: pointer; } .file-row:hover td { background: var(--panel2); }
textarea.editor { height: calc(100vh - 300px); min-height: 300px; font: 12.5px/1.5 var(--mono); resize: vertical; tab-size: 4; white-space: pre; }

.welcome { max-width: 560px; margin: 10vh auto; text-align: center; }
.welcome h1 { font-size: 28px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: var(--radius); opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; max-width: calc(100% - 40px); }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: var(--red); color: var(--red); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .server-list { grid-auto-flow: column; grid-auto-columns: max-content; }
  .side-label { display: none; }
  .main { padding: 16px; }
  .two { grid-template-columns: 1fr; }
  .head .actions { margin-left: 0; }
}
