/* ============================================================
   NeXIA Pattern System — Design Tokens + Component Library
   Base: Tailwind CSS + Flowbite + Lucide Icons
   ============================================================ */

/* ----------------------------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   ---------------------------------------------------------- */
:root {
  /* --- Brand --- */
  --color-primary-50: #f0f9ff;
  --color-primary-100: #e0f2fe;
  --color-primary-500: #0ea5e9;
  --color-primary-600: #0284c7;
  --color-primary-700: #0369a1;
  --color-primary-900: #0c4a6e;

  /* --- Accents --- */
  --color-cyan: #00f0ff;
  --color-purple: #bd00ff;
  --color-emerald: #10b981;
  --color-rose: #f43f5e;
  --color-amber: #f59e0b;

  /* --- Surfaces --- */
  --surface-primary: #ffffff;
  --surface-secondary: #f8fafc;
  --surface-tertiary: #f1f5f9;
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;

  /* --- Text --- */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  /* --- Shadows --- */
  --shadow-card: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-dropdown: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow-cyan: 0 0 20px rgba(0, 240, 255, 0.15);
  --shadow-glow-purple: 0 0 20px rgba(189, 0, 255, 0.15);
  --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.15);
  --shadow-glow-rose: 0 0 20px rgba(244, 63, 94, 0.15);

  /* --- Shimmer --- */
  --shimmer-cyan: linear-gradient(90deg, transparent 0%, rgba(0,240,255,0.7) 50%, transparent 100%);
  --shimmer-purple: linear-gradient(90deg, transparent 0%, rgba(189,0,255,0.7) 50%, transparent 100%);
  --shimmer-emerald: linear-gradient(90deg, transparent 0%, rgba(16,185,129,0.7) 50%, transparent 100%);
  --shimmer-amber: linear-gradient(90deg, transparent 0%, rgba(245,158,11,0.7) 50%, transparent 100%);
  --shimmer-rose: linear-gradient(90deg, transparent 0%, rgba(244,63,94,0.7) 50%, transparent 100%);

  /* --- Border Radius --- */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;

  /* --- Typography --- */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* --- Transitions --- */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* Dark Mode Tokens */
.dark {
  --surface-primary: #0f172a;
  --surface-secondary: #1e293b;
  --surface-tertiary: #334155;
  --border-primary: #1e293b;
  --border-secondary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #0f172a;
  --shadow-card: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

/* ----------------------------------------------------------
   2. BASE / RESET
   ---------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-primary-500); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary-600); }

.dark ::-webkit-scrollbar-thumb { background: #334155; }
.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Selection */
::selection {
  background-color: var(--color-primary-500);
  color: white;
}

/* ----------------------------------------------------------
   3. LAYOUT
   ---------------------------------------------------------- */

/* Page Layout with Sidebar */
.layout-sidebar {
  display: flex;
  min-height: 100vh;
}

.layout-sidebar .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 16rem;
  height: 100vh;
  background: var(--surface-primary);
  border-right: 1px solid var(--border-primary);
  transition: transform var(--transition-base);
}

.layout-sidebar .main-content {
  flex: 1;
  margin-left: 16rem;
  padding: 1rem;
}

@media (max-width: 640px) {
  .layout-sidebar .sidebar {
    transform: translateX(-100%);
  }
  .layout-sidebar .sidebar.open {
    transform: translateX(0);
  }
  .layout-sidebar .main-content {
    margin-left: 0;
  }
}

/* Page Header */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Section / Card Groups */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-primary);
}

.section-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----------------------------------------------------------
   4. STICKY TOPBAR
   ---------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 1rem;
  z-index: 30;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
}

.dark .topbar {
  background: rgba(15, 23, 42, 0.7);
}

/* ----------------------------------------------------------
   5. CARDS
   ---------------------------------------------------------- */

/* Base Card */
.card {
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base);
}

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

