/* =============================================================
   1. ARYCHI CONSOLE STYLESHEET (CONSUMES /static/css/tokens.css)
============================================================= */

/* CSS Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
}

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-medium); }

/* =============================================================
   2. TOPBAR HEADER (UNIFIED WITH LANDING HEADER)
============================================================= */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

header.topbar {
  height: 72px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  z-index: 50;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.sidebar-toggle-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans-fast);
}
.sidebar-toggle-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.025em;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 21px/1 var(--font-serif);
  padding-bottom: 3px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.topbar-landing-link {
  min-height: 36px;
  white-space: nowrap;
  flex-shrink: 0;
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 10px;
  padding-left: 16px;
  border-left: 1px solid var(--border-subtle);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.breadcrumb-nav > span {
  flex-shrink: 0;
}
.breadcrumb-item {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.gateway-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-success);
  animation: statusPulse 2.2s infinite ease-in-out;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.theme-toggle-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--trans-fast);
}
.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* User Profile Dropdown */
.user-profile-menu {
  position: relative;
  flex-shrink: 0;
}
.user-pill-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--trans-fast);
}
#user-display-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-pill-btn:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-hover);
}
.user-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  object-fit: cover;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 100;
  animation: dropdownIn 0.16s ease-out;
}
.dropdown-menu.show { display: flex; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-header {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 5px;
}
.dropdown-header-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}
.dropdown-header-id {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 2px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: var(--trans-fast);
}
.dropdown-item:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}
.dropdown-item.danger { color: var(--status-error); }
.dropdown-item.danger:hover { background: var(--status-error-bg); }

/* =============================================================
   3. SIDEBAR NAVIGATION
============================================================= */
.workspace-shell {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

aside.sidebar {
  width: 264px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  box-shadow: 6px 0 24px rgba(31, 49, 84, 0.025);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--trans-smooth);
  z-index: 40;
}
aside.sidebar.collapsed {
  width: 72px;
}

/* Server Switcher Card */
.sidebar-server-section {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.server-switcher-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  transition: var(--trans-fast);
  position: relative;
}
.server-switcher-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-elevated);
}
.server-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--blurple-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--blurple-border);
}
.server-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.server-text-wrap {
  flex: 1;
  overflow: hidden;
}
.server-current-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-current-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
aside.sidebar.collapsed .server-text-wrap,
aside.sidebar.collapsed .server-select-chevron {
  display: none;
}

.server-select-hidden {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Nav List */
nav.sidebar-nav {
  flex: 1;
  padding: 18px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.nav-category {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-category-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 12px;
  margin-bottom: 4px;
  white-space: nowrap;
}
aside.sidebar.collapsed .nav-category-title { display: none; }

.nav-tab-item {
  width: 100%;
  appearance: none;
  background: transparent;
  text-align: left;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: var(--trans-fast);
  position: relative;
}
.nav-tab-item:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}
.nav-tab-item.active {
  background: var(--blurple-subtle);
  border-color: var(--blurple-border);
  color: var(--accent);
  font-weight: 600;
}
.nav-tab-item.active::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.nav-tab-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}
aside.sidebar.collapsed .nav-tab-item {
  justify-content: center;
  padding: 11px 0;
}
aside.sidebar.collapsed .nav-tab-item span { display: none; }
.nav-live-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-success);
  margin-left: auto;
  flex-shrink: 0;
}
aside.sidebar.collapsed .nav-live-indicator { display: none; }

/* =============================================================
   4. VIEWPORT & REUSABLE PAGE COMPONENTS
============================================================= */
main.viewport {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px 64px;
  background: var(--bg-base);
  min-width: 0;
}

.view-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

.tab-view-panel {
  display: none;
  animation: panelFade 0.20s var(--trans-smooth);
}
.tab-view-panel.active { display: block; }

