:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #d1d5db;
    --line-dark: #374151;
    --header: #111827;
    --header-text: #f9fafb;
    --link: #2563eb;
    --link-hover: #1d4ed8;
    --success: #166534;
    --danger: #b91c1c;
    --warning: #92400e;
    --shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
    --radius: 14px;
    --shell: 1280px;
}

* {
    box-sizing: border-box;
    min-width: 0;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-x: hidden;
}

body.app-body {
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.app-header,
.app-main,
.app-footer {
    width: 100%;
}

.app-shell {
    width: min(var(--shell), calc(100% - 32px));
    margin: 0 auto;
}

.app-header {
    background: var(--header);
    color: var(--header-text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
    padding: 0;
}

.app-brand {
    flex: 0 0 auto;
}

.app-brand a {
    color: var(--header-text);
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
}

.app-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.app-nav a {
    color: rgba(255, 255, 255, 0.88);
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
}

.app-nav a:hover,
.app-nav a.is-active {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
}

.app-userbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.app-logout {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
}

.app-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.app-main {
    padding: 24px 0 40px;
    flex: 1 0 auto;
}

.app-footer {
    border-top: 1px solid var(--line);
    background: #eef2f7;
    color: var(--muted);
    font-size: 14px;
    margin-top: auto;
    flex-shrink: 0;
}

.app-footer-inner {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-footer-right {
    text-align: right;
}

.app-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    width: 100%;
}

.app-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.app-page-header-compact {
    margin-bottom: 12px;
}

.app-page-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
}

.app-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.app-toolbar-no-margin {
    margin-bottom: 0;
}

.app-btn,
button,
input[type="submit"] {
    appearance: none;
    border: 1px solid var(--line-dark);
    background: var(--header);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.app-btn:hover,
button:hover,
input[type="submit"]:hover {
    opacity: 0.94;
    text-decoration: none;
}

.app-btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.app-btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.app-grid {
    display: grid;
    gap: 18px;
}

.app-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}


.app-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-mb-18 {
    margin-bottom: 18px;
}

.app-section-title {
    margin: 0 0 12px;
    font-size: 18px;
}

.app-form-row {
    margin-bottom: 12px;
}

.app-form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.app-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.app-note {
    color: var(--muted);
    font-size: 14px;
}

.app-alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid;
}

.app-alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.app-alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: var(--success);
}

.app-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.app-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 10px;
    white-space: nowrap;
}

table.app-table th,
table.app-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

table.app-table th {
    background: var(--surface-alt);
    font-size: 14px;
}

table.app-table tr:last-child td {
    border-bottom: 0;
}

.app-table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.app-table-actions form {
    margin: 0;
}

.app-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    background: #e5e7eb;
    color: #111827;
}

.app-status-draft {
    background: #e5e7eb;
    color: #111827;
}

.app-status-open {
    background: #dbeafe;
    color: #1d4ed8;
}

.app-status-active {
    background: #fef3c7;
    color: #92400e;
}

.app-status-delivered {
    background: #dcfce7;
    color: #166534;
}

.app-status-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.app-mt-18 {
    margin-top: 18px;
}

.app-login-shell {
    max-width: 520px;
    margin: 0 auto;
}

/* Aufklappbare Bereiche */
.app-card details {
    display: block;
}

.app-card details > summary {
    position: relative;
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding-right: 34px !important;
}

.app-card details > summary::-webkit-details-marker {
    display: none;
}

.app-card details > summary::after {
    content: "▸";
    position: absolute;
    right: 0;
    top: 0;
    font-size: 18px;
    line-height: 1.2;
    color: var(--muted);
    transition: transform 0.18s ease;
}

.app-card details[open] > summary::after {
    transform: rotate(90deg);
}

.app-card details > summary:hover::after {
    color: var(--text);
}

.app-card details > div {
    border-top: 1px solid rgba(209, 213, 219, 0.55);
    margin-top: 12px;
    padding-top: 12px;
}

@media (max-width: 960px) {
    .app-shell {
        width: calc(100% - 20px);
    }

    .app-grid-2,
    .app-grid-3 {
        grid-template-columns: 1fr;
    }

    .app-header-inner,
    .app-footer-inner {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 12px 0;
    }

    .app-brand {
        width: 100%;
    }

    .app-nav {
        width: 100%;
        gap: 8px;
    }

    .app-nav a {
        flex: 0 1 auto;
    }

    .app-userbar {
        width: 100%;
        justify-content: flex-start;
    }

    .app-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-page-title {
        font-size: 24px;
    }

    .app-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .app-btn,
    button,
    input[type="submit"] {
        width: 100%;
        text-align: center;
    }

    .app-inline-check {
        display: flex;
        align-items: flex-start;
    }

    .app-footer-right {
        text-align: left;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: calc(100% - 16px);
    }

    .app-main {
        padding: 16px 0 24px;
    }

    .app-card {
        padding: 14px;
        border-radius: 12px;
    }

    .app-page-title {
        font-size: 22px;
    }

    .app-section-title {
        font-size: 17px;
    }

    .app-footer-inner {
        min-height: auto;
        gap: 8px;
    }
}


.app-table-actions-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.app-inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.app-inline-form-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}


.app-mt-8 {
    margin-top: 8px;
}

.app-proof-card {
    border: 1px dashed var(--line-dark);
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
}

.app-proof-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.app-proof-list {
    display: grid;
    gap: 6px;
}

.app-proof-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.app-proof-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.app-dashboard-tile .app-note {
    min-height: 44px;
}

.app-priority-card {
    border: 2px solid rgba(17, 24, 39, 0.10);
}

