/* ============================================================
   stn Kundenportal — Layout & Komponenten
   Body: Poppins · Überschriften: Zilla Slab · Akzent: #ca4e43
   ============================================================ */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: 'Poppins', system-ui, -apple-system, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Zilla Slab', Georgia, serif;
    font-weight: 600;
    color: var(--anthrazit);
    margin: 0 0 .4em;
    line-height: 1.2;
}

a { color: var(--rot); }

[hidden] { display: none !important; }

/* ---------- Kopf / Layout ---------- */
.topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    background: var(--weiss);
    border-bottom: 1px solid var(--rahmen-soft);
    padding: 18px 24px;
}
.topbar__logo { height: 64px; width: auto; grid-column: 2; }
.topbar__side { display: flex; align-items: center; min-width: 0; }
.topbar__side--left { justify-content: flex-start; }
.topbar__side--right { justify-content: flex-end; }

.topbar__project {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--anthrazit);
    background: #f1f3f5;
    border: 1px solid var(--rahmen-soft);
    border-radius: 999px;
    padding: 6px 14px;
    white-space: nowrap;
}
.topbar__project i { color: var(--muted); font-size: .8em; }

.topbar__side--right { gap: 8px; }
.topbar__btn { gap: 8px; }
.topbar__btn.is-busy .fa-rotate { animation: spin 1s linear infinite; }

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 40px 20px 72px;
}

.footer {
    text-align: center;
    color: var(--muted);
    font-size: .8rem;
    padding: 32px 16px 48px;
    line-height: 1.6;
}

/* ---------- Karte / Verifizierung ---------- */
.card {
    background: var(--weiss);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px 22px;
    max-width: 460px;
    margin: 16px auto;
}
.card__title { font-size: 1.7rem; text-align: center; }
.card__lead { color: var(--muted); text-align: center; margin: 0 0 20px; font-size: .95rem; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-weight: 600; font-size: .9rem; }
.field__input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--rahmen);
    border-radius: var(--radius);
    padding: 0 14px;
    font: inherit;
    color: var(--text);
    background: #fff;
}
.field__input:focus {
    outline: none;
    border-color: var(--rot);
    box-shadow: 0 0 0 3px rgba(202, 78, 67, 0.15);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--rot); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--rot-dark); }