@keyframes panelFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Standard Page Header */
.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.page-header-info {
  display: flex;
  align-items: center;
  gap: 15px;
}
.page-header-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--blurple-subtle);
  border: 1px solid var(--blurple-border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.page-title {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.25;
}
.page-subtitle,
.page-description {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.55;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ID Badge */
.id-badge-interactive {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--trans-fast);
  user-select: none;
}
.id-badge-interactive:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

/* Reusable SettingsCard Component */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
  min-width: 0;
}
.sticky-preview-card {
  position: sticky;
  top: 80px;
}
.settings-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
}
.settings-card-header > :first-child {
  min-width: 0;
  flex: 1;
}
.settings-card-header > :not(:first-child) {
  flex-shrink: 0;
}
.settings-card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.settings-card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.55;
}
.settings-card-body {
  padding: 24px;
}

/* Embedded Action Bar */
.card-action-bar {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.action-bar-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Reusable HelpPanel Component */
.help-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.help-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Workflow Step Diagram Component */
.workflow-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.workflow-step-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--trans-fast);
}
.workflow-step-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-hover);
}
.step-number-badge {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--blurple-subtle);
  border: 1px solid var(--blurple-border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-text-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.step-text-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}
.step-connector-arrow {
  display: flex;
  justify-content: center;
  color: var(--text-dim);
  margin: -6px 0;
}

/* Checklist Box */
.permission-checklist {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.checklist-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.checklist-item svg {
  color: var(--status-success);
  flex-shrink: 0;
}

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-voice-layout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 24px; }

.grid-2 > *,
.grid-3 > *,
.grid-4 > *,
.grid-voice-layout > *,
.overview-insights-grid > *,
.ops-layout-grid > * {
  min-width: 0;
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  min-width: 0;
  transition: border-color var(--trans-fast), background var(--trans-fast);
}
.stat-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface);
}
.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-card-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}
.stat-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-badge.blurple { background: var(--blurple-subtle); color: var(--accent); }
.stat-icon-badge.emerald { background: var(--status-success-bg); color: var(--status-success); }
.stat-icon-badge.amber { background: var(--status-warning-bg); color: var(--status-warning); }
.stat-icon-badge.purple { background: var(--status-info-bg); color: var(--status-info); }

.stat-card-value {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-top: 14px;
  margin-bottom: 6px;
}
.stat-card-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Resource Gauges */
.resource-row { margin-bottom: 16px; }
.resource-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.resource-title { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.resource-val { font-size: 16px; font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); }
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface-elevated);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.progress-fill.blurple { background: var(--accent); }
.progress-fill.emerald { background: var(--status-success); }

/* =============================================================
   5. BUTTONS, FORMS & BADGES (UNIFIED WITH LANDING BUTTONS)
============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 18px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: var(--trans-fast);
  user-select: none;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:active { opacity: 0.9; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 6px 13px; font-size: 12.5px; border-radius: 7px; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}
.btn-secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--status-error-bg);
  border-color: var(--status-error-border);
  color: var(--status-error);
}
.btn-danger:hover {
  background: var(--status-error-solid);
  border-color: var(--status-error-solid);
  color: var(--status-error-ink);
}

.spin-icon { animation: spin 0.7s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Form Fields */
.form-group { margin-bottom: 20px; }
.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  padding: 0 13px;
  transition: var(--trans-fast);
  outline: none;
  accent-color: var(--accent);
}
textarea {
  height: auto;
  min-height: 110px;
  padding: 10px 13px;
  resize: vertical;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--blurple-subtle);
}

/* Color Picker & Swatch Presets */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-swatch-input {
  width: 40px;
  height: 40px;
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  cursor: pointer;
  flex-shrink: 0;
}
.color-swatch-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}
.color-swatch-input::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}
.color-presets-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.color-preset-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  padding: 0;
}
.color-preset-dot:hover {
  transform: scale(1.12);
  border-color: var(--text-primary);
}

/* Switch Box */
.switch-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.switch-meta {
  min-width: 0;
  flex: 1;
}
.switch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.switch-meta strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.switch-meta span {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  transition: var(--trans-fast);
  border-radius: 99px;
}
.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  transition: var(--trans-fast);
  border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent-ink);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-success { background: var(--status-success-bg); color: var(--status-success); border: 1px solid var(--status-success-border); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); border: 1px solid var(--status-warning-border); }
