:root {
  --bg: #0e1116;
  --bg2: #161b22;
  --card: #1a2029;
  --line: #2a323d;
  --txt: #e6edf3;
  --muted: #8b949e;
  --accent: #3fb950;
  --accent2: #58a6ff;
  --danger: #f85149;
  --warn: #d29922;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--txt);
  padding: 8px 14px;
  border-radius: 8px;
  transition: background .15s, border-color .15s, opacity .15s;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #04260c; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.danger { color: var(--danger); border-color: transparent; }
button.danger:hover { border-color: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  font: inherit;
  background: var(--bg);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent2); }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.err { color: var(--danger); font-size: 13px; min-height: 16px; margin-top: 4px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.logo { font-size: 20px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; width: 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-card .brand { justify-content: center; margin-bottom: 8px; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: var(--bg2); position: sticky; top: 0; z-index: 5;
}
.spacer { flex: 1; }
main { max-width: 1100px; margin: 0 auto; padding: 26px 22px; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-title { font-size: 17px; font-weight: 650; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted); }
.dot.running { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot.stopped, .dot.exited, .dot.created { background: var(--muted); }
.dot.missing { background: var(--danger); }
.stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.stats b { color: var(--txt); font-weight: 600; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions button { padding: 7px 12px; font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 80px 20px; }

/* modals */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: grid; place-items: center; padding: 20px; z-index: 20;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; width: 480px; max-width: 100%; display: flex; flex-direction: column; gap: 14px;
}
.modal h2 { margin: 0; font-size: 19px; }
.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.modal .row { display: flex; gap: 10px; }
.modal .row label { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* tabs + mod picker */
.tabs { display: flex; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.tab { flex: 1; background: transparent; border: none; padding: 8px; border-radius: 6px; color: var(--muted); }
.tab:hover { color: var(--txt); }
.tab.active { background: var(--card); color: var(--txt); border: 1px solid var(--line); }
.pane { display: flex; flex-direction: column; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); }

.results {
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  max-height: 240px; overflow-y: auto;
}
.result { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.result:last-child { border-bottom: none; }
.result:hover { background: var(--card); }
.result img, .result .ph { width: 34px; height: 34px; border-radius: 6px; flex: none; object-fit: cover; background: var(--line); }
.result .r-main { flex: 1; min-width: 0; }
.result .r-title { font-size: 14px; font-weight: 600; }
.result .r-desc { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .r-dl { font-size: 12px; color: var(--muted); flex: none; }
.result-empty { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 4px 6px 4px 12px;
}
.chip button { background: transparent; border: none; color: var(--muted); padding: 0 4px; font-size: 13px; }
.chip button:hover { color: var(--danger); }

.pack-selected { display: flex; align-items: center; gap: 12px; border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; background: rgba(63,185,80,.06); }
.pack-selected img, .pack-selected .ph { width: 44px; height: 44px; border-radius: 8px; flex: none; object-fit: cover; background: var(--line); }
.pack-selected .p-main { flex: 1; min-width: 0; }
.pack-selected .p-title { font-weight: 650; }
.pack-selected .p-desc { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* console */
.console-modal { width: 820px; max-width: 100%; }
.console-head { display: flex; align-items: center; }
.console-head h2 { flex: 1; }
.console-out {
  background: #05070a; border: 1px solid var(--line); border-radius: 8px;
  height: 55vh; overflow-y: auto; padding: 12px; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #c9d1d9;
}
.console-input { display: flex; align-items: center; gap: 8px; }
.console-input .prompt { color: var(--accent); font-family: ui-monospace, monospace; font-size: 16px; }
.console-input input { font-family: ui-monospace, monospace; }
.console-input button { flex: none; }
