/* DASHBOARD MODULE — DO NOT MODIFY BOT LOGIC */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
  --bg-base: #1d1f24;
  --bg-sidebar: #202329;
  --bg-surface: #34383f;
  --bg-elevated: #2a2e35;
  --border: #2a2e35;
  --border-subtle: #3c4149;
  --text-primary: #f2f3f5;
  --text-secondary: #c3c7cf;
  --text-muted: #8b9098;
  --text-hint: #646973;
  --accent: #7f00ff;
  --accent-hover: #6a00d6;
  --accent-warm: #bf80ff;
  --accent-warm-hover: #a64dff;
  --green: #3ba55c;
  --yellow: #bf80ff;
  --red: #ed4245;
  --field-bg: #24272d;
  --field-bg-focus: #1f2227;
  --field-border: #1e2126;
  --field-border-hover: #50545d;
  --field-border-focus: rgba(191, 128, 255, 0.9);
  --field-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(127, 0, 255, 0.14), transparent 28%),
    radial-gradient(circle at bottom left, rgba(59, 165, 92, 0.08), transparent 22%),
    var(--bg-base);
  color: var(--text-primary);
  font: 400 14px/1.5 var(--font-sans);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

body[data-authenticated="1"] {
  background: linear-gradient(180deg, #262a31 0%, #2f333a 100%);
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

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

img,
canvas {
  max-width: 100%;
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 16px;
  border-right: 1px solid var(--border-subtle);
  background:
    linear-gradient(180deg, rgba(127, 0, 255, 0.08), transparent 24%),
    var(--bg-sidebar);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  overflow: hidden;
  transition: transform 0.2s ease, width 0.2s ease, flex-basis 0.2s ease;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(5, 7, 10, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 15;
}

.sidebar-brand,
.brand-link,
.user-panel,
.panel-header,
.topbar,
.metric-card,
.server-card,
.command-line,
.bar-meta,
.dynamic-row,
.console-input-row,
.table-row,
.log-row {
  display: flex;
  align-items: center;
}

.sidebar-brand {
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.brand-link {
  gap: 12px;
  min-width: 0;
}

.brand-avatar,
.brand-fallback,
.login-logo,
.user-avatar,
.user-fallback,
.topbar-avatar,
.server-avatar,
.server-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-elevated);
}

.brand-copy,
.user-copy,
.topbar-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-copy strong,
.user-copy strong,
.topbar h1,
.panel h2,
.panel h3,
.metric-card strong,
.invite-card h2,
.login-card h1 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-copy small,
.panel-label,
.metric-label,
.eyebrow,
.nav-group-label,
.field-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text-secondary);
  margin: 4px auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--text-secondary);
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-icon {
  width: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item:hover .nav-icon,
.nav-item.is-active .nav-icon {
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  min-width: 0;
  box-sizing: border-box;
}

.guild-selector,
.control-input,
.control-select,
input[type="text"],
input[type="number"],
input[type="search"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="tel"],
select:not([multiple]),
textarea {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--field-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.06)), var(--field-bg);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 14px 16px;
  outline: none;
  box-shadow: var(--field-shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.guild-selector:hover,
.control-input:hover,
.control-select:hover,
input[type="text"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="password"]:hover,
input[type="url"]:hover,
input[type="email"]:hover,
input[type="tel"]:hover,
select:not([multiple]):hover,
textarea:hover {
  border-color: var(--field-border-hover);
}

.control-input:focus,
.control-select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:not([multiple]):focus,
textarea:focus {
  border-color: var(--field-border-focus);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(0, 0, 0, 0.08)), var(--field-bg-focus);
  box-shadow: 0 0 0 3px rgba(127, 0, 255, 0.16), var(--field-shadow);
}

