* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(135deg, #f6f8fc 0%, #eef2fb 100%);
  color: #1f2a44;
  line-height: 1.45;
}
a { color: #163d8f; text-decoration: none; }
code { font-family: "Cascadia Code", Consolas, monospace; font-size: 0.92em; background: #eef2fb; padding: 0 4px; border-radius: 4px; }
header {
  background: #0f1f3a;
  color: #f8fbff;
  padding: 32px 16px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.hero { max-width: 960px; margin: 0 auto; }
.hero h1 { margin: 0 0 8px; font-size: 32px; }
.hero p { margin: 0 0 16px; color: #cdd7ea; max-width: 70ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn.secondary { background: #24365c; }
main { max-width: 960px; margin: 24px auto 48px; padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(15, 31, 58, 0.08);
}
.card h2 { margin-top: 0; }
.input-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.input-grid .btn { margin-top: 12px; }
label { display: block; font-weight: 600; margin-bottom: 8px; }
textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid #d5dbeb;
  border-radius: 8px;
  font-family: "Cascadia Code", Consolas, monospace;
  resize: vertical;
}
textarea.short { min-height: 64px; font-family: inherit; }
input[type="file"], input[type="number"], input[type="text"], select {
  width: 100%;
  padding: 10px;
  border: 1px solid #d5dbeb;
  border-radius: 8px;
  background: #f9fbff;
  font: inherit;
  margin-top: 4px;
}
.settings-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
.settings-grid .wide { grid-column: 1 / -1; }
.settings-grid .hint { display: block; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; margin: 0; }
.hint { margin-top: 6px; font-size: 13px; color: #5c6a88; }
.warn-text { color: #8a5a00; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #1f6feb, #163d8f);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(31, 111, 235, 0.3);
}
.btn.secondary { background: #1f2a44; box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.status { margin-top: 8px; min-height: 20px; color: #163d8f; font-weight: 600; }
.status.ok { color: #17663a; }
.status.error { color: #a3261b; }

.issue-box { border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-size: 14px; }
.issue-box h3 { margin: 0 0 6px; font-size: 15px; }
.issue-box ul { margin: 0; padding-left: 20px; }
.issue-box.error { background: #fdecea; border: 1px solid #f3b8b2; color: #7a1c13; }
.issue-box.warn { background: #fff7e0; border: 1px solid #f0d58a; color: #6b4a00; }

.preview { border: 1px dashed #cdd7ea; border-radius: 8px; padding: 12px; min-height: 80px; background: #f9fbff; margin-top: 12px; }
.preview .empty { color: #5c6a88; margin: 0; }
.bank-title { margin: 8px 0 4px; font-size: 17px; }
.preview-item { padding: 10px 12px; border-bottom: 1px solid #e7ecf6; }
.preview-item:last-child { border-bottom: none; }
.preview-item.has-error { background: #fdecea; border-left: 4px solid #d93025; }
.preview-item header { all: unset; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.preview-item .num { font-weight: 700; }
.preview-item .pts { color: #5c6a88; }
.preview-item .row-ref { margin-left: auto; color: #8a96b0; }
.preview-item .qtext { margin: 6px 0 4px; }
.preview-item .detail { margin: 4px 0; font-size: 14px; color: #3d4a66; }
.choices { margin: 4px 0; padding-left: 4px; list-style: none; font-size: 14px; }
.tick { display: inline-block; width: 18px; color: #17663a; font-weight: 700; }
.tick.off { color: #b4bdd0; }
.badge { display: inline-block; padding: 2px 6px; border-radius: 6px; font-size: 12px; background: #e4ecff; color: #163d8f; }

.docx-block { padding: 14px; border: 1px solid #c9d6f2; border-radius: 10px; background: #f6f9ff; }
.docx-block .badge { margin-left: 6px; vertical-align: middle; }
.or { margin: 18px 0 10px; color: #5c6a88; font-weight: 600; }
.import-report { margin-top: 14px; padding: 14px; border-radius: 10px; border: 1px solid #d5dbeb; background: #fff; font-size: 14px; }
.import-report h3 { margin: 0 0 8px; font-size: 16px; }
.import-report .stats { margin: 0 0 10px; color: #3d4a66; }
.import-report ul.findings { list-style: none; padding: 0; margin: 8px 0; }
.import-report ul.findings li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 6px; margin-bottom: 4px; }
.import-report li.error { background: #fdecea; }
.import-report li.warning { background: #fff7e0; }
.import-report li.info { background: #f2f5fb; }
.import-report li .msg { flex: 1; }
.import-report li button { font-size: 12px; padding: 3px 8px; border-radius: 6px; border: 1px solid #b8c4dd; background: #fff; cursor: pointer; }
.import-report details { margin: 6px 0; }
.import-report .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preview-item details.source { margin-top: 6px; font-size: 12px; color: #5c6a88; }
.preview-item details.source pre { white-space: pre-wrap; margin: 4px 0 0; font-family: inherit; background: #f2f5fb; padding: 6px 8px; border-radius: 6px; max-height: 220px; overflow: auto; }
/* ---- Doc-first layout ---- */
.hero-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 6px 0 0; color: #cdd7ea; font-size: 14px; }
.hero-steps li { display: flex; align-items: center; gap: 8px; }
.hero-steps span, h2 .step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 14px; font-weight: 700; flex: none; }
.hero-steps span { background: #24365c; color: #fff; }
h2 .step { background: #1f6feb; color: #fff; margin-right: 10px; vertical-align: 2px; }
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px 16px; border: 2px dashed #8fa8dc; border-radius: 12px; background: #f6f9ff; text-align: center; cursor: pointer; font-weight: 400; transition: background 0.15s, border-color 0.15s; }
.drop-zone:hover, .drop-zone:focus-within, .drop-zone.dragging { background: #eaf1ff; border-color: #1f6feb; }
.drop-zone input[type="file"] { width: auto; max-width: 100%; margin: 6px 0 0; background: none; border: none; padding: 0; }
.drop-title { font-size: 17px; font-weight: 700; color: #163d8f; }
.drop-hint { font-size: 13px; color: #5c6a88; max-width: 60ch; }
.checklist { margin: 12px 0 0; padding-left: 20px; font-size: 14px; color: #3d4a66; }
.checklist li { margin-bottom: 2px; }
details.other-ways, details.advanced { margin-top: 18px; border: 1px solid #e1e6f2; border-radius: 10px; background: #fbfcff; }
details.other-ways > summary, details.advanced > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; color: #3d4a66; }
.other-ways-body { padding: 4px 14px 14px; }
details.advanced { padding-bottom: 4px; }
details.advanced > label, details.advanced > p { margin: 0 14px 10px; max-width: 420px; }
.template-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.big { padding: 13px 22px; font-size: 16px; }
a.btn { text-decoration: none; }
.mode-choice { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 18px; }
.mode-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 14px 44px; border: 2px solid #d5dbeb; border-radius: 12px; cursor: pointer; font-weight: 400; margin: 0; }
.mode-card input { position: absolute; left: 14px; top: 16px; width: 18px; height: 18px; margin: 0; }
.mode-card.selected { border-color: #1f6feb; background: #f3f7ff; }
.mode-title { font-weight: 700; font-size: 16px; }
.mode-desc { font-size: 14px; color: #3d4a66; }
.quiz-settings { border: 1px solid #e1e6f2; border-radius: 10px; padding: 10px 14px 14px; margin: 16px 0 0; }
.quiz-settings legend { font-weight: 700; padding: 0 6px; }
.bank-note { margin-top: 14px; padding: 10px 12px; background: #fff7e0; border: 1px solid #f0d58a; border-radius: 8px; color: #5c4400; }
.download-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 18px; }
.download-row .status { margin: 0; }
.preview-item .qtext.clamp { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.preview-item [data-expand] { padding: 0; margin-bottom: 4px; }
.import-report ul.findings li { flex-wrap: wrap; }
.link-btn { background: none; border: none; padding: 0 4px; color: #163d8f; font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; cursor: pointer; }
.preview-item header .link-btn { margin-left: 4px; }
.badge.edited { background: #e3f4e8; color: #17663a; }
.item-editor { margin-top: 8px; padding: 12px; border: 1px solid #b8c4dd; border-radius: 8px; background: #fff; }
.item-editor .editor-errors { margin: 0 0 10px; padding: 8px 12px 8px 28px; background: #fdecea; border-radius: 6px; color: #7a1c13; font-size: 14px; }
.editor-grid { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.editor-grid .wide { grid-column: 1 / -1; }
.editor-grid label { font-size: 13px; margin: 0; }
.editor-grid textarea { min-height: 0; font-family: inherit; font-size: 14px; margin-top: 4px; }
.editor-grid fieldset { border: 1px solid #d5dbeb; border-radius: 8px; padding: 8px 10px; margin: 0; }
.editor-grid legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.choice-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.choice-row input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; }
.choice-row input[type="text"] { margin: 0; }
.numeric-fields { display: grid; gap: 8px 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); align-items: end; }
.numeric-fields .or-sep { font-size: 13px; color: #5c6a88; align-self: center; }
.item-editor .actions { display: flex; gap: 8px; margin-top: 12px; }
.images-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e7ecf6; }
.image-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 10px; }
.image-list li { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 110px; font-size: 12px; color: #3d4a66; word-break: break-all; text-align: center; }
.image-list img { width: 100px; height: 70px; object-fit: contain; background: #f2f5fb; border: 1px solid #d5dbeb; border-radius: 6px; }
.preview-item.stimulus { background: #f2f6ff; border-left: 4px solid #1f6feb; }
.preview-item.child { margin-left: 24px; border-left: 2px solid #c9d6f2; }
.preview-item .qimg { display: block; max-width: 240px; max-height: 160px; margin: 6px 0; border: 1px solid #d5dbeb; border-radius: 6px; }
.preview-item .missing { color: #a3261b; }
.import-steps ul { margin: 0; padding-left: 20px; font-size: 14px; }
.import-steps { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 16px; }
.import-steps h3 { margin: 0 0 6px; font-size: 16px; }
.import-steps ol { margin: 0; padding-left: 20px; font-size: 14px; }
.import-steps li { margin-bottom: 4px; }
footer { text-align: center; padding: 24px 16px 32px; color: #4f5d7a; }
