/* Evil6 dashboard – builds on site.css tokens and components. */

.dash-page { background: var(--bg); }
.page-dashboard .site-footer { margin-top: 0; }

.dash-root { position: relative; }

/* ---------- Demo banner, flashes ---------- */

.dash-demo-banner {
  background: linear-gradient(90deg, rgba(143, 77, 255, 0.18), rgba(255, 46, 77, 0.12));
  border-bottom: 1px solid rgba(143, 77, 255, 0.3);
}
.dash-demo-inner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  max-width: 1440px; margin: 0 auto; padding: 10px var(--gutter);
  font-size: 0.9rem;
}
.dash-demo-inner p { margin: 0; flex: 1 1 240px; color: var(--text); }
.dash-demo-inner form { margin: 0; }
.dash-flashes { padding-top: 16px; }
.dash-flashes .callout { margin: 0 0 8px; }

/* ---------- Centered pages: login, messages ---------- */

.dash-center {
  display: grid; place-items: center;
  min-height: calc(100vh - var(--header-h) - 120px);
  padding: 48px var(--gutter);
  background:
    radial-gradient(520px 260px at 50% 0%, rgba(255, 46, 77, 0.14), transparent 70%),
    radial-gradient(420px 220px at 80% 90%, rgba(143, 77, 255, 0.12), transparent 70%);
}
.dash-login, .dash-message { width: 100%; max-width: 440px; text-align: center; padding: 36px 28px; }
.dash-login h1, .dash-message h1 { font-size: 1.9rem; margin-bottom: 8px; }
.dash-login .btn { margin-top: 12px; }
.dash-login .callout { text-align: left; margin-top: 20px; }
.dash-login-logo { margin: 0 auto 16px; border-radius: 18px; box-shadow: 0 12px 36px -12px rgba(255, 46, 77, 0.6); }
.dash-login-note { margin: 12px 0 0; }
.dash-message .row { justify-content: center; margin-top: 20px; }
.dash-discord-icon { display: inline-block; }

/* ---------- Server picker ---------- */

