/* ===== EDITOR — Minimal & Clean Design ===== */

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  padding: 20px;
  background: #f1f5f9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #1e293b;
  margin: 0;
}

.editor-container { max-width: 1440px; margin: 0 auto; }

.is-hidden { display: none; }

.editor-full-width-action { width: 100%; margin-top: 8px; }

.editor-help-text { color: #6c757d; }

.editor-save-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.editor-preview-explanation { margin-top: 12px; }

/* Header — shared control-room top bar (sticky). Self-contained so the editor does not
   pull in home-v2/exam-v2 (which would collide with these styles). Its rail tokens are
   scoped to the bar; the bar is dark in both themes, matching the home and roadmaps. */
.cr-topbar {
  --rail-bg: #1d232f;
  --rail-text: #aab2c0;
  --rail-text-strong: #e8ebf0;
  --rail-line: #313947;
  --accent-bright: #2dd4bf;
  --h-radius: 10px;

  position: sticky;
  top: 0;
  z-index: 50;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-top: -20px;          /* cancel the body's 20px top padding so the bar meets the top */
  margin-bottom: 16px;
  background: var(--rail-bg);
  color: var(--rail-text);
  border-bottom: 1px solid var(--rail-line);
}
.cr-topnav {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cr-topnav-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  text-decoration: none;
}
.cr-topnav-brand .logo-img { width: 26px; height: auto; }
.cr-topnav-brand h1 {
  color: var(--rail-text-strong);
  -webkit-text-fill-color: currentcolor;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}
.cr-topnav-brand .logo-accent { color: var(--accent-bright); }
.cr-topnav-brand:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; border-radius: 6px; }
.cr-topnav-links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.cr-topnav-links > a {
  color: var(--rail-text);
  text-decoration: none;
  font-size: 0.8438rem;
  font-weight: 600;
  transition: color 0.15s;
}
.cr-topnav-links > a:hover { color: var(--rail-text-strong); }
.cr-topnav-links > a:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.cr-topnav .theme-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cr-topnav .theme-toggle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: var(--h-radius);
  background: transparent;
  border: 1px solid var(--rail-line);
  color: var(--rail-text);
  transition: color 0.15s, border-color 0.15s;
}
.cr-topnav .theme-toggle:hover { color: var(--accent-bright); border-color: var(--accent-bright); }
.cr-topnav .theme-toggle:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

.editor-muted {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0 0 16px 0;
}

/* Exam Selection Bar */
.exam-selection-bar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.exam-select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.exam-select-group label {
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  font-size: 0.8125rem;
}

.exam-select-group select {
  flex: 1;
  min-width: 0;
}

.exam-actions-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.custom-exam-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.custom-exam-input input {
  flex: 1 1 170px;
  min-width: 0;
  padding: 6px 10px;
  font-size: 0.8125rem;
}

