/* Lauer.io – ELStAM-Leitfaden
   Baut auf /styles.css und /assets/rechner/styles.css auf und nutzt deren Tokens.
   Zone 2 nach DESIGN.md: eine Eigenschaft, unter 200 ms, nur transform oder opacity. */

.el-section { scroll-margin-top: 5rem; }
.el-section h3[id], .el-group { scroll-margin-top: 6rem; }

.el-narrow { max-width: 50rem; }
.el-narrow > h2 { margin-bottom: 1rem; font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.el-narrow > h3 { margin: 2.2rem 0 0.8rem; font-size: 1.3rem; letter-spacing: -0.01em; }
.el-narrow p { line-height: 1.6; }

/* Hinweis: keine Rechts- und keine Steuerberatung */
.el-disclaimer {
  max-width: 44rem;
  margin: 1.4rem 0 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 0.3rem solid var(--blue-800);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.95rem;
  line-height: 1.55;
}
.el-disclaimer p { margin: 0; }
.el-disclaimer p + p { margin-top: 0.4rem; }
.el-disclaimer__title { color: var(--ink); font-weight: 800; }
.el-disclaimer--end { max-width: none; margin-top: 2rem; }

/* Inhaltsübersicht im Kopf */
.el-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.6rem;
}
.el-toc a {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--blue-800);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 100ms ease-out;
}
.el-toc a:hover { border-color: var(--blue-700); }
.el-toc a:active { transform: scale(0.98); }

