/* ==========================================================================
   ClipFlow V2 — Design System
   Minimalista / Supabase-inspired / White Theme
   Criado: 2026-04-16
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS / CSS VARIABLES
   -------------------------------------------------------------------------- */
:root {
  /* Brand Colors - Emerald (aligned with V1 accent) */
  --brand-50: #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;
  --brand-900: #064e3b;

  /* Accent - Emerald (success/CTA) */
  --accent-50: #ecfdf5;
  --accent-100: #d1fae5;
  --accent-200: #a7f3d0;
  --accent-300: #6ee7b7;
  --accent-400: #34d399;
  --accent-500: #10b981;
  --accent-600: #059669;
  --accent-700: #047857;
  --accent-800: #065f46;
  --accent-900: #064e3b;

  /* Neutral Scale - Cool Gray */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic Colors */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-200: #bbf7d0;
  --success-300: #86efac;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;
  
  --warning-50: #fffbeb;
  --warning-200: #fde68a;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;
  
  --error-50: #fef2f2;
  --error-200: #fecaca;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --error-700: #b91c1c;
  
  --info-50: #eff6ff;
  --info-200: #bfdbfe;
  --info-500: #3b82f6;
  --info-600: #2563eb;

  /* Surfaces - White Theme */
  --bg-primary: #ffffff;
  --bg-secondary: var(--gray-50);
  --bg-tertiary: var(--gray-100);
  --surface: #ffffff;
  --surface-elevated: #ffffff;

  /* Text */
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-tertiary: var(--gray-500);
  --text-muted: var(--gray-400);
  --text-inverse: #ffffff;

  /* Borders */
  --border-subtle: var(--gray-200);
  --border-default: var(--gray-300);
  --border-strong: var(--gray-400);

  /* Shadows - Minimal/Flat (Supabase style) */
  --shadow-none: none;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Focus Ring */
  --ring-offset: 2px;
  --ring-color: var(--brand-500);
  --ring-width: 2px;
  --ring: 0 0 0 var(--ring-offset) var(--bg-primary), 0 0 0 calc(var(--ring-offset) + var(--ring-width)) var(--ring-color);

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
  
  /* Font Sizes - 4px base grid */
  --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 */

  /* 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;
  --leading-loose: 2;

  /* Spacing - 4px base */
  --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 */

  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.375rem;  /* 6px */
  --radius-lg: 0.5rem;    /* 8px */
  --radius-xl: 0.75rem;   /* 12px */
  --radius-2xl: 1rem;     /* 16px */
  --radius-full: 9999px;

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

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

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

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

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-700);
}

/* Lists */
ul, ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
}

/* Code */
code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--gray-100);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  color: var(--gray-800);
}

pre {
  background: var(--gray-900);
  color: var(--gray-100);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Focus States */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Selection */
::selection {
  background: var(--brand-100);
  color: var(--brand-900);
}

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

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  width: 240px;
  overflow-y: auto;
  padding: var(--space-4) var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: var(--space-1) var(--space-2);
}

.sidebar__brand-logo {
  width: 28px;
  height: 28px;
  background: var(--brand-600);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: var(--font-bold);
  flex-shrink: 0;
}

.sidebar__brand-text {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar__footer {
  margin-top: auto;
  padding: var(--space-3) var(--space-2) var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

/* Main Content */
.main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  padding: var(--space-6) var(--space-6) var(--space-8);
  background: var(--bg-primary);
}

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

.main__header {
  padding: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.main__content {
  padding: var(--space-8);
  max-width: 1400px;
}

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

.container--narrow {
  max-width: 960px;
}

.container--wide {
  max-width: 1600px;
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

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

@media (max-width: 991px) {
  .main {
    margin-left: 0;
  }
}

/* Flex Utilities */
.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; }
.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); }

/* --------------------------------------------------------------------------
   4. NAVIGATION
   -------------------------------------------------------------------------- */
.nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav__section {
  margin-bottom: var(--space-3);
}

.nav__section-title {
  font-size: 0.5625rem;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: var(--space-1) var(--space-3);
  margin-bottom: var(--space-1);
}

.nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: var(--font-normal);
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.nav__link:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.nav__link--active {
  background: var(--brand-50);
  color: var(--brand-700);
}

.nav__link--active:hover {
  background: var(--brand-100);
}

.nav__link-icon {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  flex-shrink: 0;
}

