html {
  scroll-behavior: smooth;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #1c1c1c;
  --border: #262626;
  --text: #e5e5e5;
  --text-muted: #737373;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-glow: rgba(124, 58, 237, 0.3);
  --error: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;
  --danger: #dc3545;

  /* Spacing & Radius */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-primary: 0 4px 14px var(--primary-glow);
  --shadow-glow: 0 0 20px var(--primary-glow);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ==================== LOADING SCREEN ==================== */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== LOGIN CONTAINER ==================== */
.container {
  max-width: 420px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container:has(#login-section.hidden) {
  display: none;
}

/* Animated background */
body:has(#login-section:not(.hidden)) {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    var(--bg);
}

#login-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  width: 100%;
}

#login-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #a78bfa, #6366f1);
}

/* Logo/Icon */
.login-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  border-radius: 16px;
  font-size: 2rem;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

#login-section h1 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, var(--text), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* ==================== DASHBOARD LAYOUT ==================== */
#dashboard-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-left h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

/* User Menu Dropdown */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-menu-trigger:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.dropdown-arrow {
  transition: transform var(--transition-fast);
}

.user-menu.open .dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--surface-hover);
}

.dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.dropdown-icon {
  font-size: 1rem;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  padding: 0.375rem;
  border-radius: 10px;
  width: fit-content;
  border: 1px solid var(--border);
}

.tab {
  width: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  margin: 0;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-icon {
  font-size: 1rem;
  line-height: 1;
}

.tab:hover:not(.active) {
  color: var(--text);
  background: var(--surface-hover);
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), #6d28d9);
  color: white;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.tab.active .tab-icon {
  filter: brightness(1.1);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==================== DASHBOARD LAYOUT ==================== */
#org-dashboard.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

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

.dashboard-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dashboard-title h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(124, 58, 237, 0.05) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.15);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.375rem;
  text-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
  position: relative;
  z-index: 1;
}

.stat-card-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.stat-card-bg {
  position: absolute;
  right: -8px;
  bottom: -15px;
  font-size: 5.5rem;
  color: var(--primary);
  opacity: 0.08;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.stat-card:hover .stat-card-bg {
  opacity: 0.15;
  transform: scale(1.05);
}

.stat-card.clickable {
  cursor: pointer;
  user-select: none;
}

.stat-card.clickable:active {
  transform: translateY(0);
}

/* Dashboard Sections */
.dashboard-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.dashboard-section:hover {
  border-color: rgba(124, 58, 237, 0.2);
  box-shadow: var(--shadow-md);
}

.dashboard-section:last-child {
  margin-bottom: 0;
}

.section-header {
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.section-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header h2::before {
  content: '';
  width: 4px;
  height: 1.25rem;
  background: linear-gradient(180deg, var(--primary), #a78bfa);
  border-radius: 2px;
}

.section-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

/* Connect Options (horizontal buttons) */
.connect-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  justify-content: flex-start;
}

.connect-label-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0 0;
  text-align: center;
}

.connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: auto;
  flex: 0 0 auto;
}

.connect-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.connect-btn:active:not(:disabled) {
  transform: translateY(0);
}

.connect-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.connect-icon {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
}

.connect-icon.google {
  background: #4285f4;
  color: white;
}

.connect-icon.microsoft {
  background: #00a4ef;
  color: white;
}

.connect-icon.ics {
  background: var(--bg);
  font-size: 1rem;
}

.connect-icon.discord {
  background: #5865F2;
  color: white;
}

.connect-label {
  font-weight: 500;
}

/* Legacy grid layout fallback */
#org-dashboard:not(.dashboard-layout) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  align-items: start;
}

/* ==================== CARDS ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header h2 {
  margin-bottom: 0;
}

/* ==================== STATS ==================== */
.stats {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.stat {
  flex: 1;
  text-align: center;
  padding: 1rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ==================== BADGES ==================== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--primary);
  color: white;
  border-radius: 4px;
}

