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

:root {
  /* Discord palette */
  --bg-0: #1e1f22;
  --bg-1: #2b2d31;
  --bg-2: #313338;
  --bg-3: #383a40;
  --bg-4: #404249;
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --text-0: #f2f3f5;
  --text-1: #dbdee1;
  --text-2: #b5bac1;
  --text-3: #80848e;
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --blurple-light: rgba(88,101,242,0.15);
  --green: #23a559;
  --green-hover: #1a8a47;
  --red: #da373c;
  --red-hover: #c32b30;
  --yellow: #f0b232;
  --mention: rgba(250,168,26,.1);
  --mention-border: #f0b232;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 10px rgba(0,0,0,.35);
  --font: 'Nunito', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 0.15s ease;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── Toast ──────────────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  background: var(--bg-4);
  color: var(--text-0);
  box-shadow: var(--shadow);
  animation: slideIn .2s ease, fadeOut .3s ease 2.7s forwards;
  min-width: 220px;
  border-left: 3px solid var(--blurple);
}
.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }
.toast.warning { border-color: var(--yellow); }
.toast .toast-icon { flex-shrink: 0; }
@keyframes slideIn  { from { transform: translateX(110%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes fadeOut  { from { opacity:1; } to { opacity:0; transform:translateX(110%); } }

/* ── Header ─────────────────────────────────────────────────────────── */
.header {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--blurple);
  letter-spacing: -.3px;
}
.logo svg { color: var(--blurple); }
.header-actions { display: flex; gap: .5rem; align-items: center; }

/* ── Saved Panel ────────────────────────────────────────────────────── */
.saved-panel {
  position: fixed;
  top: 56px;
  right: 1rem;
  width: 300px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  z-index: 100;
  box-shadow: var(--shadow);
  padding: 1rem;
  animation: slideDown .15s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } }
.saved-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.saved-panel-header h3 { font-size: .9rem; font-weight: 700; color: var(--text-0); }
.saved-item { display: flex; align-items: center; gap: .5rem; padding: .5rem; border-radius: var(--radius-sm); background: var(--bg-2); margin-bottom: .4rem; cursor: pointer; border: 1px solid var(--border); transition: border-color var(--transition); }
.saved-item:hover { border-color: var(--blurple); }
.saved-item-name { flex: 1; font-size: .85rem; color: var(--text-1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item-url { font-size: .75rem; color: var(--text-3); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.saved-item-del { color: var(--red); padding: .15rem; border-radius: 3px; }
.saved-item-del:hover { background: rgba(218,55,60,.15); }
.saved-empty { color: var(--text-3); font-size: .85rem; text-align: center; padding: .75rem 0; }
.hidden { display: none !important; }

/* ── App Layout ─────────────────────────────────────────────────────── */
.app-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 420px 1fr;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  height: calc(100vh - 57px);
}

/* ── Builder Panel ──────────────────────────────────────────────────── */
.builder-panel {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 10px; }

/* ── Card ───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: border-color var(--transition);
}
.card:focus-within { border-color: var(--border-hover); }
.card-title {
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-2);
  margin-bottom: .85rem;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.card-title svg { color: var(--blurple); }

/* ── Fields ─────────────────────────────────────────────────────────── */
.field-group { margin-bottom: .75rem; }
.field-group:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.required { color: var(--red); }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.label-row .field-label { margin-bottom: 0; }
.char-count { font-size: .72rem; color: var(--text-3); font-family: var(--mono); }
.char-count.warn { color: var(--yellow); }
.char-count.limit { color: var(--red); }

.field-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .7rem;
  font-family: var(--font);
  font-size: .88rem;
  color: var(--text-0);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.field-input::placeholder { color: var(--text-3); }
.field-input:focus { border-color: var(--blurple); box-shadow: 0 0 0 3px rgba(88,101,242,.2); }
.field-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field-hint { font-size: .76rem; color: var(--text-3); margin-top: .3rem; }
.field-hint.valid { color: var(--green); }
.field-hint.invalid { color: var(--red); }

.input-with-action { position: relative; }
.input-with-action .field-input { padding-right: 2.4rem; }
.input-with-action .toggle-pwd { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); }

.input-with-preview { display: flex; gap: .5rem; align-items: flex-start; }
.input-with-preview .field-input { flex: 1; }
.avatar-preview {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-4);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--text-3);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ── Toggles ────────────────────────────────────────────────────────── */
.toggles-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.toggle-label { display: flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .85rem; color: var(--text-2); user-select: none; }
.toggle-input { display: none; }
.toggle-track {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--bg-4);
  border: 1px solid var(--border);
  position: relative;
  transition: background var(--transition);
}
.toggle-track::after {
  content:'';
  position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-3);
  top: 2px; left: 2px;
  transition: all var(--transition);
}
.toggle-input:checked + .toggle-track { background: var(--blurple); border-color: var(--blurple); }
.toggle-input:checked + .toggle-track::after { left: 18px; background: white; }

