/*
 * Assignment Tool MVP — Design System
 * Typography-first, calm, professional tool for instructors
 * No libraries, no build steps, vanilla CSS only
 */

/* [0] Font Loading ========================================== */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Note: Smooth scroll is handled in JavaScript for anchor links only,
   not globally, to avoid smooth scrolling on page refresh/restore */

/* [1] Variables ============================================ */
:root {
  /* Typography */
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --text: #111827;
  --text-muted: #6b7280;
  --bg: #fcfcfd;
  --surface: #f9fafb;
  --surface-2: #f3f4f6;

  --border: #e5e7eb;
  --border-strong: #d1d5db;

  /* Brand accent */
--accent: #1f3a5f;        /* muted ink blue */
--accent-hover: #162c48;  /* darker, calmer */
--accent-soft: #f1f5f9;   /* almost gray, not blue */
--accent-soft-border: #cbd5e1;

  /* Semantic */
  --success-text: #065f46;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;

  --warning-text: #92400e;
  --warning-bg: #fffbeb;
  --warning-border: #fcd34d;

  --danger-text: #991b1b;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --info-text: #1e40af;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;

  /* Layout */
  --container: 1120px;

  /* Type sizes */
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;

  /* Leading */
  --leading: 1.6;

  /* Focus ring */
  --focus: 0 0 0 3px rgba(31, 58, 95, 0.15);
}

/* [2] Base reset ============================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Link styles - calm, no underline by default */
a:not(.btn),
a:not(.btn):link,
a:not(.btn):visited {
  color: var(--text);
  text-decoration: none;
}

a:not(.btn):hover,
a:not(.btn):focus {
  color: var(--accent);
  text-decoration: none;
}

a:not(.btn):active {
  color: var(--accent-hover);
}

/* Explicit underline utility */
.link,
.link:link,
.link:visited {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.link:hover,
.link:focus {
  color: var(--accent-hover);
}

/* [3] Typography ============================================ */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: 32px;
  margin-bottom: var(--space-3);
}

h2 {
  font-size: 24px;
  margin-bottom: var(--space-2);
}

h3 {
  font-size: 20px;
  margin-bottom: var(--space-2);
}

h4 {
  font-size: 18px;
  margin-bottom: var(--space-2);
}

h5, h6 {
  font-size: 16px;
  margin-bottom: var(--space-2);
}

p { margin: 0 0 var(--space-3) 0; }
p:last-child { margin-bottom: 0; }

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

code, pre {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
code { padding: 2px 6px; }
pre {
  padding: var(--space-4);
  overflow-x: auto;
  margin: 0 0 var(--space-4) 0;
}
pre code { padding: 0; background: none; border: none; }

/* [4] Layout primitives ===================================== */
main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-5);
  box-sizing: border-box;
}

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-5); }

.row { display: flex; gap: var(--space-3); align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; }

.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Text color utilities */
.text-success {
  color: var(--success-text);
  font-weight: 600;
}

/* [5] Card/surface ========================================== */
.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
  margin-bottom: var(--space-2);
}

.card-header {
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.card-surface h1,
.card-surface h2,
.card-surface h3,
.card-surface h4,
.card-surface h5,
.card-surface h6 {
  margin-bottom: var(--space-3);
}

/* [6] Buttons =============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.15s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: white !important;
  border-color: var(--accent);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent-hover);
  color: white !important;
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text) !important;
  border-color: var(--border-strong);
}
.btn-secondary:hover,
.btn-secondary:focus {
  background: var(--surface);
  color: var(--text) !important;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted) !important;
  border-color: transparent;
}
.btn-ghost:hover,
.btn-ghost:focus {
  background: var(--surface);
  color: var(--text) !important;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text) !important;
  border-color: var(--danger-border);
}
.btn-danger:hover,
.btn-danger:focus {
  background: #fecaca;
  color: var(--danger-text) !important;
  border-color: #f87171;
}

/* Utility button variants for specific UI patterns */
.btn--primary {
  background: var(--accent);
  color: white !important;
  border-color: var(--accent);
}
.btn--primary:hover,
.btn--primary:focus {
  background: var(--accent-hover);
  color: white !important;
  border-color: var(--accent-hover);
}

.btn--secondary {
  background: var(--surface);
  color: var(--text) !important;
  border-color: var(--border-strong);
}
.btn--secondary:hover,
.btn--secondary:focus {
  background: var(--surface-2);
  color: var(--text) !important;
  border-color: var(--border-strong);
}


.btn--ghost {
  background: transparent;
  color: var(--accent) !important;
  border: none;
  padding: 4px 8px;
  font-size: var(--text-sm);
}
.btn--ghost:hover,
.btn--ghost:focus {
  background: var(--accent-soft);
  color: var(--accent) !important;
}

.btn--ghost-danger {
  background: transparent;
  color: var(--danger-text) !important;
  border: none;
  padding: 4px 8px;
  font-size: var(--text-sm);
}
.btn--ghost-danger:hover,
.btn--ghost-danger:focus {
  background: var(--danger-bg);
  color: var(--danger-text) !important;
}

.btn--success {
  background: var(--success-bg);
  color: var(--success-text) !important;
  border-color: var(--success-border);
}
.btn--success:hover,
.btn--success:focus {
  background: #bbf7d0;
  color: var(--success-text) !important;
  border-color: #4ade80;
}
.btn--danger {
  background: var(--danger-bg);
  color: var(--danger-text) !important;
  border-color: var(--danger-border);
}
.btn--danger:hover,
.btn--danger:focus {
  background: #fecaca;
  color: var(--danger-text) !important;
  border-color: #f87171;
}

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

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

.btn--filter {
  height: 40px;
  padding: 0 var(--space-4);
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text) !important;
  border: 1px solid var(--border-strong);
}
.btn--filter:hover,
.btn--filter:focus {
  background: var(--surface-2);
  color: var(--text) !important;
}

