/* ============================================================
   Fractional GC Platform — Shared Design System
   Dark theme: #0f1117 bg, #1e2130 cards, #6c63ff accent
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
  /* Colors */
  --bg-primary:   #0f1117;
  --bg-secondary: #1e2130;
  --bg-tertiary:  #252840;
  --bg-hover:     #2a2d4a;

  --accent:          #6c63ff;
  --accent-hover:    #7b74ff;
  --accent-light:    rgba(108, 99, 255, 0.15);
  --accent-border:   rgba(108, 99, 255, 0.4);

  --text-primary:   #ffffff;
  --text-secondary: #a0a8c0;
  --text-muted:     #636880;
  --text-inverse:   #0f1117;

  --success:        #22c55e;
  --success-light:  rgba(34, 197, 94, 0.15);
  --warning:        #f59e0b;
  --warning-light:  rgba(245, 158, 11, 0.15);
  --danger:         #ef4444;
  --danger-light:   rgba(239, 68, 68, 0.15);
  --info:           #3b82f6;
  --info-light:     rgba(59, 130, 246, 0.15);

  --border:         rgba(255, 255, 255, 0.08);
  --border-strong:  rgba(255, 255, 255, 0.16);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --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-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Spacing scale */
  --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;

  /* Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.7);
  --shadow-accent: 0 4px 20px rgba(108, 99, 255, 0.3);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* Z-index layers */
  --z-dropdown: 100;
  --z-drawer:   200;
  --z-modal:    300;
  --z-toast:    400;
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

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

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ----- 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); font-weight: var(--font-medium); }
h6 { font-size: var(--text-sm); font-weight: var(--font-medium); }

p { color: var(--text-secondary); line-height: var(--leading-relaxed); }

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

code {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  color: var(--accent);
}

/* ----- Layout Primitives ----- */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-sm { max-width: 768px; }
.container-md { max-width: 1024px; }
.container-lg { max-width: 1440px; }

.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); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

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

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ----- Card Component ----- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: border-color var(--transition-normal);
}
.card:hover { border-color: var(--border-strong); }

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

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

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

/* ----- Stat Card ----- */
.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1;
}

.stat-delta {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta.flat { color: var(--text-muted); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent-border);
}

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

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-success {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}
.btn-success:hover { background: rgba(34, 197, 94, 0.25); }

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

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

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

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border: 1px solid transparent;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}
.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.3);
}
.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.badge-info {
  background: var(--info-light);
  color: var(--info);
  border-color: rgba(59, 130, 246, 0.3);
}
.badge-accent {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-border);
}
.badge-muted {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-color: var(--border);
}

/* ----- Form Elements ----- */
.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-secondary);
}

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

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

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

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23636880' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
  cursor: pointer;
}

/* ----- Table ----- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

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

thead {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-strong);
}

th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

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

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

tbody tr {
  transition: background var(--transition-fast);
}
tbody tr:hover { background: var(--bg-tertiary); }

tbody tr.clickable {
  cursor: pointer;
}

/* ----- Divider ----- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-4) 0;
}

/* ----- Section Header ----- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

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

/* ----- Empty State ----- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: var(--text-sm);
  max-width: 320px;
}

/* ----- Skeleton Loading States ----- */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary)  50%,
    var(--bg-secondary) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-md);
}

.skeleton-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
}

.skeleton-line.skeleton { }
.skeleton-line-sm  { width: 40%; }
.skeleton-line-md  { width: 65%; }
.skeleton-line-full { width: 100%; }

.skeleton-title {
  height: 20px;
  width: 55%;
  border-radius: var(--radius-sm);
}

.skeleton-value {
  height: 36px;
  width: 35%;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 12px;
  border-radius: var(--radius-sm);
}

.skeleton-badge {
  height: 20px;
  width: 80px;
  border-radius: var(--radius-full);
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ----- Toast Notifications ----- */
#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;
  max-width: 360px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toast-in var(--transition-normal) ease forwards;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.toast-success::before { background: var(--success); }
.toast-error::before   { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before    { background: var(--info); }

.toast-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
  margin-top: 1px;
}

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

.toast-message {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--leading-normal);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-lg);
  line-height: 1;
  flex-shrink: 0;
  padding: 0;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text-primary); }

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
    max-height: 100px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(24px);
    max-height: 0;
    margin-bottom: calc(-1 * var(--space-3));
    padding-top: 0;
    padding-bottom: 0;
  }
}

