/* ========================================
   Admin Theme Dashboard - Dark Mode
   ======================================== */

/* Reset & Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #111827;
  color: #f9fafb;
  line-height: 1.5;
}

/* Layout */
.dashboard-wrap {
  min-height: 100vh;
}

.main-with-sidebar {
  margin-left: 256px; /* w-64 */
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 256px;
  z-index: 30;
  background: #1f2937;
  border-right: 1px solid #374151;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 1rem;
  border-bottom: 1px solid #374151;
}

.sidebar-brand-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: #2563eb; /* blue-600 */
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-text p:first-child {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0;
}

.sidebar-brand-text p:last-child {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem 1.25rem;
  overflow-y: auto;
}

.nav-section {
  margin-top: 2rem;
}

.nav-section:first-child {
  margin-top: 1.5rem;
}

.nav-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}

.icon-svg,
.nav-icon-svg,
.btn-icon-svg {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  vertical-align: middle;
}

.nav-section-title .icon-svg {
  color: #9ca3af;
}

.nav-section-title span {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.nav-item {
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-left: 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #d1d5db;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: #374151;
  color: #f9fafb;
}

.nav-link.active {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  border-left-color: #2563eb;
}

.nav-link.active .nav-icon-svg {
  color: #93c5fd;
}

.nav-icon-svg {
  color: #9ca3af;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #374151;
  background: #1f2937;
}

.btn-logout {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fca5a5;
  background: transparent;
  border: 1px solid rgba(220, 38, 38, 0.4);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-logout:hover {
  background: rgba(220, 38, 38, 0.15);
}


/* Main content */
.main-content {
  padding: 1.5rem 2rem;
}

/* Page header card */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  padding: 1.5rem;
}

.page-header-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f9fafb;
  margin: 0;
}

.page-header-title p {
  color: #9ca3af;
  margin: 0.25rem 0 0;
}

/* Alerts */
.alerts-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
}

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

.alert-message {
  flex: 1;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
}

.alert-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

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

.alert-dismiss .icon-svg {
  width: 1rem;
  height: 1rem;
}

.alert-success {
  background: rgba(5, 150, 105, 0.2);
  border-color: rgba(5, 150, 105, 0.4);
  color: #6ee7b7;
}

.alert-success .alert-icon {
  color: #34d399;
}

.alert-success .alert-dismiss {
  color: #6ee7b7;
}

.alert-warning {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(217, 119, 6, 0.4);
  color: #fcd34d;
}

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

.alert-warning .alert-dismiss {
  color: #fcd34d;
}

.alert-error {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
}

.alert-error .alert-icon {
  color: #f87171;
}

.alert-error .alert-dismiss {
  color: #fca5a5;
}

.alert-info {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.4);
  color: #93c5fd;
}

.alert-info .alert-icon {
  color: #60a5fa;
}

.alert-info .alert-dismiss {
  color: #93c5fd;
}

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  padding: 1.25rem;
}

.stat-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.stat-card-icon .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
  color: inherit;
}

.stat-card-icon-blue {
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
}

.stat-card-icon-green {
  background: rgba(5, 150, 105, 0.25);
  color: #34d399;
}

.stat-card-icon-amber {
  background: rgba(217, 119, 6, 0.25);
  color: #fbbf24;
}

.stat-card-icon-purple {
  background: rgba(124, 58, 237, 0.25);
  color: #a78bfa;
}

.stat-card-content {
  min-width: 0;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #9ca3af;
  margin: 0 0 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f9fafb;
  margin: 0;
}

/* Filters bar */
.filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #9ca3af;
}

.filter-select {
  min-width: 120px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #f9fafb;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.filter-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.btn-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-search:hover {
  background: #1d4ed8;
}

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

.btn-clear-filters {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #9ca3af;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-clear-filters:hover {
  background: #4b5563;
  border-color: #6b7280;
  color: #e5e7eb;
}

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

