/* Berichts-App (Paket B3) — IMAGe-CI, mobile-first, radikal simpel. */
:root {
    --navy: #292F68;
    --green: #4F9584;
    --mint: #3ECEA8;
    --indigo: #5B66A5;
    --navy-50: #EEEFF6;
    --green-50: #EDF5F2;
    --warning: #E5A13C;
    --danger: #C0392B;
    --ink: #23253A;
    --ink-soft: #5B627A;
    --surface: #F6F7FA;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Muss stehen, weil .btn display:inline-flex setzt und damit den
   Standardwert von [hidden] überschreiben würde. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Open Sans', system-ui, sans-serif;
    background: var(--surface);
    color: var(--ink);
    min-height: 100dvh;
    font-size: 16px;
}
h1, h2, h3 { font-family: 'Montserrat', system-ui, sans-serif; color: var(--navy); }

/* Kopfzeile */
.app-header {
    background: var(--navy);
    color: #fff;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-header h1 { color: #fff; font-size: 1.05rem; }
.app-header .sub { font-size: .75rem; opacity: .75; }
.app-header button { background: none; border: none; color: #fff; font-size: .85rem; opacity: .85; }
/* P-P: Home-Knopf links in der Kopfzeile */
.app-header .btn-home { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.12); opacity: 1; margin-right: 10px; flex: none; }
.app-header .btn-home[hidden] { display: none; }
.app-header > div { flex: 1; min-width: 0; }

main { padding: 16px; padding-bottom: 110px; max-width: 640px; margin: 0 auto; }

/* Karten & Listen */
.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(41, 47, 104, .08);
    padding: 16px;
    margin-bottom: 12px;
}
.card h3 { font-size: .95rem; margin-bottom: 8px; }
.muted { color: var(--ink-soft); font-size: .85rem; }
.list-row {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 12px 0; border-bottom: 1px solid #EFF0F4;
}
.list-row:last-child { border-bottom: none; }

/* Formulare */
label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin: 14px 0 6px; }
input[type="text"], input[type="date"], input[type="time"], input[type="email"],
input[type="password"], input[type="search"], select, textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #D9DBE6;
    border-radius: 10px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: 1px; border-color: var(--navy); }
textarea { min-height: 96px; resize: vertical; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    padding: 15px 18px;
    border: none;
    border-radius: 12px;
    font: 600 1rem 'Open Sans', sans-serif;
    cursor: pointer;
    margin-top: 14px;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-ghost { background: var(--navy-50); color: var(--navy); }
.btn-danger-soft { background: #F9E9E7; color: var(--danger); }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* Chips / Badges */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--green-50); color: var(--green);
    border-radius: 999px; padding: 5px 12px;
    font-size: .75rem; font-weight: 600;
}
.chip.warn { background: #FBF1E0; color: var(--warning); }
.chip.err { background: #F9E9E7; color: var(--danger); }
.chip.info { background: var(--navy-50); color: var(--indigo); }

/* Floating Action Button („+") */
.fab {
    position: fixed;
    right: 18px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    width: 62px; height: 62px;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 2rem;
    border: none;
    box-shadow: 0 8px 20px rgba(79, 149, 132, .45);
    z-index: 30;
}

/* Screens */
.screen { display: none; }
.screen.active { display: block; }

/* Beteiligte / Punkte */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag {
    background: var(--navy-50); color: var(--navy);
    border-radius: 999px; padding: 7px 12px; font-size: .8rem;
    display: inline-flex; gap: 8px; align-items: center;
}
.tag button { background: none; border: none; color: var(--danger); font-weight: 700; }

.entry-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; }

/* Foto-Markup */
.markup-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: none; flex-direction: column; }
.markup-wrap.active { display: flex; }
.markup-toolbar {
    display: flex; gap: 8px; padding: 12px calc(env(safe-area-inset-top,0px) + 12px);
    justify-content: center; background: rgba(0,0,0,.6);
}
.markup-toolbar button {
    background: #ffffff22; color: #fff; border: 1.5px solid #ffffff55;
    padding: 9px 14px; border-radius: 10px; font-size: .85rem;
}
.markup-toolbar button.active { background: var(--mint); border-color: var(--mint); color: #06281F; font-weight: 700; }
#markupCanvas { flex: 1; touch-action: none; max-width: 100%; object-fit: contain; margin: auto; }

/* Sync-Status */
.sync-bar {
    position: fixed; left: 0; right: 0;
    bottom: 0;
    padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 10px);
    background: #fff;
    border-top: 1px solid #EFF0F4;
    font-size: .8rem;
    color: var(--ink-soft);
    display: flex; justify-content: space-between; align-items: center;
    z-index: 25;
}
.sync-dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; margin-right: 6px; }
.sync-dot.online { background: var(--mint); }
.sync-dot.offline { background: var(--warning); }

