/**
 * Zentrales Stylesheet des Fulfillment-Portals.
 * Enthält alle seitenübergreifend genutzten Design-Elemente (Layout, Sidebar, Karten,
 * Buttons, Formulare, Tabellen, Badges, Tabs, Pagination). Seiten sollten hier nur noch
 * seitenspezifische Ergänzungen in einem eigenen, kurzen <style>-Block ergänzen.
 */

/* --- Basis-Layout --- */
body { font-family: Arial, sans-serif; background: #f4f6f9; margin: 0; padding: 0; display: flex; }
.content { margin-left: 250px; padding: 40px; width: 100%; box-sizing: border-box; }

/* --- Sidebar --- */
.sidebar { width: 250px; background: #2c3e50; color: #fff; height: 100vh; padding: 20px; box-sizing: border-box; position: fixed; overflow-y: auto; z-index: 1000; }
.sidebar h3 { margin-top: 0; border-bottom: 1px solid #4f5d73; padding-bottom: 10px; }
.sidebar a { display: block; color: #abd1c6; padding: 10px 0; text-decoration: none; }
.sidebar a:hover { color: #fff; }
.sidebar a.active { color: #fff; font-weight: bold; }

.mobile-menu-toggle { display: none; position: fixed; top: 15px; left: 15px; z-index: 1100; background: #2c3e50; color: #fff; border: 0; width: 42px; height: 42px; border-radius: 6px; font-size: 20px; cursor: pointer; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; }
.sidebar-backdrop.open { display: block; }

/* --- Karten --- */
.card { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 25px; }

/* --- Buttons --- */
.btn, .btn-submit { padding: 8px 16px; border: 0; border-radius: 4px; color: #fff; cursor: pointer; font-size: 14px; font-weight: bold; text-decoration: none; display: inline-block; }
.btn-primary, .btn-submit { background: #007bff; }
.btn-primary:hover, .btn-submit:hover { background: #0056b3; }
.btn-success { background: #28a745; }
.btn-danger { background: #dc3545; }
.btn-info { background: #17a2b8; }
.btn-secondary { background: #6c757d; }
.btn-reset { color: #4a5568; text-decoration: none; font-size: 13px; font-weight: bold; }

/* --- Formulare --- */
.form-group { margin-bottom: 12px; }
.form-group label, label { display: block; margin-bottom: 4px; font-weight: bold; font-size: 13px; color: #333; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="email"], input[type="file"], select, textarea {
    width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; font-family: inherit; background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

.checkbox-container { max-height: 120px; overflow-y: auto; border: 1px solid #ddd; padding: 8px; border-radius: 4px; background: #fafafa; }
.checkbox-item { display: flex; align-items: center; margin-bottom: 4px; font-weight: normal; }
.checkbox-item input { margin-right: 8px; width: auto; }

/* --- Tabellen --- */
table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; text-align: left; }
th { background: #f8f9fa; color: #475569; }
th a { color: #475569; text-decoration: none; }
th a:hover { color: #007bff; }

.tarif-table th { text-align: left; font-size: 13px; text-transform: uppercase; color: #2c3e50; }
.tarif-table .tarif-preis { text-align: right; font-weight: bold; }

/* --- Meldungen --- */
.alert { padding: 12px; border-radius: 4px; margin-bottom: 20px; font-weight: bold; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* --- Badges --- */
.badge { background: #007bff; color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; }
.badge-admin { background: #dc3545; }
.badge-client { background: #28a745; }

.status-badge { padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; color: #fff; display: inline-block; }
.status-vorlaeufig { background: #f39c12; }
.status-final { background: #27ae60; }
.status-offen { background: #95a5a6; }
.status-abgerechnet { background: #27ae60; }
.status-gesperrt { background: #dc3545; }

/* --- Tabs (Reports, Import etc.) --- */
.nav-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #ddd; padding-bottom: 10px; flex-wrap: wrap; }
.tab-link { padding: 10px 15px; text-decoration: none; background: #e2e8f0; color: #4a5568; border-radius: 4px; font-weight: bold; font-size: 14px; border: 0; cursor: pointer; }
.tab-link.active { background: #007bff; color: white; }

/* --- Filter-/Suchboxen --- */
.admin-filter-box, .search-box { background: #e2e8f0; padding: 15px; border-radius: 6px; margin-bottom: 20px; display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.admin-filter-box label, .search-box label { font-weight: bold; font-size: 14px; color: #2c3e50; }
.admin-filter-box select, .search-box input[type="text"] { padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; font-size: 14px; min-width: 200px; width: auto; }

.filter-card { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 25px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) 120px; gap: 12px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; }
.filter-group label { font-size: 12px; font-weight: bold; color: #475569; margin-bottom: 4px; }
.filter-group input, .filter-group select { padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 13px; background: #fff; }

/* --- KPI-/Statistik-Kacheln (Dashboard, Analytics) --- */
.header-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #ddd; padding-bottom: 20px; margin-bottom: 20px; }
.grid-stats, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card, .kpi-box { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border-left: 5px solid #007bff; }
.stat-card h4, .kpi-title { margin: 0; color: #7f8c8d; font-size: 13px; text-transform: uppercase; font-weight: bold; }
.stat-card .value, .kpi-value { font-size: 22px; font-weight: bold; margin: 10px 0 5px 0; color: #2c3e50; }
.stat-card .sub, .kpi-sub { font-size: 12px; color: #95a5a6; }
.stat-card.versand, .kpi-box.fracht { border-left-color: #2ecc71; }
.stat-card.retoure, .kpi-box.retoure { border-left-color: #e67e22; }
.stat-card.anlieferung, .kpi-box.eingang { border-left-color: #f1c40f; }
.stat-card.total { border-left-color: #9b59b6; background: #fdfefe; }
.kpi-box.avg { border-left-color: #9b59b6; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-table { background: #fff; padding: 20px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-top: 25px; }

/* --- Pagination --- */
.pagination { display: flex; justify-content: center; gap: 5px; list-style: none; padding: 0; margin: 20px 0 10px 0; }
.pagination li a, .pagination li span { display: block; padding: 8px 12px; border: 1px solid #cbd5e1; color: #4a5568; text-decoration: none; border-radius: 4px; font-size: 13px; font-weight: bold; }
.pagination li a:hover { background: #f1f5f9; }
.pagination li.active span { background: #007bff; color: white; border-color: #007bff; }
.pagination li.disabled span, .pagination li.disabled a { color: #94a3b8; background: #f8fafc; border-color: #e2e8f0; cursor: not-allowed; }

/* --- Sonstige wiederkehrende Elemente --- */
.pkg-box { background: #eef2f7; padding: 8px; border-radius: 4px; margin-top: 5px; font-size: 12px; border-left: 3px solid #2ecc71; }
.btn-quick-add { background: #28a745; color: white; border: 0; padding: 2px 6px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 12px; margin-left: 5px; }
.quick-form-panel { background: #fcfcfc; border: 1px dashed #28a745; padding: 10px; margin-top: 8px; border-radius: 4px; display: none; }
.quick-form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.quick-form-grid input, .quick-form-grid select { padding: 5px; font-size: 12px; }
.quick-form-submit { background: #28a745; color: white; border: 0; font-weight: bold; border-radius: 4px; cursor: pointer; font-size: 11px; height: 26px; }

.log-item { border-left: 4px solid #2980b9; padding-left: 15px; margin-bottom: 30px; position: relative; }
.log-item.version-latest { border-left-color: #27ae60; }
.log-header { margin-bottom: 8px; }
.log-title { font-size: 18px; font-weight: bold; color: #2c3e50; }
.log-meta { font-size: 13px; color: #7f8c8d; margin-top: 4px; }
.log-body { font-size: 14px; color: #333; line-height: 1.6; }

/* --- Mobile / Tablet (Sidebar wird zum ausklappbaren Menü, Layouts stapeln sich) --- */
@media (max-width: 768px) {
    .mobile-menu-toggle { display: block; }
    .sidebar { left: -260px; transition: left 0.25s ease; }
    .sidebar.open { left: 0; }
    .content { margin-left: 0; padding: 20px; padding-top: 75px; }

    .grid-2, .grid-3, .grid-4, .grid-5, .split-grid, .quick-form-grid,
    .grid-stats, .kpi-grid, .filter-grid { grid-template-columns: 1fr; }

    table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

    .admin-filter-box, .search-box { flex-direction: column; align-items: stretch; }
    .admin-filter-box select, .search-box input[type="text"] { width: 100%; min-width: 0; }

    .header-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .nav-tabs { gap: 6px; }
}

/* --- Utility-Klassen ---
   Ersetzen frühere Inline-style="..."-Attribute (CSP style-src erlaubt seit #63 kein
   unsafe-inline mehr). Bewusst als kleines, komponierbares Set gehalten (mehrere Klassen
   pro Element kombinierbar) statt einer eigenen Klasse pro einmaliger Kombination. */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-5 { gap: 5px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.h-full { height: 100%; }
.w-auto { width: auto; }
.w-100 { width: 100%; }
.w-70pct { width: 70%; }
.w-30pct { width: 30%; }
.h-38 { height: 38px; }
.h-40 { height: 40px; }
.nowrap { white-space: nowrap; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #7f8c8d; }
.text-muted-2 { color: #475569; }
.text-muted-3 { color: #64748b; }
.text-muted-4 { color: #94a3b8; }
.text-dark { color: #2c3e50; }
.text-link-plain { color: #475569; text-decoration: none; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.no-underline { text-decoration: none; }
.fw-normal { font-weight: normal; }
.fw-bold { font-weight: bold; }
.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-5 { margin-top: 5px; }
.mt-6 { margin-top: 6px; }
.hint-text { font-size: 12px; color: #7f8c8d; margin: 4px 0 0; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mt-neg-10 { margin-top: -10px; }
.mb-0 { margin-bottom: 0; }
.mb-5 { margin-bottom: 5px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-25 { margin-bottom: 25px; }
.ml-5 { margin-left: 5px; }
.ml-10 { margin-left: 10px; }
.m-0 { margin: 0; }
.pt-15 { padding-top: 15px; }
.p-0 { padding: 0; }
.p-2-8 { padding: 2px 8px; }
.p-3 { padding: 3px; }
.p-4-8 { padding: 4px 8px; }
.p-4-10 { padding: 4px 10px; }

.border-top-eee { border-top: 1px solid #eee; }
.border-top-danger { border-top: 4px solid #dc3545; }
.header-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #eee; padding-bottom: 10px; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.alert-success { background: #d4edda; color: #155724; padding: 12px; border-radius: 4px; margin-bottom: 15px; font-weight: bold; }
.alert-danger-box { background: #f8d7da; color: #721c24; padding: 12px; border-radius: 4px; margin-bottom: 15px; font-weight: bold; }
.float-right { float: right; }
.fs-9 { font-size: 9px; }
.p-1-4 { padding: 1px 4px; }
.p-2-6 { padding: 2px 6px; }
.w-70 { width: 70px; }
.btn-quick-add-blue { background: #007bff; }
.quick-fform-box { display: none; margin-top: 5px; background: #f8f9fa; padding: 5px; border: 1px solid #ddd; border-radius: 4px; }
.border-bottom-eee { border-bottom: 1px solid #eee; }
.opacity-40 { opacity: 0.4; }
.hidden-offscreen { position: absolute; left: -9999px; top: -9999px; }
.grid-span-1 { grid-column: span 1; }
.grid-span-2 { grid-column: span 2; }
.grid-span-3 { grid-column: span 3; }
.badge-warning { background: #f39c12; }
.box-warning-soft { background: #fff3cd; border: 1px solid #ffeeba; border-radius: 6px; padding: 15px; margin-bottom: 15px; }
.backup-codes-grid { font-family: monospace; font-size: 15px; line-height: 1.8; columns: 2; }
.text-success-alt { color: #27ae60; }
.mt-neg-8 { margin-top: -8px; }
.kpi-box-cyan { border-left-color: #00d2d3; }
.text-dark-2 { color: #1e293b; }

/* --- Kosten-Trend-Chart (analytics.php) --- */
.chart-legend { display: flex; gap: 15px; margin-bottom: 10px; font-size: 12px; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.legend-swatch-purple { background: #9b59b6; }
.legend-swatch-blue { background: #007bff; }
.legend-swatch-green { background: #2ecc71; }
.chart-bars-container { display: flex; align-items: flex-end; gap: 20px; height: 200px; padding: 10px 5px 0 5px; }
.chart-month-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bars-group { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.chart-bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar-value { font-size: 10px; font-weight: bold; color: #2c3e50; margin-bottom: 3px; }
.chart-bar { width: 18px; border-radius: 3px 3px 0 0; }
.chart-bar-purple { background: #9b59b6; }
.chart-bar-blue { background: #007bff; }
.chart-bar-green { background: #2ecc71; }
.chart-month-label { font-size: 11px; margin-top: 6px; color: #7f8c8d; }

.card-highlight-blue { border: 2px solid #007bff; background: #f8f9fa; }
.text-primary { color: #007bff; }
.text-muted-5 { color: #555; }
.badge-stat-only { background: #e0e7ff; color: #3730a3; }
.ml-4 { margin-left: 4px; }
.card-plain { background: #fff; padding: 25px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.welcome-box { background: #fff; padding: 15px 25px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 20px; }
.box-warning-left { background: #fff8e6; border-left: 4px solid #f39c12; padding: 15px 20px; border-radius: 6px; margin-top: 15px; }
.text-warning { color: #e67e22; }
.text-success-3 { color: #2ecc71; }
.text-purple { color: #9b59b6; }
.card-dashed-blue { border: 1px dashed #2980b9; background: #fdfefe; }
.text-blue-2 { color: #2980b9; }
.text-green-2 { color: #27ae60; }
.card-warning-dashed { border: 2px dashed #e67e22; background: #fffdf9; }
.badge-impersonation { background: #6f42c1; color: #fff; }

/* --- Sidebar-Banner (Staging-Hinweis / Impersonation) --- */
.staging-banner, .impersonation-banner {
    text-align: center; padding: 8px 12px; font-size: 14px; color: #fff;
    position: fixed; top: 0; left: 0; right: 0; box-sizing: border-box;
}
.staging-banner { background: #e67e22; font-weight: bold; z-index: 1300; }
.impersonation-banner { background: #6f42c1; z-index: 1200; }
.impersonation-banner a { color: #fff; text-decoration: underline; font-weight: bold; }

.mandant-switcher { padding: 10px 0; border-bottom: 1px solid #4f5d73; margin-top: 15px; margin-bottom: 15px; }
.sidebar-label { display: block; font-size: 11px; color: #abd1c6; margin-bottom: 4px; }
.sidebar-select { width: 100%; padding: 6px; background: #34495e; color: #fff; border: 1px solid #4f5d73; border-radius: 4px; font-size: 13px; cursor: pointer; }
.sidebar-section-label { color: #7f8c8d; font-size: 12px; text-transform: uppercase; margin-top: 20px; margin-bottom: 5px; }
.logout-link { color: #e74c3c; margin-top: 30px; }