/* Stat Card (metrics / KPIs) */
.stat-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-2xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base);
}

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

.stat-card .stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.stat-card .stat-icon {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.stat-card .stat-bar {
  width: 100%;
  height: 0.5rem;
  background: var(--surface-tertiary);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 1rem;
}

.stat-card .stat-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 500ms ease;
  position: relative;
  overflow: hidden;
}

/* Reusable bar shimmer (for any progress bar) */
.bar-shimmer {
  position: relative;
  overflow: hidden;
}

.bar-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: bar-shimmer 2.5s ease-in-out infinite;
}

.dark .bar-shimmer::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
}

.stat-card .stat-bar-fill.no-shimmer::after,
.stat-bar-fill.no-shimmer::after,
.bar-shimmer.no-shimmer::after {
  display: none;
}

.stat-card .stat-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: bar-shimmer 2.5s ease-in-out infinite;
}

@keyframes bar-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.stat-card .stat-footer {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
}

/* Glass Card */
.card-glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
}

.dark .card-glass {
  background: rgba(15, 23, 42, 0.7);
}

/* Dark Card (gradient) */
.card-dark {
  background: linear-gradient(to bottom right, #1e293b, #0f172a);
  border: 1px solid #334155;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  color: white;
  position: relative;
  overflow: hidden;
}

.dark .card-dark {
  background: linear-gradient(to bottom right, #1e293b, #0f172a);
}

.card-dark .glow {
  position: absolute;
  top: 0;
  right: 0;
  width: 8rem;
  height: 8rem;
  border-radius: 9999px;
  filter: blur(48px);
  opacity: 0.1;
  transform: translate(30%, -30%);
}

/* ----------------------------------------------------------
   6. BUTTONS
   ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary (Cyan) */
.btn-primary {
  background: var(--color-cyan);
  color: #0f172a;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-primary:hover {
  background: #00d8e6;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.25);
}

/* Secondary (White/Slate) */
.btn-secondary {
  background: var(--surface-primary);
  color: var(--text-primary);
  border-color: var(--border-primary);
  box-shadow: var(--shadow-card);
}

.btn-secondary:hover {
  background: var(--surface-secondary);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

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

/* Danger */
.btn-danger {
  background: var(--color-rose);
  color: white;
  box-shadow: var(--shadow-glow-rose);
}

.btn-danger:hover {
  background: #e11d48;
}

/* Success */
.btn-success {
  background: var(--color-emerald);
  color: white;
  box-shadow: var(--shadow-glow-emerald);
}

.btn-success:hover {
  background: #059669;
}

/* Outline */
.btn-outline {
  background: transparent;
  border-color: var(--border-primary);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

/* Icon Only */
.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

/* Icon Sizes */
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ----------------------------------------------------------
   7. BADGES / TAGS
   ---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  line-height: 1.5;
}

.badge-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
}

/* Status Variants */
.badge-success {
  background: #dcfce7;
  color: #166534;
}

.dark .badge-success {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

.badge-success .badge-dot {
  background: #22c55e;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.dark .badge-warning {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
}

.badge-warning .badge-dot {
  background: #f59e0b;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.dark .badge-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

.badge-danger .badge-dot {
  background: #ef4444;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.dark .badge-info {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}

.badge-info .badge-dot {
  background: #3b82f6;
}

.badge-neutral {
  background: var(--surface-tertiary);
  color: var(--text-secondary);
}

.dark .badge-neutral {
  background: var(--surface-secondary);
  color: var(--text-secondary);
}

.badge-neutral .badge-dot {
  background: var(--text-tertiary);
}

/* Animated pulse dot */
.badge-dot.pulse {
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Badge Count (circular) */
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--color-cyan);
}

/* ----------------------------------------------------------
   8. FORMS
   ---------------------------------------------------------- */

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  outline: none;
  font-family: var(--font-sans);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-secondary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-textarea {
  min-height: 5rem;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80a8,8,0,0,1,11.32-11.32L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Form with icon prefix */
.form-input-group {
  position: relative;
}

.form-input-group .form-input {
  padding-left: 2.5rem;
}

.form-input-group .input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
}

/* Toggle / Switch */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 2.75rem;
  height: 1.5rem;
  background: var(--surface-tertiary);
  border-radius: 9999px;
  transition: background var(--transition-fast);
  position: relative;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1.25rem;
  height: 1.25rem;
  background: white;
  border-radius: 9999px;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-track {
  background: var(--color-cyan);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(1.25rem);
}

.toggle-label {
  font-size: 0.875rem;
  color: var(--text-primary);
  user-select: none;
}

/* ----------------------------------------------------------
   9. TABLES
   ---------------------------------------------------------- */

.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text-secondary);
}

.table thead {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--surface-secondary);
}

.table thead th {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-primary);
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.dark .table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.table tbody td {
  padding: 1rem 1.5rem;
  white-space: nowrap;
}

.table tbody td:first-child {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.table tbody td .table-title {
  font-weight: 600;
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   10. SIDEBAR NAVIGATION
   ---------------------------------------------------------- */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  margin-bottom: 2rem;
  margin-top: 0.5rem;
}

.sidebar-brand .brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(to bottom right, var(--color-cyan), var(--color-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-cyan);
}

.sidebar-brand .brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.sidebar-brand .brand-name span {
  color: var(--color-cyan);
}

.nav-section {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-primary);
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 0.25rem 1rem 0.5rem;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  font-weight: 500;
}

.nav-item:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-left: 4px solid var(--color-cyan);
}

