/* ==========================================================================
   Shared Styles - Geist-Inspired Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   Font Import - Geist Sans & Mono
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-mono/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-mono/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   CSS Custom Properties / Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Typography */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', Monaco, 'Cascadia Code', monospace;

  /* Font Sizes (4px base scale) */
  --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 */

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

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

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

  /* Colors - Light Mode (Vercel/Geist inspired) */
  --background: #FBFCFC;
  --background-subtle: #fafafa;
  --foreground: #0a0a0a;
  --foreground-muted: #737373;
  --foreground-subtle: #a3a3a3;

  /* Gray Scale */
  --gray-50: #fafafa;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-150: #ebebeb;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --gray-950: #0a0a0a;

  /* Borders */
  --border: #e5e5e5;
  --border-subtle: #f0f0f0;
  --border-strong: #d4d4d4;

  /* Accent Colors */
  --accent-blue: #0070f3;
  --accent-blue-light: #3291ff;
  --accent-blue-dark: #0060df;
  --accent-blue-muted: rgba(0, 112, 243, 0.1);

  --accent-green: #00a550;
  --accent-green-light: #00c853;
  --accent-green-dark: #008c44;
  --accent-green-muted: rgba(0, 165, 80, 0.1);

  --accent-amber: #f5a623;
  --accent-amber-light: #ffb93b;
  --accent-amber-dark: #e09000;
  --accent-amber-muted: rgba(245, 166, 35, 0.1);

  --accent-red: #e00;
  --accent-red-light: #ff3333;
  --accent-red-dark: #cc0000;
  --accent-red-muted: rgba(238, 0, 0, 0.1);

  --accent-purple: #7928ca;
  --accent-purple-muted: rgba(121, 40, 202, 0.1);

  --accent-indigo: #4f46e5;
  --accent-indigo-light: #6366f1;
  --accent-indigo-dark: #4338ca;
  --accent-indigo-muted: rgba(79, 70, 229, 0.08);

  /* Status Colors */
  --status-pending: var(--gray-400);
  --status-pending-bg: var(--gray-100);
  --status-in-progress: var(--accent-blue);
  --status-in-progress-bg: var(--accent-blue-muted);
  --status-completed: var(--accent-green);
  --status-completed-bg: var(--accent-green-muted);
  --status-blocked: var(--accent-red);
  --status-blocked-bg: var(--accent-red-muted);
  --status-skipped: var(--gray-400);
  --status-skipped-bg: var(--gray-100);

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

  /* Focus Ring */
  --ring-color: rgba(0, 112, 243, 0.4);
  --ring-offset: 2px;

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

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 400ms;
}

/* --------------------------------------------------------------------------
   Dark Mode Support (Optional)
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root.auto-dark,
  :root[data-theme="dark"] {
    --background: #0a0a0a;
    --background-subtle: #171717;
    --foreground: #fafafa;
    --foreground-muted: #a3a3a3;
    --foreground-subtle: #737373;

    --border: #262626;
    --border-subtle: #1f1f1f;
    --border-strong: #404040;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  }
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background-color: var(--background);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--foreground);
  background-color: var(--background);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

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

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

small {
  font-size: var(--text-sm);
  color: var(--foreground-muted);
}

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   Focus States
   -------------------------------------------------------------------------- */
:focus {
  outline: none;
}

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

/* --------------------------------------------------------------------------
   Selection
   -------------------------------------------------------------------------- */
::selection {
  background-color: var(--accent-blue-muted);
  color: var(--accent-blue-dark);
}

/* --------------------------------------------------------------------------
   Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--radius-full);
  transition: background 0.2s ease;
}

*:hover::-webkit-scrollbar-thumb {
  background: var(--gray-300);
}

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

/* --------------------------------------------------------------------------
   Common Animation Keyframes
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

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

@keyframes checkmark {
  0% {
    stroke-dashoffset: 24;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

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

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

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* --------------------------------------------------------------------------
   Status Badge Base Styles
   -------------------------------------------------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  text-transform: capitalize;
}

.status-badge--pending {
  color: var(--status-pending);
  background-color: var(--status-pending-bg);
}

.status-badge--in-progress {
  color: var(--status-in-progress);
  background-color: var(--status-in-progress-bg);
}

.status-badge--completed {
  color: var(--status-completed);
  background-color: var(--status-completed-bg);
}

.status-badge--blocked {
  color: var(--status-blocked);
  background-color: var(--status-blocked-bg);
}

.status-badge--skipped {
  color: var(--status-skipped);
  background-color: var(--status-skipped-bg);
}

/* --------------------------------------------------------------------------
   Button Base Styles
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

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

.btn--primary:hover {
  background-color: var(--gray-800);
}

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

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

/* --------------------------------------------------------------------------
   Checkbox Styles
   -------------------------------------------------------------------------- */
