/* ==========================================================================
   ModPanel — main stylesheet
   Covers: layout, components, badges, tags, toggles, custom dropdown, responsive
   ========================================================================== */

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

:root {
  --bg:       #0d0f13;
  --surface:  #13161c;
  --surface2: #1a1d26;   /* slightly lighter — inputs, dropdowns */
  --border:   #1f2330;
  --accent:   #e85d2e;
  --accent2:  #f0a500;
  --text:     #e8eaf0;
  --muted:    #5a5f72;
  --ban:      #e85d2e;
  --purgeban: #9b2cf0;
  --green:    #2ecc71;
  --radius:   6px;
  --mono:     'Space Mono', monospace;
  --sans:     'DM Sans', sans-serif;
  --nav-w:    220px;
}

/* Body hidden until /api/me resolves — prevents flash-of-dashboard. */
body {
  visibility: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: auto 1fr;
}

/* ── Language switcher ──────────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: .3rem;
  align-items: center;
  margin-right: .6rem;
}
.lang-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .65rem;
  padding: .12rem .4rem;
  cursor: pointer;
  letter-spacing: .05em;
  transition: border-color .15s, color .15s;
}
.lang-btn:hover   { border-color: var(--accent); color: var(--text); }
.lang-btn--active { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: .85rem;
}

/* Hamburger — hidden on desktop, shown on tablet/mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: .32rem .4rem;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  transition: background .15s;
}
.nav-toggle:hover span { background: var(--text); }

header .logo {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
header .logo span { color: var(--text); }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}
.status-label {
  font-size: .75rem;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.header-spacer { flex: 1; }

.user-info { display: flex; align-items: center; gap: .65rem; }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}
.user-name {
  font-size: .82rem;
  font-family: var(--mono);
  color: var(--text);
  white-space: nowrap;
}
.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: .3rem .7rem;
  font-size: .72rem;
  font-family: var(--mono);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
}
.logout-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Mobile nav overlay (backdrop behind open drawer) ───────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 95;
}
.nav-overlay.open { display: block; }

/* ── Sidebar / nav ──────────────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem 1.4rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
  cursor: pointer;
}
nav a.active, nav a:hover {
  color: var(--text);
  background: rgba(232,93,46,.07);
  border-left-color: var(--accent);
}
nav .section-label {
  padding: 1rem 1.4rem .3rem;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-family: var(--mono);
}

/* ── Main content ───────────────────────────────────────────────────────── */
main {
  padding: 2rem;
  overflow-y: auto;
  min-width: 0; /* prevents grid blowout */
}

.page        { display: none; }
.page.active { display: block; }

h1        { font-size: 1.4rem; font-weight: 600; margin-bottom: .25rem; }
.subtitle { color: var(--muted); font-size: .85rem; margin-bottom: 2rem; }

