:root {
  color-scheme: dark;
  --bg: #1e1f22;
  --panel: #2b2d31;
  --panel-raised: #313338;
  --border: #3f4147;
  --border-strong: #4a4d54;
  --text: #f2f3f5;
  --text-secondary: #c8cad0;
  --muted: #949ba4;
  --accent: #5865f2;
  --accent-hover: #6a76f5;
  --danger: #f23f42;
  --success: #23a55a;
  --warning: #f0b232;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

a { cursor: pointer; }

/* Consistent, on-brand focus ring everywhere -- the browser default still
   works without this (never removed), but doesn't match the dark theme.
   :focus-visible (not :focus) so mouse clicks don't show a ring, only
   keyboard/assistive-tech navigation does. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
}

nav a { color: var(--text); text-decoration: none; margin-left: 1rem; }
nav a:hover { color: var(--accent); }

.container {
  max-width: 640px;
  margin: 3rem auto;
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.container.wide { max-width: 1300px; text-align: left; }

h1 { margin: 0 0 0.5rem; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: white;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { opacity: 0.85; }

.badge-success { color: var(--success); font-weight: 600; }
.badge-fail { color: var(--danger); font-weight: 600; }
.muted { color: var(--muted); }

table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.03em; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* Verification history "Member" cell -- avatar thumbnail plus display name
   (global name) with the username below it. */
.member-cell { display: flex; align-items: center; gap: 0.7rem; }
.member-avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.member-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.95rem; }
.member-meta { min-width: 0; }
.member-name { font-weight: 600; line-height: 1.3; }
.member-username { color: var(--muted); font-size: 0.82rem; line-height: 1.3; }

section { margin-bottom: 2rem; }

.pager { display: flex; gap: 1rem; align-items: center; margin-top: 0.5rem; font-size: 0.85rem; }
.pager a { color: var(--accent); text-decoration: none; }
.pager a:hover { text-decoration: underline; }

.banner {
  background: rgba(242, 63, 66, 0.12);
  border: 1px solid var(--danger);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.filter-form { margin-bottom: 1.5rem; }
.filter-form select { background: var(--panel); color: var(--text); border: 1px solid var(--border); padding: 0.4rem 0.6rem; border-radius: 4px; }

.table-scroll { overflow-x: auto; }
td.mono, th.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; word-break: break-all; }

.panel-layout {
  max-width: 1500px;
  width: 92%;
  margin: 2rem auto;
}

/* ---- Owner panel shell: full-height sidenav + header + content ---- */

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

.owner-sidenav {
  flex: 0 0 250px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.75rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.owner-sidenav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
}
.owner-sidenav-link svg { flex-shrink: 0; opacity: 0.75; }
.owner-sidenav-link:hover { background: rgba(88, 101, 242, 0.12); }
.owner-sidenav-link.active { background: var(--accent); color: white; font-weight: 600; }
.owner-sidenav-link.active svg { opacity: 1; }

.owner-sidenav-group { margin-top: 0.75rem; }
.owner-sidenav-group summary {
  cursor: pointer;
  list-style: none;
  padding: 0.4rem 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.owner-sidenav-group summary::-webkit-details-marker { display: none; }
.owner-sidenav-group[open] summary::before { content: '\25be\0020'; }
.owner-sidenav-group:not([open]) summary::before { content: '\25b8\0020'; }

.owner-sidenav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem;
  cursor: pointer;
  align-items: center;
}

.owner-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.owner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}
.owner-header-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.owner-header-title { margin: 0; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-header-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

.owner-guild-form select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.owner-profile { position: relative; }
.owner-profile summary {
  cursor: pointer;
  list-style: none;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.owner-profile summary::-webkit-details-marker { display: none; }
.owner-profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  min-width: 140px;
  overflow: hidden;
  z-index: 10;
}
.owner-profile-menu a {
  display: block;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}
.owner-profile-menu a:hover { background: rgba(88, 101, 242, 0.12); }

.owner-content {
  flex: 1;
  min-width: 0;
  padding: 1.75rem 2.25rem;
}

@media (max-width: 900px) {
  .owner-sidenav-toggle { display: inline-flex; }
  .owner-sidenav {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.4);
  }
  .owner-sidenav.open { transform: translateX(0); }
  .owner-header-title { display: none; }
  .owner-content { padding: 1.25rem 1rem; }
}

