/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:       #0e1117;
  --surface:  #161b27;
  --border:   #252d3d;
  --accent:   #e8510a;
  --accent2:  #c74208;
  --text:     #dce4f0;
  --muted:    #5a6480;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --radius:   6px;
  --font:     'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:     'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }

/* ── Utilities ──────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.muted   { color: var(--muted); font-size: 12px; }
.center  { text-align: center; padding: 16px; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover  { background: var(--accent2); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #2e374d; }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: #3a4560; }
.btn-danger   { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm   { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }

/* ── Fields ─────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
input[type="text"], input[type="password"] {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 9px 12px; font-size: 14px; outline: none; width: 100%;
  transition: border-color 0.15s;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--accent); }

/* ── Error msg ──────────────────────────────────────────────────── */
.error-msg { background: #3b0d0d; border: 1px solid #7f1d1d; color: #fca5a5; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; }

/* ── Badge ──────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-on  { background: #14532d; color: var(--green); }
.badge-off { background: #450a0a; color: var(--red); }

/* ── Login ──────────────────────────────────────────────────────── */
.login-body  { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap  { width: 100%; max-width: 380px; padding: 16px; }
.login-card  { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 32px 28px; }
.login-logo  { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 16px; font-weight: 700; letter-spacing: 0.08em; color: var(--text); }

/* ── App layout ─────────────────────────────────────────────────── */
.app-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 50px; padding: 0 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.05em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user  { font-size: 12px; color: var(--muted); }
.topbar-title { font-size: 14px; }

.app-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 12px;
  padding: 12px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Panel card ─────────────────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  flex-shrink: 0;
}

/* ── Console ────────────────────────────────────────────────────── */
.console-out {
  flex: 1; overflow-y: auto; padding: 10px 14px;
  font-family: var(--mono); font-size: 12px; line-height: 1.65;
  min-height: 0;
}
.console-out::-webkit-scrollbar { width: 6px; }
.console-out::-webkit-scrollbar-track { background: transparent; }
.console-out::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.log-line         { display: block; word-break: break-all; }
.log-Input        { color: var(--accent); }
.log-Generic      { color: var(--text); }
.log-Warning      { color: var(--yellow); }
.log-Error        { color: var(--red); }
.log-Chat         { color: #38bdf8; }

.cmd-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.cmd-prompt { color: var(--accent); font-family: var(--mono); font-size: 14px; flex-shrink: 0; }
.cmd-input  {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 7px 10px; font-family: var(--mono); font-size: 13px; outline: none;
}
.cmd-input:focus { border-color: var(--accent); }

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Quick actions ──────────────────────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; }
.quick-actions .btn { font-size: 12px; padding: 6px 8px; }

/* ── Player list ────────────────────────────────────────────────── */
.player-list { padding: 6px; overflow-y: auto; flex: 1; }
.player-card {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 8px 10px; border-radius: 5px; border: 1px solid var(--border);
  margin-bottom: 5px; background: var(--bg);
}
.player-info  { flex: 1; min-width: 0; }
.player-name  { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-meta  { font-size: 11px; color: var(--muted); }
.player-acts  { display: flex; gap: 5px; flex-shrink: 0; }
.player-acts .btn { padding: 4px 8px; font-size: 11px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .app-grid { grid-template-columns: 1fr; }
  .sidebar  { max-height: 320px; }
}
