/* Modern Enterprise Color Scheme */
:root {
  /* Navy-based primary colors */
  --navy-dark: #1a1f36;
  --navy-medium: #2c3e50;
  --navy-light: #34495e;
  --slate-gray: #64748b;

  /* Text colors */
  --off-white: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  /* Accent colors */
  --modern-yellow: #fbbf24;
  --warm-accent: #3b82f6;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Responsive typography scale - Consistent across all devices */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.8125rem;  /* 13px */
  --text-base: 0.875rem; /* 14px - standard body text */
  --text-lg: 1rem;       /* 16px */
  --text-xl: 1.125rem;   /* 18px */
  --text-2xl: 1.25rem;   /* 20px */
  --text-3xl: 1.5rem;    /* 24px */

  /* Spacing and layout */
  --border-radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Container utility variables */
  --container-max: 1200px;
  --container-pad: 2rem;
  --container-pad-sm: 1rem;
}

/* Anta font */
.anta-regular {
  font-family: "Anta", sans-serif;
  font-weight: 400;
  font-style: normal;
}

/* Base styles */
* {
  box-sizing: border-box;
}

/* Unified container logic - All key rows share the same container styling */
.container,
.top-bar > *,
.workspace-header > .container,
.workspace-tabs-inner,
.workspace-content-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
  width: 100%;
  box-sizing: border-box;
}

/* Mobile container padding */
@media (max-width: 640px) {
  .container,
  .top-bar > *,
  .workspace-header > .container,
  .workspace-tabs-inner,
  .workspace-content-inner {
    padding-left: var(--container-pad-sm);
    padding-right: var(--container-pad-sm);
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: var(--navy-dark);
  color: var(--off-white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography is now consistent across all screen sizes */

/* Top bar */
.top-bar {
  background: linear-gradient(135deg, var(--navy-medium) 0%, var(--navy-light) 100%);
  padding: 0.25rem 0;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--slate-gray);
}

.top-bar > .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--off-white);
}

.brand h1 .ai-accent {
  color: var(--modern-yellow);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.logout-btn {
  background: var(--warm-accent);
  color: var(--off-white);
  border: 1px solid var(--warm-accent);
  padding: 0.2rem 0.6rem; /* Even tighter padding */
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.8rem; /* Smaller font */
  font-weight: 500;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: var(--modern-yellow);
  color: var(--navy-dark);
  border-color: var(--modern-yellow);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Responsive top bar */
@media (max-width: 767px) {
  .brand h1 {
    font-size: var(--text-xl);
  }

  .user-info {
    gap: 0.5rem;
  }

  .logout-btn {
    padding: 0.2rem 0.6rem; /* Keep same size as desktop */
    font-size: 0.8rem; /* Keep same size as desktop */
  }
}

/* Main content */
.main-content {
  max-width: var(--container-max);
  margin: 2rem auto;
  padding: 0 var(--container-pad);
}

@media (max-width: 640px) {
  .main-content {
    margin: 1rem auto;
    padding: 0 var(--container-pad-sm);
  }
}

/* Form elements */
input, textarea, button {
  font-family: inherit;
  font-size: var(--text-sm);
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
}

input, textarea {
  width: 100%;
  max-width: 400px;
  background: var(--off-white);
  color: var(--navy-dark);
  box-shadow: var(--shadow-sm);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--warm-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow-sm);
  transform: translateY(-1px);
}

input::placeholder, textarea::placeholder {
  color: var(--slate-gray);
}

button {
  background: var(--warm-accent);
  color: var(--off-white);
  border: 1px solid var(--warm-accent);
  cursor: pointer;
  font-weight: 500;
  min-height: 44px; /* Touch-friendly */
  box-shadow: var(--shadow-sm);
}

button:hover {
  background: var(--modern-yellow);
  color: var(--navy-dark);
  border-color: var(--modern-yellow);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled {
  background: var(--slate-gray);
  border-color: var(--slate-gray);
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

/* Mobile form adjustments */
@media (max-width: 767px) {
  input, textarea, button {
    font-size: var(--text-base);
    padding: 0.875rem 1rem;
  }
}

/* Library Items (Notes) styling */
.note {
  padding: 1rem;
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  margin: 0.75rem 0;
  background: linear-gradient(135deg, var(--navy-medium) 0%, rgba(44, 62, 80, 0.8) 100%);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.note:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.note-header strong {
  color: var(--modern-yellow);
  font-size: var(--text-lg);
  font-weight: 600;
}

.item-type {
  background: var(--warm-accent);
  color: var(--off-white);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: var(--text-xs);
  text-transform: capitalize;
}

.note-content {
  color: var(--text-secondary);
  line-height: 1.5;
  flex-grow: 1;
}

.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--navy-light);
}

.note-footer small {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.deleteBtn {
  background: var(--error);
  border-color: var(--error);
  font-size: var(--text-xs);
  padding: 0.375rem 0.75rem;
  margin-top: 0.5rem;
  font-weight: 500;
}

.deleteBtn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: var(--off-white);
}

/* Sections */
section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(44, 62, 80, 0.3);
  border-radius: var(--border-radius);
  border: 1px solid var(--navy-light);
}

section h3 {
  margin: 0 0 1rem 0;
  color: var(--modern-yellow);
  font-size: var(--text-xl);
  font-weight: 600;
}

/* Authentication form styling */
.auth-form {
  max-width: 400px;
  margin: 0 auto;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.btn-primary {
  background: var(--warm-accent);
  color: var(--off-white);
  border: 2px solid var(--warm-accent);
  font-weight: 600;
  font-size: var(--text-base);
  padding: 0.875rem 2rem;
}

.btn-primary:hover {
  background: var(--modern-yellow);
  color: var(--navy-dark);
  border-color: var(--modern-yellow);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--slate-gray);
  font-weight: 500;
  font-size: var(--text-sm);
  padding: 0.75rem 2rem;
}

.btn-secondary:hover {
  background: var(--slate-gray);
  color: var(--off-white);
  border-color: var(--slate-gray);
}

.btn-small {
  padding: 0.2rem 0.6rem !important; /* Even tighter padding - override other button classes */
  font-size: 0.8rem !important; /* Smaller font to match logout-btn */
  font-weight: 500; /* Match logout-btn weight */
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
  text-align: center;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--slate-gray);
}