.toast.removing {
  animation: toast-out var(--transition-normal) ease forwards;
}

/* ----- Modal ----- */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  backdrop-filter: blur(4px);
}

#modal-overlay.open {
  display: flex;
  animation: fade-in var(--transition-normal) ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modal-in var(--transition-normal) ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

.modal-close {
  color: var(--text-muted);
  font-size: var(--text-xl);
  transition: color var(--transition-fast);
}
.modal-close:hover { color: var(--text-primary); }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ----- Drawer ----- */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-drawer);
  backdrop-filter: blur(2px);
}

.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-strong);
  z-index: calc(var(--z-drawer) + 1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow) cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xl);
}

.drawer.open { transform: translateX(0); }

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

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

.drawer-close {
  color: var(--text-muted);
  font-size: var(--text-xl);
  transition: color var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}
.drawer-close:hover { color: var(--text-primary); }

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

.drawer-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ----- Filter Bar ----- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

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

.filter-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-chip {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ----- Urgency Indicator ----- */
.urgency-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.urgency-critical { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.urgency-high     { background: var(--warning); }
.urgency-medium   { background: var(--info); }
.urgency-low      { background: var(--success); }
.urgency-routine  { background: var(--text-muted); }

/* ----- Progress Bar ----- */
.progress-bar-track {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}

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

/* ----- File Upload Drop Zone ----- */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-10) var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--bg-primary);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drop-zone-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.drop-zone-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.drop-zone-subtext {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ----- Pagination ----- */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-6);
}

.pagination-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.pagination-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.pagination-btn.active {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

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

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

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

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

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

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.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-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.border { border: 1px solid var(--border); }
.border-strong { border: 1px solid var(--border-strong); }

/* ----- Responsive ----- */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .drawer { width: 100vw; }
}

@media (max-width: 768px) {
  :root { font-size: 15px; }
  .container { padding-inline: var(--space-4); }
  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2 { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  #toast-container { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); max-width: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

/* ----- Overview Command Center ----- */
.ov-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding: var(--space-4) 0;
}
.ov-greeting-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
}
.ov-greeting-badge { flex-shrink: 0; }

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

.ov-attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  padding: var(--space-4);
}
.ov-attention-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color 0.15s;
}
.ov-attention-card:hover { border-color: var(--accent); }
.ov-attention-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ov-attention-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.ov-attention-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.ov-review-btn { margin-top: auto; width: 100%; justify-content: center; }

.ov-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}
.ov-bottom-left, .ov-bottom-right { min-width: 0; }

.ov-week-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: var(--space-4);
}
.ov-week-day {
  text-align: center;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.ov-week-today {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.ov-week-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.ov-week-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.ov-week-event {
  font-size: 0.6875rem;
  color: var(--accent);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ov-week-empty {
  font-size: 0.6875rem;
  color: var(--text-muted);
  opacity: 0.5;
}

@media (max-width: 1200px) {
  .ov-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .ov-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ov-bottom-grid { grid-template-columns: 1fr; }
  .ov-greeting { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
}
@media (max-width: 540px) {
  .ov-kpi-grid { grid-template-columns: 1fr; }
  .ov-week-strip { grid-template-columns: repeat(5, 1fr); font-size: 0.75rem; }
}

/* ----- Document Viewer Split Pane (Review Tab 3B) ----- */
.doc-viewer-split {
  display: flex;
  gap: 1px;
  background: var(--border);
  min-height: 60vh;
}

.doc-viewer-content {
  flex: 0 0 65%;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.doc-viewer-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.doc-viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
}

.doc-viewer-body h3,
.doc-viewer-body h4,
.doc-viewer-body h5 {
  font-family: var(--font-sans);
}

.doc-viewer-body strong {
  color: var(--text-primary);
}

.doc-viewer-qa {
  flex: 0 0 35%;
  background: var(--bg-secondary);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.doc-viewer-qa-section {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.doc-viewer-qa-section:last-child {
  border-bottom: none;
}

@media (max-width: 768px) {
  .doc-viewer-split {
    flex-direction: column;
  }
  .doc-viewer-content,
  .doc-viewer-qa {
    flex: none;
    width: 100%;
  }
  .doc-viewer-content {
    min-height: 40vh;
  }
  .doc-viewer-qa {
    min-height: 30vh;
  }
}
