/* ==========================================================================
   AMH Fallberichte - CSS
   ========================================================================== */

/* CSS-Variablen Fallbacks */
:root {
    --amh-fb-primary:            #2563eb;
    --amh-fb-primary-dark:       #1d4ed8;
    --amh-fb-primary-light:      #dbeafe;
    --amh-fb-success:            #16a34a;
    --amh-fb-success-light:      #d1fae5;
    --amh-fb-warning:            #f59e0b;
    --amh-fb-warning-light:      #fef3c7;
    --amh-fb-text:               #1e293b;
    --amh-fb-bg-karte:           #ffffff;
    --amh-fb-bg-header:          #f8fafc;
    --amh-fb-karte-border:       #e2e8f0;
    --amh-fb-btn-upload-bg:      #2563eb;
    --amh-fb-btn-upload-color:   #ffffff;
    --amh-fb-btn-upload-size:    14px;
    --amh-fb-btn-dl-bg:          #f1f5f9;
    --amh-fb-btn-dl-color:       #1e293b;
    --amh-fb-btn-dl-size:        13px;
    --amh-fb-btn-anl-bg:         #2563eb;
    --amh-fb-btn-anl-color:      #ffffff;
    --amh-fb-btn-anl-size:       13px;
    --amh-fb-btn-del-bg:         #fee2e2;
    --amh-fb-btn-del-color:      #991b1b;
    --amh-fb-badge-bg:           #f1f5f9;
    --amh-fb-badge-color:        #64748b;
    --amh-fb-badge-eingereicht-bg:    #dbeafe;
    --amh-fb-badge-eingereicht-color: #1d4ed8;
    --amh-fb-bewertung-bg:       #ffffff;
    --amh-fb-bewertung-border:   #86efac;
    --amh-fb-info-border:        #2563eb;
    --amh-fb-info-bg:            #f8fafc;
    --amh-fb-info-text-size:     14px;
    --amh-fb-ueberschrift-size:  24px;
    --amh-fb-ueberschrift-color: #1e293b;
    --amh-fb-titel-size:         15px;
}

/* --- Wrapper --- */
.amh-fb-user-wrapper,
.amh-fb-team-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-sizing: border-box;
}

/* --- Ueberschrift --- */
.amh-fb-user-wrapper .amh-fb-ueberschrift,
.amh-fb-team-wrapper .amh-fb-ueberschrift {
    font-size: var(--amh-fb-ueberschrift-size) !important;
    color: var(--amh-fb-ueberschrift-color) !important;
    margin-bottom: 1.5rem !important;
    border-bottom: 3px solid var(--amh-fb-primary) !important;
    padding-bottom: 0.5rem !important;
    background: none !important;
    box-shadow: none !important;
}

/* --- Karten --- */
.amh-fb-karte {
    border: 1px solid var(--amh-fb-karte-border) !important;
    border-radius: 10px !important;
    margin-bottom: 1.2rem !important;
    overflow: hidden;
    background: var(--amh-fb-bg-karte) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.06) !important;
    transition: box-shadow .2s;
}

.amh-fb-karte:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,.1) !important;
}

.amh-fb-karte-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1rem 1.2rem !important;
    background: var(--amh-fb-bg-header) !important;
    border-bottom: 1px solid var(--amh-fb-karte-border) !important;
    flex-wrap: wrap;
    gap: .5rem;
}

.amh-fb-status-gesperrt .amh-fb-karte-header {
    background: #fffbeb !important;
}

.amh-fb-karte-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.amh-fb-nr {
    font-size: .75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b !important;
    background: none !important;
}

.amh-fb-titel {
    font-size: var(--amh-fb-titel-size) !important;
    font-weight: 600 !important;
    color: var(--amh-fb-text) !important;
    background: none !important;
}

.amh-fb-karte-body {
    padding: 1.2rem !important;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--amh-fb-bg-karte) !important;
}

