/* =============================================================================
   LIQUISA DESIGN SYSTEM
   Version: 1.0.0

   A comprehensive design system for the Liquisa SaaS application.
   Based on the CI/CD guidelines: serious, modern, business-focused.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ----------------------------------------------------------------------------- */

:root {

  /* === Brand Colors === */
  --color-primary: #0B1220;
  --color-primary-light: #131A31;
  --color-primary-hover: #1a2540;
  --color-accent: #6EE7FF;
  --color-accent-dark: #4BC4E8;
  --color-accent-light: rgb(110, 231, 255, 0.15);
  --color-accent-glow: rgb(110, 231, 255, 0.3);
  --color-secondary: #A78BFA;
  --color-secondary-dark: #8E73DD;
  --color-secondary-light: rgb(167, 139, 250, 0.15);

  /* === Semantic Colors === */
  --color-success: #10B981;
  --color-success-light: rgb(16, 185, 129, 0.15);
  --color-warning: #F59E0B;
  --color-warning-light: rgb(245, 158, 11, 0.15);
  --color-danger: #EF4444;
  --color-danger-light: rgb(239, 68, 68, 0.15);
  --color-info: #3B82F6;
  --color-info-light: rgb(59, 130, 246, 0.15);

  /* === Neutral Colors === */
  --color-neutral-50: #F9FAFB;
  --color-neutral-100: #F3F4F6;
  --color-neutral-200: #E5E7EB;
  --color-neutral-300: #D1D5DB;
  --color-neutral-400: #9CA3AF;
  --color-neutral-500: #6B7280;
  --color-neutral-600: #4B5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1F2937;
  --color-neutral-900: #111827;

  /* === Text Colors === */
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-muted: #6B7280;
  --text-inverse: #FFF;
  --text-accent: var(--color-accent);

  /* === Background Colors === */
  --bg-page: #F8FAFC;
  --bg-surface: #FFF;
  --bg-surface-elevated: #FFF;
  --bg-sidebar: var(--color-primary);
  --bg-header: #FFF;
  --bg-hover: rgb(0, 0, 0, 0.04);
  --bg-active: rgb(110, 231, 255, 0.08);

  /* === Border Colors === */
  --border-default: #E5E7EB;
  --border-light: #F3F4F6;
  --border-strong: #D1D5DB;
  --border-focus: var(--color-accent);

  /* === Typography === */
  --font-family-base: 'Inter', -apple-system, blinkmacsystemfont, 'Segoe UI', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  --font-family-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes - Using a modular scale (1.2 ratio) */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Letter Spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* === Spacing Scale === */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */

  /* === Border Radius === */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* === Shadows === */
  --shadow-xs: 0 1px 2px rgb(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgb(0, 0, 0, 0.1), 0 1px 2px rgb(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0, 0, 0, 0.1), 0 2px 4px -1px rgb(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0, 0, 0, 0.1), 0 4px 6px -2px rgb(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0, 0, 0, 0.1), 0 10px 10px -5px rgb(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgb(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px rgb(0, 0, 0, 0.06);
  --shadow-focus: 0 0 0 3px var(--color-accent-glow);

  /* === Transitions === */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-slower: 500ms ease;

  /* === Z-Index Scale === */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;

  /* === Layout === */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --content-max-width: 1400px;
  --container-padding: var(--space-6);
}

/* Dark mode overrides (for future use) */

[data-theme="dark"] {
  --text-primary: #F9FAFB;
  --text-secondary: #D1D5DB;
  --text-muted: #9CA3AF;
  --bg-page: #0B1220;
  --bg-surface: #131A31;
  --bg-surface-elevated: #1a2540;
  --border-default: #374151;
  --border-light: #1F2937;
}

/* -----------------------------------------------------------------------------
   2. CSS RESET & BASE STYLES
   ----------------------------------------------------------------------------- */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-page);
  min-height: 100vh;
}

/* Typography Base */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

a {
  color: var(--color-accent-dark);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent);
}

/* Focus visible for accessibility */

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Remove default focus for mouse users */

:focus:not(:focus-visible) {
  outline: none;
}

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

