/* ═══════════════════════════════════════════════════════════════════════════
   INVOSPAN — Durchlauf (interaktives Schaustück)
   Eigenständige Stile, alle unter .iv- gescoped, damit nichts in die
   Hauptseiten blutet. Bewusst technisch statt hübsch: das Produkt ist ein
   Werkzeug, und die Seite soll aussehen wie eines.
   ═══════════════════════════════════════════════════════════════════════════ */

.iv {
    --iv-bg:        #071b25;
    --iv-panel:     #0b2531;
    --iv-panel-2:   #0e2c3a;
    --iv-line:      #1b4254;
    --iv-line-soft: #143544;
    --iv-text:      #e6f1f7;
    --iv-muted:     #7fa3b5;
    --iv-dim:       #557588;
    --iv-accent:    #9ccef0;
    --iv-accent-dk: #2f6f9f;
    --iv-ok:        #6fd3b2;
    --iv-warn:      #e8b86d;
    --iv-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

    color: var(--iv-text);
    font-variant-numeric: tabular-nums;
}

/* ── Rahmen ──────────────────────────────────────────────────────────────── */

.iv-shell {
    background: var(--iv-bg);
    border: 1px solid var(--iv-line);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .8);
}

.iv-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    padding: .75rem 1rem;
    background: var(--iv-panel);
    border-bottom: 1px solid var(--iv-line);
}

.iv-bar__group { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.iv-bar__label {
    font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
    color: var(--iv-dim); white-space: nowrap;
}

/* Segmentwahl statt Pillen-Wildwuchs: ein Streifen, ein Zeiger. */
.iv-seg { display: flex; position: relative; background: var(--iv-bg); border: 1px solid var(--iv-line); border-radius: 6px; }
.iv-seg button {
    appearance: none; background: none; border: 0; cursor: pointer;
    padding: .42rem .7rem; font: inherit; font-size: .8rem;
    color: var(--iv-muted); white-space: nowrap; border-radius: 5px;
    transition: color .16s ease;
}
.iv-seg button:hover { color: var(--iv-text); }
.iv-seg button[aria-pressed="true"] { color: var(--iv-bg); font-weight: 600; }
.iv-seg__thumb {
    position: absolute; top: 3px; bottom: 3px; left: 0; width: 0;
    background: var(--iv-accent); border-radius: 4px; z-index: 0;
    transition: transform .22s cubic-bezier(.4, 0, .2, 1), width .22s cubic-bezier(.4, 0, .2, 1);
}
.iv-seg button { position: relative; z-index: 1; }

.iv-run {
    margin-left: auto; display: inline-flex; align-items: center; gap: .5rem;
    background: var(--iv-accent); color: #05141c; border: 0; border-radius: 6px;
    padding: .5rem 1rem; font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer;
    transition: filter .16s ease, transform .16s ease;
}
.iv-run:hover:not(:disabled) { filter: brightness(1.08); }
.iv-run:active:not(:disabled) { transform: translateY(1px); }
.iv-run:disabled { opacity: .45; cursor: default; }
.iv-run__dot { width: 7px; height: 7px; border-radius: 50%; background: #05141c; }
.iv-run[data-state="running"] .iv-run__dot { animation: iv-pulse 1s ease-in-out infinite; }
@keyframes iv-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.iv-reset {
    background: none; border: 1px solid var(--iv-line); color: var(--iv-muted);
    border-radius: 6px; padding: .5rem .8rem; font: inherit; font-size: .85rem; cursor: pointer;
    transition: border-color .16s ease, color .16s ease;
}
.iv-reset:hover { border-color: var(--iv-accent-dk); color: var(--iv-text); }

/* ── Drei Spalten ────────────────────────────────────────────────────────── */

.iv-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .92fr) minmax(0, 1.25fr);
    min-height: 560px;
}
.iv-col { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--iv-line); }
.iv-col:last-child { border-right: 0; }

.iv-col__head {
    display: flex; align-items: baseline; gap: .6rem;
    padding: .7rem 1rem; border-bottom: 1px solid var(--iv-line-soft);
    background: var(--iv-panel);
}
.iv-col__title { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--iv-accent); }
.iv-col__sub { font-size: .74rem; color: var(--iv-dim); margin-left: auto; text-align: right; }

/* ── Spalte 1: Quelle ────────────────────────────────────────────────────── */