/* ── Row/Grid helpers ───────────────────────────────────────────────── */
.row-2 { display: flex; gap: .5rem; }
.w-full { width: 100%; justify-content: center; }

/* ── Buttons ────────────────────────────────────────────────────────── */
button { cursor: pointer; font-family: var(--font); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 700;
  border: none;
  transition: background var(--transition), transform .1s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-hover); }
.btn-danger  { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-hover); }
.btn-outline {
  background: transparent;
  color: var(--text-2);
  border: 1px dashed var(--border-hover);
}
.btn-outline:hover { border-color: var(--blurple); color: var(--blurple); background: var(--blurple-light); }
.btn-ghost  { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-4); color: var(--text-0); border-color: var(--border-hover); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-2);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.btn-icon:hover { background: var(--bg-3); color: var(--text-0); }
.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--red);
  color: white;
  font-size: .65rem;
  font-weight: 800;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── Actions Card ───────────────────────────────────────────────────── */
.actions-card { display: flex; flex-direction: column; gap: .6rem; }
.secondary-actions { display: flex; gap: .5rem; }

/* ── Embed Builder ──────────────────────────────────────────────────── */
.embed-count-badge {
  background: var(--blurple);
  color: white;
  font-size: .7rem;
  font-weight: 800;
  padding: .1rem .45rem;
  border-radius: 10px;
  margin-left: auto;
}

.embed-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .6rem;
  overflow: hidden;
  transition: border-color var(--transition);
}
.embed-card:focus-within { border-color: var(--border-hover); }
.embed-card-header {
  display: flex;
  align-items: center;
  padding: .6rem .75rem;
  cursor: pointer;
  background: var(--bg-2);
  gap: .5rem;
  user-select: none;
}
.embed-card-header:hover { background: var(--bg-3); }
.embed-color-strip {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: #5865f2;
  flex-shrink: 0;
}
.embed-card-title { flex: 1; font-size: .82rem; font-weight: 700; color: var(--text-1); }
.embed-card-chevron { color: var(--text-3); transition: transform .2s; }
.embed-card.collapsed .embed-card-chevron { transform: rotate(-90deg); }
.embed-card-body { padding: .75rem; display: flex; flex-direction: column; gap: .6rem; }
.embed-card.collapsed .embed-card-body { display: none; }

.color-row { display: flex; align-items: center; gap: .6rem; }
.color-row .field-input[type="color"] {
  width: 36px; height: 36px;
  padding: 2px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.color-hex-input { flex: 1; font-family: var(--mono); font-size: .82rem; }

.fields-container { display: flex; flex-direction: column; gap: .45rem; }
.embed-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: .4rem;
  align-items: center;
}
.embed-field-row .field-input { font-size: .82rem; }
.field-inline-toggle { display: flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--text-2); white-space: nowrap; }
.add-field-btn { font-size: .78rem; color: var(--blurple); background: var(--blurple-light); border: 1px dashed rgba(88,101,242,.4); border-radius: var(--radius-sm); padding: .3rem .6rem; margin-top: .3rem; width: 100%; display: flex; align-items: center; justify-content: center; gap: .3rem; transition: all var(--transition); }
.add-field-btn:hover { background: rgba(88,101,242,.25); }

/* ── Preview Panel ──────────────────────────────────────────────────── */
.preview-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  overflow: hidden;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.preview-label { display: flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }
.channel-badge { font-size: .8rem; color: var(--text-3); background: var(--bg-3); padding: .2rem .6rem; border-radius: 100px; font-weight: 700; }

.discord-mock {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}
.discord-mock::-webkit-scrollbar { width: 6px; }
.discord-mock::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 10px; }

/* ── Discord Message ────────────────────────────────────────────────── */
.discord-message {
  display: flex;
  gap: 1rem;
  padding: .25rem 0;
}
.msg-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--blurple);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: white;
  overflow: hidden;
}
.msg-avatar img { width:100%; height:100%; object-fit: cover; }
.msg-body { flex: 1; min-width: 0; }
.msg-header { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .2rem; }
.msg-name { font-weight: 800; color: var(--text-0); font-size: .95rem; }
.msg-time { font-size: .75rem; color: var(--text-3); }
.msg-content { font-size: .94rem; color: var(--text-1); line-height: 1.55; word-break: break-word; }
.msg-content.empty { color: var(--text-3); font-style: italic; font-size: .85rem; }

