/* NOR / SI generators. Colours follow the site's Tailwind palette. */
.rh-tool { --rh-primary: #0369a1; --rh-primary-dark: #075985; --rh-line: #e5e7eb; --rh-muted: #6b7280; --rh-ink: #111827; }
.rh-tool [hidden] { display: none !important; }

.rh-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .rh-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }

/* Form */
.rh-tools { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-bottom: 0.75rem; }
.rh-step { border: 1px solid var(--rh-line); border-radius: 0.75rem; margin-bottom: 0.75rem; background: #fff; }
.rh-step > summary { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem; cursor: pointer; font-weight: 600; color: var(--rh-ink); list-style: none; }
.rh-step > summary::-webkit-details-marker { display: none; }
.rh-step > summary::after { content: '+'; margin-left: auto; color: var(--rh-muted); font-weight: 400; font-size: 1.25rem; line-height: 1; }
.rh-step[open] > summary::after { content: '\2212'; }
.rh-step-no { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 9999px; background: #e0f2fe; color: var(--rh-primary); font-size: 0.8rem; flex-shrink: 0; }
.rh-step-body { padding: 0.25rem 1rem 1rem; display: grid; gap: 1rem; }
.rh-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.rh-field > label, .rh-field > legend { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 0.3rem; padding: 0; }
.rh-field-check > label { display: flex; align-items: flex-start; gap: 0.6rem; font-weight: 500; cursor: pointer; }
.rh-field-check input { margin-top: 0.2rem; width: 1rem; height: 1rem; accent-color: var(--rh-primary); flex-shrink: 0; }
.rh-req { color: #b91c1c; }
.rh-help { font-size: 0.8rem; color: var(--rh-muted); margin-top: 0.3rem; line-height: 1.5; }
.rh-tool input[type='text'], .rh-tool input[type='number'], .rh-tool input[type='date'], .rh-tool input[type='time'], .rh-tool input[type='email'], .rh-tool select, .rh-tool textarea {
  width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid #d1d5db; border-radius: 0.5rem; padding: 0.5rem 0.65rem; font: inherit; font-size: 0.925rem; color: var(--rh-ink); background: #fff;
}
.rh-tool input:focus-visible, .rh-tool select:focus-visible, .rh-tool textarea:focus-visible, .rh-tool button:focus-visible, .rh-step > summary:focus-visible { outline: 2px solid var(--rh-primary); outline-offset: 2px; }
.rh-tool ::placeholder { color: #9ca3af; }

.rh-rows { display: grid; gap: 0.5rem; }
.rh-row { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)) 1.75rem; gap: 0.4rem; align-items: end; }
.rh-cell { display: block; min-width: 0; }
.rh-cell-label { display: block; font-size: 0.7rem; color: var(--rh-muted); margin-bottom: 0.15rem; }
.rh-row + .rh-row .rh-cell-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 520px) {
  .rh-row { grid-template-columns: minmax(0, 1fr) 1.75rem; padding-bottom: 0.6rem; border-bottom: 1px dashed var(--rh-line); }
  .rh-row .rh-cell { grid-column: 1; }
  .rh-row .rh-icon-btn, .rh-row .rh-icon-spacer { grid-column: 2; grid-row: 1; }
  .rh-row + .rh-row .rh-cell-label { position: static; width: auto; height: auto; clip-path: none; }
}
.rh-icon-btn { width: 1.75rem; height: 2.2rem; border: 0; background: none; color: var(--rh-muted); font-size: 1.2rem; cursor: pointer; border-radius: 0.375rem; }
.rh-icon-btn:hover { color: #b91c1c; background: #fef2f2; }
.rh-link-btn { border: 0; background: none; padding: 0.2rem 0; color: var(--rh-primary); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; text-align: left; }
.rh-link-btn:hover { color: var(--rh-primary-dark); text-decoration: underline; }

/* Preview column */
.rh-sticky { position: sticky; top: 5rem; z-index: 5; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(6px); padding: 0.75rem 0; margin-bottom: 0.5rem; border-bottom: 1px solid var(--rh-line); }
.rh-status { font-size: 0.875rem; color: #92400e; margin-bottom: 0.6rem; }
.rh-status-ok { color: #166534; }
.rh-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.rh-btn { border: 1px solid #d1d5db; background: #fff; color: var(--rh-ink); border-radius: 0.5rem; padding: 0.55rem 0.9rem; font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.rh-btn:hover { border-color: var(--rh-primary); color: var(--rh-primary); }
.rh-btn-primary { background: var(--rh-primary); border-color: var(--rh-primary); color: #fff; }
.rh-btn-primary:hover { background: var(--rh-primary-dark); border-color: var(--rh-primary-dark); color: #fff; }
.rh-btn:disabled { opacity: 0.6; cursor: progress; }
.rh-note { font-size: 0.8rem; color: var(--rh-muted); margin-top: 0.5rem; min-height: 1.2em; }

.rh-paper { background: #fff; border: 1px solid var(--rh-line); border-radius: 0.5rem; box-shadow: 0 10px 25px -12px rgb(15 23 42 / 0.2); padding: 1.5rem 1.25rem; font-size: 0.9rem; line-height: 1.6; color: var(--rh-ink); overflow-wrap: anywhere; }
@media (min-width: 640px) { .rh-paper { padding: 2.5rem 2.25rem; } }
.rh-paper-head { text-align: center; margin-bottom: 1.5rem; }
.rh-paper-head p:first-child { font-size: 1.15rem; }
.rh-strong { font-weight: 700; }
.rh-center { text-align: center; }
.rh-preamble { margin-bottom: 1rem; }
.rh-paper h3 { display: flex; gap: 0.75rem; font-size: 0.9rem; font-weight: 700; margin: 1.4rem 0 0.5rem; }
.rh-paper h3.rh-addendum { display: block; text-align: center; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px dashed var(--rh-line); }
.rh-clause { display: flex; gap: 0.75rem; margin-bottom: 0.6rem; }
.rh-num { flex: 0 0 2.4rem; font-variant-numeric: tabular-nums; }
.rh-clause-body { flex: 1; min-width: 0; }
.rh-clause-body p + p, .rh-sublist p + p { margin-top: 0.4rem; }
.rh-table-wrap { overflow-x: auto; margin: 0.5rem 0; }
.rh-paper table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.rh-paper th, .rh-paper td { border: 1px solid #d1d5db; padding: 0.3rem 0.5rem; text-align: left; vertical-align: top; }
.rh-paper th { background: #f9fafb; font-weight: 600; }
.rh-blank { background: #fef08a; color: #713f12; border-radius: 2px; padding: 0 0.15em; }

.rh-extras { display: grid; gap: 1rem; margin-top: 1.5rem; }
.rh-box { border: 1px solid var(--rh-line); border-radius: 0.75rem; padding: 1rem 1.1rem; }
.rh-box h3 { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.5rem; }
.rh-box ul { list-style: disc; padding-left: 1.2rem; font-size: 0.875rem; color: #374151; line-height: 1.6; }
.rh-box li + li { margin-top: 0.35rem; }
.rh-box-check { background: #f0f9ff; border-color: #bae6fd; }
.rh-email { margin-top: 0.75rem; }
.rh-email-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* Print: only the document. */
@media print {
  body > header, body > footer, .rh-print-hide, .rh-col-form, .rh-sticky, .rh-extras { display: none !important; }
  main { padding: 0 !important; }
  .rh-grid { display: block; }
  .rh-paper { border: 0; box-shadow: none; padding: 0; font-size: 10.5pt; }
  .rh-blank { background: #fef08a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rh-paper h3 { break-after: avoid; }
  .rh-clause, .rh-paper tr { break-inside: avoid; }
  .rh-paper h3.rh-addendum { break-before: page; border-top: 0; }
}

/* Static example document in the page copy (same look as the live preview). */
.rh-paper-static { box-shadow: none; }
.rh-paper-static h4 { display: flex; gap: 0.75rem; font-size: 0.9rem; font-weight: 700; margin: 1.4rem 0 0.5rem; }
.rh-paper-static h4.rh-addendum { display: block; text-align: center; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px dashed var(--rh-line); }

/* Organizer's logo */
.rh-logo { display: block; margin: 0 auto 0.9rem; max-height: 90px; max-width: 300px; width: auto; height: auto; }
.rh-logo-thumb { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.rh-logo-thumb:empty { display: none; }
.rh-logo-thumb img { max-height: 48px; max-width: 140px; border: 1px solid var(--rh-line); border-radius: 0.375rem; padding: 0.2rem; background: #fff; }
.rh-tool input[type='file'] { font-size: 0.85rem; max-width: 100%; }

/* Addendum text (paragraphs that sit directly on the page, not in a numbered clause). */
.rh-paper > p + p, .rh-paper > .rh-sublist + p { margin-top: 0.6rem; }
.rh-paper > .rh-sublist { margin: 0.35rem 0 0 1.5rem; }
