/* ============================================================
   TutorDesk v3 — Global Stylesheet
   Emerald Green (#10B981) + Amber/Gold (#F59E0B)
   ============================================================ */

/* ----------------------------------------------------------
   1. CSS CUSTOM PROPERTIES
   ---------------------------------------------------------- */
:root {
  /* Primary — Emerald Green */
  --primary-50:  #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-300: #6ee7b7;
  --primary-400: #34d399;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;

  /* Accent — Amber / Gold */
  --accent-50:  #fffbeb;
  --accent-100: #fef3c7;
  --accent-200: #fde68a;
  --accent-300: #fcd34d;
  --accent-400: #fbbf24;
  --accent-500: #f59e0b;
  --accent-600: #d97706;
  --accent-700: #b45309;
  --accent-800: #92400e;
  --accent-900: #78350f;

  /* Semantic */
  --success-light: #d1fae5;
  --success:       #10b981;
  --success-dark:  #065f46;
  --error-light:   #fee2e2;
  --error:         #ef4444;
  --error-dark:    #991b1b;
  --warning-light: #fef3c7;
  --warning:       #f59e0b;
  --warning-dark:  #92400e;
  --info-light:    #dbeafe;
  --info:          #3b82f6;
  --info-dark:     #1e40af;

  /* Neutral — Warm Grays */
  --neutral-50:  #fafaf9;
  --neutral-100: #f5f5f4;
  --neutral-200: #e7e5e4;
  --neutral-300: #d6d3d1;
  --neutral-400: #a8a29e;
  --neutral-500: #78716c;
  --neutral-600: #57534e;
  --neutral-700: #44403c;
  --neutral-800: #292524;
  --neutral-900: #1c1917;

  /* Backgrounds */
  --bg-body:    #f8fafc;
  --bg-card:    #ffffff;
  --bg-input:   #ffffff;
  --bg-hover:   #f1f5f9;
  --bg-surface: #f1f5f9;

  /* Text */
  --text-primary:   #1e293b;
  --text-secondary: #64748b;
  --text-tertiary:  #94a3b8;
  --text-inverse:   #ffffff;
  --text-link:      #059669;

  /* Border */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: #10b981;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:     0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-lg:  0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.04);
  --shadow-xl:  0 25px 50px -12px rgba(0,0,0,0.15);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #10b981, #059669);
  --gradient-accent:  linear-gradient(135deg, #f59e0b, #d97706);
  --gradient-hero:    linear-gradient(135deg, #064e3b 0%, #059669 50%, #10b981 100%);
  --gradient-warm:    linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

  /* Spacing */
  --space-0:    0;
  --space-0-5:  0.125rem;
  --space-1:    0.25rem;
  --space-1-5:  0.375rem;
  --space-2:    0.5rem;
  --space-2-5:  0.625rem;
  --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;

  /* Typography */
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Poppins', 'Inter', sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 0.9375rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;

  /* Line heights */
  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relaxed:1.625;

  /* Border radius */
  --radius-sm:   0.375rem;
  --radius:      0.5rem;
  --radius-md:   0.75rem;
  --radius-lg:   1rem;
  --radius-xl:   1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.2s ease;
  --transition-slow:   0.3s ease;
  --transition-slower: 0.5s ease;

  /* Z-index */
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-overlay:   300;
  --z-modal:     400;
  --z-popover:   500;
  --z-tooltip:   600;
  --z-toast:     700;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

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 {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
}

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

a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

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

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

fieldset {
  border: none;
}

/* ----------------------------------------------------------
   3. UTILITY CLASSES
   ---------------------------------------------------------- */

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }
.container-xl { max-width: 1280px; }

/* Text Alignment */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Text Colors */
.text-primary    { color: var(--text-primary); }
.text-secondary  { color: var(--text-secondary); }
.text-tertiary   { color: var(--text-tertiary); }
.text-success    { color: var(--success); }
.text-error      { color: var(--error); }
.text-warning    { color: var(--warning); }
.text-info       { color: var(--info); }
.text-green      { color: var(--primary-500); }
.text-amber      { color: var(--accent-500); }
.text-white      { color: #ffffff; }
.text-inverse    { color: var(--text-inverse); }

/* Backgrounds */
.bg-body         { background-color: var(--bg-body); }
.bg-card         { background-color: var(--bg-card); }
.bg-primary-50   { background-color: var(--primary-50); }
.bg-primary-100  { background-color: var(--primary-100); }
.bg-primary-500  { background-color: var(--primary-500); }
.bg-primary-600  { background-color: var(--primary-600); }
.bg-accent-50    { background-color: var(--accent-50); }
.bg-accent-500   { background-color: var(--accent-500); }
.bg-gradient-primary { background: var(--gradient-primary); }
.bg-gradient-accent  { background: var(--gradient-accent); }

/* Flex */
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.flex-row      { flex-direction: row; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-nowrap   { flex-wrap: nowrap; }
.flex-1        { flex: 1 1 0%; }
.flex-auto     { flex: 1 1 auto; }
.flex-none     { flex: none; }
.items-start   { align-items: flex-start; }
.items-center  { align-items: center; }
.items-end     { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around  { justify-content: space-around; }
.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-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); }
.grid-cols-6  { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

/* Spacing — margin */
.m-0  { margin: 0; }
.m-1  { margin: var(--space-1); }
.m-2  { margin: var(--space-2); }
.m-3  { margin: var(--space-3); }
.m-4  { margin: var(--space-4); }
.m-6  { margin: var(--space-6); }
.m-8  { margin: var(--space-8); }
.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); }
.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); }
.ml-0 { margin-left: 0; }
.ml-2 { margin-left: var(--space-2); }
.ml-4 { margin-left: var(--space-4); }
.ml-auto { margin-left: auto; }
.mr-0 { margin-right: 0; }
.mr-2 { margin-right: var(--space-2); }
.mr-4 { margin-right: var(--space-4); }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.my-6 { margin-top: var(--space-6); margin-bottom: var(--space-6); }
.my-8 { margin-top: var(--space-8); margin-bottom: var(--space-8); }

