/**
 * Digicloud Africa Partner Portal — Modern Design System Components
 * Built on CSS Design Tokens (tokens.css) with mobile-first ergonomics.
 */

/* ==========================================================================
 * Global Scaffolding & Mobile Reset
 * ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--background, var(--color-background, #F8FAFC));
  color: var(--foreground, var(--color-text, #0B1526));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: auto;
}

body {
  padding-top: 64px !important;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.02em;
}
h1 { font-size: 2rem; line-height: 1.25; }
h2 { font-size: 1.5rem; line-height: 1.3; }
h3 { font-size: 1.25rem; line-height: 1.35; }
h4 { font-size: 1.1rem; line-height: 1.4; }

p {
  margin-top: 0;
  margin-bottom: var(--space-md);
  color: var(--color-text-secondary);
}

.text-muted { color: var(--color-text-muted) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-accent { color: var(--color-accent) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }

/* ==========================================================================
 * Modern Header & Navigation Bar (Fixed to Viewport)
 * ========================================================================== */
.modern-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 64px;
  box-sizing: border-box;
  z-index: 1020;
  background: var(--header-bg, var(--sidebar, #041e42));
  border-bottom: 1px solid var(--header-border, var(--sidebar-border, #0c3161));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 0 var(--space-md);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.modern-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 4px;
}

.modern-brand-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  text-decoration: none;
  color: var(--header-foreground, #FFFFFF);
}

.modern-brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

/* Theme-adaptive header logo switching */
.modern-brand-logo--dark {
  display: block;
}
.modern-brand-logo--light {
  display: none;
}

[data-theme="midnight"] .modern-brand-logo--dark,
[data-theme="aurora"] .modern-brand-logo--dark,
[data-theme="digidark"] .modern-brand-logo--dark,
[data-theme="digideepteal"] .modern-brand-logo--dark,
[data-theme="new-dark"] .modern-brand-logo--dark,
[data-theme="refreshed-navy"] .modern-brand-logo--dark,
[data-theme="original"] .modern-brand-logo--dark {
  display: none !important;
}

[data-theme="midnight"] .modern-brand-logo--light,
[data-theme="aurora"] .modern-brand-logo--light,
[data-theme="digidark"] .modern-brand-logo--light,
[data-theme="digideepteal"] .modern-brand-logo--light,
[data-theme="new-dark"] .modern-brand-logo--light,
[data-theme="refreshed-navy"] .modern-brand-logo--light,
[data-theme="original"] .modern-brand-logo--light {
  display: block !important;
}

.modern-brand-divider {
  width: 1px;
  height: 20px;
  background-color: var(--header-border, rgba(255, 255, 255, 0.2));
}

.modern-brand-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--header-foreground, #FFFFFF);
  opacity: 0.92;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .modern-brand-divider,
  .modern-brand-subtitle {
    display: none !important;
  }
}

.modern-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.modern-user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--header-user-chip-bg, rgba(255, 255, 255, 0.1)) !important;
  border: 1px solid var(--header-user-chip-border, rgba(255, 255, 255, 0.2)) !important;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--header-user-chip-text, #FFFFFF) !important;
  min-height: var(--touch-target-min);
  cursor: pointer;
  transition: all 150ms ease;
}

.modern-user-chip:hover {
  filter: brightness(1.15);
}

.modern-flash-container:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.modern-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background-color: var(--color-primary);
}

/* ==========================================================================
 * Page Container & Section Layouts
 * ========================================================================== */
.modern-page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) calc(var(--space-2xl) + var(--safe-area-bottom)) var(--space-md);
}

.modern-section-header {
  margin-bottom: var(--space-xl);
}

.modern-section-title {
  font-size: 1.75rem;
  margin-bottom: var(--space-2xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.modern-section-desc {
  font-size: 1rem;
  margin-bottom: 0;
  color: var(--color-text-secondary);
}

/* ==========================================================================
 * Cards, Panels & Containers
 * ========================================================================== */
.modern-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.modern-card-elevated {
  background-color: var(--color-surface-elevated);
  box-shadow: var(--shadow-md);
}

.modern-card-interactive {
  cursor: pointer;
}
.modern-card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-focus);
}
.modern-card-interactive:active {
  transform: translateY(0);
}

