/* DPIA Application Styles - West Northamptonshire Council Theme */
:root {
  /* WNC Brand Colours */
  --wnc-purple: #6f2282;
  --wnc-purple-dark: #4a1259;
  --wnc-purple-light: #8b3a9f;
  --wnc-teal: #00a5a8;
  --wnc-teal-dark: #007e80;
  --wnc-teal-light: #33b7b9;
  --wnc-dark: #2c2c2c;
  --wnc-green: #3fa535;
  --wnc-orange: #f39200;

  /* Functional colours */
  --primary: var(--wnc-purple);
  --primary-light: var(--wnc-purple-light);
  --primary-dark: var(--wnc-purple-dark);
  --accent: var(--wnc-teal);
  --accent-dark: var(--wnc-teal-dark);
  --success: #276749;
  --success-light: #c6f6d5;
  --warning: #c05621;
  --warning-light: #fefcbf;
  --danger: #c53030;
  --danger-light: #fed7d7;
  --gray-50: #f7fafc;
  --gray-100: #edf2f7;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e0;
  --gray-400: #a0aec0;
  --gray-500: #718096;
  --gray-600: #4a5568;
  --gray-700: #2d3748;
  --gray-800: #1a202c;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

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

html, body {
  min-height: 100vh;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--gray-700);
  background: var(--gray-50);
  margin: 0;
  padding: 0;
}

/* Layout - WNC Header Style */
.app-header {
  background: var(--wnc-purple);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.app-header a {
  color: white;
  text-decoration: none;
  opacity: 0.9;
  font-size: 0.875rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.app-header a:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.7);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

/* Progress Bar */
.progress-container {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--wnc-teal);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 0.5rem;
}

.progress-steps::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gray-200);
  transform: translateY(-50%);
  z-index: 0;
}

.progress-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
  cursor: pointer;
  transition: all 0.2s;
}

.progress-step.active {
  background: var(--wnc-purple);
  color: white;
  transform: scale(1.1);
}

.progress-step.completed {
  background: var(--wnc-teal);
  color: white;
}

.progress-step:hover {
  transform: scale(1.15);
}

.progress-step.has-unread-comments::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--gray-50);
  pointer-events: none;
}
[data-theme="dark"] .progress-step.has-unread-comments::after {
  border-color: #1b1b2f;
}
[data-theme="high-contrast"] .progress-step.has-unread-comments::after {
  background: #b30000;
  border-color: #fcfce0;
  width: 12px;
  height: 12px;
}

.progress-label {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-top: 0.5rem;
}

/* Form Sections */
.wizard-section {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  display: none;
  border-left: 4px solid var(--wnc-purple);
}

.wizard-section.active {
  display: block;
}

.wizard-section h2 {
  color: var(--wnc-purple);
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.35rem;
  border-bottom: 2px solid #f4f1f5;
  padding-bottom: 0.75rem;
}

.wizard-section .section-description {
  color: var(--gray-600);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
  font-size: 0.95rem;
  line-height: 1.6;
}

.form-group .help-text {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
  font-style: italic;
  line-height: 1.6;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: 2px solid var(--wnc-purple);
  outline-offset: 1px;
  border-color: var(--wnc-purple);
}

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

/* Checkbox Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.checkbox-item:hover {
  background: #f9f5fa;
  border-color: var(--wnc-purple-light);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--wnc-purple);
}

.checkbox-item label {
  font-weight: normal;
  margin: 0;
  cursor: pointer;
  font-size: 0.85rem;
}

/* Radio Group */
.radio-group {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}

.radio-group input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--wnc-purple);
}

/* Yes/No Toggle */
.yes-no-group {
  display: inline-flex;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.25rem;
}

.yes-no-group label {
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  font-weight: normal;
  font-size: 0.85rem;
  border-right: 1px solid var(--gray-300);
  transition: background 0.15s;
}

.yes-no-group label:last-child {
  border-right: none;
}

.yes-no-group input[type="radio"] {
  display: none;
}

.yes-no-group label:has(input:checked) {
  background: var(--wnc-purple);
  color: white;
}

/* Risk Matrix */
.risk-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.risk-table th,
.risk-table td {
  border: 1px solid var(--gray-200);
  padding: 0.625rem;
  text-align: left;
}

.risk-table th {
  background: var(--wnc-purple);
  color: white;
  font-weight: 600;
}

.risk-table select {
  width: 70px;
  padding: 0.25rem;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}

.risk-table .risk-score {
  font-weight: 700;
  text-align: center;
  min-width: 40px;
}

.risk-low { background: var(--success-light); color: var(--success); }
.risk-medium { background: var(--warning-light); color: var(--warning); }
.risk-high { background: var(--danger-light); color: var(--danger); }

/* Navigation Buttons */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.btn {
  padding: 0.625rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--wnc-purple);
  color: white;
}

.btn-primary:hover {
  background: var(--wnc-purple-dark);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-success {
  background: var(--wnc-teal);
  color: white;
}

.btn-success:hover {
  background: var(--wnc-teal-dark);
}

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

.btn-danger:hover {
  background: #9b2c2c;
}

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

/* Save Indicator */
.save-indicator {
  font-size: 0.8rem;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

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

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.dashboard-header h2 {
  margin: 0;
  color: var(--wnc-purple);
}

.dpia-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dpia-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.2s;
  border-left: 4px solid var(--wnc-teal);
}

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

.dpia-card-info h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  color: var(--gray-800);
}

.dpia-card-info p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--gray-600);
}

.dpia-card-row {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.dpia-card-date {
  font-size: 0.75rem;
  color: var(--gray-500);
}
.dpia-card-attribution {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.dpia-card-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-draft { background: var(--warning-light); color: var(--warning); }
.status-complete { background: var(--success-light); color: var(--success); }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-600);
}

.empty-state h3 {
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .progress-steps {
    overflow-x: auto;
    gap: 0.25rem;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .wizard-nav {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .dpia-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}


/* Guidance Panel */
.guidance-panel {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--wnc-teal);
  overflow: hidden;
}

.guidance-toggle {
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--wnc-purple);
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guidance-toggle::-webkit-details-marker {
  display: none;
}

.guidance-toggle::before {
  content: '\25B6';
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.guidance-panel[open] .guidance-toggle::before {
  transform: rotate(90deg);
}

.guidance-toggle:hover {
  background: #f9f5fa;
}

.guidance-content {
  padding: 0 1.5rem 1.5rem 1.5rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--gray-700);
  border-top: 1px solid var(--gray-100);
}

.guidance-content h3 {
  color: var(--wnc-purple);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.guidance-content h3:first-child {
  margin-top: 1rem;
}

.guidance-content ol,
.guidance-content ul {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.guidance-content li {
  margin-bottom: 0.4rem;
}


/* Export Modal */
.export-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.export-modal {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}

.export-modal h3 {
  margin-top: 0;
  color: var(--wnc-purple);
}

.export-modal p {
  color: var(--gray-600);
  font-size: 0.9rem;
}

.export-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0 1rem 0;
}

.export-buttons .btn {
  flex: 1;
  justify-content: center;
  padding: 0.75rem 1rem;
}

.export-cancel {
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
}


/* Accessibility */

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--wnc-purple);
  color: white;
  padding: 0.75rem 1.5rem;
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--wnc-teal);
  outline-offset: 2px;
}

