:root {
  color-scheme: dark;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --color-page: #1e2127;
  --color-sidebar: #1a1d23;
  --color-surface: #262a32;
  --color-surface-2: #2e333c;
  --color-line: #3b414c;
  --color-body: #eceef2;
  --color-muted: #9aa1ad;
  --color-primary: #e11d2f;
  --color-primary-hover: #c4141f;
  --color-danger: #9f1239;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-info: #38bdf8;
}

*, ::after, ::before, ::backdrop, ::file-selector-button {
  border-color: var(--color-line);
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  font-family: var(--font-sans);
}

body {
  background-color: var(--color-page);
  color: var(--color-body);
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
}

button:not(:disabled) {
  cursor: pointer;
}

[x-cloak] {
  display: none !important;
}

/* Background Color Utilities */
.bg-page { background-color: var(--color-page); }
.bg-sidebar { background-color: var(--color-sidebar); }
.bg-surface { background-color: var(--color-surface); }
.bg-surface-2 { background-color: var(--color-surface-2); }
.bg-line { background-color: var(--color-line); }
.bg-primary { background-color: var(--color-primary); }
.bg-primary-hover:hover { background-color: var(--color-primary-hover); }
.bg-danger { background-color: var(--color-danger); }
.bg-success { background-color: var(--color-success); }
.bg-warning { background-color: var(--color-warning); }
.bg-info { background-color: var(--color-info); }

/* Text Color Utilities */
.text-body { color: var(--color-body); }
.text-muted { color: var(--color-muted); }
.text-primary { color: var(--color-primary); }
.text-danger { color: #fb7185; }
.text-success { color: #4ade80; }
.text-warning { color: #fbbf24; }
.text-info { color: #7dd3fc; }

/* Border Color Utilities */
.border-line { border-color: var(--color-line); }
.border-primary { border-color: var(--color-primary); }
.border-danger { border-color: var(--color-danger); }
.border-success { border-color: var(--color-success); }
.border-warning { border-color: var(--color-warning); }

/* Component Classes */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}
.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(225, 29, 47, 0.35);
}
.btn-secondary {
  background-color: var(--color-surface-2);
  color: var(--color-body);
  border-color: var(--color-line);
}
.btn-secondary:hover {
  background-color: var(--color-surface);
  border-color: var(--color-muted);
}
.btn-ghost {
  background-color: transparent;
  color: var(--color-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background-color: var(--color-surface-2);
  color: var(--color-body);
}
.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
  border-color: var(--color-danger);
}
.btn-danger:hover {
  background-color: #881337;
  border-color: #881337;
}
.btn-sm {
  font-size: 0.75rem;
  line-height: 1rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
}
.btn-lg {
  font-size: 1rem;
  line-height: 1.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.625rem;
}

.card {
  width: 100%;
  max-width: 100%;
  background-color: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
}

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 0.375rem;
}

.input, .select, .textarea {
  width: 100%;
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  padding: 0.5rem 0.875rem;
  color: var(--color-body);
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-sizing: border-box;
}
.input::placeholder, .textarea::placeholder {
  color: rgba(154, 161, 173, 0.6);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.checkbox {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid var(--color-line);
  background-color: var(--color-surface-2);
  accent-color: var(--color-primary);
  cursor: pointer;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted);
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}
.nav-item:hover {
  color: var(--color-body);
  background-color: var(--color-surface-2);
}
.nav-item.active {
  color: #ffffff;
  background-color: var(--color-surface-2);
  font-weight: 600;
  border-left: none;
}
.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--color-muted);
  transition: color 0.15s ease-in-out;
}
.nav-item:hover .nav-icon {
  color: var(--color-body);
}
.nav-item.active .nav-icon {
  color: var(--color-primary);
}
.nav-group-label {
  padding: 0 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(154, 161, 173, 0.7);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}