.dark .nav-item.active {
  background: var(--surface-secondary);
}

.nav-item .nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

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

/* ----------------------------------------------------------
   11. SERVICE / LIST ROWS
   ---------------------------------------------------------- */

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  transition: all var(--transition-base);
}

.service-row:hover {
  background: rgba(0, 0, 0, 0.02);
  transform: translateX(4px);
}

.dark .service-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

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

.service-row .service-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-row .service-name {
  font-weight: 600;
  color: var(--text-primary);
}

.service-row .service-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.service-row .service-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   12. LOG ROWS (timeline)
   ---------------------------------------------------------- */

.log-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  transition: background var(--transition-fast);
  font-size: 0.875rem;
}

.log-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.dark .log-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.log-row .log-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
  min-width: 5rem;
}

.log-row .log-level {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
  min-width: 3.5rem;
  text-align: center;
}

.log-level-info {
  background: rgba(14, 165, 233, 0.1);
  color: #0ea5e9;
}

.log-level-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.log-level-error {
  background: rgba(244, 63, 94, 0.1);
  color: #f43f5e;
}

.log-row .log-service {
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
  min-width: 5rem;
}

.log-row .log-msg {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------
   13. QUICK ACTION GRID
   ---------------------------------------------------------- */

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

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-base);
}

.action-card:hover {
  border-color: var(--color-cyan);
  background: var(--surface-secondary);
}

.action-card .action-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--text-tertiary);
  transition: color var(--transition-base);
}

.action-card:hover .action-icon {
  color: var(--color-cyan);
}

.action-card .action-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Variant accent colors */
.action-card.cyan:hover { border-color: var(--color-cyan); }
.action-card.cyan:hover .action-icon { color: var(--color-cyan); }

.action-card.purple:hover { border-color: var(--color-purple); }
.action-card.purple:hover .action-icon { color: var(--color-purple); }

.action-card.emerald:hover { border-color: var(--color-emerald); }
.action-card.emerald:hover .action-icon { color: var(--color-emerald); }

.action-card.rose:hover { border-color: var(--color-rose); }
.action-card.rose:hover .action-icon { color: var(--color-rose); }

.action-card.amber:hover { border-color: var(--color-amber); }
.action-card.amber:hover .action-icon { color: var(--color-amber); }

