body {
  font-family: "IRANYekanX", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip link (a11y) */
.skip-link {
  position: absolute;
  top: -3rem;
  right: 0.75rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0.75rem;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Focus visible (a11y) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Sidebar */
.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 600;
  gap: 0.5rem;
}

.sidebar-link svg {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  display: block;
}

.sidebar-link span {
  flex: 1;
  line-height: 1.5;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transform: translateX(-2px);
}

.sidebar-link.active {
  background: linear-gradient(270deg, rgba(0, 144, 255, 0.2), rgba(0, 144, 255, 0.02));
  color: var(--text);
  border-color: rgba(0, 144, 255, 0.35);
  border-right: 3px solid var(--primary);
  box-shadow: inset 0 0 0 1px rgba(0, 144, 255, 0.12);
}

/* Submenu Styles */
.submenu {
  border-right: 2px solid rgba(0, 144, 255, 0.15);
  margin-right: 0.75rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding-right: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.submenu .sidebar-link {
  display: flex;
  align-items: center;
  padding-right: 1.25rem;
  padding-left: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  gap: 0.5rem;
}

.submenu .sidebar-link svg {
  flex-shrink: 0;
  width: 0.75rem;
  height: 0.75rem;
  display: block;
}

.submenu .sidebar-link span {
  flex: 1;
  line-height: 1.5;
}

.submenu .sidebar-link:hover {
  transform: translateX(-2px);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.submenu .sidebar-link.active {
  background: linear-gradient(270deg, rgba(0, 144, 255, 0.15), rgba(0, 144, 255, 0.05));
  border-color: rgba(0, 144, 255, 0.25);
  border-right: 2px solid var(--primary);
  box-shadow: inset 0 0 0 1px rgba(0, 144, 255, 0.1);
}

.sidebar-group .sidebar-link:first-child {
  font-weight: 600;
}

.sidebar-group .sidebar-link:first-child:hover {
  transform: translateX(-2px);
}

/* Ensure arrow icons in sidebar links are properly aligned (RTL) */
.sidebar-link .ml-auto {
  flex-shrink: 0;
  margin-right: auto;
  margin-left: 0;
}

.sidebar-link .mr-auto {
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 0;
}

/* Ensure proper vertical alignment for all sidebar link children */
.sidebar-link > * {
  display: flex;
  align-items: center;
}

.sidebar-link svg {
  vertical-align: middle;
}

/* Card Title */
.card-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin: 0;
}

/* KPI Cards */
.kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 0.5rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(0, 144, 255, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(30%, -30%);
  pointer-events: none;
}

.card-gradient-success .kpi-card::before {
  background: radial-gradient(circle, rgba(0, 204, 133, 0.2) 0%, transparent 70%);
}

.card-gradient-warning .kpi-card::before {
  background: radial-gradient(circle, rgba(255, 197, 61, 0.2) 0%, transparent 70%);
}

.card-gradient-danger .kpi-card::before {
  background: radial-gradient(circle, rgba(255, 66, 69, 0.2) 0%, transparent 70%);
}

.kpi-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kpi-label svg {
  width: 1rem;
  height: 1rem;
}

.kpi-trend {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
}

.kpi-trend.up {
  color: var(--success);
}

.kpi-trend.down {
  color: var(--danger);
}

.kpi-trend svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* Empty State */
.empty-state {
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem 1.25rem;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

/* HTMX Indicators */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  pointer-events: none;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

/* Loading Spinner */
.spinner {
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.6s linear infinite;
}

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

/* Form Elements */
label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23A9B4C7' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: left 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  padding-right: 2.5rem;
}

/* Checkbox and Radio */
input[type="checkbox"],
input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: var(--primary);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Focus Styles */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Utility Classes */
.text-red-400 { color: var(--danger); }
.text-green-400 { color: var(--success); }
.text-yellow-400 { color: var(--warning); }
.text-blue-400 { color: var(--primary); }
.text-orange-400 { color: var(--warning); }

.bg-red-500 { background-color: var(--danger); }
.bg-green-500 { background-color: var(--success); }
.bg-yellow-500 { background-color: var(--warning); }
.bg-blue-500 { background-color: var(--primary); }
.bg-orange-500 { background-color: var(--warning); }

.bg-gray-500 { background-color: rgba(255, 255, 255, 0.08); }
.bg-gray-600 { background-color: rgba(255, 255, 255, 0.12); }
.bg-gray-700 { background-color: rgba(255, 255, 255, 0.16); }
.border-gray-700 { border-color: rgba(255, 255, 255, 0.12); }

.bg-red-900\/20 { background-color: rgba(255, 66, 69, 0.12); }
.bg-green-900\/20 { background-color: rgba(0, 204, 133, 0.12); }
.bg-blue-900\/20 { background-color: rgba(0, 144, 255, 0.12); }

.border-red-500\/50 { border-color: rgba(255, 66, 69, 0.4); }
.border-green-500\/50 { border-color: rgba(0, 204, 133, 0.4); }
.border-blue-500\/50 { border-color: rgba(0, 144, 255, 0.4); }

.text-red-300 { color: #FF8F87; }
.text-green-300 { color: #3DD68C; }
.text-blue-300 { color: #70B8FF; }

/* Transitions */
.transition-colors {
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.transition-all {
  transition: all 0.2s ease;
}

/* App shell */
.app-shell {
  position: relative;
}

.app-sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)), var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(17, 17, 17, 0.85);
  backdrop-filter: blur(12px);
}

.page-main {
  max-width: 100%;
  margin: 0;
  width: 100%;
}

/* Dashboard hero */
.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.75rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)), var(--surface);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  inset: -40% auto auto -20%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(0, 204, 133, 0.18), transparent 70%);
  opacity: 0.8;
  pointer-events: none;
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -60% auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(0, 144, 255, 0.22), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.page-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 520px;
}