.guild-selector::placeholder,
.control-input::placeholder,
input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
input[type="password"]::placeholder,
input[type="url"]::placeholder,
input[type="email"]::placeholder,
input[type="tel"]::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.control-select,
select:not([multiple]) {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1.25 1.5L7 7.25L12.75 1.5' stroke='%238b9098' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: calc(100% - 16px) 50%;
  background-size: 14px 9px;
  background-repeat: no-repeat;
  padding-right: 44px;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

select[multiple] {
  width: 100%;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 12px;
}

select option {
  background: #202329;
  color: var(--text-primary);
}

/* Keep the sidebar profile row stable even with long Discord handles. */
.user-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.user-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.sidebar-user-name,
.sidebar-user-handle {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.sidebar-user-name {
  font-size: 13px;
}

.sidebar-user-handle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}

.button-compact {
  min-height: 36px;
  padding: 8px 10px;
}

.logout-form {
  display: contents;
}

.user-logout,
.topbar-logout {
  white-space: nowrap;
}

.user-logout {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.user-logout .button-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-logout {
  display: none;
}

.main-shell {
  margin-left: 248px;
  width: calc(100% - 248px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  min-height: 50px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(13, 14, 17, 0.78);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-leading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.topbar-sidebar-toggle {
  flex: 0 0 auto;
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 25px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--text-secondary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-badge,
.pill,
.status-pill,
.log-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 600;
}

.mode-badge {
  background: rgba(127, 0, 255, 0.16);
  color: #bf80ff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  border-color: rgba(160, 0, 255, 0.25);
  background: linear-gradient(180deg, #a64dff 0%, #7f00ff 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.button-primary:hover {
  background: linear-gradient(180deg, #b366ff 0%, #8c1aff 100%);
}

.button-secondary,
.button-ghost {
  border-color: rgba(127, 0, 255, 0.2);
  background: rgba(127, 0, 255, 0.05);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.button-secondary:hover,
.button-ghost:hover {
  border-color: rgba(127, 0, 255, 0.4);
  background: rgba(127, 0, 255, 0.12);
}

.button-block {
  width: 100%;
}

.page-body,
.public-shell {
  padding: 24px;
  min-width: 0;
}

.page-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}

.flash-stack,
.metrics-grid,
.dashboard-grid,
.config-layout,
.bars-list,
.server-grid,
.command-list,
.ranking-list,
.stacked-controls,
.allowed-tables,
.inline-actions {
  display: grid;
}

.flash-stack {
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.flash-error {
  border-color: rgba(237, 66, 69, 0.25);
  color: #ffb4b6;
}

.flash-success {
  border-color: rgba(59, 165, 92, 0.25);
  color: #9be0af;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 22px;
  margin-bottom: 24px;
  grid-auto-rows: 1fr;
}

.metric-card,
.panel,
.invite-card,
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.metric-card {
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 20px;
  min-height: 138px;
}

.metric-card strong {
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1;
}

.metric-card small,
.panel p,
.log-copy small,
.invite-card p,
.empty-card p,
.login-card p {
  color: var(--text-secondary);
}

.dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: stretch;
}

.dashboard-grid-overview {
  align-items: start;
}

.panel {
  padding: 20px;
  overflow: hidden;
  min-width: 0;
}

.panel-fill {
  display: flex;
  flex-direction: column;
}

.config-form,
.preview-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(0, 0, 0, 0.06)), var(--bg-surface);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.panel-subtle {
  background: rgba(255, 255, 255, 0.015);
}

.panel-span-2 {
  grid-column: span 2;
}

.panel-span-3 {
  grid-column: 1 / -1;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header.compact {
  margin-bottom: 12px;
}

.panel-header h2,
.panel-header h3,
.invite-card h2 {
  margin: 4px 0 0;
}

.panel-actions,
.segmented,
.console-table-wrap {
  display: flex;
}

.panel-actions,
.inline-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.segmented {
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.segmented-item {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
}

.segmented-item.is-active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.live-log-feed,
.command-list,
.ranking-list,
.console-output {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-log-feed,
.console-output {
  max-height: 420px;
  overflow-y: auto;
}

.log-row,
.table-row,
.server-card,
.command-item,
.ranking-row,
.dynamic-row,
.message-preview,
.empty-card {
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  min-width: 0;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.server-card:hover,
.command-item:hover,
.ranking-row:hover,
.empty-card:hover {
  border-color: rgba(88, 101, 242, 0.26);
  background: rgba(255, 255, 255, 0.032);
  transform: translateY(-1px);
}

.table-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1.4fr) minmax(0, 1fr) 160px;
  align-items: center;
}

.logs-table {
  display: grid;
  gap: 10px;
}

.table-head {
  display: grid;
  grid-template-columns: 90px minmax(0, 1.4fr) minmax(0, 1fr) 160px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 12px;
}

.table-body {
  display: grid;
  gap: 10px;
}

.panel-body-fill {
  flex: 1;
  min-height: 0;
}

.bars-list.panel-body-fill,
.server-grid.panel-body-fill,
.table-body.panel-body-fill {
  align-content: stretch;
}

.panel-body-fill > .empty-card {
  min-height: 100%;
  align-content: center;
}

.log-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.badge-cmd {
  background: #1a2b4a;
  color: #bf80ff;
}

.badge-event {
  background: #1a2a1a;
  color: #74d38f;
}

.badge-err {
  background: #2a1a1a;
  color: #ff8d90;
}

.badge-warn {
  background: #2a2218;
  color: #ffc961;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-meta {
  justify-content: space-between;
  gap: 12px;
}

.bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #bf80ff);
}

.server-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.dashboard-grid-overview .server-grid {
  grid-template-columns: 1fr;
}

.dashboard-grid-overview .chart-shell {
  min-height: 320px;
}

.owner-dashboard-grid .chart-shell {
  min-height: 330px;
}

.owner-dashboard-grid .stacked-controls {
  align-content: start;
}

.chart-shell {
  position: relative;
  width: 100%;
  min-height: 250px;
}

.chart-shell-compact {
  min-height: 220px;
}

.chart-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.config-layout {
  gap: 26px;
  align-items: start;
}

.config-layout.two-columns {
  grid-template-columns: minmax(0, 1.16fr) minmax(360px, 0.94fr);
  align-items: start;
}

.config-form {
  min-height: 100%;
}

.preview-card {
  min-height: auto;
  align-self: start;
  position: sticky;
  top: 92px;
}

.config-form .panel-header,
.preview-card .panel-header {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.config-form .panel-header h2 {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.05;
}

.preview-card .panel-header h3 {
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.field {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  min-width: 0;
}

.field > span {
  font-size: 14px;
  font-weight: 700;
  color: #d8dbe0;
  letter-spacing: -0.01em;
  text-transform: none;
}

.field input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 54px;
  height: 30px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #26292e;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f4f5f6;
  transition: transform 0.18s ease;
}

.field input[type="checkbox"]:checked {
  background: var(--accent-warm);
  border-color: rgba(191, 128, 255, 0.7);
}

.field input[type="checkbox"]:checked::after {
  transform: translateX(24px);
}

.field input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(127, 0, 255, 0.18);
}

.field-span-2 {
  grid-column: span 2;
}

.section-divider {
  margin: 26px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.form-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-pill {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.status-pill.is-pending {
  background: rgba(127, 0, 255, 0.12);
  color: var(--yellow);
}

.status-pill.is-success {
  background: rgba(59, 165, 92, 0.12);
  color: var(--green);
}

.status-pill.is-error {
  background: rgba(237, 66, 69, 0.12);
  color: var(--red);
}

.switch {
  position: relative;
  width: 58px;
  height: 32px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #26292e;
  box-shadow: var(--field-shadow);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f4f5f6;
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-ui {
  background: var(--accent-warm);
  border-color: rgba(191, 128, 255, 0.7);
}

.switch input:checked + .switch-ui::after {
  transform: translateX(26px);
}

.dynamic-list,
.ranking-list,
.stacked-controls,
.allowed-tables {
  gap: 10px;
}

.dynamic-row {
  grid-template-columns: 1fr auto;
}

.message-preview {
  display: grid;
  gap: 14px;
}

.message-preview strong {
  font-size: 16px;
}

.preview-stack {
  display: grid;
  gap: 18px;
}

.discord-preview-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(88, 101, 242, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.02);
}

.discord-message {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.discord-message-avatar,
.discord-message-avatar-fallback,
.discord-embed-image-avatar,
.discord-embed-image-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.discord-message-avatar-fallback,
.discord-embed-image-avatar-fallback {
  display: inline-grid;
  place-items: center;
  background: rgba(88, 101, 242, 0.18);
  color: #d3dbff;
  font-weight: 700;
}

.discord-message-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.discord-message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.discord-message-author {
  color: #8ea3ff;
  font-size: 15px;
  font-weight: 700;
}

.discord-message-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.discord-message-time {
  color: var(--text-muted);
  font-size: 12px;
}

.discord-message-content,
.discord-embed-description {
  margin: 0;
  min-width: 0;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.discord-message-content {
  -webkit-line-clamp: 2;
}

.discord-embed-description {
  -webkit-line-clamp: 4;
}

.discord-inline-mention {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(88, 101, 242, 0.16);
  color: #c7d1ff;
  font-weight: 600;
}

.discord-embed {
  position: relative;
  padding-left: 14px;
  min-width: 0;
}

.discord-embed::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8ea3ff, var(--accent));
}

.discord-embed-body {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 2px 0;
}

.discord-embed-title {
  font-size: 14px;
  font-weight: 700;
}

.discord-embed-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(88, 101, 242, 0.28), rgba(30, 32, 40, 0.82)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

.discord-embed-image-art {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 100%;
  height: 100%;
  padding: 18px;
}

.discord-embed-image-avatar,
.discord-embed-image-avatar-fallback {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.discord-embed-image-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.discord-embed-image-kicker {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.discord-embed-image-copy strong,
.discord-embed-image-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discord-embed-image-copy small {
  color: rgba(255, 255, 255, 0.84);
}

.discord-embed-edit {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(13, 14, 17, 0.84);
  color: #fff;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.discord-embed-image:hover .discord-embed-edit {
  opacity: 1;
  transform: translateY(0);
}

.discord-embed-edit:hover {
  background: rgba(30, 32, 40, 0.96);
}

.discord-message-empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.discord-preview-field {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.discord-preview-field-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.discord-preview-field-value {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.5;
}

.discord-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.discord-button-preview,
.discord-select-preview,
.discord-role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-weight: 600;
}

.discord-button-preview {
  padding: 0 14px;
}

.discord-button-preview-primary {
  background: linear-gradient(135deg, #5865f2, #7d6bff);
  border-color: rgba(125, 107, 255, 0.45);
  color: #fff;
}

.discord-button-preview-danger {
  background: rgba(237, 66, 69, 0.18);
  border-color: rgba(237, 66, 69, 0.35);
  color: #ffb3b4;
}

.discord-select-preview {
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
}

.discord-role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.discord-role-pill {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(88, 101, 242, 0.14);
  color: #d7ddff;
}

.discord-role-pill-muted {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.summary-row strong,
.summary-row span,
.summary-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-card {
  margin-top: 16px;
}

.conversation-preview-body,
.conversation-preview-meta {
  display: flex;
  min-width: 0;
}

.conversation-preview-body {
  flex-direction: column;
  gap: 6px;
}

.conversation-preview-meta {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.conversation-preview-message {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.conversation-preview-attachment,
.conversation-preview-hint {
  color: var(--text-secondary);
  font-size: 12px;
}

.conversation-preview-hint {
  display: block;
}

.search-input {
  max-width: 280px;
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.command-item p {
  margin: 0;
}

.owner-console {
  min-height: 72vh;
}

.console-output,
.console-input,
.console-prompt {
  font-family: var(--font-mono);
  font-size: 12px;
}

.console-output {
  padding: 14px;
  background: #0a0b0e;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.console-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.console-muted {
  color: var(--text-muted);
}

.console-success {
  color: #8be6a7;
}

.console-error {
  color: #ff8d90;
}

.console-warn {
  color: #ffc961;
}

.console-keyword {
  color: #6ea8ff;
}

.console-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding: 12px 16px;
  background: #050608;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.console-prompt {
  color: var(--accent);
  font-weight: 700;
}

.console-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  min-height: auto !important;
  box-shadow: none !important;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

.console-input-echo {
  color: #8ea3ff; /* Couleur pour l'écho de la commande tapée */
}

.console-table {
  width: 100%;
  border-collapse: collapse;
}

.console-table th,
.console-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}

.invite-page,
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.invite-card,
.login-card {
  width: min(100%, 420px);
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

.invite-card {
  width: min(100%, 560px);
}

.invite-page-shell {
  width: min(100%, 1160px);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  place-items: stretch;
  gap: 24px;
}

.invite-page-shell .invite-card {
  width: 100%;
}

.invite-card-hero {
  padding: 32px;
  background:
    radial-gradient(circle at top right, rgba(127, 0, 255, 0.22), transparent 34%),
    radial-gradient(circle at bottom left, rgba(59, 165, 92, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.12)),
    var(--bg-surface);
}

.invite-side-card {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
}

.invite-side-card h3 {
  margin: 6px 0 0;
  font-size: 24px;
}

.invite-brand-row,
.invite-brand-lockup,
.invite-cta-row,
.chart-legend,
.chart-legend-item {
  display: flex;
  align-items: center;
}

.invite-brand-row {
  justify-content: space-between;
  gap: 18px;
}

.invite-brand-lockup {
  gap: 18px;
  min-width: 0;
}

.invite-brand-avatar {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.invite-lead,
.invite-helper-text {
  color: var(--text-secondary);
}

.invite-highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0 24px;
}

.invite-highlight-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.invite-highlight-card strong {
  font-size: 15px;
}

.invite-highlight-card span {
  color: var(--text-secondary);
  line-height: 1.55;
}

.invite-cta-row {
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.login-brand {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
  margin-bottom: 22px;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 20px;
}

.login-logo-fallback,
.brand-fallback,
.user-fallback,
.server-avatar-fallback {
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.login-separator {
  position: relative;
  margin: 18px 0;
  text-align: center;
  color: var(--text-muted);
}

.login-separator::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--border);
}

.login-separator span {
  position: relative;
  background: var(--bg-surface);
  padding: 0 10px;
}

.login-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  color: var(--text-muted);
}

.invite-url {
  display: block;
  margin-top: 14px;
  padding: 14px;
  overflow-wrap: anywhere;
}

.chart-legend {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chart-legend-item {
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.chart-swatch-blue {
  background: #7d9bff;
}

.chart-swatch-red {
  background: #ff7f8c;
}

.chart-swatch-green {
  background: #74d38f;
}

.dashboard-grid-activity,
.owner-dashboard-grid {
  align-items: start;
}

.owner-dashboard-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.85fr) minmax(0, 0.85fr);
}

.owner-metrics-grid .metric-card,
.metrics-grid-activity .metric-card {
  min-height: 148px;
}

.empty-card {
  display: grid;
  align-content: start;
}

.empty-emoji {
  font-size: 20px;
}

.brand-copy strong,
.brand-copy small,
.topbar h1,
.topbar p,
.metric-card strong,
.metric-card small,
.panel h2,
.panel h3,
.panel p,
.panel-label,
.field > span,
.field option,
.table-row > span,
.table-head > span,
.log-copy strong,
.log-copy small,
.command-item p,
.server-card strong,
.server-card small,
.ranking-row strong,
.ranking-row small,
.invite-card h2,
.invite-card p,
.login-card h1,
.login-card p,
.flash,
.mode-badge,
.pill,
.status-pill,
.log-badge,
.button,
.conversation-preview-message,
.conversation-preview-attachment,
.empty-card,
code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-row > span,
.table-head > span {
  min-width: 0;
}

.metric-card,
.panel,
.invite-card,
.login-card,
.flash {
  animation: surface-in 0.24s ease both;
}

@keyframes surface-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 220px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(59, 165, 92, 0.25);
}

.toast-error {
  border-color: rgba(237, 66, 69, 0.25);
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .command-grid,
  .config-layout.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-span-2 {
    grid-column: span 2;
  }

  .panel-span-3 {
    grid-column: 1 / -1;
  }

  .invite-page-shell {
    grid-template-columns: 1fr;
    max-width: 760px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 84px;
    flex-basis: 84px;
    padding-inline: 10px;
  }

  .sidebar .brand-copy,
  .sidebar .nav-group-label,
  .sidebar .user-copy,
  .sidebar .field-label,
  .sidebar .guild-selector,
  .sidebar .button-label {
    display: none;
  }

  .sidebar .brand-link,
  .sidebar .nav-item {
    justify-content: center;
  }

  .sidebar .nav-item {
    padding-inline: 0;
  }

  .sidebar .user-panel {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .user-logout {
    grid-column: auto;
    width: 36px;
    padding-inline: 0;
    justify-self: center;
  }

  .topbar-logout {
    display: inline-flex;
  }

  .main-shell {
    margin-left: 84px;
    width: calc(100% - 84px);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar {
    transform: translateX(-100%);
    width: min(84vw, 280px);
    flex-basis: auto;
    box-shadow: var(--shadow-soft);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar .brand-copy,
  .sidebar .nav-group-label,
  .sidebar .user-copy,
  .sidebar .field-label,
  .sidebar .guild-selector,
  .sidebar .button-label {
    display: initial;
  }

  .sidebar .brand-copy,
  .sidebar .user-copy {
    display: flex;
  }

  .sidebar .brand-link,
  .sidebar .nav-item {
    justify-content: flex-start;
  }

  .sidebar .user-panel {
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: stretch;
  }

  .sidebar .nav-item {
    padding-inline: 11px;
  }

  .user-logout {
    grid-column: 1 / -1;
    width: 100%;
    padding-inline: 10px;
  }

  .sidebar-close-button,
  .topbar-sidebar-toggle {
    display: inline-flex;
  }

  .main-shell {
    margin-left: 0;
    width: 100%;
  }

  .topbar,
  .form-footer,
  .table-row,
  .table-head,
  .dynamic-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-actions,
  .panel-header,
  .form-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-leading {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .dashboard-grid,
  .metrics-grid,
  .command-grid,
  .config-layout,
  .config-layout.two-columns,
  .server-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .invite-highlight-grid {
    grid-template-columns: 1fr;
  }

  .discord-message {
    grid-template-columns: 1fr;
  }

  .panel-span-2,
  .panel-span-3,
  .field-span-2 {
    grid-column: span 1;
  }

  .page-body,
  .public-shell,
  .invite-page,
  .login-screen {
    padding: 18px;
  }

  .preview-card {
    position: static;
    top: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* STYLE POUR EMOJIS DISCORD DANS LE NAVIGATEUR */
.discord-emoji-inline {
  display: inline-block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* STYLES POUR LA RESTAURATION BACKUP */
.backup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 20px;
}

.restore-btn-highlight {
  font-size: 16px;
  padding: 16px 24px;
  box-shadow: 0 0 15px rgba(127, 0, 255, 0.4);
  animation: pulse-restore 2s infinite;
}

@keyframes pulse-restore {
  0% { box-shadow: 0 0 0 0 rgba(127, 0, 255, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(127, 0, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(127, 0, 255, 0); }
}

.progress-container {
  margin-top: 30px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.progress-bar-bg {
  width: 100%;
  height: 12px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
