/* ==========================================================================
   KEYSTONE NORTH INSURANCE — ENTERPRISE DESIGN SYSTEM
   Reset & Base Styles
   ========================================================================== */

/* CSS Custom Properties imported from design-system.md */
:root {
  /* Colors - Light */
  --color-primary: #0F172A;
  --color-on-primary: #FFFFFF;
  --color-secondary: #334155;
  --color-accent: #0369A1;
  --color-accent-hover: #0284C7;
  --color-accent-light: #E0F2FE;
  --color-background: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-foreground: #020617;
  --color-muted: #E8ECF1;
  --color-border: #E2E8F0;
  --color-ring: #0F172A;
  --color-destructive: #DC2626;
  --color-success: #059669;
  --color-warning: #D97706;
  --color-muted-foreground: #64748B;

  /* Typography */
  --font-display: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  --text-display: clamp(2.5rem, 5vw, 4.5rem);
  --text-h1: clamp(2rem, 4vw, 3.5rem);
  --text-h2: clamp(1.5rem, 3vw, 2.5rem);
  --text-h3: clamp(1.25rem, 2vw, 1.75rem);
  --text-h4: clamp(1.125rem, 1.5vw, 1.375rem);
  --text-body-lg: clamp(1.125rem, 1.25vw, 1.25rem);
  --text-body: clamp(1rem, 1vw, 1.125rem);
  --text-body-sm: clamp(0.875rem, 0.9vw, 1rem);
  --text-caption: clamp(0.75rem, 0.8vw, 0.875rem);
  --text-micro: 0.6875rem;

  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

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

  /* Shadows */
  --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);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-brand: 0 10px 40px -10px rgb(15 23 42 / 0.3);
  --shadow-brand-lg: 0 20px 60px -15px rgb(15 23 42 / 0.4);

  /* Transitions */
  --transition-fast: 100ms ease-out;
  --transition-base: 150ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 300ms ease-out;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Breakpoints */
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1536px;

  /* Z-Index */
  --z-base: 0;
  --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;

  /* Component Tokens */
  --btn-height: 44px;
  --btn-height-sm: 36px;
  --btn-height-lg: 52px;
  --btn-padding-x: 1.5rem;
  --btn-padding-x-sm: 1rem;
  --btn-padding-x-lg: 2rem;
  --btn-radius: 0.5rem;
  --btn-font-weight: 600;
  --btn-transition: 150ms ease-out;

  --input-height: 44px;
  --input-height-sm: 36px;
  --input-padding-x: 1rem;
  --input-padding-y: 0.75rem;
  --input-radius: 0.5rem;
  --input-border-width: 1px;
  --input-transition: 100ms ease-out;

  --card-padding: 1.5rem;
  --card-radius: 0.75rem;
  --card-border: 1px solid var(--color-border);
  --card-shadow: var(--shadow-sm);
  --card-hover-shadow: var(--shadow-md);

  --container-max: 80rem;
  --container-padding: 1.5rem;
  --container-padding-lg: 2rem;
}

/* Dark Mode */
[data-theme="dark"] {
  --color-primary: #F8FAFC;
  --color-on-primary: #0F172A;
  --color-secondary: #94A3B8;
  --color-accent: #38BDF8;
  --color-accent-hover: #0EA5E9;
  --color-accent-light: #1E3A5F;
  --color-background: #050505;
  --color-surface: #0A0A0A;
  --color-foreground: #F8FAFC;
  --color-muted: #1E293B;
  --color-border: #1E293B;
  --color-ring: #38BDF8;
  --color-destructive: #EF4444;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-muted-foreground: #94A3B8;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--color-foreground);
  background-color: var(--color-background);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  vertical-align: middle;
}

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

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

a:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-lg);
  transition: top var(--transition-fast);
}

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

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-foreground);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-display); }
h2 { font-size: var(--text-h1); }
h3 { font-size: var(--text-h2); }
h4 { font-size: var(--text-h3); }
h5 { font-size: var(--text-h3); }
h6 { font-size: var(--text-h4); }

p {
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
  color: var(--color-foreground);
}

.text-lg { font-size: var(--text-body-lg); }
.text-sm { font-size: var(--text-body-sm); }
.text-caption { font-size: var(--text-caption); }
.text-micro { font-size: var(--text-micro); }