.nav__link--active .nav__link-icon {
  opacity: 1;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.breadcrumb__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb__item a {
  color: var(--text-secondary);
}

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

.breadcrumb__separator {
  opacity: 0.4;
}

.breadcrumb__item--current {
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

/* --------------------------------------------------------------------------
   5. CARDS
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--border-default);
}

.card--interactive:hover {
  border-color: var(--brand-300);
}

.card__header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

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

.card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  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-subtle);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Card Variants */
.card--flat {
  border: none;
  box-shadow: none;
}

.card--outlined {
  border: 1px solid var(--border-default);
}

.card--compact {
  border-radius: var(--radius-lg);
}

.card--compact .card__header,
.card--compact .card__body {
  padding: var(--space-4);
}

/* Stat Card */
.stat-card {
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
}

.stat-card__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

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

.stat-card__change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
}

.stat-card__change--positive {
  color: var(--success-600);
  background: var(--success-50);
}

.stat-card__change--negative {
  color: var(--error-600);
  background: var(--error-50);
}

/* --------------------------------------------------------------------------
   6. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-tight);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

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

/* Button Variants */
.btn--primary {
  background: var(--brand-600);
  color: white;
  border-color: var(--brand-600);
}

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

.btn--secondary {
  background: white;
  color: var(--text-primary);
  border-color: var(--border-default);
}

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

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

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

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

.btn--danger:hover:not(:disabled) {
  background: var(--error-700);
  border-color: var(--error-700);
}

/* Button Sizes */
.btn--sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn--md {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

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

/* Button Width */
.btn--block {
  width: 100%;
}

/* Button with Icon */
.btn__icon {
  width: 16px;
  height: 16px;
}

.btn--lg .btn__icon {
  width: 20px;
  height: 20px;
}

/* Icon Button */
.btn--icon {
  padding: var(--space-2);
}

.btn--icon.btn--sm {
  padding: var(--space-1);
}

/* --------------------------------------------------------------------------
   7. FORMS
   -------------------------------------------------------------------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

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

.form__label--required::after {
  content: "*";
  color: var(--error-500);
  margin-left: var(--space-1);
}

.form__hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.form__error {
  font-size: var(--text-xs);
  color: var(--error-600);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Input Base */
.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: white;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.form__input::placeholder,
.form__textarea::placeholder {
  color: var(--text-muted);
}

.form__input:hover,
.form__select:hover,
.form__textarea:hover {
  border-color: var(--border-strong);
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.form__input:disabled,
.form__select:disabled,
.form__textarea:disabled {
  background: var(--gray-100);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

/* Input States */
.form__input--error,
.form__select--error,
.form__textarea--error {
  border-color: var(--error-500);
}

.form__input--error:focus,
.form__select--error:focus,
.form__textarea--error:focus {
  border-color: var(--error-500);
  box-shadow: 0 0 0 3px var(--error-50);
}

/* Select */
.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Textarea */
.form__textarea {
  min-height: 100px;
  resize: vertical;
}

/* Checkbox & Radio */
.form__checkbox,
.form__radio {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.form__checkbox input,
.form__radio input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-600);
  cursor: pointer;
}

/* Input Sizes */
.form__input--sm,
.form__select--sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.form__input--lg,
.form__select--lg {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
}

/* Input Groups */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group__prepend,
.input-group__append {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--gray-100);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.input-group__prepend {
  border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.input-group__append {
  border-left: none;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.input-group .form__input {
  border-radius: 0;
}

.input-group .form__input:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.input-group .form__input:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* --------------------------------------------------------------------------
   8. TABLES
   -------------------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

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

.table thead {
  background: var(--bg-secondary);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

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

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

/* Table Variants */
.table--compact th,
.table--compact td {
  padding: var(--space-3) var(--space-4);
}

.table--striped tbody tr:nth-child(even) {
  background: var(--gray-50);
}

/* Table Cell Types */
.table__cell--numeric {
  text-align: right;
  font-family: var(--font-mono);
}

.table__cell--actions {
  text-align: right;
  white-space: nowrap;
}

.table__cell--status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Empty State */
.table__empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}

.table__empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  opacity: 0.3;
}

/* --------------------------------------------------------------------------
   9. BADGES & STATUS
   -------------------------------------------------------------------------- */
.badge {
  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-full);
  white-space: nowrap;
}

.badge--brand {
  background: var(--brand-100);
  color: var(--brand-800);
}

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

.badge--warning {
  background: var(--warning-50);
  color: var(--warning-600);
}

.badge--error {
  background: var(--error-50);
  color: var(--error-600);
}

.badge--info {
  background: var(--info-50);
  color: var(--info-600);
}

.badge--neutral {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Status Dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.status-dot--success { background: var(--success-500); }
.status-dot--warning { background: var(--warning-500); }
.status-dot--error { background: var(--error-500); }
.status-dot--info { background: var(--info-500); }
.status-dot--neutral { background: var(--gray-400); }

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  background: var(--gray-100);
  color: var(--gray-700);
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

.status-pill--success { background: var(--success-50); color: var(--success-600); }
.status-pill--warning { background: var(--warning-50); color: var(--warning-600); }
.status-pill--error { background: var(--error-50); color: var(--error-600); }

/* --------------------------------------------------------------------------
   10. ALERTS & BANNERS
   -------------------------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}

.alert__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.alert__content {
  flex: 1;
  min-width: 0;
}

.alert__title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

.alert__message {
  color: var(--text-secondary);
}

/* Alert Variants */
.alert--success {
  background: var(--success-50);
  border: 1px solid var(--success-100);
}

.alert--success .alert__icon {
  color: var(--success-600);
}

.alert--warning {
  background: var(--warning-50);
  border: 1px solid var(--warning-100);
}

.alert--warning .alert__icon {
  color: var(--warning-600);
}

.alert--error {
  background: var(--error-50);
  border: 1px solid var(--error-100);
}

.alert--error .alert__icon {
  color: var(--error-600);
}

.alert--info {
  background: var(--info-50);
  border: 1px solid var(--info-100);
}

.alert--info .alert__icon {
  color: var(--info-600);
}

/* Notice Banner */
.notice-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

.notice-banner--success {
  background: var(--success-50);
  color: var(--success-700);
  border: 1px solid var(--success-200);
}

.notice-banner--warning {
  background: var(--warning-50);
  color: var(--warning-700);
  border: 1px solid var(--warning-200);
}

.notice-banner--error {
  background: var(--error-50);
  color: var(--error-700);
  border: 1px solid var(--error-200);
}

/* --------------------------------------------------------------------------
   11. TABS
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
}

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

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

.tab--active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-600);
}

/* Pill Tabs */
.tabs--pills {
  gap: var(--space-2);
  border-bottom: none;
  padding: var(--space-1);
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  width: fit-content;
}

.tabs--pills .tab {
  padding: var(--space-2) var(--space-4);
  border-bottom: none;
  border-radius: var(--radius-md);
  margin-bottom: 0;
}

.tabs--pills .tab--active {
  background: white;
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* --------------------------------------------------------------------------
   12. DROPDOWNS & MENUS
   -------------------------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-2);
  min-width: 200px;
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.dropdown__item--danger {
  color: var(--error-600);
}

.dropdown__item--danger:hover {
  background: var(--error-50);
}

.dropdown__divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-2) 0;
}

/* --------------------------------------------------------------------------
   13. MODALS
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal {
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  max-height: calc(100vh - var(--space-12));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal--lg {
  max-width: 700px;
}

.modal--xl {
  max-width: 900px;
}

.modal__header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin: 0;
}

.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--gray-100);
  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-subtle);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* --------------------------------------------------------------------------
   14. LOADERS & EMPTY STATES
   -------------------------------------------------------------------------- */
/* Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 25%,
    var(--gray-100) 50%,
    var(--gray-200) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

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

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--brand-600);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state__description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto var(--space-6);
}

/* --------------------------------------------------------------------------
   15. UTILITIES
   -------------------------------------------------------------------------- */
/* Text */
.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-tertiary { color: var(--text-tertiary); }
.text-muted { color: var(--text-muted); }
.text-brand { color: var(--brand-600); }
.text-success { color: var(--success-600); }
.text-warning { color: var(--warning-600); }
.text-error { color: var(--error-600); }

/* Font */
.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); }