/* Login */
/*
 * Anmeldung: identisch zur Verwaltungsoberfläche — Farbverlauf UND das
 * Bildmarken-Muster darüber. Letzteres fehlte hier, dadurch wirkte die
 * mobile Anmeldung wie ein anderes Produkt.
 * Muster und Werte gespiegelt aus public/css/imag-theme.css (.fi-simple-layout).
 */
.login-hero {
    position: relative;
    min-height: 100dvh;
    background: linear-gradient(135deg, #4F9584 0%, #292F68 100%);
    background-attachment: fixed;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-hero::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='5'%3E%3Ccircle cx='50' cy='21' r='9'/%3E%3Crect x='41' y='34' width='18' height='52' rx='9'/%3E%3Crect x='16' y='45' width='68' height='18' rx='9'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 120px 120px;
}
.login-card { position: relative; z-index: 1; }
.login-card { background: #fff; border-radius: 16px; padding: 28px 22px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card img { height: 52px; display: block; margin: 0 auto 6px; }
.login-card h1 { text-align: center; font-size: 1.15rem; margin-bottom: 4px; }
.login-card .muted { text-align: center; display: block; }
.error-text { color: var(--danger); font-size: .85rem; margin-top: 10px; }

/* ---------- ASA-Aufnahme: sichtbare Rückmeldung + Abschnitte ---------- */

.aufnahme-anzeige {
    margin: 14px 0 4px;
    padding: 14px;
    border-radius: 12px;
    background: var(--navy-50);
}

.aufnahme-kopf {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Der rote Punkt pulsiert, solange aufgenommen wird — das ist das Signal,
   an dem man aus zwei Metern Entfernung erkennt, dass es läuft. */
.aufnahme-punkt {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--danger);
    animation: aufnahme-puls 1.4s ease-in-out infinite;
    flex: 0 0 auto;
}

.aufnahme-punkt.pausiert {
    background: var(--warning);
    animation: none;
}

@keyframes aufnahme-puls {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.8); }
}

.aufnahme-zeit {
    font-variant-numeric: tabular-nums;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--navy);
}

.aufnahme-lage {
    margin-left: auto;
    font-size: .8rem;
    color: var(--ink-soft);
}

.pegel {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 34px;
    margin-top: 12px;
}

.pegel i {
    flex: 1;
    height: 22%;
    border-radius: 3px;
    background: #D4D8E8;
    transition: height .08s linear, background .08s linear;
}

.pegel i.an {
    height: 100%;
    background: var(--green);
}

.abschnitte {
    list-style: none;
    margin: 0 0 14px;
}

.abschnitte li {
    padding: 12px 0;
    border-bottom: 1px solid #E6E8F0;
}

.abschnitte li:last-child { border-bottom: 0; }

