/* ==========================================================================
   MeldeFluss — projektspezifische Styles (klickbare Demo)
   Baut auf base.css auf (gemeinsames Kampagnen-Designsystem, nur gelesen).
   Akzent: Blau #4d9aff — auf Blau steht immer SCHWARZE Schrift (Kontrast).
   Eigene Interaktions-Styles: Ledger, Quellanker-Belege, Prüflauf, Gate.
   ========================================================================== */

:root {
  --accent: var(--blue);
  --accent-ink: #000000;
  --blue-deep: #1558b8;          /* Blau für Text/Linien auf Weiß (AA) */
  --hair: rgba(0,0,0,.14);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
.brand__glyph { color: #000; }

a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
main a:not(.btn):not(.due) { color: var(--blue-deep); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px,6vw,78px) clamp(36px,5vw,60px); }
.hero h1 > span { display: block; }
.hero__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px,4vw,54px); align-items: start; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } }

/* Pflichten-Karte */
.duebar { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.duebar__head { padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--paper-2);
                display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.due { display: flex; align-items: center; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--hair);
       width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0;
       font: inherit; color: inherit; text-decoration: none; }
.due:last-child { border-bottom: 0; }
button.due { cursor: pointer; border-bottom: 1px solid var(--hair); }
.due--link { cursor: pointer; transition: background .14s ease; }
.due--link:hover { background: #f2f8ff; }
.due--link .due__t::after { content: " ↗"; font-weight: 400; color: var(--blue-deep); }
.due__dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line); }
.due__dot--ok { background: var(--ok); }
.due__dot--due { background: var(--amber); }
.due__dot--open { background: #fff; }
.due__txt { flex: 1 1 auto; min-width: 0; }
.due__t { display: block; font-weight: 600; font-size: 15.5px; }
.due__s { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- Flow (mit Live-Status) ---------- */
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 1px solid var(--line);
        border-radius: var(--r-lg); overflow: hidden; list-style: none; margin: 0; padding: 0; counter-reset: none; }
.flow__step { padding: 22px 18px; border-right: 1px solid var(--line); background: #fff; transition: background .3s ease; }
.flow__step:last-child { border-right: 0; }
.flow__n { font-family: var(--display); font-weight: 900; font-size: 13px; letter-spacing: .1em;
           color: var(--muted); margin-bottom: 9px; display: flex; align-items: center; gap: 8px; }
.flow__state { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line);
               display: inline-grid; place-items: center; background: #fff; flex: 0 0 auto;
               font-size: 11px; font-weight: 700; color: #000; }
.flow__t { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: 15px;
           line-height: 1.1; margin-bottom: 8px; }
.flow__d { font-size: 13px; line-height: 1.45; color: var(--muted); }
.flow__step.is-done { background: #eef6ff; }
.flow__step.is-done .flow__state { background: var(--blue); border-color: #000; }
.flow__step.is-done .flow__state::before { content: "✓"; }
@media (max-width: 980px) { .flow { grid-template-columns: 1fr 1fr; } .flow__step { border-bottom: 1px solid var(--line); } }
@media (max-width: 560px) { .flow { grid-template-columns: 1fr; } .flow__step { border-right: 0; } }

/* ---------- Demo-Steuerleiste ---------- */
.nojs-note { border: 2px solid var(--line); border-radius: var(--r-md); background: var(--amber);
             padding: 12px 16px; font-size: 14.5px; margin-bottom: 20px; }
.demo-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
            border: 1px solid var(--line); border-radius: var(--r-md); background: #fff;
            padding: 10px 12px; margin-bottom: 22px; }
.demo-bar__tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.dtab { font-family: var(--body); font-size: 14.5px; font-weight: 700; padding: 9px 15px;
        border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper-2);
        cursor: pointer; transition: background .14s ease, transform .14s ease; color: var(--ink); }
.dtab:hover { background: #fff; transform: translateY(-1px); }
.dtab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.demo-bar__actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.demo-bar__count { font-variant-numeric: tabular-nums; }

/* ---------- Demo-Raster ---------- */
.demo-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 24px; align-items: start; }
.demo-grid--single { grid-template-columns: 1fr; max-width: 780px; }
.demo-grid--check { margin-top: 24px; grid-template-columns: .95fr 1.05fr; }
@media (max-width: 980px) { .demo-grid, .demo-grid--check { grid-template-columns: 1fr; } }

/* ---------- Belegliste ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; overflow: hidden; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
               padding: 16px 20px 10px; flex-wrap: wrap; }
.panel__hint { font-size: 13.5px; color: var(--muted); padding: 0 20px 12px; margin: 0;
               border-bottom: 1px solid var(--line); }
.bgroup__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
                padding: 12px 20px 8px; font-size: 14px; background: var(--paper-2);
                border-bottom: 1px solid var(--hair); }
.bgroup__head .muted { font-size: 12.5px; font-variant-numeric: tabular-nums; }

.item { display: grid; grid-template-columns: 92px minmax(0,1fr) auto; gap: 4px 12px; align-items: center;
        padding: 11px 20px; border-bottom: 1px solid var(--hair); font-size: 14.5px;
        transition: background .25s ease; }
.bgroup:last-child .item:last-child { border-bottom: 0; }
.item__no { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.item__txt { min-width: 0; line-height: 1.35; }
.item__sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.item__amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.item__ctl { grid-column: 2; }
.item__ctl select { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
                    border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper-2);
                    padding: 5px 8px; max-width: 100%; cursor: pointer; }
.item__ctl select:hover { background: #fff; }
.item--muted .item__txt, .item--muted .item__amt, .item--muted .item__no { opacity: .62; }
.item--muted[data-cat="vorsteuer"] .item__txt,
.item--muted[data-cat="vorsteuer"] .item__amt { opacity: 1; }
.item--flag { box-shadow: inset 4px 0 0 var(--amber); }
.item--flag.is-resolved { box-shadow: inset 4px 0 0 var(--ok); }
.item.is-flash { background: #e8f3ff; }
.item.is-target { background: #fff2cc; }
.item.is-import { animation: itemIn .45s cubic-bezier(.2,.9,.3,1) both; }
@keyframes itemIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

/* ---------- Entwurf / Ledger ---------- */
.form-preview { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.form-preview__head { background: var(--ink); color: #fff; padding: 18px 22px;
                      display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-preview__head h3 { color: #fff; font-size: 17px; }
.form-preview__foot { padding: 16px 22px; border-top: 1px solid var(--hair); background: var(--paper-2); }
.form-preview__foot p { margin: 0; }

.kz { display: grid; grid-template-columns: 58px minmax(0,1fr) auto; gap: 0 14px; align-items: start;
      padding: 13px 22px; border-bottom: 1px solid var(--hair); font-size: 15px; }
.kz:last-of-type { border-bottom: 0; }
.kz__nr { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding-top: 2px; white-space: nowrap; }
.kz__lbl { min-width: 0; }
.kz__note { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.kz__val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap;
           transition: color .2s ease; }
.kz__val.is-flash { animation: valPulse .8s ease; }
@keyframes valPulse { 0% { color: var(--blue-deep); } 35% { color: var(--blue-deep); } 100% { color: inherit; } }
.kz--sum { background: var(--paper-2); font-size: 17px; border-top: 2px solid var(--line); }
.kz--sum .kz__val { font-size: 20px; }
@media (max-width: 560px) {
  .kz { grid-template-columns: 50px 1fr; }
  .kz__val { grid-column: 2; text-align: left; margin-top: 4px; }
  .item { grid-template-columns: 1fr auto; }
  .item__no { grid-column: 1 / -1; }
  .item__ctl { grid-column: 1; }
}

/* Quellanker → aufklappbare Belegliste */
.trace { margin-top: 5px; }
.trace summary { list-style: none; display: inline-block; cursor: pointer; }
.trace summary::-webkit-details-marker { display: none; }
.trace summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.src { font-size: 12px; font-weight: 600; border: 1px dashed var(--line); border-radius: 6px;
       padding: 2px 8px; background: var(--paper-2); color: var(--ink-2); white-space: nowrap;
       display: inline-block; transition: background .14s ease; }
.src::before { content: "¶ "; color: var(--blue-deep); font-weight: 700; }
.trace summary:hover .src { background: var(--blue); color: #000; }
.trace[open] summary .src { background: var(--blue); color: #000; border-style: solid; }
.src--excl::before { content: "⃠ "; }
.trace--excl { margin-left: 6px; display: inline-block; }

.rcpt { margin: 8px 0 4px; border: 1px solid var(--line); border-radius: var(--r-sm);
        background: #fff; font-family: var(--mono); font-size: 12.5px; overflow: hidden;
        position: relative; }
.rcpt::before { content: ""; display: block; height: 5px;
        background: repeating-linear-gradient(90deg, var(--ink) 0 7px, transparent 7px 14px);
        opacity: .14; }
.rcpt__row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 12px;
             border-bottom: 1px dashed var(--hair); }
.rcpt__row:last-child { border-bottom: 0; }
.rcpt__row span:first-child { min-width: 0; overflow-wrap: anywhere; }
.rcpt__row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rcpt__row--off span { text-decoration: line-through; opacity: .55; }
.rcpt__row--note { font-family: var(--body); color: var(--muted); border-top: 1px solid var(--hair); }

/* ---------- Hinweise ---------- */
.hints { margin-top: 20px; }
.hints__h { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 10px; }
.hint { margin-bottom: 10px; }
.hint:last-child { margin-bottom: 0; }
.hint--open { box-shadow: inset 3px 0 0 var(--amber); padding-left: 10px; }
.hint.is-done { box-shadow: inset 3px 0 0 var(--ok); padding-left: 10px; }
.hint.is-done .linkbtn { display: none; }
.hint .ok-note { color: #0b6b36; font-weight: 600; }
.linkbtn { font: inherit; font-weight: 700; color: var(--blue-deep); background: none; border: 0;
           padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: #000; }

/* ---------- Prüflauf ---------- */
.check { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 13px; align-items: start;
         padding: 13px 0; border-bottom: 1px solid var(--hair); }
.check:last-of-type { border-bottom: 0; }
.check__ico { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
              font-weight: 700; font-size: 14px; border: 1px solid var(--line); background: var(--paper-3);
              transition: background .25s ease; }
.check__ico::before { content: "·"; color: var(--muted); }
.check.is-run .check__ico { background: #fff; }
.check.is-run .check__ico::before { content: "…"; }
.check.is-ok .check__ico { background: #cdeeda; }
.check.is-ok .check__ico::before { content: "✓"; color: #0b6b36; }
.check.is-warn .check__ico { background: var(--amber); }
.check.is-warn .check__ico::before { content: "!"; color: #000; }
.check__res { white-space: nowrap; color: var(--muted); padding-top: 3px; }
.check.is-ok .check__res { color: #0b6b36; font-weight: 600; }
.check.is-warn .check__res { color: #7a5a00; font-weight: 600; }

.elog { margin: 14px 0 0; background: var(--ink); color: #e8e8e8; border-radius: var(--r-md);
        border: 1px solid var(--line); padding: 13px 15px; font-family: var(--mono);
        font-size: 12.3px; line-height: 1.55; white-space: pre-wrap; overflow-x: auto; min-height: 74px; }
.elog b { color: var(--blue); font-weight: 700; }

/* ---------- Gate ---------- */
.gate { border: 3px solid var(--line); border-radius: var(--r-lg); background: var(--blue); color: #000;
        padding: clamp(24px,3.4vw,38px); position: relative; overflow: hidden; }
.gate__lead { font-size: 17.5px; max-width: 64ch; margin-bottom: 4px; }
.gate__rules { max-width: 64ch; }
.rule { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; }
.rule__k { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #000;
           display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.gate__sum { margin: 20px 0 4px; font-size: 15.5px; border-top: 1px solid rgba(0,0,0,.35);
             padding-top: 16px; font-variant-numeric: tabular-nums; }
.gate__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.gate .btn { background: rgba(255,255,255,.92); color: var(--ink); border-color: var(--line); }
.gate .btn:hover { background: #fff; }
.gate__note { margin-top: 10px; color: rgba(0,0,0,.75); max-width: 64ch; }

.gate__hold { position: relative; overflow: hidden; background: var(--ink) !important;
              color: #fff !important; border-color: var(--ink) !important; }
.gate__hold:disabled { opacity: .45; cursor: not-allowed; }
.gate__hold:not(:disabled):hover { background: #000 !important; box-shadow: 0 3px 0 rgba(255,255,255,.85); }
.gate__holdfill { position: absolute; inset: 0; width: 0%; background: var(--blue-deep);
                  transition: width .1s linear; }
.gate__hold.is-done .gate__holdfill { background: var(--ok); width: 100%; }
.gate__holdtxt { position: relative; z-index: 1; }

/* Ticket + Stempel */
.ticket { margin-top: 22px; background: #fff; border: 2px solid var(--line); border-radius: var(--r-md);
          padding: 18px 20px; position: relative; }
.ticket__h { font-size: 17px; padding-right: 190px; }
@media (max-width: 560px) { .ticket__h { padding-right: 0; } }
.ticket code { font-family: var(--mono); background: var(--paper-2); border: 1px solid var(--hair);
               border-radius: 5px; padding: 1px 7px; font-size: 13px; }
.ticket__stamp { position: absolute; top: 10px; right: 12px; transform: rotate(-7deg);
                 border: 3px double var(--danger); color: var(--danger); border-radius: 7px;
                 font-family: var(--display); font-weight: 900; font-size: 13px; letter-spacing: .1em;
                 text-transform: uppercase; padding: 5px 10px; opacity: .9; pointer-events: none; }
.ticket.is-in { animation: ticketIn .5s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes ticketIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) { .ticket__stamp { position: static; display: inline-block; margin-bottom: 8px; transform: rotate(-3deg); } }

/* ---------- Baustein-Sektion ---------- */
.gapcard { margin-top: 20px; border-width: 2px; }
.truth { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 760px) { .truth { grid-template-columns: 1fr; } }
.truth__col { border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
              padding: clamp(18px,2.6vw,26px); }
.truth__h { font-size: 15px; display: inline-block; padding: 3px 12px; border-radius: 999px;
            border: 1px solid var(--line); margin-bottom: 12px; }
.truth__h--real { background: var(--mint); color: #000; }
.truth__h--sim { background: var(--amber); color: #000; }
.truth__list { margin: 0; padding-left: 19px; font-size: 14px; line-height: 1.55; }
.truth__list li { margin-bottom: 7px; }
.truth__list li:last-child { margin-bottom: 0; }
.truth__list code { font-family: var(--mono); font-size: 12.5px; background: var(--paper-2);
                    border: 1px solid var(--hair); border-radius: 5px; padding: 0 5px; }

/* ---------- Diverses ---------- */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
      clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
u { text-decoration-thickness: 2px; text-underline-offset: 2.5px; }

@media (prefers-reduced-motion: reduce) {
  .item.is-import { animation: none; }
  .ticket.is-in { animation: none; }
  .kz__val.is-flash { animation: none; }
}
