:root {
  --bg:       #1a1b1e;
  --sidebar:  #25262b;
  --card:     #2c2d32;
  --border:   #3a3b40;
  --primary:  #5865F2;
  --primary-h:#4752c4;
  --green:    #57F287;
  --red:      #ED4245;
  --yellow:   #FEE75C;
  --text:     #e0e0e0;
  --muted:    #8b8b8b;
  --header-h: 56px;
  --sidebar-w:220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ── Login ───────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  width: 320px;
  text-align: center;
}
.login-logo { font-size: 40px; margin-bottom: 12px; }
.login-box h2 { font-size: 20px; margin-bottom: 6px; }
.login-box p { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.login-box input { margin-bottom: 12px; }
.login-box .btn { width: 100%; }

/* ── Header ──────────────────────────────────────────── */
#header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}
.logo { font-size: 15px; font-weight: 700; letter-spacing: 1px; color: white; }
.status-badge {
  font-size: 12px; padding: 3px 10px; border-radius: 20px;
  background: var(--border); color: var(--muted); margin-left: 12px;
  transition: all 0.3s;
}
.status-badge.online  { background: rgba(87,242,135,.15); color: var(--green); }
.status-badge.offline { background: rgba(237,66,69,.15);  color: var(--red);   }
.header-right { display: flex; align-items: center; gap: 16px; }
#guild-info, #uptime-info { font-size: 13px; color: var(--muted); }

/* ── Layout ──────────────────────────────────────────── */
.layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
}

/* ── Sidebar ─────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-section {
  padding: 16px 12px 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase;
  color: var(--muted);
}
.module-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  cursor: pointer; border-radius: 6px; margin: 2px 8px;
  transition: background .1s;
}
.module-item:hover  { background: var(--border); }
.module-item.active { background: var(--primary); }
.module-item.active .module-name { color: white; }
.module-name { font-size: 14px; color: var(--text); }

/* Toggle */
.toggle { position: relative; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 9px;
  background: var(--border); transition: background .2s; cursor: pointer;
}
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle-track::after {
  content: ''; position: absolute;
  top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: white; transition: transform .2s;
}
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }

/* ── Main ────────────────────────────────────────────── */
#main { flex: 1; overflow-y: auto; padding: 24px; }

.placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: 15px;
}

/* ── Panel ───────────────────────────────────────────── */
.panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px;
}
.panel-title   { font-size: 22px; font-weight: 700; }
.panel-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 16px;
}

/* ── Fields ──────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field-hint  { font-size: 11px; color: var(--muted); margin-top: 4px; }

input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  font-size: 13px; padding: 8px 12px;
  outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; font-family: inherit; line-height: 1.5; }
select option { background: var(--card); }

/* Role multi */
.role-list { display: flex; flex-direction: column; gap: 6px; }
.role-row  { display: flex; gap: 8px; align-items: center; }
.role-row select { flex: 1; }
.btn-icon {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--red); padding: 7px 10px; cursor: pointer; font-size: 14px;
  transition: background .1s;
}
.btn-icon:hover { background: rgba(237,66,69,.1); }
.btn-add {
  background: none; border: 1px dashed var(--border); border-radius: 6px;
  color: var(--muted); padding: 7px 12px; cursor: pointer; font-size: 13px;
  width: 100%; margin-top: 4px; transition: all .1s;
}
.btn-add:hover { border-color: var(--primary); color: var(--primary); }

/* Servers */
.server-list { display: flex; flex-direction: column; gap: 10px; }
.server-row  { display: flex; gap: 8px; align-items: center; }
.server-name {
  flex: 0 0 160px; font-size: 13px;
  padding: 8px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; color: var(--text);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  padding: 9px 18px; border-radius: 6px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-danger {
  background: rgba(237,66,69,.12); color: var(--red);
  border: 1px solid rgba(237,66,69,.25);
}
.btn-danger:hover { background: rgba(237,66,69,.22); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.save-bar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; margin-top: 8px;
}
.save-hint { font-size: 12px; color: var(--muted); margin-right: auto; }
.restart-note {
  font-size: 12px; color: var(--yellow);
  background: rgba(254,231,92,.08);
  border: 1px solid rgba(254,231,92,.2);
  padding: 3px 10px; border-radius: 20px;
}

/* ── Toast ───────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  opacity: 0; transition: opacity .3s;
  pointer-events: none; z-index: 100;
}
#toast.show { opacity: 1; }
#toast.success { background: rgba(87,242,135,.15);  color: var(--green); border: 1px solid rgba(87,242,135,.3); }
#toast.error   { background: rgba(237,66,69,.15);   color: var(--red);   border: 1px solid rgba(237,66,69,.3);   }

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