/* Spacing — padding */
.p-0  { padding: 0; }
.p-1  { padding: var(--space-1); }
.p-2  { padding: var(--space-2); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }
.p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }
.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

/* Widths */
.w-full  { width: 100%; }
.w-auto  { width: auto; }
.w-1-2   { width: 50%; }
.w-1-3   { width: 33.3333%; }
.w-2-3   { width: 66.6666%; }
.w-1-4   { width: 25%; }
.w-3-4   { width: 75%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }

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

/* Border Radius */
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded      { border-radius: var(--radius); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

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

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

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

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

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

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

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

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

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

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

/* ----------------------------------------------------------
   5. FORM STYLING
   ---------------------------------------------------------- */
.form-group {
  margin-bottom: var(--space-5);
}

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

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  background-color: #ffffff;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

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

.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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

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

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

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--neutral-100);
  color: var(--text-tertiary);
  cursor: not-allowed;
  border-color: var(--neutral-200);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--primary-500);
  cursor: pointer;
}

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

/* ----------------------------------------------------------
   6. BUTTONS
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

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

/* Primary */
.btn-primary {
  background: var(--gradient-primary);
  color: #ffffff;
  border-color: transparent;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  color: #ffffff;
  text-decoration: none;
}

.btn-primary:active {
  background: linear-gradient(135deg, #047857, #065f46);
}

/* Accent */
.btn-accent {
  background: var(--gradient-accent);
  color: #ffffff;
  border-color: transparent;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  color: #ffffff;
  text-decoration: none;
}

.btn-accent:active {
  background: linear-gradient(135deg, #b45309, #92400e);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--primary-600);
  border-color: var(--primary-300);
}

.btn-outline:hover {
  background-color: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-700);
  text-decoration: none;
}

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

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

/* Danger */
.btn-danger {
  background-color: var(--error);
  color: #ffffff;
  border-color: transparent;
}

.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  color: #ffffff;
  text-decoration: none;
}