.iv-src { position: relative; flex: 1; overflow: hidden; }
.iv-src__scroll { position: absolute; inset: 0; overflow: auto; padding: .5rem 0 2rem; }
.iv-src pre {
    margin: 0; font-family: var(--iv-mono); font-size: .69rem; line-height: 1.62;
    color: var(--iv-muted); white-space: pre; tab-size: 4;
}
.iv-row { display: flex; padding: 0 1rem 0 0; }
.iv-row__n {
    flex: 0 0 2.6rem; text-align: right; padding-right: .8rem;
    color: #37596b; user-select: none;
}
.iv-row__t { flex: 1; min-width: 0; }
.iv-row.is-read  { color: var(--iv-text); background: rgba(156, 206, 240, .07); }
.iv-row.is-skip  { color: #3f6274; text-decoration: line-through; text-decoration-thickness: 1px; }
.iv-row.is-flag  { color: var(--iv-warn); background: rgba(232, 184, 109, .09); }
.iv-row { transition: background .2s ease, color .2s ease; }

.iv-scan {
    position: absolute; left: 0; right: 0; height: 2px; pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--iv-accent), transparent);
    opacity: 0; box-shadow: 0 0 12px 2px rgba(156, 206, 240, .35);
}

/* ── Spalte 2: Pipeline ──────────────────────────────────────────────────── */

.iv-pipe { flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: .1rem; overflow: auto; }

.iv-stage { display: grid; grid-template-columns: 22px 1fr; gap: .75rem; }
.iv-stage__rail { position: relative; display: flex; flex-direction: column; align-items: center; }
.iv-stage__dot {
    width: 11px; height: 11px; border-radius: 50%; margin-top: .35rem;
    border: 2px solid var(--iv-line); background: var(--iv-bg); flex: none;
    transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
.iv-stage__line { flex: 1; width: 2px; background: var(--iv-line-soft); margin: .25rem 0; }
.iv-stage:last-child .iv-stage__line { display: none; }
.iv-stage__body { padding-bottom: 1.1rem; min-width: 0; }
.iv-stage__name { font-size: .84rem; font-weight: 600; color: var(--iv-dim); transition: color .25s ease; }
.iv-stage__note { font-size: .74rem; color: var(--iv-dim); margin-top: .18rem; min-height: 1.05em; }
.iv-stage__meter { height: 2px; background: var(--iv-line-soft); border-radius: 2px; margin-top: .45rem; overflow: hidden; }
.iv-stage__fill { height: 100%; width: 0; background: var(--iv-accent); border-radius: 2px; transition: width .35s linear; }

.iv-stage.is-active .iv-stage__dot { border-color: var(--iv-accent); box-shadow: 0 0 0 4px rgba(156, 206, 240, .14); }
.iv-stage.is-active .iv-stage__name { color: var(--iv-text); }
.iv-stage.is-done   .iv-stage__dot { border-color: var(--iv-ok); background: var(--iv-ok); }
.iv-stage.is-done   .iv-stage__name { color: var(--iv-muted); }
.iv-stage.is-done   .iv-stage__fill { background: var(--iv-ok); }
.iv-stage.is-warn   .iv-stage__dot { border-color: var(--iv-warn); background: var(--iv-warn); }
.iv-stage.is-warn   .iv-stage__fill { background: var(--iv-warn); }

.iv-clar { border-top: 1px solid var(--iv-line-soft); margin-top: auto; padding-top: .8rem; }
.iv-clar__h { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--iv-warn); margin-bottom: .5rem; }
.iv-clar__i {
    display: grid; grid-template-columns: auto 1fr; gap: .5rem;
    font-size: .74rem; line-height: 1.45; color: var(--iv-muted);
    padding: .4rem 0; border-bottom: 1px solid var(--iv-line-soft);
}
.iv-clar__i:last-child { border-bottom: 0; }
.iv-clar__z { font-family: var(--iv-mono); color: var(--iv-warn); white-space: nowrap; }
.iv-clar__empty { font-size: .74rem; color: var(--iv-dim); }

/* ── Spalte 3: Empfänger ─────────────────────────────────────────────────── */

.iv-out { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--iv-panel-2); }

/* Outlook-artiger Aufbau: Schiene, Liste, Lesebereich. */
.iv-mail { flex: 1; display: grid; grid-template-columns: 128px minmax(0, 1fr); min-height: 0; }
.iv-mail__rail { border-right: 1px solid var(--iv-line-soft); padding: .8rem .6rem; }
.iv-mail__acct { font-size: .7rem; color: var(--iv-dim); padding: 0 .45rem .6rem; border-bottom: 1px solid var(--iv-line-soft); margin-bottom: .5rem; word-break: break-all; }
.iv-mail__fold {
    display: flex; align-items: center; justify-content: space-between;
    padding: .32rem .45rem; border-radius: 4px; font-size: .78rem; color: var(--iv-muted);
}
.iv-mail__fold.is-sel { background: rgba(156, 206, 240, .12); color: var(--iv-text); font-weight: 600; }
.iv-mail__count { font-size: .7rem; color: var(--iv-accent); font-weight: 700; }