.hero-metrics {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: stretch;
}

.hero-metric {
  min-width: 160px;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow-sm);
  text-align: right;
}

.hero-metric.accent-success {
  border-color: rgba(0, 204, 133, 0.4);
  background: linear-gradient(135deg, rgba(0, 204, 133, 0.14), rgba(0, 204, 133, 0.04));
}

.hero-metric.accent-warning {
  border-color: rgba(255, 197, 61, 0.45);
  background: linear-gradient(135deg, rgba(255, 197, 61, 0.14), rgba(255, 197, 61, 0.04));
}

.metric-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 0.35rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.75rem 0 1rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.section-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.stagger > * {
  opacity: 0;
  transform: translateY(10px);
  animation: fade-up 0.5s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }

@keyframes fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stagger > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Responsive utilities */
@media (max-width: 768px) {
  .kpi-value {
    font-size: 1.5rem;
  }
  
  .card-title {
    font-size: 1rem;
  }

  .dashboard-hero {
    padding: 1.25rem;
  }

  .page-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 1024px) {
  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-metrics {
    width: 100%;
  }

  .hero-metric {
    flex: 1 1 160px;
  }
}

/* Breadcrumbs */
.breadcrumbs {
  padding: 0.5rem 0;
}

.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-link:hover {
  color: var(--text);
  text-decoration: underline;
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
  width: 100%;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastSlideIn 0.3s ease-out;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
}

.toast.success::before {
  background: var(--success);
}

.toast.error::before {
  background: var(--danger);
}

.toast.warning::before {
  background: var(--warning);
}

.toast.info::before {
  background: var(--primary);
}

.toast.fade-out {
  animation: toastSlideOut 0.3s ease-in forwards;
}

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

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

.toast-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

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

.toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  animation: toastProgress linear;
}

@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0;
  }
}

/* Skeleton Loaders */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.skeleton-table {
  width: 100%;
}

