:root {
  --bg: #001020;
  --bg-elevated: #071b30;
  --bg-elevated-2: #0d2740;
  --bg-input: #051526;
  --border: #123049;
  --border-bright: #1c4a6b;
  --text: #bcdcec;
  --text-muted: #6d90a6;
  --text-bright: #eaf8ff;
  --accent: #a8e6ff;
  --accent-2: #145a8c;
  --accent-hover: #6fd0f5;
  --gradient: linear-gradient(135deg, #a8e6ff, #145a8c 55%, #001020);
  --danger: #ed4245;
  --danger-hover: #c53537;
  --success: #23a55a;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .5);
  --shadow-glow: 0 0 0 1px rgba(168, 230, 255, .25), 0 8px 24px rgba(168, 230, 255, .12);
  /* Used for anything that reads as data rather than prose -- IDs, counters,
     timestamps, the ping number -- same thread the marketing site uses, so
     the product actually looks like the thing it's advertising. */
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* A faint fixed grid instead of two soft radial blobs -- ties to the
     marketing site's backdrop and reads as "console," not "generic SaaS
     gradient." Low enough alpha to stay out of the way of dense card
     content while scrolling. */
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: #6fb8ff; text-decoration: none; transition: color .15s ease; }
a:hover { color: #8fc8ff; text-decoration: none; }

::selection { background: rgba(168, 230, 255, .35); }

.brand { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand:hover .brand-word { color: var(--accent); }
.brand-word {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--text-bright);
  transition: color .15s ease;
}

.brand-mark { display: inline-block; width: 28px; height: 28px; flex-shrink: 0; }

.modsentry-intro-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 16, 32, .92);
  padding: 24px;
}
.modsentry-intro-box {
  width: 100%; max-width: 860px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.modsentry-intro-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.modsentry-intro-title { font-weight: 800; font-size: 18px; color: var(--text-bright); }
.modsentry-intro-box video { width: 100%; display: block; border-radius: 10px; background: #000; }

.modsentry-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity .35s ease;
}
.modsentry-splash img { width: 120px; height: 120px; }
.modsentry-splash--out { opacity: 0; pointer-events: none; }

/* ---------- Sidebar (replaces the old topbar + guildnav entirely) ---------- */
:root { --sidebar-width: 244px; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 50;
  transition: transform .22s ease;
}
.sidebar-top { padding: 18px 16px 14px; flex-shrink: 0; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; }
.sidebar-nav-group-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
  padding: 16px 10px 6px;
}
.sidebar-nav-group-label:first-child { padding-top: 4px; }
.sidebar-nav-link {
  display: flex; align-items: center;
  padding: 9px 10px; border-radius: 7px;
  color: var(--text-muted); font-weight: 600; font-size: 14px;
  transition: background .15s ease, color .15s ease;
  box-shadow: inset 3px 0 0 transparent;
}
.sidebar-nav-link:hover { color: var(--text-bright); background: var(--bg-elevated-2); text-decoration: none; }
.sidebar-nav-link.is-active { color: var(--text-bright); background: var(--bg-elevated-2); box-shadow: inset 3px 0 0 var(--accent); }

.sidebar-bottom {
  flex-shrink: 0; padding: 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}

/* ---------- Shared dropdown behavior (server switcher, account menu) ---------- */
.dropdown { position: relative; }
.dropdown-trigger { font-family: inherit; cursor: pointer; width: 100%; }
.dropdown-panel {
  position: absolute; left: calc(100% + 8px); top: 0; min-width: 240px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 6px; display: none; z-index: 60;
}
.dropdown-panel.opens-up { top: auto; bottom: 0; }
.dropdown.open .dropdown-panel { display: block; }
.dropdown-panel a, .dropdown-panel button {
  display: block; width: 100%; text-align: left; box-sizing: border-box;
  padding: 9px 10px; border-radius: 7px; background: none; border: none; cursor: pointer;
  color: var(--text); font-weight: 600; font-size: 13.5px; font-family: inherit;
}
.dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--bg-elevated-2); color: var(--text-bright); text-decoration: none; }
.dropdown-panel-divider { border: none; border-top: 1px solid var(--border); margin: 6px 4px; }
.dropdown-panel-label {
  padding: 6px 10px 4px; font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; font-family: var(--font-mono);
}