/* ── Stats grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.ban::before   { background: var(--ban); }
.stat-card.purge::before { background: var(--purgeban); }
.stat-card.total::before { background: var(--accent2); }
.stat-card.msgs::before  { background: var(--muted); }
.stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-family: var(--mono);
  margin-bottom: .5rem;
}
.stat-value { font-size: 2rem; font-weight: 700; font-family: var(--mono); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
/* Allow wide tables to scroll horizontally on narrow screens */
.table-wrap > table { display: block; overflow-x: auto; }

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
  flex-wrap: wrap;
}
.table-head h2 { font-size: .9rem; font-weight: 600; }
.filter-row    { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: .3rem .75rem;
  font-size: .75rem;
  font-family: var(--mono);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.filter-btn.active, .filter-btn:hover { border-color: var(--accent); color: var(--text); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-family: var(--mono);
  padding: .75rem 1.4rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: .85rem 1.4rem;
  font-size: .84rem;
  border-bottom: 1px solid rgba(31,35,48,.6);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td      { background: rgba(255,255,255,.02); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 3px;
  font-size: .68rem;
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}
.badge.ban           { background: rgba(232,93,46,.15);  color: var(--ban);      border: 1px solid rgba(232,93,46,.3);   }
.badge.purgeban      { background: rgba(155,44,240,.15); color: var(--purgeban); border: 1px solid rgba(155,44,240,.3);  }
.badge.purgeban_count{ background: rgba(106,13,173,.18); color: #b06ef5;         border: 1px solid rgba(106,13,173,.35); }
.badge.ban_channel   { background: rgba(232,93,46,.10);  color: #f07050;         border: 1px solid rgba(232,93,46,.25);  }
.badge.report        { background: rgba(231,76,60,.15);  color: #e74c3c;         border: 1px solid rgba(231,76,60,.3);   }
.badge.kick          { background: rgba(240,165,0,.15);  color: #f0a500;         border: 1px solid rgba(240,165,0,.3);   }
.badge.purgekick     { background: rgba(240,197,0,.15);  color: #f0c500;         border: 1px solid rgba(240,197,0,.3);   }
.badge.timeout       { background: rgba(52,152,219,.15); color: #3498db;         border: 1px solid rgba(52,152,219,.3);  }
.badge.unban         { background: rgba(46,204,113,.15); color: #2ecc71;         border: 1px solid rgba(46,204,113,.3);  }
.badge.untimeout     { background: rgba(26,188,156,.15); color: #1abc9c;         border: 1px solid rgba(26,188,156,.3);  }

/* ── Tags ───────────────────────────────────────────────────────────────── */
/* Base tag style + modifiers. JS emits class="tag tag-role" etc. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(232,93,46,.1);
  border: 1px solid rgba(232,93,46,.25);
  border-radius: 4px;
  padding: .2rem .6rem;
  font-size: .78rem;
  font-family: var(--mono);
}
.tag.tag-role    { background: rgba(88,101,242,.12); border-color: rgba(88,101,242,.3);  color: #8891f0; }
.tag.tag-user    { background: rgba(46,204,113,.1);  border-color: rgba(46,204,113,.3);  color: #2ecc71; }
.tag.tag-channel { background: rgba(240,165,0,.1);   border-color: rgba(240,165,0,.3);   color: #f0a500; }

/* ── Toggle switch — commands & admin feature flags ─────────────────────── */
/* HTML uses class="switch" + class="slider" (not .toggle-switch/.toggle-slider) */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + .slider           { background: var(--accent); }
.switch input:checked + .slider::before  { transform: translateX(16px); }

/* ── Commands page ──────────────────────────────────────────────────────── */
.cmd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.cmd-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
}
.cmd-header:hover { background: rgba(255,255,255,.02); }
.cmd-name   { font-family: var(--mono); font-size: .95rem; font-weight: 700; color: var(--accent2); }
.cmd-desc   { font-size: .82rem; color: var(--muted); flex: 1; min-width: 0; }
.cmd-toggle { flex-shrink: 0; }
.cmd-body   { padding: 1.25rem 1.4rem; }

/* ── Settings page ──────────────────────────────────────────────────────── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.settings-card h2  { font-size: .9rem; font-weight: 600; margin-bottom: .3rem; }
.settings-card > p { font-size: .82rem; color: var(--muted); margin-bottom: 1.25rem; line-height: 1.6; }
.settings-row      { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.settings-input {
  flex: 1;
  min-width: 160px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: .55rem 1rem;
  font-family: var(--mono);
  font-size: .85rem;
  outline: none;
  transition: border-color .15s;
}
.settings-input:focus { border-color: var(--accent); }
.save-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .55rem 1.25rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .82rem;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity .15s;
}
.save-btn:hover    { opacity: .85; }
.save-btn:disabled { opacity: .4; cursor: default; }

/* Delete log-entry button */
.del-btn {
  background: transparent;
  border: 1px solid #e74c3c;
  color: #e74c3c;
  padding: .25rem .6rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .72rem;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.del-btn:hover { background: rgba(231,76,60,.15); }
.del-btn:disabled { opacity: .35; cursor: default; }

/* Log-table pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .75rem;
  font-family: var(--mono);
  font-size: .78rem;
}
.pagination button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .3rem .8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: .78rem;
  transition: border-color .15s;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); }
.pagination button:disabled { opacity: .35; cursor: default; }
.pagination .page-info { color: var(--muted); }
.settings-feedback {
  font-size: .78rem;
  font-family: var(--mono);
  margin-top: .5rem;
  min-height: 1rem;
}
.current-val {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  margin-top: .4rem;
}
.current-val span { color: var(--accent2); }

/* ── Misc helpers ───────────────────────────────────────────────────────── */
.mono { font-family: var(--mono); font-size: .78rem; color: var(--muted); }

.empty-state      { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: .75rem; }

.refresh-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  font-size: .8rem;
  font-family: var(--mono);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}
.refresh-btn:hover { opacity: .85; }

/* ── Custom role-picker dropdown (.arp-*) ───────────────────────────────── */
/* Replaces native <select> which cannot be dark-themed when opened.         */
.arp-wrapper { position: relative; display: inline-block; }
.arp-trigger {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: .2rem .5rem .2rem .45rem;
  cursor: pointer;
  font-size: .75rem;
  min-width: 160px;
  user-select: none;
  font-family: inherit;
}
.arp-trigger:hover { border-color: var(--accent); }
.arp-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.arp-arrow { font-size: .55rem; color: var(--muted); flex-shrink: 0; }
.arp-drop {
  display: none;
  position: absolute;
  top: calc(100% + 3px); left: 0;
  min-width: 200px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,.55);
}
.arp-option {
  padding: .35rem .55rem;
  font-size: .75rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.arp-option:hover { background: var(--accent); color: #fff; }

/* ==========================================================================
   Embed Builder (.eb-*) + Discord preview (.de-*)
   ========================================================================== */

/* ── Embed list toolbar & channel groups (.el-*) ───────────────────────── */
.eb-page-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}
.eb-new-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--accent);
  border: none;
  color: #fff;
  padding: .55rem 1.25rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.eb-new-btn:hover { opacity: .85; }

.eb-editor-toolbar {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.eb-back-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .4rem .85rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .75rem;
  cursor: pointer;
  transition: border-color .15s;
  white-space: nowrap;
}
.eb-back-btn:hover { border-color: var(--accent); }
.eb-editor-title-text {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--muted);
}

.el-channel-group { margin-bottom: 1.5rem; }
.el-channel-header {
  font-family: var(--mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: .3rem .5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .5rem;
}
.el-embed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.el-embed-preview {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 0;
}
.el-color-swatch {
  width: 6px;
  height: 38px;
  border-radius: 3px;
  flex-shrink: 0;
}
.el-embed-info { min-width: 0; }
.el-embed-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.el-embed-meta {
  font-size: .72rem;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: .15rem;
}
.el-embed-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.el-btn {
  padding: .3rem .75rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .72rem;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all .15s;
  white-space: nowrap;
  background: var(--surface2);
  color: var(--text);
}
.el-btn-edit:hover   { border-color: var(--accent); color: var(--accent); }
.el-btn-delete {
  background: rgba(231,76,60,.08);
  color: #e74c3c;
  border-color: rgba(231,76,60,.25);
}
.el-btn-delete:hover { background: rgba(231,76,60,.2); }
.el-no-access {
  font-size: .72rem;
  color: var(--muted);
  font-family: var(--mono);
  font-style: italic;
}
.el-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .85rem;
}

/* Post-row within the editor: edit vs. repost buttons */
.eb-post-row { margin-top: .5rem; }

/* ── Page layout: editor left, preview right ────────────────────────────── */
.eb-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.eb-preview {
  position: sticky;
  top: calc(56px + 1.5rem); /* header height + main padding */
}

/* ── Editor cards ───────────────────────────────────────────────────────── */
.eb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.eb-card h3 {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-family: var(--mono);
  margin-bottom: .85rem;
}
.eb-row { margin-bottom: .7rem; }
.eb-row:last-child { margin-bottom: 0; }

.eb-label {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: .25rem;
}
.eb-input,
.eb-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: .45rem .8rem;
  font-family: var(--sans);
  font-size: .84rem;
  outline: none;
  transition: border-color .15s;
}
.eb-input:focus,
.eb-textarea:focus { border-color: var(--accent); }
.eb-textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}

/* Color picker row */
.eb-color-row { display: flex; align-items: center; gap: .65rem; }
.eb-color-input {
  width: 44px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}
.eb-color-hex { flex: 1; }

/* Field cards */
.eb-field {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .7rem .85rem;
  margin-bottom: .5rem;
}
.eb-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .4rem;
}
.eb-field-label {
  font-size: .68rem;
  color: var(--muted);
  font-family: var(--mono);
}
.eb-remove-field {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .85rem;
  padding: 0;
  line-height: 1;
}
.eb-remove-field:hover { color: #e74c3c; }

.eb-inline-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .4rem;
  font-size: .78rem;
  color: var(--muted);
  cursor: pointer;
}
.eb-add-field-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  background: var(--surface2);
  border: 1px dashed var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: .45rem .9rem;
  font-size: .78rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  margin-top: .25rem;
}
.eb-add-field-btn:hover { border-color: var(--accent); color: var(--text); }

/* Action buttons row */
.eb-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.eb-save-btn {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .6rem 1rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .78rem;
  cursor: pointer;
  transition: border-color .15s;
  white-space: nowrap;
}
.eb-save-btn:hover { border-color: var(--accent); }
.eb-post-btn {
  flex: 1;
  background: var(--accent);
  border: none;
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.eb-post-btn:hover { opacity: .85; }
.eb-post-btn:disabled,
.eb-save-btn:disabled { opacity: .4; cursor: default; }
.eb-feedback {
  font-family: var(--mono);
  font-size: .78rem;
  margin-top: .5rem;
  min-height: 1rem;
}

/* ── Discord preview window ─────────────────────────────────────────────── */
.de-window {
  background: #313338;
  border-radius: 8px;
  padding: 1rem 1.1rem;
}
.de-preview-label {
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #72767d;
  font-family: var(--mono);
  margin-bottom: .7rem;
}
/* Embed container — left accent border, dark body */
.de-embed {
  background: #2b2d31;
  border-radius: 4px;
  border-left: 4px solid #5865f2;
  padding: .75rem 1rem .75rem .85rem;
  max-width: 520px;
}
/* Two-column grid: content | thumbnail, then image full-width, then footer */
.de-grid {
  display: grid;
  grid-template-areas:
    "content thumb"
    "image   image"
    "footer  footer";
  grid-template-columns: 1fr auto;
  gap: .4rem .6rem;
  align-items: start;
}
.de-content     { grid-area: content; min-width: 0; }
.de-thumb       { grid-area: thumb; }
.de-image-area  { grid-area: image; }
.de-footer-area { grid-area: footer; }

.de-author {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .35rem;
}
.de-author-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.de-author-name {
  font-size: .78rem;
  font-weight: 600;
  color: #e0e1e5;
  text-decoration: none;
}
.de-author-name:hover { text-decoration: underline; }

.de-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #00b0f4;
  margin-bottom: .3rem;
  word-break: break-word;
  text-decoration: none;
}
.de-title:hover           { text-decoration: underline; }
.de-title.de-title-nourl  { color: #e0e1e5; cursor: default; }
.de-title.de-title-nourl:hover { text-decoration: none; }

.de-desc {
  font-size: .875rem;
  color: #dbdee1;
  line-height: 1.375;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: .3rem;
}
.de-thumb img {
  width: 80px; height: 80px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}
.de-image-area img {
  max-width: 100%;
  border-radius: 4px;
  margin-top: .2rem;
  display: block;
}

.de-fields      { display: flex; flex-wrap: wrap; gap: .3rem .5rem; margin: .35rem 0 .1rem; }
.de-field       { flex: 1 1 30%; min-width: 0; }
.de-field.de-fw { flex: 1 1 100%; }
.de-field-name  { font-size: .78rem; font-weight: 700; color: #e0e1e5; margin-bottom: .1rem; word-break: break-word; }
.de-field-value { font-size: .78rem; color: #dbdee1; white-space: pre-wrap; word-break: break-word; }

.de-footer {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: .35rem;
}
.de-footer-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.de-footer-text { font-size: .72rem; color: #a3a6aa; }
.de-footer-sep  { font-size: .72rem; color: #a3a6aa; }
.de-empty {
  text-align: center;
  padding: 1.5rem 0;
  color: #72767d;
  font-size: .82rem;
  font-family: var(--mono);
}

/* ── Page sub-tabs ──────────────────────────────────────────────────────── */
.page-tabs {
  display: flex;
  gap: .1rem;
  border-bottom: 1px solid var(--border);
  margin: 1rem 0 1.5rem;
  flex-wrap: wrap;
}
.page-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: .85rem;
  padding: .5rem 1rem;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
  white-space: nowrap;
}
.page-tab:hover  { color: var(--text); }
.page-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Tab content panels — only the .active one is rendered */
.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* ==========================================================================
   Log Embeds customisation page
   ========================================================================== */

/* Two-column layout: editor on the left, stacked previews on the right */
.le-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.le-editor-col,
.le-preview-col { display: flex; flex-direction: column; gap: 1rem; }

/* Section heading inside the editor card */
.le-section-label {
  font-size: .75rem;
  color: var(--muted);
  letter-spacing: .1em;
  font-family: var(--mono);
  text-transform: uppercase;
  margin: 0 0 1rem;
}

/* Field labels */
.le-label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: .8rem 0 .3rem;
}

/* Inputs and textareas */
.le-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .4rem .6rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: .82rem;
  box-sizing: border-box;
}
.le-textarea { resize: vertical; }

/* Color picker row */
.le-color-row { display: flex; gap: .5rem; align-items: center; }
.le-color-row input[type="color"] {
  width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 6px;
  background: none; cursor: pointer; padding: 0;
}
.le-color-text { flex: 1; }

/* Checkbox rows */
.le-checkrow { margin: .5rem 0; font-size: .83rem; color: var(--text); }
.le-checkrow label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }

/* Dynamic fields */
.le-fields-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: .8rem 0 .5rem;
}
.le-fields-list { display: flex; flex-direction: column; gap: .5rem; }
.le-field-row {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem .7rem;
  position: relative;
}
.le-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.le-field-del {
  position: absolute; top: .45rem; right: .5rem;
  background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: .95rem; padding: 0;
}
.le-field-del:hover { color: #e74c3c; }
.le-field-check {
  display: flex; align-items: center; gap: .4rem;
  margin-top: .5rem; font-size: .8rem; color: var(--muted);
  cursor: pointer;
}

/* Available variables reference box */
.le-vars-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .7rem;
  margin: .9rem 0 .3rem;
}
.le-vars-title {
  font-size: .72rem; color: var(--muted);
  font-family: var(--mono); text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: .35rem;
}
.le-vars-text {
  font-size: .77rem; color: var(--accent);
  font-family: var(--mono); white-space: pre-wrap;
  word-break: break-all;
}

/* Action buttons row */
.le-actions { display: flex; gap: .7rem; margin-top: 1rem; flex-wrap: wrap; }
.le-reset-btn { background: var(--surface2) !important; color: var(--muted) !important; }
.le-reset-btn:hover { color: var(--text) !important; }

/* ── Confirmation Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.modal-overlay.is-open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
}
.modal-title {
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .55rem;
}
.modal-body {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; }
.modal-cancel-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .42rem 1rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .78rem;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.modal-cancel-btn:hover { color: var(--text); border-color: var(--accent); }
.modal-confirm-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: .42rem 1.1rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.modal-confirm-btn:hover { opacity: .85; }

/* Admin panel — group category header */
.admin-group-header {
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 1.1rem 0 .35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .5rem;
}

/* Status badge */
.le-status-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .75rem; }
.le-status-badge {
  font-size: .72rem; font-family: var(--mono);
  padding: .2rem .65rem; border-radius: 4px;
  background: var(--surface2); color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .08em;
}
.le-status-badge.custom {
  background: rgba(52,152,219,.12);
  color: #3498db; border-color: #3498db;
}

/* Preview containers */
.le-preview-box { min-height: 60px; }

/* Discord-style embed mockup */
.le-embed {
  border-radius: 4px;
  border-left: 4px solid #7289da;
  background: rgba(0,0,0,.15);
  padding: .75rem 1rem;
  font-size: .82rem;
  overflow: hidden;
}
.le-embed-title  { font-weight: 700; color: var(--text); margin-bottom: .3rem; }
.le-embed-desc   { color: var(--muted); margin-bottom: .4rem; white-space: pre-wrap; }
.le-embed-fields { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.le-embed-field  { flex: 0 0 calc(50% - .2rem); min-width: 0; }
.le-embed-field.full { flex: 0 0 100%; }
.le-embed-field-name  { font-size: .73rem; font-weight: 600; color: var(--text); margin-bottom: .1rem; }
.le-embed-field-value { font-size: .77rem; color: var(--muted); }
.le-embed-footer { font-size: .71rem; color: var(--muted); margin-top: .5rem; padding-top: .4rem; border-top: 1px solid var(--border); }
.le-embed-thumb  {
  float: right; width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border);
  margin: 0 0 .4rem .7rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 1.3rem;
}

/* ==========================================================================
   Responsive
   900px  — tablet: sidebar becomes a slide-in drawer, hamburger appears
   600px  — mobile: tighter spacing, 2-column stats, collapsible header items
   ========================================================================== */

/* ── Tablet and below (≤ 900 px) ────────────────────────────────────────── */
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }

  /* Embed builder: stack editor above preview */
  .eb-layout  { grid-template-columns: 1fr; }
  .eb-preview { position: static; }

  /* Log Embeds: stack editor above previews on tablet/mobile */
  .le-layout { grid-template-columns: 1fr; }

  /* Show hamburger toggle */
  .nav-toggle { display: flex; }

  /* Nav becomes a fixed left drawer, slides in on .open */
  nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 99;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid var(--border);
    /* override grid-row stacking */
    grid-row: unset;
  }
  nav.open { transform: translateX(0); }

  main { padding: 1.5rem; }
}

/* ── Mobile (≤ 600 px) ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 0 .85rem; gap: .55rem; }
  header .logo { font-size: .9rem; }

  /* Reduce header clutter */
  .status-label { display: none; }
  .user-name    { display: none; }
  .lang-switcher { margin-right: 0; }

  main { padding: .9rem; }

  h1        { font-size: 1.15rem; }
  .subtitle { margin-bottom: 1.25rem; }

  /* 2-column stat cards on phone */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin-bottom: 1.5rem;
  }
  .stat-card  { padding: .9rem 1rem; }
  .stat-value { font-size: 1.55rem; }

  /* Table header stacks vertically */
  .table-head { padding: .75rem 1rem; flex-direction: column; align-items: flex-start; }
  th, td      { padding: .6rem .85rem; }

  /* Settings cards */
  .settings-card { padding: 1rem 1.1rem; }
  .settings-input { min-width: 0; }

  /* Commands */
  .cmd-header { flex-wrap: wrap; gap: .5rem; }
  .cmd-body   { padding: 1rem; }
}
