/* ============================================================
   Dead Live Assist — design system
   Temas: preto | cinza | branco
   By ServerDead
   ============================================================ */

:root,
[data-theme="black"] {
  --bg: #000000;
  --bg-1: #070708;
  --bg-2: #0d0d0f;
  --bg-3: #161618;
  --card: #0c0c0e;
  --card-2: #121214;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --muted-2: #6b6b73;
  --accent: #ef4444;
  --accent-soft: rgba(239, 68, 68, 0.14);
  --accent-text: #ffffff;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --topbar-bg: rgba(6, 6, 8, 0.82);
  --logo-bg: #000000;
  --logo-fg: #ef4444;
  --logo-border: rgba(239, 68, 68, 0.45);
  --primary-bg: #ffffff;
  --primary-fg: #000000;
  --input-bg: #0d0d0f;
  --track: #1a1a1d;
  --thumb: #ffffff;
  --sidebar: #080809;
  --nav-active: rgba(239, 68, 68, 0.12);
  --nav-active-border: rgba(239, 68, 68, 0.35);
}

[data-theme="gray"] {
  --bg: #1a1a1d;
  --bg-1: #202024;
  --bg-2: #26262b;
  --bg-3: #303036;
  --card: #222226;
  --card-2: #2a2a30;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #f1f1f3;
  --muted: #b0b0b8;
  --muted-2: #808088;
  --accent: #ef4444;
  --accent-soft: rgba(239, 68, 68, 0.16);
  --accent-text: #ffffff;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --info: #60a5fa;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  --topbar-bg: rgba(26, 26, 29, 0.9);
  --logo-bg: #111113;
  --logo-fg: #ef4444;
  --logo-border: rgba(239, 68, 68, 0.4);
  --primary-bg: #ffffff;
  --primary-fg: #111111;
  --input-bg: #1c1c20;
  --track: #303036;
  --thumb: #ffffff;
  --sidebar: #1c1c20;
  --nav-active: rgba(239, 68, 68, 0.14);
  --nav-active-border: rgba(239, 68, 68, 0.4);
}

[data-theme="white"] {
  --bg: #f4f4f5;
  --bg-1: #ffffff;
  --bg-2: #ececee;
  --bg-3: #e2e2e6;
  --card: #ffffff;
  --card-2: #f0f0f2;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  --text: #111113;
  --muted: #52525b;
  --muted-2: #71717a;
  --accent: #dc2626;
  --accent-soft: rgba(220, 38, 38, 0.1);
  --accent-text: #ffffff;
  --good: #059669;
  --bad: #dc2626;
  --warn: #d97706;
  --info: #2563eb;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --logo-bg: #000000;
  --logo-fg: #ef4444;
  --logo-border: rgba(0, 0, 0, 0.2);
  --primary-bg: #111113;
  --primary-fg: #ffffff;
  --input-bg: #f4f4f5;
  --track: #d4d4d8;
  --thumb: #111113;
  --sidebar: #fafafa;
  --nav-active: rgba(220, 38, 38, 0.1);
  --nav-active-border: rgba(220, 38, 38, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }

.ic-svg { display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.btn .ic-svg { width: 17px; height: 17px; }
.btn.sm .ic-svg { width: 15px; height: 15px; }
.badge .ic-svg { width: 13px; height: 13px; }
.feat .fi .ic-svg, .now-ic .ic-svg { width: 18px; height: 18px; }
.ic-xl .ic-svg { width: 40px; height: 40px; }
.stat .ic-svg { width: 13px; height: 13px; vertical-align: -0.1em; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: padding-box; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -0.3px; font-size: 16px; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: var(--logo-bg); color: var(--logo-fg);
  border: 1px solid var(--logo-border);
  display: grid; place-items: center; font-weight: 900; font-size: 13px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: -1px;
}
.brand small { display: block; font-weight: 600; font-size: 10px; color: var(--muted-2); letter-spacing: 0.4px; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.userchip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-2);
}
.userchip img { width: 26px; height: 26px; border-radius: 999px; object-fit: cover; }
.userchip .name { font-size: 13px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--bg-3); color: var(--text); font-weight: 650; font-size: 14px;
  cursor: pointer;
  transition: transform .15s ease, background .15s, border-color .15s, box-shadow .15s, opacity .15s;
  user-select: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn.primary {
  background: var(--primary-bg); color: var(--primary-fg);
  border-color: transparent; font-weight: 750;
}
.btn.primary:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.btn.accent {
  background: var(--accent); color: var(--accent-text);
  border-color: transparent; font-weight: 750;
}
.btn.accent:hover { filter: brightness(1.1); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.discord { background: #5865F2; color: #fff; border-color: transparent; }
.btn.discord:hover { background: #4752e0; box-shadow: 0 10px 30px rgba(88,101,242,0.35); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 2px; font-size: 15px; font-weight: 750; letter-spacing: -0.2px; }
.card .sub { color: var(--muted-2); font-size: 12.5px; margin-bottom: 14px; line-height: 1.45; }

.section-title {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted-2); font-weight: 700; margin: 0 0 12px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.input, .num, select, textarea.input {
  height: 44px; width: 100%; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--input-bg); color: var(--text); padding: 0 14px; font-size: 14.5px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-family: inherit;
}
textarea.input { height: auto; min-height: 72px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input:focus, .num:focus, select:focus, textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, textarea.input::placeholder { color: var(--muted-2); }
.input-group { display: flex; gap: 10px; }
.input-group .input, .input-group .num { flex: 1; min-width: 0; }

.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 44px; height: 26px; border-radius: 999px; background: var(--track);
  border: 1px solid var(--line-2); position: relative;
  transition: background .2s ease, border-color .2s; flex-shrink: 0;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 999px; background: var(--muted-2);
  transition: transform .22s ease, background .2s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch .lbl { font-size: 13.5px; font-weight: 600; }
.switch .lbl small { display: block; font-weight: 500; font-size: 11px; color: var(--muted-2); margin-top: 1px; }

.slider-row { display: flex; align-items: center; gap: 12px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; height: 5px; border-radius: 999px;
  background: var(--track); flex: 1; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 999px;
  background: var(--thumb); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35); transition: transform .15s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.12); }
.slider-val {
  min-width: 52px; text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 13px; color: var(--muted);
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
}
.badge.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 28%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 28%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.accent { color: var(--accent); border-color: var(--nav-active-border); background: var(--nav-active); }

.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted-2); display: inline-block; flex-shrink: 0; }
.dot.on { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.off { background: var(--bad); }

#toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 11px; min-width: 260px; max-width: 92vw;
  padding: 12px 16px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); backdrop-filter: blur(10px);
  transform: translateY(-14px); opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast .ic { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-size: 14px; flex-shrink: 0; }