/* Sizes */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--text-lg);
  border-radius: var(--radius-md);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Disabled */
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Icon button */
.btn-icon {
  padding: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
}

.btn-icon.btn-sm {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0.25rem;
}

.btn-icon.btn-lg {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.625rem;
}

/* ----------------------------------------------------------
   7. CARD COMPONENT
   ---------------------------------------------------------- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

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

.card-header h3,
.card-header h4 {
  font-size: var(--text-lg);
  font-weight: 600;
}

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

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

/* Card gradient */
.card-gradient {
  background: var(--gradient-primary);
  color: #ffffff;
  border: none;
}

.card-gradient .card-header {
  border-bottom-color: rgba(255,255,255,0.2);
}

.card-gradient .card-footer {
  background-color: rgba(0,0,0,0.1);
  border-top-color: rgba(255,255,255,0.2);
}

/* Card glow */
.card-glow {
  border: none;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.card-glow:hover {
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.25);
}

/* ----------------------------------------------------------
   8. TABLE STYLING
   ---------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

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

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

.table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

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

.table tbody tr.selected {
  background-color: var(--primary-100);
}

/* ----------------------------------------------------------
   9. BADGE / PILL
   ---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

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

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

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

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

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

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

.badge-dot {
  position: relative;
  padding-left: 0.85rem;
}

.badge-dot::before {
  content: '';
  position: absolute;
  left: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* ----------------------------------------------------------
   10. FLASH MESSAGES
   ---------------------------------------------------------- */
.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

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

.flash-content {
  flex: 1;
}

.flash-close {
  flex-shrink: 0;
  padding: 2px;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.flash-close:hover {
  opacity: 1;
}

.flash-success {
  background-color: var(--success-light);
  border-left-color: var(--success);
  color: var(--success-dark);
}

.flash-error {
  background-color: var(--error-light);
  border-left-color: var(--error);
  color: var(--error-dark);
}

.flash-warning {
  background-color: var(--warning-light);
  border-left-color: var(--warning);
  color: var(--warning-dark);
}

.flash-info {
  background-color: var(--info-light);
  border-left-color: var(--info);
  color: var(--info-dark);
}

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

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

.modal {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-slow);
}

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

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

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

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

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

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

/* Modal sizes */
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

/* ----------------------------------------------------------
   12. DROPDOWN
   ---------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-block;
}

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

.dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(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);
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background-color: var(--primary-50);
  color: var(--primary-600);
  text-decoration: none;
}

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

/* ----------------------------------------------------------
   13. PAGINATION
   ---------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
}

.pagination-item {
  display: inline-flex;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.pagination-link:hover {
  background-color: var(--primary-50);
  color: var(--primary-600);
  text-decoration: none;
}

.pagination-item.active .pagination-link {
  background: var(--gradient-primary);
  color: #ffffff;
}

.pagination-item.disabled .pagination-link {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ----------------------------------------------------------
   14. PROGRESS BAR
   ---------------------------------------------------------- */
.progress {
  width: 100%;
  height: 8px;
  background-color: var(--neutral-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

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

.progress-bar.accent {
  background: var(--gradient-accent);
}

.progress-sm { height: 4px; }
.progress-lg { height: 12px; }

.progress-lg .progress-bar {
  border-radius: var(--radius-full);
}

/* ----------------------------------------------------------
   15. TOOLTIP
   ---------------------------------------------------------- */
.tooltip {
  position: relative;
  display: inline-flex;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: #ffffff;
  background-color: var(--neutral-800);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--neutral-800);
  z-index: var(--z-tooltip);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

/* ----------------------------------------------------------
   16. DIVIDER
   ---------------------------------------------------------- */
.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-6) 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-color);
}