.auth-divider span {
  padding: 0 1rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  background: var(--navy-dark);
}

/* Auth status */
#authStatus {
  font-style: italic;
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: 1rem;
  text-align: center;
}

/* Edge function test */
#pong {
  background: var(--navy-medium);
  padding: 1rem;
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

/* Mobile sections */
@media (max-width: 767px) {
  section {
    margin: 1.5rem 0;
    padding: 1rem;
  }

  section h3 {
    font-size: var(--text-lg);
  }

  .note {
    padding: 0.75rem;
  }

  .note strong {
    font-size: var(--text-base);
  }

  /* Mobile auth form */
  .auth-form {
    max-width: 100%;
  }

  .btn-primary, .btn-secondary:not(.btn-small) {
    padding: 1rem 2rem;
    font-size: var(--text-base);
  }

  .auth-divider span {
    padding: 0 0.75rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  button:hover, .note:hover, input:focus, textarea:focus {
    transform: none;
  }
}

/* Focus improvements for keyboard navigation */
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--modern-yellow);
  outline-offset: 2px;
}

/* Loading states */
button:disabled {
  position: relative;
  color: transparent;
}

button:disabled::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  border-top-color: var(--off-white);
  animation: button-loading-spinner 1s ease infinite;
}

@keyframes button-loading-spinner {
  from { transform: rotate(0turn); }
  to { transform: rotate(1turn); }
}

/* Improved contrast for better readability */
.high-contrast {
  --text-secondary: #ffffff;
  --text-muted: #e2e8f0;
}

/* Main Navigation Tabs */
.main-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--navy-light);
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 1rem 1.5rem;
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.tab-button:hover {
  color: var(--off-white);
  background: rgba(59, 130, 246, 0.1);
  transform: none;
  box-shadow: none;
}

.tab-button.active {
  color: var(--modern-yellow);
  border-bottom-color: var(--modern-yellow);
  background: rgba(251, 191, 36, 0.1);
}

