/* ============================================================
   QR - DPO Questionnaire Platform
   Design System - matches Claranova DPO report aesthetic
   ============================================================ */

:root {
  /* Core palette */
  --accent:       #7c3aed;
  --accent-bg:    #f5f3ff;
  --accent-hover: #6d28d9;
  --bg:           #f8fafc;
  --card:         #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --muted:        #64748b;

  /* Status / severity */
  --red:          #dc2626;
  --red-bg:       #fef2f2;
  --orange:       #ea580c;
  --orange-bg:    #fff7ed;
  --yellow:       #d97706;
  --yellow-bg:    #fffbeb;
  --blue:         #2563eb;
  --blue-bg:      #eff6ff;
  --green:        #059669;
  --green-bg:     #ecfdf5;
  --gray:         #6b7280;
  --gray-bg:      #f3f4f6;

  /* Pre-fill highlight */
  --prefill-bg:   #eff6ff;
  --prefill-border: #93c5fd;

  /* Spacing */
  --radius-card:  8px;
  --radius-input: 6px;
  --radius-btn:   6px;
  --max-width:    900px;

  /* Shadows */
  --shadow-card:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.10);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

/* ============================================================
   Navigation Bar
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--accent);
  color: white;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 32px;
  flex-shrink: 0;
}

.navbar-brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.navbar-brand .brand-icon {
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.navbar-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
  text-decoration: none;
}

.navbar-nav a.dpo-only {
  display: none;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.navbar-user {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.navbar-user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

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

/* ============================================================
   Page Layout
   ============================================================ */
#app {
  margin-top: 52px;
  min-height: calc(100vh - 52px);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #cbd5e1;
}

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

.btn-success:hover:not(:disabled) {
  background: #047857;
}

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

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 6px 10px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 6px 8px;
  font-size: 0.8rem;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* ============================================================
   Tags (severity)
   ============================================================ */
.tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  vertical-align: middle;
  margin-left: 6px;
}

.tag-critical {
  background: var(--red-bg);
  color: var(--red);
}

.tag-high {
  background: var(--orange-bg);
  color: var(--orange);
}

.tag-medium {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.tag-low {
  background: var(--blue-bg);
  color: var(--blue);
}

/* ============================================================
   Status Badges
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  text-transform: capitalize;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.status-draft {
  background: var(--gray-bg);
  color: var(--gray);
}

.status-active {
  background: var(--green-bg);
  color: var(--green);
}

.status-closed {
  background: var(--red-bg);
  color: var(--red);
}

/* ============================================================
   Dashboard - Questionnaire Cards
   ============================================================ */
.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.questionnaire-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.questionnaire-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  transition: box-shadow 0.15s;
}

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

.questionnaire-card-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.questionnaire-card-info p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.5;
  max-width: 600px;
}

.questionnaire-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.questionnaire-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.questionnaire-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 24px;
}

/* ============================================================
   Questionnaire Builder
   ============================================================ */
.builder-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.builder-meta-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
}