/* ----------------------------------------------------------
   17. AVATAR
   ---------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--gradient-primary);
  color: #ffffff;
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

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

.avatar-xs { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar-sm { width: 2rem;   height: 2rem;   font-size: var(--text-xs); }
.avatar-md { width: 2.5rem; height: 2.5rem; font-size: var(--text-sm); }
.avatar-lg { width: 3rem;   height: 3rem;   font-size: var(--text-base); }
.avatar-xl { width: 4rem;   height: 4rem;   font-size: var(--text-lg); }

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-card);
  margin-left: -0.5rem;
}

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

/* ----------------------------------------------------------
   18. ANIMATION KEYFRAMES
   ---------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

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

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

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

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

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

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(-12px);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.2),
                0 0 10px rgba(16, 185, 129, 0.1);
  }
  50% {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4),
                0 0 20px rgba(16, 185, 129, 0.2);
  }
}

/* Animation utilities */
.animate-fadeIn      { animation: fadeIn 0.3s ease forwards; }
.animate-fadeInUp    { animation: fadeInUp 0.4s ease forwards; }
.animate-slideUp     { animation: slideUp 0.3s ease forwards; }
.animate-slideDown   { animation: slideDown 0.3s ease forwards; }
.animate-slideInLeft { animation: slideInLeft 0.4s ease forwards; }
.animate-slideInRight{ animation: slideInRight 0.4s ease forwards; }
.animate-pulse       { animation: pulse 2s ease-in-out infinite; }
.animate-shimmer     { animation: shimmer 2s ease-in-out infinite; }
.animate-spin        { animation: spin 1s linear infinite; }
.animate-bounce      { animation: bounce 1s ease-in-out infinite; }
.animate-scaleIn     { animation: scaleIn 0.3s ease forwards; }
.animate-float       { animation: float 3s ease-in-out infinite; }
.animate-glow        { animation: glow 2s ease-in-out infinite; }

/* Staggered animation delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000{ animation-delay: 1000ms; }

/* ----------------------------------------------------------
   19. SCROLLBAR
   ---------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--neutral-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--neutral-400);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-300) transparent;
}

/* ----------------------------------------------------------
   20. SELECTION
   ---------------------------------------------------------- */
::selection {
  background-color: var(--primary-200);
  color: var(--primary-900);
}

::-moz-selection {
  background-color: var(--primary-200);
  color: var(--primary-900);
}

/* ----------------------------------------------------------
   21. FOCUS-VISIBLE
   ---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

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

/* ----------------------------------------------------------
   22. PRINT STYLES
   ---------------------------------------------------------- */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  img {
    page-break-inside: avoid;
  }

  h2, h3 {
    page-break-after: avoid;
  }

  .no-print,
  .sidebar,
  .topbar,
  .landing-nav,
  .modal-overlay,
  .btn {
    display: none !important;
  }

  .dashboard-main {
    margin-left: 0 !important;
  }

  body {
    font-size: 12pt;
  }
}

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

/* High contrast */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: #1e293b;
  }
}

/* Skip to content */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background-color: var(--primary-600);
  color: #ffffff;
  border-radius: var(--radius);
  z-index: 9999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
  color: #ffffff;
  text-decoration: none;
}

/* ----------------------------------------------------------
   24. SKELETON LOADING
   ---------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--neutral-200) 25%,
    var(--neutral-100) 50%,
    var(--neutral-200) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  width: 100%;
}

.skeleton-text:last-child {
  width: 75%;
}

.skeleton-circle {
  border-radius: var(--radius-full);
}

.skeleton-heading {
  height: 1.5em;
  width: 50%;
  margin-bottom: 0.75em;
}

/* ----------------------------------------------------------
   25. RESPONSIVE UTILITIES
   ---------------------------------------------------------- */
@media (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .container { padding-left: var(--space-3); padding-right: var(--space-3); }
}

@media (min-width: 768px) {
  .show-mobile-only { display: none !important; }
}

@media (min-width: 1024px) {
  .show-tablet-only { display: none !important; }
}