/* --- Status Badges --- */
.amh-fb-badge {
    display: inline-block !important;
    padding: .3rem .75rem !important;
    border-radius: 20px !important;
    font-size: .8rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    background: var(--amh-fb-badge-bg) !important;
    color: var(--amh-fb-badge-color) !important;
    border: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
}

.amh-fb-status-gesperrt    .amh-fb-badge { background: var(--amh-fb-warning-light) !important; color: #92400e !important; }
.amh-fb-status-eingereicht .amh-fb-badge { background: var(--amh-fb-badge-eingereicht-bg) !important; color: var(--amh-fb-badge-eingereicht-color) !important; }
.amh-fb-status-freigegeben .amh-fb-badge { background: var(--amh-fb-success-light) !important; color: #065f46 !important; }

/* --- Buttons Basis --- */
.amh-fb-btn,
.amh-fb-btn:link,
.amh-fb-btn:visited {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: auto !important;
    min-height: 36px !important;
    padding: 6px 15px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    transition: filter .15s !important;
    vertical-align: middle !important;
    font-size: .88rem !important;
}

.amh-fb-btn:hover:not(:disabled) {
    filter: brightness(.9) !important;
    text-decoration: none !important;
}

.amh-fb-btn:disabled {
    opacity: .45 !important;
    cursor: not-allowed !important;
}

/* Inline-Buttons: kein Umbrechen, kein max-width */
.amh-fb-btn-upload,
.amh-fb-btn-download,
.amh-fb-btn-bewerten,
.amh-fb-btn-zurueck,
.amh-fb-btn-entwurf,
.amh-fb-btn-abschliessen,
.amh-fb-btn-toggle-bew,
.amh-fb-btn-loeschen {
    max-width: none !important;
    white-space: nowrap !important;
}

/* Anleitung-Button: Theme darf max-width:200px setzen, umbricht */
.amh-fb-btn-anleitung {
    white-space: normal !important;
    word-break: break-word;
    text-align: center;
}

/* --- Button Varianten --- */
.amh-fb-btn-upload,
.amh-fb-btn-upload:link,
.amh-fb-btn-upload:visited {
    background: var(--amh-fb-btn-upload-bg) !important;
    color: var(--amh-fb-btn-upload-color) !important;
    font-size: var(--amh-fb-btn-upload-size) !important;
}

.amh-fb-btn-download,
.amh-fb-btn-download:link,
.amh-fb-btn-download:visited {
    background: var(--amh-fb-btn-dl-bg) !important;
    color: var(--amh-fb-btn-dl-color) !important;
    font-size: var(--amh-fb-btn-dl-size) !important;
}

.amh-fb-btn-anleitung,
.amh-fb-btn-anleitung:link,
.amh-fb-btn-anleitung:visited {
    background: var(--amh-fb-btn-anl-bg) !important;
    color: var(--amh-fb-btn-anl-color) !important;
    font-size: var(--amh-fb-btn-anl-size) !important;
}

.amh-fb-btn-loeschen {
    background: var(--amh-fb-btn-del-bg) !important;
    color: var(--amh-fb-btn-del-color) !important;
    font-size: .82rem !important;
    padding: 4px 10px !important;
    min-height: 28px !important;
}

.amh-fb-btn-bewerten,
.amh-fb-btn-bewerten:link,
.amh-fb-btn-bewerten:visited {
    background: var(--amh-fb-primary) !important;
    color: #fff !important;
    font-size: .88rem !important;
}

.amh-fb-btn-zurueck,
.amh-fb-btn-zurueck:link,
.amh-fb-btn-zurueck:visited {
    background: var(--amh-fb-bg-header) !important;
    color: var(--amh-fb-text) !important;
}

.amh-fb-btn-entwurf {
    background: var(--amh-fb-bg-header) !important;
    color: var(--amh-fb-text) !important;
}

.amh-fb-btn-abschliessen {
    background: var(--amh-fb-success) !important;
    color: #fff !important;
}

.amh-fb-btn-toggle-bew {
    background: var(--amh-fb-bg-header) !important;
    color: var(--amh-fb-text) !important;
    font-size: .82rem !important;
}

/* --- Upload-Bereich --- */
.amh-fb-upload-bereich {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: .6rem;
    padding: .65rem 1rem !important;
    background: var(--amh-fb-bg-header) !important;
    border-radius: 6px;
    border: 2px dashed var(--amh-fb-karte-border) !important;
    min-height: 56px;
}

.amh-fb-upload-input { display: none !important; }

.amh-fb-upload-label {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.amh-fb-upload-btn {
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    min-height: 36px !important;
    padding: 6px 15px !important;
    max-width: none !important;
    background: var(--amh-fb-bg-karte) !important;
    border: 1px solid #94a3b8 !important;
    border-radius: 6px !important;
    font-size: .88rem !important;
    white-space: nowrap;
    box-sizing: border-box !important;
    color: var(--amh-fb-text) !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
}

.amh-fb-upload-status { font-size: .85rem; font-weight: 600; }
.amh-fb-upload-status.amh-fb-success { color: var(--amh-fb-success) !important; }
.amh-fb-upload-status.amh-fb-error   { color: #dc2626 !important; }

.amh-fb-hinweis-warten,
.amh-fb-hinweis-neu {
    font-size: .85rem;
    color: #64748b;
    margin: 0;
    width: 100%;
}

/* --- Versionen --- */
.amh-fb-versionen-liste {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.amh-fb-version-item {
    border-radius: 8px !important;
    border: 1px solid var(--amh-fb-karte-border) !important;
    overflow: hidden;
}

.amh-fb-version-aktuell {
    border-color: #93c5fd !important;
    background: #f0f9ff !important;
}

.amh-fb-version-alt {
    background: #fafafa !important;
    opacity: .85;
}

.amh-fb-version-header {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .6rem .9rem !important;
    min-height: 52px;
}

.amh-fb-version-label {
    font-size: .85rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin-right: auto;
    background: none !important;
}

.amh-fb-datum {
    color: #64748b !important;
    font-size: .85rem !important;
    white-space: nowrap;
}

/* --- Info-Bereich --- */
.amh-fb-info-bereich {
    padding: .9rem 1.1rem !important;
    background: var(--amh-fb-info-bg) !important;
    border-left: 3px solid var(--amh-fb-info-border) !important;
    border-radius: 0 6px 6px 0;
    display: flex !important;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center !important;
}

.amh-fb-info-text {
    flex: 1;
    min-width: 200px;
    font-size: var(--amh-fb-info-text-size) !important;
    color: var(--amh-fb-text) !important;
    line-height: 1.5;
}

.amh-fb-info-text p { margin: 0 0 .5rem !important; }
.amh-fb-info-text p:last-child { margin-bottom: 0 !important; }

/* --- Bewertungsanzeige --- */
.amh-fb-bewertung-anzeige {
    padding: 1rem !important;
    background: var(--amh-fb-bewertung-bg) !important;
    border: 1px solid var(--amh-fb-bewertung-border) !important;
    border-radius: 8px;
}

.amh-fb-kommentar-anzeige {
    margin-top: .75rem;
    padding: .75rem !important;
    background: var(--amh-fb-bg-karte) !important;
    border-radius: 6px;
    border: 1px solid var(--amh-fb-bewertung-border) !important;
}

/* --- Bewertungsmatrix --- */
.amh-fb-matrix-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.amh-fb-matrix-tabelle th {
    background: var(--amh-fb-bg-header) !important;
    padding: .6rem .8rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--amh-fb-karte-border);
    color: var(--amh-fb-text) !important;
}

.amh-fb-matrix-tabelle td {
    padding: .6rem .8rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--amh-fb-text) !important;
    background: none !important;
}

.amh-fb-matrix-tabelle tr:last-child td { border-bottom: none; }

.amh-fb-punkte-combined { white-space: nowrap; text-align: right; width: 90px; }
.amh-fb-punkte-von { font-size: .78rem; color: #94a3b8; margin-left: 2px; }
.amh-fb-punkte-max { text-align: center; width: 70px; }

.amh-fb-gesamt-row td {
    background: var(--amh-fb-bg-header) !important;
    border-top: 2px solid var(--amh-fb-karte-border) !important;
}

.amh-fb-punkte-input {
    width: 60px !important;
    padding: .3rem .4rem !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    text-align: center !important;
    font-size: .9rem !important;
    background: #fff !important;
    color: var(--amh-fb-text) !important;
    height: auto !important;
}

.amh-fb-punkte-input:focus {
    outline: none !important;
    border-color: var(--amh-fb-primary) !important;
    box-shadow: 0 0 0 2px rgba(37,99,235,.15) !important;
}

.amh-fb-punkte-input[readonly] {
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: not-allowed;
}

/* --- Team Bewertung --- */
.amh-fb-bewertung-wrapper { padding: .5rem 0; }
.amh-fb-bewertung-nav { margin-bottom: 1.2rem; }

.amh-fb-bewertung-meta {
    display: flex !important;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: .75rem 1rem !important;
    background: var(--amh-fb-bg-header) !important;
    border-radius: 6px;
    border: 1px solid var(--amh-fb-karte-border) !important;
    margin-bottom: 1.5rem;
    font-size: .9rem;
    align-items: center;
}

.amh-fb-kommentar-bereich { margin: 1.5rem 0; }
.amh-fb-kommentar-bereich label { display: block; margin-bottom: .5rem; }
.amh-fb-kommentar-bereich textarea {
    width: 100% !important;
    padding: .75rem !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: .9rem !important;
    resize: vertical;
    box-sizing: border-box;
    background: #fff !important;
    color: var(--amh-fb-text) !important;
}

.amh-fb-aktionen {
    display: flex !important;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    align-items: center !important;
}

.amh-fb-speicher-status {
    margin-top: .75rem;
    padding: .6rem 1rem;
    border-radius: 6px;
    font-weight: 600;
}

.amh-fb-speicher-status.amh-fb-success { background: var(--amh-fb-success-light) !important; color: #065f46 !important; }
.amh-fb-speicher-status.amh-fb-error   { background: #fee2e2 !important; color: #991b1b !important; }

/* --- Hinweis-Boxen --- */
.amh-fb-hinweis-box {
    padding: .9rem 1.1rem !important;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    font-size: .9rem;
    background: var(--amh-fb-warning-light) !important;
    border: 1px solid var(--amh-fb-warning) !important;
    color: #92400e !important;
}

.amh-fb-hinweis-bewertet {
    background: var(--amh-fb-success-light) !important;
    border-color: #6ee7b7 !important;
    color: #065f46 !important;
}

.amh-fb-hinweis-abschluss {
    font-size: .82rem;
    color: #92400e !important;
    margin-top: .5rem;
    padding: .5rem .75rem;
    background: var(--amh-fb-warning-light) !important;
    border-radius: 6px;
}

/* --- Queue Tabelle --- */
.amh-fb-queue-info { color: #64748b; margin-bottom: 1rem; font-size: .9rem; }

.amh-fb-queue-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.amh-fb-queue-tabelle th {
    background: var(--amh-fb-text) !important;
    color: #fff !important;
    padding: .7rem 1rem;
    text-align: left;
    font-weight: 600;
}

.amh-fb-queue-tabelle td {
    padding: .7rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.amh-fb-queue-row:hover td { background: var(--amh-fb-bg-header) !important; }
.amh-fb-queue-bewertet td  { color: #64748b; }

/* --- Team Navigation --- */
.amh-fb-team-nav {
    display: flex !important;
    gap: .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--amh-fb-karte-border);
    padding-bottom: 0;
}

.amh-fb-team-nav-btn,
.amh-fb-team-nav-btn:link,
.amh-fb-team-nav-btn:visited {
    display: inline-flex !important;
    align-items: center !important;
    height: 38px !important;
    padding: 0 1.2rem !important;
    border-radius: 6px 6px 0 0 !important;
    font-size: .9rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    background: var(--amh-fb-bg-header) !important;
    border: 1px solid var(--amh-fb-karte-border) !important;
    border-bottom: none !important;
    text-decoration: none !important;
    transition: background .15s, color .15s;
    margin-bottom: -2px;
    max-width: none !important;
    white-space: nowrap !important;
}

.amh-fb-team-nav-btn:hover {
    background: var(--amh-fb-bg-karte) !important;
    color: var(--amh-fb-text) !important;
}

.amh-fb-team-nav-active,
.amh-fb-team-nav-active:link,
.amh-fb-team-nav-active:visited {
    background: var(--amh-fb-bg-karte) !important;
    color: var(--amh-fb-primary) !important;
    border-color: var(--amh-fb-karte-border) !important;
    border-bottom-color: var(--amh-fb-bg-karte) !important;
}

/* --- Archiv Filter --- */
.amh-fb-archiv-filter {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1.2rem;
    padding: .75rem 1rem !important;
    background: var(--amh-fb-bg-header) !important;
    border: 1px solid var(--amh-fb-karte-border) !important;
    border-radius: 8px;
}

.amh-fb-filter-label {
    font-size: .85rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin-right: .25rem;
    white-space: nowrap;
}

.amh-fb-filter-btn,
.amh-fb-filter-btn:link,
.amh-fb-filter-btn:visited {
    display: inline-flex !important;
    align-items: center !important;
    height: 30px !important;
    padding: 0 .85rem !important;
    border-radius: 20px !important;
    font-size: .82rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    background: var(--amh-fb-bg-karte) !important;
    border: 1px solid var(--amh-fb-karte-border) !important;
    text-decoration: none !important;
    transition: background .15s, color .15s;
    white-space: nowrap;
    max-width: none !important;
}

.amh-fb-filter-btn:hover {
    background: var(--amh-fb-primary-light) !important;
    color: var(--amh-fb-primary) !important;
    border-color: var(--amh-fb-primary) !important;
}

.amh-fb-filter-active,
.amh-fb-filter-active:link,
.amh-fb-filter-active:visited {
    background: var(--amh-fb-primary) !important;
    color: #fff !important;
    border-color: var(--amh-fb-primary) !important;
}

/* --- Status Tags --- */
.amh-fb-tag {
    display: inline-block !important;
    padding: .2rem .65rem !important;
    border-radius: 20px !important;
    font-size: .78rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
}

.amh-fb-tag-eingereicht { background: var(--amh-fb-primary-light) !important; color: #1d4ed8 !important; }
.amh-fb-tag-bewertet    { background: #ede9fe !important; color: #6d28d9 !important; }
.amh-fb-tag-freigegeben { background: var(--amh-fb-success-light) !important; color: #065f46 !important; }
.amh-fb-tag-offen       { background: var(--amh-fb-warning-light) !important; color: #92400e !important; }

/* --- Nr Badge in Tabelle --- */
.amh-fb-nr-badge {
    display: inline-block !important;
    padding: .2rem .6rem !important;
    border-radius: 4px !important;
    font-size: .82rem !important;
    font-weight: 700 !important;
    background: var(--amh-fb-bg-header) !important;
    border: 1px solid var(--amh-fb-karte-border) !important;
    color: var(--amh-fb-text) !important;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .amh-fb-karte-header   { flex-direction: column; align-items: flex-start !important; }
    .amh-fb-version-header { min-height: auto; }
    .amh-fb-upload-bereich { flex-direction: column; align-items: flex-start !important; }
    .amh-fb-queue-tabelle  { font-size: .8rem; }
    .amh-fb-queue-tabelle th,
    .amh-fb-queue-tabelle td { padding: .5rem .6rem; }
    .amh-fb-bewertung-meta { flex-direction: column; gap: .5rem; }
}