/* === App Shell === */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* === Sidebar === */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  z-index: var(--z-fixed);
  transition: width var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid rgb(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-height);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-inverse);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  pointer-events: none;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}

.nav-section {
  margin-bottom: var(--space-6);
}

.nav-section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: rgb(255, 255, 255, 0.4);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: rgb(255, 255, 255, 0.7);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgb(255, 255, 255, 0.08);
  color: var(--text-inverse);
}

.nav-item.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item-text {
  opacity: 1;
  transition: opacity var(--transition-base);
}

.sidebar.collapsed .nav-item-text {
  opacity: 0;
  pointer-events: none;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgb(255, 255, 255, 0.08);
}

/* === Main Content Area === */

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.sidebar.collapsed ~ .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* === Header === */

.header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--container-padding);
  z-index: var(--z-sticky);
}

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

.header-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.header-breadcrumb-separator {
  color: var(--color-neutral-300);
}

.header-breadcrumb a {
  color: var(--text-muted);
}

.header-breadcrumb a:hover {
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* === Main Content === */

.main-content {
  flex: 1;
  padding: var(--container-padding);
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
}

/* === Page Header === */

.page-header {
  margin-bottom: var(--space-6);
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 0;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* -----------------------------------------------------------------------------
   4. CARD COMPONENTS
   ----------------------------------------------------------------------------- */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

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

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  background: var(--color-neutral-50);
}

/* Card Variants */

.card-elevated {
  box-shadow: var(--shadow-md);
  border: none;
}

.card-interactive {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.card-interactive:hover {
  border-color: var(--color-neutral-300);
  box-shadow: var(--shadow-md);
}

/* Stat Card */

.stat-card {
  padding: var(--space-5);
}

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-icon.accent {
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
}

.stat-card-icon.secondary {
  background: var(--color-secondary-light);
  color: var(--color-secondary);
}

.stat-card-icon.success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.stat-card-icon.danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.stat-card-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.stat-card-value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: var(--leading-none);
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  margin-top: var(--space-2);
}

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

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

/* -----------------------------------------------------------------------------
   5. BUTTON COMPONENTS
   ----------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-family-base);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

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

/* Button Sizes */

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* Button Variants */

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--text-inverse);
  border-color: var(--color-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-secondary-dark);
  border-color: var(--color-secondary-dark);
}

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

.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--color-neutral-400);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--text-inverse);
  border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  border-color: #DC2626;
}

.btn-success {
  background: var(--color-success);
  color: var(--text-inverse);
  border-color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
}

/* Icon Button */

.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
  padding: var(--space-1);
}

.btn-icon.btn-lg {
  width: 44px;
  height: 44px;
}

/* Button Group */

.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.btn-group .btn:not(:last-child) {
  border-right: none;
}

/* -----------------------------------------------------------------------------
   6. FORM COMPONENTS
   ----------------------------------------------------------------------------- */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-label-optional {
  font-weight: var(--font-normal);
  color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-family-base);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-focus);
}

.form-input::placeholder {
  color: var(--text-muted);
}

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

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 3px var(--color-danger-light);
}

/* Input with icon */

.form-input-wrapper {
  position: relative;
}

.form-input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.form-input-wrapper .form-input {
  padding-left: var(--space-10);
}

/* Input with suffix */

.form-input-suffix {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.form-input-wrapper.has-suffix .form-input {
  padding-right: var(--space-12);
}

/* Textarea */

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Select */

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* Checkbox & Radio */

.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.form-check-input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

/* Form Help & Error Text */

.form-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* Form Row (for inline fields) */

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

/* -----------------------------------------------------------------------------
   7. TABLE COMPONENTS
   ----------------------------------------------------------------------------- */

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: var(--color-neutral-50);
  white-space: nowrap;
}