/* ---------- Server switcher ---------- */
.switcher-trigger {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; color: var(--text-bright);
  transition: background .15s ease, border-color .15s ease;
}
.switcher-trigger:hover, .dropdown.open .switcher-trigger { border-color: var(--border-bright); }
.switcher-trigger .chevron { color: var(--text-muted); flex-shrink: 0; margin-left: auto; transition: transform .15s ease; }
.dropdown.open .switcher-trigger .chevron { transform: rotate(180deg); }
.guild-icon { width: 26px; height: 26px; border-radius: 50%; display: block; object-fit: cover; background: var(--bg-elevated-2); flex-shrink: 0; }
.guild-name { color: var(--text-bright); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-panel { max-height: 360px; overflow-y: auto; }
.switcher-item { display: flex !important; align-items: center; gap: 10px; }
.switcher-item img { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; background: var(--bg-elevated-2); }
.switcher-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-item.is-current { color: var(--accent); }
.switcher-item.is-current::after { content: "\2713"; margin-left: auto; flex-shrink: 0; }

/* ---------- Account menu (avatar dropdown: donate / support / log out) ---------- */
.account-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; color: var(--text-bright);
}
.account-trigger:hover, .dropdown.open .account-trigger { border-color: var(--border-bright); }
.account-trigger .user-avatar { width: 24px; height: 24px; border-radius: 50%; display: block; flex-shrink: 0; }
.account-trigger .account-name { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.account-trigger .chevron { color: var(--text-muted); flex-shrink: 0; margin-left: auto; transition: transform .15s ease; }
.dropdown.open .account-trigger .chevron { transform: rotate(180deg); }

/* ---------- Hamburger + mobile drawer ---------- */
.hamburger {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 70;
  width: 40px; height: 40px; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border-bright); border-radius: 8px;
  color: var(--text-bright); cursor: pointer; box-shadow: var(--shadow-sm);
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 4, 10, .6); z-index: 49; }

.app-content { min-height: 100vh; }
.app-content.has-sidebar { margin-left: var(--sidebar-width); }

/* ---------- Slim top bar for chrome-light pages (login, server list, /staff) --
   there's no per-guild nav to justify a sidebar with nothing in it. ---------- */