.skeleton-table-row {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.skeleton-table-cell {
  flex: 1;
  height: 1rem;
}

.skeleton-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

.skeleton-button {
  width: 100px;
  height: 2.5rem;
  border-radius: var(--radius-md);
}

.skeleton-loader-container {
  position: relative;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.skeleton-loader-container .skeleton-table {
  padding: 1rem;
}

.skeleton-loader-container .skeleton-table-row {
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Sidebar Search */
.sidebar-search-wrapper {
  margin-bottom: 1rem;
  width: 100%;
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  min-height: auto;
}

.sidebar-search:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-search:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 144, 255, 0.3);
  box-shadow: 0 0 0 2px rgba(0, 144, 255, 0.1);
}

.sidebar-search input,
.sidebar-search-input {
  flex: 1;
  width: 100%;
  padding: 0.625rem 2.5rem 0.625rem 0.875rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
  min-height: 2.5rem;
}

.sidebar-search input::placeholder,
.sidebar-search-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
  font-weight: 400;
}

.sidebar-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-secondary);
  opacity: 0.5;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1;
  flex-shrink: 0;
}

.sidebar-search:focus-within .sidebar-search-icon {
  color: var(--primary);
  opacity: 0.8;
}

.sidebar-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  z-index: 2;
  flex-shrink: 0;
}

.sidebar-search-clear:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
  transform: translateY(-50%) scale(1.1);
}

.sidebar-search-clear:active {
  transform: translateY(-50%) scale(0.95);
}

.menu-item-hidden {
  display: none !important;
}

/* Sidebar sections: visual grouping */
.sidebar-section {
  margin-top: 1.25rem;
}

.sidebar-section:first-child {
  margin-top: 0;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  opacity: 0.75;
  padding: 0 0.875rem 0.5rem;
  margin-bottom: 0.125rem;
  text-transform: uppercase;
  user-select: none;
}

.sidebar-section-label:empty {
  display: none;
}

/* Pagination */
.pagination-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.625rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.pagination-btn:hover:not(.pagination-btn-disabled):not(.pagination-btn-active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
  transform: translateY(-1px);
}

.pagination-btn-active {
  background: linear-gradient(270deg, rgba(0, 144, 255, 0.2), rgba(0, 144, 255, 0.05));
  border-color: rgba(0, 144, 255, 0.3);
  color: var(--primary);
  font-weight: 600;
  cursor: default;
}

.pagination-btn-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-btn-icon {
  padding: 0.5rem;
}

.pagination-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.pagination-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

.pagination-count strong {
  color: var(--text);
  font-weight: 600;
}

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

.pagination-goto-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  white-space: nowrap;
}

.pagination-goto-input {
  width: 4rem;
  height: 2.25rem;
  padding: 0 0.625rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.875rem;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
}

.pagination-goto-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 144, 255, 0.1);
}

