/* ── Reset & Variables ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --surface2: #22263a;
  --border:   #2d3148;
  --primary:  #5865f2;
  --primary-h:#4752c4;
  --danger:   #ed4245;
  --warn:     #f0a232;
  --success:  #3ba55d;
  --text:     #e3e5e8;
  --text-2:   #8b8f9e;
  --radius:   8px;
  --shadow:   0 2px 12px rgba(0,0,0,.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { font-size: 18px; font-weight: 700; color: var(--primary); letter-spacing: .5px; }
.header-right { display: flex; align-items: center; gap: 12px; }

/* ── Badge ───────────────────────────────────────────────────────────────── */
.badge {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.badge--online  { background: #2d4d36; color: #5dbb7c; }
.badge--offline { background: #3d1f22; color: #ed6f72; }
.badge--busy    { background: #3d3018; color: #f0b849; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn--primary { background: var(--primary);  color: #fff; }
.btn--primary:hover { background: var(--primary-h); }
.btn--danger  { background: var(--danger);   color: #fff; }
.btn--danger:hover  { opacity: .85; }
.btn--ghost   { background: var(--surface2); color: var(--text); }
.btn--ghost:hover   { background: var(--border); }
.btn--warn    { background: var(--warn);     color: #000; }
.btn--sm      { padding: 4px 10px; font-size: 12px; }
.btn--wide    { flex: 1; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  align-items: start;
}
.panel--left  { display: flex; flex-direction: column; gap: 16px; }
.panel--right { display: flex; flex-direction: column; gap: 16px; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card--grow { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.hint { font-size: 11px; color: var(--text-2); }

/* ── Stat Grid ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.stat {
  background: var(--surface2);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label { font-size: 11px; color: var(--text-2); }
.stat-val   { font-size: 15px; font-weight: 700; }

/* ── Banner ──────────────────────────────────────────────────────────────── */
.banner {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.banner--warn { background: #3d2e0a; border: 1px solid #7a5e1a; color: var(--warn); }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.progress-bar {
  background: var(--surface2);
  border-radius: 99px;
  height: 20px;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-bar__inner {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width .4s ease;
}
.progress-bar__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

/* ── Search / Input ──────────────────────────────────────────────────────── */
.search-input, input[type="text"], input[type="url"],
input[type="password"], input[type="number"], textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus, input:focus, textarea:focus {
  border-color: var(--primary);
}
textarea { resize: vertical; font-family: inherit; }
.search-input { margin-bottom: 8px; }

/* ── Friend List ─────────────────────────────────────────────────────────── */
.friend-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  max-height: 380px;
}
.friend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.friend-item:hover { background: var(--surface2); }
.friend-item.selected { background: #1f2456; }
.friend-item input[type="checkbox"] { accent-color: var(--primary); }

/* ── Count Badge ─────────────────────────────────────────────────────────── */
.count-badge {
  display: inline-block;
  background: var(--surface2);
  border-radius: 99px;
  font-size: 11px;
  padding: 1px 7px;
  font-weight: 600;
  color: var(--text-2);
  margin-left: 4px;
}

/* ── Form Groups ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-group--row {
  display: flex;
  gap: 16px;
  align-items: center;
}
.form-group--row label {
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 0;
}
.form-actions { display: flex; gap: 8px; }

/* ── Selected List ───────────────────────────────────────────────────────── */
.selected-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 100px;
  overflow-y: auto;
}
.selected-tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.selected-tag .remove {
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
}
.selected-tag .remove:hover { color: var(--danger); }

/* ── Result ──────────────────────────────────────────────────────────────── */
.result-summary {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.tag {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.tag--success { background: #1e3a2a; color: #5dbb7c; }
.tag--fail    { background: #3d1f22; color: #ed6f72; }

.result-list {
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface2);
  font-size: 13px;
}
.result-icon { font-size: 16px; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 420px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.modal-box h2 { font-size: 17px; margin-bottom: 4px; }
.modal-box label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.modal-box label input { margin-top: 2px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
  min-width: 220px;
}
.toast--success { border-left: 3px solid var(--success); }
.toast--error   { border-left: 3px solid var(--danger); }
.toast--warn    { border-left: 3px solid var(--warn); }

@keyframes slideIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
}
