/* Ergänzungen der SPA zu app.css: ersetzen die Inline-Stile der Mockups (CSP ohne 'unsafe-inline')
   und Kleinigkeiten, die es im statischen Mockup nicht gibt. */

.login-card .btn-primary
{
    border: none;
    cursor: pointer;
    font: inherit;
}

.login-card .btn-primary:disabled,
button:disabled
{
    opacity: 0.6;
    cursor: default;
}

.login-hint
{
    font-size: 13px;
    margin-top: -8px;
}

.login-secret,
.totp-secret
{
    font-size: 12px;
    margin: 0 0 12px;
}

.qr-code
{
    display: block;
    width: 148px;
    height: 148px;
    margin-bottom: 12px;
    image-rendering: pixelated;
}

.totp-dialog
{
    text-align: left;
    margin: 0 0 16px;
}

.devices-table
{
    max-width: 760px;
}

.devices-actions
{
    max-width: 760px;
}

.nav-empty
{
    padding: 8px 12px;
    font-size: 13px;
}

.list-empty
{
    padding: 16px;
    font-size: 13px;
}

/* M2: Konto-Editor und Postfach-Navigation (ersetzen Inline-Stile aus settings.html und mailbox.html). */

.field-stack
{
    flex: 1;
    min-width: 0;
}

.field-stack > input,
.field-stack > select
{
    width: 100%;
}

.field-note
{
    font-size: 12px;
    margin-top: 4px;
}

.inline-group input[type="number"]
{
    width: 80px;
    flex: none;
}

.drag-grip
{
    touch-action: none;
}

.dragging
{
    opacity: 0.6;
    background: var(--bg-muted);
}

.result-box .result-line + .result-line
{
    margin-top: 4px;
}

.nav-empty a
{
    display: inline;
    padding: 0;
}

.account-status
{
    margin: 4px 0 16px;
}

/* Griff groß genug für Maus und Finger (im Mockup nur die beiden Punkte, ca. 4 px breit). */
.drag-grip
{
    display: inline-block;
    padding: 6px 6px 6px 4px;
    margin: -6px 0 -6px -4px;
}

/* M3: Postfach (mailbox.html) und Email-Fenster (read.html); ersetzen die Inline-Stile der Mockups. */

/* M5: Textanfang einer Email in den Suchtreffern (UI17), zwei Zeilen. */
.mail-row .mail-snippet
{
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
}

.list-status
{
    margin: 10px 12px 0;
}

.list-more
{
    padding: 12px;
    text-align: center;
}

.mail-row.checked
{
    background: var(--accent-soft);
}

.mail-row .mail-attach
{
    margin-right: 4px;
    font-size: 12px;
}