/* Markdown Discord */
.msg-content strong, .embed-desc strong, .embed-field-value strong { color: var(--text-0); font-weight: 800; }
.msg-content em, .embed-desc em, .embed-field-value em { font-style: italic; }
.msg-content del, .embed-desc del, .embed-field-value del { text-decoration: line-through; opacity: .7; }
.md-code { background: var(--bg-0); font-family: var(--mono); font-size: .82em; padding: .1em .35em; border-radius: 3px; color: var(--text-1); }
.md-codeblock { background: var(--bg-0); font-family: var(--mono); font-size: .82em; padding: .6rem .75rem; border-radius: 4px; margin: .3rem 0; overflow-x: auto; white-space: pre; color: var(--text-1); border: 1px solid var(--border); }
.md-codeblock code { background: none; padding: 0; font-size: 1em; }
.md-h1 { font-size: 1.4rem; font-weight: 800; color: var(--text-0); margin: .4rem 0 .2rem; line-height: 1.2; }
.md-h2 { font-size: 1.15rem; font-weight: 800; color: var(--text-0); margin: .3rem 0 .15rem; line-height: 1.2; }
.md-h3 { font-size: 1rem; font-weight: 800; color: var(--text-0); margin: .2rem 0 .1rem; line-height: 1.2; }
.md-blockquote { display: flex; gap: .5rem; margin: .2rem 0; }
.md-quote-bar { width: 4px; border-radius: 4px; background: var(--text-3); flex-shrink: 0; }
.md-quote-content { color: var(--text-2); font-style: italic; }
.md-spoiler { background: var(--text-1); color: transparent; border-radius: 3px; padding: 0 .2em; cursor: pointer; transition: all .15s; user-select: none; }
.md-spoiler.revealed { background: var(--bg-0); color: var(--text-1); }
.md-mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 3px; padding: 0 .25em; font-weight: 600; cursor: default; }
.md-mention:hover { background: rgba(88,101,242,.6); }
.md-link { color: #00b0f4; text-decoration: none; }
.md-link:hover { text-decoration: underline; }
.md-timestamp { background: rgba(88,101,242,.2); color: #c9cdfb; border-radius: 3px; padding: 0 .3em; font-size: .9em; }

/* ── Discord Embed Preview ─────────────────────────────────────────── */
.discord-embed {
  display: flex;
  max-width: 520px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
  margin-top: .4rem;
}
.embed-left-bar { width: 4px; flex-shrink: 0; background: #5865f2; }
.embed-content-area { padding: .6rem .75rem .75rem; flex: 1; min-width: 0; }
.embed-author-row { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; }
.embed-author-row img.embed-author-icon { width: 18px; height: 18px; border-radius: 50%; }
.embed-author-name { font-size: .8rem; font-weight: 700; color: var(--text-0); }
.embed-title { font-size: .94rem; font-weight: 800; color: var(--text-0); margin-bottom: .3rem; }
.embed-title a { color: #00b0f4; text-decoration: none; }
.embed-title a:hover { text-decoration: underline; }
.embed-desc { font-size: .88rem; color: var(--text-1); line-height: 1.5; margin-bottom: .5rem; white-space: pre-wrap; word-break: break-word; }
.embed-fields { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.embed-field { min-width: 100px; }
.embed-field.inline { flex: 1; }
.embed-field-name { font-size: .8rem; font-weight: 800; color: var(--text-0); margin-bottom: .1rem; }
.embed-field-value { font-size: .85rem; color: var(--text-1); }
.embed-image-wrap { margin-top: .5rem; }
.embed-image-wrap img { max-width: 100%; border-radius: 4px; max-height: 300px; }
.embed-thumb-wrap img { width: 70px; height: 70px; object-fit: cover; border-radius: 4px; }
.embed-footer-row { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.embed-footer-row img.embed-footer-icon { width: 16px; height: 16px; border-radius: 50%; }
.embed-footer-text { font-size: .75rem; color: var(--text-3); }

.preview-empty {
  color: var(--text-3);
  font-style: italic;
  font-size: .88rem;
  padding: 2rem;
  text-align: center;
}

/* ── JSON Details ───────────────────────────────────────────────────── */
.json-details {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.json-summary {
  padding: .65rem 1.25rem;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .4px;
  display: flex;
  align-items: center;
  gap: .4rem;
  user-select: none;
  list-style: none;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
}
.json-summary:hover { color: var(--text-0); }
.json-summary::-webkit-details-marker { display: none; }
.json-output-wrap { max-height: 220px; overflow-y: auto; background: var(--bg-0); }
.json-output {
  font-family: var(--mono);
  font-size: .78rem;
  color: #a3be8c;
  padding: .85rem 1.25rem;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: auto;
  }
  .builder-panel { height: auto; overflow: visible; }
  .panel-scroll { overflow: visible; }
  .preview-panel { border-top: 1px solid var(--border); min-height: 500px; }
  .discord-mock { overflow: visible; }
}

/* ── Fix: inputs inside <details> sections ───────────────────────────── */
.embed-section > div input,
.embed-section > div textarea {
  width: 100%;
  min-width: 0;
  display: block;
}

/* Fix color row — prevent color picker from stretching */
.color-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
}
.color-row .embed-color {
  width: 40px;
  height: 36px;
  flex-shrink: 0;
  padding: 2px 3px;
  cursor: pointer;
}
.color-row .embed-color-hex {
  flex: 1;
  min-width: 0;
}

/* Fix embed card body overflow */
.embed-card-body {
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════
   TABS & NAVIGATION
   ══════════════════════════════════════════════════════════════════════ */
.main-nav {
  display: flex;
  gap: .25rem;
  background: var(--bg-0);
  padding: .2rem;
  border-radius: var(--radius);
}
.nav-tab {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.nav-tab:hover  { color: var(--text-1); background: var(--bg-2); }
.nav-tab.active { color: var(--text-0); background: var(--bg-2); }

.tab-content { display: none; }
.tab-content.active { display: flex; flex-direction: column; flex: 1; }
#tab-webhook.active { display: block; }

/* ══════════════════════════════════════════════════════════════════════
   TOOLS PAGE
   ══════════════════════════════════════════════════════════════════════ */
.tools-page {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-0);
}

/* Tools grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.tool-card-wide { grid-column: span 2; }
@media (max-width: 860px) { .tool-card-wide { grid-column: span 1; } }

/* Tool card */
.tool-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tool-card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.tool-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tool-icon-blurple { background: rgba(88,101,242,.2);  color: #7289da; }
.tool-icon-yellow  { background: rgba(240,178,50,.15); color: var(--yellow); }
.tool-icon-green   { background: rgba(35,165,89,.15);  color: var(--green); }
.tool-icon-red     { background: rgba(218,55,60,.15);  color: var(--red); }
.tool-icon-blurple { background: rgba(88,101,242,.15); color: #8a95f5; }

/* Markdown Reference */
.md-ref-body { display: flex; gap: 0; padding: 0 !important; }
.md-ref-col { flex: 1; padding: 1rem 1.1rem; min-width: 0; }
.md-ref-divider { width: 1px; background: var(--border); flex-shrink: 0; }
.md-ref-group-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--blurple); opacity: .8; margin-bottom: .45rem; }
.md-ref-table { width: 100%; border-collapse: collapse; }
.md-ref-table tr { border-bottom: 1px solid rgba(255,255,255,.04); }
.md-ref-table tr:last-child { border-bottom: none; }
.md-ref-table td { padding: .32rem .2rem; vertical-align: middle; font-size: .84rem; color: var(--text-1); }
.md-ref-table td:first-child { width: 48%; padding-right: .75rem; }
.md-ref-table td:last-child { color: var(--text-0); }
.md-ref-syntax { font-family: var(--mono); font-size: .76rem; color: var(--text-2); background: rgba(0,0,0,.25); padding: .15em .45em; border-radius: 4px; white-space: nowrap; border: 1px solid rgba(255,255,255,.06); }
.md-ref-syntax-pre { display: inline-block; line-height: 1.7; }
.md-ref-pre { margin: 0 !important; padding: .25rem .5rem !important; font-size: .76rem !important; }
.md-ref-bq { display: inline-flex; align-items: center; gap: .4rem; }
.md-ref-bq-bar { width: 3px; height: 1.1em; border-radius: 3px; background: var(--text-3); flex-shrink: 0; }
@media (max-width: 700px) { .md-ref-body { flex-direction: column; } .md-ref-divider { width: auto; height: 1px; } }

.tool-title { font-size: .92rem; font-weight: 800; color: var(--text-0); }
.tool-desc  { font-size: .78rem; color: var(--text-3); margin-top: .1rem; }

.tool-body { padding: 1rem; flex: 1; }

.search-row { display: flex; gap: .5rem; align-items: center; }
.search-row .field-input { flex: 1; min-width: 0; }

/* Tool results */
.tool-result {
  margin-top: .85rem;
  animation: fadeInUp .2s ease;
}
@keyframes fadeInUp { from { opacity:0; transform:translateY(6px); } }

/* ── User profile card ── */
.user-profile {
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.user-banner {
  height: 90px;
  background: linear-gradient(135deg, #5865f2, #7289da);
  position: relative;
}
.user-banner img { width:100%; height:100%; object-fit:cover; }
.user-avatar-wrap {
  position: absolute;
  bottom: -28px;
  left: 16px;
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 4px solid var(--bg-2);
  background: var(--bg-3);
  overflow: hidden;
}
.user-avatar-wrap img { width:100%; height:100%; object-fit:cover; }
.user-avatar-wrap .av-placeholder {
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  font-size: 1.5rem; font-weight: 800; color: white;
  background: var(--blurple);
}
.user-info { padding: 2rem 1rem .85rem; }
.user-name-row { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; margin-bottom:.5rem; }
.user-display-name { font-size: 1.1rem; font-weight: 800; color: var(--text-0); }
.user-handle { font-size: .82rem; color: var(--text-3); font-family: var(--mono); }
.user-bot-badge {
  font-size: .65rem; font-weight: 800; letter-spacing: .3px;
  background: var(--blurple); color: white;
  padding: .1rem .4rem; border-radius: 3px;
}
.user-badges { display:flex; gap:.4rem; flex-wrap:wrap; margin-bottom:.75rem; }
.badge-pill {
  display: flex; align-items: center; gap: .3rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: .2rem .6rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-2);
}
.badge-pill svg { flex-shrink:0; }
.user-meta { display:flex; flex-direction:column; gap:.3rem; }
.user-meta-row { display:flex; gap:.5rem; font-size: .82rem; }
.user-meta-label { color: var(--text-3); font-weight: 700; min-width: 100px; }
.user-meta-value { color: var(--text-1); font-family: var(--mono); font-size: .8rem; word-break:break-all; }

/* ── Snowflake result ── */
.snowflake-result {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .75rem;
  border: 1px solid var(--border);
}

/* ── Timestamp grid ── */
.ts-grid { display:flex; flex-direction:column; gap:.4rem; }
.ts-row {
  display:flex; align-items:center; gap:.5rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: .4rem .6rem;
  border: 1px solid var(--border);
}
.ts-format { font-size:.75rem; color:var(--text-3); font-weight:700; min-width:80px; }
.ts-preview { flex:1; font-size:.83rem; color:var(--text-1); }
.ts-code { font-family:var(--mono); font-size:.75rem; color: var(--blurple); margin-left:auto; cursor:pointer; padding:.15rem .4rem; background:var(--blurple-light); border-radius:3px; border:none; transition:background var(--transition); }
.ts-code:hover { background: rgba(88,101,242,.3); }

/* ── Permissions grid ── */
.perms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .35rem;
  margin-bottom: .75rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: .25rem;
}
.perms-grid::-webkit-scrollbar { width: 4px; }
.perms-grid::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius:4px; }
.perm-item {
  display: flex; align-items: center; gap: .45rem;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-2);
  border: 1px solid transparent;
  transition: all var(--transition);
  user-select: none;
}
.perm-item:hover { background: var(--bg-2); color: var(--text-0); }
.perm-item.active { background: var(--blurple-light); border-color: rgba(88,101,242,.3); color: var(--text-0); }
.perm-item.active .perm-dot { background: var(--blurple); }
.perm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bg-4); flex-shrink:0; transition: background var(--transition); }
.perm-name { font-weight: 600; }
.perms-result {
  font-size: .83rem;
  color: var(--text-2);
  padding: .5rem .6rem;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.perms-result code { font-family: var(--mono); color: var(--blurple); font-size: .85rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity:0; } }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  width: min(400px, 90vw);
  box-shadow: var(--shadow);
}
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:.5rem; }
.modal-header h3 { font-size: .95rem; font-weight: 800; color: var(--text-0); }
.modal-text { font-size: .82rem; color: var(--text-3); line-height: 1.5; }