.toast.ok .ic { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.toast.err .ic { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.toast.info .ic { background: var(--bg-3); color: var(--text); }
.toast .t { font-size: 13.5px; font-weight: 700; }
.toast .s { font-size: 12px; color: var(--muted); }

.reveal { opacity: 0; transform: translateY(10px); animation: reveal .5s ease forwards; }
.reveal.d1 { animation-delay: .04s; }
.reveal.d2 { animation-delay: .08s; }
.reveal.d3 { animation-delay: .12s; }
.reveal.d4 { animation-delay: .16s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 20px 48px; }
.grid { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.spin {
  width: 16px; height: 16px; border: 2px solid var(--line-2);
  border-top-color: var(--text); border-radius: 999px;
  animation: sp .7s linear infinite; display: inline-block;
}
@keyframes sp { to { transform: rotate(360deg); } }

.hint { font-size: 12px; color: var(--muted-2); margin-top: 10px; line-height: 1.5; }
.hint.mt, .mt { margin-top: 12px; }
.switch.mt { margin-top: 14px; display: flex; }
.field.mt { margin-top: 14px; }
.off-dim { opacity: .42; pointer-events: none; filter: grayscale(.25); transition: opacity .25s; }

.theme-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-btn {
  flex: 1; min-width: 90px; height: 44px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  font-size: 13px; font-weight: 650; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: border-color .15s, background .15s, transform .15s;
}
.theme-btn:hover { transform: translateY(-1px); }
.theme-btn.active {
  border-color: var(--accent);
  background: var(--nav-active);
  box-shadow: 0 0 0 1px var(--nav-active-border);
}
.theme-swatch {
  width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-2);
}
.theme-swatch.black { background: #000; }
.theme-swatch.gray { background: #6b6b73; }
.theme-swatch.white { background: #fff; box-shadow: inset 0 0 0 1px #ccc; }

@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar-right { width: 100%; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .topbar-right::-webkit-scrollbar { display: none; }
  .topbar-right .btn.sm { height: 36px; padding: 0 10px; }
  .userchip { padding: 4px; }
  .userchip .name { display: none; }
  .wrap { padding: 14px 12px calc(28px + env(safe-area-inset-bottom)); }
  .card { padding: 15px; border-radius: 14px; }
  .input-group { flex-wrap: wrap; }
  .input-group .input, .input-group .num { flex: 1 1 140px; }
  .input, .num, select { min-height: 46px; font-size: 16px; }
  .btn { min-height: 44px; }
  .switch { min-height: 42px; }
  input[type=range] { height: 7px; }
  input[type=range]::-webkit-slider-thumb { width: 24px; height: 24px; }
  .toast { width: calc(100vw - 24px); min-width: 0; }
  #toasts { top: calc(10px + env(safe-area-inset-top)); }
}

@media (max-width: 420px) {
  .input-group > .btn { flex: 1 1 100%; }
}