.breadcrumb-item {
  transition: color 0.15s ease-in-out;
  color: var(--color-muted);
  text-decoration: none;
}
.breadcrumb-item:hover {
  color: var(--color-body);
}
.breadcrumb-sep {
  width: 1rem;
  height: 1rem;
  color: rgba(154, 161, 173, 0.4);
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  border-width: 1px;
}
.badge-primary {
  background-color: rgba(225, 29, 47, 0.15);
  color: #ff6b77;
  border-color: rgba(225, 29, 47, 0.3);
}
.badge-success {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}
.badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}
.badge-danger {
  background-color: rgba(159, 18, 57, 0.2);
  color: #fb7185;
  border-color: rgba(159, 18, 57, 0.4);
}
.badge-info {
  background-color: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.3);
}
.badge-muted {
  background-color: var(--color-surface-2);
  color: var(--color-muted);
  border-color: var(--color-line);
}

.table {
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
  border-collapse: collapse;
}
.table thead {
  background-color: var(--color-surface-2);
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-line);
}
.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-line);
  color: var(--color-body);
}
.table tbody tr:hover {
  background-color: rgba(46, 51, 60, 0.5);
}

.page-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, var(--color-primary), #ff6b77);
  z-index: 9999;
  animation: loadingBar 1.2s infinite ease-in-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate-slide-in {
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loadingBar {
  0% { transform: scaleX(0); transform-origin: left; }
  50% { transform: scaleX(0.7); transform-origin: left; }
  100% { transform: scaleX(1); transform-origin: right; }
}

/* ==========================================================================
   Comprehensive Tailwind Utility Fallbacks
   ========================================================================== */

/* Layout & Flexbox Primitives */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.grow { flex-grow: 1; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }

.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Grid System */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-12 { grid-column: span 12 / span 12; }

/* Dimensions & Overflow */
.w-full { width: 100%; }
.w-screen { width: 100vw; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.min-w-0 { min-width: 0px; }
.min-h-screen { min-height: 100vh; }
.max-w-full { max-width: 100%; }
.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }

.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-9 { width: 2.25rem; }
.h-9 { height: 2.25rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-11 { width: 2.75rem; }
.h-11 { height: 2.75rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.w-20 { width: 5rem; }
.w-64 { width: 16rem; }
.w-fit { width: fit-content; }
.h-24 { height: 6rem; }
.w-36 { width: 9rem; }
.max-h-80 { max-height: 20rem; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0px; }
.left-0 { left: 0px; }
.right-0 { right: 0px; }
.bottom-0 { bottom: 0px; }
.inset-0 { inset: 0px; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* Spacing */
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }

.space-x-1 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.25rem; }
.space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.5rem; }

.p-1 { padding: 0.25rem; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pr-1 { padding-right: 0.25rem; }
.pr-2 { padding-right: 0.5rem; }

.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0px; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Borders & Rounding */
.border { border-width: 1px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-r { border-right-width: 1px; border-right-style: solid; }
.border-l { border-left-width: 1px; border-left-style: solid; }

.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.italic { font-style: italic; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }

/* Visibility & Displays */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }

/* Transitions */
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.rotate-180 { transform: rotate(180deg); }

/* Responsive Media Queries */
@media (min-width: 640px) {
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none; }
  .sm\:inline-flex { display: inline-flex; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .sm\:col-span-6 { grid-column: span 6 / span 6; }
  .sm\:col-span-12 { grid-column: span 12 / span 12; }
  .sm\:p-6 { padding: 1.5rem; }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:gap-4 { gap: 1rem; }
  .sm\:text-lg { font-size: 1.125rem; line-height: 1.75rem; }
  .sm\:text-xl { font-size: 1.25rem; line-height: 1.75rem; }
  .sm\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
}

@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .md\:block { display: block; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:pt-0 { padding-top: 0px; }
  .md\:pt-6 { padding-top: 1.5rem; }
  .md\:border-t-0 { border-top-width: 0px; }
  .md\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
}

@media (min-width: 1024px) {
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none; }
  .lg\:block { display: block; }
  .lg\:pl-64 { padding-left: 16rem; }
  .lg\:pl-20 { padding-left: 5rem; }
  .lg\:translate-x-0 { transform: translateX(0); }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:col-span-1 { grid-column: span 1 / span 1; }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:p-8 { padding: 2rem; }
}