.badge-error { background: var(--status-error-bg); color: var(--status-error); border: 1px solid var(--status-error-border); }
.badge-neutral { background: var(--bg-surface-elevated); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.badge-blurple { background: var(--blurple-subtle); color: var(--accent); border: 1px solid var(--blurple-border); }

/* Data Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}
table.data-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
table.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}
table.data-table code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-surface-elevated);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* Variable Chips */
.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.var-chip {
  appearance: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--trans-fast);
  user-select: none;
}
.var-chip:hover {
  background: var(--blurple-subtle);
  border-color: var(--blurple-border);
  color: var(--accent);
}

.inline-input-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}
.inline-input-group > input {
  flex: 1;
  min-width: 0;
}

/* Discord Chat Embed & Components V2 Preview */
.discord-card-preview {
  background: var(--discord-bubble);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
  position: relative;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent);
}
.d-preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.d-preview-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 13px/1 Georgia, serif;
}
.d-preview-name { font-weight: 700; font-size: 13.5px; color: var(--text-primary); }
.d-preview-bot-tag {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.d-preview-time { font-size: 11px; color: var(--text-muted); }
.d-preview-title { font-weight: 700; font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }
.d-preview-body { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; white-space: pre-wrap; }

.v2-preview-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.v2-preview-text-col {
  flex: 1;
  min-width: 0;
}
.v2-preview-subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.v2-preview-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
}
.v2-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.v2-preview-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 12px 0;
}
.v2-preview-quote {
  border-left: 3px solid var(--border-strong);
  padding-left: 12px;
  margin-bottom: 10px;
}
.v2-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}
.v2-preview-footer {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}
.v2-preview-banner-wrap {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  max-height: 180px;
}
.v2-preview-banner-wrap img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.v2-preview-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.v2-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}
.v2-btn-primary {
  background: #5865f2;
  color: #ffffff;
}
.v2-btn-secondary {
  background: #4e5058;
  color: #ffffff;
}
.v2-btn-success {
  background: #248046;
  color: #ffffff;
}
.v2-btn-link {
  background: #4e5058;
  color: #ffffff;
  text-decoration: none;
}
.v2-dm-preview {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-medium);
}
.v2-dm-preview-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.v2-dm-preview-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.rp-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

/* Toast Shelf */
#toast-shelf {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast-pill {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 440px;
  pointer-events: auto;
  animation: toastSlide 0.22s var(--trans-smooth);
}
.toast-pill.success { border-left: 4px solid var(--status-success); }
.toast-pill.error { border-left: 4px solid var(--status-error); }
.toast-pill.warning { border-left: 4px solid var(--status-warning); }
.toast-pill.info { border-left: 4px solid var(--accent); }
@keyframes toastSlide {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* =============================================================
   6. AUTH GATE SCREEN (UNIFIED WITH LANDING PAGE HERO)
============================================================= */
body:not(.signed-in) #btn-toggle-sidebar,
body:not(.signed-in) #btn-command-palette,
body:not(.signed-in) .breadcrumb-nav,
body:not(.signed-in) .gateway-pill,
body:not(.signed-in) #main-workspace {
  display: none !important;
}

.login-gate-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 72px;
  padding: 64px 40px;
  background: var(--bg-base);
}

.login-story {
  max-width: 460px;
}

.login-story h1 {
  font-size: clamp(40px, 5vw, 68px);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 22px;
}

.login-story h1 em,
.login-story h1 span {
  font-family: inherit;
  font-weight: inherit;
  font-style: normal;
  color: var(--accent);
}

.login-story > p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.8;
  max-width: 420px;
}

.login-capabilities {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.login-capability {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--text-secondary);
}

.login-capability svg {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--blurple-subtle);
  border: 1px solid var(--blurple-border);
  flex-shrink: 0;
}

.login-card {
  width: 100%;
  max-width: 410px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 0 -3px var(--border-subtle), var(--shadow-lg);
  padding: 44px 34px;
  text-align: center;
}

.login-brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 38px;
  transform: perspective(400px) rotateY(-18deg) rotateZ(-8deg);
  box-shadow: 5px 5px 0 var(--accent-border);
  margin: 0 auto 18px;
}

.login-footnote {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 22px;
  line-height: 1.65;
}

.login-back {
  display: inline-block;
  margin-top: 20px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}