/* Content card (table/charts container) */
.content-card {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  overflow: hidden;
  margin-top: 1.5rem;
}

.content-card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.content-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #f9fafb;
  margin: 0;
}

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

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-wrap:focus-within {
  background: #374151;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.search-wrap .search-icon {
  position: absolute;
  left: 0.875rem;
  width: 1rem;
  height: 1rem;
  color: #9ca3af;
  pointer-events: none;
  transition: color 0.2s;
}

.search-wrap:focus-within .search-icon {
  color: #2563eb;
}

.search-input {
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  font-size: 0.875rem;
  color: #f9fafb;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  min-width: 220px;
  transition: color 0.2s;
}

.search-input::placeholder {
  color: #6b7280;
}

.search-input:focus {
  outline: none;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-add:hover {
  background: #1d4ed8;
}

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

.btn-modal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e5e7eb;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-modal:hover {
  background: #4b5563;
  border-color: #6b7280;
  color: #f9fafb;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: #374151;
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #9ca3af;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 1rem;
  color: #f9fafb;
  border-top: 1px solid #374151;
}

.data-table tbody tr:hover {
  background: #374151;
}

.th-actions {
  white-space: nowrap;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  color: #9ca3af;
  background: transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

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

.btn-action:hover {
  color: #f9fafb;
}

.btn-action-view:hover {
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
}

.btn-action-edit:hover {
  background: rgba(5, 150, 105, 0.25);
  color: #34d399;
}

.btn-action-delete:hover {
  background: rgba(220, 38, 38, 0.25);
  color: #f87171;
}

/* Table pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #374151;
  background: #374151;
}

.pagination-info {
  font-size: 0.875rem;
  color: #9ca3af;
  margin: 0;
}

.pagination-info strong {
  color: #f9fafb;
  font-weight: 600;
}

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

.btn-pagination {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: #9ca3af;
  background: #1f2937;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-pagination:hover:not(:disabled) {
  background: #1f2937;
  border-color: #2563eb;
  color: #60a5fa;
}

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

.btn-pagination .btn-icon-svg {
  width: 1.125rem;
  height: 1.125rem;
}

.btn-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #e5e7eb;
  background: #1f2937;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-page:hover {
  border-color: #2563eb;
  color: #60a5fa;
}

.btn-page.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

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

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

.pagination-select {
  min-width: 4rem;
}

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

.empty-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  background: #374151;
  border-radius: 0.5rem;
  color: #6b7280;
}

.empty-state-icon .icon-svg {
  width: 2rem;
  height: 2rem;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0 0 0.5rem;
}

.empty-state-description {
  font-size: 0.875rem;
  color: #9ca3af;
  margin: 0 0 1.25rem;
  max-width: 20rem;
}

/* Loading / Skeleton */
.loading-demo {
  padding: 1.5rem;
}

.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
}

.skeleton {
  height: 0.875rem;
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 0.25rem;
}

.skeleton-text {
  height: 1rem;
}

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

.skeleton-table {
  border: 1px solid #374151;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.skeleton-table-row {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #374151;
  background: #1f2937;
}

.skeleton-table-row:last-child {
  border-bottom: none;
}

.spinner-demo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.spinner-label {
  font-size: 0.875rem;
  color: #9ca3af;
  margin: 0;
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #374151;
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
}

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

/* Charts */
.charts-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.chart-card {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  padding: 1.25rem;
}

.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0 0 1rem;
}

.chart-placeholder {
  height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
}

.chart-line {
  align-items: stretch;
  padding: 0.5rem 0;
}

.chart-line .chart-svg {
  width: 100%;
  height: 100%;
  color: #60a5fa;
}

.chart-bar .bar {
  flex: 1;
  max-width: 2rem;
  background: #60a5fa;
  border-radius: 0.25rem 0.25rem 0 0;
  min-height: 0.5rem;
}

.chart-pie {
  align-items: center;
  justify-content: center;
}