.topbar-lite {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px;
  background: rgba(0, 16, 32, .75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-lite > * { flex-shrink: 0; }
.topbar-lite .bot-status { margin-left: auto; }
.topbar-lite .dropdown-panel { left: auto; right: 0; top: calc(100% + 8px); bottom: auto; }
@media (max-width: 680px) {
  .topbar-lite { gap: 8px; padding: 10px 14px; }
  .topbar-lite .bot-status-label { display: none; }
  .topbar-lite .bot-status { padding: 7px; }
  .topbar-lite .account-trigger .account-name { display: none; }
  .topbar-lite .account-trigger { padding: 6px; }
  .topbar-lite .btn { padding: 7px 11px; font-size: 12.5px; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .hamburger { display: flex; }
  .app-content.has-sidebar { margin-left: 0; }
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 24px 90px;
  animation: fade-up .35s ease both;
}
@media (max-width: 900px) { .has-sidebar .container { padding-top: 70px; } }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 { color: var(--text-bright); font-size: 26px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 4px; }
h2 { color: var(--text-bright); font-size: 17px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.card > h2::before, .card > div > h2::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px; flex-shrink: 0;
  background: var(--gradient);
}

.check-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
  border: 1.5px solid var(--border-bright);
}
.check-dot.done { background: var(--success); border-color: var(--success); }
.check-dot.done::after { content: "\2713"; font-size: 11px; font-weight: 800; line-height: 1; color: #0b0f0d; }
.subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 14.5px; }
.subhead { font-size: 14px; font-weight: 700; color: var(--text-bright); margin: 0 0 12px; }
.card-divider { border: none; border-top: 1px solid var(--border); margin: 26px 0 20px; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.card:hover { border-color: var(--border-bright); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } }

label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 16px 0 7px; text-transform: uppercase; letter-spacing: .04em; }
label:first-child { margin-top: 0; }

input[type=text], input[type=password], input[type=url], input[type=number], textarea, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 230, 255, .18);
}
textarea { min-height: 80px; resize: vertical; }
select[multiple] { min-height: 110px; }
input[type=color] { width: 60px; height: 38px; padding: 2px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 7px; cursor: pointer; }
.hint { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; line-height: 1.5; }
.mention-tools { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.mention-tools select { padding: 6px 8px; font-size: 12.5px; width: auto; max-width: 140px; }
.mention-tools input[type="text"] { padding: 6px 8px; font-size: 12.5px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(168, 230, 255, .3);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:hover { transform: translateY(-1px); background-color: var(--accent-hover); box-shadow: 0 6px 18px rgba(168, 230, 255, .4); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-danger { background: var(--danger); box-shadow: 0 2px 10px rgba(237, 66, 69, .3); }
.btn-danger:hover { background: var(--danger-hover); box-shadow: 0 6px 18px rgba(237, 66, 69, .4); }
.btn-ghost { background: var(--bg-elevated-2); border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-input); border-color: var(--border-bright); box-shadow: none; transform: none; filter: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; margin-top: 22px; }

.list { list-style: none; padding: 0; margin: 0; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  border-radius: 6px;
  transition: background .15s ease;
}
.list-item:hover { background: rgba(255, 255, 255, .015); }
.list-item:last-child { border-bottom: none; }
.list-item-title { color: var(--text-bright); font-weight: 600; }
.list-item-meta { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.rank-draglist li { cursor: grab; }
.rank-draglist li.dragging { opacity: .4; cursor: grabbing; }
.rank-draglist .drag-handle { color: var(--text-muted); margin-right: 6px; font-size: 15px; letter-spacing: -1px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; }

.empty { color: var(--text-muted); padding: 18px 0; font-size: 14px; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 3px 9px;
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-muted);
}
.badge-open { background: rgba(35, 165, 90, .15); color: var(--success); }
.badge-claimed { background: rgba(168, 230, 255, .15); color: #7dd3fc; }
.badge-closed { background: rgba(237, 66, 69, .15); color: #f18688; }

/* ---------- Overview page: at-a-glance stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease;
}
.stat-tile:hover { border-color: var(--border-bright); }
.stat-tile-value { font-size: 28px; font-weight: 800; color: var(--text-bright); line-height: 1.15; }
.stat-tile-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Permissions: expandable per-role panels ---------- */
.role-panel-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.role-panel-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }

.role-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s ease;
}
.role-panel:hover { border-color: var(--border-bright); }
.role-panel[open] { border-color: var(--accent-2); }

.role-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.role-summary::-webkit-details-marker { display: none; }
.role-summary::marker { content: ""; }

.role-summary-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.role-chevron { flex-shrink: 0; color: var(--text-muted); transition: transform .15s ease; }
.role-panel[open] .role-chevron { transform: rotate(180deg); }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.role-summary-name { color: var(--text-bright); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-summary-meta { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; flex-shrink: 0; }
.role-summary-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.role-panel-body { padding: 4px 18px 20px; border-top: 1px solid var(--border); }
.role-panel-body .perm-section { padding-top: 16px; }
.role-panel-body .perm-section + .perm-section { border-top: 1px solid var(--border); margin-top: 4px; }
.perm-section-title { font-size: 13px; font-weight: 700; color: var(--text-bright); margin: 0 0 4px; }

.perm-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}
.perm-item:hover { border-color: var(--border-bright); }
.perm-item:has(input:checked) { border-color: var(--accent); background: rgba(168, 230, 255, .1); color: var(--text-bright); }
.perm-item input { width: auto; margin: 0; }

.role-panel-locked .role-summary-name { color: var(--text-muted); }

/* ---------- Section sub-nav (in-page jump links for card-heavy pages) ---------- */
.staff-group-heading {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin: 34px 0 12px; padding-top: 20px; border-top: 1px solid var(--border);
}
.staff-group-heading:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.subnav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.subnav a:hover { color: var(--text-bright); border-color: var(--border-bright); background: var(--bg-elevated-2); text-decoration: none; }

/* ---------- Nav-card list (overview page -> small card -> full page) ---------- */
.nav-card-search { margin-bottom: 16px; }
.nav-card-list { display: flex; flex-direction: column; gap: 10px; }
.nav-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.nav-card:hover { border-color: var(--accent); transform: translateX(2px); text-decoration: none; }
.nav-card-body { min-width: 0; }
.nav-card-title { font-weight: 700; color: var(--text-bright); font-size: 15.5px; margin-bottom: 4px; }
.nav-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.nav-card-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.nav-card-status { font-size: 12px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.nav-card-status.all-set { color: var(--success); }
.nav-card-arrow { color: var(--text-muted); flex-shrink: 0; }
.nav-card-empty { color: var(--text-muted); font-size: 14px; padding: 20px 4px; }

.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.guild-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  color: var(--text-bright);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.guild-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.guild-card img { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 12px; background: var(--bg-input); box-shadow: 0 0 0 3px var(--bg-elevated-2); }
.guild-card-name { font-weight: 700; font-size: 14px; }
.guild-card-meta {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.guild-card-tickets { color: var(--accent); }
.guild-card-warnings { color: #f0b93d; }

.login-wrap { max-width: 360px; margin: 100px auto; }
.login-wrap .card { padding: 32px; }
.error { color: #f18688; margin-bottom: 14px; font-size: 14px; background: rgba(237, 66, 69, .1); border: 1px solid rgba(237, 66, 69, .25); padding: 10px 12px; border-radius: 7px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.field-row select { min-height: unset; }

.embed-builder-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .embed-builder-layout { grid-template-columns: 1fr; } }

.discord-embed-preview {
  background: #313338;
  border-radius: 10px;
  padding: 16px;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
.discord-embed-preview .author { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-bright); font-size: 14px; margin-bottom: 4px; }
.discord-embed-preview .author img { width: 20px; height: 20px; border-radius: 50%; }
.discord-embed-preview .title { color: #00a8fc; font-weight: 700; margin-bottom: 4px; }
.discord-embed-preview .desc { color: var(--text); white-space: pre-wrap; font-size: 14px; }
.discord-embed-preview .fields { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
.discord-embed-preview .fields.has-inline { grid-template-columns: 1fr 1fr; }
.discord-embed-preview .field-name { font-weight: 700; color: var(--text-bright); font-size: 13px; }
.discord-embed-preview .field-value { font-size: 13px; color: var(--text); white-space: pre-wrap; }
.discord-embed-preview .thumb { float: right; width: 80px; height: 80px; border-radius: 4px; object-fit: cover; margin-left: 12px; }
.discord-embed-preview .image { width: 100%; border-radius: 4px; margin-top: 10px; }
.discord-embed-preview .footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--text-muted); font-size: 12px; }
.discord-embed-preview .footer img { width: 18px; height: 18px; border-radius: 50%; }
.sticky { position: sticky; top: 90px; }

/* Role picker */
.role-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px;
}
.role-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px 7px 10px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.role-chip:hover { border-color: var(--role-color, var(--accent)); transform: translateY(-1px); }
.role-chip input { display: none; }
.role-chip .role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--role-color, var(--text-muted));
  flex-shrink: 0;
  box-shadow: 0 0 6px color-mix(in srgb, var(--role-color, transparent) 70%, transparent);
}
.role-chip .role-icon { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.role-chip:has(input:checked) {
  border-color: var(--role-color, var(--accent));
  background: color-mix(in srgb, var(--role-color, var(--accent)) 20%, var(--bg-input));
  color: var(--text-bright);
  font-weight: 600;
}

/* Ticket-type picker (panels) */
.type-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--type-color, var(--accent));
  background: var(--bg-input);
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}
.type-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.type-card input { display: none; }
.type-card .type-emoji { font-size: 20px; line-height: 1; }
.type-card .type-name { color: var(--text-bright); font-weight: 700; font-size: 13.5px; }
.type-card .type-meta { color: var(--text-muted); font-size: 11.5px; }
.type-card .type-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  transition: all .15s ease;
}
.type-card:has(input:checked) {
  border-color: var(--type-color, var(--accent));
  background: color-mix(in srgb, var(--type-color, var(--accent)) 14%, var(--bg-input));
  box-shadow: 0 0 0 1px var(--type-color, var(--accent));
}
.type-card:has(input:checked) .type-check {
  background: var(--type-color, var(--accent));
  border-color: var(--type-color, var(--accent));
  color: #fff;
}
.type-card:has(input:checked) .type-check::after { content: "✓"; }