.dash-picker { padding-top: clamp(32px, 5vw, 56px); padding-bottom: 80px; }
.dash-picker-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.dash-picker-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 6px; }
.dash-picker-head p { margin: 0; }
.dash-picker-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-picker-actions form { margin: 0; }
.dash-guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.dash-guild-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 24px 18px 18px;
  transition: border-color 0.2s, transform 0.2s;
}
.dash-guild-card.has-bot { border-color: rgba(255, 46, 77, 0.28); }
.dash-guild-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.dash-guild-card h2 {
  font-size: 1.05rem; margin: 4px 0 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-guild-card .btn { margin-top: auto; }
.dash-guild-card .badge { margin-bottom: 6px; }
.dash-empty-state { text-align: center; padding: 40px 24px; }

/* ---------- Guild icons, user chip ---------- */

.dash-gicon {
  flex: none; display: grid; place-items: center; overflow: hidden;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-3); color: #fff; font: 700 0.95rem/1 var(--font-display);
}
.dash-gicon img { width: 100%; height: 100%; object-fit: cover; }
.dash-gicon.is-initials { background: linear-gradient(135deg, var(--surface-3), #3a2a5a); }
.dash-gicon-lg { width: 44px; height: 44px; }
.dash-gicon-xl { width: 72px; height: 72px; border-radius: 20px; font-size: 1.4rem; }

.dash-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dash-user img { width: 28px; height: 28px; border-radius: 50%; }
.dash-user-name { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.dash-user form { margin: 0; }

/* ---------- App shell ---------- */

.dash { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.dash-side {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 14px 24px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 14px;
}
.dash-side-guild { display: flex; align-items: center; gap: 12px; padding: 0 6px; min-width: 0; }
.dash-side-guild-text { display: grid; min-width: 0; }
.dash-side-guild-text strong { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-side-guild-text span { font-size: 0.82rem; color: var(--text-dim); }
.dash-switch { min-height: 38px; font-size: 0.88rem; }

.dash-nav ul { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.dash-nav-title { margin: 14px 10px 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.dash-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--text-muted); font-weight: 500; font-size: 0.93rem;
}
.dash-nav a:hover { background: var(--surface); color: #fff; text-decoration: none; }
.dash-nav a[aria-current="page"] { background: var(--accent-soft); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.dash-nav-icon { width: 22px; text-align: center; font-size: 1rem; }
.dash-soon-dot {
  margin-left: auto; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: #b98bff; background: var(--violet-soft); padding: 1px 7px; border-radius: 999px;
}
.dash-side-foot { margin-top: auto; display: grid; gap: 6px; padding: 12px 10px 0; border-top: 1px solid var(--border); font-size: 0.86rem; }
.dash-side-foot a { color: var(--text-muted); }

.dash-main { min-width: 0; display: flex; flex-direction: column; }
.dash-top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.dash-menu-btn { display: none; }
.dash-crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; color: var(--text-dim); min-width: 0; flex: 1; }
.dash-crumbs a { color: var(--text-muted); }
.dash-crumbs [aria-current] { color: #fff; }
.dash-top .dash-user { margin-left: auto; }

.dash-content { width: 100%; max-width: 1000px; padding: 28px clamp(16px, 3vw, 40px) 120px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.dash-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin: 0 0 6px; }
.dash-docs-link { font-size: 0.9rem; font-weight: 600; }
.dash-subtitle { font-size: 1.15rem; margin: 32px 0 14px; }

.dash-backdrop { display: none; }

@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-side {
    position: fixed; z-index: 60; top: 0; left: 0; bottom: 0;
    width: min(300px, 86vw); height: auto;
    transform: translateX(-100%); transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .dash.is-side-open .dash-side { transform: none; }
  .dash-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5, 3, 12, 0.6); }
  .dash-backdrop[hidden] { display: none; }
  .dash-menu-btn { display: inline-flex; }
  .dash-top { flex-wrap: wrap; gap: 10px; }
  .dash-top .dash-user-name { display: none; }
  .dash-crumbs { order: 3; flex-basis: 100%; }
}

/* ---------- Cards & fields ---------- */

.dash-card { padding: 22px 24px; margin-bottom: 18px; }
.dash-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.dash-card h2 { font-size: 1.15rem; margin: 0 0 4px; }
.dash-card-head p { margin: 0; font-size: 0.92rem; }
.dash-fields > .field:last-child { margin-bottom: 0; }
.dash-fields.grid { gap: 0 20px; }
.dash-fields + .dash-preview, .dash-fields + * { margin-top: 18px; }

.dash-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.dash-toggle-row:first-child { padding-top: 0; }
.dash-fields > .dash-toggle-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-fields > .dash-toggle-row + .field { margin-top: 16px; }
.dash-toggle-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.dash-toggle-text .help { flex-basis: 100%; }
.dash-toggle-row .label { font-weight: 600; }
.dash-inline-link { font-size: 0.84rem; font-weight: 600; }

.dash-input-group { display: flex; align-items: stretch; max-width: 260px; }
.dash-input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.dash-suffix {
  display: inline-flex; align-items: center; padding: 0 12px;
  border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 9px 9px 0;
  background: var(--surface-2); color: var(--text-muted); font-size: 0.88rem; white-space: nowrap;
}
.dash-field-error { color: var(--crit); font-size: 0.84rem; font-weight: 600; }
.is-invalid .input, .is-invalid .select, .is-invalid .textarea, .is-invalid.seg, .is-invalid.dash-multi { border-color: var(--crit); }

.dash-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dash-count { font-size: 0.8rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.dash-count.is-near { color: var(--warn); }

.dash-placeholders { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.dash-ph {
  font: 0.78rem/1.4 var(--font-mono); color: #ffb3c0; background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 6px; padding: 3px 8px; cursor: pointer;
}
.dash-ph:hover { background: rgba(255, 46, 77, 0.22); }

.dash-preview { margin-top: 18px; }
.dash-preview .dc { grid-template-columns: 1fr; box-shadow: none; }
.dash-preview .dc-chat { padding: 12px 16px 14px; }
.dash-preview .dc-text:empty { display: none; }
.dc-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }

/* Multi-select chips */
.dash-multi {
  display: grid; gap: 8px; padding: 8px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-elev);
}
.dash-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dash-chips:empty::before { content: attr(data-empty); color: var(--text-dim); font-size: 0.86rem; padding: 2px 4px; }
.dash-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 4px 2px 10px; font-size: 0.86rem;
}
.dash-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-chip button {
  width: 22px; height: 22px; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--text-muted); font-size: 1rem; line-height: 1;
}
.dash-chip button:hover { background: var(--crit-soft); color: var(--crit); }
.dash-multi-add { display: flex; gap: 8px; }
.dash-multi-add .input, .dash-multi-add .select { min-height: 36px; font-size: 0.9rem; }

/* ---------- Overview ---------- */

.dash-hero { display: flex; align-items: center; gap: 20px; }
.dash-hero h2 { font-size: 1.5rem; margin-bottom: 10px; }
.dash-perm-list { margin: 0 0 10px; padding-left: 1.2em; }
.dash-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 24px; }
.dash-module { display: flex; align-items: center; gap: 12px; padding: 16px; }
.dash-module-name { font-weight: 600; color: #fff; flex: 1; min-width: 0; }
.dash-module-icon {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; background: var(--surface-2); font-size: 1.1rem;
}
.dash-tips .dash-card { margin-bottom: 0; }
.dash-list { margin: 0; padding-left: 1.2em; color: var(--text-muted); display: grid; gap: 8px; font-size: 0.93rem; }

/* ---------- Coming soon ---------- */

.dash-soon { border-style: dashed; border-color: rgba(143, 77, 255, 0.35); background: linear-gradient(180deg, rgba(143, 77, 255, 0.06), transparent 60%), var(--surface); }
.dash-soon h2 { margin-top: 10px; }
.dash-soon-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin: 0 0 8px; }
.dash-cmds { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; font-size: 0.92rem; }
.dash-cmds li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }

/* ---------- AutoMod, gulag, leveling ---------- */

.dash-rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash-rule { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.dash-rule p { margin: 2px 0 0; font-size: 0.88rem; }
@media (max-width: 640px) { .dash-rule-grid { grid-template-columns: 1fr; } }

.dash-gulag-status.is-active { border-color: rgba(61, 214, 140, 0.3); }
.dash-gulag-status p { margin-bottom: 8px; }

.dash-rewards { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.dash-rewards li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev); }
.dash-reward-level { font-weight: 700; min-width: 80px; font-variant-numeric: tabular-nums; }
.dash-role-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 0.86rem; font-weight: 600; color: var(--role-color);
  background: color-mix(in srgb, var(--role-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--role-color) 40%, transparent);
}
.dash-lb-user { display: inline-flex; align-items: center; gap: 10px; }
.dash-lb-user img { border-radius: 50%; }
.dash-rank { font-weight: 700; color: var(--text-muted); }
.dash-rank.is-top { color: var(--warn); }