/* Visible focus indicators for keyboard users */
:focus-visible {
  outline: 3px solid var(--wnc-teal);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 3px solid var(--wnc-teal);
  outline-offset: 2px;
}

.progress-step:focus-visible {
  outline: 3px solid var(--wnc-teal);
  outline-offset: 2px;
}

/* Ensure links are distinguishable */
a {
  text-decoration-skip-ink: auto;
}

/* Hidden elements for screen readers only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .progress-step {
    transition: none;
  }

  .progress-step:hover {
    transform: none;
  }

  .progress-step.active {
    transform: none;
  }
}

/* High contrast mode support */
@media (forced-colors: active) {
  .progress-step.active,
  .progress-step.completed {
    border: 2px solid ButtonText;
  }

  .btn {
    border: 1px solid ButtonText;
  }

  .wizard-section {
    border: 1px solid CanvasText;
  }
}

/* Minimum touch target size (44x44px) for mobile */
@media (pointer: coarse) {
  .progress-step {
    width: 44px;
    height: 44px;
    font-size: 0.875rem;
  }

  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .checkbox-item {
    min-height: 44px;
  }

  .radio-group label {
    min-height: 44px;
    padding: 0.5rem 0;
  }
}

/* Ensure sufficient colour contrast for text on coloured backgrounds */
.risk-low {
  background: #c6f6d5;
  color: #1a4731;
}

.risk-medium {
  background: #fefcbf;
  color: #744210;
}

.risk-high {
  background: #fed7d7;
  color: #742a2a;
}


/* Fieldset styling for accessible grouped inputs */
fieldset.form-group {
  border: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
}

fieldset.form-group legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--gray-700);
  font-size: 0.9rem;
  padding: 0;
}