/* Panel display style choice */
.style-choice { display: flex; gap: 12px; }
.style-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.style-option:hover { border-color: var(--border-bright); }
.style-option input { margin: 0; accent-color: var(--accent); }
.style-option:has(input:checked) { border-color: var(--accent); background: rgba(168, 230, 255, .12); }
.style-option .style-title { color: var(--text-bright); font-weight: 700; font-size: 14px; }
.style-option .style-desc { color: var(--text-muted); font-size: 12px; }

/* Contact picker (send-DM recipients + the contacts card) */
.contact-picker {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  background: var(--bg-input);
}
.contact-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.contact-row:hover { background: rgba(255, 255, 255, .03); }
.contact-row input { margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.contact-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; background: var(--bg-elevated-2); }
.contact-name { display: block; font-weight: 600; color: var(--text-bright); font-size: 13.5px; }
.contact-id { display: block; font-size: 11.5px; color: var(--text-muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* Bot status badge */
.role-warning {
  background: rgba(217, 119, 6, .1);
  border-bottom: 1px solid rgba(217, 119, 6, .3);
  color: #f2c078;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 9px 20px;
}

.maintenance-banner {
  background: rgba(237, 66, 69, .12);
  border-bottom: 1px solid rgba(237, 66, 69, .35);
  color: #ff9a9d;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 9px 20px;
}

.bot-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
}
.bot-status .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bot-status.online { color: #7ee6a4; }
.bot-status.online .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(35, 165, 90, .25); animation: pulse 2s ease-in-out infinite; }
.bot-status.offline { color: #f18688; }
.bot-status.offline .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(237, 66, 69, .25); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(35, 165, 90, .25); }
  50% { box-shadow: 0 0 0 6px rgba(35, 165, 90, .12); }
}

