/* Container & Allgemeines */
.agzwdag-form-container {
    max-width: 600px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.agzwdag-dynamic-form .form-row {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.agzwdag-dynamic-form label {
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

/* 🎯 Eingabefelder: Erweitert um email, password und den einheitlichen schwarzen Rand */
.agzwdag-dynamic-form input[type="text"],
.agzwdag-dynamic-form input[type="email"],
.agzwdag-dynamic-form input[type="password"],
.agzwdag-dynamic-form input[type="number"],
.agzwdag-dynamic-form select {
    width: 100%;
    padding: 8px;
    border: 1px solid #000000 !important; /* Erzwingt den einheitlichen schwarzen Rand */
    border-radius: 4px;
    font-family: inherit !important;      /* Erzwingt exakt dieselbe Schriftart */
    font-size: 16px !important;            /* Verhindert automatischen iOS-Zoom bei Mobile */
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

/* 🎯 NEU: Styling für JavaScript-Live-Fehlermeldungen unter den Feldern */
.agzwdag-js-error {
    color: #d93025;
    font-size: 0.85em;
    display: none; /* Wird via JS eingeblendet */
    margin-top: 5px;
}

/* 🎯 NEU: Die Box für die verschwindenden Passwort-Bedingungen */
.agzwdag-pwd-requirements {
    font-size: 0.85em;
    color: #d93025;
    margin-top: 8px;
    padding: 10px;
    background: #fdf2f2;
    border-left: 3px solid #d93025;
    list-style: none;
    border-radius: 4px;
    display: none; /* Wird via JS eingeblendet, sobald getippt wird */
}

.agzwdag-pwd-requirements li {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.agzwdag-pwd-requirements li:last-child {
    margin-bottom: 0;
}

/* Tooltip Styling */
.agzwdag-tooltip {
    position: relative;
    display: inline-flex;
    margin-left: 8px;
    cursor: help;
    color: #2271b1; /* WP Blau */
}

.agzwdag-tooltip .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.agzwdag-tooltip .tooltiptext {
    visibility: hidden;
    width: 220px;
    background-color: #2c3338;
    color: #fff;
    text-align: left;
    border-radius: 4px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.agzwdag-tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2c3338 transparent transparent transparent;
}

.agzwdag-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Feedback & Button */
.form-feedback {
    margin-top: 10px;
    font-weight: bold;
}

.agzwdag-dynamic-form button[type="submit"] {
    background-color: #2271b1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.agzwdag-dynamic-form button[type="submit"]:hover {
    background-color: #135e96;
}

/* Alerts (Erfolg, Warnung, Fehler) */
.agzwdag-alert {
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid;
    border-radius: 4px;
    display: flex;
    align-items: center;
}
.agzwdag-alert .dashicons { margin-right: 10px; }
.agzwdag-alert-warning { background: #fff9e6; border-color: #ffb900; color: #856404; }
.agzwdag-alert-success { background: #e7f4e4; border-color: #46b450; color: #2e5d2d; }
.agzwdag-alert-error { background: #fff0f0; border-color: #d63638; color: #d63638; }

/* Captcha Styling */
.agzwdag-captcha-box {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.agzwdag-captcha-img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #ccc;
    margin: 10px 0;
    cursor: pointer;
}
.agzwdag-captcha-input {
    width: 100%;
    text-align: center;
    font-size: 1.2em;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: 2px solid #2271b1 !important;
}

/* Footer Links */
.agzwdag-form-footer {
    margin-top: 15px;
    font-size: 0.9em;
    text-align: center;
}

.agzwdag-button {
    background-color: #2271b1;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.agzwdag-button:hover {
    background-color: #135e96;
}

.agzwdag-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.agzwdag-checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label {
    font-weight: normal !important;
    cursor: pointer;
}

.agzwdag-matrix-badge {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    cursor: help;
}

.agzwdag-field-description {
    color: #666;
    /* Stand 2026-08-04: steht jetzt zwischen Label und Eingabefeld statt
       darunter - Abstand nach unten ergänzt, damit sie nicht am Eingabefeld
       klebt. */
    margin: 4px 0 6px 0;
    font-style: italic;
}

/* ==========================================================================
   Finanzkonto: breiterer Container + Buchungsliste als Karten-Zeilen statt
   Tabelle. Bewusst kein wp-list-table (nur im wp-admin geladen, auf dem
   Frontend komplett unstyled) und bewusst NICHT der schmale
   .agzwdag-form-container (600px, für einspaltige Formulare gedacht) -
   Kontoauszüge brauchen mehr Breite, damit Datum/Kategorie/Zweck/Betrag nicht
   zusammengequetscht wirken.
   ========================================================================== */

.agzwdag-finance-container {
    max-width: 820px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.agzwdag-tx-list {
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    overflow: hidden;
}

.agzwdag-tx-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 16px 18px;
    border-bottom: 1px solid #eee;
}

.agzwdag-tx-row:last-child {
    border-bottom: none;
}

.agzwdag-tx-row:nth-child(even) {
    background: #fafbfc;
}

.agzwdag-tx-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.agzwdag-tx-purpose {
    font-weight: 600;
    color: #23282d;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agzwdag-tx-meta {
    display: flex;
    gap: 10px;
    font-size: 12.5px;
    color: #777;
    flex-wrap: wrap;
}

.agzwdag-tx-category {
    background: #f0f0f1;
    border-radius: 4px;
    padding: 1px 8px;
}

.agzwdag-tx-amount {
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
    flex-shrink: 0;
}

.agzwdag-tx-amount--positive {
    color: #00a32a;
}

.agzwdag-tx-amount--negative {
    color: #d63638;
}

.agzwdag-tx-empty {
    padding: 30px 18px;
    text-align: center;
    color: #666;
}

.agzwdag-balance-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 24px;
    background: #f6f7f7;
    border-left: 4px solid #ccc;
    border-radius: 6px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.agzwdag-balance-card__label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.agzwdag-balance-card__value {
    font-size: 30px;
    font-weight: 700;
}

.agzwdag-finance-filter {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 22px;
    padding: 16px 18px;
    background: #fafbfc;
    border: 1px solid #eee;
    border-radius: 6px;
}

.agzwdag-finance-filter label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.agzwdag-finance-pagination {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    font-size: 14px;
}

/* ==========================================================================
   KI-Agent-Shortcode ([agzwdag_ki_agent]) - bewusst eigene Klassen statt
   wp-list-table (nur im wp-admin geladen, siehe .agzwdag-finance-container
   oben für die gleiche Begründung).
   ========================================================================== */

.agzwdag-ki-container {
    max-width: 820px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.agzwdag-ki-form {
    padding: 20px 22px;
    background: #fafbfc;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 28px;
}

.agzwdag-ki-notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-weight: 600;
}

.agzwdag-ki-notice--success {
    background: #edfaef;
    color: #00a32a;
    border-left: 4px solid #00a32a;
}

.agzwdag-ki-notice--error {
    background: #fcf0f1;
    color: #d63638;
    border-left: 4px solid #d63638;
}

.agzwdag-ki-instructions {
    margin: 10px 0 16px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
}

.agzwdag-ki-instructions:empty {
    display: none;
    padding: 0;
    border: none;
}

.agzwdag-ki-instructions__title {
    display: block;
    font-size: 12.5px;
    color: #555;
    margin-bottom: 6px;
}

.agzwdag-ki-instructions__item {
    display: block;
    font-weight: normal;
    margin: 4px 0;
    cursor: pointer;
}

.agzwdag-ki-history {
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    overflow: hidden;
}

.agzwdag-ki-history__row {
    padding: 16px 18px;
    border-bottom: 1px solid #eee;
}

.agzwdag-ki-history__row:last-child {
    border-bottom: none;
}

.agzwdag-ki-history__row:nth-child(even) {
    background: #fafbfc;
}

.agzwdag-ki-history__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.agzwdag-ki-history__agent {
    font-weight: 600;
    color: #23282d;
    font-size: 15px;
}

.agzwdag-ki-history__status {
    font-size: 12.5px;
    background: #f0f0f1;
    border-radius: 4px;
    padding: 2px 10px;
}

.agzwdag-ki-history__row--failed .agzwdag-ki-history__status {
    background: #fcf0f1;
    color: #d63638;
}

.agzwdag-ki-history__row--completed .agzwdag-ki-history__status {
    background: #edfaef;
    color: #00a32a;
}

.agzwdag-ki-history__date {
    font-size: 12.5px;
    color: #777;
}

.agzwdag-ki-history__error {
    margin-top: 10px;
    color: #d63638;
    font-size: 13.5px;
}

.agzwdag-ki-history__result {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #23282d;
    white-space: pre-wrap;
}

.agzwdag-ki-history__badges {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.agzwdag-ki-badge {
    display: inline-block;
    background: #fcf3e3;
    color: #996800;
    border-radius: 4px;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 600;
}

/* Stand 2026-07-27 (Nutzer-Feedback "Tabelle aufräumen"): echte <table> für die
   Fäden-Liste statt eines flex-Rows mit justify-content:space-between - bei
   unterschiedlich langen Bezeichnungen rutschten Badge/Datum/Aktionen dadurch
   von Zeile zu Zeile sichtbar horizontal - eine echte Tabelle mit fixen
   Spalten behebt das. Ersetzt außerdem die zuvor verwendeten wp-admin-only
   Klassen .button/.button-small (auf dem Frontend gar nicht gestylt, dadurch
   sah der reine Emoji-Link wie ein kaputtes Bild statt wie ein Button aus) durch
   eine eigene .agzwdag-icon-button-Klasse, passend zum bestehenden
   .agzwdag-button-Look. */
.agzwdag-ki-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    overflow: hidden;
}

.agzwdag-ki-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: #777;
    padding: 10px 14px;
    background: #fafbfc;
    border-bottom: 1px solid #e2e4e7;
}

.agzwdag-ki-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.agzwdag-ki-table tbody tr:last-child td {
    border-bottom: none;
}

.agzwdag-ki-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.agzwdag-ki-table__actions {
    white-space: nowrap;
    text-align: right;
    width: 1%;
}

.agzwdag-ki-history__rename summary {
    cursor: pointer;
    list-style: none;
}

.agzwdag-ki-history__rename summary::-webkit-details-marker {
    display: none;
}

/* Stand 2026-08-04: User-Master-Edit - Formulare als <details>/<summary> statt
   permanent aufgeklappter <div>-Stapel, siehe class-agzwdag-id-admin-user-
   management.php. Auf-/Zuklapp-Zustand wird per localStorage gemerkt. */
.agzwdag-admin-formbox > summary.postbox-header {
    cursor: pointer;
    list-style: none;
    position: relative;
    /* .postbox-header ist ein echter WP-Core-Klassenname mit eingebautem
       display:flex; justify-content:space-between - ohne diese Überschreibung
       würden Pfeil (::before) und Label als zwei Flex-Items an die
       gegenüberliegenden Enden der Zeile gedrückt statt nebeneinander links
       zu stehen. */
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center;
}

.agzwdag-admin-formbox > summary.postbox-header::-webkit-details-marker {
    display: none;
}

.agzwdag-admin-formbox > summary.postbox-header::before {
    content: "\25B6";
    display: inline-block;
    margin-right: 10px;
    font-size: 10px;
    color: #888;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.agzwdag-admin-formbox[open] > summary.postbox-header::before {
    transform: rotate(90deg);
}

/* Stand 2026-08-04: Ziehgriff für die per Drag & Drop sortierbare
   Formular-Reihenfolge (jQuery UI Sortable, siehe admin-form-generator.js). */
.agzwdag-formbox-drag-handle {
    cursor: grab;
    color: #888;
    /* margin-left:auto drückt den Griff (als letztes Flex-Item in der
       summary, siehe Markup) an den rechten Rand, Pfeil+Label bleiben
       zusammen links stehen. */
    margin-left: auto;
    flex-shrink: 0;
}

.agzwdag-formbox-drag-handle:hover {
    color: #007cba;
}

.ui-sortable-helper.agzwdag-admin-formbox {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: grabbing;
}

.agzwdag-formbox-placeholder {
    margin-bottom: 20px;
    border: 2px dashed #b4b9be;
    background: #f6f7f7;
    border-radius: 2px;
}

.agzwdag-ki-history__rename-icon {
    opacity: .5;
    font-size: 13px;
}

.agzwdag-ki-history__rename-form {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.agzwdag-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background-color: #f0f0f1;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    text-decoration: none;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

.agzwdag-icon-button:hover {
    background-color: #e2e4e7;
}

.agzwdag-icon-button--text {
    font-size: 13px;
    padding: 0 12px;
}

/* ==========================================================================
   Dokumenten-Fäden (Stand 2026-07-24, Redesign) - Fäden-Liste + Faden-Detail
   mit Einträgen. .agzwdag-ki-history* oben wird für die Fäden-Liste
   weiterverwendet (strukturell identisch: Zeilen mit Kopfzeile + Status/Datum),
   hier nur das, was für verschachtelte Einträge NEU dazukommt.
   ========================================================================== */

.agzwdag-ki-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.agzwdag-ki-back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 13.5px;
    text-decoration: none;
}

.agzwdag-ki-entries {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.agzwdag-ki-entry {
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 16px 18px;
    background: #fff;
    scroll-margin-top: 20px;
}

/* Stand 2026-07-24: Mail-Benachrichtigungen verlinken per #<entry_id>-Anker direkt
   auf einen Eintrag ({{ ki.result_entry_id }}, siehe ki_agents/CLAUDE.md) - :target
   hebt den per Anker angesprungenen Eintrag kurz optisch hervor, rein CSS, keine
   eigene JS-Logik nötig. */
.agzwdag-ki-entry:target {
    outline: 3px solid #fcb900;
    outline-offset: 2px;
    animation: agzwdag-ki-entry-flash 2.5s ease-out 1;
}

@keyframes agzwdag-ki-entry-flash {
    0% { background: #fff8e5; }
    100% { background: #fff; }
}

.agzwdag-ki-entry--upload {
    border-left: 4px solid #2271b1;
}

.agzwdag-ki-entry--agent_result {
    border-left: 4px solid #00a32a;
}

.agzwdag-ki-entry--user_reply {
    border-left: 4px solid #8c8f94;
}

.agzwdag-ki-entry__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: #666;
}

.agzwdag-ki-entry__source {
    font-weight: 600;
    color: #23282d;
}

.agzwdag-ki-entry__excerpt {
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.5;
    color: #23282d;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px 12px;
    background: #fafbfc;
    border-radius: 6px;
}

.agzwdag-ki-entry__truncated-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #996800;
}

.agzwdag-ki-entry__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.agzwdag-ki-entry__subform {
    margin-top: 12px;
    padding: 12px 14px;
    background: #fafbfc;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
}

.agzwdag-ki-entry__subform summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
}

.agzwdag-ki-dict-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}

.agzwdag-ki-dict-card {
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 14px 16px;
    background: #fff;
}

.agzwdag-ki-dict-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.agzwdag-ki-dict-card__words {
    font-size: 13px;
    color: #555;
}