.checkbox {
  --checkbox-size: 18px;
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.checkbox input {
  position: absolute;
  opacity: 0;
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  cursor: pointer;
}

.checkbox__box {
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  transition: all var(--duration-fast) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox:hover .checkbox__box {
  border-color: var(--gray-400);
}

.checkbox input:checked + .checkbox__box {
  background-color: var(--foreground);
  border-color: var(--foreground);
}

.checkbox__check {
  width: 10px;
  height: 10px;
  stroke: white;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset var(--duration-normal) var(--ease-out);
}

.checkbox input:checked + .checkbox__box .checkbox__check {
  stroke-dashoffset: 0;
}

.checkbox input:focus-visible + .checkbox__box {
  outline: 2px solid var(--accent-blue);
  outline-offset: var(--ring-offset);
}

/* --------------------------------------------------------------------------
   Card Base Styles
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
}

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

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

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

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

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

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

/* --------------------------------------------------------------------------
   Page Header Styles
   -------------------------------------------------------------------------- */
.page-header {
  padding: var(--space-8) 0;
  margin-bottom: var(--space-8);
  border-bottom: 1px solid var(--border);
}

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

.page-header__description {
  color: var(--foreground-muted);
  font-size: var(--text-base);
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Progress Indicator Styles
   -------------------------------------------------------------------------- */
.progress-ring {
  --progress-size: 24px;
  --progress-stroke: 3px;
  width: var(--progress-size);
  height: var(--progress-size);
  transform: rotate(-90deg);
}

.progress-ring__bg {
  fill: none;
  stroke: var(--border);
  stroke-width: var(--progress-stroke);
}

.progress-ring__fill {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: var(--progress-stroke);
  stroke-linecap: round;
  transition: stroke-dashoffset var(--duration-slow) var(--ease-out);
}

/* --------------------------------------------------------------------------
   Loading Spinner
   -------------------------------------------------------------------------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--foreground);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --------------------------------------------------------------------------
   Transitions for JavaScript
   -------------------------------------------------------------------------- */
.transition-height {
  overflow: hidden;
  transition: height var(--duration-slow) var(--ease-out);
}

.transition-opacity {
  transition: opacity var(--duration-normal) var(--ease-out);
}

.transition-transform {
  transition: transform var(--duration-normal) var(--ease-out);
}

.transition-all {
  transition: all var(--duration-normal) var(--ease-out);
}

/* --------------------------------------------------------------------------
   Notepad Container (Notes + Attachments combined)
   -------------------------------------------------------------------------- */
.notepad-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.notepad-container__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.notepad-container__header .case-section__title {
  margin: 0;
}

.notepad-container .notepad {
  border: none;
  border-radius: 0;
  background: transparent;
}

.notepad-container .notepad:hover {
  border-color: transparent;
}

.notepad-container .notepad:focus {
  border-color: transparent;
  box-shadow: none;
}

.notepad-container__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

/* Attachment Pills */
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: 12px;
  font-weight: var(--font-medium);
  color: var(--foreground-muted);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.attachment-pill:hover {
  background: var(--gray-100);
  border-color: var(--border-strong);
  color: var(--foreground);
}

.attachment-pill__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.attachment-pill__icon--pdf {
  color: #dc2626;
}

.attachment-pill__icon--excel {
  color: #16a34a;
}

.attachment-pill__name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Subcase Pills (Case entities rendered as pills)
   -------------------------------------------------------------------------- */
.subcases-section {
  /* No longer needs margin/border - now in its own container */
}

.subcases-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.subcases-section__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground-subtle);
}

.subcases-section__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 11px;
  color: var(--foreground-muted);
}

.subcases-section__toggle-option {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
}

.subcases-section__toggle-option:hover {
  color: var(--foreground);
}

.subcases-section__toggle-option--active {
  background: var(--background-subtle);
  color: var(--foreground);
  font-weight: 500;
}


.subcases-section__count {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-indigo-light);
  padding: 1px 5px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: var(--radius-sm);
  margin-left: var(--space-1);
}

.subcases-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
  transition: gap var(--duration-fast) var(--ease-out);
}

/* Stacked/list layout variant */
.subcases-section--stacked .subcases-list {
  flex-direction: column;
  gap: var(--space-1);
}

.subcases-section--stacked .subcase-pill {
  width: 100%;
  justify-content: flex-start;
}

.subcases-section--stacked .subcase-pill__name {
  max-width: none;
  flex: 1;
}

.subcases-section--stacked .subcase-pill__progress {
  margin-left: auto;
}