/* ---------- Guided tour ---------- */
.tour-blocker { position: fixed; inset: 0; z-index: 99989; background: transparent; }
.tour-spotlight {
  position: fixed; z-index: 99990; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(6, 4, 4, .78);
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}
.tour-tooltip {
  position: fixed; z-index: 99991; width: min(320px, calc(100vw - 24px));
  background: var(--bg-elevated-2); border: 1px solid var(--border-bright); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-md);
}
.tour-progress { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); margin-bottom: 8px; }
.tour-title { font-size: 16px; font-weight: 800; color: var(--text-bright); margin-bottom: 6px; }
.tour-body { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin-bottom: 16px; }
.tour-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tour-actions .btn:last-child { margin-left: auto; }

/* ---------- Mobile ---------- */
/* The sidebar itself already becomes a full off-canvas drawer at this
   breakpoint (see the sidebar rules above) -- everything inside it keeps
   its normal size since it's no longer squeezed into a horizontal bar. */
@media (max-width: 480px) {
  :root { --sidebar-width: 82vw; }
}

@media (max-width: 780px) {
  .container { padding: 20px 14px 60px; }
  h1 { font-size: 21px; }
  .login-wrap { margin: 48px auto; padding: 0 16px; }

  /* Any inline flex row (form fields, list headers with a button, etc.)
     wraps instead of squeezing -- covers every "display:flex" inline style
     across every view in one place rather than editing each template. */
  [style*="display:flex"] { flex-wrap: wrap; }

  .field-row { grid-template-columns: 1fr !important; gap: 8px; }
  .grid { gap: 12px; }
  .style-choice { flex-direction: column; }
  .list-item { flex-wrap: wrap; }
  .discord-embed-preview .fields.has-inline { grid-template-columns: 1fr; }
  .mention-tools select, .mention-tools input[type="text"] { max-width: none; flex: 1 1 auto; }
}

/* [data-delete-item] rows/cards get hidden the instant their delete form is
   staged, before the bar below actually commits anything -- see
   pendingDeleteBar.js. */
.pending-delete-hidden { display: none !important; }

.pending-changes-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 24px);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 4, 10, .5);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
  max-width: calc(100vw - 32px);
}
.pending-changes-bar.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.rank-changes-bar { align-items: center; }
.pending-changes-count { color: var(--text-bright); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.pending-changes-actions { display: flex; gap: 8px; }
@media (max-width: 560px) {
  .pending-changes-bar { flex-direction: column; align-items: stretch; gap: 10px; left: 16px; right: 16px; bottom: 16px; transform: translateY(24px); max-width: none; }
  .pending-changes-bar.is-visible { transform: translateY(0); }
  .pending-changes-actions { justify-content: stretch; }
  .pending-changes-actions .btn { flex: 1; justify-content: center; }
}