.pie-chart {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(#2563eb 0deg 90deg, #059669 90deg 180deg, #d97706 180deg 270deg, #7c3aed 270deg 360deg);
}

/* Tabs */
.tabs {
  padding: 0 1.5rem 1.5rem;
}

.tabs-list {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid #374151;
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: #f9fafb;
}

.tab-btn.active {
  color: #60a5fa;
  border-bottom-color: #2563eb;
}

.tab-panels {
  min-height: 4rem;
}

.tab-panel {
  display: none;
}

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

.tab-panel p {
  margin: 0;
  font-size: 0.875rem;
  color: #9ca3af;
  line-height: 1.6;
}

/* Progress bars */
.progress-demo {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.progress-item {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #d1d5db;
}

.progress-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f9fafb;
}

.progress-track {
  height: 0.5rem;
  background: #374151;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-fill-success {
  background: #059669;
}

.progress-fill-warning {
  background: #d97706;
}

/* Disclaimer / Important points card */
.disclaimer-card {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 0.5rem;
}

.disclaimer-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0 0 0.75rem;
}

.disclaimer-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: #e5e7eb;
  line-height: 1.6;
}

.disclaimer-list li {
  margin-bottom: 0.5rem;
}

.disclaimer-list li:last-child {
  margin-bottom: 0;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.badge-yellow {
  background: rgba(217, 119, 6, 0.3);
  color: #fcd34d;
  border: 1px solid rgba(217, 119, 6, 0.5);
}

.badge-green {
  background: rgba(5, 150, 105, 0.3);
  color: #6ee7b7;
  border: 1px solid rgba(5, 150, 105, 0.5);
}

.badge-gray {
  background: #374151;
  color: #d1d5db;
  border: 1px solid #4b5563;
}

/* Spacing utility */
.space-y > * + * {
  margin-top: 1.5rem;
}

/* ========================================
   Modal
   ======================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

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

.modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  pointer-events: none;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-dialog {
  width: 100%;
  max-width: 448px;
  max-height: calc(100vh - 3rem);
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #374151;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0;
}

.btn-close-modal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.btn-close-modal:hover {
  color: #f9fafb;
  background: #374151;
}

.btn-close-modal .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: #374151;
  border-top: 1px solid #4b5563;
  flex-shrink: 0;
}

.modal-footer .btn-cancel,
.modal-footer .btn-submit {
  min-width: 5rem;
}

/* ========================================
   Offcanvas
   ======================================== */
.offcanvas-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.offcanvas-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

.offcanvas {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  z-index: 50;
  background: #1f2937;
  box-shadow: -10px 0 25px -5px rgb(0 0 0 / 0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.offcanvas.is-open {
  transform: translateX(0);
}

.offcanvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid #374151;
  flex-shrink: 0;
}

.offcanvas-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f9fafb;
  margin: 0;
}

.btn-close-offcanvas {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.btn-close-offcanvas:hover {
  color: #f9fafb;
  background: #374151;
}

.btn-close-offcanvas .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
}

.offcanvas-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.offcanvas-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #374151;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group-row {
  flex-direction: row;
  align-items: center;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #d1d5db;
}