.subcase-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px var(--space-2);
  font-size: 15px;
  font-weight: var(--font-normal);
  color: var(--foreground);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  text-decoration: none;
}

.subcase-pill:hover {
  background: var(--gray-50);
  border-color: var(--border-strong);
}

.subcase-pill__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: var(--accent-indigo);
}

/* Filled folder icon for completed subcases */
.subcase-pill__icon--filled {
  fill: var(--accent-indigo);
  stroke: none;
}

/* Completed subcase - fainter styling */
.subcase-pill--completed {
  opacity: 0.55;
}

.subcase-pill--completed:hover {
  opacity: 0.8;
}

/* Spinner for in-progress subcases */
.subcase-pill__spinner {
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--accent-indigo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 2px;
  flex-shrink: 0;
}

.subcase-pill--completed .subcase-pill__spinner {
  display: none;
}

.subcase-pill__name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stage progress indicator (e.g., "3/5") */
.subcase-pill__progress {
  font-size: 11px;
  font-weight: var(--font-medium);
  color: var(--foreground-muted);
  margin-left: var(--space-1);
}

/* Icon-only Action Button */
.action-btn--icon {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   Floating Tabs (Geist-style)
   -------------------------------------------------------------------------- */
.floating-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.floating-tab {
  padding: 6px 12px;
  font-family: 'Geist', var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  color: var(--foreground-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.floating-tab:hover {
  color: var(--foreground);
  background: var(--gray-100);
}

.floating-tab--active {
  color: var(--foreground);
  font-weight: 500;
  background: var(--gray-150);
}

/* --------------------------------------------------------------------------
   Activity Stage Groups
   -------------------------------------------------------------------------- */
.activity-stage-group {
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}

.activity-stage-group:last-child,
.activity-timeline > *:last-child {
  border-bottom: none;
}

.activity-stage-group .activity-stage-header {
  margin: 0;
  border-radius: 0;
  border: none;
  cursor: pointer;
  user-select: none;
}

.activity-stage-group .activity-stage-header:hover {
  background: transparent;
}

.activity-stage-header__time {
  margin-left: auto;
}

.activity-stage-header__chevron {
  margin-left: var(--space-3);
  width: 16px;
  height: 16px;
  color: var(--foreground-muted);
  transition: transform var(--duration-fast) var(--ease-out);
}

.activity-stage-group--collapsed .activity-stage-header__chevron {
  transform: rotate(-90deg);
}

.activity-stage-group--collapsed .activity-stage-header {
  border-bottom: none;
}

.activity-stage-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--gray-50);
}

.activity-stage-group--collapsed .activity-stage-content,
.activity-stage-group--collapsed .activity-stage-tasks {
  display: none;
}

/* Activity Stage Tasks Block */
.activity-stage-tasks {
  border-radius: 0;
  padding: var(--space-4);
  margin-bottom: 0;
  position: relative;
  background: #fff;
}

/* Inner content container */
.activity-stage-tasks__inner {
  position: relative;
  z-index: 1;
  margin-left: var(--space-4);
}

.activity-stage-tasks .stage-instruction {
  margin-bottom: var(--space-3);
}

.activity-stage-tasks .todos-list {
  margin-bottom: var(--space-3);
}

.activity-stage-tasks .accordion-actions {
  margin-top: var(--space-3);
}

/* Pending/Planned stages */
.activity-stage-group--pending {
  /* Planned stages styled consistently with other stages */
}

/* Hidden pending stages (for truncated view) - legacy support */
.activity-stage-group--hidden {
  display: none;
}

/* Planned Stages Toggle (standalone separator) */
.planned-stages-toggle {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: hidden;
  margin: var(--space-4) 0;
}

.planned-stages-toggle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--foreground-muted);
  transition: all var(--duration-fast) var(--ease-out);
  border-radius: var(--radius-md);
}

.planned-stages-toggle__btn:hover {
  background: var(--gray-100);
  color: var(--foreground);
}

.planned-stages-toggle__icon {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-fast) var(--ease-out);
}

.planned-stages-toggle--expanded .planned-stages-toggle__icon {
  transform: rotate(90deg);
}

/* Completed Stages Container */
.activity-timeline.completed-stages-container {
  display: flex;
}

/* Current Stage Container */
.activity-timeline.current-stage-container {
  display: flex;
  margin-top: var(--space-2);
}

/* Planned Stages Container (separate timeline section) */
.activity-timeline.planned-stages-container {
  display: flex;
  margin-top: var(--space-2);
}

/* Legacy: When toggle is expanded, show all following pending stages */
.planned-stages-toggle--expanded ~ .activity-stage-group--pending.activity-stage-group--hidden {
  display: block;
}

.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
