:root {
  --bg-base: #0b0911;
  --bg-surface: #13101c;
  --bg-overlay: #1a1626;
  --bg-interactive: #241f35;
  
  /* Text values */
  --text-muted: #837b96;
  --text-primary: #f1eef7;
  --text-inverse: #0b0911;
  
  /* UI Accents and Outlines */
  --accent-base: #7c4dff;
  --accent-light: #9d7cff;
  --danger-base: #ff5252;
  --outline-subtle: rgba(255, 255, 255, 0.06);

  /* Precise Discord role-style circle references */
  --color-green: #2ecc71;
  --color-blue: #3498db;
  --color-red: #e74c3c;
  
  /* Layout Typography Specification */
  --font-primary: 'Builder Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-secondary: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  
  /* Modern High-Rounding Curve Radius Definition */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --smooth-transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Base Configuration & Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Utility State Rules */
.view-hidden { display: none !important; }

/* Non-blocking loading progression element */
#top-loading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px; width: 0%;
  background-color: var(--accent-base);
  z-index: 9999;
  transition: width 0.3s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.3s ease;
}

/* Scannable Floating Notification Layer */
#toast-manager {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9998;
  max-width: 360px;
  width: 100%;
}

.custom-toast {
  background-color: var(--bg-overlay);
  border: 1px solid var(--outline-subtle);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-secondary);
  display: flex;
  align-items: center;
  border-left: 4px solid var(--accent-base);
  animation: toastEntrance 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.custom-toast.error-toast { border-left-color: var(--danger-base); }

@keyframes toastEntrance {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Clean, Rounded Buttons */
button {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none; outline: none;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--smooth-transition);
}

.btn-primary {
  background-color: var(--accent-base);
  color: var(--text-primary);
  padding: 14px 28px;
  font-size: 15px;
  border-radius: var(--radius-full);
}
.btn-primary:hover { background-color: var(--accent-light); }

.btn-accent {
  background-color: var(--accent-base);
  color: white;
  padding: 10px 22px;
}
.btn-accent:hover { background-color: var(--accent-light); }

.btn-small {
  padding: 6px 16px !important;
  font-size: 12px !important;
}

.btn-secondary {
  background-color: var(--bg-interactive);
  color: var(--text-primary);
  border: 1px solid var(--outline-subtle);
  padding: 10px 22px;
}
.btn-secondary:hover { background-color: rgba(255,255,255,0.04); }

.btn-text-icon {
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-secondary);
  font-size: 14px;
}
.btn-text-icon:hover { color: var(--text-primary); }

.btn-destructive-text {
  background: transparent;
  color: var(--danger-base);
  font-size: 13px;
  font-family: var(--font-secondary);
  padding: 6px 12px;
}
.btn-destructive-text:hover { background: rgba(255, 82, 82, 0.1); border-radius: var(--radius-sm); }

.full-width { width: 100%; }

/* Input Fields & Structured Form Controls */
input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%;
  background-color: var(--bg-base);
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-secondary);
  font-size: 14px;
  outline: none;
  transition: var(--smooth-transition);
}
input:focus, select:focus { border-color: var(--accent-base); }

/* Remove Number Spinner Inputs Everywhere */
.no-spinners::-webkit-outer-spin-button,
.no-spinners::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"].no-spinners {
  -moz-appearance: textfield;
}

/* Homepage and Topbar Layout Module */
.homepage-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--outline-subtle);
  background-color: var(--bg-base);
}

.nav-brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-tab {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 14px;
  border-radius: var(--radius-full);
}
.nav-tab:hover, .nav-tab.active {
  color: var(--text-primary);
  background-color: var(--bg-surface);
}

.homepage-content {
  min-height: calc(100vh - 75px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--outline-subtle);
  max-width: 440px;
  width: 100%;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-family: var(--font-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

/* Selection Hub View Layout */
.hub-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px;
}

.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.user-identity h2 { font-size: 24px; font-weight: 700; }
.identity-pill {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-secondary);
}

.console-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--outline-subtle);
  padding: 28px;
  border-radius: var(--radius-md);
  margin-bottom: 40px;
}

.console-box h3, .projects-section h3 {
  font-size: 12px;
  text-transform: lowercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 600;
}

.terminal-input-group {
  display: flex;
  background-color: var(--bg-base);
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-full);
  padding: 6px 6px 6px 18px;
  align-items: center;
  gap: 12px;
}

.terminal-icon { color: var(--text-muted); font-size: 18px; }
.terminal-input-group input {
  border: none !important;
  background: transparent;
  font-family: var(--font-secondary);
  padding: 6px 0;
}

/* Project Lists Configuration */
.projects-deck { display: flex; flex-direction: column; gap: 12px; }

.project-item-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--outline-subtle);
  padding: 20px 28px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--smooth-transition);
}
.project-item-card:hover {
  border-color: var(--accent-base);
  background-color: var(--bg-overlay);
}

