:root {
  --bg-deep: #0b0d10;
  --bg-0: #111318;
  --bg-1: #161a21;
  --bg-2: #1c212b;
  --bg-3: #242b38;
  --bg-hover: #2a3344;
  --bg-active: #313c50;
  --border: rgba(255, 255, 255, 0.06);
  --text: #e8edf5;
  --text-muted: #8b97ab;
  --text-dim: #5c6a80;
  --accent: #3ecf8e;
  --accent-2: #2bb673;
  --accent-soft: rgba(62, 207, 142, 0.14);
  --danger: #f04747;
  --danger-soft: rgba(240, 71, 71, 0.15);
  --warning: #faa61a;
  --online: #3ba55d;
  --idle: #faa61a;
  --dnd: #ed4245;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --server-rail: 72px;
  --sidebar: 280px;
  --members: 240px;
  --header-h: 48px;
  --titlebar-h: 0px;
  --top-nav-hotspot: 20px;
}

body.has-titlebar {
  --titlebar-h: 36px;
}

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

html, body, #app {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* Splash inicial (antes do app montar) */
.boot-splash {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  animation: boot-splash-in 0.45s ease-out both;
  background: radial-gradient(ellipse 50% 42% at 50% 48%, rgba(11, 13, 16, 0.55), transparent 70%);
}
.boot-splash-mark {
  position: relative;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.boot-splash-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  position: relative;
  z-index: 1;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.boot-splash-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(62, 207, 142, 0.35);
  animation: boot-spin 0.9s linear infinite;
}
.boot-splash-brand {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.boot-splash-bar {
  width: 120px;
  height: 3px;
  border-radius: 99px;
  background: var(--bg-3);
  overflow: hidden;
  margin-top: 2px;
}
.boot-splash-bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  animation: boot-bar 1.2s ease-in-out infinite;
}
.boot-splash-status {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
@keyframes boot-splash-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes boot-spin {
  to { transform: rotate(360deg); }
}
@keyframes boot-bar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
  .boot-splash,
  .boot-splash-ring,
  .boot-splash-bar span {
    animation: none;
  }
  .boot-splash-ring {
    border-color: var(--accent-soft);
    border-top-color: var(--accent);
  }
  .boot-splash-bar span {
    width: 100%;
    transform: none;
    opacity: 0.85;
  }
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a { color: var(--accent); text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border-radius: 8px;
}
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #04140c;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
  background: var(--bg-3);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-dim); }

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
}
.avatar-lg { width: 80px; height: 80px; }
.avatar-xl { width: 120px; height: 120px; }
.avatar-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: var(--font-display);
  color: #fff;
  text-transform: uppercase;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-1);
  position: absolute;
  right: -1px;
  bottom: -1px;
  background: var(--online);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}
.status-dot.idle { background: var(--idle); }
.status-dot.dnd { background: var(--dnd); }
.status-dot.offline, .status-dot.invisible { background: var(--text-dim); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--bg-3);
  color: var(--text-muted);
}
.badge-count {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: fadeIn 0.18s ease;
}
.modal {
  width: min(480px, 92vw);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise 0.22s ease;
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 8px;
}
.modal p.sub {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 220px;
  animation: rise 0.2s ease;
}
.toast.error { border-color: var(--danger); }
.toast.ok { border-color: var(--accent); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.field { margin-bottom: 16px; }
.field-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
}
