: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;
}

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


.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;
  }
}
