:root {
  --bg: #1b1d23;
  --panel: #24272f;
  --panel-2: #2c303a;
  --sidebar: #202228;
  --border: #353946;
  --text: #e9ebf0;
  --muted: #949bab;
  --accent: #3b8ef6;
  --ok: #3ba55d;
  --danger: #ed4245;
  /* Discord preview colors */
  --dc-bg: #313338;
  --dc-embed: #2b2d31;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

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

/* LTR so the brand sits on the left and the avatar on the right. */
header {
  direction: ltr;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand { font-weight: 700; font-size: 18px; }
.user { position: relative; }

.avatar-btn {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: block;
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { border-color: var(--accent); }
.avatar-btn img { width: 36px; height: 36px; border-radius: 50%; display: block; }

.menu {
  direction: rtl;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  z-index: 10;
}
.menu-head { padding: 8px 10px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item {
  display: block;
  width: 100%;
  text-align: right;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.menu-item:hover { background: var(--border); }
.menu-item.danger { color: var(--danger); }

main { max-width: 960px; margin: 0 auto; padding: 32px 16px; }
h1 { font-size: 22px; margin: 0 0 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--border); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }

.login-box { text-align: center; margin-top: 15vh; }
.login-box p { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.guild {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.guild img, .guild .no-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--panel-2);
  display: grid; place-items: center; font-weight: 700;
}
.guild .name { font-weight: 600; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 17px; margin: 0 0 16px; }

label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
select, textarea, input[type="url"] {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font-size: 15px; margin: 0; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 8px;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }
.muted { color: var(--muted); }

.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; }

.banner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.banner.warn { border-color: var(--danger); }
.banner b { color: var(--text); }

.badge { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.off { color: var(--danger); border-color: var(--danger); }

input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > div { flex: 1 1 160px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }

.small { font-size: 13px; }
.hint { margin: 8px 0 0; }
select:focus, textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ============================================================ dashboard layout */

body.dash { min-height: 100vh; }
body.dash header { position: sticky; top: 0; z-index: 20; height: 65px; }

/* LTR grid so the sidebar sits on the left (content inside stays RTL). */
.layout {
  direction: ltr;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: calc(100vh - 65px);
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
  overflow-y: auto;
}

main.content { max-width: 1100px; width: 100%; margin: 0; padding: 32px 40px 80px; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  main.content { padding: 24px 16px 60px; }
}

/* Guild switcher */
.guild-switch { position: relative; margin-bottom: 18px; }
.gs-current {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.gs-current:hover { background: var(--panel-2); }
.gs-current img, .gs-current .no-icon, .gs-item img, .gs-item .no-icon {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--panel-2); display: grid; place-items: center; font-size: 13px;
}
.gs-name { flex: 1; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.gs-menu {
  position: absolute; inset-inline: 0; top: calc(100% + 6px);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; z-index: 15; box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  max-height: 320px; overflow-y: auto;
}
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; }
.gs-item:hover { background: var(--border); }
.gs-item.all { color: var(--accent); justify-content: center; }

/* Nav */
.nav-title {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--muted); padding: 14px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: var(--panel-2); color: var(--text); box-shadow: inset -3px 0 0 var(--accent); }

/* Page head */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { margin: 0 0 6px; font-size: 24px; }
.page-head p { margin: 0; max-width: 620px; line-height: 1.5; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dirty { color: #f0b232; font-size: 13px; }

/* Module cards */
.card h2 { font-size: 16px; margin: 0 0 4px; }
.section-desc { margin: 0 0 16px; font-size: 14px; line-height: 1.5; }
.card.master { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.master-title { font-weight: 600; margin-bottom: 2px; }
.master-toggle { display: flex; align-items: center; gap: 10px; }
.switch-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch-card .section-desc { margin: 0; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; transition: opacity .15s; }
fieldset:disabled { opacity: .4; pointer-events: none; user-select: none; }

/* Toggle switch (LTR: off = left/gray, on = right/blue) */
.toggle { direction: ltr; position: relative; display: inline-block; width: 46px; height: 26px; margin: 0; flex: none; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: #4e5361; transition: background .18s;
}
.toggle .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform .18s;
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(20px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmented control with a sliding highlight (.seg-pill is positioned from JS) */
.segmented {
  position: relative;
  display: inline-flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; gap: 4px;
}
.segmented button {
  position: relative; z-index: 1;
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 22px; border-radius: 7px; cursor: pointer; transition: color .2s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { color: #fff; }
.seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 0;
  border-radius: 7px; background: var(--accent);
  box-shadow: 0 2px 8px rgba(59, 142, 246, .35);
}
.segmented.ready .seg-pill { transition: transform .28s cubic-bezier(.4, 0, .2, 1), width .28s cubic-bezier(.4, 0, .2, 1); }

.style-opts { margin-top: 6px; transition: opacity .14s ease, transform .14s ease, height .26s cubic-bezier(.4, 0, .2, 1); }
.style-opts.animating { overflow: hidden; }
.style-opts.fade-out { opacity: 0; transform: translateY(6px); }

.opt-grid { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }

/* Button color cube + popover */
.cube-wrap { position: relative; display: inline-block; }
.color-cube {
  width: 42px; height: 42px; border-radius: 10px; cursor: pointer;
  background: var(--c); border: 3px solid var(--panel-2);
  box-shadow: 0 0 0 1px var(--border); transition: transform .15s;
}
.color-cube:hover { transform: scale(1.06); }
.cube-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 12; width: 220px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  animation: pop-in .16s ease;
}
.cube-pop p { margin: 6px 4px 2px; }
.cube-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: inherit; cursor: pointer; text-align: right;
}
.cube-option:hover { background: var(--border); }
.cube-option .cube { width: 22px; height: 22px; border-radius: 6px; background: var(--c); flex: none; }
.cube-option.active .cube { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 4px #fff; }
.color-cube.is-link { position: relative; }
.color-cube.is-link::after { content: "↗"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 700; }

/* Multi-role picker */
.role-multi { display: flex; flex-direction: column; gap: 8px; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; }
.rm-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 6px 4px 10px; font-size: 13px; animation: pop-in .18s ease;
}
.rm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rc); flex: none; }
.rm-chip button {
  width: 18px; height: 18px; border: 0; border-radius: 50%; padding: 0; line-height: 1;
  background: var(--panel-2); color: var(--muted); cursor: pointer;
}
.rm-chip button:hover { background: var(--danger); color: #fff; }
.rm-add { max-width: 260px; }

/* Commands page */
.cmd-name {
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 15px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; direction: ltr; display: inline-block;
}
.fold-head > div { min-width: 0; }
.fold.open { border-color: rgba(59, 142, 246, .45); }
.fold.open .fold-body { animation: pop-in .2s ease; }
.hint a, .status-box a { color: var(--accent); }

/* Management */
.status-box {
  margin-top: 16px; padding: 12px 14px; border-radius: 10px; line-height: 1.7;
  background: var(--bg); border: 1px solid var(--border);
}
.status-box.ok { border-color: var(--ok); }
.status-box.off { border-color: var(--danger); }

/* Giveaways */
.gw-h { font-size: 14px; color: var(--muted); margin: 14px 0 8px; font-weight: 600; }
.gw-h:first-child { margin-top: 0; }
.gw-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); margin-bottom: 8px;
}
.gw-item.ended { opacity: .75; }
.gw-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pv-title { font-weight: 700; font-size: 16px; color: #f2f3f5; }
.pv-big { font-weight: 700; font-size: 20px; color: #f2f3f5; }
#gw-preview { gap: 4px; font-size: 14px; }
.dc-button.no-handle { padding: 0 14px; }
.dc-button.disabled-btn { opacity: .55; }
.vars-card { padding: 14px 20px; }

/* Tickets */
.tt-row .wb-head { gap: 10px; }
.tt-body { display: block !important; }
.tt-name { flex: 1; min-width: 0; font-weight: 600; }
.emoji-input { width: 64px !important; text-align: center; font-size: 18px; padding: 8px 4px !important; flex: none; }
.small-cube { width: 36px; height: 36px; border-radius: 8px; }
.icon-btn {
  width: 36px; height: 36px; flex: none; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); font-size: 15px;
}
.icon-btn.danger:hover:not(:disabled) { border-color: var(--danger); background: rgba(237, 66, 69, .15); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.switch-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.action-item {
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px;
}
.action-item:hover { border-color: rgba(59, 142, 246, .45); }
.action-emoji { font-size: 20px; }
.action-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dc-select {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: 420px; padding: 9px 12px; border-radius: 8px; background: #1e1f22; border: 1px solid #3f4147; color: #b5bac1; font-size: 14px;
}

/* Ticket type list preview (the private message after clicking the panel button) */
.chooser-text { margin-bottom: 8px; font-size: 15px; }
.dc-select.open { border-radius: 8px 8px 0 0; border-color: #5865f2; }
.dc-options {
  max-width: 420px; background: #2b2d31; border: 1px solid #3f4147; border-top: 0;
  border-radius: 0 0 8px 8px; overflow: hidden;
}
.dc-option { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-top: 1px solid #3f4147; font-size: 14px; }
.dc-option:first-child { border-top: 0; }
.dc-option b { color: #f2f3f5; font-weight: 500; }
.dc-option span { color: #949ba4; font-size: 12px; }

/* Welcome buttons list */
.wb-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.wb-row {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .2s, opacity .2s, transform .2s;
}
.wb-row.on { border-color: rgba(59, 142, 246, .45); }
.wb-row.dragging { opacity: .4; }
.wb-row.drop-target { border-color: var(--accent); transform: scale(1.01); }
.wb-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.wb-grip { cursor: grab; color: var(--muted); font-size: 18px; user-select: none; }
.wb-grip:active { cursor: grabbing; }
.wb-order { display: flex; flex-direction: column; gap: 2px; }
.wb-order button {
  width: 22px; height: 16px; padding: 0; font-size: 9px; line-height: 1;
  border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); color: var(--muted); cursor: pointer;
}
.wb-order button:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.wb-order button:disabled { opacity: .3; cursor: default; }
.wb-title { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.wb-body { display: none; padding: 0 14px 16px; border-top: 1px solid var(--border); }
.wb-row.on .wb-body { display: block; animation: pop-in .2s ease; }
.wb-body .opt-grid > div > label:first-child { margin-top: 14px; }
.wb-field { flex: 1 1 200px; }
.wb-chname { display: block; margin-top: 6px; }
.wb-chname.bad { color: var(--danger); }

.emoji-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.emoji-row input { width: 140px; flex: none; }
.emoji-pick {
  width: 40px; height: 40px; font-size: 20px; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
}
.emoji-pick.active { border-color: var(--accent); background: rgba(59, 142, 246, .15); }

/* Foldable toggle cards (welcome) */
.fold { padding: 0; overflow: hidden; }
.fold-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; }
.fold-head h2 { margin: 0; }
.fold-body { display: none; padding: 0 22px 22px; border-top: 1px solid var(--border); }
.fold.open .fold-body { display: block; }
.fold-body > label:first-child { margin-top: 18px; }

/* ============================================================ Discord message editor */

.msg-editor { display: flex; flex-direction: column; gap: 12px; }

.dc-preview {
  display: flex; gap: 14px; padding: 16px;
  background: var(--dc-bg); border-radius: 10px;
  color: var(--dc-text); font-family: "gg sans", "Noto Sans", "Segoe UI", system-ui, sans-serif;
}
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.dc-body { flex: 1; min-width: 0; }
.dc-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.dc-name { font-weight: 600; color: #f2f3f5; }
.dc-bot { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.dc-time { color: var(--dc-muted); font-size: 12px; }

/* Inline-editable fields look like plain text until hovered/focused */
.dc-preview input, .dc-preview textarea {
  display: block; width: 100%;
  background: transparent; border: 1px dashed transparent; border-radius: 6px;
  color: inherit; font: inherit; padding: 4px 6px; margin: 0 0 2px -6px;
  resize: none; min-height: 0; overflow: hidden; text-align: start;
}
.dc-preview input:hover, .dc-preview textarea:hover { border-color: #4e5058; }
.dc-preview input:focus, .dc-preview textarea:focus { border-color: var(--accent); outline: none; background: rgba(0, 0, 0, .15); }
.dc-preview ::placeholder { color: #6d6f78; }
.dc-preview .dc-content { max-width: 560px; }

/* Message box (Components V2 container) */
.dc-box-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; }
.dc-box {
  --accent-color: #5865f2;
  flex: 0 1 560px; min-width: 0;
  background: #393a41; border-radius: 8px;
  border-left: 4px solid var(--accent-color);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .2s;
}
.dc-sec { display: flex; gap: 14px; align-items: flex-start; }
.dc-sec-text { flex: 1; min-width: 0; }
.dc-preview .dc-author { font-weight: 600; font-size: 14px; color: #f2f3f5; }
.dc-preview .dc-title { font-weight: 700; color: #f2f3f5; font-size: 18px; }
.dc-preview .dc-desc { font-size: 15px; line-height: 1.45; }
.dc-preview .dc-footer { font-size: 12px; color: var(--dc-muted); }
.dc-sep { height: 1px; background: #4e5058; margin: 2px 0; }

.dc-img {
  position: relative; display: grid; place-items: center;
  border: 1px dashed #5c5e66; border-radius: 8px; color: #7d7f88;
  cursor: pointer; overflow: hidden; transition: border-color .15s, color .15s, background .15s;
}
.dc-img svg { width: 45%; height: 45%; max-width: 30px; max-height: 30px; }
.dc-img:hover, .dc-img:focus-visible { border-color: var(--accent); color: var(--dc-text); background: rgba(59, 142, 246, .08); outline: none; }
.dc-thumb { width: 84px; height: 84px; flex: none; }
/* Header / footer icon: small, left of the text (sent as an inline emoji) */
.dc-line { display: flex; align-items: center; gap: 6px; }
.dc-line input { flex: 1; min-width: 0; }
.dc-icon { width: 26px; height: 26px; flex: none; border-radius: 50%; overflow: visible; }
.dc-icon-sm { width: 20px; height: 20px; }
.dc-icon svg { width: 70%; height: 70%; }
.dc-icon.has-img img { object-fit: cover; border-radius: 50%; }
.dc-icon .dc-img-remove { top: -4px; right: -4px; width: 14px; height: 14px; font-size: 10px; }

/* Divider between the text and a button placed inside the message */
.dc-zone[data-zone="inside"]:not(:empty) { border-top: 1px solid #4e5058; padding-top: 10px; }
.dc-icon .spinner { width: 14px; height: 14px; }
.dc-image { width: 100%; min-height: 130px; }
.dc-img.has-img { border-style: solid; border-color: transparent; }
.dc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dc-image.has-img { min-height: 0; }
.dc-image.has-img img { height: auto; max-height: 320px; object-fit: contain; }
.dc-img.uploading { cursor: progress; }
.dc-img-remove {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, .75); color: #fff;
  cursor: pointer; line-height: 1; font-size: 14px; opacity: 0; transition: opacity .15s;
}
.dc-img:hover .dc-img-remove, .dc-img:focus-within .dc-img-remove { opacity: 1; }

.dc-tools { display: flex; flex-direction: column; gap: 6px; }
.dc-tool { width: 32px; height: 32px; margin: 0; cursor: pointer; display: grid; place-items: center; }
.color-tool {
  background: conic-gradient(#ed4245, #fee75c, #57f287, #5865f2, #eb459e, #ed4245);
  border: 3px solid #1e1f22; border-radius: 50%;
}
.color-tool input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* Button drop zones (inside the box / below it) */
.dc-zone:empty { display: none; }
.dc-zone[data-zone="below"] { margin-top: 8px; }
.msg-editor.dragging .dc-zone {
  display: flex; align-items: center; min-height: 46px; padding: 6px;
  border: 2px dashed #5c5e66; border-radius: 8px; transition: border-color .15s, background .15s;
}
.msg-editor.dragging .dc-zone:empty::before {
  content: "שחררו כאן"; color: var(--dc-muted); font-size: 13px; width: 100%; text-align: center;
}
.msg-editor.dragging .dc-zone.over { border-color: var(--accent); background: rgba(59, 142, 246, .12); }

.dc-button {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 14px 0 6px; height: 34px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: #fff; transition: background .2s;
}
.dc-button.primary { background: #5865f2; }
.dc-button.success { background: #248046; }
.dc-button.secondary { background: #4e5058; }
.dc-button.danger { background: #da373c; }
.drag-handle { cursor: grab; opacity: .6; padding: 0 2px; user-select: none; font-size: 16px; line-height: 1; }
.drag-handle:hover { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
/* Auto-width label input: the hidden ::after copy sizes the grid cell */
.dc-btn-label { display: inline-grid; }
.dc-btn-label::after {
  content: attr(data-value) " "; visibility: hidden; white-space: pre;
  grid-area: 1 / 1; font: inherit; padding: 2px 4px; min-width: 2ch;
}
.dc-preview .dc-btn-label input {
  grid-area: 1 / 1; width: 100%; min-width: 2ch; margin: 0; padding: 2px 4px;
  border-color: transparent; color: #fff; font-weight: 500; text-align: center;
}
.dc-preview .dc-btn-label input:hover { border-color: rgba(255, 255, 255, .4); }
.dc-preview .dc-btn-label input:focus { border-color: #fff; background: rgba(0, 0, 0, .2); }

/* Generated welcome banner preview (mirrors src/banner.js) */
.dc-banner {
  position: relative; overflow: hidden; border-radius: 8px;
  aspect-ratio: 1100 / 440; display: grid; place-items: center; background: #111;
}
.dc-banner-bg {
  position: absolute; inset: -24px;
  background: var(--avatar) center / cover;
  filter: blur(14px) brightness(.65);
}
.dc-banner-avatar {
  position: relative; width: 21%; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 clamp(3px, 1.1vw, 6px) var(--ring), 0 8px 24px rgba(0, 0, 0, .55);
  transition: box-shadow .2s;
}
.banner-opts { margin-top: 4px; }
.ring-cube { display: block; position: relative; overflow: hidden; }
.ring-cube input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }

.dc-button.link { background: #4e5058; padding: 0 12px; }
.dc-link-icon { width: 14px; height: 14px; margin-inline-start: 4px; }
.dc-btn-row { display: inline-flex; flex-wrap: wrap; gap: 8px; cursor: grab; }
.dc-btn-row:active { cursor: grabbing; }
.dc-btn-row .dc-button { padding: 0 14px; }

.dc-reaction {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 8px; font-size: 15px;
  background: rgba(88, 101, 242, .15); border: 1px solid #5865f2;
}
.dc-reaction b { font-size: 13px; color: #c9cdfb; }

.pop { animation: pop-in .28s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes pop-in {
  from { opacity: 0; transform: scale(.85) translateY(4px); }
  to { opacity: 1; transform: none; }
}

.vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.var-chip {
  display: inline-flex; gap: 6px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; direction: ltr;
}
.var-chip span { color: var(--muted); direction: rtl; }
.var-chip:hover { border-color: var(--accent); }
.var-chip { cursor: default; }
.var-chip code {
  font-family: Consolas, "Cascadia Mono", monospace; color: var(--text);
  cursor: copy; user-select: all; padding: 1px 4px; border-radius: 4px;
}
.var-chip code:hover { background: rgba(59, 142, 246, .18); }

/* ============================================================ loading states */

.spinner {
  display: inline-block; width: 14px; height: 14px; flex: none;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.dc-img .spinner { width: 20px; height: 20px; border-color: rgba(255, 255, 255, .2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { transition: background .25s, filter .15s, opacity .2s; }
.btn.loading, .btn.loading:disabled { background: #4e5361; opacity: 1; cursor: progress; }
.btn.done { background: var(--ok); }
