/* ============================================================
   THW Inventur - Mobile-First Stylesheet
   ============================================================ */

:root {
    --thw-blue: #003366;
    --thw-blue-light: #004d99;
    --thw-blue-pale: #e8f0fe;
    --thw-blue-hover: #002244;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #868e96;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --success: #2b8a3e;
    --success-bg: #ebfbee;
    --warning: #e67700;
    --warning-bg: #fff9db;
    --danger: #c92a2a;
    --danger-bg: #fff5f5;
    --info: #1971c2;
    --info-bg: #e7f5ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Pages ---- */
.page {
    display: none;
    min-height: 100vh;
    flex-direction: column;
}
.page.active {
    display: flex;
}

/* ---- Header ---- */
.header {
    background: var(--thw-blue);
    color: var(--white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-height: 56px;
}

.header h1 {
    font-size: 1.15rem;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.thw-badge {
    background: var(--white);
    color: var(--thw-blue);
    font-weight: 800;
    font-size: 0.85rem;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.btn-back {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    line-height: 1;
}
.btn-back:hover {
    background: rgba(255,255,255,0.15);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.btn-icon:hover {
    background: rgba(255,255,255,0.15);
}

.header-actions {
    display: flex;
    gap: 4px;
}

/* ---- Content ---- */
.content {
    flex: 1;
    padding: 16px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.card p {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--thw-blue);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--thw-blue-hover);
}
.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}
.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background: #a51111;
}

.btn-danger-outline {
    background: none;
    border: 2px solid var(--danger);
    color: var(--danger);
}
.btn-danger-outline:hover {
    background: var(--danger-bg);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color var(--transition);
    -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--thw-blue);
    box-shadow: 0 0 0 3px rgba(0,51,102,0.15);
}

/* ---- Section title ---- */
.section-title {
    font-size: 1rem;
    color: var(--gray-700);
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
}

.hint-text {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ---- Inventur-Liste auf Startseite ---- */
.inventur-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
    border-left: 4px solid var(--thw-blue);
}
.inventur-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}
.inventur-card:active {
    transform: scale(0.99);
}
.inventur-card.abgeschlossen {
    border-left-color: var(--success);
    opacity: 0.8;
}

.inventur-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.inventur-card-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--gray-800);
}

.inventur-card-date {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.inventur-card-progress {
    margin-top: 10px;
}

.inventur-card-progress .progress-bar {
    height: 6px;
    margin-bottom: 4px;
}

.inventur-card-progress-text {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ---- Progress ---- */
.progress-card {
    background: var(--thw-blue);
    color: var(--white);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.progress-label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
}

.progress-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.progress-bar {
    height: 10px;
    background: rgba(255,255,255,0.25);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar.small {
    height: 4px;
}

.progress-fill {
    height: 100%;
    background: var(--white);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.progress-card .progress-fill {
    background: #4fc3f7;
}

.progress-details {
    margin-top: 8px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.mini-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.mini-progress .progress-bar {
    flex: 1;
    background: var(--gray-200);
}

.mini-progress .progress-fill {
    background: var(--thw-blue);
}

.mini-progress-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--thw-blue);
    min-width: 35px;
    text-align: right;
}

/* ---- Modus-Wahl ---- */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.mode-btn {
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 16px 12px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.mode-btn.active {
    border-color: var(--thw-blue);
    background: var(--thw-blue-pale);
}

.mode-btn:hover {
    border-color: var(--thw-blue-light);
}

.mode-btn:active {
    transform: scale(0.97);
}

.mode-icon {
    font-size: 2rem;
}

.mode-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gray-800);
}

.mode-desc {
    font-size: 0.75rem;
    color: var(--gray-600);
    line-height: 1.3;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 14px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--thw-blue);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 2px;
}

.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.info .stat-value { color: var(--info); }

/* ---- Filter Bar ---- */
.filter-bar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 10px 16px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    display: none;
}

