/* SouPagu - Minimalist Design System */

:root {
  /* Colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Borders */
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-6);
}

/* Header */
header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

nav {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

nav a {
  color: var(--gray-600);
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  transition: all 0.2s;
}

nav a:hover,
nav a.active {
  background: var(--gray-100);
  color: var(--primary);
}

/* Dropdown Menu */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  color: var(--gray-600);
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-dropdown-toggle:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.nav-dropdown-toggle::after {
  content: '▾';
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.nav-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: var(--radius);
  padding-top: 0.5rem;
  z-index: 1000;
  border: 1px solid var(--gray-200);
}

.nav-dropdown:hover .nav-dropdown-content {
  display: block;
}

.nav-dropdown-content a {
  display: block;
  padding: var(--space-3) var(--space-4);
  color: var(--gray-700);
  text-decoration: none;
  transition: background 0.2s;
  border-radius: 0;
}

.nav-dropdown-content a:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.nav-dropdown-content a:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.nav-dropdown-content a:hover {
  background: var(--gray-50);
  color: var(--primary);
}

/* User Menu (Right-aligned dropdown) */
.user-menu {
  margin-left: auto;
  position: relative;
  display: inline-block;
}

.user-menu-toggle {
  color: var(--gray-700);
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.user-menu-toggle:hover {
  background: var(--gray-100);
}

.user-menu-toggle.has-avatar::before {
  display: none !important;
  content: none !important;
}

.user-menu-toggle::before {
  content: '👤';
  font-size: 1rem;
}

.user-menu-toggle::after {
  content: '▾';
  font-size: 0.75rem;
}

.user-menu-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: var(--radius);
  padding-top: 0.5rem;
  z-index: 1000;
  border: 1px solid var(--gray-200);
}

.user-menu:hover .user-menu-content {
  display: block;
}

.user-menu-content a {
  display: block;
  padding: var(--space-3) var(--space-4);
  color: var(--gray-700);
  text-decoration: none;
  transition: background 0.2s;
  border-radius: 0;
}

.user-menu-content a:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.user-menu-content a:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.user-menu-content a:hover {
  background: var(--gray-50);
}

.user-menu-content a.logout {
  color: var(--danger);
  border-top: 1px solid var(--gray-100);
}


/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card .value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-card .label {
  color: var(--gray-500);
  font-size: 0.875rem;
  margin-top: var(--space-1);
}

.stat-card.primary .value {
  color: var(--primary);
}

.stat-card.success .value {
  color: var(--success);
}

.stat-card.danger .value {
  color: var(--danger);
}

.stat-card.warning .value {
  color: var(--warning);
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.card-body {
  padding: var(--space-6);
}

/* Search & Filters */
.search-bar {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select.filter {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  font-size: 0.875rem;
  min-width: 150px;
}

/* Table */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--gray-100);
}

tr:hover {
  background: var(--gray-50);
}

/* Badges */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

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

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

.badge-primary {
  background: #e0e7ff;
  color: #3730a3;
}

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

.badge-secondary {
  background: #e5e7eb;
  color: #374151;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
}

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

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  border-top: 1px solid var(--gray-200);
}

.pagination-info {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.pagination-controls {
  display: flex;
  gap: var(--space-2);
}

/* Activity List */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.activity-icon.cancel {
  background: #fee2e2;
  color: #991b1b;
}

.activity-icon.transfer {
  background: #dbeafe;
  color: #1e40af;
}

.activity-icon.new {
  background: #d1fae5;
  color: #065f46;
}

.activity-content {
  flex: 1;
}

.activity-content strong {
  color: var(--gray-800);
}

.activity-content small {
  color: var(--gray-500);
  display: block;
  margin-top: var(--space-1);
}

/* Modal - State-of-the-Art Design System */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalIconPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 1rem;
}

#task-modal-overlay {
  z-index: 10000;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  animation: modalFadeIn 0.3s ease-out;
}

.modal {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 1.25rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 1.5rem 1.5rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

/* Header color variants */
.modal-header.primary {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.modal-header.success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.modal-header.warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.modal-header.danger {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.modal-header.neutral {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

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

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  animation: modalIconPulse 2s ease-in-out infinite;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-icon.primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
}

.modal-icon.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.modal-icon.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.modal-icon.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.modal-icon.neutral {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  color: var(--gray-500);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
  background: white;
  color: var(--gray-700);
  transform: scale(1.1);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 60vh;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--gray-50);
}

.modal-footer .btn {
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  border-radius: 0.625rem;
}

.modal-footer .btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.modal-footer .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.modal-footer .btn-secondary {
  background: white;
  border: 1px solid var(--gray-200);
}

.modal-footer .btn-secondary:hover {
  background: var(--gray-50);
}

/* Form */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

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

/* Patient Detail */
.patient-header {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.patient-info {
  flex: 1;
}

.patient-info h1 {
  font-size: 1.5rem;
  margin-bottom: var(--space-2);
}

.patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  color: var(--gray-600);
  font-size: 0.875rem;
}

.patient-actions {
  display: flex;
  gap: var(--space-2);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

.info-item {
  padding: var(--space-3);
  background: var(--gray-50);
  border-radius: var(--radius);
}

.info-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: var(--space-1);
}

.info-item span {
  font-weight: 500;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  color: var(--gray-400);
}

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

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

/* Tabs */
.settings-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 0;
}

.settings-tab {
  padding: 0.75rem 1.5rem;
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.settings-tab:hover {
  color: var(--gray-700);
}

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

.tab-content {
  display: none;
}

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

/* Data Tables */
.data-table {
  width: 100%;
}

.data-table .user-row {
  transition: background 0.2s;
}

.data-table .user-row:hover {
  background: var(--gray-50);
}

/* Checkbox Option */
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 0.5rem 0;
  user-select: none;
}

.checkbox-option input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-option span {
  font-size: 1rem;
  color: var(--gray-700);
}

/* Responsive */
/* Mobile Navigation */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-700);
  cursor: pointer;
  padding: var(--space-2);
}

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-container {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: white;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  z-index: 2001;
}