.iv-mail__pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.iv-mail__list { border-bottom: 1px solid var(--iv-line-soft); max-height: 190px; overflow: auto; }
.iv-msg {
    display: block; width: 100%; text-align: left; appearance: none; background: none;
    border: 0; border-bottom: 1px solid var(--iv-line-soft); border-left: 2px solid transparent;
    padding: .6rem .8rem; cursor: pointer; font: inherit; color: inherit;
    animation: iv-slide .26s cubic-bezier(.2, .7, .3, 1) both;
}
.iv-msg:hover { background: rgba(156, 206, 240, .05); }
.iv-msg.is-sel { background: rgba(156, 206, 240, .1); border-left-color: var(--iv-accent); }
.iv-msg__top { display: flex; align-items: baseline; gap: .5rem; }
.iv-msg__from { font-size: .78rem; font-weight: 600; color: var(--iv-text); }
.iv-msg__time { margin-left: auto; font-size: .68rem; color: var(--iv-dim); }
.iv-msg__subj { font-size: .76rem; color: var(--iv-muted); margin-top: .12rem; }
.iv-msg__meta { display: flex; align-items: center; gap: .4rem; margin-top: .3rem; font-size: .68rem; color: var(--iv-dim); }
.iv-msg.is-unread .iv-msg__from::before {
    content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--iv-accent); margin-right: .4rem; vertical-align: middle;
}
@keyframes iv-slide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.iv-read { flex: 1; overflow: auto; padding: .9rem 1rem 1.2rem; min-height: 0; }
.iv-read__subj { font-size: .95rem; font-weight: 650; line-height: 1.3; }
.iv-read__hdr { font-size: .72rem; color: var(--iv-dim); margin: .35rem 0 .8rem; line-height: 1.6; }
.iv-read__body { font-size: .78rem; line-height: 1.7; color: var(--iv-muted); white-space: pre-wrap; }
.iv-att {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    margin-top: .9rem; padding: .6rem .7rem; cursor: pointer;
    background: var(--iv-bg); border: 1px solid var(--iv-line); border-radius: 6px;
    font: inherit; color: inherit; text-align: left;
    transition: border-color .16s ease, background .16s ease;
}
.iv-att:hover { border-color: var(--iv-accent-dk); background: rgba(156, 206, 240, .06); }
.iv-att__ext {
    font-family: var(--iv-mono); font-size: .62rem; letter-spacing: .06em;
    padding: .22rem .4rem; border-radius: 3px; background: var(--iv-accent-dk); color: #f2f9ff;
}
.iv-att__n { font-size: .78rem; color: var(--iv-text); }
.iv-att__s { font-size: .68rem; color: var(--iv-dim); margin-left: auto; }

.iv-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .5rem; padding: 2rem; text-align: center; color: var(--iv-dim); font-size: .8rem;
}