.tab-icon {
  font-size: 1.2em;
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

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

/* Section Headers */
.section-header {
  margin-bottom: 2rem;
}

.section-header h3 {
  margin-bottom: 0.5rem;
  color: var(--modern-yellow);
  font-size: var(--text-3xl); /* Increased to 24px for main section headings */
}

.section-description {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin: 0;
}

/* Library Styles */
.library-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.add-item-section {
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
}

.add-item-section h4 {
  margin: 0 0 1rem 0;
  color: var(--modern-yellow);
  font-size: var(--text-lg);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.library-search {
  display: flex;
  align-items: flex-start;
  padding-top: 2.5rem;
}

.library-search input {
  width: 100%;
  max-width: none;
}

.library-content h4 {
  color: var(--modern-yellow);
  margin-bottom: 1rem;
  font-size: var(--text-lg);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Projects Styles */
.projects-actions {
  margin-bottom: 2rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Project Cards */
.project-card {
  padding: 1.5rem;
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--navy-medium) 0%, rgba(44, 62, 80, 0.8) 100%);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-header h4 {
  margin: 0;
  color: var(--modern-yellow);
  font-size: var(--text-lg);
  font-weight: 600;
}

.project-status {
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: capitalize;
}

.project-status.draft {
  background: var(--slate-gray);
  color: var(--off-white);
}

.project-status.active {
  background: var(--warm-accent);
  color: var(--off-white);
}

.project-status.completed {
  background: var(--success);
  color: var(--off-white);
}

.project-objective {
  color: var(--text-secondary);
  font-size: var(--text-base); /* Match section description size */
  line-height: 1.5;
  flex-grow: 1;
}

.project-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--navy-light);
}

.project-actions {
  display: flex;
  gap: 0.5rem;
}

/* .btn-small styles consolidated with earlier definition */

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

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: var(--off-white);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 3rem;
  border: 2px dashed var(--slate-gray);
  border-radius: var(--border-radius);
}

/* Project Creator Page */
.project-creator {
  display: none;
}

.project-creator.active {
  display: block;
}

.creator-content {
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  padding: 2rem;
  margin: 2rem 0;
}

/* Make input fields in modals use full width */
.creator-content input,
.creator-content textarea {
  max-width: none;
}

.creator-content h4 {
  margin: 0 0 1.5rem 0;
  color: var(--modern-yellow);
  font-size: var(--text-xl);
}

.template-selector {
  margin: 0 0 1.5rem 0;
}

.template-selector label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
}

.template-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--navy-dark);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  color: var(--off-white);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-select:focus {
  outline: none;
  border-color: var(--modern-yellow);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

/* AI Model Selector */
.ai-model-selector {
  margin: 0 0 1.5rem 0;
  padding: 1rem;
}

.ai-model-selector label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--modern-yellow);
  font-size: var(--text-sm);
}

/* Model Parameters */
.model-parameters {
  margin: 0 0 1.5rem 0;
  padding: 1rem;
}

.model-parameters h5 {
  margin: 0 0 1rem 0;
  color: var(--modern-yellow);
  font-size: var(--text-base);
  font-weight: 600;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.param-item {
  display: flex;
  flex-direction: column;
}

.param-item label {
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
}

.param-item input[type="number"] {
  padding: 0.5rem;
  background: var(--navy-dark);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  color: var(--off-white);
  font-size: var(--text-sm);
  margin: 0;
  max-width: none;
}

.param-item input[type="number"]:focus {
  outline: none;
  border-color: var(--modern-yellow);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.param-item small {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-style: italic;
}

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

.model-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--navy-light);
  border-radius: calc(var(--border-radius) / 2);
  background: var(--navy-dark);
  color: var(--off-white);
  font-size: var(--text-sm);
  margin-bottom: 0.5rem;
}

.model-select:focus {
  outline: none;
  border-color: var(--modern-yellow);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.model-description {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-top: 0.25rem;
}

/* Advanced Section */
.advanced-section {
  margin: 1.5rem 0;
  border: 1px solid var(--slate-gray);
  border-radius: var(--border-radius);
  background: var(--navy-medium);
}

.advanced-section summary {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-weight: 400;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  list-style: none;
  user-select: none;
  transition: all 0.2s ease;
}

.advanced-section summary::-webkit-details-marker {
  display: none;
}

.advanced-section summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s ease;
}

