:root {
  --bg: #16181c;
  --bg-raised: #1f2126;
  --card: #26292f;
  --card-2: #2f333a;
  --border: #363a42;
  --text: #e3e6eb;
  --muted: #9aa3ad;
  --green: #1bd96a;
  --green-dim: #1bd96a26;
  --red: #ff496e;
  --red-dim: #ff496e22;
  --orange: #ffa347;
  --orange-dim: #ffa34722;
  --blue: #4f9cff;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--green); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--red); min-height: 1.2em; margin: 8px 0 0; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
input, select, textarea {
  background: var(--bg-raised); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; width: 100%; outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }
label { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
label > input, label > select, label > textarea { margin-top: 6px; color: var(--text); font-weight: 400; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border);
  background: var(--card-2); color: var(--text); border-radius: 10px; padding: 8px 14px; font: 600 14px var(--font);
  cursor: pointer; white-space: nowrap; transition: filter .15s, transform .05s, background .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--green); border-color: var(--green); color: #0b1a10; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-outline { color: var(--red); border-color: #ff496e55; background: var(--red-dim); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--card-2); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 8px 11px; }
.btn.wide { width: 100%; margin-top: 14px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; padding: 28px; }
.login-card label { margin-top: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand.big { font-size: 24px; }
.logo, .server-icon {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: #fff url("uthm-logo.png") center/78% no-repeat;
}

/* layout */
.layout { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-raised); border-right: 1px solid var(--border); padding: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { padding: 24px 28px 60px; min-width: 0; max-width: 1200px; width: 100%; }
.server-card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.server-head { display: flex; gap: 12px; align-items: center; }
.server-icon { width: 46px; height: 46px; border-radius: 12px; }
.server-name { font-weight: 800; font-size: 16px; }
.server-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.power { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.power .btn { padding: 8px 6px; }
.power #btn-start { grid-column: 1 / -1; }
.power #btn-kill { display: none; }
.power.running #btn-start { display: none; }
.power.running { grid-template-columns: 1fr 1fr auto; }
.power.running #btn-kill { display: inline-flex; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.nav a i { font-style: normal; width: 22px; text-align: center; font-family: var(--mono); font-size: 13px; }
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.active { background: var(--green-dim); color: var(--green); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--card-2); color: var(--muted); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.online { background: var(--green-dim); color: var(--green); }
.badge.offline { background: var(--red-dim); color: var(--red); }
.badge.starting, .badge.stopping { background: var(--orange-dim); color: var(--orange); }
.badge.plain::before { display: none; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--card-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.tag.green { background: var(--green-dim); color: var(--green); }
.tag.orange { background: var(--orange-dim); color: var(--orange); }

/* cards & grids */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 14px; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stat .sub { color: var(--muted); font-size: 12.5px; }
.bar { height: 6px; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > div { height: 100%; background: var(--green); border-radius: 99px; transition: width .4s; }
.bar.warn > div { background: var(--orange); }
.bar.bad > div { background: var(--red); }
.two { grid-template-columns: 1.3fr 1fr; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.copy { cursor: pointer; border-bottom: 1px dashed var(--muted); }

/* console */
.console-wrap { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 380px; }
.console {
  flex: 1; background: #0e0f12; border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; padding: 12px 14px;
  overflow-y: auto; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.console .l-warn { color: var(--orange); }
.console .l-err { color: var(--red); }
.console .l-panel { color: var(--green); }
.console .l-cmd { color: var(--blue); }
.console .l-chat { color: #e0d36b; }
.console .l-join { color: #7fe3a5; }
.console-input { display: flex; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--bg-raised); }
.console-input span { padding: 10px 0 10px 14px; color: var(--green); font-family: var(--mono); }
.console-input input { border: 0; border-radius: 0 0 var(--radius) var(--radius); background: transparent; font-family: var(--mono); }
.console-mini { height: 260px; border-radius: var(--radius); }

/* lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .desc { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.disabled { opacity: .55; }
.item .actions { display: flex; gap: 6px; flex: none; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 8px; image-rendering: pixelated; flex: none; background: var(--card-2); }
.mod-icon { width: 46px; height: 46px; border-radius: 10px; flex: none; background: var(--card-2); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: transparent; border: 0; color: var(--muted); font: 700 14px var(--font); padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.tabs button.active { background: var(--green-dim); color: var(--green); }
.section { margin-top: 22px; }
.empty { color: var(--muted); padding: 22px; text-align: center; background: var(--card); border-radius: 12px; }

/* toggle */
.switch { position: relative; width: 40px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--card-2); border: 1px solid var(--border); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--muted); border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); border-color: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); background: #0b1a10; }
.switch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }

/* files */
.crumbs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; font-weight: 600; }
.crumbs a { color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--card-2); color: var(--text); }
.file-table { width: 100%; border-collapse: collapse; }
.file-table td { padding: 9px 10px; border-top: 1px solid var(--border); font-size: 14px; }
.file-table tr:hover td { background: var(--card-2); }
.file-table td.name { cursor: pointer; word-break: break-all; }
.file-table td.r { text-align: right; white-space: nowrap; color: var(--muted); }
.editor { width: 100%; min-height: 60vh; font: 13px/1.5 var(--mono); white-space: pre; tab-size: 2; resize: vertical; }

/* properties */
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.prop { background: var(--card); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.prop.changed { outline: 1px solid var(--green); }
.prop .k { font-family: var(--mono); font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prop .help { font-size: 12px; color: var(--muted); }
.savebar { position: sticky; bottom: 12px; margin-top: 16px; display: flex; gap: 10px; align-items: center; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; box-shadow: 0 8px 24px #0008; }

/* modal & toasts & banner */
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-card { width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; }
.modal-card .row.end { justify-content: flex-end; margin-top: 18px; }
.modal-card label { margin-top: 12px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--card-2); border: 1px solid var(--border); border-left: 4px solid var(--green); padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px #0008; max-width: 380px; animation: pop .2s ease-out; }
.toast.err { border-left-color: var(--red); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--orange-dim); border: 1px solid #ffa34755; color: var(--orange); padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; }
.banner span { flex: 1; min-width: 200px; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* mobile */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 8px 12px; }
  .nav a i { display: none; }
  .main { padding: 16px 16px 60px; }
  .two { grid-template-columns: 1fr; }
  .console-wrap { height: calc(100vh - 260px); }
  .item { flex-wrap: wrap; }
  .item .actions { width: 100%; justify-content: flex-end; }
  .file-table td.hide-m { display: none; }
}