/* Spacing */
.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Display */
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.hidden { display: none; }

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

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

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

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

/* --------------------------------------------------------------------------
   16. RESPONSIVE UTILITIES
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  
  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }
  
  .main__content {
    padding: var(--space-4);
  }
  
  .card__header,
  .card__body {
    padding: var(--space-4);
  }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* --------------------------------------------------------------------------
   17. ANIMATIONS
   -------------------------------------------------------------------------- */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in var(--transition-base);
}

.animate-slide-up {
  animation: slide-up var(--transition-base);
}

.animate-slide-down {
  animation: slide-down var(--transition-base);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .skeleton {
    animation: none;
    background: var(--gray-200);
  }
}

/* --------------------------------------------------------------------------
   18. MOBILE RESPONSIVE (Epic 35)
   -------------------------------------------------------------------------- */

/* Mobile-first container */
.container {
  width: 100%;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 576px) {
  .container { max-width: 540px; }
}

@media (min-width: 768px) {
  .container { max-width: 720px; }
}

@media (min-width: 992px) {
  .container { max-width: 960px; }
}

@media (min-width: 1200px) {
  .container { max-width: 1140px; }
}

/* Responsive grid */
.grid--responsive {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .grid--responsive {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .grid--responsive {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Responsive tables - convert to cards on mobile */
@media (max-width: 768px) {
  .table--responsive {
    display: block;
  }
  
  .table--responsive thead {
    display: none;
  }
  
  .table--responsive tbody,
  .table--responsive tr {
    display: block;
  }
  
  .table--responsive td {
    display: flex;
    justify-content: space-between;
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
  }
  
  .table--responsive td::before {
    content: attr(data-label);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
  }
}

/* Mobile navigation */
.mobile-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 992px) {
  .mobile-nav {
    display: none;
  }
}

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.sidebar-overlay--visible {
  display: block;
}

/* Hamburger button */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform 0.3s, opacity 0.3s;
}

@media (min-width: 992px) {
  .hamburger {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   19. ACCESSIBILITY (Epic 36 - WCAG AAA)
   -------------------------------------------------------------------------- */

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--surface);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-4);
  z-index: 10000;
  transition: top 0.3s;
  text-decoration: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  top: var(--space-2);
  left: var(--space-2);
}