.advanced-section[open] summary::before {
  transform: rotate(90deg);
}

.advanced-section summary:hover {
  color: var(--off-white);
  background: rgba(251, 191, 36, 0.05);
}

/* Prompt Editor */
.prompt-editor {
  padding: 1rem;
  background: var(--navy-medium);
}

.prompt-editor label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--modern-yellow);
  font-size: var(--text-sm);
}

.prompt-editor textarea {
  width: 100%;
  max-width: none;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: var(--text-sm);
  line-height: 1.5;
  background: var(--navy-dark);
  color: var(--off-white);
  border: 1px solid var(--navy-light);
  border-radius: calc(var(--border-radius) / 2);
  padding: 0.75rem;
  resize: vertical;
  min-height: 200px;
}

.prompt-editor textarea:focus {
  outline: none;
  border-color: var(--modern-yellow);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.prompt-help {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Performance Metrics */
.performance-metrics {
  background: var(--navy-dark);
  border: 1px solid var(--slate-gray);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-top: 1.5rem;
}

.performance-metrics h6 {
  margin: 0 0 0.75rem 0;
  color: var(--cream);
  font-size: var(--text-sm);
  font-weight: 600;
}

.perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.perf-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: calc(var(--border-radius) / 2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.perf-value {
  font-weight: 600;
  color: var(--cream);
  font-size: var(--text-base);
}

.perf-label {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin-top: 0.25rem;
}

.creator-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Structure Action Buttons */
.structure-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 1rem 0;
}

/* Markdown Editor Styles */
.markdown-editor-container {
  position: fixed;
  top: 60px; /* Below header */
  left: 20px;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: white;
  border-bottom: 1px solid var(--slate-gray);
  flex-shrink: 0;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.editor-header h3 {
  margin: 0;
  color: var(--navy-dark);
}

.editor-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.auto-save-indicator {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.auto-save-indicator.saving {
  color: var(--coral);
}

.auto-save-indicator.saved {
  color: var(--teal);
}

.editor-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem;
  background: white;
  position: relative;
  height: 100%;
}

/* Editor.js Styles */
#editorjs {
  min-height: 100%;
}

.codex-editor {
  max-width: 900px;
  margin: 0 auto;
  color: #333; /* Default text color */
}

/* Force all Editor.js content to be readable */
.ce-block {
  color: #333 !important;
}

.codex-editor__redactor {
  padding-bottom: 300px !important; /* Extra space at bottom for comfortable editing */
  min-height: calc(100vh - 300px);
}

/* Ensure scrollbar is visible */
.editor-body::-webkit-scrollbar {
  width: 8px;
}

.editor-body::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.editor-body::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.editor-body::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.ce-block__content {
  max-width: 100%;
}

.ce-toolbar__content {
  max-width: 100%;
}

.ce-header {
  color: var(--navy-dark);
  font-family: var(--font-primary);
}

h2.ce-header {
  font-size: 1.75rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--navy-medium);
}

h3.ce-header {
  font-size: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--navy-dark);
}

.ce-paragraph {
  line-height: 1.6;
  color: #333 !important; /* Force black text for readability */
}

.cdx-list {
  color: #333 !important; /* Force black text for lists */
}

.cdx-list__item {
  line-height: 1.6;
  padding: 0.25rem 0;
  color: #333 !important;
}

.cdx-nested-list__item {
  line-height: 1.6;
}

/* Fix text selection issues */
.ce-block--selected .ce-block__content {
  background: rgba(97, 160, 213, 0.05) !important;
}

/* Prevent blue highlight on text */
.ce-block ::selection {
  background: rgba(97, 160, 213, 0.2);
  color: inherit;
}

.cdx-marker {
  background: rgba(245, 235, 111, 0.3);
  color: inherit;
}

.ce-inline-toolbar {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.ce-inline-tool,
.ce-conversion-tool {
  color: var(--navy-dark);
}

.ce-inline-tool:hover,
.ce-conversion-tool:hover {
  background: rgba(0, 0, 0, 0.05);
}

.ce-inline-tool--active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--warm-accent);
}