/* Scoring Guide */
.scoring-guide {
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.scoring-guide-toggle {
  cursor: pointer;
  font-weight: 600;
  color: var(--wnc-teal);
}

.scoring-guide-content {
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

/* Overall Risk Box */
.overall-risk-box {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius);
}


/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.control-label {
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  font-weight: 500;
}

.header-select {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.header-select option {
  background: var(--gray-800);
  color: white;
}

.size-btn {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.size-btn:hover {
  background: rgba(255,255,255,0.25);
}

.header-link {
  color: white;
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
}

.header-link:hover {
  background: rgba(255,255,255,0.1);
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  background: #1b1b2f;
  color: #eaeaea;
}

[data-theme="dark"] body {
  background: #1b1b2f;
  min-height: 100vh;
}

[data-theme="dark"] .app-header {
  background: #27104e;
}

[data-theme="dark"] .header-select {
  background: #3b2066;
  color: #eaeaea;
  border-color: #6f2282;
}

[data-theme="dark"] .header-select option {
  background: #27104e;
  color: #eaeaea;
}

[data-theme="dark"] .size-btn {
  background: #3b2066;
  color: #eaeaea;
  border-color: #6f2282;
}

[data-theme="dark"] .wizard-section,
[data-theme="dark"] .dpia-card,
[data-theme="dark"] .progress-container,
[data-theme="dark"] .guidance-panel,
[data-theme="dark"] .export-modal {
  background: #262640;
  color: #eaeaea;
  box-shadow: none;
  border-color: #3b3b5c;
}

[data-theme="dark"] .export-modal p,
[data-theme="dark"] .export-modal label {
  color: #d0d0e0;
}

[data-theme="dark"] .export-modal p strong {
  color: #ffffff;
}

[data-theme="dark"] .progress-container {
  border-top-color: #00a5a8;
}

[data-theme="dark"] .wizard-section {
  border-left-color: #6f2282;
}

[data-theme="dark"] .wizard-section h2 {
  color: #c9a4d9;
  border-bottom-color: #3b3b5c;
}

[data-theme="dark"] .wizard-section .section-description {
  color: #b0b0c8;
}

[data-theme="dark"] .dashboard-header h2 {
  color: #c9a4d9;
}

[data-theme="dark"] .guidance-toggle {
  color: #c9a4d9;
}

[data-theme="dark"] .guidance-toggle:hover {
  background: #33334d;
}

[data-theme="dark"] .guidance-content {
  color: #eaeaea;
  border-top-color: #3b3b5c;
}

[data-theme="dark"] .guidance-content h3 {
  color: #c9a4d9;
}

[data-theme="dark"] .form-group label {
  color: #eaeaea;
}

[data-theme="dark"] .form-group .help-text {
  color: #b0b0c8;
}

[data-theme="dark"] .form-group input[type="text"],
[data-theme="dark"] .form-group input[type="email"],
[data-theme="dark"] .form-group input[type="date"],
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select {
  background: #1b1b2f;
  color: #eaeaea;
  border-color: #3b3b5c;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-group select:focus {
  border-color: #00a5a8;
  outline-color: #00a5a8;
}

[data-theme="dark"] .checkbox-item {
  border-color: #3b3b5c;
  color: #eaeaea;
}

[data-theme="dark"] .checkbox-item:hover {
  background: #33334d;
  border-color: #6f2282;
}

[data-theme="dark"] .checkbox-item label {
  color: #eaeaea;
}

[data-theme="dark"] .checkbox-item input[type="checkbox"],
[data-theme="dark"] .radio-group input[type="radio"] {
  color-scheme: dark;
  accent-color: #ffffff;
}

[data-theme="dark"] select {
  color-scheme: dark;
}

[data-theme="dark"] .risk-table select {
  color-scheme: dark;
}

[data-theme="dark"] .header-select {
  color-scheme: dark;
}

[data-theme="dark"] input[type="date"] {
  color-scheme: light;
}

/* Date picker icon visibility */
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) !important;
  cursor: pointer;
  opacity: 1;
}

[data-theme="dark"] input[type="date"]::-webkit-inner-spin-button {
  filter: invert(1) !important;
}

[data-theme="high-contrast"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none !important;
}

[data-theme="dark"] .dpia-card {
  border-left-color: #00a5a8;
}

[data-theme="dark"] .dpia-card-info h3 {
  color: #eaeaea;
}

[data-theme="dark"] .dpia-card-info p {
  color: #b0b0c8;
}

[data-theme="dark"] .empty-state,
[data-theme="dark"] .empty-state h3 {
  color: #b0b0c8;
}

[data-theme="dark"] .save-indicator {
  color: #b0b0c8;
}

[data-theme="dark"] .progress-step {
  background: #33334d;
  color: #b0b0c8;
  border-color: transparent;
}

[data-theme="dark"] .progress-step.active {
  background: #6f2282;
  color: #fff;
}

[data-theme="dark"] .progress-step.completed {
  background: #00a5a8;
  color: #fff;
}

[data-theme="dark"] .progress-steps::before {
  background: #3b3b5c;
}

[data-theme="dark"] .progress-label {
  color: #b0b0c8;
}

[data-theme="dark"] .risk-table th {
  background: #6f2282;
  color: #fff;
}

[data-theme="dark"] .risk-table td {
  border-color: #444;
  color: #eaeaea;
  background: #1e1e34;
}

[data-theme="dark"] .risk-table select,
[data-theme="dark"] .risk-table input[type="text"] {
  background: #262640;
  color: #eaeaea;
  border-color: #555;
}

[data-theme="dark"] .btn-primary {
  background: #6f2282;
  color: #fff;
}

[data-theme="dark"] .btn-primary:hover {
  background: #8b3a9f;
}

[data-theme="dark"] .btn-secondary {
  background: #33334d;
  color: #eaeaea;
}

[data-theme="dark"] .btn-secondary:hover {
  background: #3b3b5c;
}

[data-theme="dark"] .btn-success {
  background: #00a5a8;
  color: #fff;
}

[data-theme="dark"] .btn-danger {
  background: #c53030;
  color: #fff;
}

[data-theme="dark"] .wizard-nav {
  border-top-color: #3b3b5c;
}

[data-theme="dark"] .export-modal {
  background: #262640;
}

[data-theme="dark"] .export-modal h3 {
  color: #c9a4d9;
}

[data-theme="dark"] .export-modal p {
  color: #b0b0c8;
}

[data-theme="dark"] .status-draft {
  background: #3d2e08;
  color: #f5c542;
}

[data-theme="dark"] .status-complete {
  background: #0a3322;
  color: #5ee0a0;
}

[data-theme="dark"] .skip-link:focus {
  outline-color: #00a5a8;
}

[data-theme="dark"] fieldset.form-group legend {
  color: #eaeaea;
}

[data-theme="dark"] .radio-group label {
  color: #eaeaea;
}

[data-theme="dark"] .yes-no-group label {
  color: #eaeaea;
  border-color: #444;
}

[data-theme="dark"] .guidance-panel {
  border-color: #444;
}

[data-theme="dark"] .progress-container {
  border-color: #444;
}

/* Ensure all text in dark mode is visible */
[data-theme="dark"] details summary {
  color: #c9a4d9;
}

[data-theme="dark"] details[style] summary,
[data-theme="dark"] [style*="font-size"] {
  color: #eaeaea !important;
}

[data-theme="dark"] [style*="background:var(--gray-50)"],
[data-theme="dark"] [style*="background:var(--gray"] {
  background: #262640 !important;
  color: #eaeaea !important;
}

[data-theme="dark"] [style*="color:var(--accent)"] {
  color: #33b7b9 !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] td,
[data-theme="dark"] li,
[data-theme="dark"] strong {
  color: #eaeaea;
}

[data-theme="dark"] .scoring-guide-toggle {
  color: #33b7b9;
}

[data-theme="dark"] .scoring-guide-content {
  background: #1e1e34;
  color: #eaeaea;
}

[data-theme="dark"] .overall-risk-box {
  background: #1e1e34;
  color: #eaeaea;
}

[data-theme="dark"] .overall-risk-box strong {
  color: #eaeaea;
}

[data-theme="dark"] .risk-table .risk-score {
  color: #ffffff;
}

[data-theme="dark"] .risk-table .risk-low {
  background: #166534;
  color: #ffffff;
}

[data-theme="dark"] .risk-table .risk-medium {
  background: #92400e;
  color: #ffffff;
}

[data-theme="dark"] .risk-table .risk-high {
  background: #991b1b;
  color: #ffffff;
}

[data-theme="dark"] .risk-low {
  background: #166534;
  color: #ffffff;
}

[data-theme="dark"] .risk-medium {
  background: #92400e;
  color: #ffffff;
}

[data-theme="dark"] .risk-high {
  background: #991b1b;
  color: #ffffff;
}

/* ===== HIGH CONTRAST MODE ===== */
/* Matches Windows "Yellowish Moderate Contrast" scheme */
[data-theme="high-contrast"] {
  background: #fcfce0;
  color: #000000;
}

[data-theme="high-contrast"] body {
  background: #fcfce0;
  min-height: 100vh;
}

[data-theme="high-contrast"] .app-header {
  background: #000000;
  color: #fcfce0;
  border-bottom: 3px solid #1a0080;
}

[data-theme="high-contrast"] .header-select {
  background: #fcfce0;
  color: #000000;
  border: 2px solid #000000;
}

[data-theme="high-contrast"] .header-select option {
  background: #fcfce0;
  color: #000000;
}

[data-theme="high-contrast"] .size-btn {
  background: #000000;
  color: #fcfce0;
  border: 2px solid #fcfce0;
}

[data-theme="high-contrast"] .size-btn:hover {
  background: #1a0080;
}

[data-theme="high-contrast"] .control-label {
  color: #fcfce0;
}

[data-theme="high-contrast"] .header-link {
  color: #fcfce0;
  border-color: #fcfce0;
}

[data-theme="high-contrast"] .wizard-section,
[data-theme="high-contrast"] .dpia-card,
[data-theme="high-contrast"] .progress-container,
[data-theme="high-contrast"] .guidance-panel,
[data-theme="high-contrast"] .export-modal {
  background: #fcfce0;
  color: #000000;
  border: 2px solid #000000;
  box-shadow: none;
}

[data-theme="high-contrast"] .progress-container {
  border-top: 4px solid #1a0080;
}

[data-theme="high-contrast"] .wizard-section {
  border-left: 5px solid #1a0080;
}

[data-theme="high-contrast"] .wizard-section h2 {
  color: #000000;
  border-bottom: 2px solid #000000;
}

[data-theme="high-contrast"] .wizard-section .section-description {
  color: #3d0000;
}

[data-theme="high-contrast"] .dashboard-header h2 {
  color: #000000;
}

[data-theme="high-contrast"] .guidance-toggle {
  color: #1a0080;
  font-weight: 700;
}

[data-theme="high-contrast"] .guidance-toggle:hover {
  background: #f0f0c0;
}

[data-theme="high-contrast"] .guidance-content {
  color: #000000;
  border-top: 2px solid #000000;
}

[data-theme="high-contrast"] .guidance-content h3 {
  color: #000000;
}

[data-theme="high-contrast"] .form-group label {
  color: #000000;
  font-weight: 700;
}

[data-theme="high-contrast"] .form-group .help-text {
  color: #3d0000;
}

[data-theme="high-contrast"] .form-group input[type="text"],
[data-theme="high-contrast"] .form-group input[type="email"],
[data-theme="high-contrast"] .form-group input[type="date"],
[data-theme="high-contrast"] .form-group textarea,
[data-theme="high-contrast"] .form-group select {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

[data-theme="high-contrast"] .form-group input:focus,
[data-theme="high-contrast"] .form-group textarea:focus,
[data-theme="high-contrast"] .form-group select:focus {
  outline: 3px solid #1a0080;
  border-color: #1a0080;
}

[data-theme="high-contrast"] .checkbox-item {
  border: 2px solid #000000;
  color: #000000;
  background: #ffffff;
}

[data-theme="high-contrast"] .checkbox-item:hover {
  background: #f0f0c0;
}

[data-theme="high-contrast"] .checkbox-item label {
  color: #000000;
}

[data-theme="high-contrast"] .btn-primary {
  background: #000000;
  color: #fcfce0;
  border: 2px solid #000000;
  font-weight: 700;
}

[data-theme="high-contrast"] .btn-primary:hover {
  background: #1a0080;
}

[data-theme="high-contrast"] .btn-success {
  background: #1a0080;
  color: #fcfce0;
  border: 2px solid #1a0080;
  font-weight: 700;
}

[data-theme="high-contrast"] .btn-success:hover {
  background: #000050;
}

[data-theme="high-contrast"] .btn-danger {
  background: #3d0000;
  color: #fcfce0;
  border: 2px solid #3d0000;
  font-weight: 700;
}

[data-theme="high-contrast"] .btn-danger:hover {
  background: #600000;
}

[data-theme="high-contrast"] .btn-secondary {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  font-weight: 700;
}

[data-theme="high-contrast"] .btn-secondary:hover {
  background: #f0f0c0;
}

[data-theme="high-contrast"] .progress-step {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

[data-theme="high-contrast"] .progress-step.active {
  background: #1a0080;
  color: #fcfce0;
  border-color: #1a0080;
}

[data-theme="high-contrast"] .progress-step.completed {
  background: #000000;
  color: #fcfce0;
  border-color: #000000;
}

[data-theme="high-contrast"] .progress-steps::before {
  background: #000000;
}

[data-theme="high-contrast"] .progress-label {
  color: #000000;
}

[data-theme="high-contrast"] .dpia-card {
  border-left: 5px solid #1a0080;
}

[data-theme="high-contrast"] .dpia-card-info h3 {
  color: #000000;
}

[data-theme="high-contrast"] .dpia-card-info p {
  color: #3d0000;
}

[data-theme="high-contrast"] .risk-table th {
  background: #000000;
  color: #fcfce0;
  font-weight: 700;
}

[data-theme="high-contrast"] .risk-table td {
  border: 2px solid #000000;
  color: #000000;
}

[data-theme="high-contrast"] .risk-table select,
[data-theme="high-contrast"] .risk-table input[type="text"] {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

[data-theme="high-contrast"] .wizard-nav {
  border-top: 2px solid #000000;
}

[data-theme="high-contrast"] .save-indicator {
  color: #3d0000;
}

[data-theme="high-contrast"] .empty-state,
[data-theme="high-contrast"] .empty-state h3 {
  color: #000000;
}

[data-theme="high-contrast"] .status-badge {
  border: 2px solid #000000;
  font-weight: 700;
}

[data-theme="high-contrast"] .status-draft {
  background: #fcfce0;
  color: #3d0000;
  border-color: #3d0000;
}

[data-theme="high-contrast"] .status-complete {
  background: #fcfce0;
  color: #000000;
  border-color: #000000;
}

[data-theme="high-contrast"] .export-modal {
  background: #fcfce0;
  border: 3px solid #000000;
}

[data-theme="high-contrast"] .export-modal h3 {
  color: #000000;
}

[data-theme="high-contrast"] .export-modal p {
  color: #000000;
}

[data-theme="high-contrast"] .skip-link:focus {
  outline-color: #1a0080;
}

[data-theme="high-contrast"] a {
  color: #1a0080;
}

[data-theme="high-contrast"] fieldset.form-group legend {
  color: #000000;
  font-weight: 700;
}

[data-theme="high-contrast"] .radio-group label {
  color: #000000;
}

[data-theme="high-contrast"] .yes-no-group label {
  color: #000000;
  border-color: #000000;
}

[data-theme="high-contrast"] .scoring-guide-toggle {
  color: #1a0080;
  font-weight: 700;
}

[data-theme="high-contrast"] .scoring-guide-content {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

[data-theme="high-contrast"] .overall-risk-box {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

/* Responsive header controls */
@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-controls {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* Expandable Mitigation Textareas */
.mitigation-input {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.4rem;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  resize: none;
  min-height: 32px;
  max-height: 32px;
  overflow: hidden;
  font-family: inherit;
  line-height: 1.5;
  transition: all 0.25s ease;
}

.mitigation-input:focus,
.mitigation-input.expanded {
  position: relative;
  z-index: 10;
  min-height: 150px;
  max-height: 300px;
  overflow: auto;
  resize: vertical;
  width: 280px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] .mitigation-input {
  background: #262640;
  color: #eaeaea;
  border-color: #555;
}

[data-theme="dark"] .mitigation-input:focus,
[data-theme="dark"] .mitigation-input.expanded {
  background: #1e1e34;
  border-color: #00a5a8;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

[data-theme="high-contrast"] .mitigation-input {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

[data-theme="high-contrast"] .mitigation-input:focus,
[data-theme="high-contrast"] .mitigation-input.expanded {
  border-color: #1a0080;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ===== Login & Auth ===== */
.login-card { max-width:450px; margin:3rem auto; background:white; border-radius:var(--radius); padding:2.5rem; box-shadow:var(--shadow-md); border-top:4px solid var(--wnc-purple); }
.login-card h2 { color:var(--wnc-purple); margin-top:0; margin-bottom:0.5rem; }
[data-theme="dark"] .login-card { background:#262640; color:#eaeaea; }
[data-theme="high-contrast"] .login-card { background:#fcfce0; color:#000; border:2px solid #000; }

/* User bar */
.user-bar { display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem; padding:0.5rem 1rem; background:var(--gray-100); border-radius:var(--radius); font-size:0.85rem; }
.user-bar .user-name { font-weight:600; color:var(--wnc-purple); }
.user-bar .user-role { color:var(--gray-600); margin-left:0.25rem; }
.btn-logout { background:transparent; border:1px solid var(--gray-300); color:var(--gray-600); padding:0.3rem 0.75rem; border-radius:var(--radius); font-size:0.8rem; cursor:pointer; }
.btn-logout:hover { background:var(--danger-light); border-color:var(--danger); color:var(--danger); }
[data-theme="dark"] .user-bar { background:#1e1e34; }
[data-theme="dark"] .user-bar .user-name { color:#c9a4d9; }
[data-theme="dark"] .user-bar .user-role { color:#b0b0c8; }
[data-theme="dark"] .btn-logout { border-color:#444; color:#b0b0c8; }
[data-theme="high-contrast"] .user-bar {
  background: #fcfce0;
  border: 2px solid #000;
}
[data-theme="high-contrast"] .user-bar .user-name {
  color: #1a0080;
  font-weight: 700;
}
[data-theme="high-contrast"] .user-bar .user-role {
  color: #000;
  font-weight: 700;
}
[data-theme="high-contrast"] .btn-logout {
  background: #fcfce0;
  border: 2px solid #000;
  color: #000;
  font-weight: 700;
}
[data-theme="high-contrast"] .btn-logout:hover,
[data-theme="high-contrast"] .btn-logout:focus {
  background: #000;
  color: #fcfce0;
  border-color: #000;
}

/* Status badges */
.status-submitted { background:#e0e7ff; color:#3730a3; }
.status-in-review { background:#fef3c7; color:#92400e; }
.status-approved { background:#d1fae5; color:#065f46; }
.status-rejected { background:#fee2e2; color:#991b1b; }
[data-theme="dark"] .status-submitted { background:#1e1b4b; color:#a5b4fc; }
[data-theme="dark"] .status-in-review { background:#451a03; color:#fcd34d; }
[data-theme="dark"] .status-approved { background:#022c22; color:#6ee7b7; }
[data-theme="dark"] .status-rejected { background:#450a0a; color:#fca5a5; }

/* Admin status select */
.status-select { padding:0.3rem 0.5rem; border:1px solid var(--gray-300); border-radius:var(--radius); font-size:0.8rem; cursor:pointer; }
[data-theme="dark"] .status-select { background:#262640; color:#eaeaea; border-color:#444; }

/* Read-only notice */
.readonly-notice { background:var(--warning-light); color:var(--warning); padding:0.75rem 1rem; border-radius:var(--radius); margin-bottom:1rem; font-weight:600; text-align:center; }
[data-theme="dark"] .readonly-notice { background:#3d2e08; color:#f5c542; }

/* Validation Styles */
.step-validation-error {
  background: #fee2e2;
  border-left: 4px solid #c53030;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #742a2a;
}

.step-validation-error strong {
  display: block;
  margin-bottom: 0.4rem;
  color: #742a2a;
}

.step-validation-error ul {
  margin: 0;
  padding-left: 1.25rem;
}

.step-validation-error li {
  margin-bottom: 0.2rem;
}

.validation-modal {
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  text-align: left;
}

.validation-modal h3 {
  color: #c53030;
}

.validation-errors {
  margin-top: 0.75rem;
}

.validation-section {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.validation-section:last-child {
  border-bottom: none;
}

.validation-section strong {
  color: var(--wnc-purple);
  display: block;
  margin-bottom: 0.3rem;
}

.validation-section ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--gray-700);
  font-size: 0.85rem;
}

.validation-section li {
  margin-bottom: 0.2rem;
}

[data-theme="dark"] .step-validation-error {
  background: #450a0a;
  color: #fca5a5;
  border-left-color: #f87171;
}

[data-theme="dark"] .step-validation-error strong {
  color: #fca5a5;
}

[data-theme="dark"] .validation-modal h3 {
  color: #fca5a5;
}

[data-theme="dark"] .validation-section strong {
  color: #c9a4d9;
}

[data-theme="dark"] .validation-section ul {
  color: #eaeaea;
}

[data-theme="dark"] .validation-section {
  border-bottom-color: #3b3b5c;
}

[data-theme="high-contrast"] .step-validation-error {
  background: #fcfce0;
  border-left-color: #000;
  color: #000;
}

/* Login Tabs */
.login-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.5rem;
}

.login-tab {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: inherit;
}

.login-tab:hover {
  color: var(--wnc-purple);
}

.login-tab.active {
  color: var(--wnc-purple);
  border-bottom-color: var(--wnc-purple);
}

/* Auth error message */
.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border-left: 3px solid var(--danger);
}

[data-theme="dark"] .login-tabs {
  border-bottom-color: #3b3b5c;
}

[data-theme="dark"] .login-tab {
  color: #999;
}

[data-theme="dark"] .login-tab.active {
  color: #c9a4d9;
  border-bottom-color: #c9a4d9;
}

[data-theme="dark"] .auth-error {
  background: #450a0a;
  color: #fca5a5;
  border-left-color: #f87171;
}

[data-theme="high-contrast"] .login-tab.active {
  color: #1a0080;
  border-bottom-color: #1a0080;
}

/* Password field with show/hide toggle */
.password-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

.password-wrapper input {
  width: 100%;
  padding-right: 2.75rem;
  box-sizing: border-box;
}

.password-wrapper input[type="text"],
.password-wrapper input[type="password"] {
  width: 100%;
  min-height: 40px;
  padding: 0.625rem 2.75rem 0.625rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  box-sizing: border-box;
}

.password-wrapper input[type="text"]:focus,
.password-wrapper input[type="password"]:focus {
  outline: 2px solid var(--wnc-purple);
  outline-offset: 1px;
  border-color: var(--wnc-purple);
}

[data-theme="dark"] .password-wrapper input[type="text"],
[data-theme="dark"] .password-wrapper input[type="password"] {
  background: #1b1b2f;
  color: #eaeaea;
  border-color: #3b3b5c;
}

[data-theme="dark"] .password-wrapper input[type="text"]:focus,
[data-theme="dark"] .password-wrapper input[type="password"]:focus {
  outline-color: #00a5a8;
  border-color: #00a5a8;
}

[data-theme="high-contrast"] .password-wrapper input[type="text"],
[data-theme="high-contrast"] .password-wrapper input[type="password"] {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
}

/* Hide the browser's built-in password reveal button so it doesn't duplicate our custom eye toggle. */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

.password-toggle {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s;
  line-height: 1;
}

.password-toggle:hover {
  color: var(--wnc-purple);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--wnc-teal);
  outline-offset: 2px;
}

/* Password strength meter */
.password-strength {
  margin-top: 0.5rem;
}

.strength-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0%;
}

.strength-label {
  font-size: 0.75rem;
  font-weight: 600;
}

[data-theme="dark"] .password-toggle {
  color: #999;
}

[data-theme="dark"] .password-toggle:hover {
  color: #c9a4d9;
}

[data-theme="dark"] .strength-bar {
  background: #3b3b5c;
}

/* ===== VALIDATION FIELD HIGHLIGHT ===== */
.form-group.field-invalid {
  position: relative;
}
.form-group.field-invalid > label,
.form-group.field-invalid > legend {
  color: #c53030;
}
.form-group.field-invalid input[type="text"],
.form-group.field-invalid input[type="date"],
.form-group.field-invalid input[type="email"],
.form-group.field-invalid textarea,
.form-group.field-invalid select {
  border-color: #c53030;
  box-shadow: 0 0 0 2px rgba(197, 48, 48, 0.15);
}
.form-group.field-invalid .checkbox-group,
.form-group.field-invalid .checkbox-grid,
.form-group.field-invalid .radio-group {
  outline: 2px solid #c53030;
  outline-offset: 4px;
  border-radius: var(--radius);
}
[data-theme="dark"] .form-group.field-invalid > label,
[data-theme="dark"] .form-group.field-invalid > legend {
  color: #ff8a8a;
}
[data-theme="dark"] .form-group.field-invalid input[type="text"],
[data-theme="dark"] .form-group.field-invalid input[type="date"],
[data-theme="dark"] .form-group.field-invalid input[type="email"],
[data-theme="dark"] .form-group.field-invalid textarea,
[data-theme="dark"] .form-group.field-invalid select {
  border-color: #ff8a8a;
  box-shadow: 0 0 0 2px rgba(255, 138, 138, 0.25);
}
[data-theme="high-contrast"] .form-group.field-invalid > label,
[data-theme="high-contrast"] .form-group.field-invalid > legend {
  color: #ffff00;
  background: #000000;
  padding: 2px 6px;
}
[data-theme="high-contrast"] .form-group.field-invalid input[type="text"],
[data-theme="high-contrast"] .form-group.field-invalid input[type="date"],
[data-theme="high-contrast"] .form-group.field-invalid input[type="email"],
[data-theme="high-contrast"] .form-group.field-invalid textarea,
[data-theme="high-contrast"] .form-group.field-invalid select {
  border: 3px solid #ffff00;
}

/* Modal jump-to-section buttons */
.validation-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.validation-jump {
  background: none;
  border: none;
  color: var(--wnc-teal, #007a87);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  text-decoration: underline;
}
.validation-jump:hover,
.validation-jump:focus {
  color: #005a63;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ===== FULL-WIDTH TEXTAREA RESIZE HANDLE ===== */
.textarea-resize-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.textarea-resize-wrap > textarea {
  resize: none;       /* hide the native corner grabber */
  display: block;
  width: 100%;
  margin-bottom: 0;
}
.textarea-resize-handle {
  height: 10px;
  width: 100%;
  cursor: ns-resize;
  background:
    linear-gradient(to bottom, transparent 3px, var(--gray-300) 3px, var(--gray-300) 4px, transparent 4px, transparent 6px, var(--gray-300) 6px, var(--gray-300) 7px, transparent 7px);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  margin-top: -2px;   /* sit just under the textarea, over its border */
  transition: background-color 0.15s;
  touch-action: none; /* prevent scroll during drag on touch devices */
}
.textarea-resize-handle:hover,
.textarea-resize-wrap.resizing .textarea-resize-handle {
  background:
    linear-gradient(to bottom, transparent 3px, var(--wnc-purple) 3px, var(--wnc-purple) 4px, transparent 4px, transparent 6px, var(--wnc-purple) 6px, var(--wnc-purple) 7px, transparent 7px);
}
[data-theme="dark"] .textarea-resize-handle {
  background:
    linear-gradient(to bottom, transparent 3px, #4a4a68 3px, #4a4a68 4px, transparent 4px, transparent 6px, #4a4a68 6px, #4a4a68 7px, transparent 7px);
}
[data-theme="dark"] .textarea-resize-handle:hover,
[data-theme="dark"] .textarea-resize-wrap.resizing .textarea-resize-handle {
  background:
    linear-gradient(to bottom, transparent 3px, #c9a4d9 3px, #c9a4d9 4px, transparent 4px, transparent 6px, #c9a4d9 6px, #c9a4d9 7px, transparent 7px);
}
[data-theme="high-contrast"] .textarea-resize-handle {
  background:
    linear-gradient(to bottom, transparent 3px, #000 3px, #000 4px, transparent 4px, transparent 6px, #000 6px, #000 7px, transparent 7px);
}
[data-theme="high-contrast"] .textarea-resize-handle:hover,
[data-theme="high-contrast"] .textarea-resize-wrap.resizing .textarea-resize-handle {
  background:
    linear-gradient(to bottom, transparent 3px, #1a0080 3px, #1a0080 4px, transparent 4px, transparent 6px, #1a0080 6px, #1a0080 7px, transparent 7px);
}

/* ===== AUTH VERIFICATION GATE ===== */
/* Hide page content until the server has confirmed the session, so a tampered
   sessionStorage entry cannot flash privileged UI before the redirect. */
html.auth-pending body {
  visibility: hidden;
}

/* ===== REQUIRED / OPTIONAL FIELD MARKERS ===== */
.required-marker {
  color: #c53030;
  font-weight: 700;
  margin-left: 0.15rem;
  font-size: 1em;
}
.optional-marker {
  color: var(--gray-500);
  font-weight: 400;
  font-style: italic;
  font-size: 0.85em;
  margin-left: 0.35rem;
}
.field-legend {
  background: var(--gray-50);
  border-left: 4px solid var(--wnc-teal);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  margin: 0 0 1.25rem 0;
  font-size: 0.9rem;
  color: var(--gray-700);
  line-height: 1.55;
}
.field-legend strong {
  display: inline-block;
  margin-bottom: 0.25rem;
  color: var(--wnc-purple);
}
[data-theme="dark"] .field-legend strong {
  color: #c9a4d9;
}
[data-theme="high-contrast"] .field-legend strong {
  color: #000;
}
.field-legend .required-marker,
.field-legend .optional-marker {
  margin-left: 0;
  margin-right: 0.25rem;
}

[data-theme="dark"] .required-marker {
  color: #ff8a8a;
}
[data-theme="dark"] .optional-marker {
  color: #a5a5c0;
}
[data-theme="dark"] .field-legend {
  background: #1e1e34;
  border-left-color: #00a5a8;
  color: #eaeaea;
}

[data-theme="high-contrast"] .required-marker {
  color: #000;
  background: #ffff00;
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 900;
}
[data-theme="high-contrast"] .optional-marker {
  color: #000;
  background: #fcfce0;
  border: 1px solid #000;
  padding: 0 3px;
  border-radius: 3px;
  font-style: normal;
  font-weight: 700;
}
[data-theme="high-contrast"] .field-legend {
  background: #fcfce0;
  border: 2px solid #000;
  border-left-width: 6px;
  color: #000;
}

/* ===== SUBMIT-BLOCKED STATE ===== */
.btn-submit-disabled {
  background: var(--gray-300);
  color: var(--gray-600);
  cursor: not-allowed;
  border: 1px solid var(--gray-400);
}
.btn-submit-disabled:hover {
  background: var(--gray-300);
  color: var(--gray-600);
}
.dpia-blocker {
  display: block;
  margin-top: 0.5rem;
  color: var(--danger);
  font-weight: 600;
}
.dpia-ready {
  display: block;
  margin-top: 0.5rem;
  color: var(--success);
  font-weight: 600;
}

[data-theme="dark"] .btn-submit-disabled {
  background: #3b3b5c;
  color: #b0b0c8;
  border-color: #4a4a68;
}
[data-theme="dark"] .btn-submit-disabled:hover {
  background: #3b3b5c;
  color: #b0b0c8;
}
[data-theme="dark"] .dpia-blocker {
  color: #ff8a8a;
}
[data-theme="dark"] .dpia-ready {
  color: #5ee0a0;
}

[data-theme="high-contrast"] .btn-submit-disabled {
  background: #fcfce0;
  color: #000;
  border: 2px solid #000;
  font-weight: 700;
  text-decoration: line-through;
}
[data-theme="high-contrast"] .dpia-blocker {
  color: #3d0000;
  background: #fcfce0;
  border: 1px solid #3d0000;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
}
[data-theme="high-contrast"] .dpia-ready {
  color: #000;
  background: #fcfce0;
  border: 1px solid #000;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
}

/* ===== ADMIN CHANGE LOG BANNER ===== */
.admin-changes-banner {
  background: #fef5e7;
  border-left: 4px solid var(--wnc-orange);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem 0;
  color: var(--gray-700);
}
.admin-changes-banner details summary {
  cursor: pointer;
  font-size: 0.95rem;
  list-style: none;
  outline: none;
}
.admin-changes-banner details summary::-webkit-details-marker { display: none; }
.admin-changes-banner details summary::before {
  content: '\25B6';
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.7rem;
  transition: transform 0.15s;
}
.admin-changes-banner details[open] summary::before {
  transform: rotate(90deg);
}
.admin-changes-list {
  list-style: none;
  padding: 0.75rem 0 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.admin-change-row {
  background: #fffdf8;
  border: 1px solid #f0e0c0;
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
}
.admin-change-where {
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: var(--gray-700);
}
.admin-change-diff {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-change-old {
  color: #9b2c2c;
  background: #fed7d7;
  padding: 1px 5px;
  border-radius: 3px;
}
.admin-change-new {
  color: #276749;
  background: #c6f6d5;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
}
.admin-change-arrow { color: var(--gray-500); }
.admin-change-meta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--gray-600);
}

.admin-edits-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.5rem;
  background: var(--wnc-orange);
  color: white;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}

[data-theme="dark"] .admin-changes-banner {
  background: #3a2a10;
  border-left-color: #f39200;
  color: #eaeaea;
}
[data-theme="dark"] .admin-change-row {
  background: #2b1f0f;
  border-color: #5c4020;
}
[data-theme="dark"] .admin-change-where {
  color: #eaeaea;
}
[data-theme="dark"] .admin-change-old {
  color: #fed7d7;
  background: #4a1a1a;
}
[data-theme="dark"] .admin-change-new {
  color: #c6f6d5;
  background: #14432a;
}
[data-theme="dark"] .admin-change-meta {
  color: #b0b0c8;
}
[data-theme="dark"] .admin-edits-badge {
  background: #f39200;
  color: #1b1b2f;
}

[data-theme="high-contrast"] .admin-changes-banner {
  background: #fcfce0;
  border: 2px solid #000;
  border-left-width: 6px;
  color: #000;
}
[data-theme="high-contrast"] .admin-change-row {
  background: #fcfce0;
  border: 2px solid #000;
}
[data-theme="high-contrast"] .admin-change-old {
  color: #000;
  background: #ffffff;
  border: 2px solid #000;
  font-weight: 700;
}
[data-theme="high-contrast"] .admin-change-new {
  color: #000;
  background: #ffffff;
  border: 2px solid #1a0080;
  font-weight: 700;
}
[data-theme="high-contrast"] .admin-edits-badge {
  background: #000;
  color: #fcfce0;
  border: 2px solid #1a0080;
}
[data-theme="high-contrast"] .admin-change-where {
  color: #000;
  font-weight: 700;
}
[data-theme="high-contrast"] .admin-change-arrow {
  color: #000;
  font-weight: 700;
}
[data-theme="high-contrast"] .admin-change-meta,
[data-theme="high-contrast"] .admin-change-meta small {
  color: #000;
  font-weight: 600;
}

/* ===== PER-FIELD COMMENTS ===== */
.field-comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  margin-left: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.2;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  border-radius: 999px;
  cursor: pointer;
  vertical-align: middle;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.field-comment-btn:hover {
  background: #f9f5fa;
  border-color: var(--wnc-purple-light);
  color: var(--wnc-purple);
}
.field-comment-btn.has-comments {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  font-weight: 700;
}
.field-comment-btn.has-comments:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: white;
}
.field-comment-count { font-weight: 700; }

.comments-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.5rem;
  background: var(--wnc-teal);
  color: white;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}

[data-theme="dark"] .field-comment-btn {
  background: #33334d;
  color: #eaeaea;
  border-color: #444;
}
[data-theme="dark"] .field-comment-btn:hover {
  background: #3b3b5c;
  border-color: #c9a4d9;
  color: #c9a4d9;
}
[data-theme="dark"] .field-comment-btn.has-comments {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
[data-theme="dark"] .comments-badge { background: #00a5a8; color: #fff; }

[data-theme="high-contrast"] .field-comment-btn {
  background: #fcfce0;
  color: #000;
  border: 2px solid #000;
  font-weight: 700;
}
[data-theme="high-contrast"] .field-comment-btn.has-comments {
  background: #000;
  color: #fcfce0;
  border-color: #1a0080;
}
[data-theme="high-contrast"] .comments-badge {
  background: #000;
  color: #fcfce0;
  border: 2px solid #1a0080;
}

/* ===== FIELD COMMENTS SIDE PANEL ===== */
.field-comments-side-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 380px;
  max-width: 92vw;
  background: white;
  border-left: 1px solid var(--gray-200);
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.08);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
}
.field-comments-side-panel.open {
  transform: translateX(0);
}
.field-comments-side-panel[hidden] { display: none; }

.fcsp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--wnc-purple);
  color: white;
  border-bottom: 1px solid var(--wnc-purple-dark);
}
.fcsp-title { display: flex; flex-direction: column; line-height: 1.15; }
.fcsp-eyebrow { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.fcsp-field-label { font-size: 1rem; font-weight: 600; }
.fcsp-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}
.fcsp-close:hover { background: rgba(255,255,255,0.15); }
.fcsp-close:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.fcsp-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.fcsp-thread {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.fcsp-empty {
  color: var(--gray-600);
  font-style: italic;
  font-size: 0.9rem;
  margin: 0;
}

.fcsp-comment {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
}
.fcsp-comment.is-admin { border-left: 3px solid var(--wnc-purple); }
.fcsp-comment.is-user  { border-left: 3px solid var(--wnc-teal); }

.fcsp-comment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.fcsp-comment-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--gray-800);
}
.fcsp-by { color: var(--gray-500); font-size: 0.8rem; }
.fcsp-role {
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: white;
}
.fcsp-role.role-admin { background: var(--wnc-purple); }
.fcsp-role.role-user  { background: var(--wnc-teal); }
.fcsp-when { color: var(--gray-500); font-size: 0.72rem; white-space: nowrap; margin-top: 2px; }
.fcsp-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--gray-800);
  word-wrap: break-word;
}

.fcsp-form {
  border-top: 1px solid var(--gray-200);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.fcsp-form textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 70px;
}
.fcsp-form textarea:focus {
  outline: 2px solid var(--wnc-purple);
  border-color: var(--wnc-purple);
}
.fcsp-post-btn {
  align-self: flex-end;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

[data-theme="dark"] .field-comments-side-panel {
  background: #1e1e34;
  border-left-color: #3b3b5c;
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .fcsp-head {
  background: #27104e;
  border-bottom-color: #3b3b5c;
}
[data-theme="dark"] .fcsp-comment {
  background: #262640;
  border-color: #3b3b5c;
}
[data-theme="dark"] .fcsp-comment.is-admin { border-left-color: #c9a4d9; }
[data-theme="dark"] .fcsp-comment.is-user  { border-left-color: #33b7b9; }
[data-theme="dark"] .fcsp-comment-title { color: #eaeaea; }
[data-theme="dark"] .fcsp-by { color: #b0b0c8; }
[data-theme="dark"] .fcsp-when { color: #b0b0c8; }
[data-theme="dark"] .fcsp-text { color: #eaeaea; }
[data-theme="dark"] .fcsp-empty { color: #b0b0c8; }
[data-theme="dark"] .fcsp-role.role-admin { background: #c9a4d9; color: #1b1b2f; }
[data-theme="dark"] .fcsp-role.role-user  { background: #00a5a8; color: #fff; }
[data-theme="dark"] .fcsp-form { border-top-color: #3b3b5c; }
[data-theme="dark"] .fcsp-form textarea {
  background: #1b1b2f;
  color: #eaeaea;
  border-color: #3b3b5c;
}

[data-theme="high-contrast"] .field-comments-side-panel {
  background: #fcfce0;
  border-left: 3px solid #000;
  box-shadow: -6px 0 0 #000;
}
[data-theme="high-contrast"] .fcsp-head {
  background: #000;
  color: #fcfce0;
  border-bottom: 2px solid #1a0080;
}
[data-theme="high-contrast"] .fcsp-comment {
  background: #fcfce0;
  border: 2px solid #000;
  color: #000;
}
[data-theme="high-contrast"] .fcsp-comment-title { color: #000; }
[data-theme="high-contrast"] .fcsp-by { color: #000; font-weight: 700; }
[data-theme="high-contrast"] .fcsp-text { color: #000; }
[data-theme="high-contrast"] .fcsp-role.role-admin {
  background: #000; color: #fcfce0; border: 2px solid #1a0080;
}
[data-theme="high-contrast"] .fcsp-role.role-user {
  background: #1a0080; color: #fcfce0; border: 2px solid #000;
}
[data-theme="high-contrast"] .fcsp-form textarea {
  background: #ffffff; color: #000; border: 2px solid #000;
}
[data-theme="high-contrast"] .fcsp-when {
  color: #000;
  font-weight: 600;
}
[data-theme="high-contrast"] .fcsp-empty {
  color: #000;
  font-weight: 600;
}

/* ===== ADMIN CHANGE LOG TABS ===== */
.admin-change-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.65rem 0 0.4rem 0;
  flex-wrap: wrap;
}
.admin-change-tab {
  background: transparent;
  border: 1px solid var(--wnc-orange);
  color: var(--wnc-orange);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.admin-change-tab:hover {
  background: rgba(243, 146, 0, 0.12);
}
.admin-change-tab.active {
  background: var(--wnc-orange);
  color: white;
}
.admin-change-tab:focus-visible {
  outline: 2px solid var(--wnc-orange);
  outline-offset: 2px;
}

[data-theme="dark"] .admin-change-tab {
  border-color: #f39200;
  color: #f39200;
}
[data-theme="dark"] .admin-change-tab:hover {
  background: rgba(243, 146, 0, 0.18);
}
[data-theme="dark"] .admin-change-tab.active {
  background: #f39200;
  color: #1b1b2f;
}

[data-theme="high-contrast"] .admin-change-tab {
  border: 2px solid #000;
  color: #000;
  background: #fcfce0;
}
[data-theme="high-contrast"] .admin-change-tab.active {
  background: #000;
  color: #fcfce0;
  border-color: #1a0080;
}

/* ===== ADMIN CHANGES: SECTION GROUPS ===== */
.admin-change-group {
  border: 1px solid #f0e0c0;
  border-radius: var(--radius);
  margin-top: 0.6rem;
  background: #fffdf8;
  padding: 0;
  overflow: hidden;
}
.admin-change-group[open] > .admin-change-group-summary {
  border-bottom: 1px solid #f0e0c0;
}
.admin-change-group-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #fdf4e3;
}
.admin-change-group-summary::-webkit-details-marker { display: none; }
.admin-change-group-summary::before {
  content: '\25B6';
  display: inline-block;
  font-size: 0.7rem;
  color: var(--wnc-orange);
  transition: transform 0.15s;
}
.admin-change-group[open] > .admin-change-group-summary::before {
  transform: rotate(90deg);
}
.admin-change-group-count {
  font-size: 0.8rem;
  color: var(--gray-600);
  font-weight: 500;
}
.admin-change-group .admin-changes-list {
  padding: 0.5rem 0.85rem 0.65rem 0.85rem;
  margin: 0;
}
.admin-changes-view[hidden] {
  display: none;
}

[data-theme="dark"] .admin-change-group {
  background: #2b1f0f;
  border-color: #5c4020;
}
[data-theme="dark"] .admin-change-group[open] > .admin-change-group-summary {
  border-bottom-color: #5c4020;
}
[data-theme="dark"] .admin-change-group-summary {
  background: #3a2a10;
  color: #eaeaea;
}
[data-theme="dark"] .admin-change-group-summary::before {
  color: #f39200;
}
[data-theme="dark"] .admin-change-group-count {
  color: #b0b0c8;
}

[data-theme="high-contrast"] .admin-change-group {
  background: #fcfce0;
  border: 2px solid #000;
}
[data-theme="high-contrast"] .admin-change-group[open] > .admin-change-group-summary {
  border-bottom: 2px solid #000;
}
[data-theme="high-contrast"] .admin-change-group-summary {
  background: #fcfce0;
  color: #000;
  font-weight: 700;
}
[data-theme="high-contrast"] .admin-change-group-summary::before {
  color: #000;
}
[data-theme="high-contrast"] .admin-change-group-count {
  color: #000;
  font-weight: 700;
}
