/* Materialverwaltung – Verwaltungsseite.
   Look wie Volunteer/Fahrzeug Management: blauer Verlauf, weisse Schrift,
   weisse Tabellen. Alle Eingabefelder, Auswahllisten und Knöpfe gleich hoch. */

.mv-wrap, .mv-wrap *, .mv-wrap *::before, .mv-wrap *::after { box-sizing: border-box; }

.mv-wrap {
    --mv-h: 40px;
    --mv-line: var(--zp-line, rgba(255, 255, 255, 0.25));
    --mv-soft: var(--zp-soft, rgba(255, 255, 255, 0.07));
    --mv-acc: #2271b1;
    max-width: 100%;
    background: var(--zp-bg, linear-gradient(135deg, rgb(34, 80, 227) 0%, rgb(0, 25, 61) 100%));
    color: var(--zp-text, #fff);
    padding: 28px 32px;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    font-size: 15px;
    line-height: 1.45;
}
.mv-wrap h2, .mv-wrap h3, .mv-wrap h4, .mv-wrap p, .mv-wrap label { color: var(--zp-text, #fff); }
.mv-wrap h2 { margin: 0; }
.mv-wrap h3 { margin: 0 0 14px; font-size: 1.2rem; }
.mv-wrap a { color: var(--zp-link, #e7ecff); }

/* ---------- Eingabefelder: einheitliche Höhe ---------- */
.mv-wrap input[type=text], .mv-wrap input[type=number], .mv-wrap input[type=date],
.mv-wrap input[type=search], .mv-wrap input[type=email], .mv-wrap input[type=url],
.mv-wrap select {
    height: var(--mv-h) !important;
    min-height: var(--mv-h);
    padding: 0 10px !important;
    margin: 0 !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    color: #222 !important;
    font-size: 15px !important;
    line-height: normal !important;
    box-shadow: none !important;
    max-width: 100%;
}
.mv-wrap select { padding-right: 28px !important; }
.mv-wrap textarea {
    width: 100%; min-height: calc(var(--mv-h) * 2); padding: 8px 10px; margin: 0;
    border: 1px solid #ccc; border-radius: 4px; background: #fff; color: #222; font-size: 15px; font-family: inherit;
}
.mv-wrap input[type=file] { color: var(--zp-text, #fff); font-size: 14px; height: var(--mv-h); padding: 8px 0; }
.mv-wrap input[type=checkbox], .mv-wrap .mv-field input[type=checkbox] { width: 18px !important; height: 18px !important; min-width: 18px; margin: 0 !important; padding: 0 !important; flex: none; accent-color: #2271b1; }
.mv-wrap .mv-field input[type=file] { width: 100% !important; }

/* ---------- Knöpfe ---------- */
.mv-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--mv-h, 40px); padding: 0 18px; margin: 0;
    background: #2271b1; color: #fff !important; border: 1px solid #2271b1; border-radius: 4px;
    font-size: 15px; line-height: 1; text-decoration: none !important; cursor: pointer; white-space: nowrap;
}
.mv-btn:hover { background: #135e96; border-color: #135e96; }
.mv-btn-light { background: var(--zp-soft, rgba(255,255,255,0.1)); border-color: var(--zp-line, rgba(255,255,255,0.45)); }
.mv-btn-light:hover { background: var(--zp-soft, rgba(255,255,255,0.2)); border-color: #fff; }
.mv-btn-small { height: 32px; padding: 0 12px; font-size: 14px; }
.mv-btn-danger { background: #c62828; border-color: #c62828; }
.mv-btn-danger:hover { background: #a31f1f; }
.mv-link-danger { background: none; border: 0; padding: 0; color: #ff8a8a; cursor: pointer; text-decoration: underline; font-size: 0.88em; }
.mv-table .mv-link-danger { color: #b32d2e; }

/* ---------- Kopf, Tabs, Meldungen ---------- */
.mv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.mv-head .zbv-account-links a { color: var(--zp-link, #e7ecff); }
.mv-applink { font-size: 0.9rem; padding: 8px 12px; background: var(--mv-soft); border: 1px solid var(--mv-line); border-radius: 6px; }
.mv-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid #ddd; margin: 16px 0 20px; }
.mv-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; color: var(--zp-link, #e7ecff) !important; text-decoration: none !important; border: 1px solid transparent; border-bottom: none; border-radius: 4px 4px 0 0; }
.mv-tab:hover { background: var(--zp-soft, rgba(255,255,255,0.15)); }
.mv-tab-active { background: #fff; color: #17335c !important; border-color: #ddd; font-weight: 600; position: relative; top: 2px; }
.mv-msg { padding: 10px 14px; border-radius: 4px; margin: 0 0 16px; }
.mv-msg-ok { background: #d4edda; color: #155724; }
.mv-msg-error { background: #f8d7da; color: #721c24; }

/* ---------- Badges ---------- */
.mv-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.78em; font-weight: 600; background: #e3e8f0; color: #17335c; vertical-align: middle; white-space: nowrap; }
.mv-badge-warn { background: #f59f00; color: #111; }
.mv-badge-ok { background: #2f9e44; color: #fff; }
.mv-badge-err { background: #c62828; color: #fff; }
.mv-badge-anlass { background: #7048e8; color: #fff; }
.mv-badge-frei { background: #0b7285; color: #fff; }
.mv-tab-active .mv-badge { background: #17335c; color: #fff; }

/* ---------- Werkzeugleiste / Filter ---------- */
.mv-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.mv-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.mv-filter input[type=search], .mv-filter input[type=text] { width: 240px !important; }
.mv-filter select { width: auto !important; min-width: 160px; }
.mv-inline { display: inline-flex; align-items: center; gap: 6px; height: var(--mv-h); white-space: nowrap; }
.mv-inline input[type=date], .mv-inline input[type=number] { width: auto !important; }

/* ---------- Boxen ---------- */
.mv-box { background: var(--mv-soft); border: 1px solid var(--mv-line); border-radius: 8px; padding: 18px 22px; margin: 0 0 18px; }
.mv-box-wide { width: 100%; }
.mv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px; align-items: start; }
.mv-cols > .mv-box { margin: 0; }
.mv-cols + .mv-box, .mv-cols + .mv-cols { margin-top: 18px; }

/* ---------- Formular-Raster ---------- */
.mv-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
    gap: 16px 18px;
    align-items: end;          /* Felder unten bündig, auch wenn eine Beschriftung umbricht */
    margin-bottom: 16px;
}
.mv-form-grid-tight { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 12px 14px; margin-bottom: 12px; }
.mv-span-2 { grid-column: span 2; }
@media (max-width: 560px) { .mv-span-2 { grid-column: auto; } }
.mv-form-sub { margin: 6px 0 12px !important; padding-top: 14px; border-top: 1px solid var(--mv-line); font-size: 1rem; }
.mv-wrap .mv-field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; min-width: 0; }
.mv-form-grid > .mv-field { margin: 0; }
.mv-wrap .mv-field > label { font-weight: 600; font-size: 0.9rem; margin: 0; }
.mv-field input, .mv-field select, .mv-field textarea { width: 100% !important; }
.mv-field-small input { width: 100% !important; }
.mv-field-check { justify-content: flex-end; }
.mv-field-check > label { display: flex; align-items: center; gap: 8px; min-height: var(--mv-h); font-weight: 600; }
.mv-field-check .mv-hint { margin-top: -6px; }
.mv-static { display: flex; align-items: center; height: var(--mv-h); font-weight: 600; }
.mv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mv-hint, .mv-small { font-size: 0.85em; color: var(--zp-link, #d7e0ff); }
.mv-muted { opacity: 0.6; font-weight: 400; }

/* Buchungsformulare in den Boxen */
.mv-buchen form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 14px 16px; align-items: end; }
.mv-buchen form .mv-field { margin: 0; }
.mv-buchen form > p:not(.mv-field) { margin: 0; grid-column: 1 / -1; }
.mv-buchen form > .mv-btn { justify-self: start; grid-column: 1 / -1; }
.mv-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.mv-subtabs button { height: 34px; padding: 0 14px; border: 1px solid var(--zp-line, rgba(255,255,255,0.45)); background: transparent; color: var(--zp-text, #fff); border-radius: 4px; cursor: pointer; font-size: 14px; }
.mv-subtabs button.on { background: #fff; color: #17335c; border-color: #fff; font-weight: 600; }

/* Stammdaten */
.mv-stamm-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--mv-line); }
.mv-stamm-titel { font-weight: 700; margin-bottom: 8px; }

/* ---------- Tabellen (weiss, wie in den anderen Plugins) ---------- */
.mv-table-wrap { overflow-x: auto; }
.mv-table { width: 100%; border-collapse: collapse; background: #fff; color: #222; font-size: 0.92rem; margin: 0 0 6px; }
.mv-table th, .mv-table td { border: 1px solid #ddd; padding: 7px 9px; text-align: left; vertical-align: top; color: #222; }
.mv-table th { background: #f5f5f5; font-weight: 600; white-space: nowrap; }
.mv-table tr:nth-child(even) td { background: #fafafa; }
.mv-table a { color: #2271b1; }
.mv-table .mv-small, .mv-table .mv-hint { color: #666; }
.mv-table .mv-field > label, .mv-table label { color: #222; }
.mv-table details summary { color: #2271b1; cursor: pointer; }
.mv-table details form { margin-top: 8px; }
.mv-table details .mv-field { margin-bottom: 8px; }
.mv-table details .mv-field input, .mv-table details .mv-field select { min-width: 160px; }
.mv-num { text-align: right !important; white-space: nowrap; }
.mv-thumb { width: 54px; }
.mv-thumb img { width: 42px; height: 42px; object-fit: cover; border-radius: 4px; display: block; }
.mv-inaktiv td { opacity: 0.55; }
.mv-row-warn td { background: #fff4e0 !important; }

/* ---------- Artikel-Detail ---------- */
.mv-artikel-kopf { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 14px; }
.mv-artikel-kopf h3 { margin: 0 0 4px; font-size: 1.4rem; }
.mv-artikel-kopf p { margin: 0 0 6px; }
.mv-qr { text-align: center; background: #fff; padding: 8px; border-radius: 6px; }
.mv-qr img { width: 110px; height: 110px; image-rendering: pixelated; display: block; }
.mv-qr .mv-small { color: #444; }
.mv-fotos { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.mv-fotos figure { margin: 0; text-align: center; }
.mv-fotos img { height: 120px; border-radius: 6px; display: block; background: #fff; }
.mv-danger-zone { margin-top: 20px; }
.mv-wrap details summary { cursor: pointer; }

/* ---------- Etiketten / Unternavigation ---------- */
.mv-subnav { display: flex; gap: 16px; margin-bottom: 14px; }
.mv-subnav a { text-decoration: none; padding-bottom: 2px; }
.mv-subnav a.on { font-weight: 700; border-bottom: 2px solid #fff; }
.mv-check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; max-height: 420px; overflow: auto; margin-top: 12px; }
.mv-check-list label { display: flex; align-items: center; gap: 8px; }

/* Buchungstypen im Protokoll */
.mv-typ { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.8em; font-weight: 600; color: #fff; background: #666; white-space: nowrap; }
.mv-typ-zugang { background: #1c7ed6; } .mv-typ-abgang { background: #e8590c; } .mv-typ-rueckgabe { background: #2f9e44; }
.mv-typ-korrektur { background: #7048e8; } .mv-typ-umlagerung { background: #495057; } .mv-typ-verlust { background: #c62828; }

@media (max-width: 640px) {
    .mv-wrap { padding: 18px 14px; }
    .mv-filter input[type=search], .mv-filter input[type=text], .mv-filter select { width: 100% !important; }
    .mv-artikel-kopf { flex-direction: column; }
}

/* Stammdaten-Tabellen: passen in die Boxen */
.mv-table-stamm th { white-space: normal; }
.mv-table-stamm .mv-stamm-akt { white-space: nowrap; width: 1%; font-size: .88em; }
.mv-table-stamm .mv-stamm-akt form { display: block !important; margin-top: 2px; }
.mv-filter.mv-toolbar { justify-content: flex-start; }
.mv-inline[hidden], [data-mv-laenge][hidden] { display: none !important; }
.mv-et-opt { gap: 8px 22px; flex-wrap: wrap; }