/* ----------------------------------------------------------
   13. NOTIFICATION BELL
   ---------------------------------------------------------- */

.notification-btn {
  position: relative;
  padding: 0.5rem;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notification-btn:hover {
  background: var(--surface-secondary);
}

.notification-dot {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 0.625rem;
  height: 0.625rem;
  background: var(--color-rose);
  border-radius: 9999px;
  border: 2px solid var(--surface-primary);
}

/* ----------------------------------------------------------
   14. AVATAR / PROFILE
   ---------------------------------------------------------- */

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: white;
  flex-shrink: 0;
}

.avatar-gradient {
  background: linear-gradient(to top right, #334155, #0f172a);
}

.dark .avatar-gradient {
  background: linear-gradient(to top right, var(--color-cyan), var(--color-purple));
}

.avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1rem; }

/* ----------------------------------------------------------
   15. PROFILE DROPDOWN (topbar)
   ---------------------------------------------------------- */

.profile-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-primary);
}

.profile-info {
  text-align: right;
  display: none;
}

@media (min-width: 640px) {
  .profile-info { display: block; }
}

.profile-info .profile-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-info .profile-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   16. SPINNERS / LOADING
   ---------------------------------------------------------- */

/* Circular Spinner */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--surface-tertiary);
  border-top-color: var(--color-cyan);
  border-radius: 9999px;
  animation: spin 0.6s linear infinite;
}

.spinner-sm { width: 1rem; height: 1rem; border-width: 2px; }
.spinner-lg { width: 2.5rem; height: 2.5rem; border-width: 3px; }
.spinner-xl { width: 3.5rem; height: 3.5rem; border-width: 4px; }

/* Accent color variants */
.spinner-purple { border-top-color: var(--color-purple); }
.spinner-emerald { border-top-color: var(--color-emerald); }
.spinner-rose { border-top-color: var(--color-rose); }
.spinner-amber { border-top-color: var(--color-amber); }
.spinner-white { border-top-color: white; border-color: rgba(255,255,255,0.2); }

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

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

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: currentColor;
  border-radius: 9999px;
  animation: spin 0.6s linear infinite;
}

/* Dots Spinner */
.spinner-dots {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.spinner-dots span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--color-cyan);
  animation: dots-bounce 1.4s ease-in-out infinite both;
}

.spinner-dots span:nth-child(1) { animation-delay: -0.32s; }
.spinner-dots span:nth-child(2) { animation-delay: -0.16s; }
.spinner-dots span:nth-child(3) { animation-delay: 0s; }

.spinner-dots.dot-purple span { background: var(--color-purple); }
.spinner-dots.dot-emerald span { background: var(--color-emerald); }
.spinner-dots.dot-rose span { background: var(--color-rose); }
.spinner-dots.dot-amber span { background: var(--color-amber); }

@keyframes dots-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Pulse Spinner (ring expansion) */
.spinner-pulse {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--color-cyan);
  opacity: 0.6;
  animation: pulse-ring 1.5s ease-out infinite;
}

.spinner-pulse.pulse-purple { background: var(--color-purple); }
.spinner-pulse.pulse-emerald { background: var(--color-emerald); }
.spinner-pulse.pulse-rose { background: var(--color-rose); }

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 0.2; }
  100% { transform: scale(0.8); opacity: 0.6; }
}

/* Toast slide-up */
@keyframes slide-up {
  from { opacity: 0; transform: translateY(1rem) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-slide-up {
  animation: slide-up 0.3s ease forwards;
}

/* Modal backdrop init */
.modal-backdrop:not(.open) {
  display: none !important;
}

/* Full-page Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.loading-overlay .loading-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Inline loading text */
.loading-text-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   17. LOADING / SKELETON
   ---------------------------------------------------------- */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-tertiary) 25%,
    var(--surface-secondary) 50%,
    var(--surface-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ----------------------------------------------------------
   18. TOAST / ALERT
   ---------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-dropdown);
  animation: toast-in 300ms ease forwards;
  max-width: 24rem;
}