.login-back:hover {
  text-decoration: underline;
}

/* =============================================================
   7. PROFESSIONAL COMMAND CENTER
============================================================= */
.command-trigger {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 11px;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font: 600 12.5px var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--trans-fast);
}
.command-trigger:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--bg-surface-hover);
}
.command-trigger kbd,
.command-palette-search kbd,
.command-palette-footer kbd {
  padding: 2px 6px;
  border: 1px solid var(--border-medium);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font: 600 11px var(--font-mono);
}
.last-updated-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.overview-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 18px 28px;
  padding: 20px 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  overflow: hidden;
}
.overview-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.overview-server-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 20px/1 var(--font-serif);
}
.overview-server-avatar img { width: 100%; height: 100%; object-fit: cover; }
.overview-hero-copy { min-width: 0; }
.overview-strip-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eyebrow-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font: 600 var(--text-xs) var(--font-mono);
  letter-spacing: 0.04em;
}
.overview-hero-copy h2 {
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.overview-hero-copy > p {
  max-width: 680px;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.overview-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.overview-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.overview-meta-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
}
.overview-meta-row strong { color: var(--text-secondary); font-weight: 600; }
.overview-readiness {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding-left: 24px;
  border-left: 1px solid var(--border-subtle);
}
.score-ring {
  --score: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.score-ring-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.score-ring strong {
  color: var(--text-primary);
  font: 700 18px/1.1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.score-ring span {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
}
.score-ring-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.score-ring-fill {
  height: 100%;
  width: calc(clamp(0, var(--score, 0), 100) * 1%);
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.35s var(--trans-smooth);
}
.overview-readiness-copy { display: flex; flex-direction: column; gap: 2px; }
.overview-readiness-copy strong { color: var(--text-primary); font-size: 13px; font-weight: 600; }
.overview-readiness-copy span { color: var(--text-muted); font-size: var(--text-xs); line-height: 1.45; }
.overview-quick-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.quick-action-btn {
  appearance: none;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--trans-fast), background var(--trans-fast);
}
.quick-action-btn:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-hover);
}
.quick-action-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: color var(--trans-fast), border-color var(--trans-fast);
}
.quick-action-btn:hover .quick-action-icon {
  color: var(--accent);
  border-color: var(--blurple-border);
}
.quick-action-btn div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quick-action-btn strong { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.quick-action-btn small { color: var(--text-muted); font-size: var(--text-xs); line-height: 1.35; }

.overview-insights-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 24px;
}
.metric-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.metric-inline strong {
  color: var(--text-primary);
  font: 700 20px var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.metric-inline span {
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.activity-chart {
  height: 190px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  padding: 12px 4px 0;
  border-bottom: 1px solid var(--border-subtle);
  background-image: linear-gradient(to top, var(--border-subtle) 1px, transparent 1px);
  background-size: 100% 25%;
}
.activity-bar-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.activity-bar-value { color: var(--text-muted); font: 600 11px var(--font-mono); }
.activity-bar {
  width: min(34px, 72%);
  min-height: 6px;
  border-radius: 5px 5px 2px 2px;
  background: var(--accent);
  transition: height 0.45s var(--trans-smooth);
}
.activity-bar-label { color: var(--text-muted); font: 500 11px var(--font-mono); }
.chart-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.accent { background: var(--accent); }
.module-health-list { padding: 8px 0; }
.module-health-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.module-health-item:last-child { border-bottom: 0; }
.module-state-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.module-state-icon.ready { color: var(--status-success); background: var(--status-success-bg); }
.module-state-icon.pending { color: var(--status-warning); background: var(--status-warning-bg); }
.module-health-copy { min-width: 0; }
.module-health-copy strong { display: block; color: var(--text-primary); font-size: 13px; }
.module-health-copy small { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-health-action { color: var(--accent); background: none; border: 0; font: 600 var(--text-xs) var(--font-sans); cursor: pointer; }
.module-health-action:hover { text-decoration: underline; }
.runtime-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.ranked-list { padding: 8px 0; }
.ranked-list-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.ranked-list-item:last-child { border-bottom: 0; }
.rank-number { color: var(--text-dim); font: 700 var(--text-xs) var(--font-mono); }
.ranked-channel-name { min-width: 0; color: var(--text-primary); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranked-count { color: var(--text-secondary); font: 600 var(--text-xs) var(--font-mono); }
.empty-insight { padding: 36px 22px; color: var(--text-muted); text-align: center; font-size: var(--text-xs); }
.automation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border-subtle);
}
.automation-metric {
  appearance: none;
  font: inherit;
  min-height: 108px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 14px 10px;
  border: 0;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--trans-fast);
}
.automation-metric:hover { background: var(--bg-surface-hover); }
.automation-icon {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--trans-fast);
}
.automation-metric:hover .automation-icon { color: var(--accent); }
.automation-metric strong { font: 700 22px var(--font-mono); font-variant-numeric: tabular-nums; }
.automation-metric small { color: var(--text-muted); font-size: var(--text-xs); }