.modern-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-subtle);
}

.modern-card-title {
  font-size: 1.15rem;
  margin: 0;
}

/* ==========================================================================
 * Buttons & Interactive Triggers
 * ========================================================================== */
.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--touch-target-min);
  padding: 0 var(--space-md);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.btn-modern:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.btn-modern:active {
  transform: scale(0.98);
}

/* Button Variants */
.btn-modern-primary {
  background-color: var(--color-primary);
  color: var(--color-primary-fg);
  box-shadow: var(--shadow-sm);
}
.btn-modern-primary:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-modern-secondary {
  background-color: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-modern-secondary:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-focus);
}

.btn-modern-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-modern-ghost:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text);
}

.btn-modern-danger {
  background-color: var(--color-danger);
  color: #FFFFFF;
}
.btn-modern-danger:hover {
  filter: brightness(0.9);
  box-shadow: var(--shadow-md);
}

.btn-modern-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-modern-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-modern.is-loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
.btn-modern.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: currentColor;
  border-radius: var(--radius-full);
  animation: modern-spin 0.6s linear infinite;
}

.btn-modern:disabled,
.btn-modern.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

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

/* ==========================================================================
 * Form Controls & Input Fields (16px Mobile-Safe Sizing)
 * ========================================================================== */
.modern-form-group {
  margin-bottom: var(--space-md);
}

.modern-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: var(--space-2xs);
  color: var(--color-text);
}

.modern-helper-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-2xs);
}

.modern-input,
.modern-select select,
.modern-textarea {
  width: 100%;
  min-height: var(--touch-target-min);
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* CRITICAL: Eradicate iOS auto-zoom distortion on mobile */
@media (max-width: 768px) {
  .modern-input,
  .modern-select select,
  .modern-textarea {
    font-size: 16px !important;
  }
}

.modern-input:focus,
.modern-select select:focus,
.modern-textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(0, 160, 223, 0.18);
}

.modern-input.is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.modern-input.is-valid {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Switch Toggle Component */
.modern-switch-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  min-height: var(--touch-target-min);
  user-select: none;
}

.modern-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.modern-switch-track {
  width: 46px;
  height: 26px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color var(--transition-fast);
}

.modern-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background-color: #FFFFFF;
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.modern-switch-input:checked + .modern-switch-track {
  background-color: var(--color-primary);
}

.modern-switch-input:checked + .modern-switch-track::after {
  transform: translateX(20px);
}

/* ==========================================================================
 * Badges, Chips & Status Indicators
 * ========================================================================== */
.modern-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.badge-primary { background: rgba(0, 160, 223, 0.16); color: var(--color-primary); }
.badge-success { background: rgba(16, 185, 129, 0.16); color: var(--color-success); }
.badge-warning { background: rgba(245, 158, 11, 0.16); color: var(--color-warning); }
.badge-danger  { background: rgba(239, 68, 68, 0.16);  color: var(--color-danger); }
.badge-neutral { background: var(--color-surface-hover); color: var(--color-text-secondary); border: 1px solid var(--color-border); }

/* ==========================================================================
 * Modern Toast Notifications System
 * ========================================================================== */
.modern-toast-container {
  position: fixed;
  top: calc(var(--space-md) + var(--safe-area-top));
  right: var(--space-md);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - (var(--space-md) * 2));
}

@media (max-width: 768px) {
  .modern-toast-container {
    right: 0;
    left: 0;
    margin: 0 auto;
    top: calc(var(--space-sm) + var(--safe-area-top));
    width: calc(100% - 24px);
  }
}

.modern-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
  overflow: hidden;
  position: relative;
  animation: modern-toast-slide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.modern-toast.is-leaving {
  opacity: 0;
  transform: translateX(40px) scale(0.95);
}