.toast.toast-success { border-left: 4px solid var(--color-emerald); }
.toast.toast-error { border-left: 4px solid var(--color-rose); }
.toast.toast-warning { border-left: 4px solid var(--color-amber); }
.toast.toast-info { border-left: 4px solid var(--color-cyan); }

.toast .toast-message {
  font-size: 0.875rem;
  color: var(--text-primary);
  flex: 1;
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.25rem;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------
   19. EMPTY STATE
   ---------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state .empty-icon {
  width: 3rem;
  height: 3rem;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.empty-state .empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.empty-state .empty-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 20rem;
}

/* ----------------------------------------------------------
   20. DIVIDER
   ---------------------------------------------------------- */

.divider {
  width: 100%;
  height: 1px;
  background: var(--border-primary);
  margin: 1rem 0;
}

.divider-vertical {
  width: 1px;
  height: 1rem;
  background: var(--border-primary);
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   21. GRID HELPERS
   ---------------------------------------------------------- */

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

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .content-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* ----------------------------------------------------------
   22. SHIMMER / TITLE EFFECTS
   ---------------------------------------------------------- */

/* Shimmer base — sweeping metallic highlight across text */
.title-shimmer {
  position: relative;
  display: inline-block;
  color: var(--text-primary);
}

.title-shimmer::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: var(--shimmer-cyan);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer-sweep 3s ease-in-out infinite;
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Variants */
.title-shimmer.cyan::after { background: var(--shimmer-cyan); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }
.title-shimmer.purple::after { background: var(--shimmer-purple); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }
.title-shimmer.emerald::after { background: var(--shimmer-emerald); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }
.title-shimmer.amber::after { background: var(--shimmer-amber); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }
.title-shimmer.rose::after { background: var(--shimmer-rose); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }

/* Slower / faster sweep */
.title-shimmer.slow::after { animation-duration: 6s; }
.title-shimmer.fast::after { animation-duration: 1.5s; }

@keyframes shimmer-sweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Glow text — soft neon glow on the base text */
.title-glow {
  color: var(--color-cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.25);
  animation: glow-pulse 3s ease-in-out infinite;
}

.title-glow.glow-purple {
  color: var(--color-purple);
  text-shadow: 0 0 8px rgba(189, 0, 255, 0.25);
}

.title-glow.glow-emerald {
  color: var(--color-emerald);
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.title-glow.glow-amber {
  color: var(--color-amber);
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.25);
}

.title-glow.glow-rose {
  color: var(--color-rose);
  text-shadow: 0 0 8px rgba(244, 63, 94, 0.25);
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Gradient text — static gradient fill */
.title-gradient {
  background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title-gradient.gradient-emerald-cyan {
  background: linear-gradient(135deg, var(--color-emerald), var(--color-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title-gradient.gradient-rose-amber {
  background: linear-gradient(135deg, var(--color-rose), var(--color-amber));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ----------------------------------------------------------
   23. CHECKBOX & RADIO
   ---------------------------------------------------------- */

/* Checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  user-select: none;
}

.check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.check .check-box {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--border-secondary);
  border-radius: 0.375rem;
  background: var(--surface-primary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.check .check-box::after {
  content: '';
  width: 0.375rem;
  height: 0.625rem;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) scale(0);
  transition: transform var(--transition-fast);
  position: absolute;
  top: 1px;
}

.check input:checked + .check-box {
  background: var(--color-cyan);
  border-color: var(--color-cyan);
}

.check input:checked + .check-box::after {
  transform: rotate(45deg) scale(1);
}

.check input:focus-visible + .check-box {
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2);
}

/* Checkbox purple variant */
.check.purple input:checked + .check-box {
  background: var(--color-purple);
  border-color: var(--color-purple);
}

.check.purple input:focus-visible + .check-box {
  box-shadow: 0 0 0 3px rgba(189, 0, 255, 0.2);
}

.check.emerald input:checked + .check-box {
  background: var(--color-emerald);
  border-color: var(--color-emerald);
}

/* Indeterminate state */
.check .check-box.indeterminate::after {
  content: '';
  width: 0.625rem;
  height: 2px;
  background: white;
  border: none;
  transform: none;
  top: 50%;
  left: 50%;
  margin: -1px 0 0 -0.3125rem;
}

.check input:indeterminate + .check-box {
  background: var(--color-cyan);
  border-color: var(--color-cyan);
}

/* Radio */
.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  user-select: none;
}

.radio input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio .radio-circle {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--border-secondary);
  border-radius: 9999px;
  background: var(--surface-primary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.radio .radio-circle::after {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: white;
  transform: scale(0);
  transition: transform var(--transition-fast);
}

.radio input:checked + .radio-circle {
  background: var(--color-cyan);
  border-color: var(--color-cyan);
}

.radio input:checked + .radio-circle::after {
  transform: scale(1);
}

.radio input:focus-visible + .radio-circle {
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2);
}

/* Radio accent variants */
.radio.purple input:checked + .radio-circle {
  background: var(--color-purple);
  border-color: var(--color-purple);
}

.radio.emerald input:checked + .radio-circle {
  background: var(--color-emerald);
  border-color: var(--color-emerald);
}

/* ----------------------------------------------------------
   24. FORM VALIDATION
   ---------------------------------------------------------- */

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

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

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

/* Input Validation States */
.form-input.is-error,
.form-select.is-error,
.form-textarea.is-error {
  border-color: var(--color-rose);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

.form-input.is-success,
.form-select.is-success,
.form-textarea.is-success {
  border-color: var(--color-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Form group (label + input + error) */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .form-row-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Required indicator */
.form-label .required {
  color: var(--color-rose);
  margin-left: 0.125rem;
}

/* ----------------------------------------------------------
   25. ALERTS
   ---------------------------------------------------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

.alert .alert-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.alert .alert-content {
  flex: 1;
}

.alert .alert-title {
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.alert .alert-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.125rem;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.alert .alert-close:hover {
  opacity: 1;
}

/* Info */
.alert-info {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.dark .alert-info {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

/* Success */
.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.dark .alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

/* Warning */
.alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.dark .alert-warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

/* Danger / Error */
.alert-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.dark .alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* Info (blue) */
.alert-info-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.dark .alert-info-blue {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

/* ----------------------------------------------------------
   26. TABS
   ---------------------------------------------------------- */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-primary);
  gap: 0;
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text-primary);
  border-bottom-color: var(--border-secondary);
}

.tab.active {
  color: var(--color-cyan);
  border-bottom-color: var(--color-cyan);
}

.tab .tab-icon {
  width: 1rem;
  height: 1rem;
}

.tab-content {
  display: none;
  padding: 1.25rem 0;
}

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

/* Tabs variant — pills */
.tabs-pill {
  display: flex;
  gap: 0.25rem;
  border-bottom: none;
  background: var(--surface-secondary);
  padding: 0.25rem;
  border-radius: var(--radius-md);
}

.tabs-pill .tab {
  border-bottom: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
}

.tabs-pill .tab:hover {
  color: var(--text-primary);
  background: var(--surface-tertiary);
  border-bottom: none;
}

.tabs-pill .tab.active {
  color: var(--text-primary);
  background: var(--surface-primary);
  border-bottom: none;
  box-shadow: var(--shadow-card);
}

/* ----------------------------------------------------------
   27. DROPDOWN MENU
   ---------------------------------------------------------- */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 12rem;
  padding: 0.375rem;
  margin-top: 0.375rem;
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.25rem);
  transition: all var(--transition-fast);
}

.dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
}

.dropdown-item .dropdown-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.dropdown-item:hover .dropdown-icon {
  color: var(--color-cyan);
}

.dropdown-item.danger:hover {
  color: var(--color-rose);
}

.dropdown-item.danger:hover .dropdown-icon {
  color: var(--color-rose);
}

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

/* ----------------------------------------------------------
   28. MODAL
   ---------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-dropdown);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(0.5rem);
  transition: transform var(--transition-base);
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-header .modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-header .modal-close:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-primary);
}

/* Modal sizes */
.modal-sm { max-width: 24rem; }
.modal-lg { max-width: 48rem; }
.modal-xl { max-width: 64rem; }

/* ----------------------------------------------------------
   29. BREADCRUMB
   ---------------------------------------------------------- */

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--color-cyan);
}

.breadcrumb .breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--text-tertiary);
  margin: 0 0.25rem;
  display: inline-flex;
  align-items: center;
}

/* ----------------------------------------------------------
   30. PAGINATION
   ---------------------------------------------------------- */

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

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

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

.page-btn.active {
  background: var(--color-cyan);
  color: #0f172a;
  border-color: var(--color-cyan);
  font-weight: 600;
}

.page-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.page-btn .page-icon {
  width: 1rem;
  height: 1rem;
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-left: 0.75rem;
}

/* ----------------------------------------------------------
   31. ACCORDION
   ---------------------------------------------------------- */

.accordion {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border-primary);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
  text-align: left;
  gap: 0.75rem;
}

.accordion-trigger:hover {
  background: var(--surface-secondary);
}

.accordion-trigger .accordion-arrow {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease, padding 300ms ease;
  padding: 0 1.25rem;
}

.accordion-item.open .accordion-content {
  max-height: 500px;
  padding: 0 1.25rem 1rem;
}

.accordion-content-inner {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ----------------------------------------------------------
   32. TIMELINE
   ---------------------------------------------------------- */

.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.4375rem;
  top: 0.5rem;
  bottom: 0;
  width: 2px;
  background: var(--border-primary);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 0.25rem;
  width: 0.9375rem;
  height: 0.9375rem;
  border-radius: 9999px;
  background: var(--surface-primary);
  border: 2px solid var(--border-secondary);
  z-index: 1;
}

.timeline-dot.cyan { border-color: var(--color-cyan); background: rgba(0, 240, 255, 0.15); }
.timeline-dot.purple { border-color: var(--color-purple); background: rgba(189, 0, 255, 0.15); }
.timeline-dot.emerald { border-color: var(--color-emerald); background: rgba(16, 185, 129, 0.15); }
.timeline-dot.rose { border-color: var(--color-rose); background: rgba(244, 63, 94, 0.15); }
.timeline-dot.amber { border-color: var(--color-amber); background: rgba(245, 158, 11, 0.15); }

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 0.125rem;
}

.timeline-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

/* ----------------------------------------------------------
   33. STEPS / WIZARD
   ---------------------------------------------------------- */

.steps {
  display: flex;
  gap: 0;
  width: 100%;
}

.step {
  display: flex;
  align-items: center;
  flex: 1;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border-primary);
  margin: 0 0.75rem;
  transition: background var(--transition-fast);
}

