/* --- LÉPÉS ELŐNÉZET --- */
.icon-btn.preview-btn { color: #0891b2; }
  .icon-btn.preview-btn:hover { background: #cffafe; border-color: #67e8f9; }

  /* A .modal.step-preview-modal magasabb specificitású, mint a .modal,
     így a max-width és a width értékek érvényesülnek. */
  .modal.step-preview-modal {
    max-width: 1400px !important;
    width: 98% !important;
    height: 92vh !important;
    max-height: 92vh !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  /* Az előnézet modalnak kisebb a külső margója, hogy szélesebb legyen. */
  #stepPreviewModal.modal-backdrop { padding: 8px !important; }
  .step-preview-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
  }
  .step-preview-header h3 {
    margin: 0; font-size: 1.05rem;
    word-break: break-word;
  }
  .step-preview-close {
    background: transparent; border: none;
    font-size: 1.1rem; font-weight: 700;
    cursor: pointer; padding: 4px 10px;
    border-radius: 6px; line-height: 1;
    color: #64748b;
    flex-shrink: 0;
  }
  .step-preview-close:hover { background: #e2e8f0; color: #1e293b; }
  .step-preview-toolbar {
    display: flex; gap: 16px; align-items: center;
    padding: 10px 18px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .step-preview-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .step-preview-toolbar label {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.88rem; cursor: pointer; user-select: none;
    color: #334155;
    font-weight: 500;
  }
  .step-preview-toolbar label:hover { color: #0891b2; }
  .step-preview-toolbar input[type="radio"] {
    margin: 0; cursor: pointer; accent-color: #0891b2;
  }
  .step-preview-body {
    flex: 1;
    background: #e2e8f0;
    overflow: hidden;
    padding: 12px;
    min-height: 0;
  }
  .step-preview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: block;
  }

  /* A diáknak szánt HTML-ben az előnézetnél a fejléc, a mentősáv és a
     footer is rejtve van – csak a lépés tartalma látszik. */
  body.preview-mode header,
  body.preview-mode .save-bar,
  body.preview-mode .footer { display: none !important; }

  /* Az előnézetben a tartalom szélesebb: kisebb padding, teljes szélesség. */
  body.preview-mode { padding: 12px !important; }
  body.preview-mode .container { max-width: 100% !important; }

  /* Az előnézet STATIKUS: minden interakció le van tiltva.
     A tanár csak áttekintést kap, nem tud gombokat nyomni,
     szöveget beírni, hover-effekteket kiváltani. */
  body.preview-mode,
  body.preview-mode * {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: default !important;
  }

  .icon-btn.hint-btn { color: #d97706; }
  .icon-btn.hint-btn:hover { background: #fef3c7; }
  .icon-btn.hint-btn.has-hint {
    background: #fef3c7; border-color: #fcd34d; color: #78350f;
  }
  .icon-btn.hint-btn.open {
    background: #f59e0b; border-color: #d97706; color: white;
  }
  .icon-btn.hint-btn.open.has-hint {
    background: #d97706; border-color: #b45309; color: white;
  }
  .section-config-panel {
    display: none; background: #f3e8ff; border: 1px solid #c4b5fd;
    border-radius: 8px; padding: 12px 16px; margin-bottom: 14px;
    margin-left: 0; font-size: 0.88rem;
  }
  .section-config-panel.show { display: block; }
  .section-config-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; gap: 8px; flex-wrap: wrap;
  }
  .section-config-title {
    font-weight: 600; color: #5b21b6; margin-bottom: 0; font-size: 0.85rem;
  }
  .section-config-actions { display: flex; gap: 4px; flex-wrap: wrap; }
  .section-config-actions .tool-btn { padding: 3px 8px; font-size: 0.75rem; }
  .section-config-list { display: flex; flex-wrap: wrap; gap: 14px; }
  .section-config-item {
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; user-select: none; font-weight: 600; color: #5b21b6;
  }
  .section-config-item input { width: auto; margin: 0; cursor: pointer; }
  .phase-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
  .phase-dot.szakasz { background: var(--szakasz); }
  .button-row {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 16px; margin-left: 0; margin-right: 0;
  }
  .step-instructions {
    margin-left: 0; margin-right: 0; margin-bottom: 12px;
    display: flex; flex-direction: column; gap: 6px;
  }
  .step-instructions:empty { display: none; margin-bottom: 0; }
  .sections { margin-left: 0; margin-right: 0; }
  .btn {
    border: none; border-radius: 8px; padding: 9px 16px;
    font-size: 0.9rem; font-weight: 600; color: white;
    cursor: pointer; transition: transform 0.05s, opacity 0.15s;
  }
  .btn:hover { opacity: 0.9; }
  .btn:active { transform: scale(0.97); }
  .btn:disabled {
    background: #cbd5e1 !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
  }
  .btn:disabled:hover { opacity: 1 !important; }
  .btn.szakasz { background: var(--szakasz); }
  .btn.btn-disabled { opacity: 0.35; cursor: not-allowed; }
  .btn.btn-disabled:hover { opacity: 0.35; }
  .btn.instruction-step-btn { background: #dc2626; }
  .btn.instruction-step-btn:hover { background: #b91c1c; }
  .section {
    border-left: 2px solid var(--border);
    border-right: 2px solid var(--border);
    background: var(--section-bg, #f8fafc);
    border-radius: 8px; padding: 14px 16px;
    margin-bottom: 12px; position: relative;
  }
  /* jobb_szel_javitas_ok */
  /* Hover '+' jel a szakasz bal szelen. */
  /* _szinEsMenuFix: kek hatter, feher + */
  .section-hover-add {
    position: fixed;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    border: 1px solid #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
    z-index: 9999;
    user-select: none;
    box-shadow: 0 2px 6px rgba(37,99,235,0.4);
    line-height: 1;
    padding: 0;
    box-sizing: border-box;
    pointer-events: auto;
  }
  .section-hover-add:hover {
    background: #1d4ed8;
    border-color: #1e40af;
  }
  /* Zold + jel a ket feladat kozott. */
  .step-between-add {
    position: fixed;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #16a34a;
    border: 1px solid #15803d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s;
    z-index: 9999;
    user-select: none;
    box-shadow: 0 2px 6px rgba(22,163,74,0.4);
    line-height: 1;
    padding: 0;
    box-sizing: border-box;
    pointer-events: auto;
  }
  .step-between-add:hover {
    background: #15803d;
    border-color: #166534;
  }
  /* modosit_676.py: a diák nem szúr be új feladatot →
     a zöld + (step-between-add) soha ne jelenjen meg nála. */
  body:not(.teacher-mode) .step-between-add { display: none !important; }
  .section.szakasz { border-left-color: var(--szakasz); border-right-color: var(--szakasz); }
  .section-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
  }
  .section-title-group {
    display: flex; align-items: center; gap: 8px;
    max-width: 100%; min-width: 0;
  }
  .section-title {
    font-size: 0.8rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    /* A padding, border-radius és box-shadow ALAPBÓL megvan,
       hogy hover/szerkesztés közben NE változzon a méret. */
    padding: 1px 5px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 2px transparent;
    transition: background 0.12s, box-shadow 0.12s;
    display: inline-block;  /* hogy a padding érvényesüljön */
  }
  .section-title:hover {
    background: #f1f5f9;
  }
  /* Szakasznév szerkesztés közben */
  .section-title.section-title-editing {
    background: #fef3c7;
    box-shadow: inset 0 0 0 2px #f59e0b;
    outline: none;
    cursor: text !important;
    /* A text-transform NEM változik – marad az uppercase */
  }
  .section-move-btns { display: inline-flex; gap: 2px; }
  .section-move-btns .tool-btn { padding: 1px 6px; font-size: 0.65rem; line-height: 1; }
  .section.szakasz .section-title { color: var(--szakasz); }
  /* Paletta gomb a szakasznév mellett: a szakasz háttérszíne. */
  .section-color-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.12s, background 0.12s, border-color 0.12s;
  }
  .section-color-btn:hover {
    opacity: 1;
    background: #f1f5f9;
    border-color: #94a3b8;
  }
  .section-color-btn.is-set {
    opacity: 1;
    border-color: #8b5cf6;
    background: #f5f3ff;
  }
  /* A paletta menü (a .terminal-menu mintájára, saját azonosítóval). */
  .section-color-menu {
    position: fixed;
    z-index: 10035;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 6px;
    display: none;
    font-size: 0.9rem;
    user-select: none;
    -webkit-user-select: none;
  }
  .section-color-menu.show { display: block; }
  .section-color-menu .section-color-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 4px 6px;
    white-space: nowrap;
  }
  .section-color-menu .section-color-grid {
    display: grid;
    grid-template-columns: repeat(5, 26px);
    gap: 6px;
  }
  .section-color-menu .section-color-swatch {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    color: #475569;
    transition: transform 0.1s, border-color 0.12s, box-shadow 0.12s;
  }
  .section-color-menu .section-color-swatch:hover {
    transform: scale(1.08);
    border-color: #64748b;
  }
  .section-color-menu .section-color-swatch.is-active {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px #ddd6fe;
    color: #6d28d9;
  }
  /* A paletta gomb nem jelenik meg, ahol a szakasz-eszköztár sem:
     zárolt szakasz, nyomtatás. A diáklapról a kiadáskor amúgy is
     kikerül (publish.js), ez a szabály csak biztonsági tartalék. */
  body.locked .section-color-btn,
  body.mode-fill-only .section-color-btn,
  body:not(.teacher-mode) .section-color-btn { display: none !important; }
  @media print {
    .section-color-btn,
    .section-color-menu { display: none !important; }
  }
  .section-tools {
    display: flex; gap: 3px; flex-wrap: wrap;
    margin-left: auto; max-width: 100%;
  }
  /* Kompakt gombok a szakasz-eszköztárban, hogy a Feladat, Szöveg,
     Kép, Fájl, Jegyzet, Teszt, Terminál, Utasítás, … gombok
     egy sorba elférjenek. */
  .section-tools .tool-btn {
    padding: 3px 7px;
    font-size: 0.72rem;
    font-weight: 600;
  }
  .section-tools .section-move-btns {
    padding-right: 3px;
    margin-right: 1px;
  }
  .section-tools .section-move-btns .tool-btn {
    padding: 2px 5px;
    font-size: 0.68rem;
    line-height: 1.2;
  }
  .section-tools .section-block-badge {
    padding: 3px 8px;
    min-width: 70px;
  }
  .section-tools .section-block-badge .badge-icon {
    font-size: 0.75rem;
  }
  .section-tools .section-block-badge .badge-text {
    font-size: 0.66rem;
  }

  /* A mozgatás gombok és a badge a gombok sorában vannak.
     Egy vékony elválasztó vonal választja el őket a többi gombtól. */
  .section-tools > .section-move-btns {
    padding-right: 4px;
    margin-right: 2px;
    border-right: 1px solid #e2e8f0;
  }

  /* Ha a cím és a gombok nem férnek el egy sorban,
     a cím felülre kerül középre, a gombok alulra középre. */
  .section-head.section-head-wrapped {
    flex-direction: column;
    align-items: center;
  }
  .section-head.section-head-wrapped .section-title-group {
    justify-content: center;
    max-width: 100%;
  }
  .section-head.section-head-wrapped .section-tools {
    margin-left: 0;
    justify-content: center;
    max-width: 100%;
  }

  .tool-btn {
    background: white; border: 1px solid var(--border); border-radius: 6px;
    padding: 4px 10px; font-size: 0.78rem; cursor: pointer;
    font-weight: 600; color: #475569;
  }
  .tool-btn:hover { background: #e2e8f0; }
  .tool-btn.danger { color: #b91c1c; }
  .tool-btn.danger:hover { background: #fee2e2; }
  .tool-btn.instruction-btn { color: #b91c1c; border-color: #fca5a5; background: #fef2f2; }
  .tool-btn.instruction-btn:hover { background: #fee2e2; border-color: #f87171; }
  .tool-btn.dup-btn { color: var(--dup); border-color: #bae6fd; background: #f0f9ff; }
  .tool-btn.dup-btn:hover { background: #e0f2fe; border-color: #7dd3fc; }
  .tool-btn.file-btn { color: var(--file-accent); border-color: var(--file-border); background: var(--file-bg); }
  .tool-btn.file-btn:hover { background: #e0f2fe; border-color: #7dd3fc; }
  .tool-btn.note-btn { color: #166534; border-color: #86efac; background: #f0fdf4; }
  .tool-btn.note-btn:hover { background: #dcfce7; border-color: #4ade80; }
  /* Kisméretű config gomb a + Utasítás mellett – világoskék */
  .tool-btn.config-tool-btn {
    color: #1e40af;
    background: #dbeafe;
    border-color: #93c5fd;
    padding: 4px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
  }
  .tool-btn.config-tool-btn:hover {
    background: #bfdbfe;
    border-color: #60a5fa;
    color: #1e40af;
  }
  header h1, .section-title, .setup-info, .step-number,
  .empty-hint, .block-handle, .save-bar {
    user-select: none; -webkit-user-select: none; -ms-user-select: none; -moz-user-select: none;
  }
  .section textarea {
    width: 100%; min-height: 90px; padding: 10px;
    border: 1px solid var(--border); border-radius: 6px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9rem; resize: vertical; background: white;
    cursor: text; user-select: text; -webkit-user-select: text;
    overflow: hidden; transition: height 0.12s ease; max-height: 60vh;
  }
  .section textarea:focus, .section input:focus { outline: 2px solid #93c5fd; border-color: transparent; }
  .section img { max-width: 100%; border-radius: 6px; border: 1px solid var(--border); display: block; margin-top: 8px; user-select: none; -webkit-user-drag: none; }
  .blocks { display: flex; flex-direction: column; gap: 8px; }
  .block {
    position: relative; border-radius: 8px; padding: 8px;
    background: white; border: 1px solid var(--border);
    transition: background 0.15s, box-shadow 0.15s;
  }
  /* A tanár által a blokk feliratába írt kérdés/utasítás a diáknál
     a doboz tetején, olvasható fejlécként jelenik meg. Azért kell
     külön elem, mert a diáknál a block-toolbar rejtve van (Kitöltő
     sablon, beadott munka). A tanár nézetében az elem nem jön létre:
     ott a toolbar mezője szerkeszthető.

     A kérdés a válasszal egy kártyán marad, de a kártyán belül
     külön, eltérő hátterű és bal oldali színcsíkos sávként jelenik
     meg, hogy a diák rögtön lássa: ez a feladat kiírása, nem a
     saját válasza. */
  .block > .block-question {
    margin: 0 0 8px; padding: 8px 10px 8px 12px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-bottom: 1px solid #a5b4fc;
    border-left: 4px solid #4f46e5;
    border-radius: 6px;
    font-size: 0.98rem; font-weight: 600; line-height: 1.35;
    color: #1e1b4b; white-space: pre-wrap; overflow-wrap: anywhere;
  }
  /* Kis felirat a sáv tetején, hogy a kérdés és a válasz
     összetéveszthetetlen legyen. */
  .block > .block-question::before {
    content: 'Tanári kérdés';
    display: block; margin-bottom: 3px;
    font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em;
    text-transform: uppercase; color: #4338ca;
  }
  .block.dragging { opacity: 0.5; background: #eff6ff; }
  .block.drag-over-top { box-shadow: 0 -3px 0 0 #3b82f6; }
  .block.drag-over-bottom { box-shadow: 0 3px 0 0 #3b82f6; }
  /* Step-instruction mozgatása: a section mutatja a drop pozíciót. */
  .section.drag-over-top { box-shadow: 0 -4px 0 0 #3b82f6; }
  .section.drag-over-bottom { box-shadow: 0 4px 0 0 #3b82f6; }
  /* .sections közé áthelyezett step-instruction blokk margója. */
  .sections > .block.instruction-block {
    margin-bottom: 12px;
  }
  .sections > .block.instruction-block:last-child {
    margin-bottom: 0;
  }
  /* .step-instructions konténer drop-hover jelzése. */
  .step-instructions.drag-over-target {
    background: rgba(59, 130, 246, 0.06);
    outline: 2px dashed #93c5fd;
    outline-offset: 2px;
    border-radius: 8px;
    padding: 6px;
  }
  .block.locked { border-color: var(--locked-border); }
  .block.locked::after {
    content: '🔒'; position: absolute; top: 4px; right: 4px;
    font-size: 0.9rem; opacity: 0.8; pointer-events: none;
  }
  .block-toolbar { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 6px; align-items: center; }
  .block-toolbar .icon-btn { padding: 3px 7px; font-size: 0.72rem; }
  .block-handle {
    cursor: grab; user-select: none; padding: 2px 6px;
    border-radius: 4px; font-size: 0.72rem; color: #94a3b8; margin-right: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 260px;
    min-width: 0;
  }
  .block-handle:hover { background: #f1f5f9; color: #475569; }
  .block-handle:active { cursor: grabbing; }
  .block.locked .block-handle { cursor: default; color: #92400e; }
  .block-handle .handle-icon {
    flex-shrink: 0;
    user-select: none;
  }
  .block-handle .handle-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .block-handle .handle-label-input {
    flex: 1;
    min-width: 60px;
    max-width: 200px;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    font-size: 0.72rem;
    color: inherit;
    padding: 1px 4px;
    border-radius: 3px;
    outline: none;
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
  }
  .block-handle .handle-label-input:hover {
    border-color: #cbd5e1;
    background: white;
  }
  .block-handle .handle-label-input:focus {
    border-color: #93c5fd;
    background: white;
    color: #1e293b;
  }
  .block-handle .handle-label-input::placeholder {
    color: #cbd5e1;
    font-style: italic;
  }
  .block textarea {
    width: 100%; min-height: 80px;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 8px 10px; font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9rem; resize: vertical; background: white;
    user-select: text; -webkit-user-select: text;
    overflow: hidden; transition: height 0.12s ease; max-height: 60vh;
  }
  .block.locked textarea { background: #ffffff; cursor: not-allowed; }
  .block textarea:focus { outline: 2px solid #93c5fd; border-color: transparent; }
  .block img {
    max-width: 100%; border-radius: 6px; display: block; margin-top: 4px;
    user-select: none; -webkit-user-drag: none;
  }
  .markdown-preview, .md-editor-preview {
    padding: 10px 12px; background: white;
    border: 1px solid var(--border); border-radius: 6px;
    min-height: 80px; font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.95rem; line-height: 1.6; color: #1e293b; overflow-x: auto;
  }
  .markdown-preview h1, .md-editor-preview h1 { font-size: 1.5rem; margin: 0.6em 0 0.4em; font-weight: 700; }
  .markdown-preview h2, .md-editor-preview h2 { font-size: 1.25rem; margin: 0.6em 0 0.4em; font-weight: 700; }
  .markdown-preview h3, .md-editor-preview h3 { font-size: 1.05rem; margin: 0.6em 0 0.4em; font-weight: 700; }
  .markdown-preview h4, .md-editor-preview h4 { font-size: 0.95rem; margin: 0.6em 0 0.4em; font-weight: 700; }
  .markdown-preview h1:first-child, .md-editor-preview h1:first-child, 
  .markdown-preview h2:first-child, .md-editor-preview h2:first-child, 
  .markdown-preview h3:first-child, .md-editor-preview h3:first-child { margin-top: 0; }
  .markdown-preview p, .md-editor-preview p { margin: 0.5em 0; }
  .markdown-preview strong, .md-editor-preview strong { font-weight: 700; }
  .markdown-preview em, .md-editor-preview em { font-style: italic; }
  .markdown-preview code, .md-editor-preview code {
    background: #f1f5f9; padding: 1px 5px; border-radius: 3px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9em; color: #be185d;
  }
  .markdown-preview pre, .md-editor-preview pre {
    background: #cbd5e1; color: #1e293b; padding: 10px 12px;
    border-radius: 6px; overflow-x: auto; margin: 0.5em 0;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.85rem; line-height: 1.5;
    border: 1px solid #94a3b8;
  }
  .markdown-preview pre code, .md-editor-preview pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }
  .markdown-preview blockquote, .md-editor-preview blockquote {
    border-left: 4px solid #cbd5e1; margin: 0.5em 0; padding: 4px 12px;
    color: #64748b; background: #f8fafc; border-radius: 0 4px 4px 0;
  }
  .markdown-preview ul, .md-editor-preview ul, .markdown-preview ol, .md-editor-preview ol{ margin: 0.5em 0; padding-left: 26px; }
  .markdown-preview li, .md-editor-preview li { margin: 0.2em 0; }
  .markdown-preview hr, .md-editor-preview hr { border: none; border-top: 1px solid #e2e8f0; margin: 0.8em 0; }
  .markdown-preview a, .md-editor-preview a { color: #2563eb; text-decoration: underline; }
  .markdown-preview mark, .md-editor-preview mark {
    background: #fef08a;
    color: inherit;
    padding: 1px 3px;
    border-radius: 2px;
  }
  .markdown-preview sup, .md-editor-preview sup,
  .markdown-preview sub, .md-editor-preview sub {
    font-size: 0.75em;
    line-height: 0;
  }
  .markdown-preview hr, .md-editor-preview hr {
    border: none; border-top: 1px solid #e2e8f0; margin: 0.8em 0;
  }
  /* Feladatlista */
  .markdown-preview .task-list-item, .md-editor-preview .task-list-item {
    list-style: none;
    margin-left: -20px;
  }
  .markdown-preview .task-list-item input[type=checkbox],
  .md-editor-preview .task-list-item input[type=checkbox] {
    margin-right: 6px;
  }
  .markdown-preview table, .md-editor-preview table { border-collapse: collapse; margin: 0.5em 0; font-size: 0.9em; }
  .markdown-preview th, .md-editor-preview th, .markdown-preview td, .md-editor-preview td{ border: 1px solid #cbd5e1; padding: 8px 12px; min-height: 32px; min-width: 40px; vertical-align: middle; }
  /* Üres cella: kattintható maradjon */
  .markdown-preview td:empty::after, .md-editor-preview td:empty::after,
  .markdown-preview th:empty::after, .md-editor-preview th:empty::after {
    content: '\00a0';
  }
  .markdown-preview th, .md-editor-preview th { background: #f1f5f9; font-weight: 600; }
  .markdown-preview tbody tr:nth-child(even), .md-editor-preview tbody tr:nth-child(even) { background: #f8fafc; }
  .markdown-preview pre.raw-text, .md-editor-preview pre.raw-text, 
  .note-preview-body pre.raw-text {
    background: #f8fafc; color: #1e293b; border: 1px solid var(--border);
    white-space: pre-wrap; word-wrap: break-word;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9rem; padding: 12px 14px; margin: 0; line-height: 1.5;
  }
  .block.instruction-block {
    position: relative; background: #fef3c7; border: 1px solid #f59e0b;
    border-radius: 8px; padding: 4px 8px; overflow: visible;
  }
  .block.instruction-block::after { content: none; }
  .block.instruction-block .block-toolbar {
    position: absolute; top: 3px; right: 3px;
    padding: 0; margin: 0; background: transparent; z-index: 1;
  }
  .block.instruction-block .instruction-text {
    width: 100%; min-height: 24px; border: none; outline: none;
    border-radius: 0; padding: 4px 130px 4px 28px;
    font-family: inherit; font-size: 0.95rem; resize: none;
    background: transparent; color: #7f1d1d; font-weight: 500;
    line-height: 1.4; cursor: text; box-shadow: none;
    display: block; overflow: hidden; word-wrap: break-word;
    transition: height 0.12s ease; max-height: 60vh;
  }
  .block.instruction-block .instruction-text:focus {
    outline: none; border: none; box-shadow: none;
  }
  /* Tanárnál a textarea mindig kattintható és szerkeszthető */
  body.teacher-mode .block.instruction-block .instruction-text {
    pointer-events: auto !important;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
  }
  body.teacher-mode .block.instruction-block .instruction-text[disabled] {
    pointer-events: auto !important;
    cursor: text !important;
    -webkit-text-fill-color: #7f1d1d !important;
    color: #7f1d1d !important;
  }
  .block.instruction-block .instruction-text[disabled] {
    background: transparent; color: #7f1d1d; cursor: not-allowed;
    opacity: 1; -webkit-text-fill-color: #7f1d1d;
  }
  .block.instruction-block .markdown-preview{
    background: transparent; border: none;
    padding: 4px 130px 4px 28px; color: #7f1d1d;
    font-weight: 500; min-height: 24px;
  }
  .block.instruction-block .markdown-preview h1, 
  .block.instruction-block .markdown-preview h2, 
  .block.instruction-block .markdown-preview h3, 
  .block.instruction-block .markdown-preview h4{ color: #7f1d1d; }
  .block.instruction-block .markdown-preview code{ background: #fde68a; color: #7f1d1d; }
  .block.instruction-block .markdown-preview pre{
    background: #7f1d1d; color: #fef3c7;
  }
  .block.instruction-block .markdown-preview blockquote{
    border-left-color: #f59e0b; color: #78350f; background: #fef9e7;
  }
  .block.instruction-block .markdown-preview strong{ color: #7f1d1d; }
  .block.instruction-block .markdown-preview th{
    background: #fde68a; color: #7f1d1d;
  }
  .block.instruction-block .markdown-preview th, 
  .block.instruction-block .markdown-preview td{
    border-color: #f59e0b;
  }
  .block.instruction-block .markdown-preview tbody tr:nth-child(even){
    background: #fef9e7;
  }
  .block.instruction-block .markdown-preview pre.raw-text{
    background: #fef3c7; color: #7f1d1d; border: 1px solid #f59e0b;
  }
  .block.instruction-block .lock-btn { opacity: 1; cursor: not-allowed !important; }
  .block.instruction-block .lock-btn:hover { background: #fef3c7; }
  /* Az utasítás blokk drag handle-je a bal szélen, középen. */
  .block.instruction-block .block-handle {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    z-index: auto;
    padding: 2px 4px;
    background: transparent;
    border-radius: 4px;
    cursor: grab;
    user-select: none;
    color: #94a3b8;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    max-width: none;
    min-width: 0;
  }
  .block.instruction-block .block-handle:hover {
    background: #fde68a;
    color: #78350f;
  }
  .block.instruction-block .block-handle:active {
    cursor: grabbing;
  }
  body:not(.teacher-mode) .block.instruction-block .block-handle { display: none !important; }
  .block.file-block { background: var(--file-bg); border: 1px solid var(--file-border); }
  .block.file-block .file-info {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 4px; font-size: 0.9rem; color: var(--file-accent); flex-wrap: wrap;
  }
  .block.file-block .file-info .file-icon { font-size: 1.4rem; }
  .block.file-block .file-info .file-name { font-weight: 600; word-break: break-all; }
  .block.file-block .file-info .file-size { color: #64748b; font-size: 0.82rem; }
  .block.file-block .file-info .file-actions { display: flex; gap: 6px; margin-left: auto; }
  .block.file-block .file-info .file-actions .icon-btn { font-size: 0.8rem; padding: 4px 8px; }
  .block.file-block .file-input-row { padding: 4px 0; }
  .block.note-block { background: #f0fdf4; border: 1px solid #86efac; }
  .block.note-block .note-info {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 4px; font-size: 0.9rem; color: #166534; flex-wrap: wrap;
  }
  .block.note-block .note-info .note-icon { font-size: 1.4rem; }
  .block.note-block .note-info .note-name { font-weight: 600; word-break: break-all; }
  .block.note-block .note-info .note-size { color: #64748b; font-size: 0.82rem; }
  .block.note-block .note-info .note-actions { display: flex; gap: 6px; margin-left: auto; }
  .block.note-block .note-info .note-actions .icon-btn { font-size: 0.8rem; padding: 4px 8px; }
  .block.note-block .note-input-row { padding: 4px 0; }
  .block.note-block .note-preview {
    background: white; border: 1px solid #86efac;
    border-radius: 6px; padding: 0; overflow: hidden;
  }
  .block.note-block .note-preview-header {
    background: #dcfce7; color: #166534; padding: 8px 12px;
    font-size: 0.85rem; font-weight: 700; border-bottom: 1px solid #86efac;
    word-break: break-all;
  }
  .block.note-block .note-preview-body {
    padding: 12px 16px; font-size: 0.95rem; line-height: 1.6;
    color: #1e293b; max-height: 60vh; overflow-y: auto;
  }
  .block.note-block .note-preview-body .markdown-preview{
    padding: 0; background: transparent; border: none; min-height: 0;
  }
  .block.note-block .note-preview-body,
  .note-viewer-body { word-wrap: break-word; overflow-wrap: break-word; }
  .block.note-block .note-preview-body img,
  .note-viewer-body img { max-width: 100%; height: auto; border-radius: 6px; }
  .block.note-block .note-preview-body table,
  .note-viewer-body table { border-collapse: collapse; max-width: 100%; }
  .note-shadow-host {
    display: block; width: 100%; min-height: 40px;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.95rem; line-height: 1.6; color: #1e293b;
    background: white; padding: 16px 18px; border-radius: 6px;
    box-sizing: border-box; overflow-x: auto;
  }
  .hint-field-wrap {
    display: none; margin-top: 8px;
    border: 1px dashed #fcd34d; border-radius: 6px;
    background: #fffbeb; padding: 6px 8px;
  }
  .hint-field-wrap.show { display: block; }
  .hint-field-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.72rem; font-weight: 700; color: #92400e;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 4px; user-select: none;
  }
  .hint-field-label .hint-field-hint {
    font-weight: 400; color: #b45309;
    text-transform: none; letter-spacing: 0;
  }
  .hint-field-textarea {
    width: 100%; min-height: 40px;
    border: 1px solid #fcd34d; border-radius: 4px;
    padding: 6px 8px; font-family: "Consolas", "Courier New", monospace;
    font-size: 0.85rem; resize: vertical; background: #fffbeb;
    color: #78350f; outline: none; cursor: text; user-select: text;
    overflow: hidden; transition: height 0.12s ease; max-height: 60vh;
  }
  .hint-field-textarea:focus { outline: 2px solid #f59e0b; border-color: transparent; }
  .hint-field-textarea::placeholder { color: #b45309; font-style: italic; }
  body:not(.teacher-mode) .hint-field-wrap,
  body:not(.teacher-mode) .hint-btn { display: none !important; }
  .add-row { display: flex; gap: 8px; margin-top: 10px; }
  .add-btn {
    background: white; border: 1px dashed var(--border); border-radius: 6px;
    padding: 6px 12px; font-size: 0.82rem; cursor: pointer;
    color: #475569; font-weight: 600;
  }
  .add-btn:hover { background: #f1f5f9; border-style: solid; }
  .footer { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }
  .footer .btn { padding: 12px 22px; font-size: 0.95rem; }
  .btn.secondary { background: #475569; }
  .btn.primary { background: #2563eb; }
  .btn.success { background: #059669; }
  .btn.warn { background: #d97706; }
  .btn.lock { background: #7c3aed; }
  .btn.publish { background: #ea580c; }
  .empty-hint { color: #94a3b8; font-size: 0.88rem; font-style: italic; padding: 4px 0; }
  body.locked .btn.szakasz,
  body.locked .btn.instruction-step-btn,
  body.locked .delete-step,
  body.locked .section-tools,
  body.locked .add-btn,
  body.locked .footer .btn.primary,
  body.locked .footer .btn.warn,
  body.locked .footer .btn.success,
  body.locked .step-actions,
  body.locked .insert-bar,
  body.locked .block-toolbar,
  body.locked .section-config-panel,
  body.locked .section-move-btns,
  body.locked .button-row { display: none !important; }
  body.mode-no-add-step #btnAddStep,
  body.mode-no-add-step .insert-bar,
  body.mode-no-add-step .delete-step,
  body.mode-no-add-step .step-actions,
  body.mode-fill-only #btnAddStep,
  body.mode-fill-only .insert-bar,
  body.mode-fill-only .delete-step,
  body.mode-fill-only .step-actions { display: none !important; }

  /* A panel-összecsukás gomb MINDIG látható, minden módban */
  #btnToggleAllSteps { display: inline-block !important; }
  body.mode-no-add-block .section-tools .tool-btn:not(.danger),
  body.mode-no-add-block .block-toolbar .icon-btn:not(.danger),
  body.mode-fill-only .section-tools,
  body.mode-fill-only .block-toolbar { display: none !important; }
  body.mode-fill-only .step-title-group input {
    background: transparent; border: none; pointer-events: none;
  }
  /* A 4-es (Kitöltő) sablonban a Megjegyzés gomb MINDIG látható,
     de a többi gomb (Szakasz, Utasítás) rejtve van. */
  body.mode-fill-only .button-row { display: flex !important; }
  body.mode-fill-only .button-row > *:not(.comment-step-btn) {
    display: none !important;
  }
  /* Ha a Megjegyzés gomb nincs engedélyezve, a sor üresen marad –
     ezt is elrejtjük, hogy ne maradjon üres hely. */
  body.mode-fill-only .button-row:not(:has(.comment-step-btn)) {
    display: none !important;
  }
  body.mode-fill-only .step-number { cursor: default !important; }
  .modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    z-index: 9999; padding: 20px;
  }
  .modal-backdrop.show {
    display: flex;
    align-items: flex-start;
    overflow-y: auto;
  }
  /* A modal marad kozepen, de ha nem fer el, a backdrop
     gorgetheto lesz. A margin:auto gondoskodik a kozepre
     igazitasrol, ha van eleg hely. */
  .modal-backdrop.show > .modal {
    margin: auto;
  }
  .modal {
    background: white; border-radius: 12px;
    padding: 24px 28px; max-width: 720px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalIn 0.15s ease-out;
  }
  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
  }
  .modal h3 { margin: 0 0 6px; font-size: 1.2rem; }
  .modal > p { margin: 0 0 18px; color: #64748b; font-size: 0.9rem; }
  .modal-templates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .modal-template-card {
    background: #f8fafc; border: 2px solid var(--border);
    border-radius: 10px; padding: 12px 14px; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
  }
  .modal-template-card:hover { background: #f1f5f9; }
  .modal-template-card.selected { border-color: var(--primary); background: #eff6ff; }
  .modal-template-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    background: #f1f5f9;
    border-style: dashed;
  }
  .modal-template-card.disabled .num {
    background: #94a3b8;
  }
  .modal-template-card h4 { margin: 0 0 4px; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; }
  .modal-template-card .num {
    display: inline-block; background: var(--primary); color: white;
    width: 20px; height: 20px; border-radius: 50%;
    text-align: center; line-height: 20px;
    font-size: 0.7rem; font-weight: 700;
  }
  .modal-template-card p { margin: 0; font-size: 0.78rem; color: #64748b; }
  .modal label.field-label {
    display: block; font-size: 0.8rem; font-weight: 600; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 6px; margin-top: 12px;
  }
  .modal input[type=text] {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.9rem; font-family: inherit;
  }
  .modal input[type=file] {
    width: 100%; padding: 6px 0;
    font-size: 0.88rem; font-family: inherit;
  }
  .modal select {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.9rem; font-family: inherit; background: white;
  }
  .modal textarea {
    width: 100%; padding: 10px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.9rem; font-family: "Consolas", "Courier New", monospace;
    resize: vertical; background: white;
  }
  .modal-checkbox { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.88rem; color: #475569; }
  .modal-checkbox input { width: auto; }
  .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
  .modal-actions .btn { padding: 10px 18px; }
  .name-list-info {
    font-size: 0.82rem; color: #64748b;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 10px; margin-top: 6px;
  }
  /* Export modális */
  .export-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 18px 0 8px;
  }
  .export-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .export-card-icon {
    font-size: 2rem;
    line-height: 1;
  }
  .export-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
  }
  .export-card-desc {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    flex: 1;
  }
  .export-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
  }
  .export-card-actions .btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
  @media (max-width: 900px) {
    .export-grid { grid-template-columns: 1fr 1fr; }
  }
  @media (max-width: 600px) {
    .export-grid { grid-template-columns: 1fr; }
  }

  /* Markdown editor modális */
  .md-editor-modal {
    max-width: 1200px; width: 95%; height: 90vh; max-height: 90vh;
    display: flex; flex-direction: column;
    padding: 0; overflow: hidden;
  }
  .md-editor-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
  }
  .md-editor-header h3 {
    margin: 0; font-size: 1.05rem;
    word-break: break-all;
  }
  .md-editor-header-actions { display: flex; gap: 4px; align-items: center; }
  .md-editor-close {
    background: transparent; border: none;
    font-size: 1.1rem; font-weight: 700;
    cursor: pointer; padding: 4px 10px;
    border-radius: 6px; line-height: 1;
    color: #64748b;
  }
  .md-editor-close:hover { background: #e2e8f0; color: #1e293b; }

  /* Toolbar */
  .md-editor-toolbar {
    display: flex; gap: 4px; flex-wrap: wrap;
    padding: 8px 12px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
  }
  .md-toolbar-btn {
    background: white; border: 1px solid var(--border);
    border-radius: 6px; padding: 5px 10px;
    font-size: 0.85rem; font-weight: 600; color: #475569;
    cursor: pointer; line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    min-width: 32px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .md-toolbar-btn:hover { background: #e2e8f0; color: #1e293b; }
  .md-toolbar-btn.bold { font-weight: 900; }
  .md-toolbar-btn.italic { font-style: italic; }
  .md-toolbar-btn.strike { text-decoration: line-through; }
  .md-toolbar-btn.danger { color: #b91c1c; }
  .md-toolbar-btn.danger:hover { background: #fee2e2; }
  .md-toolbar-sep {
    width: 1px; background: var(--border);
    margin: 0 4px; align-self: stretch;
  }

  /* Két hasáb: bal textarea, jobb előnézet */
  .md-editor-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    /* A modal 90vh magasságából a header, toolbar, footer levonva
       marad a testnek. Explicit minimum, hogy ne omoljon össze. */
  }
  .md-editor-left,
  .md-editor-right {
    display: flex; flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }
  .md-editor-left {
    border-right: 1px solid var(--border);
    min-height: 400px;
  }
  .md-editor-label {
    font-size: 0.72rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 8px 14px 4px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
  }
  .md-editor-textarea {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    padding: 14px 16px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.55;
    resize: none;
    background: white;
    color: #1e293b;
    overflow-y: auto;
  }
  .md-editor-preview {
    flex: 1;
    padding: 14px 18px;
    overflow-y: auto;
    background: white;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #1e293b;
  }
  .md-editor-preview p:first-child { margin-top: 0; }
  .md-editor-preview p:last-child { margin-bottom: 0; }

  /* Táblázat cella-szerkesztés */
  .md-editor-preview table td[data-md-row],
  .md-editor-preview table th[data-md-row] {
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s;
    position: relative;
    min-height: 32px;
  }
  .md-editor-preview table td[data-md-row]:hover,
  .md-editor-preview table th[data-md-row]:hover {
    background: #eff6ff;
    box-shadow: inset 0 0 0 2px #93c5fd;
  }
  .md-editor-preview table td[data-md-row].md-cell-editing,
  .md-editor-preview table th[data-md-row].md-cell-editing {
    background: #fef3c7;
    box-shadow: inset 0 0 0 2px #f59e0b;
    cursor: text;
    outline: none;
  }
  .md-editor-preview table td[data-md-row].md-cell-editing::after,
  .md-editor-preview table th[data-md-row].md-cell-editing::after {
    content: '✏️';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.75rem;
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  }

  /* Link popup */
  .md-link-popup-wrap {
    position: relative;
  }
  .md-link-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 12px 14px;
    margin-top: 4px;
    min-width: 280px;
  }
  .md-link-popup.show { display: block; }
  .md-link-popup label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    margin-top: 8px;
  }
  .md-link-popup label:first-child { margin-top: 0; }
  .md-link-popup input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
  }
  .md-link-popup input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
  }
  .md-link-popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 10px;
  }
  .md-link-popup-actions button {
    border: none;
    border-radius: 5px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
  }
  .md-link-popup-actions .cancel {
    background: #e2e8f0;
    color: #475569;
  }
  .md-link-popup-actions .cancel:hover { background: #cbd5e1; }
  .md-link-popup-actions .confirm {
    background: #2563eb;
    color: white;
  }
  .md-link-popup-actions .confirm:hover { background: #1d4ed8; }

  /* Táblázat picker */
  .md-table-picker-wrap {
    position: relative;
  }
  .md-table-picker {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 10px 12px;
    margin-top: 4px;
  }
  .md-table-picker.show { display: block; }
  .md-table-picker-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
    text-align: center;
    min-height: 16px;
  }
  .md-table-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 22px);
    grid-template-rows: repeat(5, 22px);
    gap: 3px;
    margin-bottom: 6px;
  }
  .md-table-picker-cell {
    width: 22px;
    height: 22px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #f8fafc;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
  }
  .md-table-picker-cell.hover {
    background: #dbeafe;
    border-color: #3b82f6;
  }
  .md-table-picker-hint {
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
  }

  /* Lábléc */
  .md-editor-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
  }

  /* Mobilon egymás alatt */
  @media (max-width: 700px) {
    .md-editor-body { grid-template-columns: 1fr; }
    .md-editor-left { border-right: none; border-bottom: 1px solid var(--border); }
  }

  /* Előnézet modális */
  .preview-modal {
    max-width: 900px; width: 95%; max-height: 90vh;
    display: flex; flex-direction: column;
    padding: 0; overflow: hidden;
  }
  .preview-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
  }
  .preview-modal-header h3 {
    margin: 0; font-size: 1.05rem;
    word-break: break-all;
  }
  .preview-modal-header-actions {
    display: flex; gap: 4px; align-items: center;
  }
  .preview-modal-close,
  .preview-modal-external {
    background: transparent; border: none;
    font-size: 1.1rem; font-weight: 700;
    cursor: pointer; padding: 4px 10px;
    border-radius: 6px; line-height: 1;
  }
  .preview-modal-close { color: #64748b; }
  .preview-modal-close:hover { background: #e2e8f0; color: #1e293b; }
  .preview-modal-external { color: #2563eb; }
  .preview-modal-external:hover { background: #dbeafe; color: #1e40af; }
  .preview-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    background: #ffffff;
  }
  .preview-modal-body pre {
    background: white;
    margin: 0; padding: 16px 20px;
    white-space: pre-wrap; word-wrap: break-word;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.85rem; line-height: 1.55;
    color: #1e293b;
  }

  /* Mappa tartalma modális */
  .folder-modal {
    max-width: 700px; width: 90%; max-height: 85vh;
    display: flex; flex-direction: column; padding: 0; overflow: hidden;
  }
  .folder-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border); background: #f8fafc;
  }
  .folder-modal-header h3 { margin: 0; font-size: 1.1rem; word-break: break-all; }
  .folder-modal-header-actions {
    display: flex; align-items: center; gap: 6px;
  }
  .folder-modal-close {
    background: transparent; border: none; font-size: 1.2rem;
    font-weight: 700; color: #64748b; cursor: pointer;
    padding: 4px 10px; border-radius: 6px; line-height: 1;
  }
  .folder-modal-close:hover { background: #e2e8f0; color: #1e293b; }
  .folder-modal-body {
    padding: 16px 20px; overflow-y: auto; flex: 1;
  }
  .folder-file-list {
    display: flex; flex-direction: column; gap: 10px;
  }
  .folder-file-item {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
  }
  .folder-file-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-color: #94a3b8;
  }
  .folder-file-body {
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
  }
  .folder-file-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .folder-file-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    word-break: break-all;
    font-family: "Consolas", "Courier New", monospace;
  }
  .folder-file-meta {
    font-size: 0.8rem;
    color: #64748b;
  }
  .folder-file-desc {
    background: #ecfeff;
    border-bottom: 1px solid #a5f3fc;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0c4a6e;
    line-height: 1.35;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .folder-file-actions {
    display: flex; gap: 4px; flex-shrink: 0;
  }
  .folder-file-actions .icon-btn {
    padding: 5px 9px; font-size: 0.85rem;
  }
  .folder-empty {
    text-align: center; padding: 40px 20px;
    color: #94a3b8; font-style: italic; font-size: 0.95rem;
  }
  .folder-loading {
    text-align: center; padding: 40px 20px;
    color: #64748b; font-size: 0.95rem;
  }
  .confirm-modal { max-width: 480px; }
  .confirm-modal h3 {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.15rem; margin: 0 0 12px;
  }
  .confirm-modal p {
    margin: 0 0 22px; color: #475569;
    font-size: 0.95rem; line-height: 1.5;
  }
  .confirm-modal .modal-actions .btn { min-width: 90px; }
  .btn.danger-confirm { background: #dc2626; }
  .btn.danger-confirm:hover { background: #b91c1c; }
  .note-viewer-modal {
    max-width: 800px; width: 90%; max-height: 85vh;
    display: flex; flex-direction: column; padding: 0; overflow: hidden;
  }
  .note-viewer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border); background: #f8fafc;
  }
  .note-viewer-header h3 { margin: 0; font-size: 1.1rem; word-break: break-all; }
  .note-viewer-header-actions { display: flex; gap: 6px; align-items: center; }
  .note-viewer-close {
    background: transparent; border: none; font-size: 1.2rem;
    font-weight: 700; color: #64748b; cursor: pointer;
    padding: 4px 10px; border-radius: 6px; line-height: 1;
  }
  .note-viewer-close:hover { background: #e2e8f0; color: #1e293b; }
  .note-viewer-edit {
    background: transparent; border: none; font-size: 1.1rem;
    font-weight: 700; color: #166534; cursor: pointer;
    padding: 4px 10px; border-radius: 6px; line-height: 1;
  }
  .note-viewer-edit:hover { background: #dcfce7; color: #14532d; }
  .note-viewer-external {
    background: transparent; border: none; font-size: 1.1rem;
    font-weight: 700; color: #2563eb; cursor: pointer;
    padding: 4px 10px; border-radius: 6px; line-height: 1;
  }
  .note-viewer-external:hover { background: #dbeafe; color: #1e40af; }
  .note-viewer-body {
    padding: 20px 24px; overflow-y: auto; flex: 1;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.95rem; line-height: 1.65; color: #1e293b;
  }
  .note-viewer-body pre.raw-text {
    white-space: pre-wrap; word-wrap: break-word;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9rem; background: #f8fafc;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 14px 16px; margin: 0; color: #1e293b;
  }
  .note-viewer-body .markdown-preview{
    padding: 0; background: transparent; border: none; min-height: 0;
  }
  .note-input-modal { max-width: 700px; width: 90%; }
  .note-input-modal .field-label {
    display: block; font-size: 0.8rem; font-weight: 600; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 6px; margin-top: 12px;
  }
  .note-input-modal .note-file-row {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    background: #f0fdf4; border: 1px solid #86efac;
    border-radius: 8px; padding: 12px 14px; margin-bottom: 12px;
  }
  .note-input-modal .note-file-row button {
    background: white; border: 1px solid #86efac;
    border-radius: 6px; padding: 8px 14px;
    font-size: 0.88rem; font-weight: 600; color: #166534; cursor: pointer;
  }
  .note-input-modal .note-file-row button:hover { background: #dcfce7; }
  .note-input-modal .note-file-row .hint { font-size: 0.82rem; color: #64748b; }
  .note-input-modal .note-checkbox-row {
    display: flex; align-items: center; gap: 8px;
    margin-top: 12px; padding: 10px 12px;
    background: #f0fdf4; border: 1px solid #86efac;
    border-radius: 6px; font-size: 0.88rem; color: #166534;
    font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap;
  }
  .note-input-modal .note-checkbox-row input {
    width: auto; margin: 0; cursor: pointer; accent-color: #16a34a;
  }
  .annotator-modal {
    position: relative; max-width: 95vw; width: auto;
    max-height: 95vh; padding: 16px;
  }
  .annotator-modal h3 { margin: 0 0 6px; }
  .annotator-hint { font-size: 0.82rem; color: #64748b; margin-bottom: 10px; }
  .annotator-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: stretch; }
  .annotator-toolbar .tool-group {
    display: flex; gap: 4px; padding: 4px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #f8fafc; align-items: center; min-height: 48px; box-sizing: border-box;
  }
  .annotator-toolbar > .tool-group:last-child { margin-left: auto; }
  /* Jel (stamp) palette */
  .annotator-shape-palette {
    display: none;
    gap: 4px;
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
  }
  .annotator-shape-palette.show { display: flex; }
  .annotator-shape-palette .shape-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    margin-right: 6px;
  }
  .annotator-shape-palette .shape-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.12s, background 0.12s;
    color: #1e293b;
  }
  .annotator-shape-palette .shape-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
  }
  .annotator-shape-palette .shape-btn.active {
    background: #dbeafe;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  }
  .annotator-toolbar .tool-group button {
    background: white; border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 12px;
    font-size: 0.85rem; font-weight: 600; color: #475569;
    cursor: pointer; line-height: 1;
  }
  .annotator-toolbar .tool-group button:hover { background: #e2e8f0; }
  .annotator-toolbar .tool-group button.active {
    background: #2563eb; border-color: #2563eb; color: white;
  }
  .annotator-toolbar .tool-group button.danger { color: #b91c1c; }
  .annotator-toolbar .tool-group button.danger:hover { background: #fee2e2; }
  .color-group-single {
    display: flex; flex-direction: row; gap: 2px; padding: 4px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #f8fafc; align-items: center; justify-content: center;
    min-height: 48px; box-sizing: border-box;
  }
  .color-group-single .color-swatch { width: 32px; height: 32px; }
  .color-group-stack {
    display: none; flex-direction: column; gap: 2px; padding: 4px;
    border: 1px solid var(--border); border-radius: 8px;
    background: #f8fafc; justify-content: center; align-items: center;
    min-height: 48px; box-sizing: border-box;
  }
  .color-group-stack.show { display: flex; }
  .color-group-stack .color-row {
    display: flex; gap: 2px; align-items: center; justify-content: center;
  }
  .color-group-stack .color-swatch.small {
    width: 16px; height: 16px; border-radius: 4px;
    border-width: 1.5px; padding: 0; cursor: pointer;
  }
  .color-group-stack .color-swatch.small:hover { transform: scale(1.15); }
  .color-swatch {
    padding: 0; border-radius: 6px; border: 2px solid #cbd5e1; cursor: pointer;
  }
  .annotator-canvas-wrap {
    position: relative; display: inline-block;
    border: 1px solid var(--border); border-radius: 6px;
    overflow: hidden; background: #f1f5f9; max-width: 100%;
  }
  .annotator-canvas-wrap canvas {
    display: block; max-width: 100%; cursor: crosshair;
  }
  .annotator-modal .modal-actions {
    margin-top: 12px; position: relative;
    display: flex; justify-content: flex-end; align-items: center;
    gap: 10px; flex-wrap: nowrap; min-height: 44px;
  }
  .annotator-modal .modal-actions .btn {
    flex-shrink: 0; position: relative; z-index: 11;
  }
  .annotator-context-menu {
    position: fixed; z-index: 10000; background: white;
    border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 4px; min-width: 180px; display: none; font-size: 0.9rem;
  }
  .annotator-context-menu.show { display: block; }

  /* Táblázat cella kontextusmenü */
  .md-table-context-menu {
    position: fixed; z-index: 10001; background: white;
    border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    padding: 4px; min-width: 230px; display: none;
    font-size: 0.88rem;
  }
  .md-table-context-menu.show { display: block; }
  .md-table-context-menu button {
    display: block; width: 100%; text-align: left;
    background: transparent; border: none; border-radius: 4px;
    padding: 8px 12px; font-size: 0.88rem; font-weight: 500;
    color: #1e293b; cursor: pointer; font-family: inherit;
  }
  .md-table-context-menu button:hover { background: #f1f5f9; }
  .md-table-context-menu button.danger { color: #b91c1c; }
  .md-table-context-menu button.danger:hover { background: #fee2e2; }
  .md-table-context-menu button:disabled {
    color: #cbd5e1; cursor: not-allowed;
  }
  .md-table-context-menu button:disabled:hover { background: transparent; }
  .md-table-context-menu .menu-separator {
    height: 1px; background: #e2e8f0; margin: 4px 0;
  }
  .annotator-context-menu button {
    display: block; width: 100%; text-align: left;
    background: transparent; border: none; border-radius: 4px;
    padding: 8px 12px; font-size: 0.88rem; font-weight: 500;
    color: #1e293b; cursor: pointer; font-family: inherit;
  }
  .annotator-context-menu button:hover { background: #f1f5f9; }
  .annotator-context-menu button.danger { color: #b91c1c; }
  .annotator-context-menu button.danger:hover { background: #fee2e2; }
  .annotator-context-menu .menu-separator {
    height: 1px; background: #e2e8f0; margin: 4px 0;
  }
  .annotator-size-panel {
    display: none; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%); width: 60%; max-width: 480px;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 12px;
    align-items: center; gap: 10px; flex-wrap: nowrap;
    z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  .annotator-size-panel.show { display: flex; }
  .annotator-size-panel label {
    font-size: 0.85rem; font-weight: 600; color: #475569;
    white-space: nowrap; flex-shrink: 0;
  }
  .annotator-size-panel input[type=range] { flex: 1; min-width: 0; cursor: pointer; }
  .annotator-size-panel .size-value {
    font-family: "Consolas", monospace; font-size: 0.85rem;
    color: #1e293b; font-weight: 600; min-width: 45px;
    text-align: right; flex-shrink: 0;
  }
  .activity-modal {
    max-width: 900px; width: 95%; padding: 0;
    display: flex; flex-direction: column;
    max-height: 85vh; overflow: hidden;
  }
  .activity-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border); background: #f8fafc;
  }
  .activity-modal-header h3 {
    margin: 0; font-size: 1.15rem;
    display: flex; align-items: center; gap: 8px;
  }
  .activity-modal-header-actions { display: flex; align-items: center; gap: 4px; }
  .activity-modal-sort {
    background: white; border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 12px;
    font-size: 0.82rem; font-weight: 600; color: #475569;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    line-height: 1; transition: background 0.15s, border-color 0.15s, transform 0.05s;
  }
  .activity-modal-sort:hover { background: #f1f5f9; border-color: #94a3b8; }
  .activity-modal-sort:active { transform: scale(0.98); }
  .activity-modal-close {
    background: transparent; border: none;
    font-size: 1.2rem; font-weight: 700; color: #64748b;
    cursor: pointer; padding: 4px 10px; border-radius: 6px; line-height: 1;
  }
  .activity-modal-close:hover { background: #e2e8f0; color: #1e293b; }
  .activity-modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
  .activity-summary {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 20px;
  }
  .activity-summary-card {
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 14px;
  }
  .activity-summary-card .label {
    font-size: 0.68rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
  }
  .activity-summary-card .value {
    font-size: 1.15rem; font-weight: 700; color: #1e293b;
    font-family: "Consolas", "Courier New", monospace;
  }
  .activity-summary-card.green { border-color: #86efac; }
  .activity-summary-card.green .value { color: #166534; }
  .activity-summary-card.yellow { border-color: #fcd34d; }
  .activity-summary-card.yellow .value { color: #92400e; }
  .activity-summary-card.red { border-color: #fca5a5; }
  .activity-summary-card.red .value { color: #991b1b; }
  .activity-log-section-title {
    font-size: 0.78rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em; margin: 20px 0 8px;
  }
  .activity-log-list {
    border: 1px solid var(--border); border-radius: 8px;
    overflow-x: auto; background: white;
  }
  .activity-log-list-header {
    background: #f8fafc; padding: 10px 16px;
    font-size: 0.7rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    display: grid; grid-template-columns: 140px 110px 100px 140px;
    gap: 12px; align-items: center; min-width: 490px;
  }
  .activity-log-list-row {
    padding: 10px 16px; font-size: 0.88rem;
    display: grid; grid-template-columns: 140px 110px 100px 140px;
    gap: 12px; border-bottom: 1px solid #f1f5f9;
    color: #1e293b; align-items: center; line-height: 1.4; min-width: 490px;
  }
  .activity-log-list-row:last-child { border-bottom: none; }
  .activity-log-list-row:nth-child(even) { background: #fafbfc; }
  .activity-log-list-row .log-time-start {
    font-weight: 600; color: #475569; white-space: nowrap;
    font-family: "Consolas", "Courier New", monospace;
  }
  .activity-log-list-row .log-time-end {
    color: #64748b; white-space: nowrap;
    font-family: "Consolas", "Courier New", monospace;
  }
  .activity-log-list-row .log-time-end.ongoing {
    color: #92400e; font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
  }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
  .activity-log-list-row .log-away {
    text-align: right; font-weight: 700; color: #991b1b;
    white-space: nowrap; font-family: "Consolas", "Courier New", monospace;
  }
  .activity-log-list-row .log-type-wrap { display: flex; justify-content: flex-start; }
  .activity-log-list-row .log-type {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; font-size: 0.82rem; font-weight: 600;
    padding: 4px 10px; border-radius: 12px; white-space: nowrap;
  }
  .activity-log-list-row .log-type.tab { background: #eff6ff; color: #1e40af; }
  .activity-log-list-row .log-type.window { background: #f3e8ff; color: #6b21a8; }
  .activity-log-list-row .log-type.other { background: #f1f5f9; color: #475569; }
  .activity-log-list-row.ongoing { background: #fef3c7; }
  .activity-log-empty {
    padding: 32px 24px; text-align: center;
    color: #94a3b8; font-style: italic; font-size: 0.95rem;
  }
  .activity-log-note {
    font-size: 0.82rem; color: #64748b;
    background: #fffbeb; border: 1px solid #fcd34d;
    border-radius: 6px; padding: 10px 14px;
    margin-top: 14px; line-height: 1.5;
  }
  /* Szövegbeviteli tevékenység */
  .activity-sessions-summary {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 14px;
  }
  .activity-sessions-table {
    border: 1px solid var(--border); border-radius: 8px;
    overflow-x: auto; background: white;
  }
  .activity-sessions-table-header {
    background: #f8fafc; padding: 10px 16px;
    font-size: 0.7rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    display: grid; grid-template-columns: 1fr 100px 70px 70px 90px;
    gap: 10px; align-items: center; min-width: 500px;
  }
  .activity-sessions-table-row {
    padding: 10px 16px; font-size: 0.85rem;
    display: grid; grid-template-columns: 1fr 100px 70px 70px 90px;
    gap: 10px; border-bottom: 1px solid #f1f5f9;
    color: #1e293b; align-items: center; line-height: 1.4; min-width: 500px;
  }
  .activity-sessions-table-row:last-child { border-bottom: none; }
  .activity-sessions-table-row:nth-child(even) { background: #fafbfc; }
  .activity-sessions-table-row.suspicious { background: #fef3c7; }
  @media (max-width: 600px) {
    .activity-sessions-summary { grid-template-columns: 1fr 1fr; }
    .activity-sessions-table-header { display: none; }
    .activity-sessions-table { overflow-x: visible; }
    .activity-sessions-table-row {
      grid-template-columns: 1fr; gap: 4px; font-size: 0.82rem;
      min-width: 0; padding: 10px 14px;
    }
  }
  .modal-activity-option {
    margin-top: 16px; background: #f0f9ff;
    border: 2px solid #bfdbfe; border-radius: 8px;
    padding: 12px 14px; transition: border-color 0.15s, background 0.15s;
  }
  .modal-activity-option.checked { background: #dbeafe; border-color: #3b82f6; }
  .modal-activity-option .option-row {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
  }
  .modal-activity-option .option-row input {
    width: auto; margin: 0; cursor: pointer;
    accent-color: #2563eb; transform: scale(1.15);
  }
  .modal-activity-option .option-label { font-size: 0.95rem; font-weight: 700; color: #1e40af; }
  .modal-activity-option .option-hint {
    font-size: 0.82rem; color: #1e40af;
    margin-top: 6px; margin-left: 28px; line-height: 1.5;
  }
  .modal-activity-option.checked .option-label { color: #1e3a8a; }
  @keyframes flashHighlight {
    0%   { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7); }
    70%  { box-shadow: 0 0 0 12px rgba(14, 165, 233, 0); }
    100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
  }
  .flash-highlight { animation: flashHighlight 0.9s ease-out; }

/* --- LÉPÉS-SZINTŰ LAKAT --- */
.step.step-locked {
    border-left-color: #f59e0b;
    border-right-color: #f59e0b;
    border-left-width: 3px;
    border-right-width: 3px;
  }
  .step.step-locked .step-header h2.step-number {
    cursor: default;
  }
  .step.step-locked .step-header h2.step-number:active {
    cursor: default;
  }
  .step.step-locked .step-header h2.step-number::after {
    content: ' 🔒';
    font-size: 0.72rem;
    opacity: 0.7;
    vertical-align: top;
    margin-left: 2px;
    font-weight: 400;
  }
  body:not(.teacher-mode) .step.step-locked .step-title {
    background: #f8fafc !important;
    color: #64748b !important;
    cursor: default !important;
    border-color: #cbd5e1 !important;
  }

/* --- LÉPÉS ALATTI ELVÁLASZTÓ VONAL --- */
.step.has-divider-below {
    position: relative;
    margin-bottom: 44px;
  }
  .step.has-divider-below::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -23px;
    height: 2px;
    background: #94a3b8;
    border-radius: 1px;
  }
  .tool-btn.step-divider-btn {
    color: #64748b;
    min-width: 34px;
    text-align: center;
  }
  .tool-btn.step-divider-btn:hover {
    background: #e2e8f0;
  }
  .tool-btn.step-divider-btn.is-active {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #1e293b;
    font-weight: 700;
  }
  .tool-btn.step-divider-btn.is-active:hover {
    background: #cbd5e1;
  }

/* --- LÉPÉSEK KÖZÖTTI ELVÁLASZTÓ VONAL VEZÉRLŐI --- */
/* A vezérlők NEM középen vannak: a zöld + (új feladat) gomb a
   vonal közepére esik, ezért a középponttól jobbra toljuk őket
   (a zöld + jobb széle + 8 px térköz). A jobb oldali lila és kék
   + gomboktól így még bőven marad hely. */
.step-divider-controls {
    position: absolute;
    left: calc(50% + 22px);
    bottom: -24px;
    transform: translateY(50%);
    display: flex;
    gap: 4px;
    z-index: 10;
    background: white;
    padding: 2px 4px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
  }
  .step.has-divider-below:hover .step-divider-controls {
    opacity: 1;
    visibility: visible;
  }
  .step-divider-controls .icon-btn {
    padding: 2px 7px;
    font-size: 0.72rem;
    line-height: 1;
  }
  .step-divider-controls .icon-btn.danger {
    color: #b91c1c;
  }
  .step-divider-controls .icon-btn.danger:hover {
    background: #fee2e2;
  }
  .step-divider-controls .icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  .step-divider-controls .icon-btn:disabled:hover {
    background: white;
  }
/* ============================================================
   TÖBB SOROS FEJLÉC-CÍMKE (tanári kérdés a blokk fejlécében)
   ============================================================
   A tanár a blokk fejlécében lévő mezőbe írja a diáknak szóló
   kérdést/utasítást. A mező szándékosan textarea, hogy a hosszú
   kérdés több sorban is elférjen – de továbbra is a gombokkal
   egy sorban, ugyanabban a helyen és szélességben, mint korábban
   az egysoros input.

   A .block textarea / .section textarea általános szabályai
   (monospace betű, 80–90px magasság, átméretező fogantyú) itt
   NEM érvényesek: a mező a tartalmához nő, a magasságát a JS
   állítja (autoResizeBlockLabel).
   ============================================================ */

.block-toolbar > .block-handle > textarea.handle-label-input,
.block-toolbar > span.block-handle > textarea.handle-label-input,
.block .block-handle > textarea.handle-label-input {
  /* Egysorosnak indul, a magasságot a JS igazítja (inline
     height), ezért itt NEM lehet height:auto !important. */
  min-height: 0 !important;
  max-height: 40vh !important;
  width: 100% !important;
  box-sizing: border-box !important;
  resize: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  /* Ugyanaz a betű, mint az egykori inputon. */
  font-family: "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
  /* A sorok közötti törés maradjon, a behúzás ne. */
  tab-size: 2 !important;
  /* Megjelenés: mint a régi input (átlátszó, hoveren keret). */
  padding: 4px 8px !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #64748b !important;
  margin: 0 !important;
  display: block !important;
  cursor: text !important;
  /* A magasságot a JS állítja; a height animálása mérés közben
     hamis értéket adna, ezért csak a színeket animáljuk. */
  transition: border-color 0.12s, background 0.12s !important;
}

.block-toolbar > .block-handle > textarea.handle-label-input:hover,
.block-toolbar > .block-handle > textarea.handle-label-input:focus,
.block-toolbar > span.block-handle > textarea.handle-label-input:hover,
.block-toolbar > span.block-handle > textarea.handle-label-input:focus,
.block .block-handle > textarea.handle-label-input:hover,
.block .block-handle > textarea.handle-label-input:focus {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
  color: #1e293b !important;
  outline: none !important;
}

.block-toolbar > .block-handle > textarea.handle-label-input::placeholder,
.block-toolbar > span.block-handle > textarea.handle-label-input::placeholder {
  color: #cbd5e1 !important;
  font-style: italic !important;
}

/* A fogantyú ikon a mező első sorához igazodjon, ha a kérdés
   több soros – ne a doboz közepén lebegjen. */
.block-toolbar > .block-handle:has(> textarea.handle-label-input),
.block-toolbar > span.block-handle:has(> textarea.handle-label-input) {
  align-items: flex-start !important;
}
.block-toolbar > .block-handle > .handle-icon,
.block-toolbar > span.block-handle > .handle-icon {
  margin-top: 5px !important;
}

/* Több soros kérdésnél a gombok a mező tetejéhez igazodjanak,
   hogy ne csússzanak a doboz közepére. */
.block-toolbar:has(> .block-handle > textarea.handle-label-input) {
  align-items: flex-start !important;
}

/* A terminál/VNC sötét toolbarján a mező maradjon világos betűs. */
.block.terminal-block .block-handle > textarea.handle-label-input,
.block.vnc-block .block-handle > textarea.handle-label-input {
  color: #cbd5e1 !important;
  background: transparent !important;
}
.block.terminal-block .block-handle > textarea.handle-label-input:hover,
.block.terminal-block .block-handle > textarea.handle-label-input:focus,
.block.vnc-block .block-handle > textarea.handle-label-input:hover,
.block.vnc-block .block-handle > textarea.handle-label-input:focus {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}
.block.terminal-block .block-handle > textarea.handle-label-input::placeholder {
  color: #475569 !important;
}

/* Az utasítás blokk fejlécében ugyanaz a viselkedés. */
.instruction-block .block-handle > textarea.handle-label-input {
  max-width: 100% !important;
  white-space: pre-wrap !important;
}

/* Mobilon a mező ne nyomja össze a gombokat. */
@media (max-width: 640px) {
  .block-toolbar > .block-handle > textarea.handle-label-input,
  .block-toolbar > span.block-handle > textarea.handle-label-input {
    font-size: 0.8rem !important;
  }
}