@keyframes modern-toast-slide {
  from { opacity: 0; transform: translateY(-16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modern-toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.modern-toast.toast-success { border-left: 4px solid var(--color-success); }
.modern-toast.toast-success .modern-toast-icon { color: var(--color-success); }

.modern-toast.toast-error { border-left: 4px solid var(--color-danger); }
.modern-toast.toast-error .modern-toast-icon { color: var(--color-danger); }

.modern-toast.toast-warning { border-left: 4px solid var(--color-warning); }
.modern-toast.toast-warning .modern-toast-icon { color: var(--color-warning); }

.modern-toast.toast-info { border-left: 4px solid var(--color-primary); }
.modern-toast.toast-info .modern-toast-icon { color: var(--color-primary); }

.modern-toast-body {
  flex: 1;
}
.modern-toast-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: var(--color-text);
}
.modern-toast-message {
  font-size: 0.82rem;
  margin: 0;
  color: var(--color-text-secondary);
}

.modern-toast-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  min-width: 28px;
  min-height: 28px;
}
.modern-toast-close:hover {
  color: var(--color-text);
  background-color: var(--color-surface-hover);
}

.modern-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: currentColor;
  opacity: 0.35;
  width: 100%;
}

/* ==========================================================================
 * Browser Popups, Confirmation Dialogs & Modals
 * ========================================================================== */
.modern-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  background: rgba(2, 21, 48, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modern-dialog-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.modern-dialog-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  padding: var(--space-xl);
  position: relative;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modern-dialog-overlay.is-active .modern-dialog-card {
  transform: scale(1);
}

/* Mobile Bottom Sheet Adaptation */
@media (max-width: 768px) {
  .modern-dialog-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modern-dialog-card {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: var(--space-lg) var(--space-md) calc(var(--space-lg) + var(--safe-area-bottom)) var(--space-md);
    transform: translateY(100%);
  }
  .modern-dialog-overlay.is-active .modern-dialog-card {
    transform: translateY(0);
  }
  .modern-sheet-handle {
    width: 38px;
    height: 5px;
    background-color: var(--color-border);
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-md) auto;
  }
}

.modern-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Dialog Sizing & Scrollable Content */
.modern-dialog-card.dialog-lg {
  max-width: 820px;
}
.modern-dialog-card.dialog-sm {
  max-width: 420px;
}

.modern-dialog-body-scrollable {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 8px;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* Side Sheet / Drawer Component */
.modern-side-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  background: rgba(2, 21, 48, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.modern-side-sheet-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.modern-side-sheet {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 100%;
  max-width: 480px;
  background-color: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10001;
}
.modern-side-sheet-overlay.is-active .modern-side-sheet {
  transform: translateX(0);
}

.modern-side-sheet-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-surface-elevated);
}
.modern-side-sheet-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modern-side-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}
.modern-side-sheet-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
 * Notification Banners & Alert Strips
 * ========================================================================== */
.system-banner {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-xs) var(--space-md);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.modern-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  border: 1px solid transparent;
}
.modern-alert.alert-info    { background: rgba(0, 160, 223, 0.12); border-color: rgba(0, 160, 223, 0.25); color: var(--color-text); }
.modern-alert.alert-success { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.25); color: var(--color-text); }
.modern-alert.alert-warning { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.25); color: var(--color-text); }
.modern-alert.alert-danger  { background: rgba(239, 68, 68, 0.12);  border-color: rgba(239, 68, 68, 0.25);  color: var(--color-text); }

/* ==========================================================================
 * Theme Selection Cards (User Preferences)
 * ========================================================================== */
.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
}

.theme-card {
  position: relative;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  user-select: none;
  display: flex;
  flex-direction: column;
}

.theme-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-focus);
}

.theme-card.is-active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 160, 223, 0.25), var(--shadow-md);
}