/* ══════════════════════════════════════════════════════════════════════
   AUTH PAGES (login / register / setup)
   ══════════════════════════════════════════════════════════════════════ */
.auth-body {
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--blurple);
  margin-bottom: 1.25rem;
}
.auth-title { font-size: 1.4rem; font-weight: 800; color: var(--text-0); text-align: center; }
.auth-sub   { color: var(--text-2); text-align: center; font-size: .9rem; margin: .4rem 0 1.25rem; }
.auth-form  { display: flex; flex-direction: column; gap: .9rem; }
.auth-form .btn { margin-top: .4rem; }
.auth-switch { text-align: center; margin-top: 1.1rem; font-size: .88rem; color: var(--text-2); }
.auth-switch a { color: var(--blurple); font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-error {
  background: rgba(218,55,60,.12);
  border: 1px solid var(--red);
  color: #ff9a9d;
  padding: .65rem .85rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ══════════════════════════════════════════════════════════════════════
   USER CHIP (nav)
   ══════════════════════════════════════════════════════════════════════ */
.user-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .6rem .3rem .35rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-1);
}
.user-chip-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--blurple);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 800;
  flex-shrink: 0;
}
.user-chip-badge {
  background: var(--yellow);
  color: #2b2200;
  font-size: .62rem;
  font-weight: 800;
  padding: .1rem .4rem;
  border-radius: 4px;
  letter-spacing: .04em;
}

