:root {
  --bg: #0c0a10;
  --bg-secondary: #17131f;
  --bg-tertiary: #1f1a2b;
  --bg-card: #17131f;
  --text: #f2eefc;
  --text-muted: #a297c2;
  --accent: #9b30ff;
  --accent-hover: #7d1fd6;
  --green: #23a55a;
  --red: #f23f42;
  --yellow: #f0b232;
  --border: #322a44;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "gg sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse at top, rgba(155,48,255,.10), transparent 60%);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  background: var(--bg-secondary);
  padding: 20px 12px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background-image: linear-gradient(180deg, rgba(155,48,255,.08), transparent 220px);
}

.sidebar .brand {
  font-weight: 700;
  font-size: 17px;
  padding: 0 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: .02em;
}
.sidebar .brand img { width: 34px; height: 34px; border-radius: 8px; box-shadow: 0 0 14px rgba(155,48,255,.55); }

.sidebar .status-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block;
}
.sidebar .status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.sidebar nav a:hover { background: var(--bg-tertiary); color: var(--text); }
.sidebar nav a.active { background: linear-gradient(135deg, var(--accent), #5c1aa8); color: #fff; }

.main {
  flex: 1;
  padding: 28px 36px;
  max-width: 1100px;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h1 { margin: 0 0 6px; font-size: 24px; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 14px; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card h2, .card h3 { margin-top: 0; }

.stat-card { text-align: left; }
.stat-card .value { font-size: 30px; font-weight: 700; }
.stat-card .label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

form .field { margin-bottom: 16px; }
label { display: block; font-size: 12.5px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; letter-spacing: .02em; }
.hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=color], textarea, select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

input[type=checkbox] { width: 18px; height: 18px; vertical-align: middle; margin-right: 8px; }
.checkbox-row { display: flex; align-items: center; }
.checkbox-row label { margin: 0; text-transform: none; font-weight: 500; font-size: 14px; color: var(--text); }

input[type=color] { padding: 4px; height: 42px; cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--bg-tertiary); border: 1px solid var(--border); }
.btn.secondary:hover { background: #3a3c42; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #c8302f; }
.btn.small { padding: 6px 12px; font-size: 12.5px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert.success { background: rgba(35,165,90,.15); border: 1px solid var(--green); color: #7ee2a8; }
.alert.error { background: rgba(242,63,66,.15); border: 1px solid var(--red); color: #ff9a9c; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 11.5px; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; }
.badge.open { background: rgba(35,165,90,.2); color: #7ee2a8; }
.badge.closed { background: rgba(148,155,164,.2); color: var(--text-muted); }
.badge.ended { background: rgba(148,155,164,.2); color: var(--text-muted); }
.badge.active { background: rgba(240,178,50,.2); color: #f7cd7a; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag {
  background: var(--bg-tertiary); border: 1px solid var(--border); padding: 5px 10px 5px 12px;
  border-radius: 100px; font-size: 12.5px; display: flex; align-items: center; gap: 8px;
}
.tag button { background: none; border: none; color: var(--red); cursor: pointer; font-weight: 700; }

/* ---------- Editor de botões personalizados ---------- */
.cb-row {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.cb-main-row { display: flex; gap: 8px; align-items: center; }
.cb-main-row .cb-label { flex: 2; }
.cb-main-row .cb-style { flex: 1; }
.cb-main-row .cb-action { flex: 2; }
.cb-fields { margin-top: 8px; }
.cb-sub-row { display: flex; gap: 8px; align-items: center; }
.cb-sub-row input, .cb-sub-row select { margin: 0; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.login-card { width: 340px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 32px; box-shadow: 0 0 40px rgba(155,48,255,.12); }
.login-card h1 { font-size: 20px; margin-top: 0; text-align: center; }
.login-card img.login-logo { display: block; margin: 0 auto 16px; width: 72px; height: 72px; border-radius: 14px; box-shadow: 0 0 24px rgba(155,48,255,.6); }

.upload-row { display: flex; align-items: center; gap: 12px; }
.upload-row input[type=file] { flex: 1; font-size: 13px; }
.thumb-preview { max-width: 80px; max-height: 80px; border-radius: 6px; display: none; margin-top: 8px; }

/* ---------- Discord message preview ---------- */
.discord-preview-wrap { background: #313338; border-radius: 10px; padding: 18px; }
.discord-preview-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 10px; font-weight: 700; }

.dc-message { display: flex; gap: 14px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 16px; }
.dc-body { flex: 1; min-width: 0; }
.dc-username { font-weight: 600; font-size: 15px; color: #fff; }
.dc-bot-tag { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: 2px; font-weight: 600; }
.dc-timestamp { color: var(--text-muted); font-size: 11.5px; margin-left: 6px; }
.dc-text { color: #dbdee1; font-size: 14.5px; margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

.dc-embed { border-left: 4px solid #5865f2; background: #2b2d31; border-radius: 4px; padding: 12px 14px; margin-top: 8px; max-width: 480px; display: flex; gap: 14px; }
.dc-embed-content { flex: 1; min-width: 0; }
.dc-embed-title { font-weight: 700; color: #fff; font-size: 15px; margin-bottom: 6px; }
.dc-embed-desc { color: #dbdee1; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.dc-embed-thumb { width: 72px; height: 72px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.dc-embed-image { width: 100%; max-width: 420px; border-radius: 4px; margin-top: 10px; display: block; }
.dc-embed-footer { color: var(--text-muted); font-size: 11.5px; margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.dc-embed-fields { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.dc-embed-field { flex: 1 1 45%; }
.dc-embed-field .fname { font-weight: 700; color: #fff; font-size: 13px; }
.dc-embed-field .fvalue { color: #dbdee1; font-size: 13px; }

.dc-buttons { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dc-btn { padding: 7px 14px; border-radius: 4px; font-size: 13.5px; font-weight: 500; background: #4e5058; color: #fff; }
.dc-btn.primary { background: #5865f2; }
.dc-btn.success { background: #248046; }
.dc-btn.danger { background: #da373c; }
.dc-btn.select { background: #383a40; border: 1px solid #1e1f22; padding: 8px 12px; width: 100%; max-width: 420px; }

.footer-note { color: var(--text-muted); font-size: 12px; margin-top: 30px; text-align: center; }