.command-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 120px) 20px 30px;
  background: var(--bg-scrim);
}
.command-palette-backdrop[hidden],
.command-palette-backdrop[aria-hidden="true"]:not(.open) {
  display: none !important;
}
.command-palette-backdrop.open { display: flex; }
.command-palette-panel {
  width: min(620px, 100%);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  animation: paletteIn 0.16s var(--trans-smooth);
}
@keyframes paletteIn { from { opacity: 0; transform: translateY(-8px) scale(0.985); } }
.command-palette-search {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.command-palette-search input {
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}
.command-palette-heading,
.command-palette-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.command-palette-heading span { color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.command-palette-results { max-height: min(52vh, 430px); overflow-y: auto; padding: 0 8px 9px; }
.command-result {
  appearance: none;
  font: inherit;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.command-result:hover,
.command-result.active { background: var(--blurple-subtle); }
.command-result strong { display: block; font-size: 13px; }
.command-result small { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--text-xs); }
.command-result-arrow { color: var(--text-muted); flex-shrink: 0; display: inline-flex; align-items: center; }
.command-result:hover .command-result-arrow,
.command-result.active .command-result-arrow { color: var(--accent); }
.command-palette-footer { justify-content: flex-start; border-top: 1px solid var(--border-subtle); }
.command-palette-footer span { display: inline-flex; align-items: center; gap: 5px; }

/* =============================================================
   7B. OPERATIONS CENTER, MUSIC STUDIO & ANTI-NUKE WHITELIST
============================================================= */
.live-refresh-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.live-refresh-toggle input {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  accent-color: var(--accent);
}

.ops-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 24px 26px;
  margin-bottom: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.ops-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font: 700 11.5px var(--font-mono);
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
}
.ops-status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.ops-status-pill.ready {
  background: var(--status-success-bg);
  color: var(--status-success);
  border-color: var(--status-success-border);
}
.ops-status-pill.warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border-color: var(--status-warning-border);
}
.ops-status-pill.error {
  background: var(--status-error-bg);
  color: var(--status-error);
  border-color: var(--status-error-border);
}
.ops-status-pill.checking {
  background: var(--blurple-subtle);
  color: var(--accent);
  border-color: var(--blurple-border);
}
.ops-hero-copy h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.ops-hero-copy > p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.ops-runtime-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.ops-runtime-strip span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ops-runtime-strip small {
  font-size: 11px;
  color: var(--text-muted);
}
.ops-runtime-strip strong {
  font: 700 14px var(--font-mono);
  color: var(--text-primary);
}
.ops-score-ring {
  --health-score: 0;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-left: 24px;
  border-left: 1px solid var(--border-subtle);
}
.ops-score-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.ops-score-ring strong {
  font: 700 20px/1.1 var(--font-mono);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.ops-score-ring span {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: 600;
}
.ops-score-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.ops-score-fill {
  height: 100%;
  width: calc(clamp(0, var(--health-score, 0), 100) * 1%);
  border-radius: var(--radius-full);
  background: var(--status-success);
  transition: width 0.35s var(--trans-smooth);
}

.ops-checks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.ops-check-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.ops-check-card.warning {
  border-color: var(--status-warning-border);
}
.ops-check-card.error {
  border-color: var(--status-error-border);
}
.ops-check-card.skeleton-card {
  min-height: 82px;
  background: var(--bg-surface-elevated);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.ops-check-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.ops-check-top strong {
  font-size: 13px;
  color: var(--text-primary);
}
.ops-check-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.ops-layout-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 24px;
  align-items: start;
}
.ops-side-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.card-header-row.compact {
  padding: 16px 20px;
}
.card-header-row h3 {
  font-size: 16px;
  color: var(--text-primary);
}
.card-header-row p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.ops-command-toolbar {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.ops-search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-muted);
}
.ops-search-box input {
  border: 0;
  background: transparent;
  color: var(--text-primary);
  width: 100%;
  height: 100%;
  outline: none;
  font-size: 13px;
}
.ops-command-list {
  max-height: 480px;
  overflow-y: auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ops-cmd-item {
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
}
.ops-cmd-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 6px;
}
.ops-cmd-top code {
  font: 700 12.5px var(--font-mono);
  color: var(--accent);
}
.ops-cmd-badges {
  display: flex;
  gap: 6px;
}
.ops-cmd-item p {
  font-size: 12.5px;
  color: var(--text-secondary);
}
.ops-recommendations {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ops-rec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
}
.ops-rec-item strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
}
.ops-rec-item p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.ops-diagnostics-card > p {
  padding: 12px 20px 0;
  font-size: 12px;
  color: var(--text-muted);
}
.ops-diagnostics-json {
  margin: 12px 20px 20px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font: 11.5px/1.5 var(--font-mono);
  color: var(--text-secondary);
  overflow-x: auto;
  max-height: 220px;
}

