* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #eef3f8 0%, #f7f9fc 100%);
    color: #1f2937;
}
a { color: #0f4c81; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #0f4c81 0%, #116ea1 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(15, 76, 129, .25);
}
.topnav { display:flex; gap:12px; align-items:center; }
.topnav a {
    color: #fff;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,.12);
}
.topnav a:hover { background: rgba(255,255,255,.2); }
.topnav .user-pill { padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.13); font-size: .84rem; }
.logout-form { margin: 0; }
.logout-form button { padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.15); box-shadow: none; }
.brand { display:flex; align-items:center; gap:14px; font-size:20px; font-weight:700; }
.brand img { display:block; max-width: 100%; }
.page { padding: 24px; }
.muted { opacity: .78; font-size: 12px; }
button, .btn, input[type=file]::file-selector-button {
    border: 0;
    background: linear-gradient(135deg, #0f4c81 0%, #116ea1 100%);
    color: #fff;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(17,110,161,.2);
}
button:hover, .btn:hover, input[type=file]::file-selector-button:hover { filter: brightness(1.04); }
input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5deea;
    border-radius: 12px;
    background: #fff;
}
label { display:block; font-weight:700; margin-bottom:6px; }
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(31,41,55,.08);
}
.data-table th {
    background: #edf5fb;
    color: #0f4c81;
    text-align: left;
    padding: 14px;
    font-size: 14px;
}
.data-table td {
    padding: 14px;
    border-top: 1px solid #edf2f7;
}
.note { margin-top: 8px; font-size: 13px; color: #64748b; }
.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0,1fr);
    gap: 24px;
    align-items: start;
}
.sidebar {
    position: sticky;
    top: 24px;
    background: #fff;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 14px 30px rgba(31,41,55,.08);
}
.sidebar h1 { margin: 0 0 6px 0; font-size: 28px; }
.sidebar .muted { display:block; margin-bottom: 20px; }
.sidebar-menu {
    display: grid;
    gap: 12px;
}
.sidebar-menu a {
    display: block;
    text-decoration: none;
    color: #1f2937;
    background: linear-gradient(180deg, #f8fbff 0%, #edf5fb 100%);
    border: 1px solid #d9e7f3;
    border-radius: 18px;
    padding: 14px 16px;
    font-weight: 700;
}
.sidebar-menu a small {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-weight: 400;
}
.content-stack {
    display: grid;
    gap: 24px;
}
.admin-group {
    display: grid;
    gap: 18px;
}
.group-title {
    margin: 0;
    font-size: 26px;
    color: #0f4c81;
}
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}
.card {
    background: #fff;
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 14px 30px rgba(31,41,55,.08);
    border: 1px solid #e7eef6;
}
.card.hero {
    background: linear-gradient(135deg, #ffffff 0%, #f2f8fc 100%);
}
.card h2 { margin-top: 0; margin-bottom: 16px; font-size: 24px; }
.card h3 { margin-top: 0; margin-bottom: 12px; font-size: 18px; color: #0f4c81; }
.card.danger {
    border: 1px solid #f4caca;
    background: linear-gradient(180deg, #fff 0%, #fff4f4 100%);
}
.form-row {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}
.toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.logo-preview {
    min-height: 84px;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    padding: 12px;
    border-radius: 18px;
    background: repeating-conic-gradient(#f4f7fa 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
    border: 1px solid #dbe5ef;
    margin-bottom: 16px;
}
.stat-grid {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.stat {
    background: linear-gradient(180deg, #f8fbff 0%, #edf5fb 100%);
    border-radius: 18px;
    padding: 16px;
    border: 1px solid #d9e7f3;
}
.stat strong { display:block; font-size:28px; color:#0f4c81; margin-bottom:4px; }
.section-anchor { scroll-margin-top: 30px; }
@media (max-width: 980px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}

/* Aktiver Sidebar-Link */
.sidebar-menu a.active {
    background: linear-gradient(135deg, #0f4c81 0%, #116ea1 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(15,76,129,.3);
}
.sidebar-menu a.active small { color: rgba(255,255,255,.75); }
.sidebar-menu a:hover:not(.active) {
    background: linear-gradient(180deg, #e2eeff 0%, #d5e8f7 100%);
    border-color: #a8c8e8;
}

/* Fahrtenbuch */
.triplog-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.triplog-filter {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.triplog-filter input, .triplog-filter select {
    padding: 8px 12px; border: 1px solid #d5deea; border-radius: 10px;
    background: #fff; font-size: .875rem; width: auto;
}
.badge-online  { background:#dcfce7; color:#15803d; padding:3px 10px; border-radius:99px; font-size:.75rem; font-weight:600; }
.badge-offline { background:#fef2f2; color:#dc2626; padding:3px 10px; border-radius:99px; font-size:.75rem; font-weight:600; }

/* Anmeldung und Benutzerverwaltung */
.auth-page { min-height: calc(100vh - 150px); display: grid; place-items: center; padding: 28px 12px; }
.auth-card { width: min(430px, 100%); background:#fff; border:1px solid #e2e8f0; border-radius:24px; padding:32px; box-shadow:0 24px 60px rgba(15,23,42,.14); }
.auth-card h1 { margin: 8px 0; color:#0f4c81; }
.auth-card > p { margin:0 0 24px; color:#64748b; }
.auth-icon { font-size:2.4rem; }
.form-group { margin-bottom:16px; }
.auth-check { display:flex; gap:9px; align-items:center; margin:4px 0 20px; font-weight:600; }
.auth-check input { width:auto; }
.auth-submit { width:100%; font-size:1rem; }
.validation-error { color:#b91c1c; font-size:.82rem; margin:6px 0; }
.validation-error:empty { display:none; }
.notice-success,.notice-error,.notice-info { padding:13px 16px; border-radius:12px; font-weight:650; }
.notice-success { background:#ecfdf5; color:#166534; border:1px solid #bbf7d0; }
.notice-error { background:#fef2f2; color:#991b1b; border:1px solid #fecaca; }
.notice-info { background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; margin-bottom:18px; }
.user-header { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.user-header h2 { margin:0; }
.user-subline { display:block; margin-top:4px; color:#64748b; }
.user-actions { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.user-actions form { margin:0; }
.btn-small,.btn-danger-small { border:0; border-radius:8px; padding:7px 10px; text-decoration:none; font-size:.78rem; font-weight:700; cursor:pointer; box-shadow:none; }
.btn-small { background:#e0f2fe; color:#075985; }
.btn-danger-small { background:#fee2e2; color:#991b1b; }
.btn-secondary { background:#e2e8f0; color:#334155; box-shadow:none; }
.form-card { width:min(680px, 100%); }
.table-scroll { overflow:auto; }
@media (max-width: 760px) {
    .topbar { align-items:flex-start; flex-direction:column; }
    .topnav { width:100%; flex-wrap:wrap; }
    .page { padding:14px; }
    .user-header { align-items:flex-start; flex-direction:column; }
}

/* Auftrags- und Packlistenmodul */
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5deea;
    border-radius: 12px;
    background: #fff;
    resize: vertical;
    font: inherit;
}
.order-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}
.order-page-header h2 { margin-bottom: 5px; }
.order-title { margin: 0; color: #475569; font-size: 1.05rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: #64748b; font-weight: 800; }
.order-filter { margin-top: 18px; }
.form-grow { grid-column: span 2; }
.order-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 18px;
}
.stat small { color: #64748b; display: block; margin-bottom: 7px; }
.stat .stat-text { font-size: 1.1rem; line-height: 1.25; }
.stat span { display: block; color: #64748b; font-size: .78rem; margin-top: 6px; }
.status-badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: .75rem; font-weight: 800; background: #e2e8f0; color: #334155; }
.status-neu { background: #dbeafe; color: #1d4ed8; }
.status-in-vorbereitung, .status-in-bearbeitung { background: #fef3c7; color: #92400e; }
.status-wartet-auf-container { background: #ffedd5; color: #9a3412; }
.status-versandbereit { background: #dcfce7; color: #166534; }
.status-abgeschlossen { background: #d1fae5; color: #065f46; }
.status-storniert { background: #fee2e2; color: #991b1b; }
.table-subline { display: block; margin-top: 4px; color: #64748b; font-size: .76rem; font-weight: 400; }
.empty-state { text-align: center; color: #64748b; padding: 20px; }
.description-box, .card-inset, .unassigned-box {
    margin-top: 14px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}
.order-shipping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 9px;
    margin-top: 14px;
    padding: 13px;
    border-radius: 14px;
    background: #f8fafc;
}
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.subform { background: #f8fafc; border: 1px solid #dbe6ef; border-radius: 16px; padding: 15px; margin: 14px 0 18px; }
.load-unit-grid { display: grid; gap: 16px; }
.load-unit-card { border: 1px solid #dbe6ef; border-radius: 18px; overflow: hidden; background: #fff; }
.load-unit-header { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 16px; background: linear-gradient(135deg,#f8fbff,#eaf3fb); }
.load-unit-header h4 { margin: 4px 0 2px; color: #0f4c81; font-size: 1.2rem; }
.load-unit-header p { margin: 0; color: #64748b; }
.unit-type { display: inline-block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #475569; }
.weight-block { text-align: right; min-width: 130px; }
.weight-block strong { display: block; font-size: 1.25rem; color: #0f4c81; }
.weight-block span { color: #64748b; font-size: .75rem; }
.load-unit-facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 8px; padding: 12px 16px; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; font-size: .85rem; }
.compact-table { padding: 0 12px 12px; }
.compact-table .data-table { box-shadow: none; border: 1px solid #edf2f7; border-radius: 12px; }
.compact-table .data-table th, .compact-table .data-table td { padding: 9px; font-size: .82rem; }
.move-form { display: flex; gap: 6px; align-items: center; min-width: 240px; }
.move-form select { min-width: 130px; padding: 7px; }
.move-form button { white-space: nowrap; }
.unassigned-box h4 { margin-top: 0; }
.unassigned-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 9px 0; border-top: 1px solid #e2e8f0; }
.unassigned-row:first-of-type { border-top: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); gap: 12px; margin-top: 16px; }
.photo-card { display: block; text-decoration: none; color: #1f2937; border: 1px solid #dbe6ef; border-radius: 14px; overflow: hidden; background: #fff; }
.photo-card img { display: block; width: 100%; height: 170px; object-fit: cover; background: #e2e8f0; }
.photo-card span, .photo-card small { display: block; padding: 8px 10px 0; }
.photo-card small { padding-top: 3px; padding-bottom: 9px; color: #64748b; }
.document-list { display: grid; gap: 8px; margin-top: 14px; }
.document-list a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid #dbe6ef; border-radius: 12px; text-decoration: none; background: #f8fafc; }
.document-list a > span { font-size: 1.4rem; }
.document-list strong, .document-list small { display: block; }
.document-list small { margin-top: 3px; color: #64748b; }
.history-list { display: grid; gap: 0; }
.history-entry { display: grid; grid-template-columns: 18px 1fr; gap: 10px; position: relative; padding: 0 0 17px; }
.history-entry::before { content: ""; position: absolute; left: 5px; top: 12px; bottom: 0; width: 2px; background: #dbe6ef; }
.history-entry:last-child::before { display: none; }
.history-dot { width: 12px; height: 12px; border-radius: 50%; background: #116ea1; margin-top: 4px; z-index: 1; }
.history-entry span { display: block; color: #64748b; font-size: .75rem; margin-top: 3px; }
.history-entry p { margin: 5px 0 0; color: #475569; }
.customer-create-form { margin-top: 16px; padding: 15px; background: #f8fafc; border: 1px solid #dbe6ef; border-radius: 16px; }
@media (max-width: 760px) {
    .form-grow { grid-column: span 1; }
    .load-unit-header, .unassigned-row { align-items: flex-start; flex-direction: column; }
    .weight-block { text-align: left; }
    .move-form { min-width: 0; width: 100%; flex-wrap: wrap; }
}

/* Auftragskalkulation und Drag-and-drop-Organisation */
.internal-pricing-card { border-left: 5px solid #7c3aed; }
.pricing-summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:10px; margin:12px 0; }
.positive-value { color:#047857 !important; }
.negative-value { color:#b91c1c !important; }
.inline-check { display:flex; align-items:center; gap:8px; padding-top:24px; }
.inline-check input { width:auto; }
.loadunit-board-card { overflow:visible; min-width:0; }
.board-toolbar { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:12px; }
.loadunit-board { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch; gap:14px; overflow-x:hidden; padding:4px; min-height:430px; min-width:0; }
.loadunit-column { min-width:0; width:100%; height:100%; display:flex; flex-direction:column; background:var(--unit-bg,#f8fafc); border:1px solid #cbd5e1; border-radius:14px; overflow:hidden; box-shadow:0 4px 14px rgba(15,23,42,.06); }
.loadunit-column.dragging-unit { opacity:.5; outline:3px dashed #2563eb; }
.loadunit-column > header { display:flex; gap:8px; align-items:center; min-height:66px; padding:10px 12px; background:var(--unit-bg,#eaf2f8); border-bottom:1px solid #cbd5e1; }
.unit-drag-handle { font-size:1.5rem; color:#64748b; cursor:grab; user-select:none; }
.unit-heading { flex:1; min-width:0; }
.unit-heading strong,.unit-heading span { display:block; }
.unit-heading strong { color:#0f4c81; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.unit-heading span { color:#64748b; font-size:.78rem; margin-top:2px; }
.unit-order-buttons { display:flex; gap:3px; }
.unit-order-buttons button { border:1px solid #cbd5e1; background:#fff; color:#334155; padding:5px 7px; border-radius:7px; cursor:pointer; }
.package-dropzone { flex:1 1 auto; min-height:170px; padding:10px; display:grid; align-content:start; gap:8px; transition:.15s ease; min-width:0; }
.package-dropzone.drop-active { background:#dbeafe; outline:2px dashed #2563eb; outline-offset:-5px; }
.package-drag-card { min-width:0; background:var(--package-bg,#fff); border:1px solid #dbe6ef; border-radius:10px; padding:9px 10px; cursor:grab; box-shadow:0 2px 7px rgba(15,23,42,.05); }
.package-drag-card.dragging { opacity:.45; }
.package-drag-card p { margin:5px 0; font-size:.86rem; }
.package-drag-card small { display:block; color:#64748b; }
.package-drag-title { display:flex; gap:7px; align-items:center; }
.package-drag-title span { color:#94a3b8; }
.price-line { color:#6d28d9 !important; margin-top:4px; font-weight:600; }
.drop-placeholder { color:#94a3b8; text-align:center; border:1px dashed #cbd5e1; border-radius:9px; padding:18px 8px; }
.unassigned-column { border-color:#f59e0b; }
.unassigned-column > header { background:#fff7ed; }
.unit-edit-panel { border-top:1px solid #dbe6ef; background:#fff; padding:0 10px 10px; }
.unit-edit-panel summary { cursor:pointer; color:#0f4c81; font-weight:700; padding:10px 0; }
.compact-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.compact-form-grid label { display:grid; gap:3px; font-size:.75rem; color:#475569; }
.compact-form-grid input,.compact-form-grid select,.compact-form-grid textarea { width:100%; padding:7px; border:1px solid #cbd5e1; border-radius:7px; }
.compact-form-grid .wide { grid-column:1 / -1; }
@media (max-width:760px) { .loadunit-board { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:520px) {
    .board-toolbar { align-items:flex-start; flex-direction:column; }
    .loadunit-board { grid-template-columns:1fr; }
    .pricing-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

.package-touch-move { display:flex; gap:6px; align-items:center; margin-top:8px; }
.package-touch-move select { min-width:0; flex:1 1 auto; padding:6px 7px; font-size:.78rem; }
.package-touch-move button { flex:0 0 auto; padding:6px 8px; font-size:.75rem; }
@media (hover:hover) and (pointer:fine) {
  .package-touch-move { opacity:.55; transition:opacity .15s ease; }
  .package-drag-card:hover .package-touch-move { opacity:1; }
}

/* Auftragsbearbeitung: festgeschriebene Felder klar erkennbar */
.readonly-field,
input[readonly].readonly-field {
    background: #eef1f5;
    color: #4b5563;
    cursor: not-allowed;
    border-style: dashed;
}

/* 1.17.0 – Schnellerfassung, Seitenleiste, Vorschauen und Live-Suche */
.quick-capture-bar {
    display: grid;
    grid-template-columns: auto minmax(150px, 220px) auto auto minmax(220px, 1fr);
    gap: 10px;
    align-items: center;
    margin-top: 16px;
    padding: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8fbff, #eef6fc);
}
.quick-capture-bar select { min-width: 0; }
.organizer-hero { position: relative; }
.entity-edit-button {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f4c81;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    box-shadow: none;
    flex: 0 0 auto;
}
.entity-edit-button:hover { background: #dbeafe; border-color: #93c5fd; }
.unit-summary-line {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 9px 11px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    font-size: .76rem;
}
.unit-note {
    margin: 0;
    padding: 9px 12px;
    background: #fffdf5;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    font-size: .84rem;
}
.unit-label { font-weight: 600; color: #475569 !important; }
.entity-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(15, 23, 42, .36);
    backdrop-filter: blur(4px);
}
.entity-drawer {
    position: fixed;
    z-index: 1100;
    top: 0;
    right: 0;
    width: min(560px, 96vw);
    height: 100dvh;
    padding: 20px;
    overflow-y: auto;
    background: #fff;
    box-shadow: -20px 0 55px rgba(15, 23, 42, .2);
    transform: translateX(105%);
    transition: transform .22s ease;
}
.entity-drawer.open { transform: translateX(0); }
.entity-drawer-header {
    position: sticky;
    top: -20px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin: -20px -20px 18px;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
}
.entity-drawer-header h3 { margin: 2px 0 0; }
.drawer-close, .file-preview-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #e2e8f0;
    color: #1e293b;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    display: inline-grid;
    place-items: center;
    padding: 0;
    text-align: center;
}
.drawer-form, .drawer-form [data-editor] { display: grid; gap: 12px; }
.drawer-form label { display: grid; gap: 5px; color: #475569; font-size: .82rem; font-weight: 700; }
.drawer-grid-2, .drawer-grid-3 { display: grid; gap: 10px; }
.drawer-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drawer-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.drawer-save { position: sticky; bottom: 10px; width: 100%; margin-top: 4px; }
.drawer-photo-section { margin-top: 24px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
.drawer-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 10px 0; }
.drawer-photo-card { padding: 0; overflow: hidden; border: 1px solid #dbe6ef; border-radius: 11px; background: #fff; color: #334155; box-shadow: none; text-align: left; }
.drawer-photo-card img { display: block; width: 100%; height: 120px; object-fit: cover; }
.drawer-photo-card span { display: block; padding: 7px 8px; font-size: .76rem; }
.drawer-photo-section form { display: grid; gap: 9px; }

/* Modale Dateivorschau */
html.preview-open { overflow: hidden; }
.file-preview-modal { position: fixed; inset: 0; z-index: 2000; }
.file-preview-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.48); backdrop-filter: blur(7px); }
.file-preview-dialog {
    position: relative;
    width: min(1120px, calc(100vw - 40px));
    height: min(88vh, 900px);
    margin: 6vh auto;
    display: grid;
    grid-template-rows: auto minmax(0,1fr) auto;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 32px 90px rgba(0,0,0,.34);
}
.file-preview-dialog > header, .file-preview-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.file-preview-dialog > header { border-bottom: 1px solid #e2e8f0; }
.file-preview-dialog > footer { justify-content: flex-end; border-top: 1px solid #e2e8f0; }
.file-preview-dialog h3 { margin: 2px 0 0; }
.file-preview-body { min-height: 0; display: grid; place-items: center; overflow: auto; background: #eef2f6; }
.file-preview-image { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.file-preview-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.file-preview-generic { max-width: 460px; padding: 32px; text-align: center; color: #475569; }
.file-preview-generic span { display: block; font-size: 4rem; margin-bottom: 10px; }
.photo-card, .document-card { font: inherit; text-align: left; cursor: pointer; }
.photo-card { width: 100%; padding: 0; box-shadow: none; }
.document-card { width: 100%; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid #dbe6ef; border-radius: 12px; background: #f8fafc; color: #1f2937; box-shadow: none; }
.document-card > span { font-size: 1.4rem; }
.document-card strong, .document-card small { display: block; }
.document-card small { margin-top: 3px; color: #64748b; }

/* Vorschau vor einem Upload */
.upload-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: -6px 0 18px; }
.upload-preview-card { display: grid; grid-template-columns: 64px minmax(0,1fr); align-items: center; gap: 9px; min-width: 0; padding: 8px; border: 1px solid #dbe6ef; border-radius: 12px; background: #fff; }
.upload-preview-media { width: 64px; height: 52px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: #e2e8f0; color: #475569; font-size: .7rem; font-weight: 800; }
.upload-preview-media.pdf { background: #fee2e2; color: #991b1b; }
.upload-preview-media img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-card strong, .upload-preview-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-preview-card small { margin-top: 4px; color: #64748b; }
.compact-upload-preview { grid-template-columns: 1fr; margin: 0; }

/* Auftragssuche und Verlauf */
.live-order-filter { align-items: end; }
.live-order-filter input[type="search"] { width: 100%; }
tr[hidden], .history-entry[hidden] { display: none !important; }
.history-heading { align-items: end; }
.history-search-label { width: min(360px, 100%); display: grid; gap: 5px; font-size: .8rem; color: #475569; font-weight: 700; }
.history-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 12px; }
.history-pager span { min-width: 180px; text-align: center; color: #475569; font-weight: 700; }
.history-pager button:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 980px) {
    .quick-capture-bar { grid-template-columns: 1fr 1fr; }
    .quick-capture-bar > strong, .quick-capture-bar > .note { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .quick-capture-bar { grid-template-columns: 1fr; }
    .quick-capture-bar > * { grid-column: 1 !important; width: 100%; }
    .drawer-grid-2, .drawer-grid-3 { grid-template-columns: 1fr; }
    .unit-summary-line { grid-template-columns: 1fr; }
    .entity-drawer { width: 100vw; }
    .file-preview-dialog { width: calc(100vw - 16px); height: 94vh; margin: 3vh 8px; }
    .file-preview-dialog > footer { flex-wrap: wrap; }
    .history-heading { align-items: stretch; flex-direction: column; }
}


/* 6.8.1 – Packstück-/Ladeeinheiteneditor, Farbkatalog und Fotobearbeitung */
.editor-section[hidden] { display:none !important; }
.editor-section:not([hidden]) { display:grid; gap:12px; }
.unassigned-zone-card { margin-bottom:14px; border:1px solid #f59e0b; border-radius:14px; overflow:hidden; background:#fffaf0; }
.unassigned-zone-card > header { padding:11px 14px; background:#fff3d6; border-bottom:1px solid #f5d69a; }
.unassigned-zone-card > header strong,.unassigned-zone-card > header span { display:block; }
.unassigned-dropzone { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); min-height:90px; }
.unit-summary-line { grid-template-columns:repeat(2,minmax(0,1fr)); }
.package-weight-total { grid-column:1/-1; padding-top:4px; border-top:1px dashed rgba(71,85,105,.25); }
.package-weight-total em { font-style:normal; font-weight:800; color:#0f4c81; }
.drawer-action-row { position:sticky; bottom:10px; z-index:2; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding-top:6px; background:#fff; }
.drawer-action-row .drawer-save { position:static; margin:0; }
.btn-danger { border:1px solid #dc2626; background:#fff; color:#b91c1c; border-radius:8px; padding:9px 14px; font-weight:700; cursor:pointer; }
.btn-danger:hover { background:#fee2e2; }
.drawer-photo-card { display:grid; grid-template-columns:92px minmax(0,1fr); gap:8px; padding:8px; }
.drawer-photo-card.assigned-here { outline:2px solid #16a34a; background:#f0fdf4; }
.drawer-photo-preview { width:92px; height:76px; padding:0; border:0; border-radius:8px; overflow:hidden; box-shadow:none; background:#e2e8f0; }
.drawer-photo-preview img { width:100%; height:100%; object-fit:cover; }
.drawer-photo-info { min-width:0; }
.drawer-photo-info strong,.drawer-photo-info small { display:block; overflow:hidden; text-overflow:ellipsis; }
.drawer-photo-info small { color:#64748b; margin-top:4px; }
.drawer-photo-actions { grid-column:1/-1; display:flex; gap:6px; }
.drawer-photo-actions button { padding:6px 8px; font-size:.72rem; }
.photo-unassign-button { border:1px solid #cbd5e1; background:#fff; color:#475569; }
.photo-unassign-button:disabled,.photo-assign-button:disabled { opacity:.55; cursor:default; }
.history-thumbnail { margin-top:8px; width:120px; height:78px; object-fit:cover; border-radius:8px; border:1px solid #dbe6ef; }
.photo-assignment-badge { display:inline-flex; margin-top:5px; padding:3px 7px; border-radius:999px; background:#e2e8f0; color:#334155; font-size:.72rem; font-weight:700; }

/* Erweiterte Bildvorschau mit Zeichenfläche */
.file-preview-dialog.editable-image-dialog { grid-template-rows:auto minmax(0,1fr) auto auto; }
.file-preview-canvas-wrap { position:relative; width:100%; height:100%; min-height:300px; display:grid; place-items:center; overflow:auto; background:#dfe5eb; touch-action:none; }
.file-preview-canvas { max-width:100%; max-height:100%; background:#fff; box-shadow:0 5px 22px rgba(15,23,42,.18); touch-action:none; }
.file-preview-editor { display:grid; grid-template-columns:auto auto minmax(180px,1fr) auto auto; gap:8px; align-items:center; padding:10px 18px; border-top:1px solid #e2e8f0; background:#fff; }
.file-preview-editor input[type=color] { width:42px; height:38px; padding:2px; }
.file-preview-editor input[type=range] { width:100px; }
.file-preview-editor input[type=text] { width:100%; }
.file-preview-delete { border-color:#dc2626 !important; color:#b91c1c !important; }
@media(max-width:980px){ .unassigned-dropzone{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media(max-width:640px){ .unassigned-dropzone{grid-template-columns:1fr;} .file-preview-editor{grid-template-columns:1fr 1fr;} .file-preview-editor input[type=text]{grid-column:1/-1;} }

/* 6.8.1 Abschlusskorrekturen: keine horizontale Seitenverschiebung */
.organizer-hero,
.loadunit-board-card,
.loadunit-board-card .loadunit-board,
.admin-shell > .content-stack { min-width: 0; max-width: 100%; }
.loadunit-board-card { overflow-x: clip; }


/* 6.8.1 – Farben auch in der normalen Auftragsakte */
.load-unit-card { background: var(--unit-bg, #fff); }
.load-unit-card .load-unit-header { background: var(--unit-bg, #eaf2f8); }
.package-table-row > td { background: var(--package-bg, #fff); }
.unassigned-row { background: var(--package-bg, #fff); }

/* Exakt geometrisch zentrierte Schließen-Symbole – unabhängig von der Schriftmetrik */
.drawer-close,
.file-preview-close,
.remove-loadunit-type {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0 !important;
    line-height: 0 !important;
    padding: 0;
}
.drawer-close::before,
.drawer-close::after,
.file-preview-close::before,
.file-preview-close::after,
.remove-loadunit-type::before,
.remove-loadunit-type::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 15px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
}
.drawer-close::before,
.file-preview-close::before,
.remove-loadunit-type::before { transform: translate(-50%, -50%) rotate(45deg); }
.drawer-close::after,
.file-preview-close::after,
.remove-loadunit-type::after { transform: translate(-50%, -50%) rotate(-45deg); }
.organizer-hero { overflow-x: hidden; }
.quick-capture-bar { min-width: 0; max-width: 100%; }
.loadunit-board > *, .unassigned-dropzone > * { min-width: 0; }

/* 6.8.2 – Bildzoom in der Auftragsvorschau */
.file-preview-header-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; }
.file-preview-zoom { display:inline-flex; align-items:center; gap:6px; padding:4px 6px; border:1px solid #dbe6ef; border-radius:10px; background:#f8fafc; }
.file-preview-zoom[hidden] { display:none !important; }
.file-preview-zoom button { min-width:34px; height:32px; padding:0 9px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; color:#0f4c81; font:inherit; font-weight:800; cursor:pointer; box-shadow:none; }
.file-preview-zoom span { min-width:58px; text-align:center; color:#334155; font-size:.8rem; font-weight:800; }
.zoomable-preview-image { flex:none; object-fit:contain; }
.file-preview-canvas-wrap { place-items:start; align-content:start; justify-content:start; padding:14px; box-sizing:border-box; }
@media (max-width: 700px) {
    .file-preview-dialog > header { align-items:flex-start; }
    .file-preview-header-actions { align-items:flex-end; flex-direction:column-reverse; }
    .file-preview-zoom { flex-wrap:wrap; justify-content:flex-end; }
}

/* 6.8.3 – Responsive Ladeeinheitenarten aus Razor-Datei ausgelagert */
@media (max-width: 760px) {
    .loadunit-type-row {
        grid-template-columns: 1fr 1fr;
    }

    .remove-loadunit-type {
        align-self: end;
    }
}

/* 6.9.0 – Auftragsfunktionen, rechtsbündige Aktionen und sichtbare Farbflächen */
.order-header-actions {
    margin-left: auto;
    justify-content: flex-end;
    align-items: flex-start;
}
.order-functions-menu { position: relative; }
.order-functions-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.order-functions-menu > summary::-webkit-details-marker { display: none; }
.order-functions-menu[open] > summary { background: #0b3b66; }
.order-functions-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 7px);
    right: 0;
    width: min(420px, calc(100vw - 32px));
    max-height: min(72vh, 650px);
    overflow: auto;
    padding: 12px;
    display: grid;
    gap: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 50px #0f172a36;
}
.order-functions-panel section {
    display: grid;
    gap: 3px;
    padding: 9px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}
.order-functions-panel section > strong { color: #0f4c81; margin-bottom: 4px; }
.order-functions-panel a {
    display: block;
    padding: 7px 9px;
    border-radius: 7px;
    color: #334155;
    text-decoration: none;
}
.order-functions-panel a:hover { background: #dbeafe; color: #0f4c81; }
.order-functions-panel > small { color: #64748b; line-height: 1.35; }
.loadunit-type-row {
    background: color-mix(in srgb, var(--loadunit-preview-color, #64748b) 12%, white) !important;
    border-color: color-mix(in srgb, var(--loadunit-preview-color, #64748b) 28%, #dbe6ef) !important;
    transition: background-color .15s ease, border-color .15s ease;
}
.loadunit-type-row input[type="color"],
.loadunit-type-actions input[type="color"] {
    width: 100%;
    min-width: 78px;
    height: 38px;
    padding: 2px;
    border-radius: 8px;
    background: transparent;
}
.loadunit-package-color-preview {
    padding: 8px 10px;
    border: 1px solid #dbe6ef;
    border-radius: 10px;
    background: color-mix(in srgb, var(--package-preview-color, #f59e0b) 12%, white);
}
.file-preview-editor label:has(#previewDrawWidth) { min-width: 145px; }
#previewDrawWidthValue { display:inline-block; min-width:42px; margin-left:5px; color:#475569; font-size:.75rem; font-weight:800; }
@media (max-width: 900px) {
    .order-header-actions { width: 100%; }
    .order-functions-panel { position: fixed; top: 76px; right: 16px; left: 16px; width: auto; }
}

/* 6.9.2 – eigenständige Auftragsfunktionen */
.function-category-grid,.function-action-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}.function-category-card,.function-action-card{display:flex;align-items:center;gap:15px;width:100%;box-sizing:border-box;padding:20px;border:1px solid #d8e2eb;border-radius:16px;background:#fff;color:#0f172a;text-align:left;text-decoration:none;box-shadow:0 5px 18px rgba(15,23,42,.06);cursor:pointer}.function-category-card:hover,.function-action-card:hover{border-color:#0b6aa2;box-shadow:0 9px 25px rgba(15,23,42,.11);transform:translateY(-1px)}.function-category-card>span,.function-action-card>span{display:grid;place-items:center;min-width:52px;height:52px;border-radius:13px;background:#e8f2f8;font-size:1.5rem;font-weight:900}.function-category-card>div,.function-action-card>div{min-width:0;flex:1}.function-category-card h3,.function-action-card h3{margin:0 0 5px}.function-category-card p,.function-action-card p{margin:0;color:#64748b;line-height:1.45}.function-category-card>b{font-size:2rem;color:#0b6aa2}.function-action-card{font:inherit}.file-preview-dialog [hidden]{display:none!important}

/* 6.9.3 – Ladeeinheiten: drei Spalten, danach neue Zeile; Drag-and-drop-Zielfix in View */


/* 6.9.4 - robuste Funktionskacheln und PDF-Gestaltungsansicht */
.function-action-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,310px),1fr));align-items:stretch}
.function-action-card{min-width:0;min-height:190px;align-items:center;overflow:hidden}
.function-action-card>div{overflow:hidden}
.function-action-card h3{overflow-wrap:anywhere;word-break:normal;line-height:1.15}
.function-action-card p{overflow-wrap:anywhere}
.pdf-branding-preview{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px;margin:12px 0 16px;border:1px solid #d8e2eb;border-radius:12px;background:#f8fafc}
.pdf-branding-preview>div{display:flex;flex-direction:column;gap:6px;min-width:0}
.pdf-branding-preview strong,.pdf-branding-preview small{overflow-wrap:anywhere}
.pdf-branding-preview img{display:block;max-width:150px;max-height:58px;object-fit:contain;flex:none}
@media(max-width:760px){.pdf-branding-preview{align-items:flex-start;flex-direction:column}.function-action-card{min-height:0}}