/* Focus visible - clear focus ring */
:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 2px;
}

/* Remove focus outline on click, keep on keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn {
    border: 2px solid currentColor;
  }
  
  .card {
    border: 2px solid var(--border-default);
  }
  
  :focus-visible {
    outline: 4px solid CanvasText;
    outline-offset: 2px;
  }
}

/* Screen reader only text */
.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;
}

/* Live regions for announcements */
[aria-live="polite"],
[aria-live="assertive"] {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Touch target size (44px minimum for AAA) */
@media (pointer: coarse) {
  .btn,
  .nav__link,
  .form__input,
  .form__select,
  .form__textarea,
  .form__checkbox,
  .form__radio {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Prevent zoom on iOS */
  .form__input,
  .form__select,
  .form__textarea {
    font-size: 16px;
  }
}

/* ARIA current page indicator */
[aria-current="page"] {
  font-weight: var(--font-semibold);
  color: var(--brand-600);
}

/* Disabled state with better contrast */
[disabled],
[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error states */
[aria-invalid="true"] {
  border-color: var(--error-500);
  box-shadow: 0 0 0 3px var(--error-100);
}

/* --------------------------------------------------------------------------
   20. MOBILE UTILITY CLASSES
   -------------------------------------------------------------------------- */

/* Stack elements on mobile */
@media (max-width: 768px) {
  .flex--mobile-stack {
    flex-direction: column;
  }
  
  .flex--mobile-stack > * {
    width: 100%;
  }
  
  /* Full width buttons on mobile */
  .btn--mobile-block {
    width: 100%;
    justify-content: center;
  }
  
  /* Reduce padding on mobile */
  .p-mobile-0 { padding: 0; }
  .p-mobile-2 { padding: var(--space-2); }
  .p-mobile-4 { padding: var(--space-4); }
  
  /* Smaller text on mobile */
  .text-mobile-sm { font-size: var(--text-sm); }
  .text-mobile-xs { font-size: var(--text-xs); }
}

/* Mobile-only and Desktop-only visibility */
.mobile-only {
  display: block;
}

.desktop-only {
  display: none;
}

@media (min-width: 992px) {
  .mobile-only {
    display: none;
  }
  
  .desktop-only {
    display: block;
  }
}

/* Mobile navigation bar */
.mobile-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  min-width: 64px;
  transition: color 0.2s, background 0.2s;
}

.mobile-nav__link:hover,
.mobile-nav__link:focus {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.mobile-nav__link--active {
  color: var(--brand-600);
}

.mobile-nav__icon {
  width: 24px;
  height: 24px;
}

.mobile-nav__label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

/* Sidebar mobile styles */
@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 80vw;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-xl);
  }
  
  .sidebar--open {
    transform: translateX(0);
  }
  
  /* Hamburger button */
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    gap: 5px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 1001;
    box-shadow: var(--shadow-md);
  }
  
  .hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    transition: transform 0.3s, opacity 0.3s;
    border-radius: 1px;
  }
  
  .hamburger[aria-expanded="true"] span:first-child {
    transform: translateY(7px) rotate(45deg);
  }
  
  .hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger[aria-expanded="true"] span:last-child {
    transform: translateY(-7px) rotate(-45deg);
  }
  
  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
  }
  
  .sidebar-overlay--visible {
    display: block;
  }
  
  /* Adjust main content for hamburger */
  .main {
    padding-top: calc(var(--space-4) + 60px);
  }
  
  /* Hide desktop nav items */
  .nav__section:first-child {
    margin-top: var(--space-12);
  }
}

@media (min-width: 992px) {
  .hamburger {
    display: none;
  }
  
  .sidebar-overlay {
    display: none !important;
  }
  
  .mobile-nav {
    display: none;
  }
}

/* Body scroll lock when sidebar open */
body:has(.sidebar--open) {
  overflow: hidden;
}

/* ==========================================================================
   END OF CLIP-V2.CSS
   ========================================================================== */