.builder-meta-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.section-builder {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.section-builder-header {
  background: var(--text);
  color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-builder-header input {
  flex: 1;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: white;
  padding: 5px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
}

.section-builder-header input::placeholder {
  color: rgba(255,255,255,0.5);
}

.section-builder-header input:focus {
  outline: none;
  border-color: rgba(255,255,255,0.5);
}

.section-num-badge {
  background: var(--accent);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.question-builder {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.question-builder:last-child {
  border-bottom: none;
}

.question-builder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.question-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.question-builder-controls {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.question-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.question-grid-full {
  grid-column: 1 / -1;
}

.add-question-footer {
  padding: 12px 16px;
  background: var(--bg);
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.option-row input[type="text"] {
  flex: 1;
}

.add-section-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.875rem;
  transition: border-color 0.15s, color 0.15s;
}

.add-section-area:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.builder-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  position: sticky;
  bottom: 16px;
  z-index: 10;
}

.builder-toolbar-left {
  display: flex;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.builder-toolbar-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Import panel */
.import-panel {
  background: var(--accent-bg);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius-card);
  padding: 16px;
  margin-top: 12px;
}

.import-panel h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ============================================================
   Forms / Inputs
   ============================================================ */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.form-group label .optional {
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

textarea {
  resize: vertical;
  min-height: 60px;
}

select {
  cursor: pointer;
}

.required-marker {
  color: var(--red);
  margin-left: 2px;
}

/* Checkbox / Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  cursor: pointer;
}

.form-check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================
   Fill Form - Respondent View
   ============================================================ */
.fill-header {
  background: var(--accent);
  color: white;
  padding: 28px 32px;
  border-radius: 12px;
  margin-bottom: 28px;
}

.fill-header h1 {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.fill-header p {
  font-size: 0.875rem;
  opacity: 0.9;
  line-height: 1.5;
}

.fill-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.fill-meta span {
  background: rgba(255,255,255,0.15);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Progress bar */
.progress-bar-wrapper {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 60px;
  z-index: 50;
}

.progress-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* Auto-save indicator */
.autosave-status {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.3s;
}

.autosave-saved {
  color: var(--green);
  background: var(--green-bg);
}

.autosave-saving {
  color: var(--yellow);
  background: var(--yellow-bg);
}

.autosave-unsaved {
  color: var(--muted);
  background: var(--gray-bg);
}

/* Respondent info block */
.respondent-info-card {
  background: var(--accent-bg);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 24px;
}

.respondent-info-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.respondent-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Fill section */
.fill-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.fill-section-header {
  background: var(--text);
  color: white;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fill-section-header .section-num {
  background: var(--accent);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Fill question */
.fill-question {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.fill-question:last-child {
  border-bottom: none;
}

.fill-question.prefilled {
  background: var(--prefill-bg);
  border-left: 3px solid var(--prefill-border);
}

.q-label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.q-required::after {
  content: " *";
  color: var(--red);
}

.q-context {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.5;
}

.q-why {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 8px;
  line-height: 1.4;
}

.q-why::before {
  content: "Why we ask: ";
  font-weight: 600;
}

.prefill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-bg);
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 6px;
}

/* Fill inputs */
.fill-question input[type="text"],
.fill-question textarea,
.fill-question select {
  margin-top: 4px;
}

.fill-question.prefilled input[type="text"],
.fill-question.prefilled textarea,
.fill-question.prefilled select {
  background: #f0f9ff;
  border-color: var(--prefill-border);
}

.fill-question.prefilled input[type="text"]:focus,
.fill-question.prefilled textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #eff6ff;
}

/* Radio / Checkbox options */
.q-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.q-option-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: white;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.3;
}

.q-option-label:hover {
  background: var(--accent-bg);
  border-color: #c4b5fd;
}

.q-option-label input[type="radio"],
.q-option-label input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.q-option-label.selected {
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* Table input */
.table-input-wrapper {
  margin-top: 8px;
  overflow-x: auto;
}

.table-input {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-input th {
  background: var(--bg);
  padding: 7px 10px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.table-input td {
  border: 1px solid var(--border);
  padding: 0;
}

.table-input td input {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 7px 10px;
  font-size: 0.83rem;
}

.table-input td input:focus {
  box-shadow: none;
  background: var(--accent-bg);
}

.table-add-row {
  margin-top: 6px;
  font-size: 0.8rem;
}

/* Submit area */
.submit-area {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  text-align: center;
  margin-top: 24px;
  box-shadow: var(--shadow-card);
}

.submit-area h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.submit-area p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Success state */
.submit-success {
  background: var(--green-bg);
  border: 2px solid var(--green);
  border-radius: var(--radius-card);
  padding: 32px;
  text-align: center;
  margin-top: 24px;
}

.submit-success .success-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.submit-success h3 {
  color: var(--green);
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.submit-success p {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ============================================================
   Response Viewer (read-only)
   ============================================================ */
.response-viewer .fill-question {
  cursor: default;
}

.response-viewer input,
.response-viewer textarea,
.response-viewer select {
  background: var(--bg) !important;
  cursor: default;
  color: var(--text);
  pointer-events: none;
}

.response-answer {
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 9px 12px;
  margin-top: 6px;
  min-height: 36px;
  line-height: 1.5;
}

.response-answer.empty {
  color: var(--muted);
  font-style: italic;
}

/* Responses list */
.responses-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.response-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s;
}

.response-row:hover {
  box-shadow: var(--shadow-hover);
}

.response-row-info h4 {
  font-size: 0.925rem;
  font-weight: 600;
  margin-bottom: 3px;
}

.response-row-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.response-row-actions {
  display: flex;
  gap: 6px;
}

/* ============================================================
   Alerts / Notifications
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-card);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-info {
  background: var(--blue-bg);
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert-success {
  background: var(--green-bg);
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.alert-error {
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert-warning {
  background: var(--yellow-bg);
  border: 1px solid #fcd34d;
  color: #92400e;
}

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-body {
  padding: 16px 24px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.modal-footer {
  padding: 12px 24px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Close button */
.btn-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-close:hover {
  background: var(--bg);
  color: var(--text);
}

/* ============================================================
   Loading State
   ============================================================ */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--muted);
  gap: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ============================================================
   Toast Notifications
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.2s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--accent); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   Utilities
   ============================================================ */
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  .navbar,
  .progress-bar-wrapper,
  .builder-toolbar,
  .btn,
  .autosave-status,
  .dashboard-actions {
    display: none !important;
  }

  #app {
    margin-top: 0;
  }

  .container {
    max-width: 100%;
    padding: 10px;
  }

  .fill-section,
  .fill-question,
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .fill-header {
    background: #1e293b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  textarea {
    min-height: 40px;
  }
}

/* ============================================================
   Responsive - Tablet
   ============================================================ */
@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  .navbar {
    padding: 0 16px;
  }

  .navbar-user-name {
    display: none;
  }

  .fill-header {
    padding: 20px;
  }

  .fill-header h1 {
    font-size: 1.15rem;
  }

  .questionnaire-card {
    grid-template-columns: 1fr;
  }

  .questionnaire-card-actions {
    flex-direction: row;
    align-items: flex-start;
  }

  .respondent-info-grid {
    grid-template-columns: 1fr;
  }

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

  .progress-bar-wrapper {
    top: 52px;
    flex-wrap: wrap;
  }

  .builder-toolbar {
    position: static;
  }

  .modal {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .navbar-nav a:not(.active) {
    display: none;
  }

  .fill-meta {
    flex-direction: column;
    gap: 4px;
  }

  .q-options {
    flex-direction: column;
  }
}