/* Tabellen */
.el-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}
.el-table th,
.el-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}
.el-table th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.el-table td:first-child { color: var(--ink); font-weight: 700; }
.el-section .rx-table-wrap { margin: 1rem 0 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.el-wide-table { margin-top: 1.6rem !important; }

.el-rules { margin: 0 0 1.2rem; padding-left: 1.4rem; line-height: 1.6; }
.el-rules li + li { margin-top: 0.5rem; }

/* Hinweiskästen */
.el-box {
  margin: 1.2rem 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid #b9e3da;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: #0d4f47;
  font-size: 0.95rem;
  line-height: 1.55;
}
.el-box p { margin: 0; }
.el-box p + p { margin-top: 0.45rem; }
.el-box__title { color: #0a4d45; font-weight: 800; }
.el-box--warn { border-color: #f3cf9c; background: #fff4e5; color: #5c3b0a; }
.el-box--warn .el-box__title { color: #4a2f06; }

/* Abbildungen aus archify */
.el-figure { margin: 1.8rem 0 0; }
.el-figure__frame {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.el-figure__frame:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.el-figure__svg { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 690; }
.el-figure__svg--wide { aspect-ratio: 1380 / 622; }
#baum { aspect-ratio: 996 / 528; }
.el-figure__svg img { display: block; width: 100%; height: auto; }
.el-figure--medium { max-width: 62rem; }
.el-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.el-figure figcaption > span { flex: 1 1 24rem; }
.el-figure figcaption strong { color: var(--text); }

.el-zoom,
.el-reset,
.el-answer,
.el-dialog__close {
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--blue-700);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--blue-800);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 100ms ease-out;
}
.el-zoom:hover,
.el-reset:hover,
.el-answer:hover,
.el-dialog__close:hover { background: var(--blue-050); }
.el-zoom:active,
.el-reset:active,
.el-answer:active,
.el-dialog__close:active { transform: scale(0.98); }

/* Phasen des Ablaufs */
.el-phases {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin: 2rem 0;
}
.el-phase h3 { margin: 0.2rem 0 0.8rem; color: var(--ink); font-size: 1.15rem; letter-spacing: 0; text-transform: none; }
.el-phase p,
.el-phase li { font-size: 0.95rem; line-height: 1.55; }
.el-phase ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.el-phase li + li { margin-top: 0.35rem; }

/* Aufklappbare Einträge */
.el-accordion { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.el-accordion details + details { border-top: 1px solid var(--line-soft); }
.el-accordion summary,
.el-details summary {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.75rem 1rem;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}
.el-accordion summary::-webkit-details-marker,
.el-details summary::-webkit-details-marker { display: none; }
.el-accordion summary::before,
.el-details summary::before {
  flex: 0 0 auto;
  color: var(--blue-700);
  content: "+";
  font-weight: 800;
}
.el-accordion details[open] > summary::before,
.el-details[open] > summary::before { content: "–"; }
.el-accordion summary:hover,
.el-details summary:hover { background: var(--blue-050); }
.el-accordion summary:focus-visible,
.el-details summary:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.el-accordion details > p { margin: 0; padding: 0 1rem 0.6rem 2rem; font-size: 0.95rem; line-height: 1.55; }
.el-accordion details > p:last-child { padding-bottom: 1rem; }

.el-details { margin: 1.4rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.el-details > .rx-table-wrap { margin: 0 1rem 1rem !important; }
.el-details > dl { margin: 0; padding: 0 1rem 1rem 2rem; }

/* Geführte Fehlersuche */
.el-assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 1.6rem;
}
.el-assistant-layout .el-figure { margin: 0; }
.el-assistant { position: sticky; top: 6rem; }
.el-assistant__title { margin: 0 0 0.3rem !important; color: var(--ink) !important; font-size: 1.2rem !important; letter-spacing: 0 !important; text-transform: none !important; }
.el-assistant__intro { margin: 0 0 1rem; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.el-trail { margin: 0 0 1rem; padding: 0; list-style: none; }
.el-trail:empty { display: none; }
.el-trail li {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.88rem;
}
.el-trail li strong { flex: 0 0 auto; color: var(--ink); }
.el-step__count { margin: 0 0 0.3rem; color: var(--teal); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.el-step__question { margin: 0 0 0.5rem; color: var(--ink); font-size: 1.15rem; font-weight: 800; line-height: 1.3; }
.el-step__help { margin: 0 0 1rem; font-size: 0.93rem; line-height: 1.55; }
.el-step__answers { display: flex; gap: 0.6rem; }
.el-answer { flex: 1 1 0; }
.el-answer--yes { border-color: var(--blue-800); background: var(--blue-800); color: #fff; }
.el-answer--yes:hover { background: var(--blue-900); }

.el-result { padding: 0.9rem 1rem; border: 1px solid var(--line); border-left-width: 0.3rem; border-radius: var(--radius); background: var(--blue-050); }
.el-result--software { border-left-color: #0891b2; }
.el-result--elster { border-left-color: #ea580c; }
.el-result--fa { border-left-color: #059669; }
.el-result--ok { border-left-color: var(--teal); }
.el-result__who { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.el-result__title { margin: 0 0 0.5rem; color: var(--ink); font-size: 1.1rem; font-weight: 800; line-height: 1.3; }
.el-result ul { margin: 0 0 0.6rem; padding-left: 1.1rem; font-size: 0.93rem; line-height: 1.5; }
.el-result li + li { margin-top: 0.3rem; }
.el-result__more { margin: 0; font-size: 0.93rem; }
.el-reset { margin-top: 1rem; }

/* Fehlerbilder in drei Zuständigkeitsgruppen */
.el-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; align-items: start; }
.el-group h4 { display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; align-items: baseline; margin: 0 0 0.6rem; color: var(--ink); font-size: 1.05rem; }
.el-group h4 small { flex-basis: 100%; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.el-dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; }
.el-group--software .el-dot { background: #0891b2; }
.el-group--elster .el-dot { background: #ea580c; }
.el-group--fa .el-dot { background: #059669; }
.el-group .el-accordion summary { font-size: 0.95rem; }

/* Code-Suche */
.el-filter { display: grid; gap: 0.35rem; max-width: 30rem; margin: 1rem 0 0.4rem; }
.el-filter label { color: var(--ink); font-size: 0.9rem; font-weight: 700; }
.el-filter input {
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.el-filter input:hover { border-color: var(--blue-700); }
.el-filter input:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.el-filter__status { min-height: 1.3em; margin: 0; color: var(--muted); font-size: 0.88rem; }
.el-codes td:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.el-codes mark { padding: 0 0.1em; border-radius: 2px; background: #ffe7c2; color: inherit; }

.el-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; }
.el-links a { font-weight: 700; }

/* Tipps */
.el-tips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem;
  margin: 1.6rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: tipp;
}
.el-tips li {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  counter-increment: tipp;
}
.el-tips li::before {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--teal);
  content: "Tipp " counter(tipp);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.el-tips h3 { margin: 0 0 0.4rem; font-size: 1.02rem; letter-spacing: 0; line-height: 1.3; }
.el-tips p { margin: 0; font-size: 0.93rem; line-height: 1.5; }

/* Checklisten */
.el-actions { margin: 1rem 0 0; }
.el-checklists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; margin-top: 1.6rem; }
.el-checklist { margin: 0; }
.el-checklist legend { float: left; width: 100%; margin: 0 0 0.4rem; padding: 0; color: var(--ink); font-size: 1.2rem; font-weight: 800; }
.el-checklist legend + * { clear: both; }
.el-checklist label {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1.45;
  cursor: pointer;
}
.el-checklist label:last-of-type { border-bottom: 0; }
.el-checklist input {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0.12rem 0 0;
  accent-color: var(--teal);
  cursor: pointer;
}
.el-checklist input:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.el-checklist label:has(input:checked) { color: var(--muted); }
.el-progress { display: grid; gap: 0.35rem; margin: 0 0 0.6rem; }
.el-progress__text { color: var(--muted); font-size: 0.88rem; font-weight: 700; }
.el-progress__bar { display: block; height: 0.4rem; overflow: hidden; border-radius: 999px; background: var(--line-soft); }
.el-progress__bar span { display: block; width: 100%; height: 100%; background: var(--teal); transform: scaleX(0); transform-origin: left center; transition: transform 150ms ease-out; }
.el-checklist.is-done { border-color: #9ed8cc; }
.el-checklist.is-done .el-progress__text { color: var(--teal); }

.el-glossary dt { margin-top: 0.8rem; color: var(--ink); font-weight: 800; }
.el-glossary dd { margin: 0.15rem 0 0; line-height: 1.5; }
.el-sources { padding-left: 1.2rem; line-height: 1.6; }
.el-sources li + li { margin-top: 0.35rem; }

/* Vergrößerte Grafik */
.el-dialog {
  width: min(96vw, 110rem);
  max-width: none;
  height: min(92vh, 60rem);
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.el-dialog[open] { display: flex; flex-direction: column; }
.el-dialog::backdrop { background: rgba(16, 44, 63, 0.55); }
.el-dialog__bar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: 0.6rem 0.8rem 0.6rem 1.1rem; border-bottom: 1px solid var(--line-soft); }
.el-dialog__bar p { margin: 0; color: var(--ink); font-weight: 800; }
.el-dialog__body { flex: 1 1 auto; overflow: auto; }
.el-dialog__body:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.el-dialog__body img { display: block; width: auto; max-width: none; height: auto; min-width: 100%; }

@media (max-width: 1020px) {
  .el-phases,
  .el-groups { grid-template-columns: minmax(0, 1fr); }
  .el-assistant-layout { grid-template-columns: minmax(0, 1fr); }
  .el-assistant { position: static; }
}

/* Auf schmalen Geräten bleiben die Grafiken lesbar groß und lassen sich im Rahmen seitlich schieben. */
@media (max-width: 820px) {
  .el-figure__svg { min-width: 44rem; }
  .el-figure__svg--wide { min-width: 52rem; }
  .el-checklists { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .el-table { font-size: 0.9rem; }
  .el-table th,
  .el-table td { padding: 0.5rem; }
  .el-step__answers { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .el-toc a:active,
  .el-zoom:active,
  .el-reset:active,
  .el-answer:active,
  .el-dialog__close:active { transform: none; }
  .el-progress__bar span { transition: none; }
}

@media (prefers-contrast: more) {
  .el-disclaimer,
  .el-box,
  .el-accordion,
  .el-figure__frame { border-color: var(--ink); }
}

/* Druck: nur die Checklisten, wenn über den Knopf ausgelöst */
@media print {
  html.el-print-checklists body > *:not(main),
  html.el-print-checklists main > *:not(#checklisten),
  html.el-print-checklists #checklisten .el-narrow > p,
  html.el-print-checklists #checklisten .el-actions,
  html.el-print-checklists .el-reset { display: none !important; }
  html.el-print-checklists #checklisten { padding: 0; }
  html.el-print-checklists .el-checklists { grid-template-columns: 1fr 1fr; }
  html.el-print-checklists .el-checklist { box-shadow: none; break-inside: avoid; }
}