/* ══════════════════════════════════════════════════════════════════════
   SUBNAV (Webhook / Tools)
   ══════════════════════════════════════════════════════════════════════ */
.subnav {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}
.subnav-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: .5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.subnav-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

/* ══════════════════════════════════════════════════════════════════════
   PAGE CONTAINER (dashboard / admin)
   ══════════════════════════════════════════════════════════════════════ */
.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.page-head { }
.page-title { font-size: 1.6rem; font-weight: 800; color: var(--text-0); }
.page-sub   { color: var(--text-2); margin-top: .35rem; font-size: .92rem; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text-0); }
.stat-label { font-size: .8rem; color: var(--text-3); font-weight: 600; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 860px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .9rem;
}
.empty-state {
  color: var(--text-3);
  font-size: .88rem;
  padding: 1rem 0;
  text-align: center;
}

.data-list { display: flex; flex-direction: column; gap: .5rem; }
.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .85rem;
}
.data-name { font-weight: 700; color: var(--text-0); font-size: .9rem; }
.data-meta { font-size: .76rem; color: var(--text-3); margin-top: .15rem; }

.notice {
  background: var(--blurple-light);
  border: 1px solid var(--blurple);
  color: var(--text-0);
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════
   ADMIN TABLES
   ══════════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 640px;
}
.admin-table th {
  text-align: left;
  padding: .6rem .75rem;
  color: var(--text-3);
  font-weight: 700;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
.admin-table td .user-chip-avatar { margin-right: .4rem; vertical-align: middle; }
.role-badge {
  font-size: .72rem;
  font-weight: 800;
  padding: .15rem .5rem;
  border-radius: 5px;
  text-transform: capitalize;
}
.role-admin { background: var(--yellow); color: #2b2200; }
.role-user  { background: var(--bg-4); color: var(--text-1); }
.tag-self {
  font-size: .68rem;
  background: var(--blurple);
  color: #fff;
  padding: .08rem .4rem;
  border-radius: 4px;
  margin-left: .35rem;
  font-weight: 700;
}
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.mono-cell { font-family: var(--mono); font-size: .78rem; color: var(--text-2); }

/* ══════════════════════════════════════════════════════════════════════
   PROFILE PAGE
   ══════════════════════════════════════════════════════════════════════ */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.profile-avatar-card {
  display: flex;
  flex-direction: column;
}

.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--blurple);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 4px solid var(--bg-1);
  box-shadow: 0 0 0 2px var(--border);
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-large .avatar-placeholder {
  font-size: 3rem;
  font-weight: 800;
  color: white;
  background: var(--blurple);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.avatar-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-3);
  font-size: .85rem;
  font-weight: 600;
}

