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

:root {
  --bg:         #1a1b1e;
  --surface:    #25262b;
  --surface2:   #2c2d32;
  --border:     #373a40;
  --accent:     #5865f2;
  --accent-h:   #4752c4;
  --green:      #2ecc71;
  --red:        #e74c3c;
  --yellow:     #f59e0b;
  --text:       #dcddde;
  --text-muted: #8d9197;
  --radius:     8px;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Layout ──────────────────────────────────────────────────────────────────── */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.navbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.navbar-brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.navbar-user  { display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--border); }

.main-layout { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px; min-width: 240px;
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 16px 0;
}
.sidebar-title { padding: 0 16px 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); }
.guild-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer; transition: background .15s;
  border-left: 3px solid transparent;
}
.guild-item:hover  { background: var(--surface2); }
.guild-item.active { background: var(--surface2); border-left-color: var(--accent); }
.guild-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.guild-icon img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.guild-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Content area ─────────────────────────────────────────────────────────────── */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.placeholder { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.placeholder .icon { font-size: 48px; margin-bottom: 16px; }
.placeholder p { font-size: 16px; }

/* ── Tabs ─────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex; border-bottom: 2px solid var(--border);
  background: var(--surface); padding: 0 28px; flex-shrink: 0;
}
.tab {
  padding: 14px 18px; cursor: pointer; color: var(--text-muted);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  font-size: 14px; font-weight: 500; transition: all .15s;
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-content { padding: 28px 32px; flex: 1; overflow-y: auto; }

/* ── Cards ────────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }

/* ── Form controls ────────────────────────────────────────────────────────────── */
.form-row { margin-bottom: 20px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.form-hint  { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.input-group { display: flex; align-items: center; gap: 8px; }
.input-suffix { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

input[type=text], input[type=number], select {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 14px; padding: 10px 14px; width: 100%;
  outline: none; transition: border-color .15s; font-family: inherit;
}
input[type=text]:focus, input[type=number]:focus, select:focus { border-color: var(--accent); }
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238d9197' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
select option { background: var(--surface2); }

/* ── Chips ────────────────────────────────────────────────────────────────────── */
.chips-grid { display: flex; flex-wrap: wrap; gap: 8px; min-height: 36px; }
.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 20px;
  border: 2px solid var(--border); cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 13px; font-weight: 500; user-select: none;
}
.chip:hover  { border-color: var(--accent); }
.chip.active { border-color: var(--accent); background: rgba(88,101,242,.18); }
.chip-dot    { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chip-hash   { font-size: 13px; color: var(--text-muted); font-weight: 700; }

/* ── Buttons ──────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius);
  border: none; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: background .15s, transform .1s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-discord  { background: #5865f2; color: #fff; font-size: 16px; padding: 14px 28px; border-radius: 10px; }
.btn-discord:hover { background: #4752c4; }

.section-actions { margin-top: 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ── About / Commands ─────────────────────────────────────────────────────────── */
.cmd-group { margin-bottom: 28px; }
.cmd-group-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.cmd-list { display: flex; flex-direction: column; gap: 3px; }
.cmd-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border-radius: var(--radius); background: var(--surface2);
  flex-wrap: wrap;
}
.cmd-name {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px; color: #a9dc76; white-space: nowrap; min-width: 180px;
}
.cmd-desc { font-size: 13px; color: var(--text-muted); flex: 1; }
.badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; white-space: nowrap;
}
.badge-everyone { background: rgba(46,204,113,.18); color: #86efac; }
.badge-admin    { background: rgba(88,101,242,.25); color: #a5b4fc; }
.badge-strict   { background: rgba(239,68,68,.2);   color: #fca5a5; }

/* ── Multi-select component ───────────────────────────────────────────────────── */
.ms-wrap { position: relative; width: 100%; }

.ms-box {
  min-height: 46px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px; cursor: pointer; transition: border-color .15s;
}
.ms-box:hover, .ms-box.open { border-color: var(--accent); }

.ms-tags { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-height: 28px; align-items: center; }

.ms-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 7px; border-radius: 20px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.ms-td  { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.ms-x   { display: inline-flex; align-items: center; cursor: pointer; margin-left: 2px; opacity: .65; padding: 2px; border-radius: 50%; }
.ms-x:hover { opacity: 1; }

.ms-addbtn { display: flex; align-items: center; opacity: .45; transition: opacity .15s; flex-shrink: 0; margin-left: 2px; }
.ms-box:hover .ms-addbtn, .ms-box.open .ms-addbtn { opacity: 1; }

.ms-placeholder { font-size: 13px; color: var(--text-muted); padding: 2px 4px; }

.ms-drop {
  position: absolute; left: 0; right: 0; top: calc(100% + 5px);
  z-index: 200; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  max-height: 280px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 4px;
  display: none;
}
.ms-drop.open { display: block; }

.ms-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 6px; cursor: pointer;
  font-size: 14px; transition: background .1s; user-select: none;
}
.ms-item:hover:not(.ms-sel) { background: var(--surface); }
.ms-item.ms-sel { opacity: .4; pointer-events: none; }
.ms-item .ms-check { margin-left: auto; opacity: .6; }

.ms-empty { padding: 10px 14px; font-size: 13px; color: var(--text-muted); }

.ms-search-wrap { padding: 6px 6px 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ms-search {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px;
  padding: 7px 10px 7px 32px; width: 100%; outline: none;
  transition: border-color .15s; font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='11' cy='11' r='7' stroke='%238d9197' stroke-width='2'/%3E%3Cpath d='M16.5 16.5L21 21' stroke='%238d9197' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
.ms-search:focus { border-color: var(--accent); }

/* ── Info box ─────────────────────────────────────────────────────────────────── */
.info-box {
  background: rgba(88,101,242,.1); border: 1px solid rgba(88,101,242,.3);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 13px; color: var(--text-muted); display: flex; align-items: flex-start; gap: 10px;
}
.info-box code { background: var(--surface2); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--text); }

/* ── Modal ────────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); width: 580px; max-width: 100%;
  max-height: 82vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 6px; border-radius: 6px; display: flex; align-items: center;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-search { padding: 14px 24px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-body { flex: 1; overflow-y: auto; }

/* ── Activity users list ──────────────────────────────────────────────────────── */
.au-header {
  display: grid; grid-template-columns: 1fr 120px 90px;
  gap: 8px; padding: 8px 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.au-row {
  display: grid; grid-template-columns: 1fr 120px 90px;
  gap: 8px; padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; transition: background .1s;
}
.au-row:last-child { border-bottom: none; }
.au-row:hover { background: var(--surface2); }
.au-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.au-date { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.au-days { font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }

/* ── Login page ───────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 24px; }
.login-title { font-size: 32px; font-weight: 800; }
.login-sub   { font-size: 16px; color: var(--text-muted); max-width: 380px; }

/* ── Toast ────────────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 20px; font-size: 14px; animation: slideIn .25s ease; max-width: 320px; }
.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.loader { text-align: center; padding: 80px; color: var(--text-muted); font-size: 16px; }

@media (max-width: 640px) { .sidebar { display: none; } .tab-content { padding: 16px; } }