/* Music Player Studio */
.music-player-stage {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}
.music-artwork-box {
  width: 78px;
  height: 78px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  display: grid;
  place-items: center;
  font-size: 28px;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}
.music-artwork-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.music-track-meta {
  flex: 1;
  min-width: 0;
}
.music-track-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-track-author {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.music-track-submeta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.music-track-submeta strong {
  color: var(--text-secondary);
}
.music-progress-block {
  margin-bottom: 18px;
}
.music-time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font: 600 11.5px var(--font-mono);
  color: var(--text-muted);
}
.music-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.music-volume-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.music-range-slider {
  width: 100%;
  height: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}
.command-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.cmd-ref-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}
.cmd-ref-item code {
  font: 700 12px var(--font-mono);
  color: var(--accent);
}
.cmd-ref-item span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Security Whitelist Box */
.whitelist-list-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-top: 4px;
}
.whitelist-chip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}
.whitelist-chip-row code {
  font: 600 12.5px var(--font-mono);
  color: var(--text-primary);
}

/* =============================================================
   8. RESPONSIVE MEDIA QUERIES
============================================================= */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-voice-layout { grid-template-columns: 1fr; }
  .overview-quick-actions { grid-template-columns: repeat(2, 1fr); }
  .ops-checks-grid { grid-template-columns: repeat(2, 1fr); }
  .ops-layout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .login-gate-container { gap: 36px; }
  .login-story { max-width: 360px; }
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .overview-insights-grid { grid-template-columns: 1fr; }
  .overview-hero { grid-template-columns: 1fr; }
  .ops-hero { grid-template-columns: 1fr; }
  .ops-checks-grid { grid-template-columns: 1fr; }
  .ops-command-toolbar { grid-template-columns: 1fr; }
  .command-reference-grid { grid-template-columns: 1fr; }
  .overview-readiness { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--border-subtle); }
  .ops-score-ring { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--border-subtle); min-width: 0; }
  .sticky-preview-card { position: static; top: auto; }
  main.viewport { padding: 24px; }
  .login-gate-container {
    flex-direction: column;
    justify-content: flex-start;
    gap: 32px;
    padding: 40px 24px;
  }
  .login-story { max-width: 420px; width: 100%; }
  .login-capabilities { display: none; }
}

@media (max-width: 1180px) {
  .breadcrumb-nav { display: none; }
}

@media (max-width: 960px) {
  .topbar-landing-link span { display: none; }
  .topbar-landing-link { padding: 0; width: 36px; }
}