.step.completed:not(:last-child)::after {
  background: var(--color-cyan);
}

.step.active:not(:last-child)::after {
  background: var(--color-cyan);
}

.step-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  background: var(--surface-tertiary);
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.step.active .step-circle {
  background: var(--color-cyan);
  color: #0f172a;
  border-color: var(--color-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.step.completed .step-circle {
  background: var(--color-cyan);
  color: #0f172a;
  border-color: var(--color-cyan);
}

.step-label {
  display: none;
  margin-left: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
}

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

.step.completed .step-label {
  color: var(--text-secondary);
}

@media (min-width: 640px) {
  .step-label {
    display: block;
  }
}

/* ----------------------------------------------------------
   34. TOOLTIP
   ---------------------------------------------------------- */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.375rem);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
  background: #1e293b;
  border-radius: 0.375rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 100;
}

.dark [data-tooltip]::after {
  background: #f1f5f9;
  color: #0f172a;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

/* Tooltip positions */
[data-tooltip][data-tooltip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 0.375rem);
}

[data-tooltip][data-tooltip-pos="left"]::after {
  bottom: auto;
  left: auto;
  right: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%) scale(0.9);
}

[data-tooltip][data-tooltip-pos="left"]:hover::after {
  transform: translateY(-50%) scale(1);
}