.pagination-goto-btn {
  height: 2.25rem;
  padding: 0 1rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-goto-btn:hover {
  background: rgba(0, 144, 255, 0.9);
  transform: translateY(-1px);
}

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

@media (max-width: 640px) {
  .pagination-info {
    flex-direction: column;
    align-items: stretch;
  }
  
  .pagination-goto {
    justify-content: space-between;
  }
}

/* Lazy Loading */
.lazy-load {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-load.loaded {
  opacity: 1;
}

.lazy-image {
  background: rgba(255, 255, 255, 0.05);
  min-height: 200px;
}

.lazy-image img {
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-image img.loaded {
  opacity: 1;
}

.lazy-chart {
  min-height: 300px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.lazy-chart.loaded {
  background: transparent;
}

/* Infinite Scroll */
.infinite-scroll-container {
  position: relative;
}

.infinite-scroll-trigger {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.infinite-scroll-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.infinite-scroll-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.infinite-scroll-end {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Tooltips */
.tooltip {
  position: fixed;
  z-index: 10000;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  max-width: 250px;
  word-wrap: break-word;
  animation: tooltipFadeIn 0.2s ease-out;
}

.tooltip::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 5px solid transparent;
}

.tooltip-top::after {
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: rgba(0, 0, 0, 0.9);
}

.tooltip-bottom::after {
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: rgba(0, 0, 0, 0.9);
}

.tooltip-left::after {
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: rgba(0, 0, 0, 0.9);
}

.tooltip-right::after {
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: rgba(0, 0, 0, 0.9);
}

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

/* Context Menu */
.context-menu {
  position: fixed;
  z-index: 10001;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 0.5rem;
  animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.context-menu-item:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.context-menu-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.context-menu-separator {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

.context-menu-shortcut {
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Keyboard Shortcuts Modal */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.shortcut-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

kbd {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: monospace;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  min-width: 1.5rem;
  text-align: center;
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.3;
  color: var(--text-secondary);
}

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

.empty-state-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  max-width: 400px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  /* Mobile optimizations */
  .table {
    font-size: 0.75rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
  }
  
  .card {
    padding: 1rem;
  }
  
  .pagination {
    gap: 0.25rem;
  }
  
  .pagination-btn {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
  }
  
  .pagination-info {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .pagination-goto {
    width: 100%;
    justify-content: space-between;
  }
  
  .context-menu {
    min-width: 180px;
    font-size: 0.8125rem;
  }
  
  .tooltip {
    max-width: 200px;
    font-size: 0.75rem;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  /* Tablet optimizations */
  .table {
    font-size: 0.8125rem;
  }
  
  .card {
    padding: 1.25rem;
  }
}

/* Session Management */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.session-item.current {
  border-color: var(--primary);
  background: rgba(0, 144, 255, 0.05);
}

.session-info {
  flex: 1;
}

.session-device {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.session-details {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.session-actions {
  display: flex;
  gap: 0.5rem;
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.activity-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 144, 255, 0.1);
  color: var(--primary);
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.activity-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

.activity-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.activity-filter {
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.activity-filter:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.activity-filter.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Export/Import Buttons */
.export-import-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.export-btn,
.import-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-btn:hover,
.import-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.export-btn svg,
.import-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Dashboard Widgets */
.widgets-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .widgets-container {
    grid-template-columns: 1fr;
  }
}

/* Widget Column Control */
.widget-col-1 {
  grid-column: span 1;
}

.widget-col-2 {
  grid-column: span 2;
}

@media (max-width: 1024px) {
  .widget-col-1,
  .widget-col-2 {
    grid-column: span 1;
  }
}

.widget-column-control {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: auto;
  margin-left: 1rem;
}

.widget-col-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.widget-col-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: var(--primary);
}

.widget-col-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.widget {
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 200px;
}

.widget.dragging {
  opacity: 0.5;
  cursor: grabbing;
  transform: scale(0.98);
  z-index: 1000;
  pointer-events: none;
}

.widget.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 144, 255, 0.3);
  transform: scale(1.02);
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: var(--text-secondary);
  cursor: move;
  transition: color 0.2s ease;
  margin-left: 0.5rem;
}

.drag-handle:hover {
  color: var(--text);
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.widget-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

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

.widget-body {
  padding: 1.25rem;
}

.widget-placeholder {
  border: 2px dashed var(--primary) !important;
  border-radius: var(--radius-md);
  min-height: 200px !important;
  background: rgba(0, 144, 255, 0.15) !important;
  transition: all 0.2s ease;
  grid-column: span 2;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin: 0 !important;
  padding: 1.5rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
  position: relative;
  z-index: 1;
}

.widget-placeholder.widget-col-1 {
  grid-column: span 1;
}

.widget-placeholder.widget-col-2 {
  grid-column: span 2;
}

/* Mobile drawer */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.mobile-drawer-overlay-visible {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(18rem, 85vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mobile-drawer-open {
  transform: translateX(0);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3);
}

.mobile-drawer-body-open {
  overflow: hidden;
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mobile-drawer-close {
  padding: 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.mobile-drawer-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.mobile-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Button loading state (UX) */
.btn[data-loading="true"] {
  position: relative;
  color: transparent;
  pointer-events: none;
}
.btn[data-loading="true"]::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 50%;
  left: 50%;
  margin-top: -0.5rem;
  margin-left: -0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