.mobile-menu-overlay.active .mobile-menu-container {
  transform: translateX(0);
}

.mobile-menu-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  padding: var(--space-1);
}

.mobile-menu-content {
  padding: var(--space-4);
  overflow-y: auto;
  flex: 1;
}

.mobile-nav-link {
  display: block;
  padding: var(--space-3) var(--space-4);
  color: var(--gray-700);
  text-decoration: none;
  border-radius: var(--radius);
  margin-bottom: var(--space-1);
  font-weight: 500;
  transition: background 0.2s;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  background: var(--gray-50);
  color: var(--primary);
}

.mobile-nav-group {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--gray-100);
}

.mobile-nav-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: var(--space-2);
  padding: 0 var(--space-4);
}

.mobile-user-profile {
  padding: var(--space-4) var(--space-6);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.mobile-user-avatar {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Responsive Overrides */
@media (max-width: 768px) {

  /* Hide desktop nav */
  header nav {
    display: none;
  }

  /* Show mobile toggle */
  .mobile-menu-toggle {
    display: block;
  }

  /* Adjust grid layouts */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-body>div[style*="display: flex"] {
    flex-direction: column;
  }

  .card-body>div>div[style*="flex: 1"] {
    width: 100%;
  }

  /* Adjust header */
  header {
    padding: var(--space-3) var(--space-4);
  }

  .container {
    padding: var(--space-4);
  }

  /* Adjust tables */
  th,
  td {
    padding: var(--space-2) var(--space-3);
    font-size: 0.8125rem;
  }

  .badge {
    padding: 0.125rem 0.375rem;
  }

  /* Adjust grid for dashboard */
  .container>div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

}

/* Avatar Utilities - Global (Moved out of media query) */
.avatar-circle {
  border-radius: 50% !important;
  object-fit: cover !important;
  aspect-ratio: 1/1;
  background-color: var(--gray-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  font-weight: 600;
  overflow: hidden;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 0.875rem;
}

.avatar-md {
  width: 48px;
  height: 48px;
  min-width: 48px;
  font-size: 1.125rem;
}

.avatar-lg {
  width: 96px;
  height: 96px;
  min-width: 96px;
  font-size: 2rem;
}

/* Upload overlay for avatar */
.avatar-upload-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 50%;
}

.avatar-upload-container:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.avatar-upload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
  color: white;
  gap: 4px;
}

.avatar-upload-container:hover .avatar-upload-overlay {
  opacity: 1;
}


/* Mobile Utilities */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }

  .desktop-only {
    display: none !important;
  }

  /* Groups Mobile Layout - Override inline grid styles */
  .groups-layout {
    display: block !important;
    /* Stack items, overriding grid */
  }

  /* Default state: List visible, Detail hidden */
  .groups-list-card {
    display: flex;
    height: calc(100vh - 80px);
  }

  .detail-card {
    display: none !important;
    /* Force hidden by default on mobile */
    min-height: calc(100vh - 80px);
  }

  /* Active state: List hidden, Detail visible */
  .groups-layout.show-detail .groups-list-card {
    display: none !important;
  }

  .groups-layout.show-detail .detail-card {
    display: flex !important;
  }

  /* CRM Mobile Layout */
  .crm-grid {
    grid-template-columns: 1fr !important;
  }

  .funnel-container {
    grid-template-columns: 1fr 1fr !important;
    /* 2 columns on mobile */
  }

  /* Kanban Mobile: Stack columns */
  #kanban-board>div {
    grid-template-columns: 1fr !important;
    display: grid !important;
  }

  /* Tables */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal Adjustments */
  .modal-content {
    width: 95% !important;
    margin: 10px auto !important;
    max-height: 90vh;
  }
}

/* Global Toasts (Notifications) - Apple High-End Glassmorphism */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 10001;
  pointer-events: none;
}

.toast {
  position: relative;
  min-width: 340px;
  max-width: 500px;
  padding: 0.75rem 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.4);
  /* Lower opacity for better glass effect */
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  color: #1c1c1e;

  /* Multi-layered shadow for high-end depth */
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 10px 40px -4px rgba(0, 0, 0, 0.08),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.5);
  /* Inner glint */

  display: flex;
  align-items: center;
  gap: 0.875rem;
  pointer-events: auto;
  animation: toastSpringIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast.removing {
  animation: toastSlideOut 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.toast-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.toast:hover .toast-icon-wrapper {
  transform: scale(1.05);
}

.toast.success .toast-icon-wrapper {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

.toast.error .toast-icon-wrapper {
  background: rgba(255, 59, 48, 0.12);
  color: #d72319;
}

.toast.warning .toast-icon-wrapper {
  background: rgba(255, 149, 0, 0.12);
  color: #b36b00;
}

.toast.info .toast-icon-wrapper {
  background: rgba(0, 122, 255, 0.12);
  color: #0062cc;
}

.toast-icon {
  width: 22px;
  height: 22px;
}

.toast-message {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.015em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@keyframes toastSpringIn {
  0% {
    opacity: 0;
    transform: translateX(40px) scale(0.92) rotate(2deg);
  }

  70% {
    transform: translateX(-5px) scale(1.02) rotate(-0.5deg);
  }

  100% {
    opacity: 1;
    transform: translateX(0) scale(1) rotate(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }

  to {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
    filter: blur(8px);
  }
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
  }
}