.panel-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 2.5rem;
}
.panel-content > p.muted:first-of-type { margin-top: -0.25rem; margin-bottom: 1.75rem; font-size: 0.95rem; max-width: 62ch; }

/* Every settings page's <section> becomes a distinct, scannable card
   instead of running together as one continuous wall of forms -- reuses
   the same background-on-panel treatment already proven by .plugin-card.
   Descendant (not direct-child) selector: some pages need every field in
   one combined <form> (single Save button for the whole page), which
   means the sections sit one level deeper, inside that form. There's no
   genuine nested-section-inside-a-section case in this app -- that's
   what .settings-subsection below is for instead. */
.panel-content section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}
.panel-content section:last-child { margin-bottom: 0; }
/* Pages that collect every field into one <form> with a single Save button
   (ban-reports, tickets-flow) place the button outside the card sections,
   so without spacing it would sit flush against the next card below. */
.panel-content form > .btn { margin-bottom: 1.5rem; }
.panel-content section > h2:first-child,
.panel-content section > h2:first-of-type {
  margin: 0 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel-content section > p.muted:first-of-type { margin-top: 0; margin-bottom: 1.25rem; max-width: 68ch; }

/* A visually lighter divider for a sub-group *within* an already-carded
   section (e.g. logging's per-event-type breakdown under a group toggle)
   -- was ad-hoc inline styles per instance before, now a real class. */
.settings-subsection {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.server-selector { margin-bottom: 1.5rem; }
.server-selector .filter-form { margin-bottom: 0; }

.form-group { margin-bottom: 1.5rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; }
.form-group .hint { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.35rem; line-height: 1.5; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease;
}
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--border-strong); }
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible { border-color: var(--accent); outline-offset: 0; }
.form-group select[multiple] { min-height: 8rem; }
.form-group input[type="range"] { width: 100%; }
.form-group input[type="color"] { width: 3rem; height: 2.1rem; padding: 0; border: none; background: none; }

/* ---- Multi-select (dropdown + checkmarks + removable tags) ---- */