/* [7] Forms ================================================= */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

label {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
}

.input, .textarea, select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}

.input, select {
  height: 40px;
}

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

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

.help-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: normal;
}

/* Select hint (semantic feedback for select options) */
.select-hint {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.select-hint--issue {
  background: var(--surface-2);
  color: var(--text);
}

.select-hint--question {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.select-hint--suggestion {
  background: var(--surface-2);
  color: var(--text);
}

.select-hint--nice-to-have {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

.select-hint--must-fix {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.select-hint--should-fix {
  background: rgba(255, 193, 7, 0.15);
  color: #856404;
}

.select-hint--nice-to-have {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

/* [7.5] Trix Editor (Rich Text) ================================ */
/* Override Trix defaults to match our calm design system */

/* Editor container */
trix-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  min-height: 200px;
  background: #ffffff;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--text);
}

trix-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

/* Trix toolbar */
trix-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: none;
  padding: var(--space-2);
}

/* Toolbar buttons - match our ghost button style */
trix-toolbar .trix-button-group {
  border: none;
  margin-bottom: 0;
}

trix-toolbar .trix-button {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: var(--space-2);
  margin: 0 2px;
  cursor: pointer;
  font-size: var(--text-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
}

trix-toolbar .trix-button:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

trix-toolbar .trix-button.trix-active {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
  color: var(--accent);
}

trix-toolbar .trix-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hide attachment button (we don't support attachments in descriptions) */
trix-toolbar .trix-button--icon-attach {
  display: none;
}

/* Trix dialogs */
trix-toolbar .trix-dialog {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: var(--space-3);
}

trix-toolbar .trix-dialog__link-fields .trix-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}

trix-toolbar .trix-dialog__link-fields .trix-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

trix-toolbar .trix-button--dialog {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
}

trix-toolbar .trix-button--dialog:hover {
  background: var(--accent-hover);
}

/* Content styling inside editor */
trix-editor h1 {
  font-size: 24px;
  margin-bottom: var(--space-2);
}

trix-editor a {
  color: var(--accent);
  text-decoration: underline;
}

trix-editor a:hover {
  color: var(--accent-hover);
}

trix-editor ul, trix-editor ol {
  padding-left: var(--space-5);
  margin-bottom: var(--space-3);
}

trix-editor li {
  margin-bottom: var(--space-1);
}

/* Rendered description (in views) - match Trix output styling */
.assignment-description {
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--text);
}

.assignment-description p {
  margin-bottom: var(--space-3);
}

.assignment-description strong {
  font-weight: 600;
}

.assignment-description em {
  font-style: italic;
}

.assignment-description a {
  color: var(--accent);
  text-decoration: underline;
}

.assignment-description a:hover {
  color: var(--accent-hover);
}

.assignment-description ul,
.assignment-description ol {
  padding-left: var(--space-5);
  margin-bottom: var(--space-3);
}

.assignment-description li {
  margin-bottom: var(--space-1);
}

/* File picker component */
.file-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.file-picker__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-picker__label {
  /* Styled as btn btn--secondary - inherits from .btn */
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.file-picker__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Details component (collapsible sections) */
.details {
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
}

.details__summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  user-select: none;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Remove native disclosure triangle */
.details__summary::-webkit-details-marker {
  display: none;
}

/* Custom chevron (disabled - no arrows) */
.details__summary::before {
  content: '';
  display: none;
}

.details__summary:hover {
  background: var(--surface);
}

.details__body {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Feedback Item Utilities Container */
.feedback-item__utilities {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* Compact utility variant */
.details--utility {
  margin-top: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.details--utility:last-child {
  border-bottom: none;
}

.details--utility .details__summary {
  padding: var(--space-3) var(--space-2);
  background: none;
  border-radius: 0;
  font-weight: 500;
  font-size: var(--text-sm);
  gap: var(--space-2);
}

.details--utility .details__summary:hover {
  background: var(--surface-2);
}

.details--utility .details__summary::before {
  content: none;
}

.details__icon {
  font-size: var(--text-base);
  line-height: 1;
  opacity: 0.6;
}

.details__label {
  flex: 1;
}

.details--utility .details__body {
  margin-top: 0;
  padding: var(--space-3);
  background: var(--surface-2);
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}

/* Feedback Version Structure */
.feedback-version {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.feedback-version__header {
  margin-bottom: var(--space-3);
}

.feedback-version__header h4 {
  margin: 0 0 var(--space-3) 0;
}

.feedback-version__section {
  margin-top: var(--space-4);
}

.feedback-version__section--publish {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.feedback-version__items-header {
  margin-bottom: var(--space-4);
}

.feedback-version__items-header h5 {
  margin: 0 0 var(--space-1) 0;
  font-size: var(--text-base);
  font-weight: 600;
}

.feedback-version__items-header p {
  margin: 0;
}

/* Summary Actions Row */
.feedback-summary-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Add Feedback Item - Discoverable CTA */
.feedback-add-item {
  margin-top: var(--space-4);
}

.feedback-add-item .details__summary {
  padding: var(--space-4);
  background: linear-gradient(to right, #f8fafc, var(--surface));
  border: 2px solid #94a3b8;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-base);
  gap: var(--space-2);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(148, 163, 184, 0.1);
}

.feedback-add-item .details__summary:hover {
  background: linear-gradient(to right, #e2e8f0, var(--surface-2));
  border-color: #64748b;
  box-shadow: 0 2px 6px rgba(100, 116, 139, 0.15);
  transform: translateY(-1px);
}

.feedback-add-item[open] .details__summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: linear-gradient(to right, #e2e8f0, var(--surface));
  box-shadow: none;
}

.feedback-add-item .details__icon {
  font-size: var(--text-lg);
  opacity: 0.7;
}

.feedback-add-item .details__body {
  background: var(--surface);
  border: 2px solid #94a3b8;
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--space-4);
  margin-top: 0;
}

/* Publish Form */
.feedback-publish-form {
  display: block;
}

.error-text {
  font-size: var(--text-sm);
  color: var(--danger-text);
}

.field-error .input,
.field-error .textarea,
.field-error select {
  border-color: var(--danger-border);
}

/* Filterbar layout */
.filterbar {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.filterbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.filterbar__extras {
  margin-top: var(--space-3);
}

/* Checkbox group */
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--text);
}

.check input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin: 0;
}

.checkbox-label {
  cursor: pointer;
}

/* [8] Tables ================================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: 1.45;
  border: none;
}

.table th {
  text-align: left;
  font-weight: 600;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-sm);
  border: none;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 10px 12px;
  border: none;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
}

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

.table tbody tr:hover {
  background: var(--surface);
}

.cell--date {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Clickable table rows */
.table-row-link {
  cursor: pointer;
  transition: background 0.15s ease;
}

.table-row-link:hover {
  background: var(--surface-2);
}

.table-row-link:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.table-row-link:focus:not(:focus-visible) {
  outline: none;
}

.table-row-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Screen reader only content */
.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;
}

/* [9] Badges ================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-open {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}

.badge-resolved {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.badge-must-fix {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.badge-info {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.badge-neutral {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Assignment status badges */
.badge--active {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.badge--late {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.badge--closed {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* Invite link status badges */
.badge--expired {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

.badge--revoked {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.badge--none {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Metric pills (statistics indicators) */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pills--tight {
  gap: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 5px;
  border: 1px solid transparent;
}

.pill[title] {
  cursor: help;
}

.pill[title]:hover {
  opacity: 0.85;
}

.pill--neutral {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

.pill--danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.pill--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.pill--info {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.3);
}

.pill--nice-to-have {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.3);
}

.pill--muted {
  background: #e7e7e7;
  color: #4b5563;
  border-color: #d1d5db;
}

.pill--status {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  font-size: var(--text-sm);
  font-weight: 400;
}

.pill--issue {
  background: #fee;
  color: #991b1b;
  border-color: #fecaca;
}

.pill--success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.pill--latest {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.pill--archived {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Radio pill group (for radio button selections with pill design) */
.radio-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.radio-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-3);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 140px;
}

.radio-pill:hover {
  border-color: var(--primary);
  background: var(--surface-1);
}

.radio-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill:has(input[type="radio"]:checked) {
  background: var(--primary-bg);
  border-color: var(--primary);
}

.radio-pill__label {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-1);
}

.radio-pill__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.3;
}

/* Stat list (vertical statistics display) */
.stat-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.stat-item__label {
  font-size: var(--text-base);
  color: var(--text);
}

.stat-item__value {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
}

.stat-item--danger .stat-item__value {
  color: var(--danger-text);
}

.stat-item--warning .stat-item__value {
  color: var(--warning-text);
}

.stat-item--info .stat-item__value {
  color: var(--info-text);
}

.stat-item--muted .stat-item__value {
  color: var(--text-muted);
}

/* File link component */
.file-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 14px;
  font-weight: 500;
  color: var(--text) !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.file-link:hover,
.file-link:focus {
  background: var(--accent-soft);
  border-color: var(--accent-soft-border);
  color: var(--text) !important;
}

/* Small copy button for invite links */
.btn-copy {
  padding: 3px 6px;
  font-size: 10px;
  background: var(--text-muted);
  color: white !important;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-copy:hover {
  background: var(--text);
}

/* Panel component (for feedback sections) */
.panel {
  padding: var(--space-3) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.panel__title {
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-lg);
  font-weight: 600;
}

.panel__meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

/* Feedback list */
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.feedback-item {
  padding: var(--space-4);
  background: white;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #cbd5e1;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  scroll-margin-top: clamp(80px, 15vh, 200px);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 4px 8px rgba(0, 0, 0, 0.02);
}

.feedback-item:target {
  animation: highlight-fade 2.5s ease-out;
}

@keyframes highlight-fade {
  0% {
    background-color: #fef3c7;
    border-color: #fbbf24;
  }
  100% {
    background-color: white;
    border-color: var(--border);
  }
}

/* Item type accent colors */
.feedback-item--issue {
  border-left-color: #ef4444;
}

.feedback-item--suggestion {
  border-left-color: #94a3b8;
}

.feedback-item--nice-to-have {
  border-left-color: #a855f7;
}

.feedback-item--question {
  border-left-color: #3b82f6;
}

.feedback-item--resolved {
  opacity: 0.7;
  border-left-color: #10b981;
}

.feedback-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.feedback-item__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.feedback-item__body {
  color: var(--text);
  line-height: 1.5;
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
}

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

/* Reply list and components */
.reply-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: #fafbfc;
  border-radius: var(--radius-sm);
  border: 1px solid #e5e7eb;
  border-left: 3px solid #d1d5db;
}

.reply {
  padding: var(--space-3);
  background: white;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.reply--student {
  background: var(--surface);
}

.reply--instructor {
  background: var(--info-bg);
}

.reply--new {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning-border);
}

.reply__meta {
  display: flex;
  justify-content: space-between;
  align-items: start;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.reply__body {
  color: var(--text);
  line-height: 1.5;
}

.reply__badge {
  display: inline-block;
  padding: 2px 6px;
  background: var(--warning-bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  margin-left: var(--space-2);
}

/* Button text-only utilities */
.btn--danger-text {
  color: var(--danger-text) !important;
}

/* Link button (subtle action link) */
.link-btn {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent) !important;
  text-decoration: none !important;
  transition: color 0.15s ease;
}

.link-btn:hover,
.link-btn:focus {
  color: var(--accent-hover) !important;
}

/* Version label */
.version-label {
  font-weight: 600;
  color: var(--text);
  font-size: var(--text-sm);
}

/* Version card (submission version block) */
.version-card {
  padding: var(--space-4);
  margin-top: 25px;
  margin-bottom: var(--space-4);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.version-card--archived {
  background: var(--surface);
  border-color: #e0e0e0;
  padding: 0;
}

.version-content {
  padding: var(--space-4);
  background: white;
}

.version-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.version-head h3 {
  margin-bottom: 0;
}

.version-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Callout (for student comments, notes) */
.callout {
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--border-strong);
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.callout--note {
  background: #f0f8ff;
  border-left-color: var(--info-border);
}

.callout--student {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  padding: var(--space-4);
}

.callout__meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: var(--space-2);
}

.callout__body {
  font-size: var(--text-base);
  color: var(--text);
  line-height: var(--leading);
}

.callout strong {
  font-weight: 600;
}

/* File list */
.file-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* [10] Alerts =============================================== */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  margin-bottom: var(--space-4);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

/* [10.5] Toast Notifications ================================ */
.toasts {
  position: fixed;
  top: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 600px;
  width: 100%;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  pointer-events: auto;
  font-size: var(--text-base);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.toast__content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.toast__icon {
  font-size: var(--text-base);
  line-height: 1.5;
  flex-shrink: 0;
}

.toast__message {
  line-height: 1.5;
  word-wrap: break-word;
}

.toast__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.toast__close:hover {
  color: var(--text);
}

.toast--success {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.toast--success .toast__icon {
  color: var(--success-text);
}

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

.toast--error .toast__icon {
  color: var(--danger-text);
}

.toast--warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.toast--warning .toast__icon {
  color: var(--warning-text);
}

.toast--info {
  background: var(--info-bg);
  border-color: var(--info-border);
}

.toast--info .toast__icon {
  color: var(--info-text);
}

/* Responsive: stack on mobile */
@media (max-width: 640px) {
  .toasts {
    left: var(--space-4);
    right: var(--space-4);
    top: var(--space-4);
    max-width: none;
    transform: none;
  }
}

/* [11] Top navigation ======================================= */
.topnav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-6);
}

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

.topnav-brand {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.topnav-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Brand logo (icon + wordmark) */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.brand:hover {
  opacity: 0.75;
}

.brand__icon {
  height: 24px;
  width: auto;
  flex-shrink: 0;
}

.brand__wordmark {
  height: 36px;
  width: auto;
}

/* Footer variant */
.brand--footer .brand__icon {
  height: 18px;
}

.topnav-links {
  display: flex;
  gap: var(--space-5);
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topnav-links a {
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
}
.topnav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-link--accent {
  color: var(--accent) !important;
  font-weight: 500;
}
.nav-link--accent:hover {
  color: var(--accent-hover) !important;
}

/* [12] Helpers ============================================== */
.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-5);
  color: var(--text-muted);
}

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

.meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

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

/* [13] Footer =============================================== */
.footer {
  margin-top: var(--space-7);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

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

.footer__text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.footer__badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
  border-radius: 999px;
}

.footer__links {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-sm);
  flex-wrap: wrap;
}

.footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer__links a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* [14] Landing page ========================================= */

/* Landing container */
.landing {
  background: var(--bg);
}

/* Top Navigation */
.landing-nav {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.landing-nav__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.landing-nav__brand {
  display: flex;
  align-items: center;
}

.landing-nav__links {
  display: flex;
  gap: var(--space-5);
  align-items: center;
}

.landing-nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.landing-nav__link:hover {
  color: var(--text);
}

.landing-kicker {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--text-sm);
}

/* Hero */
.landing-hero {
  padding: 80px 0 96px;
  text-align: center;
  background: linear-gradient(to bottom, var(--bg), var(--surface));
  position: relative;
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

.landing-hero__content {
  max-width: 760px;
  margin: 0 auto;
}

.landing-hero__title {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin: 0 0 var(--space-5) 0;
  letter-spacing: -0.02em;
}

.landing-hero__subtitle {
  font-size: 20px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 var(--space-6) 0;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.landing-hero__actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.landing-hero__note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

/* Trust Strip */
.landing-trust {
  padding: var(--space-6) 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.landing-trust__items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
}

.landing-trust__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-align: center;
}

.landing-trust__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.landing-trust__text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Sections */
.landing-section {
  padding: 80px 0;
  border-top: 1px solid var(--border);
  position: relative;
}

.landing-section--alt {
  background: var(--surface);
}

.landing-section--emphasis {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.landing-section--cta {
  text-align: center;
  padding: 96px 0;
  background: linear-gradient(to bottom, var(--surface), var(--bg));
}

.landing-section__title {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 var(--space-6) 0;
  text-align: center;
  color: var(--text);
  letter-spacing: -0.01em;
}

.landing-section__intro {
  max-width: 680px;
  margin: 0 auto var(--space-6);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
}

/* Steps */
.landing-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
  max-width: 1000px;
  margin: 0 auto;
}

.landing-step {
  text-align: center;
  padding: var(--space-5);
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  position: relative;
}

.landing-step:hover {
  border-color: var(--accent-soft-border);
  box-shadow: 0 4px 12px rgba(31, 58, 95, 0.08);
  transform: translateY(-2px);
}

.landing-step--empty {
  visibility: hidden;
}

.landing-step-placeholder {
  /* Empty placeholder for grid alignment - only visible on large screens with 3-column layout */
}

/* Hide placeholder on smaller screens where we don't have 3 columns */
@media (max-width: 900px) {
  .landing-step-placeholder {
    display: none;
  }
}

.landing-step__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: white;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-4);
  box-shadow: 0 4px 12px rgba(31, 58, 95, 0.15);
}

.landing-step__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 var(--space-3) 0;
  color: var(--text);
}

.landing-step__text {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* Iterative workflow */
.landing-iterative {
  max-width: 720px;
  margin: var(--space-6) auto 0;
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}

.landing-iterative__title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 var(--space-3) 0;
  color: var(--text);
}

.landing-iterative__text {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

/* Features */
.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
  max-width: 1000px;
  margin: 0 auto;
}

.landing-feature {
  padding: var(--space-5);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.landing-feature:hover {
  border-color: var(--accent-soft-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.landing-feature__title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 var(--space-3) 0;
  color: var(--text);
}

.landing-feature__text {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* List */
.landing-list {
  max-width: 600px;
  margin: 0 auto;
  padding-left: var(--space-5);
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
}

.landing-list li {
  margin-bottom: var(--space-2);
}

/* Problem list - simple, observational */
.landing-list--problem {
  color: var(--text-muted);
  font-size: 17px;
  background: white;
  padding: var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  max-width: 680px;
  margin: 0 auto;
}

.landing-list--problem li {
  margin-bottom: var(--space-4);
  padding-left: var(--space-2);
  position: relative;
}

.landing-list--problem li:last-child {
  margin-bottom: 0;
}

/* Solution container - structured and organized */
.landing-solution {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-7);
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.landing-list--solution {
  margin: 0;
  padding-left: var(--space-5);
  font-size: 17px;
  line-height: 1.8;
  color: var(--text);
}

.landing-list--solution li {
  margin-bottom: var(--space-4);
  padding-left: var(--space-2);
  position: relative;
}

.landing-list--solution li::marker {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1em;
}

/* Emphasis section */
.landing-emphasis__text {
  max-width: 720px;
  margin: 0 auto;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
}

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

.landing-emphasis__text ul {
  text-align: left;
  max-width: 600px;
  margin: var(--space-5) auto;
  padding: var(--space-5);
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  list-style: none;
}

.landing-emphasis__text ul li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  padding-left: var(--space-4);
}

.landing-emphasis__text ul li:last-child {
  border-bottom: none;
}

/* FAQ */
.landing-section--faq {
  background: var(--bg);
}

.landing-faq {
  max-width: 800px;
  margin: 0 auto;
}

.landing-faq__item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.landing-faq__item:last-child {
  border-bottom: none;
}

.landing-faq__question {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
  color: var(--text);
}

.landing-faq__answer {
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

/* CTA */
.landing-cta__title {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 var(--space-4) 0;
  color: var(--text);
  letter-spacing: -0.01em;
}

.landing-cta__text {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 var(--space-6) 0;
}

/* Button variants */
.btn-sm {
  padding: 8px 16px;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(31, 58, 95, 0.15);
}

.btn-lg.btn-primary {
  box-shadow: 0 4px 12px rgba(31, 58, 95, 0.25);
}

.btn-lg.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(31, 58, 95, 0.3);
  transform: translateY(-1px);
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .landing-nav__container {
    flex-direction: column;
    gap: var(--space-3);
  }

  .landing-nav__links {
    flex-direction: column;
    gap: var(--space-2);
  }

  .landing-hero__title {
    font-size: 32px;
  }

  .landing-hero__subtitle {
    font-size: 16px;
  }

  .landing-section__title {
    font-size: 28px;
  }

  .landing-steps {
    grid-template-columns: 1fr;
  }

  .landing-features {
    grid-template-columns: 1fr;
  }

  .landing-trust__items {
    grid-template-columns: 1fr;
  }

  .landing-hero__actions {
    flex-direction: column;
  }
}

/* Landing Footer */
.landing-footer {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.landing-footer__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.landing-footer__copyright {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

.landing-footer__links {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-sm);
}

.landing-footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.landing-footer__links a:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .landing-footer__content {
    flex-direction: column;
    text-align: center;
  }

  .landing-footer__links {
    flex-direction: column;
    gap: var(--space-2);
  }
}

/* [15] Legal Pages ========================================== */
.legal-page {
  background: var(--bg);
  min-height: 100vh;
  padding: var(--space-6) 0;
}

.legal-header {
  margin-bottom: var(--space-5);
}

.legal-back {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease;
}

.legal-back:hover {
  color: var(--accent);
}

.legal-content {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: var(--space-7);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.legal-title {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-2) 0;
  color: var(--text);
}

.legal-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-6) 0;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.legal-body {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
}

.legal-section {
  margin-bottom: var(--space-6);
}

.legal-section:last-child {
  margin-bottom: 0;
}

.legal-section h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 var(--space-3) 0;
  color: var(--text);
}

.legal-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin: var(--space-4) 0 var(--space-2) 0;
  color: var(--text);
}

.legal-section p {
  margin: 0 0 var(--space-3) 0;
}

.legal-section ul {
  margin: var(--space-3) 0;
  padding-left: var(--space-5);
}

.legal-section li {
  margin-bottom: var(--space-2);
}

.legal-section a {
  color: var(--accent);
  text-decoration: none;
}

.legal-section a:hover {
  color: var(--accent-hover);
}

.legal-footer {
  max-width: 800px;
  margin: var(--space-6) auto 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  text-align: center;
}

.legal-footer__links {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.legal-footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-footer__links a:hover {
  color: var(--text);
}

.legal-footer__copyright {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 768px) {
  .legal-content {
    padding: var(--space-5);
  }

  .legal-title {
    font-size: 28px;
  }

  .legal-section h2 {
    font-size: 20px;
  }

  .legal-footer__links {
    flex-direction: column;
    gap: var(--space-2);
  }
}

/* [16] Account Pages ======================================== */
.account-page {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-6) 0;
}

.account-header {
  margin-bottom: var(--space-6);
}

.account-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
  color: var(--text);
}

.account-subtitle {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0;
}

.account-form-container {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}

.account-form .form-group {
  margin-bottom: var(--space-4);
}

.account-form .form-group:last-of-type {
  margin-bottom: var(--space-5);
}

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

.account-form .form-control {
  width: 100%;
  padding: 10px var(--space-3);
  font-size: var(--text-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}

.account-form .form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.account-form .form-control-static {
  padding: 10px 0;
  font-size: var(--text-base);
  color: var(--text-muted);
}

.account-form .form-help {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.account-form .form-errors {
  color: var(--danger-text);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

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

.account-notice {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--info-text);
}

.account-links {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  text-align: center;
}

.account-links a {
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
}

.account-links a:hover {
  color: var(--accent-hover);
}

/* Topnav dropdown */
.topnav-dropdown {
  position: relative;
}

.topnav-dropdown-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.topnav-dropdown-toggle:hover {
  color: var(--accent);
}

.topnav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-1);
  padding-top: var(--space-1);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  min-width: 160px;
  z-index: 1000;
}

.topnav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.topnav-dropdown:hover .topnav-dropdown-menu,
.topnav-dropdown:focus-within .topnav-dropdown-menu,
.topnav-dropdown-menu:hover {
  display: block;
}

.topnav-dropdown-menu a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.topnav-dropdown-menu a:hover {
  background: var(--surface);
  color: var(--accent);
}

@media (max-width: 768px) {
  .account-page {
    padding: var(--space-4) 0;
  }

  .account-form-container {
    padding: var(--space-4);
  }

  .account-actions {
    flex-direction: column;
    width: 100%;
  }

  .account-actions .btn {
    width: 100%;
  }
}

/* [17] Error Pages ========================================== */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--bg);
}

.error-page__container {
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand--error {
  display: inline-flex;
  margin-bottom: var(--space-7);
}

.brand--error .brand__wordmark {
  height: 36px;
}

.error-page__content {
  width: 100%;
  padding: var(--space-7);
  text-align: center;
}

.error-page__code {
  font-size: 72px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  margin: 0 0 var(--space-5) 0;
  opacity: 0.3;
}

.error-page__title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-5) 0;
  line-height: 1.2;
}

.error-page__message {
  font-size: var(--text-lg);
  color: var(--text-muted);
  margin: 0 0 var(--space-7) 0;
  line-height: var(--leading);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.error-page__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.error-page__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

.error-page__hint a {
  color: var(--accent);
  text-decoration: none;
}

.error-page__hint a:hover {
  text-decoration: underline;
}

/* [17.5] Submission Overview ================================= */
.submission-overview {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.open-feedback-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.submission-overview__header {
  margin-bottom: var(--space-4);
}

.submission-overview__header h1 {
  margin-bottom: var(--space-2);
}

.submission-overview__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--text-sm);
}

.submission-overview__details {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

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

.submission-overview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
}

.submission-overview__section {
  margin-top: var(--space-3);
}

.submission-overview__section-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) 0;
  color: var(--text-muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: color 0.15s;
}

.submission-overview__section-summary::-webkit-details-marker {
  display: none;
}

.submission-overview__section-summary:hover {
  color: var(--accent);
}

.submission-overview__section-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--text-muted);
}