.ce-popover {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.ce-popover__item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.ce-popover__item-icon {
  color: var(--navy-dark);
}

.ce-toolbar__plus:hover {
  background: rgba(59, 130, 246, 0.1);
}

.btn-ai {
  background: linear-gradient(135deg, var(--warm-accent) 0%, #8b5cf6 100%);
  color: var(--off-white);
  border: 2px solid transparent;
  font-weight: 600;
  font-size: var(--text-base);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.btn-ai:hover:not(:disabled) {
  background: linear-gradient(135deg, #8b5cf6 0%, var(--modern-yellow) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-ai:disabled {
  background: var(--slate-gray);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Structure Editor */
.structure-editor {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--navy-light);
}

.structure-editor h5 {
  margin: 0 0 1rem 0;
  color: var(--modern-yellow);
  font-size: var(--text-lg);
}

.structure-tree {
  background: rgba(26, 31, 54, 0.5);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  padding: 1rem;
  min-height: 200px;
}

/* Markdown Structure Display */
.markdown-structure h4 {
  color: var(--modern-yellow);
  margin-bottom: 1rem;
}

.markdown-content {
  background: var(--navy-dark);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  line-height: 1.8;
  color: var(--off-white);
}

.markdown-content h2.section-heading {
  color: var(--modern-yellow);
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--modern-yellow);
}

.markdown-content h2.section-heading:first-child {
  margin-top: 0;
}

.markdown-content h3.subsection-heading {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 1.5rem 0 0.75rem 0;
}

.markdown-content p {
  margin: 0.75rem 0;
  color: var(--text-secondary);
}

.markdown-content ul {
  margin: 0.75rem 0 0.75rem 1.5rem;
  color: var(--text-secondary);
}

.markdown-content li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.markdown-content strong {
  color: var(--modern-yellow);
  font-weight: 600;
}

.markdown-content em {
  color: var(--warm-accent);
  font-style: italic;
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
  .main-tabs {
    gap: 0.25rem;
  }

  .tab-button {
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
  }

  .tab-icon {
    font-size: 1em;
  }

  .library-actions {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .library-search {
    padding-top: 0;
  }

  .add-item-section {
    padding: 1rem;
  }

  .library-grid, .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-creator {
    padding: 1rem;
  }

  .creator-content {
    padding: 1.5rem;
    max-height: 95vh;
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-buttons button {
    width: 100%;
  }
}

/* Print styles */
@media print {
  .top-bar, .logout-btn, #auth, button {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .note {
    background: white !important;
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
}

/* ========== PROJECT WORKSPACE STYLES ========== */
.project-workspace {
  position: fixed;
  top: 60px; /* Increased to prevent overlap with top bar */
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Only content area should scroll */
}

.workspace-header {
  background: transparent; /* Remove background to prevent bleeding */
  padding: 0.6rem 0; /* Increased for equal spacing above and below button */
  min-height: auto;
  display: flex;
  align-items: center;
  border-bottom: 0.5px solid rgba(44, 62, 80, 0.2); /* Add subtle separator instead */
}

.workspace-header > div {
  display: flex;
  justify-content: space-between;
  align-items: center; /* Vertically center breadcrumb with button */
  flex-wrap: nowrap;
  height: 100%;
}

.workspace-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-shrink: 1;
  min-width: 0;
}

.workspace-actions {
  flex-shrink: 0;
  margin-left: 1rem;
}

.breadcrumb-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  text-decoration: underline;
}

.breadcrumb-link:hover {
  color: var(--primary-dark);
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

@media (max-width: 640px) {
  .breadcrumb-current {
    max-width: 150px;
  }
}

.workspace-tabs {
  background: rgba(44, 62, 80, 0.2);
  border-bottom: none; /* Border on inner container */
  display: flex;
  justify-content: flex-start; /* Avoid double centering */
}

.workspace-tabs-inner {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--navy-light);
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.workspace-tab {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  position: relative;
  transition: all 0.3s ease;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .workspace-tab {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

.workspace-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.workspace-tab.active {
  color: var(--modern-yellow);
  font-weight: 600;
  background: rgba(44, 62, 80, 0.3);
  background-clip: padding-box; /* Optical alignment at different zooms */
}

.workspace-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--modern-yellow);
  transform: translateZ(0); /* Force GPU acceleration for crisp rendering */
}

.workspace-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 0;
  /* Keep the gutter stable to avoid width jumps */
  scrollbar-gutter: stable both-edges;
}

/* .workspace-content-inner uses .container utility class */

.workspace-tab-content {
  display: none;
  animation: fadeIn 0.3s;
  max-width: 100%;
}

.workspace-tab-content.active {
  display: block;
}

/* Overview Tab Styles */
.overview-header {
  margin-bottom: 2rem;
}

.overview-header h2 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  font-size: var(--text-2xl); /* 20px - main title */
}

.overview-meta {
  display: flex;
  gap: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Objective Section - matches Structure section styling */
.objective-section {
  margin-bottom: 2rem;
}

.objective-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.objective-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-xl); /* 18px - matches structure */
}

.objective-content {
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid var(--navy-light);
  padding: 1.5rem;
  border-radius: var(--border-radius);
}

.objective-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-base); /* 14px */
  line-height: 1.6;
}