.text-muted { color: var(--color-muted-foreground); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.leading-tight { line-height: var(--leading-tight); }
.leading-snug { line-height: var(--leading-snug); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

.text-gradient {
  background: linear-gradient(135deg, var(--color-accent), var(--color-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-balance {
  text-wrap: balance;
}

/* ==========================================================================
   LAYOUT UTILITIES
   ========================================================================== */

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

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--container-padding-lg);
  }
}

.section {
  padding: var(--space-16) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-20) 0;
  }
}

.section-sm {
  padding: var(--space-10) 0;
}

@media (min-width: 768px) {
  .section-sm {
    padding: var(--space-12) 0;
  }
}

.section-lg {
  padding: var(--space-24) 0;
}

@media (min-width: 768px) {
  .section-lg {
    padding: var(--space-32) 0;
  }
}

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

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.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: 767px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* 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; }
.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); }
.gap-10 { gap: var(--space-10); }

/* Spacing */
.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }
.mt-16 { margin-top: var(--space-16); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }

/* ==========================================================================
   COMPONENTS — BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--btn-height);
  padding: 0 var(--btn-padding-x);
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: var(--btn-font-weight);
  line-height: 1;
  border-radius: var(--btn-radius);
  border: none;
  cursor: pointer;
  transition: all var(--btn-transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

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

.btn-sm {
  height: var(--btn-height-sm);
  padding: 0 var(--btn-padding-x-sm);
  font-size: var(--text-caption);
}

.btn-lg {
  height: var(--btn-height-lg);
  padding: 0 var(--btn-padding-x-lg);
  font-size: var(--text-body);
}

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

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

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
}

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

.btn-ghost {
  background-color: transparent;
  color: var(--color-foreground);
  border: 1px solid transparent;
}

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

.btn-outline {
  background-color: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--color-accent-light);
}

.btn-destructive {
  background-color: var(--color-destructive);
  color: var(--color-on-primary);
}

.btn-destructive:hover:not(:disabled) {
  background-color: #B91C1C;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--btn-height);
  height: var(--btn-height);
  padding: 0;
  border-radius: var(--btn-radius);
}

.btn-icon-sm {
  width: var(--btn-height-sm);
  height: var(--btn-height-sm);
}

.btn-icon-lg {
  width: var(--btn-height-lg);
  height: var(--btn-height-lg);
}

.btn-full {
  width: 100%;
}

.btn-group {
  display: inline-flex;
  gap: var(--space-2);
}

@media (max-width: 480px) {
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  .btn-group .btn {
    width: 100%;
  }
}

/* ==========================================================================
   COMPONENTS — INPUTS & FORMS
   ========================================================================== */

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

.form-label {
  font-size: var(--text-body-sm);
  font-weight: var(--weight-medium);
  color: var(--color-foreground);
}

.form-label .required::after {
  content: " *";
  color: var(--color-destructive);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input {
  width: 100%;
  height: var(--input-height);
  padding: var(--input-padding-y) var(--input-padding-x);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  color: var(--color-foreground);
  background-color: var(--color-surface);
  border: var(--input-border-width) solid var(--color-border);
  border-radius: var(--input-radius);
  transition: all var(--input-transition);
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--color-muted-foreground);
  opacity: 1;
}

.input:hover:not(:disabled):not(:read-only) {
  border-color: var(--color-secondary);
}

.input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.input:disabled,
.input[readonly] {
  background-color: var(--color-muted);
  color: var(--color-muted-foreground);
  cursor: not-allowed;
}

.input:invalid:not(:placeholder-shown) {
  border-color: var(--color-destructive);
}

.input-error {
  border-color: var(--color-destructive) !important;
}

.input-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

.input-icon {
  position: absolute;
  left: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted-foreground);
  pointer-events: none;
}

.input-icon + .input {
  padding-left: calc(var(--input-padding-x) + 1.5rem + var(--space-2));
}

.input-icon-right {
  position: absolute;
  right: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted-foreground);
  pointer-events: none;
}

.input-icon-right + .input {
  padding-right: calc(var(--input-padding-x) + 1.5rem + var(--space-2));
}

.input-sm {
  height: var(--input-height-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-body-sm);
}

.input-lg {
  height: 52px;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-body-lg);
}

textarea.input {
  min-height: 120px;
  height: auto;
  resize: vertical;
  padding-top: var(--input-padding-y);
  padding-bottom: var(--input-padding-y);
  line-height: var(--leading-relaxed);
}

select.input {
  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='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px;
  padding-right: calc(var(--input-padding-x) + 1.5rem);
}