.table td {
  color: var(--text-primary);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Table Cell Alignments */

.table .text-right {
  text-align: right;
}

.table .text-center {
  text-align: center;
}

/* Table with Sticky Header */

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Sortable Table Header */

.table-sortable th {
  cursor: pointer;
  user-select: none;
}

.table-sortable th:hover {
  background: var(--color-neutral-100);
}

/* -----------------------------------------------------------------------------
   8. BADGE & TAG COMPONENTS
   ----------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-default {
  background: var(--color-neutral-100);
  color: var(--text-secondary);
}

.badge-primary {
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
}

.badge-secondary {
  background: var(--color-secondary-light);
  color: var(--color-secondary-dark);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-light);
  color: #B45309;
}

.badge-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* Tag (similar to badge but with border) */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-sm);
  background: var(--color-neutral-50);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.tag-remove:hover {
  background: var(--color-neutral-200);
}

/* -----------------------------------------------------------------------------
   9. AVATAR COMPONENT
   ----------------------------------------------------------------------------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-secondary-light);
  color: var(--color-secondary);
  font-weight: var(--font-semibold);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-xs { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-sm); }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-base); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-xl); }

/* Avatar Group */

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-surface);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* -----------------------------------------------------------------------------
   10. DROPDOWN & MENU COMPONENTS
   ----------------------------------------------------------------------------- */

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

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  margin-top: var(--space-1);
  padding: var(--space-2);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
}

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

.dropdown-menu-right {
  left: auto;
  right: 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.dropdown-item.active {
  background: var(--bg-active);
  color: var(--color-accent-dark);
}

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

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

.dropdown-divider {
  height: 1px;
  margin: var(--space-2) 0;
  background: var(--border-light);
}

.dropdown-header {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* -----------------------------------------------------------------------------
   11. MODAL COMPONENT
   ----------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

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

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 700px; }
.modal-xl { max-width: 900px; }

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
}

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

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  background: var(--color-neutral-50);
}

/* Export Format Selection */
.export-format-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.export-format-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.export-format-option:hover {
  border-color: var(--accent-dark);
  background: var(--color-neutral-50);
}

.export-format-option:has(input:checked) {
  border-color: var(--accent-dark);
  background: color-mix(in srgb, var(--accent-dark) 5%, transparent);
}

.export-format-option input[type="radio"] {
  margin: 0;
  accent-color: var(--accent-dark);
}

.export-format-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-format-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.export-format-option small {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding-left: 26px;
}

/* -----------------------------------------------------------------------------
   12. ALERT & NOTIFICATION COMPONENTS
   ----------------------------------------------------------------------------- */

.alert {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  gap: var(--space-3);
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.alert-message {
  font-size: var(--text-sm);
  margin: 0;
}

.alert-info {
  background: var(--color-info-light);
  border: 1px solid rgb(59, 130, 246, 0.3);
  color: #1E40AF;
}

.alert-success {
  background: var(--color-success-light);
  border: 1px solid rgb(16, 185, 129, 0.3);
  color: #065F46;
}

.alert-warning {
  background: var(--color-warning-light);
  border: 1px solid rgb(245, 158, 11, 0.3);
  color: #92400E;
}

.alert-danger {
  background: var(--color-danger-light);
  border: 1px solid rgb(239, 68, 68, 0.3);
  color: #991B1B;
}

/* Alert Banner */

.alert-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-warning-light);
  border: 1px solid rgb(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.alert-banner-icon {
  color: var(--color-warning);
  flex-shrink: 0;
}

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

.alert-banner-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #92400E;
}

.alert-banner-message {
  font-size: var(--text-sm);
  color: #B45309;
  margin: 0;
}

/* Toast Notification */