/* Inline editing for objective */
.objective-edit-textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem;
  background: var(--navy-dark);
  color: var(--text-secondary);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  font-size: var(--text-base);
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s ease;
}

.objective-edit-textarea:focus {
  outline: none;
  border-color: var(--modern-yellow);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.1);
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: rgba(44, 62, 80, 0.3);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  text-align: center;
  border: 1px solid var(--navy-light);
  transition: all 0.3s ease;
}

.stat-card:hover {
  background: rgba(44, 62, 80, 0.5);
  transform: translateY(-2px);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Structure Tab Styles */
.structure-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.structure-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-xl); /* Increased to 18px */
}

.structure-content {
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid var(--navy-light);
  padding: 2rem;
  border-radius: var(--border-radius);
  min-height: 300px;
}

.structure-content h2 {
  color: var(--primary);
  font-size: var(--text-xl); /* 18px */
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.structure-content h2:first-child {
  margin-top: 0;
}

.structure-content h3 {
  color: var(--text-primary);
  font-size: var(--text-lg); /* 16px */
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.structure-content p {
  color: var(--text-secondary);
  font-size: var(--text-base); /* 14px */
  line-height: 1.6;
  margin-bottom: 1rem;
}

.structure-content ul {
  margin: 0.5rem 0 1rem 1.5rem;
  color: var(--text-secondary);
  font-size: var(--text-base); /* 14px */
}

.structure-content li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  font-size: var(--text-base); /* 14px */
}

/* Library Tab Styles */
.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.library-header h3 {
  margin: 0;
  color: var(--text-primary);
}

.linked-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Actions Tab Styles */
.actions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.actions-header h3 {
  margin: 0;
  color: var(--text-primary);
}

.actions-list {
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid var(--navy-light);
  padding: 2rem;
  border-radius: var(--border-radius);
  min-height: 200px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-style: italic;
}

/* Container alignment now handled by .container utility class */

/* ===== ACTION REVIEW MODAL STYLES ===== */

/* Wide Modal Layout - uses maximum available width */
.modal-wide {
  width: 95vw;
  max-width: 2400px; /* Increased significantly for ultra-wide displays */
  padding: 2.5rem;
}

.modal-split-container {
  display: flex;
  gap: 2rem;
  height: auto; /* Allow natural flow instead of fixed height */
  max-height: 60vh; /* Constrain to prevent overflow */
  margin: 1.5rem 0;
}

/* Left Panel - Project Structure (66%) */
.structure-panel-wide {
  flex: 0 0 66%;
  overflow-y: visible; /* No nested scroll */
}

.structure-content-formatted {
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  padding: 2rem;
  height: auto; /* Let it flow naturally */
  overflow-y: visible; /* No nested scroll - modal handles scrolling */
}

/* Same formatting as project overview */
.structure-formatted h2 {
  color: var(--modern-yellow);
  font-size: var(--text-xl);
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--navy-light);
}