.btn--ghost {
    background: transparent;
    color: var(--anthrazit);
    border-color: var(--rahmen);
    min-height: 40px;
    padding: 8px 14px;
}
.btn--ghost:hover:not(:disabled) { background: #f1f1f1; }
.btn--block { width: 100%; }

/* ---------- Meldungen ---------- */
.msg {
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: .9rem;
    margin: 6px 0;
}
.msg--error { background: #fdecea; border: 1px solid #f5c6c2; color: #9b2c22; }
.msg--info  { background: #eef4ff; border: 1px solid #cfe0fb; color: #1d4ed8; }
.msg--ok    { background: #ecfdf3; border: 1px solid #b6ecc6; color: #1c7a3c; }

/* ---------- Portal-Kopf / Tabs ---------- */
.portal__head {
    text-align: center;
    margin: 4px 0 32px;
}
.portal__title { font-size: 1.7rem; margin: 0; }
.portal__sub { color: var(--muted); margin: 6px 0 0; font-size: .95rem; }

.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs__btn {
    flex: 1 1 auto;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--rahmen);
    border-radius: var(--radius);
    background: #fff;
    color: var(--anthrazit);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.tabs__btn.is-active { background: var(--anthrazit); color: #fff; border-color: var(--anthrazit); }
.tabs__btn:disabled { opacity: .55; cursor: not-allowed; }
.tabs__btn .fa-lock { margin-left: 6px; font-size: .8em; }

/* ---------- To-do-Übersicht ---------- */
.todo {
    background: var(--weiss);
    border: 1px solid var(--rahmen-soft);
    border-left: 5px solid var(--orange);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 20px 22px;
    margin: 0 0 28px;
}
.todo--empty { border-left-color: var(--gruen); }

.todo__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    margin: 0;
}
.todo__title i { color: var(--orange); }
.todo--empty .todo__title i { color: var(--gruen-dark); }
.todo__lead { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }

.todo__list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.todo__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    background: #fff7ee;
    border: 1px solid #f5dcbc;
    border-radius: var(--radius);
    padding: 12px 16px;
    font: inherit;
    color: var(--text);
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.todo__item:hover { background: #fdeeda; border-color: var(--orange); }
.todo__item-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--orange);
    color: var(--orange-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}
.todo__item-text { flex: 1 1 auto; min-width: 0; }
.todo__item-text strong { display: block; font-weight: 600; }
.todo__item-text small { color: var(--muted); font-size: .82rem; }
.todo__item-arrow { flex: 0 0 auto; color: var(--muted); }

/* ---------- Legende ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin: 4px 2px 24px; font-size: .82rem; color: var(--muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot--gruen { background: var(--gruen); }
.dot--orange { background: var(--orange); }
.dot--rot { background: var(--rot-ampel); }

/* ---------- Zeitstrahl ---------- */
.timeline { position: relative; margin-top: 8px; }

.tstep { position: relative; display: flex; gap: 18px; padding-bottom: 30px; }
.tstep__rail { position: relative; flex: 0 0 52px; display: flex; justify-content: center; }
/* Verbindungslinie */
.tstep__rail::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: -30px;
    left: 50%;
    width: 3px;
    transform: translateX(-50%);
    background: var(--rahmen);
    z-index: 0;
}
.tstep:last-child .tstep__rail::before { display: none; }

.tstep__node {
    position: relative;
    z-index: 1;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--rahmen);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--muted);
    flex: 0 0 auto;
}

.tstep__body {
    flex: 1 1 auto;
    background: #fff;
    border: 1px solid var(--rahmen-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 18px 20px;
    min-width: 0;
}
.tstep__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tstep__title { font-size: 1.08rem; margin: 0; }
.tstep__hint { color: var(--muted); font-size: .86rem; margin: 6px 0 0; }

.tags { flex: 0 0 auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag {
    flex: 0 0 auto;
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}
/* Rollen-Chips: jede Zuständigkeit mit eigener, klar unterscheidbarer Farbe. */
.tag--stn { background: #eef0f2; color: var(--anthrazit); }
.tag--kunde { background: #fff1e2; color: var(--orange-dark); }
.tag--gemeinsam { background: #f0eaf8; color: #6b46a8; }
.tag--evu { background: #e6f0f8; color: #23639e; }

.next-badge {
    display: inline-block;
    margin-top: 8px;
    font-size: .72rem;
    font-weight: 600;
    color: #fff;
    background: var(--rot);
    padding: 3px 10px;
    border-radius: 999px;
}

/* Externe Links (z. B. Hersteller-Anleitungen) */
.tstep__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn--link {
    min-height: 36px;
    padding: 6px 12px;
    font-size: .85rem;
    background: #fff;
    color: var(--rot);
    border-color: var(--rahmen);
    text-decoration: none;
}
.btn--link:hover { background: #fdf3f2; border-color: var(--rot); }

.tstep__fields { margin: 12px 0 0; display: grid; gap: 8px 18px; }
.tstep__fields > div { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; border-top: 1px dashed var(--rahmen-soft); padding-top: 8px; }
.tstep__fields dt { color: var(--muted); margin: 0; }
.tstep__fields dd { margin: 0; font-weight: 500; text-align: right; }

/* Status-Farben am Knoten */
.tstep.is-gruen  .tstep__node { border-color: var(--gruen); color: #fff; background: var(--gruen); }
.tstep.is-orange .tstep__node { border-color: var(--orange); color: var(--orange-dark); background: #fff7ee; }
.tstep.is-rot    .tstep__node { border-color: var(--rot-ampel); color: var(--rot-ampel); background: #fff; }
.tstep.is-info   .tstep__node { border-color: var(--rahmen); color: var(--info); background: #fff; }

.tstep.is-gruen  .tstep__rail::before { background: var(--gruen); }

/* Hervorhebung des nächsten Schritts */
.tstep.is-next .tstep__body { border-color: var(--rot); box-shadow: 0 0 0 2px rgba(202,78,67,.15), var(--shadow-soft); }
.tstep.is-next .tstep__node { box-shadow: 0 0 0 4px rgba(202,78,67,.18); }

/* Kurzes Aufleuchten nach Sprung aus der To-do-Übersicht */
.tstep.is-flash .tstep__body { animation: stepFlash 1.8s ease-out; }
@keyframes stepFlash {
    0%   { box-shadow: 0 0 0 5px rgba(232, 145, 28, .5), var(--shadow-soft); }
    100% { box-shadow: var(--shadow-soft); }
}

/* ---------- Bestätigung (orange) ---------- */
.confirm { margin-top: 12px; border-top: 1px solid var(--rahmen-soft); padding-top: 12px; }
.confirm__note {
    width: 100%;
    min-height: 70px;
    border: 1px solid var(--rahmen);
    border-radius: var(--radius);
    padding: 10px 12px;
    font: inherit;
    resize: vertical;
    margin-bottom: 10px;
}
.confirm__note:focus { outline: none; border-color: var(--rot); box-shadow: 0 0 0 3px rgba(202,78,67,.15); }
.confirm__check { display: flex; align-items: center; gap: 10px; font-size: .92rem; margin-bottom: 10px; cursor: pointer; }
.confirm__date { max-width: 240px; margin: 6px 0 12px; display: block; }
.confirm__box { width: 20px; height: 20px; accent-color: var(--rot); }
.confirm__hint { color: var(--muted); font-size: .78rem; margin: 0 0 10px; }

/* ---------- Wahl-Schritt (Buttons) ---------- */
.wahl { margin-top: 12px; border-top: 1px solid var(--rahmen-soft); padding-top: 12px; }
.wahl__optionen { display: flex; flex-direction: column; gap: 10px; }
.wahl__opt { justify-content: flex-start; text-align: left; font-weight: 500; }
.wahl__opt.is-selected { border-color: var(--rot); background: #fdf3f2; }
.wahl__form { margin-top: 12px; }
.wahl__form .field__input { margin: 4px 0 10px; max-width: 340px; display: block; }
.wahl__form-hint { color: var(--muted); font-size: .88rem; margin: 0 0 10px; }

/* ---------- Ladezustand ---------- */
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mobile ---------- */
@media (max-width: 520px) {
    .topbar { padding: 12px 14px; gap: 8px; }
    .topbar__logo { height: 46px; }
    .topbar__project { font-size: .72rem; padding: 5px 10px; gap: 6px; }
    .topbar__btn { min-height: 36px; padding: 6px 10px; }
    .topbar__btn-label { display: none; } /* nur Icon, aria-label übernimmt */
    .wrap { padding: 28px 14px 56px; }
    .todo { padding: 16px; }
    .tstep__fields > div { flex-direction: column; gap: 2px; }
    .tstep__fields dd { text-align: left; }
    .tstep__rail { flex-basis: 44px; }
    .tstep__node { width: 44px; height: 44px; font-size: 1rem; }
}