[data-tooltip][data-tooltip-pos="right"]::after {
  bottom: auto;
  left: calc(100% + 0.5rem);
  right: auto;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
}

[data-tooltip][data-tooltip-pos="right"]:hover::after {
  transform: translateY(-50%) scale(1);
}

/* ----------------------------------------------------------
   35. FILE UPLOAD
   ---------------------------------------------------------- */

.file-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem 1.5rem;
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.file-upload:hover {
  border-color: var(--color-cyan);
  background: rgba(0, 240, 255, 0.03);
}

.file-upload .upload-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--text-tertiary);
}

.file-upload:hover .upload-icon {
  color: var(--color-cyan);
}

.file-upload .upload-text {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
}

.file-upload .upload-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.file-upload input {
  display: none;
}

/* ----------------------------------------------------------
   36. CODE BLOCK
   ---------------------------------------------------------- */

.code-block {
  background: #1e293b;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #e2e8f0;
  overflow-x: auto;
  border: 1px solid #334155;
}

.dark .code-block {
  background: #0f172a;
}

.code-block .code-comment { color: #64748b; }
.code-block .code-keyword { color: #c084fc; }
.code-block .code-string { color: #86efac; }
.code-block .code-variable { color: #fbbf24; }
.code-block .code-function { color: #60a5fa; }

.code-inline {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.125rem 0.375rem;
  background: var(--surface-tertiary);
  border-radius: 0.25rem;
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}

/* ----------------------------------------------------------
   37. SEARCH INPUT
   ---------------------------------------------------------- */

.search-input {
  position: relative;
}

.search-input .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  width: 1.125rem;
  height: 1.125rem;
}

.search-input .form-input {
  padding-left: 2.75rem;
  padding-right: 2.5rem;
}

.search-input .search-clear {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 9999px;
  display: none;
}

.search-input .search-clear.show {
  display: flex;
}

.search-input .search-clear:hover {
  background: var(--surface-tertiary);
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   38. STATS GROUP (horizontal metrics)
   ---------------------------------------------------------- */

.stats-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

@media (min-width: 640px) {
  .stats-group {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stats-group-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  border-right: 1px solid var(--border-primary);
  border-bottom: 1px solid var(--border-primary);
}

.stats-group-item:nth-child(2n) {
  border-right: none;
}

@media (min-width: 640px) {
  .stats-group-item {
    border-bottom: none;
  }
  .stats-group-item:nth-child(2n) {
    border-right: 1px solid var(--border-primary);
  }
  .stats-group-item:last-child {
    border-right: none;
  }
}

.stats-group-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stats-group-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.125rem;
}

   39. PAGE FOOTER
   ---------------------------------------------------------- */

.page-footer {
  position: relative;
  margin-top: 2.5rem;
  padding: 0;
  border: none;
}

.page-footer::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--color-cyan) 20%, var(--color-purple) 50%, var(--color-cyan) 80%, transparent 100%);
  opacity: 0.5;
  margin-bottom: 1.5rem;
}

.page-footer .footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding-bottom: 0.5rem;
}

.page-footer .footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.page-footer .footer-brand i {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--color-cyan);
}

.page-footer .footer-brand span {
  color: var(--color-cyan);
}

.page-footer .footer-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ----------------------------------------------------------
   40. RESPONSIVE UTILITIES
   ---------------------------------------------------------- */

@media (max-width: 639px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 640px) {
  .show-mobile { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}