.structure-formatted h3 {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.structure-formatted p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.structure-formatted ul,
.structure-formatted ol {
  margin: 0.5rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

.structure-formatted li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* Highlighting for structure elements */
.highlighted-structure {
  background: rgba(255, 215, 0, 0.15);
  padding: 0.25rem 0.5rem;
  margin-left: -0.5rem;
  border-left: 3px solid var(--modern-yellow);
  transition: all 0.2s ease;
}

/* Right Panel - Actions List (34%) */
.actions-panel-compact {
  flex: 0 0 34%;
  display: flex;
  flex-direction: column;
}

.panel-title {
  color: var(--modern-yellow);
  font-size: var(--text-lg);
  margin: 0 0 1rem 0;
  font-weight: 600;
}

.actions-list-compact {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Compact Action Items */
.action-item-compact {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  background: rgba(44, 62, 80, 0.3);
  transition: all 0.2s ease;
}

.action-item-compact:hover {
  background: rgba(44, 62, 80, 0.5);
  transform: translateX(2px);
}

.action-item-compact.selected {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.action-item-compact.rejected {
  opacity: 0.6;
  background: rgba(44, 62, 80, 0.2);
}

/* Top row with badge and controls */
.action-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Compact Accept/Reject Controls - now inline */
.action-controls {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.action-accept,
.action-reject {
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--slate-gray);
  border-radius: 0.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: auto;
}

.action-accept:hover {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.action-reject:hover {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.action-accept.active {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.action-reject.active {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

/* Compact Action Content */
.action-content-compact {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.confidence-badge-compact {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.5rem;
}

.action-text {
  color: var(--off-white);
  font-size: var(--text-sm);
  line-height: 1.4;
  padding: 0.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.action-text[contenteditable]:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--navy-light);
}

.action-text[contenteditable]:focus {
  outline: none;
  background: var(--navy-medium);
  border-color: var(--modern-yellow);
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--navy-light);
}

.panel-header {
  padding: 1rem 1.25rem;
  background: rgba(44, 62, 80, 0.4);
  border-bottom: 1px solid var(--navy-light);
}

.panel-header h4 {
  margin: 0;
  color: var(--modern-yellow);
  font-size: var(--text-lg);
}

.panel-header small {
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: block;
  margin-top: 0.25rem;
}

/* Structure Display Styles */
.structure-display {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9rem;
}

.structure-lines {
  counter-reset: line-number;
}

.structure-line {
  display: flex;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  cursor: default;
}

.structure-line.is-bullet {
  cursor: pointer;
}

.structure-line.is-bullet:hover {
  background: rgba(255, 255, 255, 0.05);
}

.structure-line.is-header {
  font-weight: bold;
  color: var(--modern-yellow);
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.structure-line.highlighted {
  background: rgba(255, 215, 0, 0.2);
  border-left: 3px solid var(--modern-yellow);
  margin-left: -3px;
}

.line-number {
  color: var(--text-muted);
  min-width: 3em;
  margin-right: 1rem;
  text-align: right;
  user-select: none;
}

.line-content {
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Action Filters in Panel Header */
.modal-filters {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Suggestion Item Updates for Highlighting */
.suggestion-item.highlighted {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--modern-yellow);
  transform: translateX(4px);
}

.suggestion-source {
  display: flex;
  gap: 1rem;
  align-items: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.source-section {
  flex: 1;
}

.source-line {
  color: var(--warm-accent);
  font-weight: 500;
}

/* Modal Actions Bar */
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--navy-light);
}

.action-summary {
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.action-summary span {
  color: var(--modern-yellow);
  font-weight: bold;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
}

/* ===== ORIGINAL ACTION REVIEW MODAL STYLES ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start; /* Changed from center - start modal at top */
  justify-content: center;
  padding-top: 1rem; /* Space just below top bar */
  z-index: 2000;
}

.modal-content {
  background: var(--navy-dark);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem;
  margin: 2rem auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--navy-light);
}

.modal-header h3 {
  margin: 0;
  color: var(--modern-yellow);
  font-size: var(--text-xl);
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s ease;
}

.close-modal:hover {
  color: var(--modern-yellow);
  transform: rotate(90deg);
}

.modal-filters {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(44, 62, 80, 0.3);
  border-radius: var(--border-radius);
}

.modal-filters label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.suggestions-list {
  max-height: 450px;
  overflow-y: auto;
  margin: 1.5rem 0;
  scrollbar-gutter: stable;
  padding-right: 0.5rem;
}

.suggestion-item {
  display: flex;
  align-items: flex-start;
  padding: 1.25rem;
  border: 1px solid var(--navy-light);
  margin-bottom: 0.75rem;
  border-radius: var(--border-radius);
  background: rgba(44, 62, 80, 0.3);
  transition: all 0.2s ease;
}

.suggestion-item:hover {
  background: rgba(44, 62, 80, 0.5);
  transform: translateX(2px);
}

.suggestion-check {
  margin-right: 1rem;
  margin-top: 0.25rem;
}

.suggestion-content {
  flex: 1;
}

.suggestion-title {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.confidence-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.confidence-high {
  background: var(--success);
  color: white;
}

.confidence-medium {
  background: var(--warning);
  color: white;
}

.confidence-low {
  background: var(--error);
  color: white;
}

.editable-title {
  flex: 1;
  color: var(--off-white);
  font-size: var(--text-base);
  line-height: 1.5;
  padding: 0.375rem 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  min-width: 0;
  word-wrap: break-word;
}

.editable-title[contenteditable]:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--navy-light);
}

.editable-title[contenteditable]:focus {
  outline: none;
  background: var(--navy-medium);
  border-color: var(--modern-yellow);
}

.suggestion-source {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-left: 0.25rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--navy-light);
}

/* Action status filter buttons */
.filter-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--slate-gray);
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--off-white);
}

.filter-btn.active {
  background: var(--warm-accent);
  color: var(--off-white);
  border-color: var(--warm-accent);
}

/* ===== ACTION CARDS IN WORKSPACE ===== */
.actions-buttons {
  display: flex;
  gap: 0.75rem;
}

.actions-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: rgba(44, 62, 80, 0.2);
  border-radius: var(--border-radius);
}

.status-filter {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0.25rem;
}

.status-filter:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--off-white);
}