.filter-bar.visible {
    display: block;
}

.filter-row {
    margin-bottom: 8px;
}
.filter-row:last-child {
    margin-bottom: 0;
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    padding: 6px 14px;
    border: 2px solid var(--gray-300);
    border-radius: 20px;
    background: var(--white);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition);
}

.chip.active {
    background: var(--thw-blue);
    color: var(--white);
    border-color: var(--thw-blue);
}

.chip:hover:not(.active) {
    border-color: var(--thw-blue-light);
}

/* ---- Item List ---- */
.list-content {
    padding: 8px 16px;
}

.item-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
    border-left: 4px solid var(--gray-300);
    position: relative;
}

.item-card:hover {
    box-shadow: var(--shadow-lg);
}

.item-card:active {
    transform: scale(0.99);
}

.item-card.erfasst {
    border-left-color: var(--success);
}

.item-card.fehlt {
    border-left-color: var(--danger);
}

.item-card.beschaedigt,
.item-card.mangelhaft {
    border-left-color: var(--warning);
}

.item-card.reparatur {
    border-left-color: var(--info);
}

.item-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-800);
    line-height: 1.3;
    padding-right: 30px;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--gray-600);
}

.item-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.item-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-art {
    background: var(--gray-100);
    color: var(--gray-600);
}

.item-status-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-tag.gut {
    background: var(--success-bg);
    color: var(--success);
}
.status-tag.fehlt {
    background: var(--danger-bg);
    color: var(--danger);
}
.status-tag.beschaedigt,
.status-tag.mangelhaft {
    background: var(--warning-bg);
    color: var(--warning);
}
.status-tag.reparatur {
    background: var(--info-bg);
    color: var(--info);
}

.status-tag.lagerort {
    background: var(--thw-blue-pale);
    color: var(--thw-blue);
}

.status-tag.erfasser {
    background: #f0eef8;
    color: #6b5fa5;
}

.item-check {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 1.2rem;
}

/* ---- Location Grid (Fachmodus) ---- */
.section-group {
    margin-bottom: 24px;
}

.section-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Unterkunft-Grid (einfach) */
.location-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ---- Vehicle Layout (Draufsicht) ---- */
.vehicle-layout {
    display: grid;
    grid-template-rows: auto;
    gap: 6px;
    background: var(--gray-100);
    border: 3px solid var(--gray-400);
    border-radius: var(--radius);
    padding: 6px;
    position: relative;
    margin-top: 24px;
}

/* GKW: 4-Spalten-Layout */
.vehicle-gkw {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* MzKW: einfaches 1-Spalten-Layout */
.vehicle-mzkw {
    grid-template-columns: 1fr;
}

/* Fahrtrichtungspfeil */
.vehicle-layout::before {
    content: '▲ Fahrtrichtung';
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--gray-500);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.vehicle-cell {
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 12px 6px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
}

.vehicle-cell:hover {
    border-color: var(--thw-blue);
    background: var(--thw-blue-pale);
}

.vehicle-cell:active {
    transform: scale(0.96);
}

.vehicle-cell.has-items {
    border-color: var(--success);
    background: var(--success-bg);
}

/* Grid-Platzierung: 4 Spalten-Layout
   Spalten: [G-links] [Mitte-L] [Mitte-R] [G-rechts]
   Zeilen:  Führerhaus | Fahrgastraum | G1/G2 | G3/G4 | G5/Dachbox/Dach/G6 | Heckklappe */
.vl-fuehrerhaus  { grid-column: 1 / -1; grid-row: 1; background: var(--gray-50); border-style: dashed; }
.vl-fahrgastraum { grid-column: 1 / -1; grid-row: 2; background: var(--gray-50); border-style: dashed; }
.vl-g1           { grid-column: 1; grid-row: 3; }
.vl-g2           { grid-column: 4; grid-row: 3; }
.vl-g3           { grid-column: 1; grid-row: 4; }
.vl-g4           { grid-column: 4; grid-row: 4; }
.vl-g5           { grid-column: 1; grid-row: 5; }
.vl-dachbox      { grid-column: 2; grid-row: 5; }
.vl-dach         { grid-column: 3; grid-row: 5; }
.vl-g6           { grid-column: 4; grid-row: 5; }
.vl-heckklappe   { grid-column: 1 / -1; grid-row: 6; background: var(--gray-50); border-style: dashed; }

/* Laderaum-Optik: Zeilen 3+4 haben leeren Mittelbereich (nur GKW) */
.vehicle-gkw::after {
    content: '';
    grid-column: 2 / 4;
    grid-row: 3 / 5;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 6px,
        var(--gray-200) 6px,
        var(--gray-200) 7px
    );
    border-radius: var(--radius-sm);
    pointer-events: none;
}