.theme-swatch-box {
  width: 100%;
  height: 110px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.12);
  padding: var(--space-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.theme-swatch-mini-surface {
  border-radius: var(--radius-xs);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.theme-card-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.theme-card-radio {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-card.is-active .theme-card-radio {
  border-color: var(--color-primary);
  background-color: var(--color-primary);
}

.theme-card.is-active .theme-card-radio::after {
  content: "✓";
  color: var(--color-primary-fg);
  font-size: 12px;
  font-weight: 800;
}

/* ==========================================================================
 * Data Tables & Touch Momentum Containers
 * ========================================================================== */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.modern-table th {
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-surface-elevated);
  color: var(--color-text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

.modern-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text);
  vertical-align: middle;
}

.modern-table tr:hover td {
  background-color: var(--color-surface-hover);
}

/* Density Variants */
.modern-table.table-compact th {
  padding: 6px 10px;
  font-size: 0.78rem;
}
.modern-table.table-compact td {
  padding: 6px 10px;
  font-size: 0.82rem;
}
.modern-table.table-comfortable th {
  padding: 14px 18px;
  font-size: 0.94rem;
}
.modern-table.table-comfortable td {
  padding: 14px 18px;
  font-size: 0.92rem;
}

/* Striped Rows */
.modern-table.table-striped tbody tr:nth-of-type(even) td {
  background-color: var(--color-surface-hover);
}

/* Expandable / Accordion Rows */
.btn-row-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-row-expand:hover {
  color: var(--color-primary);
  background-color: var(--color-surface-hover);
}
.btn-row-expand.is-expanded i {
  transform: rotate(90deg);
  color: var(--color-primary);
}

.demo-row-details td {
  background-color: var(--color-surface-elevated);
  padding: 16px 24px;
  border-bottom: 2px solid var(--color-border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.details-drawer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  font-size: 0.86rem;
  padding: 4px 0;
}

.details-drawer-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.details-drawer-item-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
}

/* Column Visibility Toggles */
.modern-table.table-hide-plan .col-plan {
  display: none !important;
}
.modern-table.table-hide-seats .col-seats {
  display: none !important;
}

/* Table View Options Toolbar */
.table-options-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--space-sm);
  padding: 10px 14px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.btn-density.is-active {
  background-color: var(--color-primary) !important;
  color: var(--color-primary-fg) !important;
  border-color: var(--color-primary) !important;
}

.btn-col-toggle.is-hidden-col {
  opacity: 0.55;
  text-decoration: line-through;
}

/* Table Pagination Toolbar */
.table-pagination-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ==========================================================================
 * Section Spacing & Component Finder
 * ========================================================================== */
.lab-component-section {
  margin-bottom: 2.75rem !important;
  transition: opacity 0.22s ease;
}
.lab-component-section.is-hidden {
  display: none !important;
}

.component-filter-bar {
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
 * Sticky Locked Table Headers
 * ========================================================================== */
.table-container-sticky {
  width: 100%;
  max-height: 440px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  position: relative;
}

.table-container-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--color-surface-elevated);
  box-shadow: 0 1px 0 var(--color-border);
}

.modern-table th.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast);
}
.modern-table th.th-sortable:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text);
}
.modern-table th.th-sortable .sort-icon {
  margin-left: 6px;
  font-size: 0.78rem;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}
.modern-table th.th-sortable:hover .sort-icon,
.modern-table th.th-sortable.is-sorted .sort-icon {
  opacity: 1;
  color: var(--color-primary);
}

.modern-table tr.is-selected td {
  background-color: rgba(0, 160, 223, 0.08) !important;
}

[data-theme="new-dark"] .modern-table tr.is-selected td {
  background-color: rgba(56, 189, 248, 0.12) !important;
}

[data-theme="refreshed-navy"] .modern-table tr.is-selected td {
  background-color: rgba(255, 191, 59, 0.12) !important;
}

.table-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  animation: slideDownFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
 * Click-To-Copy Buttons & Action Elements
 * ========================================================================== */
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 4px;
}
.btn-copy:hover {
  color: var(--color-primary);
  background-color: var(--color-surface-hover);
  border-color: var(--color-border);
}
.btn-copy:active {
  transform: scale(0.92);
}
.btn-copy.is-copied {
  color: var(--color-success) !important;
  background-color: rgba(15, 157, 88, 0.12);
  border-color: rgba(15, 157, 88, 0.3);
}

.copy-text-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
 * Interactive Search Toolbars & Filter Options
 * ========================================================================== */
.modern-search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.modern-search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.modern-search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.modern-search-input-wrapper .modern-input {
  padding-left: 36px;
  padding-right: 32px;
}

.modern-search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: var(--radius-full);
}
.modern-search-clear-btn:hover {
  color: var(--color-text);
  background-color: var(--color-surface-hover);
}

.search-filter-pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.search-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  min-height: 32px;
}
.search-filter-pill:hover,
.search-filter-pill.is-active {
  background: var(--color-primary);
  color: var(--color-primary-fg);
  border-color: var(--color-primary);
}

/* ==========================================================================
 * Hero Cards: Customer, DAR / Reseller, and Leads
 * ========================================================================== */