.status-filter.active {
  background: var(--warm-accent);
  color: var(--off-white);
  border-color: var(--warm-accent);
}

.action-card {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: rgba(44, 62, 80, 0.3);
  border: 1px solid var(--navy-light);
  border-radius: var(--border-radius);
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.action-card:hover {
  background: rgba(44, 62, 80, 0.5);
  transform: translateX(2px);
}

.action-status {
  margin-right: 1rem;
}

.status-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: transform 0.2s ease;
  min-height: auto;
  min-width: 2rem;
}

.status-toggle:hover {
  transform: scale(1.2);
  background: none;
}

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

.action-title {
  color: var(--off-white);
  font-size: var(--text-base);
  margin-bottom: 0.5rem;
  padding: 0.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.action-title[contenteditable]:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--navy-light);
}

.action-title[contenteditable]:focus {
  outline: none;
  background: var(--navy-medium);
  border-color: var(--modern-yellow);
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.action-meta span {
  font-size: var(--text-xs);
}

.priority-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 500;
  text-transform: capitalize;
}

.priority-high {
  background: var(--error);
  color: white;
}

.priority-medium {
  background: var(--warning);
  color: white;
}

.priority-low {
  background: var(--slate-gray);
  color: white;
}

.source {
  color: var(--text-muted);
}

.confidence {
  color: var(--text-muted);
  font-weight: 500;
}

.action-actions {
  margin-left: 1rem;
}

.delete-action {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.375rem 0.75rem;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: auto;
}

.delete-action:hover {
  background: var(--error);
  color: white;
  transform: translateY(-1px);
}

/* ===== OPTION A: MODAL ALIGNMENT & SINGLE SCROLL FIX ===== */
/* Lock body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* Align the modal with page's container geometry */
.modal-content {
  /* Replace the modal's own sizing with container width */
  width: auto;
  max-width: var(--container-max);
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);

  /* Single scroll region */
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

/* Don't let inner panels create more scrollbars */
.modal-split-container {
  height: auto;  /* Remove fixed 65vh height */
  max-height: none; /* Remove max-height constraint */
}

.structure-panel-wide,
.structure-content-formatted,
.actions-list-compact {
  overflow: visible !important; /* Disable nested scroll to avoid double bars */
}

/* Actions panel should allow natural flow */
.actions-panel-compact {
  overflow: visible !important;
}

/* Footer stays at bottom naturally without sticky positioning */
.modal-footer {
  background: var(--navy-dark);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}