.form-error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-caption);
  color: var(--color-destructive);
}

.form-hint {
  font-size: var(--text-caption);
  color: var(--color-muted-foreground);
}

.checkbox-wrapper,
.radio-wrapper {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.checkbox,
.radio {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.checkbox-label,
.radio-label {
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
  color: var(--color-foreground);
  cursor: pointer;
}

/* ==========================================================================
   COMPONENTS — CARDS
   ========================================================================== */

.card {
  background: var(--color-surface);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: var(--card-padding);
  transition: all var(--transition-normal);
}

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

.card-header {
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-h3);
  font-weight: var(--weight-bold);
  color: var(--color-foreground);
}

.card-description {
  font-size: var(--text-body);
  color: var(--color-muted-foreground);
  margin-top: var(--space-2);
}

.card-content {
  margin-top: var(--space-4);
}

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

.card-elevated {
  box-shadow: var(--shadow-lg);
}

.card-elevated:hover {
  box-shadow: var(--shadow-xl);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-2px);
}

.card-interactive:active {
  transform: translateY(0);
}

/* ==========================================================================
   COMPONENTS — BADGES & TAGS
   ========================================================================== */

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

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

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

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

.badge-destructive {
  background: #FEF2F2;
  color: var(--color-destructive);
}

.badge-neutral {
  background: var(--color-muted);
  color: var(--color-muted-foreground);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted-foreground);
}

/* ==========================================================================
   COMPONENTS — ALERTS
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-xl);
  border: 1px solid;
}

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

.alert-content {
  flex: 1;
  min-width: 0;
}

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

.alert-description {
  font-size: var(--text-body-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-muted-foreground);
}

.alert-dismiss {
  flex-shrink: 0;
  padding: var(--space-1);
  color: inherit;
  opacity: 0.6;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.alert-dismiss:hover {
  opacity: 1;
  background: var(--color-muted);
}

.alert-info {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.alert-success {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
}

.alert-warning {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}

.alert-destructive {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B;
}

/* ==========================================================================
   COMPONENTS — TABLE
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
}

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

.table thead {
  background: var(--color-muted);
}

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

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

.table tbody tr {
  transition: background var(--transition-fast);
}

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

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

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

/* ==========================================================================
   COMPONENTS — DROPDOWN / SELECT MENU
   ========================================================================== */

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

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-body-sm);
  font-weight: var(--weight-medium);
  color: var(--color-foreground);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-trigger:hover {
  border-color: var(--color-secondary);
}

.dropdown-trigger:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px;
  max-width: 320px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-base);
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-body-sm);
  color: var(--color-foreground);
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

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

.dropdown-item:focus {
  outline: none;
  background: var(--color-muted);
}

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

/* ==========================================================================
   COMPONENTS — TABS
   ========================================================================== */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-6);
}

.tab-list {
  display: flex;
  gap: var(--space-1);
}

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

.tab-trigger:hover {
  color: var(--color-foreground);
}

.tab-trigger[data-state="active"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.tab-trigger:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: -2px;
  border-radius: var(--radius-md);
}

.tab-content {
  animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   COMPONENTS — MODAL / DIALOG
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(8px);
  transition: all var(--transition-normal);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: var(--text-h3);
  font-weight: var(--weight-bold);
}

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

.modal-close:hover {
  background: var(--color-muted);
  color: var(--color-foreground);
}

.modal-body {
  padding: var(--space-6);
  max-height: 50vh;
  overflow-y: auto;
}

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

/* ==========================================================================
   COMPONENTS — TOAST
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 360px;
  pointer-events: auto;
  animation: slideIn var(--transition-normal);
}

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

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

.toast-content {
  flex: 1;
  min-width: 0;
}

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

.toast-message {
  font-size: var(--text-body-sm);
  color: var(--color-muted-foreground);
  line-height: var(--leading-relaxed);
}

.toast-close {
  flex-shrink: 0;
  padding: var(--space-1);
  color: var(--color-muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: var(--color-muted);
  color: var(--color-foreground);
}

.toast-info { border-left: 4px solid var(--color-accent); }
.toast-success { border-left: 4px solid var(--color-success); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-destructive { border-left: 4px solid var(--color-destructive); }

/* ==========================================================================
   COMPONENTS — SKELETON LOADERS
   ========================================================================== */

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

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

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
  margin-bottom: 0;
}