/* D177: Beantwortet (↩) und Weitergeleitet (→) in der Zeile, dezent. */
.mail-row .mail-state
{
    margin-right: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.mail-row[draggable="true"]
{
    user-select: none;
}

.folder-link.drop-target
{
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

.mail-title
{
    font-size: 22px;
    margin: 0 0 16px;
    overflow-wrap: anywhere;
}

.mail-sender
{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mail-sender .sender-name
{
    font-weight: 600;
    overflow-wrap: anywhere;
}

.mail-sender .sender-address,
.mail-sender .mail-meta
{
    font-weight: 400;
    color: var(--text-muted);
}

.mail-sender .mail-meta
{
    font-size: 12px;
    overflow-wrap: anywhere;
}

.spam-note
{
    font-size: 12px;
    margin: -8px 0 12px;
}

.remote-hint
{
    text-align: left;
    font-size: 12px;
    margin-bottom: 16px;
}

/* Email-Inhalt: das iframe ist so hoch wie sein Inhalt (Höhe meldet das Nonce-Skript im srcdoc, T15,
   mail-frame.js) und scrollt senkrecht nie selbst; .detail-body ist der einzige senkrechte Scrollbereich. */

.mail-frame
{
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
}

.mail-text
{
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.5;
}

.attachment-list
{
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

button.attachment
{
    font: inherit;
    cursor: pointer;
}

/* F42: Chip zum Öffnen und daneben ⬇ zum Speichern als eine Einheit. */
.attachment-item
{
    display: inline-flex;
    align-items: stretch;
    max-width: 100%;
}

.attachment-item .attachment
{
    margin: 0;
    min-width: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    overflow-wrap: anywhere;
    text-align: left;
}

.attachment-save
{
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--border-light);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--bg-muted);
    padding: 6px 10px;
}

.attachment-save:hover,
.attachment-item .attachment:hover
{
    background: var(--bg-pressed);
}

.attachment-all
{
    font-size: 13px;
}

.detail-toolbar .btn.active
{
    background: var(--bg-pressed);
}

.folder-dialog
{
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    min-width: 260px;
    max-width: 90vw;
}

.folder-dialog::backdrop
{
    background: rgba(0, 0, 0, 0.25);
}

.folder-dialog h2
{
    font-size: 16px;
    margin: 0 0 12px;
}

.folder-choices
{
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.folder-choices .btn
{
    justify-content: flex-start;
}

.read-window
{
    width: 100%;
}

/* Breite der Emailliste am Griff zwischen Liste und Lesebereich (mailbox.js, localStorage). */
.pane-list.resizable
{
    width: var(--list-width, 360px);
}

.list-resizer
{
    flex: 0 0 6px;
    margin: 0 -3px;
    cursor: col-resize;
    position: relative;
    z-index: 2;
    touch-action: none;
}

.list-resizer:hover,
.list-resizer:focus-visible,
.list-resizer.dragging
{
    background: var(--border);
    outline: none;
}

@media (max-width: 700px)
{
    .pane-list.resizable
    {
        width: 100%;
    }

    .list-resizer
    {
        display: none;
    }
}

/* M4: Anmeldung (Kennwort vergessen, Code erneut senden), Einstellungen SMS und System. */

.login-note
{
    font-size: 13px;
    margin: 12px 0 0;
}

.login-success
{
    font-size: 13px;
    margin: -4px 0 12px;
    color: #067647;
}

.link-button
{
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
}

.link-button:disabled
{
    color: inherit;
    text-decoration: none;
}

.log-filters
{
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.log-filters select,
.log-filters input[type="date"]
{
    flex: none;
}

.log-table td:first-child
{
    white-space: nowrap;
}

.log-table tr.log-error td,
.log-table tr.log-fatal td
{
    color: #b42318;
}

.log-table tr.log-warn td
{
    color: #9a6700;
}

.reindex-start
{
    margin-bottom: 12px;
}

/* M6: Kontakte (contacts.html) und Absender-Menü im Lesebereich. */

.field-row > .field-stack,
.field-row > .group-slot
{
    flex: 1;
    min-width: 0;
}

.field-stack .form-error
{
    margin: 4px 0 0;
}

.group-chips
{
    margin: 0;
}

.contact-note
{
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.contact-messages
{
    margin: 0 -16px;
}

.contact-messages .mail-row
{
    cursor: pointer;
}

/* Auf Touch-Geräten gibt es kein Überfahren: der Stift zum Bearbeiten einer Gruppe bleibt sichtbar. */
@media (hover: none)
{
    .module-nav a .nav-edit
    {
        visibility: visible;
    }
}

.module-nav a .nav-edit:focus-visible
{
    visibility: visible;
}

.sender-menu > summary .sender-address
{
    font-weight: 400;
}

/* D73: Kontakt als Absender, vom Anbieter aber nicht bestätigt. */
.remote-hint.sender-warning strong
{
    color: #b42318;
}

/* Hinweise unter einer Listenzeile: Konto (Zusammengefasst), Ordner (Suche in allen
   Ordnern), Gruppen eines Kontakts (höchstens drei, dann "+n"). */

.mail-row .mail-hints
{
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.mail-row .mail-hints .mail-account-tag
{
    margin-top: 0;
}

/* "In Gruppe aufnehmen": neue Gruppe gleich im Dialog anlegen. */

.group-new-title
{
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0 6px;
}

.group-new
{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.group-new input
{
    flex: 1;
    min-width: 0;
}

/* Verfassen (compose.html, M9): Aufbau aus app.css; hier nur, was das Mockup nicht braucht. Die
   schwebenden Felder des Editors liegen im positionierten Verfassen bzw. Signatur-Editor. */

.editor-layer
{
    display: contents;
}

.compose-pane
{
    min-height: 0;
}

.compose .compose-notice a
{
    cursor: pointer;
}

.drop-icon
{
    font-size: 32px;
}

.signature-row
{
    align-items: flex-start;
}

.signature-row > label
{
    padding-top: 10px;
}

.attachment-remove
{
    border: none;
    background: none;
    padding: 0 2px;
    cursor: pointer;
    color: var(--text-muted);
    font: inherit;
}

.attachment-remove:hover
{
    color: #b42318;
}

.toolbar-status.fail
{
    color: #b42318;
}

.module-action.active
{
    pointer-events: none;
    opacity: 0.8;
}

/* "+ Neue E-Mail" steht in der Postfach-Navigation (.module-nav); deren Link-Regel
   (dunkle Schrift, grauer Hover) darf den blauen Button nicht überschreiben. */
.module-nav a.btn-primary
{
    color: #fff;
    background: var(--accent);
    font-weight: normal;
}

.module-nav a.btn-primary:hover
{
    background: var(--accent-hover);
}

/* Postausgang (UI22, UI23): Versandstatus in der Zeile und im Lesebereich. */

.send-state
{
    color: var(--text-muted);
}

.send-state.failed
{
    color: #b42318;
    font-weight: 600;
}

.outbox-sending-hint,
.outbox-note,
.send-error
{
    text-align: left;
    font-size: 12px;
    margin-bottom: 16px;
}

.send-error strong
{
    color: #b42318;
}

.quick-reply-status
{
    font-size: 12px;
    margin-top: 6px;
}

/* D106: schnelle Antwort mehrzeilig mit Senden-Button. */
.quick-reply-row
{
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.detail-reply textarea.quick-reply-input
{
    flex: 1;
    min-width: 0;
    resize: none;
    min-height: 36px;
    max-height: 240px;
    padding: 8px 14px;
    font: inherit;
    line-height: 1.4;
    border-radius: 18px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    color: inherit;
}

.quick-reply-send
{
    flex: none;
    height: 36px;
    min-width: 36px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
}

/* D102: Zustellstand einzelner Empfänger. */
.delivery-note
{
    text-align: left;
    font-size: 12px;
    margin-bottom: 16px;
}

.delivery-note .delivery-failed strong
{
    color: #b42318;
}

/* UC219, D98: Abrufprotokoll im Konto-Editor. */
.fetch-log
{
    max-width: 760px;
}

.fetch-log-head
{
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 6px;
}

.fetch-log-head .section-title
{
    margin: 0;
}

.fetch-log-table td.log-duration
{
    white-space: nowrap;
    text-align: right;
}

/* Tags (F13, M11, tags.js): Chips in der Listenzeile ohne eigenen Abstand, "+n" als Hinweis; Dialog
   "Tag vergeben" mit Feld, Vorschlägen und (Mehrfachauswahl) "Entfernen"; "#"-Vorschläge im Suchfeld. */

.mail-row .mail-hints .mail-tags
{
    margin-left: 0;
}

.mail-row .mail-tags .tag
{
    cursor: pointer;
}

.mail-row .mail-tags .tag-more
{
    cursor: default;
    background: var(--bg-muted);
    color: var(--text-muted);
}

.mail-tag-area .tag-list
{
    margin: -8px 0 16px;
}

.tag-dialog
{
    width: 340px;
}

.tag-dialog-input
{
    width: 100%;
    margin-bottom: 8px;
}

.tag-choices,
.tag-remove-choices
{
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.tag-remove-choices h3
{
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0;
}

.tag-choice
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: none;
    border-radius: var(--radius);
    background: none;
    text-align: left;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.tag-choice.active,
.tag-choice:hover
{
    background: var(--accent-soft);
}

.tag-choice .tag
{
    margin-right: 0;
}

.tag-choice-new
{
    color: var(--accent);
}

.search-field .tag-suggestions,
.search-field .term-suggestions
{
    left: 0;
    right: 0;
}

/* "Anzeigename spiegeln" ohne F11-Adresse (D110). */
.field-links.disabled .field-check label
{
    opacity: 0.6;
    cursor: default;
}

/* Die Vorschlagsliste ragt aus dem Listenkopf; der Kopf muss deshalb über den ebenfalls klebenden
   Schnellfiltern und der Auswahlzeile liegen. */
.pane-list-header:has(.tag-suggestions:not([hidden])),
.pane-list-header:has(.term-suggestions:not([hidden]))
{
    z-index: 3;
}

/* M12: Filter-Editor (settings.html #filter): Bedingung aus Auswahl, Suchbegriff und ✕ in einer Zeile,
   der Suchbegriff nimmt den Rest der Breite; schmal bricht die Zeile um. */

.filter-conditions .inline-group
{
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.filter-conditions .inline-group input[type="text"]
{
    flex: 1;
    min-width: 140px;
}

/* Importieren (UI30): Fortschrittsbalken je Komponente. */
progress.import-progress
{
    width: 120px;
    vertical-align: middle;
}

/* Importieren (UI30, D161, D162): Werte eines neuen Kontos unter der Auswahl des Ziels. */
.import-sources select
{
    max-width: 320px;
}

.import-new-account
{
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.5;
}

/* Schmal: Quellkonten untereinander statt als breite Tabelle. */
@media (max-width: 700px)
{
    .import-sources,
    .import-sources tbody,
    .import-sources tr,
    .import-sources td
    {
        display: block;
    }

    .import-sources tr:first-child
    {
        display: none;
    }

    .import-sources tr
    {
        padding: 10px 0;
        border-bottom: 1px solid var(--border, #e5e7eb);
    }

    .import-sources td
    {
        border: none;
        padding: 2px 0;
    }

    .import-sources select
    {
        max-width: 100%;
        width: 100%;
    }

    .import-sources td.n-done::before
    {
        content: "Übernommen: ";
    }

    .import-sources td.n-dup::before
    {
        content: "Dubletten: ";
    }

    .import-sources td.n-err::before
    {
        content: "Fehler: ";
    }
}

/* F44: erkannte Suchbegriffe als Chips unter dem Suchfeld (✕ entfernt den Begriff), ausgeschlossene durchgestrichen
   umrandet; Hinweise zu ungültigen Begriffen über der Trefferliste. */
.search-chips
{
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 12px 0;
}

.search-chips[hidden],
.search-warnings[hidden]
{
    display: none;
}

.search-chip
{
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 2px 4px 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.search-chip.negated
{
    background: var(--bg-muted);
    outline: 1px dashed var(--border);
}

.search-chip-remove
{
    border: 0;
    background: none;
    padding: 0 4px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

.search-chip-remove:hover
{
    color: var(--text);
}

.search-warnings
{
    padding: 6px 14px 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* D172: Suchbereich als Auswahlliste unter dem Suchfeld; auf 375 px nimmt die Liste die restliche Breite. */
.search-scope-label
{
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
    font-size: 12px;
}

.search-scope-select
{
    min-width: 0;
    max-width: 100%;
    font-size: 12px;
    padding: 3px 6px;
}

/* F43: "Auswahl aufheben" ganz rechts in der Auswahlleiste, auch nach einem Umbruch. */
.selection-bar .selection-clear
{
    margin-left: auto;
}

/* D175: Lesebereich beim Öffnen einer Email: der Rahmen der neuen Email ersetzt die alte erst nach dem Laden; bis
   dahin bleibt die alte gedämpft sichtbar (kein Flackern beim Blättern mit der Tastatur). */
.detail-frame
{
    display: contents;
}

.pane-detail.loading .detail-body
{
    opacity: 0.6;
    transition: opacity 0.15s ease 0.15s;
}

/* Die noch gezeigte Email ist bis zum Austausch nicht bedienbar: eine Aktion dort würde von der gerade geladenen
   Fassung überschrieben (D175). */
.pane-detail.loading > *
{
    pointer-events: none;
}

/* D177: "Beantwortet am …" bzw. "Weitergeleitet" unter dem Absender. */
.mail-answered
{
    margin: -8px 0 12px;
    font-size: 13px;
}