.info-value {
  color: var(--text-1);
  font-size: .85rem;
}

.notice-success {
  background: rgba(35,165,89,.12);
  border-color: var(--green);
  color: #9ce9b5;
}

.notice-error {
  background: rgba(218,55,60,.12);
  border-color: var(--red);
  color: #ff9a9d;
}

.bio-counter {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .avatar-section {
    flex-direction: column;
    align-items: center;
  }

  .avatar-form {
    max-width: 100%;
  }
}

/* User chip with avatar image support */
.user-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ══════════════════════════════════════════════════════════════════════
   ADMIN USER PAGE
   ══════════════════════════════════════════════════════════════════════ */
.admin-user-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}

.user-edit-badge {
  background: var(--yellow);
  color: #2b2200;
  font-size: .7rem;
  font-weight: 800;
  padding: .25rem .6rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.danger-card {
  border-color: rgba(218,55,60,.3);
  background: rgba(218,55,60,.05);
}

.danger-card .card-title {
  color: var(--red) !important;
}

/* Admin table clickable username */
.user-row-link {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem .4rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.user-row-link:hover {
  background: var(--bg-3);
}

/* Improved row actions spacing */
.row-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ══════════════════════════════════════════════════════════════════════
   IP TRACKING STYLES
   ══════════════════════════════════════════════════════════════════════ */
.date-cell {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.ip-mini {
  font-size: .65rem;
  color: var(--text-3);
  font-family: var(--mono);
}

.ip-cell {
  font-size: .78rem;
}

.ip-info-grid {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}

.ip-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .75rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ip-info-label {
  font-size: .8rem;
  color: var(--text-2);
  font-weight: 600;
}

.ip-info-date {
  font-size: .75rem;
  color: var(--text-3);
  margin-left: .5rem;
}

.ua-cell {
  font-size: .75rem;
  color: var(--text-2);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-success {
  background: rgba(35,165,89,.15);
  color: var(--green);
}

.status-failed {
  background: rgba(218,55,60,.15);
  color: var(--red);
}

/* ══════════════════════════════════════════════════════════════════════
   ENHANCED ADMIN & DASHBOARD COMPONENTS
   ══════════════════════════════════════════════════════════════════════ */

/* Profile Header (banner + avatar) */
.profile-header {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.profile-banner {
  height: 120px;
  background: linear-gradient(135deg, #5865f2, #7289da, #9147ff);
  position: relative;
}
.profile-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.3) 100%);
}
.profile-header-body {
  padding: 0 1.5rem 1.25rem;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  margin-top: -48px;
}
.profile-header-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--blurple);
  border: 4px solid var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.profile-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-header-info {
  flex: 1;
  min-width: 0;
  padding-bottom: 0.25rem;
}
.profile-header-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.profile-header-handle {
  font-size: 0.85rem;
  color: var(--text-3);
  font-family: var(--mono);
  margin-top: 0.1rem;
}
.profile-header-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.profile-header-meta span {
  font-size: 0.78rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Quick Stats Row (compact) */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.quick-stat {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color var(--transition), transform var(--transition);
}
.quick-stat:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.quick-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.quick-stat-icon.blurple { background: var(--blurple-light); }
.quick-stat-icon.green { background: rgba(35,165,89,0.15); }
.quick-stat-icon.red { background: rgba(218,55,60,0.15); }
.quick-stat-icon.yellow { background: rgba(240,178,50,0.15); }
.quick-stat-info {
  display: flex;
  flex-direction: column;
}
.quick-stat-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-0);
  line-height: 1;
}
.quick-stat-label {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 600;
  margin-top: 0.2rem;
}

/* Section Tabs (for page navigation) */
.section-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.section-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.section-tab:hover { color: var(--text-1); background: var(--bg-2); }
.section-tab.active { color: var(--text-0); background: var(--bg-2); }
.section-tab svg { flex-shrink: 0; }
.section-tab .tab-badge {
  background: var(--bg-4);
  color: var(--text-2);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.05rem 0.4rem;
  border-radius: 10px;
  margin-left: 0.2rem;
}

/* Quick Action Cards */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.action-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}
.action-card:hover {
  border-color: var(--blurple);
  background: var(--blurple-light);
  transform: translateY(-2px);
}
.action-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: var(--bg-2);
  transition: background var(--transition);
}
.action-card:hover .action-card-icon { background: var(--bg-3); }
.action-card-info { flex: 1; min-width: 0; }
.action-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-0);
}
.action-card-desc {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 0.15rem;
}