.app-priority-kicker {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.app-priority-title {
    font-size: 22px;
    margin-bottom: 6px;
}

.app-form-block {
    width: 100%;
}

.app-file-trigger {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.app-toolbar-tabs {
    gap: 8px;
}

.app-toolbar-tabs a {
    min-width: 110px;
    text-align: center;
}

.app-table-responsive-cards td {
    white-space: normal;
}

@media (max-width: 960px) {
    .app-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-grid-4 {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .app-dashboard-tile {
        padding: 12px;
    }

    .app-dashboard-tile .app-page-title {
        font-size: 18px;
    }

    .app-dashboard-tile .app-note {
        font-size: 13px;
        min-height: 0;
    }

    .app-toolbar-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .app-toolbar-tabs a {
        min-width: 0;
    }

    .app-table-responsive-cards thead {
        display: none;
    }

    .app-table-responsive-cards,
    .app-table-responsive-cards tbody,
    .app-table-responsive-cards tr,
    .app-table-responsive-cards td {
        display: block;
        width: 100%;
    }

    .app-table-responsive-cards tr {
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
        margin-bottom: 12px;
        overflow: hidden;
    }

    .app-table-responsive-cards td {
        border-bottom: 1px solid var(--line);
        padding: 12px;
    }

    .app-table-responsive-cards td:last-child {
        border-bottom: 0;
    }

    .app-table-responsive-cards td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: var(--muted);
        margin-bottom: 6px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .app-table-responsive-cards td[colspan]::before {
        display: none;
    }

    .app-proof-card,
    .app-priority-card {
        padding: 12px;
    }
}

@media (max-width: 420px) {
    .app-grid-4 {
        grid-template-columns: 1fr;
    }
}

.app-tracking-list {
    display: grid;
    gap: 12px;
}

.app-tracking-item {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-alt);
}

.app-tracking-time {
    font-weight: 700;
}

.app-tracking-title {
    font-weight: 700;
    margin-bottom: 4px;
}

@media (max-width: 760px) {
    .app-tracking-item {
        grid-template-columns: 1fr;
    }
}


.app-hidden { display:none !important; }
.app-card-flat { box-shadow:none; border-style:dashed; background:var(--surface-alt); }
.app-legal-card p, .app-legal-card li { max-width: 78ch; }
.app-legal-list { margin:0; padding-left:18px; }
.app-priority-kicker { font-size:12px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin-bottom:6px; }
.app-priority-card { border-width:2px; }
.app-priority-title { font-size:24px; margin-bottom:6px; }
.app-order-list { display:grid; gap:12px; }
.app-order-accordion { border:1px solid var(--line); border-radius:12px; background:#fff; overflow:hidden; }
.app-order-summary { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; cursor:pointer; list-style:none; }
.app-order-summary::-webkit-details-marker { display:none; }
.app-order-summary-title { font-size:18px; font-weight:700; }
.app-order-body { border-top:1px solid var(--line); padding:16px; }
.app-proof-card { border:1px solid var(--line); border-radius:12px; background:var(--surface-alt); padding:14px; }
.app-proof-title { font-size:15px; font-weight:700; margin-bottom:8px; }
.app-file-trigger { position:relative; overflow:hidden; }
.app-file-input { position:absolute; inset:0; opacity:0; cursor:pointer; }
.app-proof-list { display:grid; gap:10px; }
.app-proof-item { display:flex; flex-direction:column; gap:2px; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.app-inline-form-stack, .app-table-actions-stack { display:grid; gap:10px; }
.app-form-block { width:100%; }
.app-input { width:100%; }
@media (max-width: 960px) {
  .app-nav { overflow-x:auto; flex-wrap:nowrap; padding-bottom:4px; -webkit-overflow-scrolling:touch; }
  .app-nav a { flex:0 0 auto; }
  .app-priority-title, .app-order-summary-title { font-size:17px; }
  .app-order-summary { align-items:flex-start; flex-direction:column; }
  .app-grid-4 { grid-template-columns:1fr; }
}


.app-footer-links { display:flex; gap:12px; flex-wrap:wrap; justify-content:flex-end; }
.app-honeypot { position:absolute !important; left:-9999px !important; width:1px; height:1px; overflow:hidden; }
.app-proof-big { font-size:30px; font-weight:800; margin-top:4px; }
.app-proof-item { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:10px 0; border-top:1px solid var(--line); }
.app-proof-item:first-of-type { border-top:0; }
.app-proof-item strong { display:block; }
@media (max-width: 820px) {
  .app-grid-3 { grid-template-columns: 1fr; }
  .app-proof-item { align-items:flex-start; flex-direction:column; }
  .app-footer-links { justify-content:flex-start; }
}


.app-proof-item > div { min-width: 0; }
.app-proof-name {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-proof-item .app-btn { flex: 0 0 auto; }
.app-alert-success {
  background: rgba(22, 163, 74, 0.10);
  color: #166534;
  border: 1px solid rgba(22, 163, 74, 0.25);
}
@media (max-width: 820px) {
  .app-proof-name { white-space: normal; overflow: visible; text-overflow: initial; }
}

.app-archive-summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-summary-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  padding: 14px;
}

.app-summary-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.app-summary-value {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
  margin-bottom: 4px;
}

.app-summary-subline {
  color: var(--muted);
  margin-top: 2px;
}

.app-archive-sections {
  display: grid;
  gap: 18px;
}

.app-archive-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.app-timeline {
  display: grid;
  gap: 14px;
}

.app-timeline-item {
  position: relative;
  padding: 14px 14px 14px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid #cbd5e1;
  border-radius: 12px;
  background: var(--surface-alt);
}

.app-timeline-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 6px;
}

.app-timeline-time {
  font-weight: 700;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.app-badge-public {
  background: #dcfce7;
  color: #166534;
}

.app-badge-internal {
  background: #e0e7ff;
  color: #3730a3;
}

.app-timeline-title {
  margin: 0 0 8px;
  font-size: 17px;
}

.app-timeline-details {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  color: var(--text);
}

.app-note-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 2px;
}

.app-timeline-note {
  margin-top: 10px;
  color: var(--muted);
}

.app-proof-groups-grid {
  align-items: start;
}

.app-proof-stack {
  display: grid;
  gap: 10px;
}

.app-proof-item-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.app-proof-item-card .app-btn {
  align-self: flex-start;
}

.app-download-grid {
  display: grid;
  gap: 14px;
}
.app-download-button-bar {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:12px;
}

.app-download-fileline {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  margin-bottom:14px;
  color: var(--text);
}

.app-download-groups {
  display:grid;
  gap:14px;
}


.app-download-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.app-download-row-compact {
  padding: 10px 12px;
}

.app-download-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.app-download-name {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.app-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}


@media (max-width: 900px) {
  .app-archive-summary-grid,
  .app-timeline-details {
    grid-template-columns: 1fr;
  }

  .app-download-row {
    flex-direction: column;
  }

  .app-download-actions {
    justify-content: flex-start;
  }

  .app-download-button-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .app-download-fileline {
    flex-direction: column;
    align-items: flex-start;
  }

}


.app-order-show-section {
  padding: 16px;
}

.app-overview-facts {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-fact-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  padding: 12px 14px;
}

.app-fact-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.app-fact-value {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 800;
}

.app-fact-value-small {
  font-size: 15px;
  font-weight: 600;
}

.app-order-overview-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-detail-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.app-detail-panel-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-detail-address {
  line-height: 1.55;
}

.app-detail-subline {
  margin-top: 8px;
  color: var(--muted);
}

.app-order-details-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.app-keyvalue-list {
  display: grid;
  gap: 10px;
}

.app-keyvalue-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.app-keyvalue-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.app-keyvalue-label {
  font-weight: 700;
  color: var(--text);
}

.app-keyvalue-value {
  color: var(--text);
}

.app-table-compact th,
.app-table-compact td {
  padding-top: 10px;
  padding-bottom: 10px;
  vertical-align: top;
}

.app-summary-subline {
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .app-overview-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-order-details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-order-overview-grid,
  .app-overview-facts,
  .app-keyvalue-row {
    grid-template-columns: 1fr;
  }
}


.app-collapsible-card { padding: 0; overflow: hidden; }
.app-collapsible-summary {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  cursor:pointer;
  list-style:none;
  padding:16px;
  font-weight:700;
}
.app-collapsible-summary::-webkit-details-marker { display:none; }
.app-collapsible-content { border-top:1px solid var(--line); padding:16px; }
.app-mini-transfer-list { display:grid; gap:10px; }
.app-mini-transfer-item {
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
  padding:12px;
}
.app-mini-transfer-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
}
.app-table-actions-wrap { flex-wrap:wrap; }
@media (max-width: 820px) {
  .app-collapsible-summary,
  .app-mini-transfer-head { align-items:flex-start; flex-direction:column; }
}
.app-alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; background: #eef6ff; border: 1px solid #bfdbfe; }
.app-alert-danger { background: #fff1f2; border-color: #fecdd3; color: #991b1b; }
.app-alert-success { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.app-badge { display:inline-block; padding:3px 8px; border-radius:999px; background:#e5e7eb; font-size:12px; font-weight:700; }
.app-badge-green { background:#dcfce7; color:#166534; }
.app-badge-yellow { background:#fef9c3; color:#854d0e; }
.app-badge-blue { background:#dbeafe; color:#1d4ed8; }
.app-badge-red { background:#fee2e2; color:#991b1b; }
.app-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.app-muted { color: var(--muted); }
.app-small { font-size: 13px; }
.app-detail-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.app-detail-box { border:1px solid var(--line); border-radius:12px; padding:14px; background:var(--surface-alt); }
.app-detail-box h3 { margin:0 0 8px 0; font-size:16px; }
.app-table input, .app-table select { width:100%; min-width:90px; }
.signature-pad { border:1px solid var(--line); border-radius:10px; width:100%; height:160px; background:#fff; touch-action:none; }
@media print { .no-print, .app-header, .app-footer { display:none!important; } body.app-body { background:#fff; } .app-shell { width:100%; } .app-card { box-shadow:none; border:1px solid #aaa; page-break-inside:avoid; } }

/* Clean freight forms */
.app-main {
    padding-top: 18px;
}

.app-card {
    padding: 16px;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.05);
}

.app-section-title {
    margin-bottom: 14px;
}

.app-grid {
    gap: 12px;
}

.app-form-row {
    margin-bottom: 10px;
}

.app-grid > .app-form-row:last-child,
.app-card > .app-form-row:last-child {
    margin-bottom: 0;
}

.app-form-row label {
    font-size: 13px;
    margin-bottom: 4px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 38px;
}

textarea {
    min-height: 72px;
}

.app-textarea-small {
    min-height: 58px;
}

.app-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.app-card-head .app-section-title {
    margin-bottom: 0;
}

.freight-items-list {
    display: grid;
    gap: 10px;
}

.freight-item-row {
    display: grid;
    grid-template-columns: minmax(135px, 1.1fr) minmax(100px, .8fr) 78px minmax(190px, 1.7fr) 96px 72px 72px 72px auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-alt);
}

.freight-item-row .app-form-row {
    margin-bottom: 0;
}

.freight-item-row input[type="number"] {
    text-align: right;
}

.freight-item-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
}

.app-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.app-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #e5e7eb;
    color: #111827;
}

.app-badge-green { background: #dcfce7; color: #166534; }
.app-badge-yellow { background: #fef3c7; color: #92400e; }
.app-badge-red { background: #fee2e2; color: #991b1b; }
.app-badge-blue { background: #dbeafe; color: #1d4ed8; }

.app-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.app-detail-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 14px;
}

.app-detail-box h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.app-detail-box pre {
    margin: 0;
    white-space: pre-wrap;
    font: inherit;
    color: var(--text);
}

@media (max-width: 1180px) {
    .freight-item-row {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .freight-item-goods {
        grid-column: span 2;
    }

    .freight-item-actions {
        grid-column: span 6;
        justify-content: flex-start;
    }

    .app-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-card-head {
        align-items: stretch;
        flex-direction: column;
    }

    .freight-item-row,
    .app-detail-grid {
        grid-template-columns: 1fr;
    }

    .freight-item-goods,
    .freight-item-actions {
        grid-column: auto;
    }
}

/* Freight form polish v3 */
.freight-form {
    display: grid;
    gap: 16px;
}

.freight-form .app-card {
    border: 1px solid rgba(148, 163, 184, 0.55);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    padding: 18px;
}

.freight-form .app-subcard {
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 16px;
    background: #f8fafc;
    padding: 14px;
}

.freight-form .app-section-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 14px;
}

.freight-form .app-form-row label,
.freight-form .app-inline-check {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.freight-form input:not([type]),
.freight-form input[type="text"],
.freight-form input[type="date"],
.freight-form input[type="time"],
.freight-form input[type="number"],
.freight-form input[type="email"],
.freight-form input[type="password"],
.freight-form select,
.freight-form textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #ffffff;
    padding: 9px 11px;
    color: #0f172a;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.025);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.freight-form input:not([type]):focus,
.freight-form input[type="text"]:focus,
.freight-form input[type="date"]:focus,
.freight-form input[type="time"]:focus,
.freight-form input[type="number"]:focus,
.freight-form input[type="email"]:focus,
.freight-form input[type="password"]:focus,
.freight-form select:focus,
.freight-form textarea:focus {
    border-color: #334155;
    box-shadow: 0 0 0 3px rgba(51, 65, 85, 0.12);
}

.freight-form input:disabled {
    background: #f1f5f9;
    color: #64748b;
}

.freight-form textarea.app-textarea-small {
    min-height: 62px;
}

.freight-form input[type="file"] {
    width: 100%;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
}

.freight-form input[type="file"]::file-selector-button {
    border: 0;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    padding: 8px 12px;
    margin-right: 10px;
    cursor: pointer;
}

.freight-form .app-grid {
    gap: 14px;
}

.freight-form .app-form-row {
    margin-bottom: 0;
}

.freight-form .app-mt-18 {
    margin-top: 0;
}

.freight-form .app-card-head {
    margin-bottom: 14px;
}

.freight-form .freight-item-row {
    grid-template-columns: 170px 122px 76px minmax(220px, 1fr) 96px 68px 68px 68px 82px;
    gap: 9px;
    align-items: end;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 16px;
    background: #f8fafc;
}

.freight-form .freight-item-row label {
    font-size: 12px;
    white-space: nowrap;
}

.freight-form .freight-item-row input:not([type]),
.freight-form .freight-item-row input[type="number"] {
    min-height: 38px;
    padding: 7px 8px;
}

.freight-form .freight-item-actions .app-btn {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 12px;
}

.freight-form .app-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: rgba(244, 246, 248, 0.92);
    backdrop-filter: blur(10px);
    padding: 12px 0 0;
    margin-top: 0;
}

@media (max-width: 1280px) {
    .freight-form .freight-item-row {
        grid-template-columns: 160px 110px 72px minmax(190px, 1fr) 88px 64px 64px 64px 82px;
        gap: 8px;
    }
}

@media (max-width: 1120px) {
    .freight-form .freight-item-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .freight-form .freight-item-goods {
        grid-column: span 2;
    }
    .freight-form .freight-item-actions {
        grid-column: span 4;
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .freight-form .freight-item-row,
    .freight-form .freight-item-goods,
    .freight-form .freight-item-actions {
        grid-template-columns: 1fr;
        grid-column: auto;
    }
}

/* Frachtaufträge: kompakte Suche und saubere Listenbreiten */
input:not([type]),
input[type="search"],
input[type="tel"],
input[type="url"] {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
}

.app-filter-card {
    padding: 14px;
}

.app-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
}

.app-filter-search {
    flex: 0 1 280px;
    min-width: 220px;
}

.app-filter-status {
    flex: 0 0 190px;
    width: 190px;
}

.app-filter-button {
    flex: 0 0 auto;
}

.app-order-table-wrap {
    overflow-x: hidden;
}

.app-order-table {
    table-layout: fixed;
}

.app-order-table th,
.app-order-table td {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-order-table .col-shipment { width: 132px; }
.app-order-table .col-status { width: 106px; }
.app-order-table .col-doc { width: 82px; }
.app-order-table .col-principal { width: 160px; }
.app-order-table .col-billing { width: 160px; }
.app-order-table .col-place { width: 112px; }
.app-order-table .col-date { width: 92px; }
.app-order-table .col-action { width: 84px; text-align: right; }

.app-truncate {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-btn-small {
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 14px;
}

@media (max-width: 960px) {
    .app-filter-form {
        align-items: stretch;
    }

    .app-filter-search,
    .app-filter-status,
    .app-filter-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .app-order-table-wrap {
        overflow-x: auto;
    }

    .app-order-table {
        min-width: 900px;
    }
}

/* Rechnungsmodul-Kompatibilität */
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px; }
.page-title { margin:0; font-size:28px; line-height:1.2; }
.page-subtitle { color:var(--muted); margin-top:4px; }
.panel, .form-card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.panel-body, .form-card { padding:18px; }
.stack { display:grid; gap:18px; }
.form-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
.field label { display:block; font-weight:600; margin-bottom:6px; }
.input, .select, .textarea, .search-input { width:100%; max-width:100%; border:1px solid var(--line); background:#fff; border-radius:10px; padding:10px 12px; font:inherit; color:var(--text); }
.textarea { min-height:110px; resize:vertical; }
.btn { appearance:none; border:1px solid var(--line-dark); background:var(--header); color:#fff; padding:10px 14px; border-radius:10px; cursor:pointer; font:inherit; text-decoration:none; white-space:nowrap; display:inline-block; }
.btn:hover { opacity:.94; text-decoration:none; color:#fff; }
.btn-primary { background:var(--header); color:#fff; }
.btn-danger { background:var(--danger); border-color:var(--danger); color:#fff; }
.btn-secondary, .btn:not(.btn-primary):not(.btn-danger) { background:#fff; color:var(--text); border:1px solid var(--line); }
.toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:end; margin-bottom:16px; }
.table-wrap { width:100%; overflow-x:auto; }
.listing-table { width:100%; min-width:100%; border-collapse:collapse; background:var(--surface); border:1px solid var(--line); border-radius:12px; overflow:hidden; white-space:nowrap; }
.listing-table th, .listing-table td { padding:10px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
.listing-table th { background:var(--surface-alt); font-size:14px; }
.strong { font-weight:700; }
.muted { color:var(--muted); }
.badge { display:inline-block; padding:4px 10px; border-radius:999px; font-size:13px; font-weight:700; background:#e5e7eb; color:#111827; }
.badge-final { background:#dcfce7; color:#166534; }
.badge-muted { background:#e5e7eb; color:#374151; }
.empty-state { color:var(--muted); text-align:center; padding:20px; }
.pagination-wrap { margin-top:18px; }
.pager { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.pager-pages { display:flex; gap:6px; flex-wrap:wrap; }
.pager-btn, .pager-page { border:1px solid var(--line); background:#fff; color:var(--text); border-radius:8px; padding:7px 10px; text-decoration:none; }
.pager-page.is-active { background:var(--header); color:#fff; border-color:var(--header); }
.is-disabled { opacity:.5; pointer-events:none; }
.mobile-list { display:none; }
.app-table-fixed { table-layout:fixed; }
.app-ellipsis { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
.app-small { font-size:13px; }

@media (max-width: 960px) {
  .form-grid { grid-template-columns:1fr; }
  .page-head { flex-direction:column; }
}

/* Adressbuch: kompakte Filter, Sortierung und Pagination */
.app-filter-card {
    padding: 14px;
}

.app-filter-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) auto;
    gap: 12px;
    align-items: end;
}

.app-filter-row .app-form-row {
    margin-bottom: 0;
}

.app-filter-actions {
    display: flex;
    gap: 10px;
    align-items: end;
    margin-bottom: 0;
}

.app-table-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    overflow-x: hidden;
}

.app-table-card table.app-table {
    margin-top: 0;
    border: 0;
    box-shadow: none;
}

.app-addressbook-table {
    table-layout: fixed;
    white-space: normal !important;
}

.app-addressbook-table th,
.app-addressbook-table td {
    overflow: hidden;
}

.app-small {
    font-size: 13px;
}

.app-muted {
    color: var(--muted);
}

.app-ellipsis {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-col-company {
    max-width: 260px;
}

.app-sort-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.app-sort-link:hover {
    color: var(--link);
    text-decoration: none;
}

.app-btn-small {
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 14px;
}

.app-table-action-cell {
    text-align: right !important;
    white-space: nowrap;
}

.app-pagination-row {
    margin-top: 14px;
}

.app-pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
}

.app-page-link,
.app-page-current,
.app-page-disabled,
.app-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    text-decoration: none;
}

.app-page-link:hover {
    border-color: var(--line-dark);
    text-decoration: none;
}

.app-page-current {
    background: var(--header);
    border-color: var(--header);
    color: #fff;
    font-weight: 700;
}

.app-page-disabled {
    color: var(--muted);
    background: var(--surface-alt);
}

.app-page-dots {
    border-color: transparent;
    background: transparent;
    min-width: 22px;
}

.app-page-summary {
    margin-left: 8px;
    color: var(--muted);
}

@media (max-width: 960px) {
    .app-filter-row {
        grid-template-columns: 1fr;
    }

    .app-filter-actions {
        align-items: stretch;
    }
}

/* Fahrer-Seite: Button sauber ausrichten */
.driver-page-toolbar {
    align-items: center;
    justify-content: space-between;
}

.driver-page-toolbar > .app-btn {
    width: auto;
    min-height: 0;
    align-self: flex-start;
}

@media (max-width: 820px) {
    .driver-page-toolbar > .app-btn {
        width: 100%;
    }
}

/* Fahrer Detailseite */
.driver-show-toolbar {
    align-items: center;
    justify-content: space-between;
}

.driver-show-toolbar .app-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.driver-show-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 18px;
    margin-top: 18px;
}

.driver-show-full {
    grid-column: 1 / -1;
}

.driver-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 16px 28px;
}

.driver-detail-label {
    display: block;
    font-size: 12px;
    color: #667085;
    margin-bottom: 4px;
}

.driver-address-box {
    line-height: 1.7;
}

.driver-status-actions {
    justify-content: flex-start;
}

@media (max-width: 900px) {
    .driver-show-grid {
        grid-template-columns: 1fr;
    }

    .driver-detail-grid {
        grid-template-columns: 1fr;
    }

    .driver-show-toolbar {
        align-items: stretch;
    }

    .driver-show-toolbar .app-actions {
        width: 100%;
    }
}

/* Mobile Tabellen: horizontal scrollbar statt Abschneiden */
@media (max-width: 768px) {
    .app-shell {
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-card,
    .app-panel,
    .app-box,
    .app-table-card,
    .card {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-card table,
    .app-panel table,
    .app-box table,
    .app-table-card table,
    .card table,
    table.app-table {
        min-width: 720px;
        width: max-content;
        border-collapse: collapse;
    }

    .app-card th,
    .app-card td,
    .app-panel th,
    .app-panel td,
    .app-box th,
    .app-box td,
    .app-table-card th,
    .app-table-card td,
    .card th,
    .card td,
    table.app-table th,
    table.app-table td {
        white-space: nowrap;
    }

    .app-card td div,
    .app-card td small,
    .app-panel td div,
    .app-panel td small,
    .app-box td div,
    .app-box td small,
    .app-table-card td div,
    .app-table-card td small,
    .card td div,
    .card td small,
    table.app-table td div,
    table.app-table td small {
        white-space: normal;
    }

    .app-card a,
    .app-card button,
    .app-panel a,
    .app-panel button,
    .app-box a,
    .app-box button,
    .app-table-card a,
    .app-table-card button,
    .card a,
    .card button {
        white-space: nowrap;
    }
}

/* Finaler Mobile-Fix: alle System-Tabellen horizontal scrollbar */
@media (max-width: 768px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-main,
    .app-shell {
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-main table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-collapse: collapse;
    }

    .app-main table th,
    .app-main table td {
        white-space: nowrap;
    }

    .app-main table td small,
    .app-main table td div,
    .app-main table td span {
        white-space: normal;
    }

    .app-main table input,
    .app-main table select,
    .app-main table textarea,
    .app-main table button,
    .app-main table a {
        white-space: nowrap;
    }

    .app-main .table,
    .app-main .app-table {
        min-width: 720px;
    }

    .app-main table:not(.no-mobile-scroll) {
        scrollbar-width: thin;
    }
}

/* Mobile-Fix speziell für Frachtauftrag-Detailseiten */
@media (max-width: 768px) {
    .app-main .app-card {
        overflow-x: hidden;
    }

    .app-main .app-card table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .app-main .app-card table tbody,
    .app-main .app-card table thead,
    .app-main .app-card table tr {
        width: max-content;
        min-width: 720px;
    }

    .app-main .app-card table th,
    .app-main .app-card table td {
        white-space: nowrap !important;
    }

    .app-main .app-card table td div,
    .app-main .app-card table td small {
        white-space: normal !important;
    }

    /* Detail-Tabellen mit Label/Wert-Paaren sauberer auf Handy */
    .app-main .app-card table.detail-table,
    .app-main .app-card table.app-detail-table,
    .app-main .app-card table.meta-table,
    .app-main .app-card table.info-table {
        min-width: 0 !important;
    }

    .app-main .app-card table.detail-table tr,
    .app-main .app-card table.app-detail-table tr,
    .app-main .app-card table.meta-table tr,
    .app-main .app-card table.info-table tr {
        display: grid !important;
        grid-template-columns: 1fr !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .app-main .app-card table.detail-table th,
    .app-main .app-card table.detail-table td,
    .app-main .app-card table.app-detail-table th,
    .app-main .app-card table.app-detail-table td,
    .app-main .app-card table.meta-table th,
    .app-main .app-card table.meta-table td,
    .app-main .app-card table.info-table th,
    .app-main .app-card table.info-table td {
        display: block !important;
        width: 100% !important;
        white-space: normal !important;
        box-sizing: border-box;
    }
}

/* Mobile Detailtabellen Frachtauftrag */
@media (max-width: 768px) {
    .app-main table.mobile-stack-table {
        display: table !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    .app-main table.mobile-stack-table tbody,
    .app-main table.mobile-stack-table tr {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .app-main table.mobile-stack-table th,
    .app-main table.mobile-stack-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        text-align: left !important;
    }

    .app-main table.mobile-stack-table th {
        padding-bottom: 2px !important;
        opacity: 0.75;
    }

    .app-main table.mobile-stack-table td {
        padding-top: 2px !important;
        margin-bottom: 8px !important;
    }

    .app-main table.mobile-scroll-table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .app-main table.mobile-scroll-table tbody,
    .app-main table.mobile-scroll-table thead,
    .app-main table.mobile-scroll-table tr {
        min-width: 720px !important;
        width: max-content !important;
    }

    .app-main table.mobile-scroll-table th,
    .app-main table.mobile-scroll-table td {
        white-space: nowrap !important;
    }
}

/* FINAL FIX Frachtauftrag Detail mobil */
@media screen and (max-width: 1100px) {
    .app-main table.app-table.mobile-stack-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    .app-main table.app-table.mobile-stack-table tbody,
    .app-main table.app-table.mobile-stack-table tr {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .app-main table.app-table.mobile-stack-table th,
    .app-main table.app-table.mobile-stack-table td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        white-space: normal !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }

    .app-main table.app-table.mobile-stack-table th {
        padding-bottom: 2px !important;
        opacity: 0.7;
    }

    .app-main table.app-table.mobile-stack-table td {
        padding-top: 2px !important;
        padding-bottom: 10px !important;
    }

    .app-main table.app-table.mobile-scroll-table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .app-main table.app-table.mobile-scroll-table tbody,
    .app-main table.app-table.mobile-scroll-table thead,
    .app-main table.app-table.mobile-scroll-table tr {
        min-width: 760px !important;
        width: max-content !important;
    }

    .app-main table.app-table.mobile-scroll-table th,
    .app-main table.app-table.mobile-scroll-table td {
        white-space: nowrap !important;
    }
}

/* Fix: Rechnungslisten-Namen auf Mobil nicht zerquetschen */
@media screen and (max-width: 1100px) {
    .app-main table.app-table td,
    .app-main table.app-table th {
        word-break: normal !important;
        overflow-wrap: normal !important;
    }

    .app-main table.app-table td a,
    .app-main table.app-table td strong,
    .app-main table.app-table td span {
        word-break: normal !important;
        overflow-wrap: normal !important;
    }

    /* Kundennamen/Rechnungsnamen lesbar halten */
    .app-main table.app-table td:nth-child(2),
    .app-main table.app-table td:nth-child(3) {
        min-width: 180px;
        white-space: normal !important;
    }
}

/* FINAL MOBILE TABLE FIX */
@media (max-width: 768px) {
    .app-main,
    .app-shell {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .app-card,
    .app-panel,
    .app-box,
    .app-table-card,
    .card,
    .invoice-card,
    .freight-card {
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .app-main table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-collapse: collapse !important;
    }

    .app-main table thead,
    .app-main table tbody {
        display: table !important;
        min-width: 860px !important;
        width: 860px !important;
    }

    .app-main table tr {
        display: table-row !important;
    }

    .app-main table th,
    .app-main table td {
        display: table-cell !important;
        white-space: nowrap !important;
        vertical-align: top !important;
    }

    .app-main table td small,
    .app-main table td .app-muted {
        white-space: nowrap !important;
    }

    .app-main table td a,
    .app-main table td button,
    .app-main table .app-btn {
        white-space: nowrap !important;
    }
}

/* OS KEP mobile views final: Listen als Karten, Detailtabellen gezielt stacken/scrollen */
@media (min-width: 769px) {
    .mobile-list { display: none !important; }
}

@media (max-width: 768px) {
    .table-desktop,
    .customers-desktop-wrap,
    .drivers-desktop-table,
    .orders-table-wrap {
        display: none !important;
    }

    .mobile-list {
        display: grid !important;
        gap: 12px !important;
        margin-top: 12px !important;
    }

    .mobile-card {
        background: var(--surface, #fff) !important;
        border: 1px solid var(--line, #d7dde6) !important;
        border-radius: 16px !important;
        box-shadow: var(--shadow, 0 10px 24px rgba(15,23,42,.08)) !important;
        padding: 16px !important;
        overflow: hidden !important;
    }

    details.mobile-card summary {
        cursor: pointer !important;
        list-style: none !important;
    }

    details.mobile-card summary::-webkit-details-marker {
        display: none !important;
    }

    .mobile-card-head,
    .mobile-summary-head {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 12px !important;
        min-width: 0 !important;
    }

    .mobile-title,
    .mobile-card .strong {
        font-weight: 800 !important;
        font-size: 17px !important;
        line-height: 1.25 !important;
        color: var(--text, #0f172a) !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }

    .mobile-subtitle,
    .mobile-card .muted {
        color: var(--muted, #64748b) !important;
        margin-top: 3px !important;
        font-size: 14px !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }

    .mobile-badges {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
        gap: 6px !important;
    }

    .mobile-card-body {
        margin-top: 12px !important;
    }

    .mobile-kv,
    .mobile-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 9px !important;
        margin-top: 12px !important;
    }

    .mobile-kv > div,
    .mobile-grid > div {
        border-top: 1px solid var(--line, #e5e7eb) !important;
        padding-top: 9px !important;
    }

    .mobile-kv span,
    .mobile-label {
        display: block !important;
        color: var(--muted, #64748b) !important;
        font-size: 12px !important;
        font-weight: 800 !important;
        letter-spacing: .03em !important;
        text-transform: uppercase !important;
        margin-bottom: 2px !important;
    }

    .mobile-kv strong,
    .mobile-grid strong {
        display: block !important;
        color: var(--text, #0f172a) !important;
        font-size: 15px !important;
        line-height: 1.35 !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }

    .mobile-actions {
        display: flex !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
        margin-top: 14px !important;
    }

    .mobile-actions .app-btn,
    .mobile-actions .btn {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }

    /* Detailtabellen: Label/Wert-Paare untereinander statt abgeschnitten */
    .app-main table.app-table.mobile-stack-table,
    .app-main table.mobile-stack-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    .app-main table.app-table.mobile-stack-table thead,
    .app-main table.app-table.mobile-stack-table tbody,
    .app-main table.app-table.mobile-stack-table tr,
    .app-main table.mobile-stack-table thead,
    .app-main table.mobile-stack-table tbody,
    .app-main table.mobile-stack-table tr {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .app-main table.app-table.mobile-stack-table th,
    .app-main table.app-table.mobile-stack-table td,
    .app-main table.mobile-stack-table th,
    .app-main table.mobile-stack-table td {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        text-align: left !important;
        overflow: visible !important;
    }

    .app-main table.app-table.mobile-stack-table th,
    .app-main table.mobile-stack-table th {
        background: var(--surface-alt, #f8fafc) !important;
        font-size: 13px !important;
        padding-bottom: 4px !important;
    }

    .app-main table.app-table.mobile-stack-table td,
    .app-main table.mobile-stack-table td {
        padding-top: 6px !important;
        padding-bottom: 12px !important;
    }

    /* Große Detailtabellen: innerhalb der Karte scrollbar */
    .mobile-scroll-wrap,
    .app-card:has(table.mobile-scroll-table) {
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .app-main table.app-table.mobile-scroll-table,
    .app-main table.mobile-scroll-table {
        display: table !important;
        width: max-content !important;
        min-width: 720px !important;
        max-width: none !important;
        overflow: visible !important;
        white-space: nowrap !important;
    }

    .app-main table.app-table.mobile-scroll-table thead,
    .app-main table.app-table.mobile-scroll-table tbody,
    .app-main table.app-table.mobile-scroll-table tr,
    .app-main table.mobile-scroll-table thead,
    .app-main table.mobile-scroll-table tbody,
    .app-main table.mobile-scroll-table tr {
        display: table-row-group !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .app-main table.app-table.mobile-scroll-table tr,
    .app-main table.mobile-scroll-table tr {
        display: table-row !important;
    }

    .app-main table.app-table.mobile-scroll-table th,
    .app-main table.app-table.mobile-scroll-table td,
    .app-main table.mobile-scroll-table th,
    .app-main table.mobile-scroll-table td {
        display: table-cell !important;
        white-space: nowrap !important;
        width: auto !important;
    }
}



/* Fahrer mobil: niemals Tabelle und Karten gleichzeitig, Karten eingeklappt */
.drivers-mobile-list {
    display: none !important;
}

@media (min-width: 769px) {
    .drivers-mobile-list {
        display: none !important;
    }

    .drivers-desktop-table {
        display: table !important;
    }
}

@media (max-width: 768px) {
    .drivers-desktop-table {
        display: none !important;
    }

    .drivers-mobile-list {
        display: grid !important;
        gap: 12px !important;
        margin-top: 12px !important;
    }

    details.driver-mobile-card {
        padding: 0 !important;
    }

    details.driver-mobile-card > summary {
        padding: 16px !important;
        cursor: pointer !important;
        list-style: none !important;
    }

    details.driver-mobile-card > summary::-webkit-details-marker {
        display: none !important;
    }

    details.driver-mobile-card .mobile-card-body {
        padding: 0 16px 16px 16px !important;
        margin-top: 0 !important;
    }

    .mobile-toggle-hint {
        display: inline-flex !important;
        align-items: center !important;
        border: 1px solid var(--line, #d7dde6) !important;
        border-radius: 999px !important;
        padding: 3px 8px !important;
        font-size: 11px !important;
        font-weight: 800 !important;
        color: var(--muted, #64748b) !important;
        background: #fff !important;
        white-space: nowrap !important;
    }

    details.driver-mobile-card[open] .mobile-toggle-hint {
        color: var(--navy, #0f172a) !important;
    }
}

/* OS KEP final mobile lists: desktop tables off, mobile cards collapsed */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
    .customers-desktop-wrap,
    .drivers-desktop-table,
    .orders-table-wrap {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .customers-mobile-list,
    .drivers-mobile-list,
    .freight-mobile-list {
        display: grid !important;
        gap: 12px !important;
        margin-top: 12px !important;
    }

    details.mobile-card {
        padding: 0 !important;
    }

    details.mobile-card > summary {
        display: block !important;
        padding: 16px !important;
        cursor: pointer !important;
        list-style: none !important;
    }

    details.mobile-card > summary::-webkit-details-marker {
        display: none !important;
    }

    details.mobile-card .mobile-card-body {
        padding: 0 16px 16px 16px !important;
        margin-top: 0 !important;
    }

    details.mobile-card:not([open]) .mobile-card-body {
        display: none !important;
    }

    .mobile-toggle-hint {
        display: inline-flex !important;
        align-items: center !important;
        border: 1px solid var(--line, #d7dde6) !important;
        border-radius: 999px !important;
        padding: 3px 8px !important;
        font-size: 11px !important;
        font-weight: 800 !important;
        color: var(--muted, #64748b) !important;
        background: #fff !important;
        white-space: nowrap !important;
    }

    details.mobile-card[open] .mobile-toggle-hint {
        color: var(--navy, #0f172a) !important;
    }
}

@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
    .customers-mobile-list,
    .drivers-mobile-list,
    .freight-mobile-list {
        display: none !important;
    }

    .customers-desktop-wrap {
        display: block !important;
    }

    .drivers-desktop-table,
    .orders-table {
        display: table !important;
    }
}



/* OS KEP System UI-Fix 2026-05-21: einheitlicher Header, Footer, Buttons und Tracking */
:root {
    --bg: #e8f0f7;
    --surface: #ffffff;
    --surface-alt: #f4f8fc;
    --text: #102033;
    --muted: #5c6b7a;
    --line: #c7d3df;
    --line-dark: #0a2948;
    --header: #071d33;
    --header-soft: #102c49;
    --header-text: #f8fbff;
    --link: #0b5e9e;
    --link-hover: #074a7c;
    --shadow: 0 12px 28px rgba(7, 29, 51, 0.10);
}

body.app-body {
    background: var(--bg);
}

.app-header {
    background: var(--header);
    box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 8px 22px rgba(7,29,51,.14);
}

.app-header-inner {
    min-height: 68px;
}

.app-brand a,
.app-footer a {
    color: var(--header-text);
}

.app-brand a {
    letter-spacing: .01em;
}

.app-nav {
    gap: 8px;
}

.app-nav a {
    color: rgba(248,251,255,.88);
    border: 1px solid transparent;
}

.app-nav a:hover,
.app-nav a.is-active {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.12);
    color: #fff;
    text-decoration: none;
}

.app-user-name {
    color: rgba(248,251,255,.88);
}

.app-footer {
    background: var(--header);
    color: rgba(248,251,255,.75);
    border-top: 0;
}

.app-footer-inner {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.app-footer-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-footer-links a {
    color: rgba(248,251,255,.86);
    text-decoration: none;
}

.app-footer-links a:hover {
    color: #fff;
    text-decoration: underline;
}

.app-card,
.panel,
.form-card,
.listing-table,
table.app-table {
    background: var(--surface);
    border-color: var(--line);
}

.app-card-flat {
    background: var(--surface-alt);
}

.app-btn,
.btn,
button,
input[type="submit"] {
    background: var(--header);
    border-color: var(--header);
    color: #fff;
    font-weight: 700;
}

.app-btn:hover,
.btn:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--header-soft);
    border-color: var(--header-soft);
    color: #fff;
    opacity: 1;
    text-decoration: none;
}

.app-btn-secondary,
.btn-secondary,
.btn:not(.btn-primary):not(.btn-danger) {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.app-btn-secondary:hover,
.btn-secondary:hover,
.btn:not(.btn-primary):not(.btn-danger):hover {
    background: var(--surface-alt);
    color: var(--text);
    border-color: #a9bacb;
}

.app-btn-danger,
.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

button:disabled,
button[disabled],
.app-btn:disabled,
.app-btn[disabled],
.btn:disabled,
.btn[disabled] {
    background: #d7e0ea !important;
    border-color: #bdc9d6 !important;
    color: #667789 !important;
    opacity: 1 !important;
    cursor: not-allowed !important;
}

input[type="text"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea,
.input,
.select,
.textarea,
.search-input {
    background: #fff;
    border-color: #bdc9d6;
}

.app-public-hero h1 {
    margin: 6px 0 10px;
    font-size: clamp(30px, 4vw, 52px);
    line-height: 1.05;
    max-width: 780px;
}

.app-public-hero p {
    max-width: 760px;
    color: var(--muted);
    font-size: 17px;
}

.app-kicker,
.app-note-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.app-info-card h2 {
    margin-top: 0;
    font-size: 18px;
}

.app-info-card p {
    color: var(--muted);
    margin-bottom: 0;
}

.app-tracking-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.app-tracking-main-title {
    margin: 10px 0 4px;
    font-size: 30px;
}

.app-tracking-list {
    display: grid;
    gap: 0;
}

.app-tracking-item {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.app-tracking-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.app-tracking-time,
.app-tracking-title {
    font-weight: 700;
}

.app-legal-card h1,
.app-legal-card h2 {
    color: var(--text);
}

.app-legal-card h2 {
    margin-top: 22px;
    font-size: 19px;
}

@media (max-width: 960px) {
    .app-header-inner {
        align-items: stretch;
    }
    .app-footer-inner {
        align-items: flex-start;
    }
    .app-footer-links {
        justify-content: flex-start;
    }
    .app-tracking-item {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}