.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {

  from {
    transform: translateX(100%);
    opacity: 0;
  }

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

/* -----------------------------------------------------------------------------
   13. TABS COMPONENT
   ----------------------------------------------------------------------------- */

.tabs {
  display: flex;
  flex-direction: column;
}

.tabs-list {
  display: flex;
  border-bottom: 1px solid var(--border-default);
  gap: var(--space-1);
}

.tabs-trigger {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tabs-trigger:hover {
  color: var(--text-primary);
}

.tabs-trigger.active {
  color: var(--color-accent-dark);
  border-bottom-color: var(--color-accent);
}

.tabs-content {
  padding: var(--space-5) 0;
}

.tabs-panel {
  display: none;
}

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

/* Pills Variant */

.tabs-pills .tabs-list {
  border-bottom: none;
  background: var(--color-neutral-100);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  gap: var(--space-1);
}

.tabs-pills .tabs-trigger {
  border-bottom: none;
  border-radius: var(--radius-sm);
  margin-bottom: 0;
}

.tabs-pills .tabs-trigger.active {
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

/* -----------------------------------------------------------------------------
   14. PROGRESS & LOADING COMPONENTS
   ----------------------------------------------------------------------------- */

/* Progress Bar */

.progress {
  height: 8px;
  background: var(--color-neutral-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar.secondary {
  background: var(--color-secondary);
}

.progress-bar.success {
  background: var(--color-success);
}

.progress-bar.danger {
  background: var(--color-danger);
}

/* Spinner */

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

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 4px; }

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

/* Skeleton Loading */

.skeleton {
  background: linear-gradient(90deg, var(--color-neutral-200) 25%, var(--color-neutral-100) 50%, var(--color-neutral-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-text { height: 16px; margin-bottom: var(--space-2); }
.skeleton-title { height: 24px; width: 60%; margin-bottom: var(--space-3); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); }

/* -----------------------------------------------------------------------------
   15. TOOLTIP COMPONENT
   ----------------------------------------------------------------------------- */

.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-2);
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-primary);
}

.tooltip-wrapper:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* -----------------------------------------------------------------------------
   16. EMPTY STATE COMPONENT
   ----------------------------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--color-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.empty-state-icon-wrapper svg {
  width: 40px;
  height: 40px;
  color: var(--color-accent-dark);
}

.empty-state-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.empty-state-description {
  font-size: var(--text-base);
  color: var(--text-muted);
  max-width: 500px;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-2);
}

.empty-state-description:last-of-type {
  margin-bottom: var(--space-4);
}

.empty-state-description + .empty-state-list {
  margin-top: var(--space-1);
}

.empty-state-list {
  text-align: left;
  margin: 0 auto var(--space-5);
  padding-left: var(--space-5);
  max-width: 500px;
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  list-style-type: disc;
}

.empty-state-list li {
  margin-bottom: var(--space-1);
}

.empty-state .btn {
  margin-top: var(--space-2);
}

/* -----------------------------------------------------------------------------
   17. DASHBOARD SPECIFIC COMPONENTS
   ----------------------------------------------------------------------------- */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

@media (max-width: 1200px) {

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  position: relative;
  height: 300px;
}

.liquidity-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-lg);
  color: var(--text-inverse);
}

.liquidity-indicator-value {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  line-height: 1;
}

.liquidity-indicator-label {
  font-size: var(--text-sm);
  opacity: 0.8;
}

.liquidity-indicator-trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

.liquidity-indicator-trend.positive {
  color: var(--color-accent);
}

.liquidity-indicator-trend.negative {
  color: #FF6B6B;
}

/* Scenario comparison */

.scenario-comparison-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

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

.scenario-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.scenario-dot.real { background: var(--color-accent); }
.scenario-dot.best { background: var(--color-success); }
.scenario-dot.worst { background: var(--color-danger); }
.scenario-dot.custom { background: var(--color-secondary); }