/* Gerätefach-Buttons: kräftigere Farbe */
.vl-g1, .vl-g2, .vl-g3, .vl-g4, .vl-g5, .vl-g6 {
    background: #e8f0fe;
    border-color: #b0c4de;
    font-weight: 700;
}
.vl-g1:hover, .vl-g2:hover, .vl-g3:hover, .vl-g4:hover, .vl-g5:hover, .vl-g6:hover {
    background: var(--thw-blue-pale);
    border-color: var(--thw-blue);
}

/* ---- MzKW Layout (3 Bereiche, von vorn nach hinten) ---- */
.vl-mz-fuehrerhaus  { grid-row: 1; background: var(--gray-50); border-style: dashed; }
.vl-mz-fahrgastraum { grid-row: 2; background: #e8f0fe; border-color: #b0c4de; font-weight: 700; }
.vl-mz-laderaum     { grid-row: 3; background: #e8f0fe; border-color: #b0c4de; font-weight: 700; }

.vl-mz-fahrgastraum:hover, .vl-mz-laderaum:hover {
    background: var(--thw-blue-pale);
    border-color: var(--thw-blue);
}

/* ---- MTW ZTr Layout (3 Bereiche, von vorn nach hinten) ---- */
.vehicle-mtw {
    grid-template-columns: 1fr;
}

.vl-mtw-fuehrerhaus  { grid-row: 1; background: var(--gray-50); border-style: dashed; }
.vl-mtw-fahrgastraum { grid-row: 2; background: #e8f0fe; border-color: #b0c4de; font-weight: 700; }
.vl-mtw-heckklappe   { grid-row: 3; background: var(--gray-50); border-style: dashed; }

.vl-mtw-fahrgastraum:hover {
    background: var(--thw-blue-pale);
    border-color: var(--thw-blue);
}

/* Standard-Buttons für Unterkunft */
.location-btn {
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 18px 10px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.location-btn:hover {
    border-color: var(--thw-blue);
    background: var(--thw-blue-pale);
}

.location-btn:active {
    transform: scale(0.96);
}

.location-btn.has-items {
    border-color: var(--success);
    background: var(--success-bg);
}

.loc-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-800);
}

.loc-count {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ---- Fach Detail ---- */
.fach-summary {
    background: var(--thw-blue-pale);
    color: var(--thw-blue);
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-600);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* ---- Modal ---- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: rgba(0,0,0,0.5);
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-fullscreen {
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.1rem;
    color: var(--gray-800);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
.btn-close:hover {
    background: var(--gray-100);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--gray-200);
    position: sticky;
    bottom: 0;
    background: var(--white);
}

.modal-footer .btn {
    flex: 1;
}

/* ---- Item Info in Modal ---- */
.item-info {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
}

.item-info-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.item-info-details {
    font-size: 0.82rem;
    color: var(--gray-600);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ---- Lagerort Picker ---- */
.lagerort-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.picker-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.picker-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.picker-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.picker-btn {
    padding: 8px 14px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition);
}

.picker-btn.small {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.picker-btn.active {
    background: var(--thw-blue);
    color: var(--white);
    border-color: var(--thw-blue);
}

.picker-btn:hover:not(.active) {
    border-color: var(--thw-blue-light);
    background: var(--thw-blue-pale);
}

/* ---- Zustand Picker ---- */
.zustand-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.zustand-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    text-align: left;
}

.zustand-btn:hover {
    border-color: var(--gray-400);
}

.zustand-btn.active.gut { 
    background: var(--success-bg); 
    border-color: var(--success); 
    color: var(--success); 
}
.zustand-btn.active.beschaedigt { 
    background: var(--warning-bg); 
    border-color: var(--warning); 
    color: var(--warning); 
}
.zustand-btn.active.mangelhaft { 
    background: var(--warning-bg); 
    border-color: var(--warning); 
    color: var(--warning); 
}
.zustand-btn.active.fehlt { 
    background: var(--danger-bg); 
    border-color: var(--danger); 
    color: var(--danger); 
}
.zustand-btn.active.reparatur { 
    background: var(--info-bg); 
    border-color: var(--info); 
    color: var(--info); 
}

.zustand-icon {
    font-size: 1.2rem;
}

/* ---- Search Results ---- */
.search-results {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background var(--transition);
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-item:active {
    background: var(--gray-100);
}

.search-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.search-result-meta {
    font-size: 0.78rem;
    color: var(--gray-600);
    margin-top: 3px;
}

.search-result-item.already-added {
    opacity: 0.5;
}

.search-result-item.already-added::after {
    content: '✓ erfasst';
    float: right;
    font-size: 0.78rem;
    color: var(--success);
    font-weight: 600;
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 300;
    transition: transform 0.3s ease;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* ---- Loading ---- */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--thw-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Separator ---- */
hr {
    border: none;
    height: 1px;
    background: var(--gray-200);
    margin: 16px 0;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
    .content {
        padding: 24px;
    }

    .header {
        padding: 14px 24px;
    }

    .modal-content:not(.modal-fullscreen) {
        border-radius: var(--radius);
        margin-bottom: 5vh;
        max-height: 80vh;
    }

    .modal {
        align-items: center;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---- Legende-Grid (Status-Legende) ---- */
.legende-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.legende-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px 16px;
}

.legende-item {
    font-size: 0.82rem;
    color: var(--gray-700);
    white-space: nowrap;
}

.legende-item strong {
    display: inline-block;
    min-width: 22px;
    color: var(--thw-blue);
    font-weight: 700;
}

/* ---- Pos-Gruppen (Positionsüberschriften) ---- */
.pos-group {
    margin-bottom: 8px;
}

.pos-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 16px;
    margin-bottom: 4px;
    background: var(--thw-blue);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
}

.pos-badge {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    color: #fff;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pos-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-progress {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.85;
    white-space: nowrap;
}

.pos-progress small {
    opacity: 0.7;
}

/* ---- Satz-Accordion (aufklappbare Sätze) ---- */
.satz-accordion {
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.satz-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--thw-blue-pale);
    border-left: 4px solid var(--thw-blue);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--thw-blue);
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background var(--transition);
}

.satz-header::-webkit-details-marker {
    display: none;
}

.satz-header:hover {
    background: #d0dfee;
}

/* Chevron */
.satz-chevron {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5.7 3.3l4.7 4.7-4.7 4.7' fill='none' stroke='%23003366' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

.satz-accordion[open] > .satz-header .satz-chevron {
    transform: rotate(90deg);
}

.satz-badge {
    display: inline-block;
    background: var(--thw-blue);
    color: #fff;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.satz-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.satz-counter {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-600);
    white-space: nowrap;
    flex-shrink: 0;
}

.satz-progress-bar {
    width: 40px;
    height: 5px;
    background: var(--gray-300);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.satz-progress-fill {
    height: 100%;
    background: var(--thw-blue);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.satz-done > .satz-header {
    background: var(--success-bg);
    border-left-color: var(--success);
    color: var(--success);
}

.satz-done .satz-badge {
    background: var(--success);
}

.satz-done .satz-progress-fill {
    background: var(--success);
}

.satz-done .satz-chevron {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5.7 3.3l4.7 4.7-4.7 4.7' fill='none' stroke='%23198754' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.satz-items {
    padding: 2px 0 4px 0;
}

/* ---- Stan-Status tags ---- */
.stan-status {
    display: inline-block;
    background: var(--gray-200);
    color: var(--gray-700);
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    cursor: help;
}

.stan-status-detail {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--gray-600);
}

/* ---- Art badge ---- */
.badge-art {
    background: var(--thw-blue-pale);
    color: var(--thw-blue);
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

/* ---- Login page ---- */
#page-login .form-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ---- Listen-Cards (Stan-Listen Verwaltung) ---- */
.liste-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    margin-bottom: 8px;
}

.liste-card-info {
    flex: 1;
    min-width: 0;
}

.liste-card-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-900);
}

.liste-card-meta {
    display: block;
    font-size: 0.78rem;
    color: var(--gray-600);
    margin-top: 2px;
}

/* Inventur-Card: zugehörige Liste */
.inventur-card-liste {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 2px;
    margin-bottom: 4px;
}

.liste-delete {
    flex-shrink: 0;
    font-size: 1.1rem;
    opacity: 0.5;
    transition: opacity var(--transition);
}

.liste-delete:hover {
    opacity: 1;
}

/* ---- Print ---- */
@media print {
    .header, .filter-bar, .mini-progress, .modal {
        display: none !important;
    }
}

/* ---- Safe area (notch) ---- */
@supports (padding: env(safe-area-inset-top)) {
    .header {
        padding-top: calc(12px + env(safe-area-inset-top));
    }

    .toast {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* ---- Item-card navigating indicator ---- */
.item-card .nav-arrow {
    position: absolute;
    right: 14px;
    bottom: 14px;
    color: var(--gray-400);
    font-size: 0.85rem;
}

/* Erfassen/Bearbeiten Button in item card for Fachmodus */
.item-card .item-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.item-card .item-actions .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

/* Swipe delete hint */
.item-card .delete-hint {
    color: var(--danger);
    font-size: 0.78rem;
    cursor: pointer;
    margin-left: auto;
}

/* ---- Mengen-Check (Soll/Ist Vergleich im Modal) ---- */
.menge-check {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.menge-soll {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 56px;
}

.menge-soll .menge-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--thw-blue);
    line-height: 1;
}

.menge-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.menge-input-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 140px;
}

.menge-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--white);
}

.stepper-btn {
    background: var(--gray-100);
    border: none;
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    -webkit-user-select: none;
    user-select: none;
}

.stepper-btn:hover {
    background: var(--gray-200);
}

.stepper-btn:active {
    background: var(--gray-300);
}

#modal-ist-menge {
    width: 64px;
    height: 48px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--gray-300);
    border-right: 1px solid var(--gray-300);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-900);
    -moz-appearance: textfield;
    padding: 0;
}

#modal-ist-menge::-webkit-outer-spin-button,
#modal-ist-menge::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.menge-diff {
    width: 100%;
    text-align: center;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 4px;
}

.diff-ok {
    background: var(--success-bg);
    color: var(--success);
}

.diff-unter {
    background: var(--danger-bg);
    color: var(--danger);
}

.diff-ueber {
    background: #fff3cd;
    color: #856404;
}

/* ---- Mengen-Tags in Item-Cards ---- */
.status-tag.menge-ok {
    background: var(--success-bg);
    color: var(--success);
    font-weight: 700;
    font-size: 0.78rem;
}

.status-tag.menge-unter {
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 700;
    font-size: 0.78rem;
}

.status-tag.menge-ueber {
    background: #fff3cd;
    color: #856404;
    font-weight: 700;
    font-size: 0.78rem;
}