/* 1. Customer Hero Card (Customer Info Plate Format) */
.modern-hero-customer {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-hover) 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

.hero-meta-divider {
  width: 1px;
  height: 54px;
  background-color: var(--color-border);
}
@media (max-width: 768px) {
  .hero-meta-divider {
    display: none;
  }
}

/* 2. DAR / Reseller Hero Card (Partner Digest Format) */
.modern-hero-dar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 6px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-lg);
}

/* 3. Leads / Deal Desk Hero Card */
.modern-hero-lead {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
  position: relative;
}

/* ==========================================================================
 * Component Lab Sub-Navigation Tabs
 * ========================================================================== */
.lab-nav-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.lab-nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all var(--transition-fast);
  color: var(--color-text-secondary);
  border: 1px solid transparent;
}
.lab-nav-tab-btn:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text);
}
.lab-nav-tab-btn.is-active {
  background-color: var(--color-primary);
  color: var(--color-primary-fg) !important;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
 * Subscriptions Grid & Cards (Modern Entitlements)
 * ========================================================================== */
.subscription-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: var(--space-xl);
}

.subscription-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  position: relative;
}
.subscription-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.subscription-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.subscription-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.subscription-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subscription-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.subscription-add-card {
  background-color: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 280px;
  text-decoration: none !important;
}
.subscription-add-card:hover {
  border-color: var(--color-primary);
  background-color: var(--color-surface-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}
.subscription-add-card-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background-color: rgba(0, 160, 223, 0.12);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 12px;
}

/* Meter Bar Helper */
.seat-meter-bar {
  width: 100%;
  height: 6px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 6px 0;
}
.seat-meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  transition: width 0.4s ease;
}

/* ==========================================================================
 * Style B: Neo-Fintech / Ambient Glass Cockpit Component Redesign
 * ========================================================================== */

/* Ambient Radial Hero Cockpit */
.modern-hero-customer-v2 {
  background: radial-gradient(120% 120% at 85% 15%, rgba(0, 160, 223, 0.14) 0%, rgba(0, 112, 120, 0.05) 40%, var(--color-surface) 100%);
  border: 1px solid rgba(0, 160, 223, 0.28);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  box-shadow: 0 4px 20px -2px rgba(0, 160, 223, 0.1);
  position: relative;
  overflow: hidden;
}

.modern-hero-customer-v2::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 240px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 160, 223, 0.04));
  pointer-events: none;
}

/* Pulsating Live Status Dot */
.status-dot-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
  vertical-align: middle;
  margin-right: 6px;
}
.status-dot-pulse.dot-success {
  background-color: #00D2B4;
  box-shadow: 0 0 8px #00D2B4;
}
.status-dot-pulse.dot-warning {
  background-color: #FFBF3B;
  box-shadow: 0 0 8px #FFBF3B;
}
.status-dot-pulse.dot-danger {
  background-color: #E24301;
  box-shadow: 0 0 8px #E24301;
}
.status-dot-pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid currentColor;
  animation: statusPulseKeyframe 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes statusPulseKeyframe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.8); opacity: 0.1; }
}

/* KPI Tiles (Style B) */
.kpi-card-v2 {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.kpi-card-v2:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.kpi-card-v2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  opacity: 0.85;
}
.kpi-card-v2.kpi-accent-gold::before {
  background: linear-gradient(90deg, #FF9900, #FFBF3B);
}
.kpi-card-v2.kpi-accent-emerald::before {
  background: linear-gradient(90deg, #34A853, #00D2B4);
}
.kpi-card-v2.kpi-accent-coral::before {
  background: linear-gradient(90deg, #EA4335, #E24301);
}

.kpi-number-gradient {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-text) 20%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 4px;
}
.kpi-number-gradient-warning {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #FFBF3B 10%, #E24301 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 4px;
}

/* Product Cards (Style B - Subscriptions Cockpit) */
.subscription-card-v2 {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
}
.subscription-card-v2:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.2), 0 0 16px -2px rgba(0, 160, 223, 0.25);
  border-color: rgba(0, 160, 223, 0.4);
}