.submission-overview__section-body {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-sm);
}

/* Compact feedback item for summary view */
.feedback-item-compact {
  padding: var(--space-3);
  background: white;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #cbd5e1;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  transition: all 0.15s;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 4px 8px rgba(0, 0, 0, 0.02);
}

.feedback-item-compact:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.feedback-item-compact--issue {
  border-left-color: #ef4444;
}

.feedback-item-compact--suggestion {
  border-left-color: #94a3b8;
}

.feedback-item-compact--nice-to-have {
  border-left-color: #a855f7;
}

.feedback-item-compact--question {
  border-left-color: #3b82f6;
}

.feedback-item__body-preview {
  font-size: var(--text-sm);
  color: var(--text);
  margin: var(--space-2) 0;
  line-height: 1.4;
}

/* Latest version distinction */
.version-card--latest {
  border: 2px solid var(--accent);
  border-left: 4px solid var(--accent);
}

.version-card--latest .version-head {
  background: var(--accent-soft);
  padding: var(--space-4);
  margin: calc(var(--space-4) * -1);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Archived version summary */
.version-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  cursor: pointer;
  background: var(--surface);
  border-radius: var(--radius-md);
  transition: background 0.15s;
  list-style: none;
}

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

.version-summary:hover {
  background: var(--surface-2);
}