.abschnitt-kopf {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.abschnitt-kopf .muted { font-size: .8rem; }

.link-loeschen {
    margin-left: auto;
    background: none;
    border: 0;
    color: var(--danger);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
    padding: 4px;
}

.abschnitt-notiz {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #DDE0EC;
    border-radius: 9px;
    font: inherit;
    font-size: .9rem;
}

/* Ohne Bewegung: der Punkt bleibt stehen, die Farbe trägt die Aussage. */
@media (prefers-reduced-motion: reduce) {
    .aufnahme-punkt { animation: none; }
    .pegel i { transition: none; }
}

/* ---------- Anwesende ---------- */

.zeile-mit-knopf {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.zeile-mit-knopf > select,
.zeile-mit-knopf > input { flex: 1; min-width: 0; }

.knopf-schmal {
    width: auto;
    flex: 0 0 auto;
    margin-top: 0;
    padding: 10px 14px;
    font-size: .85rem;
}

/* Die Zeile hat oben schon Abstand durch das Feld darüber. */
.zeile-mit-knopf + .zeile-mit-knopf { margin-top: 8px; }

.teilnehmer {
    list-style: none;
    margin-top: 10px;
}

.teilnehmer li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #EDEFF5;
    font-size: .92rem;
}

.teilnehmer li:last-child { border-bottom: 0; }
.teilnehmer .link-loeschen { margin-left: auto; }

/* ---------- Abschnitt: anhören und mitlesen ---------- */

.abschnitt-audio {
    width: 100%;
    margin-top: 10px;
    height: 38px;
}

.abschnitt-lage {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: .85rem;
    color: var(--ink-soft);
}

.abschnitt-lage.fehler { color: var(--danger); }

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #C9CEE0;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: dreh .8s linear infinite;
    flex: 0 0 auto;
}

@keyframes dreh { to { transform: rotate(360deg); } }

.transkript {
    margin-top: 10px;
    padding: 12px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--green-50);
    border-radius: 10px;
    font-size: .88rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.sprecher-zuordnung {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.sprecher-zuordnung label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.sprecher-zuordnung label > span {
    flex: 0 0 92px;
    font-size: .82rem;
    color: var(--ink-soft);
}

.sprecher-zuordnung select { flex: 1; min-width: 0; margin: 0; }

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2.4s; }
}

/* ---------- Auswahl der Plaud-Aufnahmen ---------- */

.plaud-liste {
    list-style: none;
    margin-top: 12px;
}

.plaud-liste li {
    padding: 12px 0;
    border-bottom: 1px solid #EDEFF5;
}

.plaud-liste li:last-child { border-bottom: 0; }

.plaud-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin-bottom: 8px;
}

.plaud-kopf .muted { font-size: .8rem; }
.plaud-liste .abschnitt-lage { margin-top: 0; }

/* ---------- Eintrag vervollständigen ---------- */

.unklar {
    list-style: disc;
    margin: 6px 0 0 18px;
    font-size: .82rem;
    color: #8A5A00;
}

.unklar:empty { display: none; }

.baustein-zeile {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--navy-50);
    border-radius: 10px;
    font-size: .9rem;
}

.baustein-zeile a {
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Mikrofon im Beschreibungsfeld ---------- */

.feld-mit-mikro { position: relative; }
.feld-mit-mikro textarea { padding-right: 52px; }

.mikro {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    min-width: 34px;
    padding: 0 8px;
    border: 1px solid #D9DBE6;
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
}

.mikro .mikro-stopp { display: none; }
.mikro.aktiv { background: var(--danger); border-color: var(--danger); color: #fff; }
.mikro.aktiv .mikro-an { display: none; }
.mikro.aktiv .mikro-stopp { display: block; animation: aufnahme-puls 1.4s ease-in-out infinite; }
.mikro-zeit { font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) { .mikro.aktiv .mikro-stopp { animation: none; } }


/* P-P: Entwurfsliste — Filter, klickbare Zeilen, Fehler, Hinweiskarte */
.filter-leiste { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.filter-knopf { border: 1.5px solid #D9DBE6; background: #fff; color: var(--ink-soft); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: .78rem; font-weight: 600; }
.filter-knopf.aktiv { background: var(--navy); border-color: var(--navy); color: #fff; }
.list-row-klickbar > div:first-child { flex: 1; cursor: pointer; }
.list-row-klickbar > div:first-child:active { opacity: .7; }
.entwurf-fehler { color: var(--danger); font-size: .8rem; margin-top: 4px; }
.entwurf-knoepfe { display: flex; gap: 6px; align-items: center; flex: none; }
.card-hinweis { background: #FBF1E0; border: 1px solid #F0D9A8; }
.card-hinweis strong { color: var(--warning); }