/* Ordnerweg */
.iv-files { flex: 1; overflow: auto; padding: .8rem 1rem; }
.iv-files__path { font-family: var(--iv-mono); font-size: .72rem; color: var(--iv-muted); margin-bottom: .7rem; }
.iv-file {
    display: grid; grid-template-columns: 1fr auto; gap: .4rem .8rem;
    padding: .55rem 0; border-bottom: 1px solid var(--iv-line-soft);
    animation: iv-slide .26s cubic-bezier(.2, .7, .3, 1) both;
}
.iv-file__n { font-family: var(--iv-mono); font-size: .76rem; color: var(--iv-text); }
.iv-file__s { font-size: .7rem; color: var(--iv-dim); }
.iv-file__h { grid-column: 1 / -1; font-family: var(--iv-mono); font-size: .64rem; }
.iv-file__h { color: #456d80; word-break: break-all; }

/* Peppol — ehrlicher Zustand statt Theater */
.iv-peppol { flex: 1; padding: 1.4rem; display: flex; flex-direction: column; gap: .9rem; overflow: auto; }
.iv-peppol h4 { font-size: .9rem; font-weight: 650; color: var(--iv-text); margin: 0; }
.iv-peppol p { font-size: .79rem; line-height: 1.65; color: var(--iv-muted); margin: 0; }
.iv-peppol ul { margin: 0; padding-left: 1.05rem; }
.iv-peppol li { font-size: .77rem; line-height: 1.6; color: var(--iv-muted); margin-bottom: .3rem; }
.iv-peppol__box { border: 1px solid var(--iv-line); border-left: 2px solid var(--iv-warn); border-radius: 6px; padding: .8rem .9rem; background: var(--iv-bg); }

/* ── Beleg-Overlay ───────────────────────────────────────────────────────── */

.iv-ov {
    position: fixed; inset: 0; z-index: 200; display: none;
    background: rgba(3, 12, 17, .82); backdrop-filter: blur(3px);
    padding: 3vh 2vw; overflow: auto;
}
.iv-ov.is-open { display: flex; animation: iv-fade .18s ease both; }
@keyframes iv-fade { from { opacity: 0; } to { opacity: 1; } }
.iv-ov__win {
    margin: auto; width: min(980px, 100%); background: var(--iv-bg);
    border: 1px solid var(--iv-line); border-radius: 10px; overflow: hidden;
    animation: iv-rise .22s cubic-bezier(.2, .7, .3, 1) both;
    display: flex; flex-direction: column; max-height: 94vh;
}
@keyframes iv-rise { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
.iv-ov__bar { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; background: var(--iv-panel); border-bottom: 1px solid var(--iv-line); }
.iv-ov__name { font-family: var(--iv-mono); font-size: .78rem; color: var(--iv-text); }
.iv-ov__x { margin-left: auto; background: none; border: 0; color: var(--iv-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.iv-ov__x:hover { color: var(--iv-text); }
.iv-ov__tabs { display: flex; gap: .25rem; padding: 0 1rem; background: var(--iv-panel); border-bottom: 1px solid var(--iv-line); }
.iv-ov__tab {
    appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
    padding: .55rem .1rem; margin-right: 1.1rem; font: inherit; font-size: .8rem;
    color: var(--iv-muted); cursor: pointer;
}
.iv-ov__tab[aria-selected="true"] { color: var(--iv-accent); border-bottom-color: var(--iv-accent); }
.iv-ov__body { overflow: auto; padding: 1.1rem 1.2rem 1.4rem; }

/* Menschliche Ansicht */
.iv-doc__top { display: flex; flex-wrap: wrap; gap: 1.4rem; justify-content: space-between; margin-bottom: 1.1rem; }
.iv-doc__party { font-size: .78rem; line-height: 1.6; color: var(--iv-muted); }
.iv-doc__party b { display: block; color: var(--iv-text); font-weight: 600; margin-bottom: .15rem; }
.iv-doc__no { text-align: right; font-size: .78rem; color: var(--iv-muted); line-height: 1.7; }
.iv-doc__no b { color: var(--iv-text); }
.iv-tbl { width: 100%; border-collapse: collapse; font-size: .77rem; }
.iv-tbl th {
    text-align: left; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--iv-dim); font-weight: 600; padding: .4rem .5rem; border-bottom: 1px solid var(--iv-line);
}
.iv-tbl td { padding: .45rem .5rem; border-bottom: 1px solid var(--iv-line-soft); color: var(--iv-muted); }
.iv-tbl td:first-child { color: var(--iv-dim); font-family: var(--iv-mono); font-size: .72rem; }
.iv-tbl .n { text-align: right; font-family: var(--iv-mono); font-size: .74rem; color: var(--iv-text); }
.iv-sum { margin-left: auto; margin-top: .9rem; width: min(320px, 100%); font-size: .78rem; }
.iv-sum div { display: flex; justify-content: space-between; padding: .3rem 0; color: var(--iv-muted); }
.iv-sum div.t { border-top: 1px solid var(--iv-line); margin-top: .3rem; padding-top: .5rem; color: var(--iv-text); font-weight: 650; }
.iv-sum span:last-child { font-family: var(--iv-mono); }

/* XML */
.iv-xml {
    margin: 0; font-family: var(--iv-mono); font-size: .7rem; line-height: 1.65;
    color: var(--iv-muted); white-space: pre-wrap; word-break: break-word;
}
.iv-xml .t { color: var(--iv-accent); }
.iv-xml .a { color: #8fbfa8; }
.iv-xml .v { color: #d9c48a; }
.iv-xml .c { color: #46697c; font-style: italic; }
.iv-xml .x { color: var(--iv-text); }

.iv-note {
    display: flex; gap: .6rem; align-items: flex-start;
    font-size: .74rem; line-height: 1.6; color: var(--iv-dim);
    border-top: 1px solid var(--iv-line-soft); margin-top: 1rem; padding-top: .8rem;
}

/* ── Fußzeile: was hier echt ist ─────────────────────────────────────────── */

.iv-truth {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1px; background: var(--iv-line); border-top: 1px solid var(--iv-line);
}
.iv-truth__i { background: var(--iv-panel); padding: .85rem 1rem; }
.iv-truth__k { font-size: .66rem; letter-spacing: .11em; text-transform: uppercase; color: var(--iv-accent); margin-bottom: .3rem; }
.iv-truth__v { font-size: .76rem; line-height: 1.55; color: var(--iv-muted); }

@media (max-width: 1080px) {
    .iv-grid { grid-template-columns: 1fr; }
    .iv-col { border-right: 0; border-bottom: 1px solid var(--iv-line); }
    .iv-src { min-height: 240px; }
    .iv-out { min-height: 430px; }
    .iv-mail { grid-template-columns: 1fr; }
    .iv-mail__rail { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .iv *, .iv *::before, .iv *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