.skeleton-title {
  height: 1.5rem;
  width: 40%;
  margin-bottom: var(--space-4);
}

.skeleton-card {
  height: 200px;
  border-radius: var(--card-radius);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

.skeleton-button {
  height: var(--btn-height);
  width: 120px;
  border-radius: var(--btn-radius);
}

/* ==========================================================================
   LAYOUT — HEADER / NAVIGATION
   ========================================================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background: rgba(248, 250, 252, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .header {
  background: rgba(5, 5, 5, 0.9);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

@media (min-width: 1024px) {
  .header-inner {
    padding: 0 var(--container-padding-lg);
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-h4);
  font-weight: var(--weight-bold);
  color: var(--color-foreground);
  text-decoration: none;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-secondary));
  border-radius: var(--radius-full);
  color: white;
  font-family: var(--font-display);
  font-size: var(--text-body-sm);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}

.nav {
  display: none;
  align-items: center;
  gap: var(--space-8);
}

@media (min-width: 768px) {
  .nav {
    display: flex;
  }
}

.nav-link {
  font-size: var(--text-body-sm);
  font-weight: var(--weight-medium);
  color: var(--color-muted-foreground);
  text-decoration: none;
  transition: color var(--transition-fast);
  padding: var(--space-2) 0;
}

.nav-link:hover {
  color: var(--color-foreground);
}

.nav-link.active {
  color: var(--color-accent);
}

.nav-cta {
  display: none;
}

@media (min-width: 768px) {
  .nav-cta {
    display: inline-flex;
  }
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: transparent;
  border: none;
  color: var(--color-foreground);
  cursor: pointer;
  transition: background var(--transition-fast);
}

@media (min-width: 768px) {
  .mobile-menu-btn {
    display: none;
  }
}

.mobile-menu-btn:hover {
  background: var(--color-muted);
}

.mobile-menu {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-fixed);
  background: var(--color-surface);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu-link {
  display: block;
  padding: var(--space-4) 0;
  font-size: var(--text-body-lg);
  font-weight: var(--weight-medium);
  color: var(--color-foreground);
  border-bottom: 1px solid var(--color-border);
}

.mobile-menu-link:last-child {
  border-bottom: none;
}

.mobile-menu-cta {
  margin-top: var(--space-4);
  width: 100%;
}

/* ==========================================================================
   LAYOUT — FOOTER
   ========================================================================== */

.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

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

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

.footer-brand {
  max-width: 280px;
}

.footer-logo {
  margin-bottom: var(--space-4);
}

.footer-description {
  font-size: var(--text-body-sm);
  color: var(--color-muted-foreground);
  line-height: var(--leading-relaxed);
}

.footer-title {
  font-size: var(--text-body-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-foreground);
  margin-bottom: var(--space-4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-link {
  font-size: var(--text-body-sm);
  color: var(--color-muted-foreground);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--color-accent);
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-copyright {
  font-size: var(--text-caption);
  color: var(--color-muted-foreground);
}

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

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-muted);
  color: var(--color-muted-foreground);
  transition: all var(--transition-fast);
}

.social-link:hover {
  background: var(--color-accent);
  color: white;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

.animate-fade-in { animation: fadeIn var(--transition-normal) ease-out; }
.animate-slide-up { animation: slideUp var(--transition-slow) ease-out; }
.animate-slide-down { animation: slideDown var(--transition-slow) ease-out; }
.animate-slide-left { animation: slideLeft var(--transition-slow) ease-out; }
.animate-slide-right { animation: slideRight var(--transition-slow) ease-out; }
.animate-scale-in { animation: scaleIn var(--transition-normal) ease-out; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* Stagger */
.stagger-1 { animation-delay: 0ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 200ms; }
.stagger-4 { animation-delay: 300ms; }
.stagger-5 { animation-delay: 400ms; }
.stagger-6 { animation-delay: 500ms; }

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.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;
}

.visible { visibility: visible; }
.invisible { visibility: hidden; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-words { overflow-wrap: break-word; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }

.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }

.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }

.transition-none { transition: none; }
.transition-fast { transition: all var(--transition-fast); }
.transition-base { transition: all var(--transition-base); }
.transition-normal { transition: all var(--transition-normal); }
.transition-slow { transition: all var(--transition-slow); }

/* Print */
@media print {
  .no-print { display: none !important; }
  .header, .footer, .btn, .modal-overlay { display: none !important; }
  body { background: white; color: black; }
  a { color: black; text-decoration: underline; }
}