/* Luminous Top Header Accent Stripes */
.card-accent-workspace {
  height: 4px;
  background: linear-gradient(90deg, #4285F4 0%, #00A0DF 100%);
  box-shadow: 0 0 10px rgba(66, 133, 244, 0.4);
}
.card-accent-gcp {
  height: 4px;
  background: linear-gradient(90deg, #FF9900 0%, #FFBF3B 100%);
  box-shadow: 0 0 10px rgba(255, 191, 59, 0.4);
}
.card-accent-warning {
  height: 4px;
  background: linear-gradient(90deg, #EA4335 0%, #E24301 100%);
  box-shadow: 0 0 10px rgba(226, 67, 1, 0.4);
}
.card-accent-chrome {
  height: 4px;
  background: linear-gradient(90deg, #34A853 0%, #00D2B4 100%);
  box-shadow: 0 0 10px rgba(0, 210, 180, 0.4);
}

/* Luminous Product Icons with Ambient Glow */
.subscription-card-icon-v2 {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}
.icon-v2-azure {
  background: rgba(0, 160, 223, 0.14);
  color: #00A0DF;
  box-shadow: 0 0 12px rgba(0, 160, 223, 0.25);
}
.icon-v2-gold {
  background: rgba(255, 191, 59, 0.14);
  color: #FFBF3B;
  box-shadow: 0 0 12px rgba(255, 191, 59, 0.25);
}
.icon-v2-coral {
  background: rgba(226, 67, 1, 0.14);
  color: #E24301;
  box-shadow: 0 0 12px rgba(226, 67, 1, 0.25);
}
.icon-v2-emerald {
  background: rgba(0, 210, 180, 0.14);
  color: #00D2B4;
  box-shadow: 0 0 12px rgba(0, 210, 180, 0.25);
}

/* Inset Frosted Data Box */
.card-data-box-v2 {
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.82rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Multi-Stop Glowing Progress Meters (Style B) */
.seat-meter-v2 {
  width: 100%;
  height: 8px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  margin: 6px 0;
}
.seat-meter-fill-v2-azure {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #4285F4 0%, #00A0DF 50%, #00D2B4 100%);
  box-shadow: 0 0 8px rgba(0, 160, 223, 0.5);
  transition: width 0.4s ease;
}
.seat-meter-fill-v2-coral {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #FF9900 0%, #EA4335 60%, #E24301 100%);
  box-shadow: 0 0 8px rgba(226, 67, 1, 0.5);
  transition: width 0.4s ease;
}
.seat-meter-fill-v2-emerald {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #34A853 0%, #00D2B4 100%);
  box-shadow: 0 0 8px rgba(0, 210, 180, 0.5);
  transition: width 0.4s ease;
}

/* Luminous Badges (Style B) */
.modern-badge-v2 {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  line-height: 1.2;
}
.badge-v2-success {
  background: rgba(0, 210, 180, 0.14);
  color: #00D2B4;
  border: 1px solid rgba(0, 210, 180, 0.35);
  box-shadow: 0 0 8px rgba(0, 210, 180, 0.15);
}
.badge-v2-warning {
  background: rgba(255, 191, 59, 0.14);
  color: #FFBF3B;
  border: 1px solid rgba(255, 191, 59, 0.35);
  box-shadow: 0 0 8px rgba(255, 191, 59, 0.2);
}
.badge-v2-azure {
  background: rgba(0, 160, 223, 0.14);
  color: #00A0DF;
  border: 1px solid rgba(0, 160, 223, 0.35);
  box-shadow: 0 0 8px rgba(0, 160, 223, 0.15);
}

/* Add Service Card (Style B) */
.subscription-add-card-v2 {
  background: radial-gradient(140% 140% at 50% 10%, rgba(0, 160, 223, 0.08) 0%, var(--color-surface) 100%);
  border: 2px dashed rgba(0, 160, 223, 0.35);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 280px;
  text-decoration: none !important;
}
.subscription-add-card-v2:hover {
  border-color: #00A0DF;
  transform: translateY(-4px);
  box-shadow: 0 10px 24px -2px rgba(0, 160, 223, 0.25);
  background: radial-gradient(140% 140% at 50% 10%, rgba(0, 160, 223, 0.14) 0%, var(--color-surface-hover) 100%);
}

/* Table Style B Variations */
.modern-table-v2 tbody tr {
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}
.modern-table-v2 tbody tr:hover {
  background-color: var(--color-surface-hover);
  box-shadow: inset 3px 0 0 #00A0DF;
}

/* ==========================================================================
 * Modern Contextual Tooltips & Popovers
 * ========================================================================== */
.portal-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
  margin: 0 4px;
}

.portal-tooltip-icon {
  font-size: 0.95rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.portal-tooltip-wrapper:hover .portal-tooltip-icon,
.portal-tooltip-wrapper:focus .portal-tooltip-icon {
  transform: scale(1.15);
}

.portal-tooltip-info { color: #00A0DF; }
.portal-tooltip-warning { color: #e28701; }
.portal-tooltip-danger { color: #d93025; }
.portal-tooltip-success { color: #188038; }

.portal-tooltip-bubble {
  position: absolute;
  z-index: 1050;
  display: none;
  min-width: 220px;
  max-width: 320px;
  padding: 10px 14px;
  font-size: 0.825rem;
  font-weight: 400;
  line-height: 1.4;
  color: #ffffff;
  background-color: #1f2937;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  text-align: left;
  white-space: normal;
  word-wrap: break-word;
}

/* Tooltip positions */
.portal-tooltip-bubble.portal-tooltip-top {
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
}

.portal-tooltip-bubble.portal-tooltip-bottom {
  top: 125%;
  left: 50%;
  transform: translateX(-50%);
}

.portal-tooltip-bubble.portal-tooltip-right {
  left: 125%;
  top: 50%;
  transform: translateY(-50%);
}

.portal-tooltip-bubble.portal-tooltip-left {
  right: 125%;
  top: 50%;
  transform: translateY(-50%);
}

/* Tooltip arrows */
.portal-tooltip-bubble.portal-tooltip-top::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

.portal-tooltip-bubble.portal-tooltip-bottom::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent #1f2937 transparent;
}

/* Hover and Focus triggers (Desktop & Mobile Tap) */
.portal-tooltip-wrapper:hover .portal-tooltip-bubble,
.portal-tooltip-wrapper:focus .portal-tooltip-bubble,
.portal-tooltip-wrapper:focus-within .portal-tooltip-bubble {
  display: block;
  animation: tooltipFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-tooltip-bubble.is-viewport-clamped {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  animation: none !important;
  min-width: 0 !important;
  width: max-content !important;
  max-width: min(300px, calc(100vw - 24px)) !important;
  z-index: 10050 !important;
}

.portal-tooltip-bubble.is-viewport-clamped::after {
  display: none !important;
}

@media (max-width: 768px) {
  .portal-tooltip-bubble {
    min-width: 0;
    max-width: calc(100vw - 24px);
  }
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translate(-50%, 5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
 * Subscription Guidance Card & Comparison Grid
 * ========================================================================== */
.subscription-guidance-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s ease;
}

.guidance-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
}

.guidance-title {
  display: flex;
  align-items: center;
  font-size: 1rem;
  color: #1e293b;
}

.guidance-card-body {
  padding: 20px;
}

.guidance-intro {
  font-size: 0.92rem;
  color: #475569;
  margin-bottom: 16px;
  line-height: 1.5;
}

.plan-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.plan-card {
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.plan-card-flex { border-top: 4px solid #00A0DF; }
.plan-card-commit-monthly { border-top: 4px solid #f59e0b; background: #fffdfa; }
.plan-card-commit-yearly { border-top: 4px solid #10b981; }

.plan-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.plan-type-pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 6px;
}

.flex-pill { background: #e0f2fe; color: #0369a1; }
.commit-pill { background: #fef3c7; color: #b45309; }
.commit-yearly-pill { background: #d1fae5; color: #047857; }

.plan-rate-note {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

.plan-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}

.plan-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px 0;
  font-size: 0.85rem;
  color: #334155;
  flex-grow: 1;
}

.plan-feature-list li {
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.plan-feature-list li i {
  margin-top: 3px;
  flex-shrink: 0;
}

.plan-best-for {
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
  color: #64748b;
}

.critical-rules-banner {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #991b1b;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.rule-item i {
  margin-top: 2px;
  flex-shrink: 0;
}

/* Badges for Lock-In and Seat Floor */
.lockin-warning-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.seat-floor-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 500;
}