.version-summary__title {
  font-weight: 500;
  color: var(--text);
}

.version-summary__badges {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.version-details {
  margin-top: var(--space-4);
}

/* Compact details inline (for show more) */
.details-inline {
  margin-top: var(--space-3);
}

.details-inline summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
  list-style: none;
  transition: color 0.15s;
}

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

.details-inline summary:hover {
  color: var(--accent-hover);
}

.details-inline summary::before {
  content: '▶ ';
  display: inline-block;
  margin-right: var(--space-1);
  transition: transform 0.15s;
}

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

/* Feedback Utility Actions ======================================== */
.feedback-item__utilities {
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.feedback-utility-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.feedback-utility-toggle {
  background: none;
  border: none;
  padding: 4px 0;
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

.feedback-utility-toggle:hover {
  color: var(--accent);
}

.feedback-utility-toggle--secondary {
  color: var(--text-muted);
  font-weight: 400;
}

.feedback-utility-toggle--secondary:hover {
  color: var(--text);
}

.feedback-utility-panel {
  margin-top: var(--space-2);
  width: 100%;
}

/* Feedback Summary ======================================== */
.feedback-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.feedback-summary__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  flex: 1;
}

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

.feedback-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.feedback-summary-chip--total {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.feedback-summary-chip--danger {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.feedback-summary-chip--warning {
  background: rgba(255, 193, 7, 0.15);
  color: #856404;
}

.feedback-summary-chip--info {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.feedback-summary-chip--nice-to-have {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

.feedback-summary-chip--muted {
  background: var(--surface-2);
  color: var(--text-muted);
}

.feedback-summary-chip--highlight {
  background: rgba(255, 193, 7, 0.2);
  color: #856404;
  font-weight: 600;
}

/* [18] AI Generation Loading States ======================== */
.btn--loading {
  opacity: 0.7;
  cursor: wait;
  position: relative;
}

.ai-status {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: 1.5;
  display: none;
}

.ai-status:not(:empty) {
  display: block;
}

.ai-status--loading {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

.ai-status--long-wait {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

/* [19] Accessibility ======================================== */
*:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

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

/* [20] Scroll Position Restoration Masking ================= */
/* Subtle mask while page is restoring scroll position to hide jump effect */
html.scroll-restoring {
  opacity: 0.97;
  transition: opacity 0.05s ease-out;
}

/* Instant fade-in when class is removed */
html:not(.scroll-restoring) {
  opacity: 1;
}