.badge.owner { background: #f59e0b; }
.badge.admin { background: #3b82f6; }
.badge.member { background: #525252; }
.badge.success { background: var(--success); }

/* Superuser Badge for navigation tabs */
.superuser-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 0.625rem;
  font-weight: 700;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
  border-radius: 4px;
  margin-left: 0.375rem;
  flex-shrink: 0;
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* Primary labels for important settings */
label.primary {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* Secondary/muted labels */
label.secondary {
  font-size: 0.75rem;
  color: var(--text-muted);
}

input, select, textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-row {
  display: flex;
  gap: 0.5rem;
}

.form-row button {
  flex: 1;
}

.form-section {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.form-section h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-section h3 .section-icon {
  font-size: 1rem;
  opacity: 0.8;
}

.form-section h4 {
  font-size: 0.7rem;
  font-weight: 500;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

/* Help text styling */
.help-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* Empty state for lists */
.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 0.25rem;
}

.empty-state small {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Conditional fields that appear/disappear */
.conditional-field {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.conditional-field.hidden {
  opacity: 0;
  transform: translateY(-5px);
}

/* Collapsible/Accordion panels for advanced settings */
.collapsible-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
  overflow: hidden;
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.collapsible-header:hover {
  background: var(--surface-hover);
}

.collapsible-header h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collapsible-header .toggle-icon {
  font-size: 0.625rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.collapsible-section.open .collapsible-header .toggle-icon {
  transform: rotate(180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
  background: var(--surface);
}

.collapsible-section.open .collapsible-content {
  max-height: 1000px;
  transition: max-height 0.35s ease-in;
}

.collapsible-content-inner {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

/* Advanced settings badge */
.advanced-badge {
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
  background: var(--surface-hover);
  border-radius: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Tooltip system for technical terms */
.tooltip-trigger {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--text-muted);
}

.tooltip-trigger::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 1000;
  pointer-events: none;
}

.tooltip-trigger::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 1001;
}

.tooltip-trigger:hover::after,
.tooltip-trigger:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Info icon for tooltips */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 0.625rem;
  background: var(--surface-hover);
  color: var(--text-muted);
  border-radius: 50%;
  margin-left: 0.25rem;
  cursor: help;
  vertical-align: middle;
}

.info-icon:hover {
  background: var(--primary);
  color: white;
}

/* Danger Zone for destructive actions */
.danger-zone {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
}

.danger-zone-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.danger-zone-header h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: #ef4444;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.danger-zone p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.danger-zone .danger {
  background: #ef4444;
  border-color: #ef4444;
}

.danger-zone .danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.checkbox-group + .checkbox-group {
  margin-top: -0.25rem;
}

.checkbox-group + small {
  margin-top: -0.5rem;
  margin-bottom: 0.875rem;
  display: block;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-group label {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}

/* ==================== BUTTONS ==================== */
button {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

button.secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--text-muted);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button.small {
  width: auto;
  height: 32px;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

button.danger {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
}

button.danger:hover:not(:disabled) {
  background: var(--error);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

/* ==================== ACTION BUTTONS ==================== */
.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8125rem;
  margin: 0;
  transition: all 0.2s ease;
}

.action-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn .icon {
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  background: var(--surface);
  border-radius: 4px;
}

/* ==================== DISCORD BUTTON ==================== */
.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  background: linear-gradient(135deg, #5865F2, #7289da);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

.discord-btn:hover {
  background: linear-gradient(135deg, #4752c4, #5865F2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(88, 101, 242, 0.4);
}

.discord-btn:active {
  transform: translateY(0);
}

.discord-btn svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* ==================== DEV BUTTON ==================== */
.dev-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.dev-btn:hover {
  background: linear-gradient(135deg, #4b5563, #374151);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.dev-btn:active {
  transform: translateY(0);
}

.dev-btn i {
  font-size: 1rem;
}

/* ==================== DIVIDER ==================== */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ==================== MESSAGES ==================== */
.info {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin: 0.5rem 0;
}

.error {
  color: var(--error);
  font-size: 0.8125rem;
  margin-top: 0.75rem;
}

/* ==================== CONNECTIONS LIST ==================== */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.connection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: var(--radius);
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.connection-item:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

/* Server Group (Discord connections grouped by server) */
.server-group {
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s ease;
}

.server-group:hover {
  border-color: var(--border);
}

.server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
}

.server-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.server-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.server-name {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
}

.server-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.channel-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

.server-nickname {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.channel-actions-list {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.channel-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  gap: 0.75rem;
}

.channel-action-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.channel-action-row .channel-name {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.channel-buttons {
  display: flex;
  gap: 0.375rem;
}

/* Status Dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.status-dot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  opacity: 0.3;
}

.status-dot.status-active {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.status-active::after {
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.status-warning {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.status-dot.status-error {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.status-dot.status-inactive {
  background: var(--text-muted);
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.5); opacity: 0; }
}

/* Connection Info with Status */
.connection-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.connection-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 1rem;
  flex-shrink: 0;
}

.connection-icon.google {
  background: linear-gradient(135deg, #4285f4, #34a853);
  color: white;
}

.connection-icon.ics {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}

.connection-icon.microsoft {
  background: linear-gradient(135deg, #00a4ef, #0078d4);
  color: white;
}

.connection-icon.discord {
  background: linear-gradient(135deg, #5865F2, #7289da);
  color: white;
}

.connection-details {
  flex: 1;
  min-width: 0;
}

.connection-name {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.connection-item.has-auth-error {
  border: 2px solid var(--danger);
  background: rgba(220, 53, 69, 0.08);
  padding: 0;
}

/* Auth Error Banner (prominente Warnung) */
.auth-error-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  width: 100%;
}

.auth-error-icon {
  font-size: 2rem;
  line-height: 1;
}

.auth-error-content {
  flex: 1;
  min-width: 0;
}

.auth-error-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--danger);
  margin-bottom: 0.125rem;
}

.auth-error-email {
  font-size: 0.8125rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.auth-error-message {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.auth-error-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.auth-error-actions button.primary {
  background: var(--danger);
  border-color: var(--danger);
}

.auth-error-actions button.primary:hover {
  background: #c82333;
  border-color: #bd2130;
}

/* ==================== ACCOUNT GROUPS (Multi-Account Support) ==================== */
.account-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.account-group:hover {
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: var(--shadow-md);
}

.account-group.has-auth-error {
  border: 2px solid var(--danger);
  background: rgba(220, 53, 69, 0.05);
}

.account-group.has-auth-error .auth-error-banner {
  padding: 0.875rem 1rem;
  gap: 0.75rem;
}

.account-group.has-auth-error .auth-error-icon {
  font-size: 1.5rem;
}

.account-group.has-auth-error .account-calendars {
  border-top: 1px solid var(--danger);
  background: rgba(220, 53, 69, 0.03);
  padding: 0.5rem 1rem;
}

/* Discord Event Count Display */
.event-count-display {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.event-count-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.event-count-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.event-count-fill.warning {
  background: #f59e0b;
}

.event-count-fill.danger {
  background: var(--danger);
}

#discord-event-count-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Gear icon button for settings */
.settings-icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.settings-icon-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.form-static-value {
  padding: 0.5rem 0;
  color: var(--text);
  font-weight: 500;
}

.account-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--bg) 0%, rgba(124, 58, 237, 0.03) 100%);
  border-bottom: 1px solid var(--border);
}

.account-info {
  flex: 1;
  min-width: 0;
}

.account-email {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-status {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.account-actions {
  flex-shrink: 0;
}

.account-calendars {
  padding: 0.75rem 1.25rem 1rem;
  background: var(--bg);
}

.calendar-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  margin: 0.25rem -0.75rem;
  gap: 0.75rem;
  border-radius: 8px;
  transition: all var(--transition-fast);
}

.calendar-item-row:hover {
  background: var(--surface-hover);
}

.calendar-item-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}

.calendar-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.calendar-bullet.active {
  background: var(--success);
}

.calendar-item-row .calendar-name {
  font-size: 0.8125rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-item-small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
}

.calendar-item-small .calendar-bullet,
.calendar-item-small .status-dot {
  width: 6px;
  height: 6px;
}

.calendar-item-small .calendar-name {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.calendar-item-small.inactive {
  opacity: 0.6;
}

.calendar-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.calendar-item-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  min-width: auto;
}

.connection-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}

.connection-icon {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  background: #4285f4;
  color: white;
  border-radius: 6px;
  flex-shrink: 0;
}

.connection-details {
  min-width: 0;
}

.connection-email {
  font-weight: 500;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-calendar {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

/* ==================== EVENTS LIST ==================== */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  padding-left: calc(4px + 1rem); /* Base padding + bar width */
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: var(--radius);
  align-items: center;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.event-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  transition: width var(--transition-fast);
  border-radius: var(--radius) 0 0 var(--radius);
}

.event-item:hover {
  background: var(--surface-hover);
  padding-left: calc(8px + 1rem); /* Expanded padding */
}

.event-item:hover::before {
  width: 8px;
}

.event-date {
  font-size: 0.8125rem;
  color: var(--primary);
  min-width: 100px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.event-title {
  flex: 1;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  min-width: 0;
}

.event-location {
  flex: 0 0 150px;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.event-location i {
  color: var(--primary);
  font-size: 0.6875rem;
}

.event-source {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
  text-align: right;
}

.event-source-icon {
  font-size: 0.75rem;
}

/* ==================== ORG LIST ==================== */
.org-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.org-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
}

.org-item:hover {
  border-color: var(--primary);
}

.org-item.active {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.org-item-info {
  display: flex;
  flex-direction: column;
}

.org-item-name {
  font-weight: 500;
  font-size: 0.875rem;
}

.org-item-stats {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==================== AGENTS LIST ==================== */
.agents-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}

.agent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
}

.agent-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 12px 0 0 12px;
}

.agent-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.agent-item:hover::before {
  opacity: 1;
}

.agent-item.active::before {
  opacity: 1;
  background: var(--success);
}

.agent-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  border-radius: 10px;
  font-size: 1.25rem;
  margin-right: 1rem;
  flex-shrink: 0;
}

.agent-info {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.agent-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.event-limit-warning {
  font-size: 0.875rem;
  cursor: help;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.event-limit-warning.warning {
  color: var(--warning, #f59e0b);
}

.event-limit-warning.danger {
  color: var(--error);
}

.event-limit-warning.danger > i {
  animation: pulse-warning 1.5s ease-in-out infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Event Limit Tooltip */
.limit-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  min-width: 200px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  pointer-events: none;
}

.limit-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}

.limit-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--surface);
  z-index: 1;
}

.event-limit-warning:hover .limit-tooltip {
  opacity: 1;
  visibility: visible;
}

.limit-tooltip-title {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.limit-tooltip-title.warning {
  color: var(--warning, #f59e0b);
}

.limit-tooltip-title.danger {
  color: var(--error);
}

.limit-tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.25rem 0;
  font-size: 0.75rem;
}

.limit-tooltip-server {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.limit-tooltip-count {
  font-weight: 600;
  white-space: nowrap;
}

.limit-tooltip-count.warning {
  color: var(--warning, #f59e0b);
}

.limit-tooltip-count.danger {
  color: var(--error);
}

.agent-description {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.agent-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.inactive {
  background: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  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-color: var(--border);
  transition: 0.2s;
  border-radius: 22px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px) translateY(-50%);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Toggle switch with label */
.toggle-switch-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle-switch-label.compact {
  gap: 0.5rem;
  font-size: 0.875rem;
}

.toggle-switch-label.compact + .toggle-switch-label.compact {
  margin-top: 0.25rem;
}

.toggle-label-text {
  font-size: 0.8125rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Pin summary list */
.pin-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pin-summary-option {
  padding: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.toggle-switch.small {
  width: 32px;
  height: 18px;
}

.toggle-switch.small .toggle-slider:before {
  width: 12px;
  height: 12px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
}

.toggle-switch.small input:checked + .toggle-slider:before {
  transform: translateX(16px) translateY(-50%);
}

.agent-status {
  gap: 0.5rem;
}

.agent-status-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 40px;
}

/* ==================== CUSTOMERS LIST ==================== */
.customers-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.customer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.customer-name {
  font-weight: 500;
  font-size: 0.875rem;
}

.customer-slug {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==================== MODALS ==================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  backdrop-filter: blur(4px);
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(1) translateY(0);
  transition: transform 0.2s ease-out;
}

.modal.hidden .modal-content {
  transform: scale(0.95) translateY(10px);
}

.modal-large {
  max-width: 700px;
}

.modal-xlarge {
  max-width: 900px;
}

/* ==================== MODAL TABS ==================== */
.modal-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin: -0.5rem -1.5rem 0 -1.5rem;
  padding: 0 1.5rem;
  overflow-x: auto;
  flex-shrink: 0;
  background: var(--surface);
}

/* Scrollable form container inside modals */
#agent-form {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 1rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal-tab {
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.modal-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.modal-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin: 0 -1.5rem -1rem;
}

/* Tab Layout */
.tab-two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.tab-column {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
}

.tab-column h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-column h3 .section-icon {
  font-size: 1rem;
  opacity: 0.7;
}

.tab-column .info.small {
  font-size: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Subsections within tab columns */
.tab-subsection {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.tab-subsection:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.tab-subsection h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.75rem;
}

/* Full width section below two-column layout */
.tab-full-width {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tab-full-width h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-full-width .info.small {
  font-size: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Google Sync Section Styles */
.sync-section-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sync-toggle-row {
  display: flex;
  align-items: center;
}

.sync-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

.sync-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sync-info span:first-child {
  font-size: 0.8125rem;
  color: var(--text);
}

.sync-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sync-actions .info.small {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

#agent-google-sync-options .form-group {
  margin-top: 0.75rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.settings-grid .form-section {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius);
}

.settings-grid .form-section h3 {
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
}

.small-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0.75rem 0 0.375rem 0;
}

.icon-btn {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--text-muted);
}

@media (max-width: 768px) {
  .tab-two-column {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .modal-tabs {
    margin: -0.5rem -1rem 1rem -1rem;
    padding: 0 1rem;
  }

  .modal-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* ==================== CALENDAR LIST (Modal) ==================== */
.calendar-list-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.calendar-list-header button {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.calendar-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
  max-height: 280px;
  overflow-y: auto;
}

.calendar-item {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  gap: 0.75rem;
}

.calendar-item:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

/* Primary calendar hat keine spezielle Hervorhebung mehr - wird nur als erstes angezeigt */

.calendar-name {
  font-size: 0.8125rem;
  flex: 1;
  text-align: left;
}

.calendar-list label.calendar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.calendar-list label.calendar-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* ==================== DETAIL SECTIONS ==================== */
.agent-detail-content {
  margin: 1rem 0;
}

.detail-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.detail-section h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-header h3 {
  margin-bottom: 0;
}

.section-header button {
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
}

/* ==================== SOURCE LIST ==================== */
.source-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem;
  background: var(--bg);
  border-radius: var(--radius);
  transition: background-color 0.15s ease;
}

.source-item.clickable {
  cursor: pointer;
}

.source-item.clickable:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}

.source-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.channel-category {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
}

.source-item-icon {
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border-radius: 4px;
}

.source-item-name {
  font-size: 0.8125rem;
}

/* ==================== UPCOMING EVENTS LIST ==================== */
.upcoming-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.upcoming-events-list .loading,
.upcoming-events-list .info,
.upcoming-events-list .error {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  padding: 1rem;
}

.upcoming-events-list .error {
  color: var(--error);
}

.upcoming-event-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.upcoming-event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 55px;
  padding: 0.375rem 0.5rem;
  background: var(--surface);
  border-radius: 4px;
  text-align: center;
}

.upcoming-event-date .date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.upcoming-event-date .time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.upcoming-event-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.upcoming-event-info .title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upcoming-event-info .calendar {
  font-size: 0.6875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.upcoming-event-info .calendar::before {
  content: "📅";
  font-size: 0.625rem;
}

/* ==================== INLINE TABS ==================== */
.tabs-inline {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.tab-inline {
  width: auto;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  margin: 0;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.tab-inline:hover {
  background: var(--surface-hover);
}

.tab-inline.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ==================== TEMPLATES LIST ==================== */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.template-item {
  padding: 0.625rem;
  background: var(--bg);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.template-item:hover {
  background: var(--surface-hover);
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.template-name {
  font-size: 0.8125rem;
  font-weight: 500;
}

.template-weight {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.template-remove {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.15s;
  flex-shrink: 0;
}

.template-remove:hover {
  background: var(--danger);
  color: white;
}

.template-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== PLACEHOLDER HELP ==================== */
.placeholder-help {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.placeholder-help h4 {
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.placeholder-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.375rem;
}

.placeholder-item {
  font-size: 0.75rem;
}

.placeholder-item code {
  background: var(--surface);
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
  color: var(--primary);
}

/* ==================== COLOR PICKER ==================== */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.color-swatch-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.color-swatch.selected {
  border-color: white;
  box-shadow: 0 0 0 2px var(--primary);
}

.color-swatch.selected::after {
  content: '\2713';
  font-size: 0.75rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.color-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== LOADING ==================== */
button.loading {
  position: relative;
  color: transparent;
}

button.loading::after {
  content: '';
  position: absolute;
  width: 0.875rem;
  height: 0.875rem;
  top: 50%;
  left: 50%;
  margin: -0.4375rem 0 0 -0.4375rem;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.5s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== UTILITIES ==================== */
.hidden {
  display: none !important;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  #dashboard-section {
    padding: 1rem;
  }

  /* New dashboard layout responsive */
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .stat-card-value {
    font-size: 1.5rem;
    order: 2;
  }

  .stat-card-label {
    order: 1;
  }

  .connect-options {
    flex-direction: column;
  }

  .connect-btn {
    width: 100%;
    justify-content: flex-start;
  }

  /* Legacy grid layout responsive */
  #org-dashboard:not(.dashboard-layout) {
    grid-template-columns: 1fr;
  }

  .agents-list,
  .customers-list {
    grid-template-columns: 1fr;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .header-left {
    flex-direction: column;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
  }

  .stats {
    flex-direction: column;
  }

  .action-buttons {
    flex-direction: column;
  }

  .modal-content,
  .modal-large {
    max-width: 100%;
    margin: 0.5rem;
  }

  .placeholder-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1.5rem 1rem;
  }

  #login-section {
    padding: 1.5rem;
  }

  .connection-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .connection-actions {
    width: 100%;
  }

  .connection-actions button:not(.settings-icon-btn) {
    flex: 1;
  }

  .connection-actions .settings-icon-btn {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
  }
}

/* Success Message */
.success-message {
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  color: var(--success);
}

.success-message div:first-child {
  color: var(--success);
}

.success-message p {
  color: var(--text);
}

/* Refresh Spinner */
.refresh-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Inline Spinner (for headers) */
.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-left: 0.5rem;
}

.spinner-inline.hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-state p {
  margin-bottom: 0.5rem;
}

.empty-state p:first-child:not(.info) {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 500;
}

.empty-state .info {
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.empty-state button {
  margin-top: 1.5rem;
}

.empty-state-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.empty-state-actions button {
  margin-top: 0;
}

/* ==================== FORM VALIDATION ==================== */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--error);
}

.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
  border-color: var(--success);
}

.form-error {
  color: var(--error);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.form-error::before {
  content: '!';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: var(--error);
  color: white;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: bold;
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Input with icon */
.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-right: 2.5rem;
}

.input-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input-icon.success {
  color: var(--success);
}

.input-icon.error {
  color: var(--error);
}

/* ==================== AGENT WIZARD ==================== */
.modal-wizard {
  max-width: 900px;
  min-height: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.wizard-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.wizard-header h2 {
  margin-bottom: 1rem;
}

.wizard-progress {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.wizard-progress::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 40px;
  right: 40px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  position: relative;
  z-index: 1;
}

.step-number {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.step-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.wizard-step.active .step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.wizard-step.active .step-label {
  color: var(--text);
}

.wizard-step.completed .step-number {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.wizard-step.completed .step-number::after {
  content: '✓';
}

.wizard-step.completed .step-label {
  color: var(--success);
}

/* Wizard Pages */
.wizard-page {
  display: none;
  flex: 1;
  overflow-y: auto;
}

.wizard-page.active {
  display: block;
}

.wizard-page h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.wizard-page > .info {
  margin-bottom: 1.25rem;
}

/* Wizard Footer */
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.wizard-footer > button {
  /* Cancel button - auto width */
  width: auto;
  padding: 0.5rem 1rem;
}

.wizard-nav {
  display: flex;
  gap: 0.5rem;
}

.wizard-nav button {
  width: auto;
  min-width: 100px;
  padding: 0.5rem 1.25rem;
}

/* Wizard Selection List */
.wizard-selection-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.wizard-selection-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.wizard-selection-item:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.wizard-selection-item.selected {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
}

.selection-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  border-radius: 6px;
  flex-shrink: 0;
}

.selection-info {
  flex: 1;
  min-width: 0;
}

.selection-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-detail {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.selection-check {
  font-size: 1rem;
  color: var(--primary);
  font-weight: bold;
}

.wizard-selected-items {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Wizard Filter Section */
.wizard-filter-section {
  margin-top: 0.5rem;
}

.wizard-two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.wizard-filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-option {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.875rem;
}

.filter-option-header {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.filter-option-header .toggle-switch {
  margin-top: 2px;
  flex-shrink: 0;
}

.filter-option-header input[type="checkbox"]:not(.toggle-switch input) {
  width: 1rem;
  height: 1rem;
  margin-top: 2px;
  cursor: pointer;
}

.filter-option-header label {
  flex: 1;
  cursor: pointer;
}

.filter-option-header label strong {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
  color: var(--text);
}

.filter-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.filter-option-content {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.filter-option-content input {
  margin-bottom: 0.25rem;
}

.filter-logic-section {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.875rem;
  margin-top: 0.5rem;
}

.filter-logic-section > label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.625rem;
  display: block;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  cursor: pointer;
}

.radio-group input[type="radio"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.radio-group strong {
  color: var(--primary);
}

/* Filter Preview */
.wizard-filter-preview {
  display: flex;
  flex-direction: column;
}

.wizard-filter-preview h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.filter-preview-list {
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.875rem;
  max-height: 300px;
  overflow-y: auto;
}

.preview-summary {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--success);
  margin-bottom: 0.75rem;
}

.preview-events {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.preview-event {
  display: flex;
  gap: 0.625rem;
  padding: 0.5rem;
  background: var(--surface);
  border-radius: 4px;
  align-items: center;
}

.preview-date {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
  min-width: 50px;
}

.preview-title {
  font-size: 0.8125rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wizard-filter-preview button {
  margin-top: 0.75rem;
}

/* Wizard Settings Grid */
.wizard-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.settings-card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--surface-hover);
}

.settings-card-header input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.settings-card-header label {
  cursor: pointer;
  margin: 0;
  color: var(--text);
  font-size: 0.875rem;
}

.settings-card-content {
  padding: 0.875rem;
}

.settings-card-content .form-group {
  margin-bottom: 0.75rem;
}

.settings-card-content .form-group:last-child {
  margin-bottom: 0;
}

.settings-card-content .info {
  margin: 0;
  font-size: 0.75rem;
}

/* NEW: Simple Wizard Settings (vertical list) */
.wizard-settings-simple {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wizard-setting-item {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.wizard-setting-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.wizard-setting-icon {
  font-size: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.wizard-setting-info {
  flex: 1;
  min-width: 0;
}

.wizard-setting-info label {
  display: block;
  margin: 0;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.wizard-setting-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.wizard-setting-details {
  padding: 0 1rem 1rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: -0.25rem;
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.wizard-setting-details.hidden {
  display: none;
}

.wizard-setting-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reminder-list-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  flex: 1;
}

.reminder-list-compact .reminder-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 1rem;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
}

.reminder-list-compact .reminder-item-text {
  white-space: nowrap;
}

.reminder-list-compact .reminder-item-remove {
  font-size: 0.875rem;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
}

.reminder-list-compact .reminder-item-remove:hover {
  opacity: 1;
}

.reminder-add-compact {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reminder-add-compact input[type="number"] {
  width: 55px;
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
}

.reminder-add-compact select {
  width: 70px;
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
}

.reminder-add-compact span {
  color: var(--text-muted);
}

.reminder-add-compact button {
  padding: 0.375rem 0.625rem;
  font-size: 0.8rem;
}

.compact-select {
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.wizard-setting-toggle .compact-select {
  max-width: 180px;
}

.compact-input {
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-hover);
  border-radius: 24px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px) translateY(-50%);
}

/* Wizard Chips */
.wizard-summary-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding-left: 0;
}

.wizard-chip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.wizard-chip:hover {
  border-color: var(--primary);
}

.wizard-chip input {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
}

.wizard-chip:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.wizard-chip span {
  margin: 0;
}

.wizard-frequency-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.wizard-frequency-row label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.wizard-schedule-options {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.wizard-schedule-options.hidden {
  display: none;
}

.wizard-schedule-options span {
  color: var(--text-muted);
}

.wizard-days-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.wizard-days-row span {
  color: var(--text-muted);
}

/* Reminder List */
.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
}

.reminder-item-text {
  color: var(--text);
}

.reminder-item-remove {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.reminder-item-remove:hover {
  color: var(--error);
}

.reminder-add {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.reminder-add-inputs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
}

.reminder-add-inputs span {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.reminder-value-input {
  width: 60px !important;
  min-width: 60px;
}

.reminder-add select {
  width: auto;
  min-width: 90px;
}

.reminder-empty {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  padding: 0.5rem 0;
}

/* Summary Triggers */
.summary-triggers {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.summary-trigger-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8125rem;
}

.summary-trigger-option input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.inline-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inline-select select {
  width: auto;
  min-width: 100px;
}

.inline-select span {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.weekly-schedule-options {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* ==================== DELETE AGENT MODAL ==================== */
.delete-warning {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 1rem;
}

.delete-warning span {
  font-weight: 600;
  color: var(--error);
}

.delete-options {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.5rem;
}

.delete-options > .info {
  margin-bottom: 0.75rem;
}

.delete-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.delete-option:last-of-type {
  border-bottom: none;
}

.delete-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.delete-option span {
  flex: 1;
}

/* Wizard Empty State */
.wizard-empty-state {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.wizard-empty-state .info {
  margin-bottom: 0.5rem;
}

.wizard-empty-state .wizard-add-buttons {
  justify-content: center;
}

/* Wizard Add Section */
.wizard-add-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.wizard-add-section > .info {
  margin-bottom: 0.75rem;
}

.wizard-add-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wizard-add-buttons button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.wizard-add-buttons .discord-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* Wizard Two Sections Layout */
.wizard-two-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  height: 100%;
}

.wizard-section {
  display: flex;
  flex-direction: column;
}

.wizard-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wizard-section h3 i {
  font-size: 0.75rem;
  color: var(--primary);
}

.wizard-section > .info {
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.wizard-selection-list.compact {
  max-height: 180px;
}

.wizard-add-inline {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.wizard-add-inline button {
  font-size: 0.6875rem;
  padding: 0.375rem 0.5rem;
}

/* Target Options */
.wizard-target-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.target-option-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.target-option-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
}

.target-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: white;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.target-icon.discord {
  background: #5865F2;
}

.target-icon.google-sync {
  background: linear-gradient(135deg, #4285f4, #f59e0b);
}

.target-option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.target-option-info strong {
  font-size: 0.8125rem;
  font-weight: 600;
}

.target-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* Responsive for wizard two-sections */
@media (max-width: 600px) {
  .wizard-two-sections {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Responsive Wizard */
@media (max-width: 768px) {
  .modal-wizard {
    max-width: 100%;
    min-height: auto;
    max-height: 95vh;
  }

  .wizard-two-column {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .wizard-progress::before {
    display: none;
  }

  .wizard-progress {
    gap: 0.25rem;
  }

  .step-label {
    display: none;
  }

  .wizard-footer {
    flex-direction: column;
    gap: 0.75rem;
  }

  .wizard-nav {
    width: 100%;
    justify-content: space-between;
  }

  .wizard-nav button {
    flex: 1;
  }

  .wizard-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== ADMIN: CUSTOMERS LIST ==================== */

.customers-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.customer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.customer-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.customer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.customer-header strong {
  margin-right: 0.5rem;
}

.customer-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.customer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.customer-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Organization Stats Modal */
.org-stats-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.org-stats-header h3 {
  margin: 0;
}

.org-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.org-stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}

.org-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.org-stat-limit {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
}

.org-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.org-limits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1rem;
}

.org-limit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}

.org-limit-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.org-limit-value {
  font-size: 0.8rem;
  font-weight: 600;
}

.org-limit-value.enabled {
  color: var(--success);
}

.org-limit-value.disabled {
  color: var(--text-muted);
}

#org-stats-content h4 {
  font-size: 0.9rem;
  margin: 1rem 0 0.75rem 0;
  color: var(--text);
}

.org-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.org-member-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.org-member-item small {
  margin-left: auto;
  color: var(--text-muted);
}

.org-agents-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.org-agent-item {
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
}

.org-agent-item.active {
  border-left-color: var(--success);
}

.org-agent-item.inactive {
  opacity: 0.6;
}

.org-agent-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.org-agent-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.org-agent-item small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.reminder-distribution {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.reminder-bar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reminder-label {
  width: 80px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reminder-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.reminder-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
}

.reminder-count {
  width: 40px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.org-stats-meta {
  display: flex;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.org-stats-meta small {
  color: var(--text-muted);
}

/* Checkbox grid for subscription modal */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

/* ==================== EVENTS PREVIEW (integrated with calendar) ==================== */

.events-preview {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.events-preview-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.events-preview-title::before {
  content: '📅';
}

.events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.events-header .events-preview-title {
  margin-bottom: 0;
}

.events-pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.75rem;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 40px;
  text-align: center;
}

/* ==================== ORGANIZATION MANAGEMENT ==================== */

.org-management-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .org-management-layout {
    grid-template-columns: 1fr;
  }
}

/* Subscription Info */
.subscription-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.plan-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1.125rem;
}

.plan-badge.plan-free {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.plan-badge.plan-basic {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
}

.plan-badge.plan-pro {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
}

.plan-badge.plan-enterprise {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.limits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

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

.limit-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.limit-value {
  font-weight: 500;
  font-family: var(--font-mono);
}

.features-list {
  grid-column: span 2;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.features-list h4 {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.feature-item {
  display: inline-block;
  margin-right: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.feature-item.enabled {
  color: var(--success);
}

.feature-item.disabled {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Members List */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.member-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border);
}

.member-details {
  display: flex;
  flex-direction: column;
}

.member-name {
  font-weight: 500;
}

.member-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.member-actions select.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Invitations List */
.invitations-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.invitation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
}

.invitation-info {
  display: flex;
  flex-direction: column;
}

.invitation-email {
  font-weight: 500;
}

.invitation-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Badge role colors */
.badge.owner {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.badge.admin {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
}

.badge.member {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
  max-width: 100%;
}

.toast.toast-out {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  font-size: 1.125rem;
  line-height: 1;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-muted);
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: auto;
  transition: color 0.15s;
}

.toast-close:hover {
  color: var(--text);
  background: none;
}

/* Toast variants */
.toast.toast-success {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}

.toast.toast-success .toast-icon {
  color: var(--success);
}

.toast.toast-success .toast-title {
  color: var(--success);
}

.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
}

.toast.toast-error .toast-icon {
  color: var(--error);
}

.toast.toast-error .toast-title {
  color: var(--error);
}

.toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
}

.toast.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast.toast-warning .toast-title {
  color: #f59e0b;
}

.toast.toast-info {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.1);
}

.toast.toast-info .toast-icon {
  color: #3b82f6;
}

.toast.toast-info .toast-title {
  color: #3b82f6;
}

/* Loading Toast with Spinner */
.toast.toast-loading {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.1);
  padding: 0.75rem 1rem;
}

.toast-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

/* ==================== CONFIRMATION MODAL ==================== */
.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10000;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal.visible {
  opacity: 1;
  visibility: visible;
}

.confirm-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.confirm-modal.visible .confirm-modal-content {
  transform: scale(1);
}

.confirm-modal-icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.confirm-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.5rem;
}

.confirm-modal-message {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.confirm-modal-buttons {
  display: flex;
  gap: 0.75rem;
}

.confirm-modal-buttons button {
  flex: 1;
}

.confirm-modal.confirm-danger .confirm-modal-icon {
  color: var(--error);
}

.confirm-modal.confirm-danger .btn-confirm {
  background: var(--error);
}

.confirm-modal.confirm-danger .btn-confirm:hover {
  background: #dc2626;
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Modal-specific loading overlay */
.modal-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-loading-overlay .loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 4px;
}

/* Card/Section loading state */
.card.is-loading,
.dashboard-section.is-loading {
  position: relative;
  min-height: 100px;
}

/* Button with spinner text */
button.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

button.btn-loading::after {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 50%;
  left: 50%;
  margin: -0.5rem 0 0 -0.5rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

button.btn-loading.secondary::after {
  border-top-color: var(--text);
}

button.btn-loading.danger::after {
  border-top-color: white;
}

/* ==================== PLAN CARDS (Admin) ==================== */

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.plan-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.plan-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.plan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.plan-price {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--primary);
}

.plan-card-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.plan-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.plan-card-limits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.plan-card-limits span {
  background: var(--bg-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

/* ==================== PERMISSION CHECK MODAL ==================== */
.permission-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.permission-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.25rem 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.permission-item.perm-ok {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.05);
}

.permission-item.perm-missing {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.permission-item.perm-optional {
  border-color: var(--border);
  opacity: 0.7;
}

.perm-icon {
  grid-row: span 2;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
}

.perm-name {
  font-weight: 500;
  font-size: 0.9rem;
}

.perm-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.permission-help {
  border-left: 3px solid var(--primary);
}

.permission-help ol {
  line-height: 1.8;
}

.perm-success {
  color: var(--success);
  padding: 0.75rem;
  background: rgba(34, 197, 94, 0.1);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.perm-error {
  color: var(--error);
  padding: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

/* Modal Header Row */
.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header-row h2 {
  margin: 0;
}

/* Test Steps with Spinner */
.test-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.test-step.step-success {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.05);
}

.test-step.step-failed {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}

.step-icon {
  font-size: 1.25rem;
  width: 1.5rem;
  text-align: center;
}

.step-icon.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.step-icon.pending {
  opacity: 0.5;
}

.step-name {
  flex: 1;
  font-weight: 500;
}

.step-status {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.step-success .step-status {
  color: var(--success);
}

.step-failed .step-status {
  color: var(--error);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== EMBED BUILDER ==================== */

.embed-builder-modal {
  max-width: 1200px;
  width: 95vw;
}

.embed-builder-container {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .embed-builder-container {
    grid-template-columns: 1fr;
  }
}

.embed-editor {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.embed-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.embed-section h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.input-row small {
  color: var(--text-muted);
  white-space: nowrap;
}

.color-picker-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.color-picker-row input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.color-picker-row input[type="text"] {
  width: 90px;
  font-family: monospace;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Embed Fields */
.embed-field-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.embed-field-item .field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.embed-field-item .field-header span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.embed-field-item .remove-field {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
  width: auto;
  min-width: unset;
  flex-shrink: 0;
}

.embed-field-item .remove-field:hover {
  color: #ff6b6b;
}

.embed-field-item input,
.embed-field-item textarea {
  width: 100%;
  margin-bottom: 0.5rem;
}

.embed-field-item .field-options {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==================== DISCORD PREVIEW ==================== */

.embed-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  height: fit-content;
  max-height: 70vh;
  overflow-y: auto;
}

.embed-preview h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.discord-preview {
  background: #313338;
  border-radius: 8px;
  padding: 1rem;
  font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.discord-message {
  display: flex;
  gap: 1rem;
}

.discord-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  flex-shrink: 0;
}

.discord-message-content {
  flex: 1;
  min-width: 0;
}

.discord-username {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.discord-username .name {
  font-weight: 500;
  color: #f2f3f5;
  font-size: 1rem;
}

.discord-username .bot-tag {
  background: #5865f2;
  color: white;
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.1rem 0.275rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.discord-text {
  color: #dbdee1;
  font-size: 1rem;
  line-height: 1.375;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.25rem;
}

.discord-text:empty {
  display: none;
}

/* Discord Embed */
.discord-embed {
  display: grid;
  grid-template-columns: auto 1fr auto;
  max-width: 520px;
  background: #2b2d31;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.discord-embed.hidden {
  display: none;
}

.embed-color-bar {
  width: 4px;
  background: var(--primary);
}

.embed-content-wrapper {
  padding: 0.5rem 1rem 1rem 0.75rem;
  min-width: 0;
}

.embed-thumbnail {
  width: 80px;
  height: 80px;
  margin: 1rem 1rem 0 0;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.embed-thumbnail:empty {
  display: none;
}

.embed-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.embed-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: #f2f3f5;
}

.embed-author:empty {
  display: none;
}

.embed-author img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.embed-author a {
  color: #f2f3f5;
  text-decoration: none;
}

.embed-author a:hover {
  text-decoration: underline;
}

.embed-title {
  font-weight: 600;
  font-size: 1rem;
  color: #00aff4;
  margin-bottom: 0.5rem;
}

.embed-title:empty {
  display: none;
}

.embed-description {
  color: #dbdee1;
  font-size: 0.875rem;
  line-height: 1.125rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.embed-description:empty {
  display: none;
}

.embed-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.embed-fields.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.embed-fields.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.embed-fields:empty {
  display: none;
}

.embed-field {
  min-width: 0;
  grid-column: span 3; /* Default: full width */
}

.embed-fields.cols-2 .embed-field {
  grid-column: span 2;
}

.embed-fields.cols-3 .embed-field {
  grid-column: span 3;
}

.embed-field.inline {
  grid-column: span 1; /* Inline: takes 1 column */
}

.embed-field:not(.inline) {
  grid-column: 1 / -1; /* Full width - spans all columns */
}

.embed-field-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f2f3f5;
  margin-bottom: 0.125rem;
}

.embed-field-value {
  font-size: 0.875rem;
  color: #dbdee1;
  line-height: 1.125rem;
  white-space: pre-wrap;
}

.embed-image-container {
  margin-top: 1rem;
  border-radius: 4px;
  overflow: hidden;
  max-width: 400px;
}

.embed-image-container:empty {
  display: none;
}

.embed-image-container img {
  max-width: 100%;
  height: auto;
  display: block;
}

.embed-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #b5bac1;
}

.embed-footer:empty {
  display: none;
}

.embed-footer img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.embed-footer .separator {
  margin: 0 0.25rem;
}

/* Modal Actions */
.modal-actions {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ==================== INLINE EMBED EDITOR ==================== */

.embed-inline-editor {
  position: relative;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.editor-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-toolbar label {
  font-size: 0.75rem;
  margin-bottom: 0;
}

.editor-toolbar input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.editor-toolbar .toggle-label.small {
  font-size: 0.75rem;
}

.embed-inline-editor .discord-preview {
  border-radius: 0 0 8px 8px;
}

/* Override :empty hiding for inline editor - show all editable elements */
.embed-inline-editor .embed-title,
.embed-inline-editor .embed-description,
.embed-inline-editor .embed-thumbnail,
.embed-inline-editor .embed-image-container {
  display: block !important;
}

.embed-inline-editor .embed-author,
.embed-inline-editor .embed-footer {
  display: flex !important;
}

/* Editable Elements - minimal styling to preserve Discord look */
.editable {
  outline: none;
  border-radius: 2px;
  transition: box-shadow 0.15s;
  min-height: 1em;
}

.editable:hover {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.editable:focus {
  box-shadow: 0 0 0 1px var(--primary);
}

.editable:empty::before {
  content: attr(data-placeholder);
  color: #5c5e66;
  pointer-events: none;
}

/* Specific editable element sizes */
.embed-inline-editor .embed-title.editable {
  min-height: 1.2em;
}

.embed-inline-editor .embed-description.editable {
  min-height: 2em;
}

.editable:focus:empty::before {
  color: #8b8d96;
}

/* Editable Row (for author/footer with icons) */
.editable-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 4px;
  margin: -4px;
  border-radius: 4px;
  transition: background-color 0.15s;
}

.editable-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Icon Placeholders */
.author-icon-placeholder,
.footer-icon-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.author-icon-placeholder:hover,
.footer-icon-placeholder:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
}

.author-icon-placeholder span,
.footer-icon-placeholder span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.author-icon-placeholder.has-image,
.footer-icon-placeholder.has-image {
  border: none;
  background: none;
}

.author-icon-placeholder img,
.footer-icon-placeholder img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.footer-icon-placeholder {
  width: 20px;
  height: 20px;
}

/* Timestamp preview in footer */
.timestamp-preview {
  color: #b5bac1;
  font-size: 0.75rem;
}

.timestamp-preview::before {
  content: ' • ';
}

.timestamp-preview:empty {
  display: none;
}

.timestamp-preview:empty::before {
  display: none;
}

/* Editable Image Placeholders */
.editable-image {
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.editable-image .image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.editable-image:hover .image-placeholder {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  color: rgba(255, 255, 255, 0.6);
}

.editable-image.has-image .image-placeholder {
  display: none;
}

/* Thumbnail specific */
#preview-thumbnail.editable-image {
  min-width: 80px;
  min-height: 80px;
}

#preview-thumbnail .image-placeholder {
  width: 80px;
  height: 80px;
}

/* Image container specific */
#preview-image-container.editable-image {
  min-height: 60px;
  margin-top: 0.75rem;
}

#preview-image-container .image-placeholder {
  height: 60px;
  width: 100%;
}

#preview-image-container.has-image {
  min-height: auto;
}

/* Add Field Button Inline */
.add-field-inline {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s;
  width: auto;
}

.add-field-inline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  color: rgba(255, 255, 255, 0.7);
}

/* Inline Field Editor */
.embed-field.editable-field {
  position: relative;
  padding: 4px;
  margin: -4px;
  border-radius: 4px;
  transition: background-color 0.15s;
}

.embed-field.editable-field:hover {
  background: rgba(255, 255, 255, 0.05);
}

.embed-field.editable-field .field-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px !important;
  height: 18px;
  min-width: unset;
  padding: 0;
  background: var(--error);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.embed-field.editable-field:hover .field-remove {
  opacity: 1;
}

.embed-field .editable {
  display: block;
}

.embed-field .field-inline-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.4);
  opacity: 0;
  transition: opacity 0.15s;
}

.embed-field.editable-field:hover .field-inline-toggle {
  opacity: 1;
}

.embed-field .field-inline-toggle input {
  width: 12px;
  height: 12px;
}

/* URL Popover */
.url-popover {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-width: 280px;
}

.url-popover.hidden {
  display: none;
}

.url-popover input {
  flex: 1;
  font-size: 0.8125rem;
  padding: 0.375rem 0.5rem;
}

.url-popover .popover-buttons {
  display: flex;
  gap: 0.25rem;
}

.url-popover .popover-buttons button {
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 200px;
  max-width: 300px;
  max-height: 250px;
  overflow-y: auto;
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-header {
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.autocomplete-list {
  padding: 0.25rem 0;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--surface-hover);
}

.autocomplete-item .role-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.autocomplete-item .role-name {
  font-size: 0.875rem;
  color: var(--text);
}

.autocomplete-item .role-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
}

.autocomplete-empty {
  padding: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Discord text editable in inline mode */
.discord-text.editable {
  min-height: 1.375em;
}

.discord-text.editable:empty {
  display: block;
}

.discord-text.editable:empty::before {
  content: attr(data-placeholder);
}

/* ==================== ADMIN DASHBOARD ==================== */

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 0 1.5rem 0;
  margin-top: -1rem;
  background: #000000;
  background: linear-gradient(180deg, rgba(0, 0, 0, 1) 30%, rgba(0, 0, 0, 0) 100%);
}

.admin-header h1 {
  font-size: 1.5rem;
  margin: 0;
}

.time-range-selector {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  padding: 0.25rem;
  border-radius: var(--radius);
}

.time-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.time-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.time-btn.active {
  background: var(--primary);
  color: white;
}

/* Stats Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.admin-stat-card.quota {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(124, 58, 237, 0.1) 100%);
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.admin-stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.admin-stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
}

/* Charts Row */
.admin-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-chart-card {
  min-height: 300px;
}

.admin-chart-card h3 {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.admin-chart-card canvas {
  max-height: 250px;
}

/* Chart container with fixed height for Chart.js */
.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
}

.chart-container canvas {
  max-height: 100% !important;
}

/* Full-width chart card */
.admin-chart-card-full {
  min-height: 300px;
  grid-column: 1 / -1;
}

.admin-chart-card-full h3 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.admin-chart-card-full canvas {
  max-height: 250px;
}

/* Quiet Hours Stats */
.quiet-hours-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.quiet-hours-stats span {
  color: var(--text-muted);
}

.quiet-hours-stats span span {
  color: var(--primary);
  font-weight: 500;
}

/* Reminder Stats */
.reminder-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.reminder-stats span {
  color: var(--text-muted);
}

.reminder-stats span span {
  color: var(--primary);
  font-weight: 500;
}

.reminder-distribution-bars,
.reminder-ranges-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* All-Time Grid */
.admin-alltime-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.alltime-item {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.alltime-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.alltime-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Manual Sync Stats */
.manual-sync-stats {
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.manual-sync-stats p {
  margin-bottom: 0.5rem;
}

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

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

.admin-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.admin-table tr:hover {
  background: var(--surface-hover);
}

/* Errors List */
.errors-list {
  max-height: 400px;
  overflow-y: auto;
}

.error-item {
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  border-left: 3px solid var(--danger);
}

.error-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.error-item-service {
  font-weight: 600;
  color: var(--text);
}

.error-item-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.error-item-endpoint {
  color: var(--text-muted);
  font-family: monospace;
  font-size: 0.75rem;
}

.error-item-message {
  color: var(--danger);
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-charts-row {
    grid-template-columns: 1fr;
  }

  .admin-alltime-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-table {
    display: block;
    overflow-x: auto;
  }
}

/* ==================== MODAL OVERLAY ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 90vh;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* Organization Settings Modal */
.org-settings-section {
  margin-bottom: 1.5rem;
}

.org-settings-section:last-child {
  margin-bottom: 0;
}

.org-settings-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.section-description {
  color: var(--text-muted);
  font-size: 0.813rem;
  margin-bottom: 1rem;
}

.info-box {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.info-box p {
  font-size: 0.813rem;
  color: var(--text);
  margin: 0;
}

.info-box p + p {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* Fancy Switch Label (with sliding toggle) */
.switch-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.switch-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch-label .toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.switch-label .toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text);
  border-radius: 50%;
  transition: var(--transition-fast);
}

.switch-label input:checked + .toggle-switch {
  background: var(--primary);
}

.switch-label input:checked + .toggle-switch::after {
  left: 22px;
}

/* Form Row for Quiet Hours section (scoped) */
.quiet-hours-settings .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Quiet Hours Presets */
.quiet-hours-presets {
  margin-bottom: 1rem;
}

.presets-label {
  font-size: 0.813rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.preset-btn {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.preset-btn:hover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
}

.preset-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Quiet Hours Preview */
.quiet-hours-preview {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-hover);
  border-radius: var(--radius);
  font-size: 0.813rem;
  color: var(--text-muted);
}

.quiet-hours-settings {
  margin-top: 1rem;
}

/* Feature Unavailable Message */
.feature-unavailable {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius);
  color: var(--warning);
  font-size: 0.813rem;
}

/* ==================== ONBOARDING TOUR ==================== */

/* Custom Driver.js popover styling */
.harptos-tour-popover {
  --popover-bg: var(--surface);
  --popover-border: var(--border);
  --popover-text: var(--text);
}

.driver-popover {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
  max-width: 360px !important;
}

.driver-popover * {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.driver-popover-title {
  color: var(--text) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.5rem !important;
}

.driver-popover-description {
  color: var(--text-secondary) !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
}

.driver-popover-progress-text {
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
}

.driver-popover-navigation-btns {
  gap: 0.5rem !important;
}

.driver-popover-prev-btn,
.driver-popover-next-btn {
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  transition: all 0.15s ease !important;
  border: none !important;
  text-shadow: none !important;
}

/* Hide pseudo-elements that may duplicate button text */
.driver-popover-prev-btn::before,
.driver-popover-prev-btn::after,
.driver-popover-next-btn::before,
.driver-popover-next-btn::after,
.driver-popover-close-btn::before,
.driver-popover-close-btn::after {
  content: none !important;
  display: none !important;
}

.driver-popover-prev-btn {
  background: var(--surface-hover) !important;
  color: var(--text) !important;
}

.driver-popover-prev-btn:hover {
  background: var(--bg-secondary) !important;
}

.driver-popover-next-btn {
  background: var(--primary) !important;
  color: white !important;
}

.driver-popover-next-btn:hover {
  background: var(--primary-hover) !important;
}

.driver-popover-close-btn {
  color: var(--text-muted) !important;
  font-size: 1.25rem !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius) !important;
  transition: all 0.15s ease !important;
}

.driver-popover-close-btn:hover {
  background: var(--surface-hover) !important;
  color: var(--text) !important;
}

.driver-popover-arrow-side-left.driver-popover-arrow,
.driver-popover-arrow-side-right.driver-popover-arrow,
.driver-popover-arrow-side-top.driver-popover-arrow,
.driver-popover-arrow-side-bottom.driver-popover-arrow {
  border-color: var(--surface) !important;
}

/* Highlight styling */
.driver-active-element {
  outline: 2px solid var(--primary) !important;
  outline-offset: 4px !important;
  border-radius: var(--radius) !important;
}

/* Overlay styling */
.driver-overlay {
  background: rgba(0, 0, 0, 0.7) !important;
}

/* ==================== AGENT LIVE STATUS ==================== */

.agent-item {
  position: relative;
}

.agent-live-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.agent-status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.agent-status-row i {
  width: 14px;
  text-align: center;
  color: var(--primary);
}

.agent-status-row .status-value {
  color: var(--text);
  font-weight: 500;
}

.agent-status-row.success .status-value {
  color: var(--success);
}

.agent-status-row.warning .status-value {
  color: var(--warning);
}

.agent-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.agent-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.agent-quick-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.agent-item:hover .agent-quick-actions {
  opacity: 1;
}

.agent-quick-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.agent-quick-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ==================== COMMAND PALETTE ==================== */

.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.command-palette-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.command-palette {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 90%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.command-palette-overlay.visible .command-palette {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.command-palette-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.command-palette-search i {
  color: var(--text-muted);
  font-size: 1.125rem;
}

.command-palette-search input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 1rem;
  color: var(--text);
  outline: none;
}

.command-palette-search input::placeholder {
  color: var(--text-muted);
}

.command-palette-search kbd {
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: inherit;
}

.command-palette-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.command-palette-group {
  margin-bottom: 0.5rem;
}

.command-palette-group-title {
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
}

.command-palette-item:hover,
.command-palette-item.selected {
  background: var(--surface-hover);
}

.command-palette-item.selected {
  background: rgba(124, 58, 237, 0.15);
}

.command-palette-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 1rem;
}

.command-palette-item-content {
  flex: 1;
}

.command-palette-item-title {
  font-size: 0.875rem;
  color: var(--text);
}

.command-palette-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.command-palette-item-shortcut {
  display: flex;
  gap: 0.25rem;
}

.command-palette-item-shortcut kbd {
  padding: 0.125rem 0.375rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.625rem;
  color: var(--text-muted);
}

.command-palette-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.command-palette-empty i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ==================== ACTIVITY FEED ==================== */

.activity-feed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.activity-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.activity-feed-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.activity-feed-header h3 i {
  color: var(--primary);
}

.activity-date-group {
  margin-bottom: 1rem;
}

.activity-date-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.activity-icon.reminder {
  background: rgba(124, 58, 237, 0.2);
  color: var(--primary);
}

.activity-icon.sync {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.activity-icon.event {
  background: rgba(59, 130, 246, 0.2);
  color: var(--info);
}

.activity-icon.error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.4;
}

.activity-text strong {
  font-weight: 600;
}

.activity-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.activity-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.activity-empty i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ==================== ONBOARDING CHECKLIST ==================== */

.onboarding-checklist {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(124, 58, 237, 0.08) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.onboarding-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.onboarding-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
}

.onboarding-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.onboarding-progress {
  text-align: right;
}

.onboarding-progress-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.onboarding-progress-bar {
  width: 120px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 0.375rem;
  overflow: hidden;
}

.onboarding-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.onboarding-step:hover:not(.completed) {
  background: rgba(124, 58, 237, 0.1);
}

.onboarding-step.completed {
  opacity: 0.6;
}

.onboarding-step-check {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: 50%;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.onboarding-step.completed .onboarding-step-check {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.onboarding-step-content {
  flex: 1;
}

.onboarding-step-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}

.onboarding-step.completed .onboarding-step-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.onboarding-step-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.onboarding-step.completed .onboarding-step-arrow {
  display: none;
}

.onboarding-dismiss {
  margin-top: 0.75rem;
  text-align: center;
}

.onboarding-dismiss button {
  width: auto;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.onboarding-dismiss button:hover {
  color: var(--text);
  background: transparent;
  transform: none;
  box-shadow: none;
}

/* ==================== TEMPLATE GALLERY ==================== */

.template-gallery {
  margin-bottom: 1rem;
}

.template-gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.template-gallery-header h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.template-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.template-gallery-item {
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.template-gallery-item:hover {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.05);
}

.template-gallery-item.selected {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
}

.template-gallery-icon {
  font-size: 1.5rem;
  margin-bottom: 0.375rem;
}

.template-gallery-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.125rem;
}

.template-gallery-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ==================== NOTIFICATION CENTER ==================== */

.notification-bell {
  position: relative;
  padding: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.125rem;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.notification-bell:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--error);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
}

.notification-dropdown.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.notification-header h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

button.notification-mark-read {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: transparent !important;
  border: none;
  border-radius: 0;
  cursor: pointer;
  padding: 0;
  width: auto;
  transition: color 0.15s;
  box-shadow: none !important;
  transform: none !important;
}

button.notification-mark-read:hover {
  text-decoration: none;
  color: var(--text);
  background: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
}

.notification-item:hover {
  background: var(--surface-hover);
}

.notification-item.unread {
  background: rgba(124, 58, 237, 0.05);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.notification-icon.success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.notification-icon.error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.notification-icon.warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.notification-icon.info {
  background: rgba(59, 130, 246, 0.2);
  color: var(--info);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-text {
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.4;
}

.notification-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.notification-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.notification-empty i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ==================== BULK OPERATIONS ==================== */

.bulk-actions-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.bulk-actions-bar.hidden {
  display: none;
}

.bulk-select-count {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

.bulk-actions-buttons {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.bulk-actions-buttons button {
  width: auto;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* Agent checkbox - only visible in bulk mode */
.agent-checkbox {
  display: none;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.bulk-mode .agent-checkbox {
  display: flex;
}

.agent-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Custom checkbox styling */
.agent-checkbox .checkbox-custom {
  display: none; /* Use native checkbox for simplicity */
}

/* Selected agent styling in bulk mode */
.bulk-mode .agent-item.selected {
  background: var(--primary-alpha);
  border-color: var(--primary);
}

.bulk-mode .agent-item.selected::before {
  background: var(--primary);
}

/* ==================== MOBILE OPTIMIZATION ==================== */

/* Mobile Bottom Navigation */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.5rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
  z-index: 1000;
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.625rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.15s;
  width: auto;
}

.mobile-nav-item i {
  font-size: 1.25rem;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item:hover {
  color: var(--text);
  background: var(--surface-hover);
  transform: none;
  box-shadow: none;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Show mobile nav */
  .mobile-nav {
    display: block;
  }

  /* Hide desktop tabs */
  #main-nav.tabs {
    display: none;
  }

  /* Add bottom padding for mobile nav */
  #dashboard-section {
    padding-bottom: 80px;
  }

  /* Stats row to 2 columns */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Single column layouts */
  .tab-two-column {
    grid-template-columns: 1fr;
  }

  .wizard-two-column {
    grid-template-columns: 1fr;
  }

  /* Full width modals */
  .modal-content {
    width: 95%;
    max-width: none;
    margin: 1rem;
  }

  /* Larger touch targets */
  button, .connect-btn, .tab {
    min-height: 44px;
  }

  /* Collapsible cards */
  .dashboard-section {
    padding: 1rem;
  }

  /* Command palette adjustments */
  .command-palette {
    top: 5%;
    width: 95%;
  }

  /* Notification dropdown */
  .notification-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 70vh;
  }

  /* Header adjustments */
  header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .header-left h1 {
    font-size: 1.125rem;
  }

  /* Connect options stack */
  .connect-options {
    flex-direction: column;
  }

  .connect-btn {
    width: 100%;
  }

  /* Agent cards */
  .agent-item {
    padding: 1rem;
  }

  .agent-quick-actions {
    opacity: 1;
    margin-top: 0.75rem;
  }

  /* Activity feed */
  .activity-feed {
    max-height: 300px;
  }

  /* Onboarding */
  .onboarding-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .onboarding-progress {
    text-align: left;
    width: 100%;
  }

  .onboarding-progress-bar {
    width: 100%;
  }
}

@media (max-width: 480px) {
  /* Single column stats */
  .stats-row {
    grid-template-columns: 1fr;
  }

  /* Smaller text */
  .stat-card-value {
    font-size: 1.5rem;
  }

  /* Compact agent items */
  .agent-live-status {
    gap: 0.375rem;
  }

  /* Template gallery */
  .template-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .agent-quick-actions {
    opacity: 1;
  }

  .agent-checkbox {
    opacity: 1;
  }

  button:hover {
    transform: none;
  }
}

/* ==================== FILTER PREVIEW ENHANCED ==================== */

.filter-preview-enhanced {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
}

.filter-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
}

.filter-preview-count {
  font-size: 0.8125rem;
  font-weight: 500;
}

.filter-preview-count .match {
  color: var(--success);
}

.filter-preview-count .total {
  color: var(--text-muted);
}

.filter-preview-list-enhanced {
  padding: 0.5rem;
}

.filter-preview-event {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  margin-bottom: 0.25rem;
}

.filter-preview-event.matches {
  background: rgba(34, 197, 94, 0.1);
}

.filter-preview-event.filtered {
  background: rgba(239, 68, 68, 0.05);
  opacity: 0.6;
}

.filter-preview-status {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.6875rem;
  flex-shrink: 0;
}

.filter-preview-event.matches .filter-preview-status {
  background: var(--success);
  color: white;
}

.filter-preview-event.filtered .filter-preview-status {
  background: var(--border);
  color: var(--text-muted);
}

.filter-preview-event-info {
  flex: 1;
  min-width: 0;
}

.filter-preview-event-title {
  font-size: 0.8125rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-preview-event.filtered .filter-preview-event-title {
  color: var(--text-muted);
  text-decoration: line-through;
}

.filter-preview-event-date {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.filter-preview-event-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ==================== UX IMPROVEMENTS ====================*/

/* === TOOLTIPS & HELP SYSTEM === */

.help-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.375rem;
  cursor: help;
}

.help-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 0.625rem;
  color: var(--text-muted);
  transition: all 0.15s;
}

.help-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.help-tooltip .tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.625rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.75rem;
  color: var(--text);
  line-height: 1.5;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s;
  pointer-events: none;
}

.help-tooltip .tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}

.help-tooltip:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
}

/* Inline help text */
.help-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  line-height: 1.4;
}

.help-text i {
  margin-right: 0.25rem;
  opacity: 0.7;
}

/* Info Banner for sections */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.info-banner-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--info);
  border-radius: 50%;
  color: white;
  font-size: 0.6875rem;
}

.info-banner-content {
  flex: 1;
}

.info-banner-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.125rem;
}

.info-banner-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.info-banner-dismiss {
  flex-shrink: 0;
  padding: 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  width: auto;
  min-width: unset;
}

.info-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  transform: none;
  box-shadow: none;
}

/* === IMPROVED PLACEHOLDERS === */

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

/* Higher contrast for important inputs */
#email::placeholder,
#otp::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

/* === LARGER TOGGLE SWITCHES === */

.toggle-switch {
  width: 48px;
  height: 26px;
}

.toggle-switch .slider {
  border-radius: 26px;
}

.toggle-switch .slider:before {
  width: 20px;
  height: 20px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(24px) translateY(-50%);
}

/* === STRONGER STATUS INDICATORS === */

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-indicator.active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-indicator.inactive {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.status-indicator .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: none;
}

.status-indicator.active .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: pulse-status 2s ease-in-out infinite;
}

.status-indicator.inactive .status-dot {
  background: var(--text-muted);
}

@keyframes pulse-status {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.1); }
}

/* Stronger badge for agent status */
.agent-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.agent-status-badge.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.1) 100%);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.agent-status-badge.inactive {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* === ACTION FEEDBACK === */

/* Save success animation */
@keyframes save-success {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.save-success {
  animation: save-success 0.3s ease;
}

/* Toggle feedback */
.toggle-switch input:checked + .slider {
  background-color: var(--success);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

/* Button click feedback */
button:active:not(:disabled) {
  transform: scale(0.97);
}

/* Saving state */
.is-saving {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.is-saving::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Saved indicator */
.saved-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: rgba(34, 197, 94, 0.1);
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s;
}

.saved-indicator.visible {
  opacity: 1;
}

.saved-indicator i {
  font-size: 0.875rem;
}

/* === NAVIGATION TOOLTIPS === */

.tab {
  position: relative;
}

.tab::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.375rem 0.625rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.6875rem;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s;
  pointer-events: none;
  z-index: 100;
}

.tab:hover::after {
  opacity: 1;
  visibility: visible;
}

.tab:not([data-tooltip])::after {
  display: none;
}

/* === KEYBOARD NAVIGATION INDICATORS === */

*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2);
}

.tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* Keyboard shortcut hints */
.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  opacity: 0.6;
}

.kbd-hint kbd {
  padding: 0.125rem 0.375rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.625rem;
  font-family: inherit;
  color: var(--text-muted);
}

/* === EMAIL VALIDATION ENHANCED === */

.form-group.has-error input {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.05);
}

.form-group.has-error input:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-error {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--error);
}

.form-error i {
  font-size: 0.875rem;
}

.form-group.has-success input {
  border-color: var(--success);
}

.form-group.has-success input:focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* === IMPROVED CONNECT BUTTONS === */

.connect-btn .connect-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.connect-btn .connect-title {
  font-weight: 600;
}

.connect-btn .connect-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* === LOGOUT MORE VISIBLE === */

.dropdown-item.logout {
  color: var(--error);
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  padding-top: 0.625rem;
}

.dropdown-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* === UNDO/REVERT NOTICE === */

.undo-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.undo-notice.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.undo-notice-text {
  font-size: 0.875rem;
  color: var(--text);
}

.undo-notice-btn {
  padding: 0.375rem 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  width: auto;
}

.undo-notice-btn:hover {
  background: var(--primary-hover);
}

.undo-notice-dismiss {
  padding: 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: auto;
  min-width: unset;
}

/* === SCREEN READER ONLY === */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