@media (max-width: 860px) {
  .command-trigger span, .command-trigger kbd { display: none; }
  .command-trigger { padding: 0; width: 36px; justify-content: center; }
}

@media (max-width: 768px) {
  aside.sidebar,
  aside.sidebar.collapsed {
    position: fixed;
    left: -280px;
    top: 64px;
    bottom: 0;
    width: 264px;
    box-shadow: var(--shadow-lg);
    transition: left var(--trans-smooth);
  }
  aside.sidebar.mobile-open,
  aside.sidebar.collapsed.mobile-open { left: 0; }
  aside.sidebar.collapsed .server-text-wrap,
  aside.sidebar.collapsed .server-select-chevron,
  aside.sidebar.collapsed .nav-category-title { display: block; }
  aside.sidebar.collapsed .nav-tab-item {
    justify-content: flex-start;
    padding: 10px 12px;
  }
  aside.sidebar.collapsed .nav-tab-item span,
  aside.sidebar.collapsed .nav-live-indicator { display: inline; }
  .grid-4 { grid-template-columns: 1fr; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--bg-scrim);
    z-index: 35;
  }
  .sidebar-backdrop.active { display: block; }
}

@media (max-width: 540px) {
  header.topbar { padding-inline: 14px; gap: 8px; }
  .topbar-left, .topbar-right { gap: 8px; min-width: 0; }
  .topbar-right .topbar-landing-link, .gateway-pill { display: none !important; }
  .command-trigger { width: 34px; min-height: 34px; }
  main.viewport { padding: 18px 14px; }
  .page-title { font-size: 22px; }
  .page-header-icon-box { width: 40px; height: 40px; }
  .page-header-info { min-width: 0; }
  .page-actions { flex-wrap: wrap; }
  .last-updated-label { width: 100%; }
  .overview-hero { padding: 18px 16px; }
  .overview-hero-main { align-items: flex-start; }
  .overview-server-avatar { width: 44px; height: 44px; flex-basis: 44px; border-radius: var(--radius-md); font-size: 18px; }
  .overview-hero-copy h2 { font-size: 17px; }
  .overview-meta-row { flex-direction: column; gap: 5px; }
  .overview-quick-actions { grid-template-columns: 1fr; }
  .activity-chart { height: 160px; gap: 5px; }
  .automation-grid { grid-template-columns: 1fr 1fr; }
  .inline-input-group { flex-direction: column; align-items: stretch; }
  .command-palette-backdrop { padding: 12px; align-items: center; }
  .settings-card-header, .settings-card-body { padding: 18px 16px; }
  .settings-card-header { flex-wrap: wrap; gap: 12px; }
  .settings-card-header > :first-child { flex: 1 1 100%; }
  .switch-box { flex-wrap: wrap; gap: 12px; }
  .switch-meta { min-width: 100%; }
  .card-action-bar { flex-wrap: wrap; padding: 14px 16px; }
  table.data-table th,
  table.data-table td { padding: 10px 12px; }
  .login-card { padding: 28px 24px; flex-shrink: 1; }
  .login-gate-container { padding: 30px 20px; }
  #toast-shelf { left: 12px; right: 12px; bottom: 12px; }
  .toast-pill { min-width: 0; max-width: 100%; }
}

@media (max-width: 430px) {
  header.topbar { padding-inline: 10px; gap: 6px; }
  .topbar-left, .topbar-right { gap: 6px; }
  .brand-link span { display: none; }
  .brand-logo-icon { width: 32px; height: 32px; font-size: 19px; }
  .sidebar-toggle-btn, .theme-toggle-btn, .command-trigger { width: 32px; height: 32px; min-height: 32px; }
  .user-pill-btn { padding: 3px 8px 3px 4px; gap: 6px; max-width: 132px; }
  #user-display-name { max-width: 72px; }
  #auth-box-logged-out { padding: 6px 10px; font-size: 12px; min-height: 32px; }
}

@media (max-width: 380px) {
  main.viewport { padding: 16px 12px; }
  .automation-grid { grid-template-columns: 1fr; }
  .settings-card-body .btn,
  .card-action-bar .btn,
  .page-actions .btn,
  .switch-box .btn {
    white-space: normal;
    text-align: center;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