.form-label .required {
  color: #dc2626;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #f9fafb;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-input::placeholder {
  color: #6b7280;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-helper,
.form-helper-inline {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 0;
}

.form-helper-inline {
  margin-left: 0.25rem;
  font-size: 0.75rem;
  color: #6b7280;
}

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

.form-input-error {
  border-color: #dc2626;
}

.form-input-error:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.form-input-success {
  border-color: #059669;
}

.form-input-success:focus {
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.form-input:disabled {
  background: #374151;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 0.7;
}

.form-helper-error {
  color: #dc2626;
}

.form-helper-success {
  color: #059669;
}

/* File upload */
.file-upload {
  position: relative;
  min-height: 8rem;
  border: 2px dashed #4b5563;
  border-radius: 0.5rem;
  background: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.file-upload:hover,
.file-upload.is-dragover {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.15);
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  pointer-events: none;
}

.file-upload-icon {
  width: 2rem;
  height: 2rem;
  color: #6b7280;
}

.file-upload:hover .file-upload-icon,
.file-upload.is-dragover .file-upload-icon {
  color: #60a5fa;
}

.file-upload-text {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #d1d5db;
}

.file-upload-browse {
  color: #60a5fa;
  text-decoration: underline;
}

.file-upload-hint {
  margin: 0;
  font-size: 0.75rem;
  color: #9ca3af;
}

.form-label-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: #2563eb;
  cursor: pointer;
}

.offcanvas-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: #374151;
  border-top: 1px solid #4b5563;
}

.btn-cancel {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #d1d5db;
  background: #1f2937;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-cancel:hover {
  background: #374151;
  border-color: #6b7280;
}

.btn-submit {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-submit:hover {
  background: #1d4ed8;
}

/* ========================================
   Sidebar Toggle & Collapsible Sidebar
   ======================================== */
.sidebar-toggle-inline {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin-right: 0.75rem;
  color: #9ca3af;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.375rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sidebar-toggle-inline:hover {
  background: #4b5563;
  color: #f9fafb;
}

.sidebar-toggle-inline .icon-svg {
  width: 1.25rem;
  height: 1.25rem;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  pointer-events: none;
}

.sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Collapsed sidebar (desktop) */
.sidebar.is-collapsed {
  width: 72px;
}

.sidebar.is-collapsed .sidebar-brand-text,
.sidebar.is-collapsed .nav-section-title span,
.sidebar.is-collapsed .nav-link span,
.sidebar.is-collapsed .btn-logout span {
  display: none;
  overflow: hidden;
}

.sidebar.is-collapsed .sidebar-brand-inner {
  justify-content: center;
}

.sidebar.is-collapsed .nav-link {
  justify-content: center;
  margin-left: 0;
  padding: 0.5rem;
}

.sidebar.is-collapsed .nav-section-title {
  justify-content: center;
  padding: 0;
}

.sidebar.is-collapsed .btn-logout {
  justify-content: center;
}

.main-with-sidebar.sidebar-collapsed {
  margin-left: 72px;
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

/* Tablet and below: sidebar overlay, full-width main */
@media (max-width: 1023px) {
  .sidebar-toggle-inline {
    display: inline-flex;
  }

  .main-with-sidebar {
    margin-left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

/* Mobile: stacked layout, tighter spacing */
@media (max-width: 767px) {
  .main-content {
    padding: 1rem;
  }

  .page-header {
    padding: 1rem;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
  }

  .page-header .sidebar-toggle-inline {
    order: -1;
    margin-right: 0.5rem;
  }

  .page-header-title {
    flex: 1;
    min-width: 0;
  }

  .page-header-title h1 {
    font-size: 1.25rem;
  }

  .header-actions {
    width: 100%;
    order: 3;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .filter-group {
    flex: 1;
    min-width: 0;
  }

  .filter-select {
    min-width: 0;
    width: 100%;
  }

  .content-card-header {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .search-input {
    min-width: 0;
    width: 100%;
  }

  .header-actions {
    justify-content: stretch;
  }

  .content-card {
    margin-top: 1rem;
    overflow-x: auto;
  }

  .data-table {
    min-width: 600px;
  }

  .table-pagination {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .pagination-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .charts-section {
    grid-template-columns: 1fr;
  }

  .skeleton-cards {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    margin: 0.5rem;
  }

  .offcanvas {
    max-width: 100%;
  }

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

/* Small mobile */
@media (max-width: 479px) {
  .header-actions {
    flex-direction: column;
  }

  .header-actions .btn-add,
  .header-actions .btn-modal {
    width: 100%;
    justify-content: center;
  }
}