/* Split Layout */
.split {
  display: grid;
  grid-template-columns: minmax(280px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sidebar-header {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.sidebar-header h3 {
  margin: 0 0 10px 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-header h3 i { color: #0f766e; font-size: 0.8rem; }

.sidebar-header input[type="text"] {
  display: block;
  margin-bottom: 8px;
}

#searchInput {
  max-width: 100%;
}

.sidebar-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.sidebar-filters select {
  min-width: 0;
}

/* Question List */
.list {
  border-radius: 10px;
  padding: 8px;
  flex: 1;
  overflow: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  max-height: calc(100vh - 440px);
  min-width: 0;
}

.list-item {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
  font-size: 0.8125rem;
}

.list-item:hover {
  background: #f8fafc;
}

.list-item.active {
  background: rgba(15, 118, 110, 0.06);
  border-left-color: #0f766e;
}

.list-item .item-type {
  font-size: 0.6875rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.list-item .item-text {
  color: #334155;
  line-height: 1.4;
  margin-top: 2px;
}

.list-item.active .item-text { color: #1e293b; }

.editor-metadata-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.editor-metadata-panel h4 {
  margin: 0 0 6px 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-metadata-panel h4 i { color: #0f766e; }

.editor-metadata-note {
  margin: 0 0 10px 0;
  color: #64748b;
  font-size: 0.75rem;
  line-height: 1.4;
}

.editor-metadata-status {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 10px;
  padding: 8px 9px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.75rem;
  line-height: 1.35;
}

.editor-metadata-status i {
  flex: 0 0 auto;
  margin-top: 2px;
}

.editor-metadata-status.is-ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.editor-metadata-grid {
  display: grid;
  gap: 8px;
}

.editor-metadata-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.editor-metadata-grid span {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.editor-metadata-grid input,
.editor-metadata-grid select {
  min-width: 0;
  padding: 7px 9px;
  font-size: 0.8125rem;
}

/* Sidebar Footer */
.sidebar-footer {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.exam-management h4 {
  margin: 0 0 10px 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.exam-management button {
  width: 100%;
  margin-bottom: 6px;
  justify-content: flex-start;
  text-align: left;
}

/* Right Pane */
.right-pane {
  display: grid;
  grid-template-rows: minmax(260px, 1fr) minmax(220px, 0.85fr);
  gap: 12px;
  height: calc(100vh - 200px);
  min-width: 0;
}

/* Form */
.form {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  background: #fff;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.form-header-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0f172a;
  min-width: 0;
}

.form-header-status {
  font-size: 0.75rem;
  color: #22c55e;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.18);
  white-space: nowrap;
}

.form-header-status.is-dirty,
.editor-save-status.is-dirty {
  color: #b45309;
}

.form-header-status.is-dirty {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.24);
}

.editor-save-status.is-dirty {
  font-weight: 700;
}

.editor-validation {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.editor-validation-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.editor-validation-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.editor-validation-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.form .row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 12px;
  min-width: 0;
}

.form .row label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form .row label i { margin-right: 4px; }

.form-meta-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(220px, 1fr) minmax(84px, 100px);
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

.form textarea {
  min-height: 80px;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Inputs - Global */
input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.875rem;
  font-family: inherit;
  color: #1e293b;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
  background: #fff;
}

/* Options */
.options { display: grid; gap: 6px; }
.section-title {
  margin: 14px 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.option-row input[type="text"] {
  background: #fff;
}

.option-row.correct-option input[type="text"] {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.04);
}

.option-row .sequence-order-num {
  font-weight: 700;
  color: #0f766e;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  font-size: 0.875rem;
}

.option-row.sequence-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.btn {
  cursor: pointer;
  border-radius: 6px;
  padding: 7px 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primary { background: #0f766e; border-color: #0f766e; color: #fff; }
.btn.primary:hover { background: #0b5d57; }
.btn.danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.warning { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-primary { background: #0f766e; border-color: #0f766e; color: #fff; }
.btn-primary:hover { background: #0b5d57; }
.btn-secondary { background: #475569; color: #fff; border: none; }
.btn-secondary:hover { background: #334155; }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: #475569; }
.btn-outline:hover { background: #f1f5f9; border-color: #94a3b8; }
.btn-danger { background: #ef4444; color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; }

.footer { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
.form-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
  margin-top: 16px;
}

/* Small helpers */
.small { font-size: 0.75rem; color: #94a3b8; }
.muted { opacity: .7; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.2);
  color: #0f766e;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.75rem;
  color: #475569;
  text-decoration: none;
}
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; min-width: 0; }

/* Sequence hint */
#sequenceHint {
  background: rgba(15, 118, 110, 0.06);
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 0.8125rem;
  color: #0f766e;
}

/* ===== Preview Panel ===== */
.preview {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 16px;
  overflow: auto;
  min-height: 200px;
}

.preview h3 {
  margin: 0 0 10px 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pv-type {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.15);
  color: #0f766e;
  font-size: 0.6875rem;
  font-weight: 600;
}

.pv-question { margin: 10px 0; line-height: 1.5; color: #1e293b; font-size: 0.9375rem; }
.pv-images img { max-width: 100%; height: auto; border: 1px solid #e2e8f0; border-radius: 8px; margin: 8px 0; display: block; }
.pv-options { display: grid; gap: 6px; margin-top: 10px; }
.pv-option {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.875rem;
  background: #fff;
}
.pv-option.correct { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.04); }
.pv-option.correct .pv-letters { color: #16a34a; }
.pv-letters { font-weight: 700; width: 20px; text-align: center; color: #0f766e; }
.pv-option.selected { background: rgba(15, 118, 110, 0.06); border-color: rgba(15, 118, 110, 0.2); }
.pv-clickable { cursor: pointer; -webkit-user-select: none; user-select: none; }

.pv-yn-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; border-bottom: 1px solid #f1f5f9; padding: 6px 0; }
.pv-yn-ans { font-weight: 600; color: #0f766e; }
.pv-seq { font-size: 0.875rem; }
.pv-seq strong { color: #0f766e; }
.pv-explanation { margin-top: 12px; padding-top: 12px; border-top: 1px solid #f1f5f9; font-size: 0.875rem; color: #64748b; }

/* Preview drag/drop & sequence widgets */
.pv-seq-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.pv-col { border: 1px dashed #e2e8f0; border-radius: 8px; padding: 8px; min-height: 60px; }
.pv-col-title { font-size: 0.75rem; color: #94a3b8; margin-bottom: 6px; }
.pv-chip { display: flex; align-items: center; gap: 8px; border: 1px solid #e2e8f0; border-radius: 999px; padding: 4px 8px; margin: 4px 0; background: #fff; font-size: 0.8125rem; }
.pv-chip .x { border: none; background: transparent; color: #94a3b8; cursor: pointer; }
.pv-dd-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.pv-dd-source, .pv-dd-target { border: 1px dashed #e2e8f0; border-radius: 8px; padding: 8px; min-height: 60px; }
.pv-dd-title { font-size: 0.75rem; color: #94a3b8; margin-bottom: 6px; }
.pv-dd-btn { display: block; width: 100%; text-align: left; border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 8px; margin: 4px 0; background: #fff; cursor: pointer; font-size: 0.8125rem; }
.pv-dd-btn:hover { border-color: #0f766e; background: rgba(15, 118, 110, 0.04); }
.pv-dd-chip { display: flex; align-items: center; gap: 8px; border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 8px; margin: 4px 0; background: #f8fafc; font-size: 0.8125rem; }
.pv-dd-chip .rm { margin-left: auto; border: none; background: transparent; cursor: pointer; color: #94a3b8; }

/* ===== Editor dialogs, hints & toast ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

.ed-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}
.ed-modal {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s;
}
.ed-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.ed-modal-icon { font-size: 28px; }
.ed-modal-icon.success { color: #16a34a; }
.ed-modal-icon.danger { color: #ef4444; }
.ed-modal-head h3 { margin: 0; color: #0f172a; font-size: 1.05rem; }
.ed-modal-head p { margin: 4px 0 0; color: #64748b; font-size: 0.8438rem; }

.ed-note {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.8125rem;
  line-height: 1.55;
}
.ed-note p { margin: 8px 0 0; }
.ed-note ol { margin: 8px 0 0 20px; padding: 0; line-height: 1.7; }
.ed-note small { opacity: 0.8; display: block; margin-top: 8px; }
.ed-note.info {
  background: rgba(15, 118, 110, 0.06);
  border: 1px solid rgba(15, 118, 110, 0.2);
  color: #0b5d57;
}
.ed-note.warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.ed-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  font-size: 0.875rem;
  color: #475569;
}
.ed-check-row input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #0f766e;
}
.ed-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#persistence-hint {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #9a3412;
}
#persistence-hint p { margin: 8px 0 0; }
#persistence-hint ol { margin: 8px 0 0 20px; padding: 0; line-height: 1.7; }
#persistence-hint small { opacity: 0.8; }

#editor-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1d232f;
  border: 1px solid #313947;
  color: #e8ebf0;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 9999;
  font-size: 0.875rem;
}

/* ===== DARK MODE ===== */
body.dark-mode {
  background: #10141b;
  color: #e2e8f0;
}

/* The control-room top bar is dark in both themes; only its graphite deepens. */
body.dark-mode .cr-topbar {
  --rail-bg: #161b24;
  --rail-line: #2b3340;
}

.dark-mode .exam-selection-bar,
.dark-mode .sidebar-header,
.dark-mode .editor-metadata-panel,
.dark-mode .sidebar-footer,
.dark-mode .list,
.dark-mode .form {
  background: #1a212c;
  border-color: rgba(255, 255, 255, 0.06);
}

.dark-mode .preview {
  background: #1f2733;
  border-color: rgba(255, 255, 255, 0.06);
}

.dark-mode .sidebar-header h3,
.dark-mode .editor-metadata-panel h4,
.dark-mode .exam-management h4 { color: #94a3b8; }
.dark-mode .sidebar-header h3 { color: #e2e8f0; }

.dark-mode .exam-select-group label { color: #94a3b8; }

.dark-mode input[type="text"],
.dark-mode input[type="number"],
.dark-mode textarea,
.dark-mode select {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.dark-mode input:focus,
.dark-mode textarea:focus,
.dark-mode select:focus {
  border-color: #2bb3a3;
  box-shadow: 0 0 0 3px rgba(43, 179, 163, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.dark-mode select option {
  background: #1a212c;
  color: #e2e8f0;
}

.dark-mode .list-item:hover { background: rgba(255, 255, 255, 0.04); }
.dark-mode .list-item.active {
  background: rgba(43, 179, 163, 0.12);
  border-left-color: #4ecdbd;
}
.dark-mode .list-item .item-type { color: #64748b; }
.dark-mode .list-item .item-text { color: #94a3b8; }
.dark-mode .list-item.active .item-text { color: #e2e8f0; }

.dark-mode .form .row label { color: #64748b; }
.dark-mode .editor-metadata-note,
.dark-mode .editor-metadata-grid span { color: #64748b; }
.dark-mode .editor-metadata-status {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}
.dark-mode .editor-metadata-status.is-ready {
  border-color: rgba(74, 222, 128, 0.26);
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
}
.dark-mode .form-header { border-bottom-color: rgba(255, 255, 255, 0.06); }
.dark-mode .form-header-title { color: #f1f5f9; }
.dark-mode .form-footer { border-top-color: rgba(255, 255, 255, 0.06); }
.dark-mode .form-header-status {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.22);
}
.dark-mode .form-header-status.is-dirty {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.26);
}
.dark-mode .editor-save-status.is-dirty { color: #fbbf24; }

.dark-mode .option-row.correct-option input[type="text"] {
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.06);
}

.dark-mode .section-title { color: #64748b; }
.dark-mode .small { color: #64748b; }
.dark-mode .editor-muted { color: #64748b; }

.dark-mode .btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}
.dark-mode .btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}
.dark-mode .btn.primary,
.dark-mode .btn-primary { background: #2bb3a3; border-color: #2bb3a3; color: #0d1a18; }
.dark-mode .btn.primary:hover,
.dark-mode .btn-primary:hover { background: #4ecdbd; }
.dark-mode .btn-outline { border-color: rgba(255, 255, 255, 0.15); color: #94a3b8; }
.dark-mode .btn-outline:hover { background: rgba(255, 255, 255, 0.05); }

.dark-mode .chip {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.25);
  color: #7fd7c9;
}

.dark-mode .pill {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
}

.dark-mode .custom-exam-input {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.dark-mode #sequenceHint {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.2);
  color: #7fd7c9;
}

/* Dark mode dialogs & hints */
.dark-mode .ed-modal {
  background: #1a212c;
  border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .ed-modal-head h3 { color: #f1f5f9; }
.dark-mode .ed-modal-head p { color: #94a3b8; }
.dark-mode .ed-modal-icon.success { color: #5fc28e; }
.dark-mode .ed-modal-icon.danger { color: #dd8f8f; }
.dark-mode .ed-note.info {
  background: rgba(43, 179, 163, 0.1);
  border-color: rgba(43, 179, 163, 0.25);
  color: #7fd7c9;
}
.dark-mode .ed-note.warning,
.dark-mode #persistence-hint {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(251, 191, 36, 0.28);
  color: #fbbf24;
}
.dark-mode .ed-check-row { color: #94a3b8; }

/* Dark mode preview */
.dark-mode .preview h3 { color: #64748b; }
.dark-mode .pv-question { color: #e2e8f0; }
.dark-mode .pv-option {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
}
.dark-mode .pv-option.correct {
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.06);
}
.dark-mode .pv-option.selected {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.2);
}
.dark-mode .pv-yn-row { border-bottom-color: rgba(255, 255, 255, 0.06); }
.dark-mode .pv-yn-ans { color: #4ecdbd; }
.dark-mode .pv-explanation { border-top-color: rgba(255, 255, 255, 0.06); color: #64748b; }
.dark-mode .pv-col,
.dark-mode .pv-dd-source,
.dark-mode .pv-dd-target { border-color: rgba(255, 255, 255, 0.08); }
.dark-mode .pv-col-title,
.dark-mode .pv-dd-title { color: #64748b; }
.dark-mode .pv-chip,
.dark-mode .pv-dd-chip {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}
.dark-mode .pv-dd-btn {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
}
.dark-mode .pv-dd-btn:hover {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.08);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .right-pane { height: auto; }
  .list { max-height: 300px; }
  .exam-selection-bar { flex-direction: column; align-items: stretch; }
  .form-meta-row { grid-template-columns: 1fr; }
  .grid2,
  .pv-seq-wrap,
  .pv-dd-wrap { grid-template-columns: 1fr; }
  .custom-exam-input > * { flex: 1 1 100%; }
}