/* Quick actions */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-neutral-50);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-action-btn:hover {
  background: var(--bg-surface);
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

.quick-action-btn svg {
  width: 24px;
  height: 24px;
}

/* Transactions list */

.transactions-list {
  display: flex;
  flex-direction: column;
}

.transaction-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

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

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.transaction-icon.income {
  background: var(--color-success-light);
  color: var(--color-success);
}

.transaction-icon.expense {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.transaction-details {
  flex: 1;
  min-width: 0;
}

.transaction-title {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.transaction-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.transaction-amount {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-align: right;
}

.transaction-amount.income {
  color: var(--color-success);
}

.transaction-amount.expense {
  color: var(--color-danger);
}

/* Forecast timeline */

.forecast-timeline {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-4);
}

.forecast-month {
  flex: 1;
  text-align: center;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  background: var(--color-neutral-100);
}

.forecast-month.positive {
  background: var(--color-success-light);
  color: var(--color-success);
}

.forecast-month.warning {
  background: var(--color-warning-light);
  color: #92400E;
}

.forecast-month.negative {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* -----------------------------------------------------------------------------
   18. ACCOUNT CARDS
   ----------------------------------------------------------------------------- */

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.account-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}

.account-card:hover {
  border-color: var(--color-neutral-300);
  box-shadow: var(--shadow-md);
}

.account-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.account-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
}

.account-card-info {
  flex: 1;
}

.account-card-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.account-card-type {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.account-card-balance {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.account-card-add {
  border: 2px dashed var(--border-default);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  cursor: pointer;
}

.account-card-add:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.account-card-add-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  color: var(--text-muted);
}

.account-card-add:hover .account-card-add-icon {
  background: var(--color-accent);
  color: var(--color-primary);
}

.account-card-add-text {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
}

.account-card-add:hover .account-card-add-text {
  color: var(--color-accent-dark);
}

/* -----------------------------------------------------------------------------
   19. TENANT SELECTOR (Sidebar)
   ----------------------------------------------------------------------------- */

.tenant-selector {
  padding: var(--space-4) var(--space-3);
  border-bottom: 1px solid rgb(255, 255, 255, 0.08);
}

.tenant-current {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: rgb(255, 255, 255, 0.05);
  border: 1px solid rgb(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-inverse);
}

.tenant-current:hover {
  background: rgb(255, 255, 255, 0.08);
  border-color: rgb(110, 231, 255, 0.3);
}

.tenant-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.tenant-info {
  flex: 1;
  min-width: 0;
}

.tenant-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-inverse);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenant-role {
  font-size: var(--text-xs);
  color: rgb(255, 255, 255, 0.5);
}

.tenant-arrow {
  color: rgb(255, 255, 255, 0.4);
  transition: transform var(--transition-fast);
}

.tenant-current.open .tenant-arrow {
  transform: rotate(180deg);
}

/* -----------------------------------------------------------------------------
   20. RESPONSIVE UTILITIES
   ----------------------------------------------------------------------------- */

/* Mobile breakpoint: 640px */

/* Tablet breakpoint: 768px */

/* Desktop breakpoint: 1024px */

/* Large Desktop: 1280px */

@media (max-width: 1024px) {

  :root {
    --sidebar-width: 72px;
  }

  .sidebar {
    width: var(--sidebar-width);
  }

  .sidebar-logo-text,
  .nav-section-title,
  .nav-item-text {
    opacity: 0;
    pointer-events: none;
  }

  .main-wrapper {
    margin-left: var(--sidebar-width);
  }
}

@media (max-width: 768px) {

  :root {
    --container-padding: var(--space-4);
    --header-height: 56px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    width: 280px;
  }

  .sidebar.mobile-open .sidebar-logo-text,
  .sidebar.mobile-open .nav-section-title,
  .sidebar.mobile-open .nav-item-text {
    opacity: 1;
    pointer-events: auto;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .page-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    width: 100%;
    justify-content: stretch;
  }

  .page-actions .btn {
    flex: 1;
  }

  .modal {
    width: calc(100% - var(--space-8));
    max-height: calc(100vh - var(--space-8));
  }
}

/* Utility: Hide on mobile */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

/* Utility: Show only on mobile */
@media (min-width: 769px) {
  .show-mobile-only { display: none !important; }
}

/* -----------------------------------------------------------------------------
   21. UTILITY CLASSES
   ----------------------------------------------------------------------------- */

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.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; }
.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

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

@media (max-width: 640px) {

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 { grid-template-columns: 1fr; }
}

/* Spacing */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }

/* Text */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--color-accent-dark); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Borders */
.border { border: 1px solid var(--border-default); }
.border-t { border-top: 1px solid var(--border-default); }
.border-b { border-bottom: 1px solid var(--border-default); }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Backgrounds */
.bg-surface { background: var(--bg-surface); }
.bg-page { background: var(--bg-page); }
.bg-accent-light { background: var(--color-accent-light); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Visibility */
.hidden { display: none; }
.invisible { visibility: hidden; }
.visible { visibility: visible; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Width & Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Divider */

.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-4) 0;
}

/* Screen Reader Only */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