.project-title-meta h4 { font-size: 16px; font-weight: 600; }
.project-title-meta p { font-size: 13px; color: var(--text-muted); font-family: var(--font-secondary); margin-top: 1px; }

/* Dashboard Context Grid Canvas */
.dashboard-layout { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

.dashboard-sidebar {
  width: 240px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--outline-subtle);
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 40px;
}
.brand-logo { font-size: 24px; font-weight: 700; }
.brand-arrow { color: var(--text-muted); font-size: 18px; }

.sidebar-context { margin-bottom: 32px; }
.sidebar-context label {
  font-size: 12px;
  text-transform: lowercase;
  color: var(--text-muted);
  font-weight: 600;
}
.context-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
  font-family: var(--font-secondary);
}

.sidebar-menu { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: lowercase;
}
.menu-item .material-icons-round { font-size: 18px; }
.menu-item:hover { color: var(--text-primary); background-color: var(--bg-interactive); }
.menu-item.item-active { background-color: var(--accent-base); color: white; }
.logout-item:hover { background-color: rgba(255, 82, 82, 0.1); color: var(--danger-base); }

/* Main Working Canvas Panel Area */
.dashboard-main { flex-grow: 1; padding: 56px 64px; overflow-y: auto; }
.panel-view { animation: viewEntrance 0.25s cubic-bezier(0.25, 1, 0.5, 1) forwards; }

@keyframes viewEntrance {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 36px; }
.panel-header h2 { font-size: 26px; font-weight: 700; }
.panel-header p { color: var(--text-muted); font-size: 14px; font-family: var(--font-secondary); margin-top: 2px; }

/* Cards & Badges Layout */
.cards-deck { display: flex; flex-direction: column; gap: 12px; }
.component-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--outline-subtle);
  padding: 22px 32px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.component-meta-block h4 { font-size: 16px; font-weight: 600; }
.component-meta-block p { font-size: 13px; color: var(--text-muted); font-family: var(--font-secondary); margin-top: 2px; }
.pill-group { display: flex; gap: 8px; align-items: center; }

/* Discord Role Badges styling references */
.custom-flag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-interactive);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-secondary);
}

.flag-dot {
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  display: inline-block;
}
.dot-green { background-color: var(--color-green); }
.dot-blue { background-color: var(--color-blue); }
.dot-red { background-color: var(--color-red); }

/* Modals Overlay Shell */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: rgba(7, 5, 11, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-window {
  background-color: var(--bg-surface);
  border: 1px solid var(--outline-subtle);
  max-width: 480px;
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: modalScale 0.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes modalScale {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header { padding: 32px 36px 20px 36px; }
.modal-header h3 { font-size: 20px; font-weight: 700; }
.modal-header p { color: var(--text-muted); font-size: 13px; font-family: var(--font-secondary); margin-top: 2px; }
.modal-body { padding: 0 36px 32px 36px; }

.form-element { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.form-element label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-row-split { display: flex; gap: 16px; }
.form-row-split .form-element { flex: 1; }

/* Randomizer Field Layout Rules */
.randomizer-input-container {
  display: flex;
  gap: 8px;
  width: 100%;
}
.btn-randomize {
  padding: 0 16px !important;
  border-radius: var(--radius-sm) !important;
  background-color: var(--bg-base) !important;
}

/* Custom CSS Switch Framework */
.custom-switch-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  width: 100%;
}

.switch-label-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.switch-track {
  position: relative;
  width: 56px;
  height: 28px;
  background-color: var(--bg-base);
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-full);
  transition: var(--smooth-transition);
  margin-top: 8px;
}

.switch-track input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: var(--smooth-transition);
}

/* Trigger actions for toggle checks dynamically mapped via parent nodes */
.switch-track:has(input:checked) {
  background-color: var(--accent-base);
  border-color: var(--accent-base);
}

.switch-track:has(input:checked) .switch-thumb {
  transform: translateX(26px);
  background-color: #ffffff;
}

.smart-input-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-base);
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-sm);
  padding: 0 14px;
}
.smart-input-icon { color: var(--text-muted); font-size: 18px; margin-right: 8px; }
.smart-input-container input { border: none !important; padding: 12px 0; }

/* Interactive Role Flags Builder elements */
.flag-selection-workspace { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.flag-selector-pill {
  display: flex;
  align-items: center;
  background-color: var(--bg-base);
  border: 1px solid var(--outline-subtle);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--smooth-transition);
}
.flag-selector-pill:hover { border-color: var(--text-muted); }
.flag-selector-pill .flag-dot { margin-right: 12px; }
.flag-selector-pill .check-icon { margin-left: auto; font-size: 18px; color: var(--accent-base); display: none; }
.flag-selector-pill.selected { border-color: var(--accent-base); background-color: var(--bg-interactive); }
.flag-selector-pill.selected .check-icon { display: block; }

.modal-footer {
  background-color: rgba(0,0,0,0.2);
  padding: 20px 36px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--outline-subtle);
}