/* Search & Filter Bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filter-bar .field-input {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.filter-bar select.field-input {
  max-width: 160px;
  min-width: 120px;
}

/* Table hover & selection */
.admin-table tbody tr {
  transition: background var(--transition);
}
.admin-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

/* Enhanced empty state */
.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}
.empty-state-text {
  color: var(--text-3);
  font-size: 0.88rem;
  text-align: center;
  padding: 1.5rem;
}

/* Data row with hover */
.data-row {
  transition: all var(--transition);
}
.data-row:hover {
  border-color: var(--border-hover);
  background: var(--bg-3);
}
.data-row .data-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}
.data-row:hover .data-actions {
  opacity: 1;
}

/* User badge with avatar */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--text-0);
}
.user-badge-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blurple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}
.user-badge-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Modal confirmation */
.confirm-modal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: min(400px, 90vw);
  box-shadow: var(--shadow);
}
.confirm-modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-0);
  margin-bottom: 0.5rem;
}
.confirm-modal-text {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}
.confirm-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: color var(--transition);
}
.breadcrumb a:hover { color: var(--text-0); }
.breadcrumb-sep {
  color: var(--text-3);
  font-size: 0.8rem;
}
.breadcrumb-current {
  color: var(--text-0);
  font-size: 0.82rem;
  font-weight: 700;
}

/* Page with tabs layout */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Copy button */
.copy-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}
.copy-btn:hover {
  background: var(--blurple-light);
  color: var(--blurple);
  border-color: var(--blurple);
}