/* ---------- Logging ---------- */

.dash-log-cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.dash-log-cats .dash-card { margin-bottom: 0; }
.dash-log-cat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.dash-log-cat-head h3 { margin: 0; font-size: 1.05rem; }
.dash-log-cat .field { margin-bottom: 12px; }
.dash-log-events-title { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.dash-log-events .dash-toggle-row { padding: 8px 0; }
.dash-log-events .dash-toggle-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-log-events .label { font-weight: 500; font-size: 0.92rem; }
.dash-toggle-row.is-below .label { text-decoration: line-through; text-decoration-color: var(--text-dim); color: var(--text-dim); }
.dash-below-note { font-size: 0.75rem; color: var(--text-dim); }
@media (max-width: 760px) { .dash-log-cats { grid-template-columns: 1fr; } }

/* ---------- Tables, filters, pager ---------- */

.dash-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dash-filter .input, .dash-filter .select { width: auto; flex: 1 1 180px; min-height: 36px; font-size: 0.9rem; }
.dash-filter .select { flex: 0 1 200px; }
.dash-table td { font-size: 0.9rem; }
.dash-person { display: grid; line-height: 1.3; }
.dash-person strong { color: #fff; font-weight: 600; }
.dash-person small { color: var(--text-dim); font-size: 0.75rem; font-family: var(--font-mono); }
.dash-nowrap { white-space: nowrap; }
.dash-empty { color: var(--text-dim); margin: 8px 0 0; }
.dash-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.dash-pager-info { color: var(--text-dim); font-size: 0.86rem; }

@media (max-width: 640px) {
  .dash-table thead { display: none; }
  .dash-table, .dash-table tbody, .dash-table tr, .dash-table td { display: block; width: 100%; }
  .dash-table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .dash-table tr:last-child { border-bottom: 0; }
  .dash-table td { border: 0; padding: 3px 0; text-align: left; }
  .dash-table td::before { content: attr(data-label); display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
  .dash-table td.num { text-align: left; }
  .dash-lb td::before { display: inline; margin-right: 8px; }
  .dash-hero { flex-direction: column; align-items: flex-start; }
}

/* ---------- Save bar, toasts ---------- */

.dash-savebar {
  position: fixed; z-index: 70; left: 50%; bottom: 20px;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px 12px 18px;
  background: rgba(29, 23, 51, 0.96); backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: dash-up 0.2s ease-out;
}
.dash-savebar[hidden] { display: none; }
.dash-savebar-text { display: grid; gap: 2px; min-width: 0; }
.dash-savebar-note { font-size: 0.8rem; color: var(--text-muted); }
.dash-savebar-actions { display: flex; gap: 8px; margin-left: auto; }
.dash-savebar.is-shake { animation: dash-shake 0.35s; }

.dash-toasts {
  position: fixed; z-index: 80; top: calc(var(--header-h) + 12px); right: 16px;
  display: grid; gap: 8px; width: min(360px, calc(100% - 32px)); pointer-events: none;
}
.dash-toast {
  pointer-events: auto; padding: 12px 16px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 0.92rem; animation: dash-in 0.2s ease-out;
  border-left: 4px solid var(--info);
}
.dash-toast.is-ok { border-left-color: var(--ok); }
.dash-toast.is-error { border-left-color: var(--crit); }
.dash-toast-action { display: inline-block; margin-left: 8px; font-weight: 700; }
.dash-toast.is-leaving { opacity: 0; transform: translateX(12px); transition: opacity 0.25s, transform 0.25s; }

@keyframes dash-up { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes dash-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes dash-shake { 0%, 100% { transform: translateX(-50%); } 25% { transform: translateX(calc(-50% - 6px)); } 75% { transform: translateX(calc(-50% + 6px)); } }

@media (max-width: 480px) {
  .dash-card { padding: 18px 16px; }
  .dash-cmds .cmd { white-space: normal; overflow-wrap: anywhere; }
  .dash-savebar-actions { width: 100%; }
  .dash-savebar-actions .btn { flex: 1; }
}

/* ---------- IDs, removed rows, misc ---------- */

.dash-id { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.dash-id code { font-size: 0.8rem; background: var(--bg-elev); color: var(--text-muted); overflow-wrap: anywhere; }
.dash-copy {
  flex: none; width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim); font-size: 0.85rem; line-height: 1;
}
.dash-copy:hover { color: #fff; border-color: var(--border-strong); }
.dash-copy.is-copied { color: var(--ok); border-color: rgba(61, 214, 140, 0.4); }
.dash-table tr.is-removed td { opacity: 0.55; }
.dash-table tr.is-removed td:nth-child(2) { text-decoration: line-through; text-decoration-color: var(--text-dim); }
.dash-table tr.is-removed .badge { text-decoration: none; }
.dash-extra { display: block; color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }
.dash-mono { font-family: var(--font-mono); }
.dash-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-muted); cursor: pointer; }
.dash-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.seg.is-disabled { opacity: 0.5; }
.seg.is-disabled label { cursor: not-allowed; }
.dash-updated { margin: 10px 0 0; font-size: 0.85rem; }
.dash-guild-members { font-size: 0.82rem; }
.dash-reward-xp { margin-left: auto; white-space: nowrap; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.dash-lb-user.is-gone img { opacity: 0.5; }
.dash-lb-user.is-gone > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dash-preview-default { margin: 4px 0 0; color: var(--dc-muted); font-style: italic; font-size: 0.88rem; }
.dash-toggle-row .dash-field-error { flex-basis: 100%; }
.dash-toggle-row:has(.dash-field-error:not([hidden])) { flex-wrap: wrap; }