.multi-select { position: relative; }
.multi-select-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.multi-select-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.3rem 0.2rem 0.7rem;
  font-size: 0.82rem;
  color: var(--text);
  max-width: 100%;
}
.multi-select-tag > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-select-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.multi-select-tag-remove:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.multi-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.multi-select-trigger:hover { border-color: var(--border-strong); }
.multi-select-trigger:focus-visible { border-color: var(--accent); outline-offset: 0; }
.multi-select-trigger-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-select.has-value .multi-select-trigger-label { color: var(--text); }
.multi-select-caret { color: var(--muted); font-size: 0.75rem; flex-shrink: 0; transition: transform 0.15s ease; }
.multi-select.open .multi-select-caret { transform: rotate(180deg); }
.multi-select-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: 18rem;
  overflow-y: auto;
  display: none;
  padding: 0.35rem;
}
.multi-select.open .multi-select-menu { display: block; }
.multi-select-search {
  display: block;
  padding: 0.35rem 0.35rem 0.5rem;
  position: sticky;
  top: 0;
  background: var(--panel-raised);
}
.multi-select-search input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
}
.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
}
.multi-select-option:hover { background: rgba(88, 101, 242, 0.12); }
.multi-select-option input[type="checkbox"] { accent-color: var(--accent); flex-shrink: 0; }
.multi-select-option span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.multi-select-option:has(input:checked) { background: rgba(88, 101, 242, 0.08); }
.multi-select-empty { padding: 0.6rem; color: var(--muted); font-size: 0.85rem; text-align: center; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.toggle-row:last-child { margin-bottom: 0; }
.toggle-row label { font-weight: 600; margin: 0; font-size: 0.9rem; }
.toggle-row span:not(.pill-knob) { font-size: 0.9rem; }

/* A set of mutually-exclusive radio options, styled as selectable rows
   (was ad-hoc inline font-weight overrides on bare <label>+<input> pairs
   before -- same idea as .toggle-row but for a group with more than two
   states). */
.radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.radio-option:hover { border-color: var(--border-strong); }
.radio-option input[type="radio"] { margin-top: 0.2rem; accent-color: var(--accent); flex-shrink: 0; }
.radio-option:has(input:checked) { border-color: var(--accent); background: rgba(88, 101, 242, 0.08); }
.radio-option-label { font-weight: 600; font-size: 0.9rem; display: block; }
.radio-option-desc { color: var(--muted); font-size: 0.8rem; display: block; margin-top: 0.1rem; }

.flash-success { background: rgba(35, 165, 90, 0.15); border: 1px solid var(--success); color: var(--text); padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1.25rem; }
.flash-error { background: rgba(242, 63, 66, 0.12); border: 1px solid var(--danger); color: var(--text); padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1.25rem; }

.embed-preview {
  border-left: 4px solid var(--accent);
  background: #2b2d31;
  border-radius: 0 6px 6px 0;
  padding: 0.75rem 1rem;
  max-width: 420px;
  margin-top: 1rem;
}
.embed-preview .embed-title { font-weight: 700; margin-bottom: 0.25rem; }
.embed-preview .embed-desc { font-size: 0.9rem; white-space: pre-wrap; }
.embed-preview img { max-width: 100%; border-radius: 4px; margin-top: 0.5rem; }
.embed-preview .embed-footer { color: var(--muted); font-size: 0.75rem; margin-top: 0.5rem; }

.plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.plugin-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.plugin-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.plugin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.plugin-card-header h3 { margin: 0; font-size: 1.05rem; }
.plugin-card p { margin: 0; flex: 1; font-size: 0.87rem; color: var(--text-secondary); line-height: 1.55; }
.plugin-card .btn { align-self: flex-start; padding: 0.45rem 1.1rem; font-size: 0.85rem; }

.pill-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.pill-toggle.on { background: var(--accent); }
.pill-toggle.off { background: #4a4d54; }
.pill-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: left 0.15s ease;
}
.pill-toggle.on .pill-knob { left: 21px; }

.tags-reference {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.tags-reference h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.tags-reference table { margin-top: 0.5rem; }
.tags-reference td { padding: 0.3rem 0.75rem 0.3rem 0; border-bottom: none; font-size: 0.85rem; }
.tags-reference td:first-child { white-space: nowrap; color: var(--accent); }


/* ---- Owner panel: table search/sort, section headers ---- */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-header h2 { margin-bottom: 0; }

.table-search {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  min-width: 220px;
}

table.data-table th[data-sort-col] { cursor: pointer; user-select: none; }
table.data-table th[data-sort-col]:hover { color: var(--text); }
table.data-table th[data-sort-col]::after { content: '\0020\21c5'; opacity: 0.35; font-size: 0.7rem; }
table.data-table th[data-sort-dir="asc"]::after { content: '\0020\2191'; opacity: 1; color: var(--accent); }
table.data-table th[data-sort-dir="desc"]::after { content: '\0020\2193'; opacity: 1; color: var(--accent); }

.hint { color: var(--muted); font-size: 0.78rem; margin-top: 0.5rem; }

/* ---- Owner panel: analytics dashboard cards + charts ---- */

.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.analytics-toolbar select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-card .stat-label { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.analytics-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.analytics-card h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.analytics-card .analytics-card-note { color: var(--muted); font-size: 0.78rem; margin-bottom: 0.75rem; }
.analytics-card canvas { max-height: 260px; }
.analytics-card.unavailable {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 140px;
  opacity: 0.7;
  border-style: dashed;
}

.analytics-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 2rem 0 0.75rem;
}
.analytics-section-title:first-child { margin-top: 0; }

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover { opacity: 1; border-color: var(--accent); }

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #ff5c5f; }
.btn.small { padding: 0.35rem 0.85rem; font-size: 0.8rem; }

/* Native <dialog> for the "add bot to this server" confirm popup --
   browser default styling is plain white, clashes with the dark theme. */
.panel-dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  max-width: 380px;
  width: 90%;
}
.panel-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.panel-dialog h3 { margin-top: 0; }
.panel-dialog-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ---- Customer panel header: present on every /panel page, not just
   the dashboard, so the guild switcher actually works mid-workflow. ---- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.panel-header-left { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.panel-header-logo { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.panel-header-logo:hover { color: var(--accent); }
.panel-header-actions { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.panel-header-actions > a { color: var(--text-secondary); text-decoration: none; font-size: 0.88rem; font-weight: 500; }
.panel-header-actions > a:hover { color: var(--accent); }
.panel-guild-form select {
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}

/* ---- Tickets: flow cards, forms, embed builder, transcripts ---- */
.section-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-actions h2 { margin: 0; }

.plugin-card-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.plugin-card-actions form { margin: 0; }

/* ---- Ban Reports: report status pills ---- */
.status-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.status-pill.pending { background: rgba(240, 178, 50, 0.15); color: #f0b232; }
.status-pill.approved { background: rgba(35, 165, 90, 0.15); color: #23a55a; }
.status-pill.denied { background: rgba(242, 63, 66, 0.15); color: #f23f42; }
.status-pill.needinfo { background: rgba(88, 101, 242, 0.15); color: #5865f2; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 1rem;
}

.embed-builder {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.embed-builder h2 { margin-top: 0; }
.embed-builder h3 { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; }
.embed-builder .embed-preview { max-width: 480px; }

.embed-preview .embed-author {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.embed-preview .embed-author-icon,
.embed-preview .embed-footer-icon { width: 20px; height: 20px; border-radius: 50%; margin: 0 !important; flex-shrink: 0; }
.embed-preview .embed-field {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.embed-preview .embed-field-name {
  display: block;
  font-weight: 700;
  color: var(--text);
}
.embed-preview .embed-field-value {
  display: block;
  color: var(--text-secondary);
  white-space: pre-wrap;
}
.embed-preview .embed-thumb {
  float: right;
  max-width: 80px;
  max-height: 80px;
  margin-left: 0.75rem;
}
.embed-preview .embed-image { margin-top: 0.75rem; }
.embed-preview .embed-footer { display: flex; align-items: center; gap: 0.4rem; }
.embed-preview .embed-footer-icon { margin-right: 0.25rem; }

/* ---- Tickets: transcripts ---- */
.transcript-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

.transcript {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  max-width: 760px;
}

.transcript-message {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.transcript-message:last-child { border-bottom: none; }
.transcript-message.deleted { opacity: 0.55; }

.transcript-message-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}
.transcript-message-author { font-weight: 700; color: var(--accent); }
.transcript-deleted-badge {
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}
.transcript-message-content { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; }
.transcript-attachments { margin-top: 0.3rem; font-size: 0.85rem; }
.transcript-attachments a { display: inline-block; margin-right: 0.75rem; }

.transcript-embed {
  background: #2b2d31;
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 0.6rem 0.9rem;
  margin-top: 0.5rem;
  max-width: 420px;
  font-size: 0.85rem;
}
.transcript-embed-author { color: var(--text-secondary); margin-bottom: 0.15rem; }
.transcript-embed-title { font-weight: 700; margin-bottom: 0.15rem; }
.transcript-embed-desc { white-space: pre-wrap; color: var(--text-secondary); }
.transcript-embed-field { margin-top: 0.4rem; }
.transcript-embed-field-name { display: block; font-weight: 700; }
.transcript-embed-field-value { white-space: pre-wrap; color: var(--text-secondary); }

.notice-banner {
  background: rgba(240, 178, 50, 0.12);
  border: 1px solid var(--warning, #f0b232);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Ticket action buttons: transcript list rows and the single-transcript
   action bar (web-panel close/lock/delete/etc). Forms sit inline so the
   buttons read as one button group. */
.ticket-actions form { display: inline-block; margin-right: 0.4rem; }
.ticket-actions form:last-child { margin-right: 0; }

.ticket-action-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.6rem 1rem;
  background: rgba(88, 101, 242, 0.06);
  border: 1px solid var(--accent);
  border-radius: 6px;
}
.ticket-action-bar form { display: inline-block; }