/* Toast improvements */
.toast-container-top {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Animation for cards */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.card-anim {
  animation: cardIn 0.35s ease both;
}
.card-anim-delay-1 { animation-delay: 0.05s; }
.card-anim-delay-2 { animation-delay: 0.1s; }
.card-anim-delay-3 { animation-delay: 0.15s; }

/* Responsive profile header */
@media (max-width: 640px) {
  .profile-header-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .profile-header-meta {
    justify-content: center;
  }
  .profile-header-avatar {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   PAGINATION, SEARCH BAR, EXPORT/IMPORT, WEBHOOK LOGS
   ══════════════════════════════════════════════════════════════════════ */

/* Search bar */
.search-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.search-bar .field-input {
  flex: 1;
  min-width: 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--text-2);
}
.page-info {
  font-weight: 600;
  color: var(--text-1);
  font-family: var(--mono);
  font-size: .78rem;
}

/* Status badge variants */
.status-warning {
  background: rgba(240, 178, 50, 0.15);
  color: var(--yellow);
}

/* Rate limit notice */
.rate-limit-info {
  font-size: .75rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .4rem;
}

/* Export/Import buttons */
.export-import-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Webhook log table */
.webhook-log-url {
  font-size: .75rem;
  color: var(--text-3);
  font-family: var(--mono);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════
   DASHBOARD RICH DATA ROWS
   ══════════════════════════════════════════════════════════════════════ */
.data-row-rich {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .85rem;
  transition: border-color var(--transition), background var(--transition);
  gap: .75rem;
}
.data-row-rich:hover {
  border-color: var(--border-hover);
  background: var(--bg-3);
}
.data-row-rich .data-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.data-row-rich .data-row-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.data-row-rich .data-row-name {
  font-weight: 700;
  color: var(--text-0);
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-row-rich .data-row-date {
  font-size: .72rem;
  color: var(--text-3);
  font-family: var(--mono);
}
.data-row-rich .data-row-url {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .76rem;
  color: var(--text-3);
}
.data-row-rich .data-row-url svg {
  flex-shrink: 0;
  color: var(--text-3);
}
.data-row-rich .data-row-meta {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.data-row-rich .data-actions {
  display: flex;
  gap: .25rem;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.data-row-rich:hover .data-actions {
  opacity: 1;
}

/* Template badge */
.template-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: .12rem .4rem;
  border-radius: 4px;
  background: var(--bg-4);
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* Copy button small */
.copy-btn-sm {
  color: var(--text-3);
  padding: .35rem;
  border-radius: 4px;
  transition: background var(--transition), color var(--transition);
}
.copy-btn-sm:hover {
  background: var(--blurple-light);
  color: var(--blurple);
}
.copy-btn-xs {
  padding: .2rem .5rem;
  font-size: .72rem;
  gap: .3rem;
}

/* Always show actions on mobile */
@media (max-width: 640px) {
  .data-row-rich .data-actions {
    opacity: 1;
  }
}

/* Separator dot in data row header */
.data-row-dot {
  color: var(--text-3);
  font-size: .8rem;
  opacity: 0.5;
  flex-shrink: 0;
  margin: 0 0.2rem;
}

/* Data row header spacing */
.data-row-rich .data-row-name {
  margin-right: 0.2rem;
}

/* Badge variants */
.template-badge.badge-primary {
  background: var(--blurple-light);
  color: var(--blurple);
  border-color: rgba(88,101,242,0.2);
}
.template-badge.badge-secondary {
  background: var(--bg-3);
  color: var(--text-2);
}

/* Webhook row card animation */
.data-row-rich {
  animation: cardIn 0.3s ease both;
}
.data-row-rich:nth-child(1)  { animation-delay: 0.02s; }
.data-row-rich:nth-child(2)  { animation-delay: 0.04s; }
.data-row-rich:nth-child(3)  { animation-delay: 0.06s; }
.data-row-rich:nth-child(4)  { animation-delay: 0.08s; }
.data-row-rich:nth-child(5)  { animation-delay: 0.10s; }
.data-row-rich:nth-child(6)  { animation-delay: 0.12s; }
.data-row-rich:nth-child(7)  { animation-delay: 0.14s; }
.data-row-rich:nth-child(8)  { animation-delay: 0.16s; }

/* Empty history illustration */
.empty-state-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  color: var(--text-3);
  text-align: center;
}
.empty-state-history .icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}
.empty-state-history .text {
  font-size: 0.85rem;
  max-width: 280px;
  line-height: 1.5;
}

/* Admin audit log */
.audit-log-entry {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.audit-log-entry:last-child {
  border-bottom: none;
}
.audit-log-time {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
  flex-shrink: 0;
  width: 110px;
}
.audit-log-action {
  font-weight: 700;
  color: var(--text-0);
  text-transform: uppercase;
  font-size: .7rem;
  flex-shrink: 0;
}
.audit-log-target {
  color: var(--text-2);
  flex: 1;
  min-width: 0;
}

