/* Handyklinik Express – Bestellübersicht */
:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --brand: #e50914;
    --brand-dark: #b8070f;
    --dark: #1f2023;
    --sel: #fff4d6;
    --sel-line: #f5b400;
    --red-bg: #fde8e8;   --red: #b91c1c;
    --yellow-bg: #fef3c7; --yellow: #92400e;
    --green-bg: #dcfce7; --green: #166534;
    --orange-bg: #ffedd5; --orange: #c2410c;
    --mint-bg: #ccfbf1;  --mint: #0f766e;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
body.has-bar { padding-bottom: 90px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: #1d4ed8; }

/* ---------- Kopfzeile ---------- */
/* Anthrazit-Kopf (nicht tiefschwarz), Inhalt breit und mittig */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: linear-gradient(180deg, rgba(58, 61, 68, .96) 0%, rgba(46, 49, 55, .96) 100%);
    -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 8px 26px rgba(20, 22, 26, .18);
    color: #fff;
}
.topbar-inner {
    max-width: 1880px; margin: 0 auto; padding: 10px 24px;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
}
.page { max-width: 1880px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; justify-self: start; min-width: 0; }
.brand-logo { height: 30px; }
.brand-sub { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: #a3a7b0; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.15); }

/* Menü: mittig, als Pillen-Leiste (etwas dunkler als der Kopf) */
.mainnav {
    justify-self: center;
    display: flex; gap: 2px; padding: 4px;
    background: rgba(24, 26, 30, .55);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.25);
}
.mainnav a {
    display: flex; align-items: center; gap: 7px;
    color: #c4c7cf; text-decoration: none; padding: 8px 15px; border-radius: 999px;
    font-weight: 600; font-size: 14px; white-space: nowrap;
    transition: background .15s, color .15s;
}
.mainnav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.mainnav a.active { background: #fff; color: #111; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.mainnav a.active .ico { color: var(--brand); }
.ico { width: 18px; height: 18px; flex: 0 0 auto; }

/* Benutzer-Menü rechts */
.usermenu { position: relative; justify-self: end; }
.usermenu summary {
    list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05);
    color: #fff; transition: background .15s;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover, .usermenu[open] summary { background: rgba(255,255,255,.12); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, #ff3b47, #b8070f); font-weight: 800; font-size: 14px;
}
.usermenu-name { font-size: 14px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 16px; height: 16px; opacity: .6; transition: transform .15s; }
.usermenu[open] .chev { transform: rotate(180deg); }
.usermenu-pop {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 50;
    background: #fff; color: var(--text); border-radius: 12px; padding: 6px;
    box-shadow: 0 16px 40px rgba(0,0,0,.25); border: 1px solid var(--line);
}
.usermenu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu-head span { font-size: 12px; color: var(--muted); }
.usermenu-pop button, .usermenu-pop a {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none;
    border-radius: 8px; font: inherit; font-weight: 600; color: var(--text); text-decoration: none; cursor: pointer;
}
.usermenu-pop button:hover, .usermenu-pop a:hover { background: #f3f4f6; }
.usermenu-pop a { color: #b91c1c; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
    font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-ghost-dark { background: #fff; color: var(--text); border-color: var(--line); }
.btn-ghost-dark:hover { background: #f9fafb; border-color: #d1d5db; }
.btn-yellow { background: #f59e0b; color: #1f1300; }
.btn-yellow:hover { background: #d97706; }
.btn-green { background: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-ghost { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn-danger-ghost:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.icon-btn:hover { color: var(--text); }

/* ---------- Seite ---------- */
.page { padding: 20px 24px; max-width: 1880px; margin: 0 auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid var(--line); background: #fff; border-radius: 999px;
    padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.chip b { background: #f3f4f6; border-radius: 999px; padding: 0 8px; font-size: 12px; }
.chip:hover { border-color: #9ca3af; }
.chip.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.chip.active b { background: rgba(255,255,255,.2); }
.chip.s-red b { background: var(--red-bg); color: var(--red); }
.chip.s-yellow b { background: var(--yellow-bg); color: var(--yellow); }
.chip.s-green b { background: var(--green-bg); color: var(--green); }
.chip.s-orange b { background: var(--orange-bg); color: var(--orange); }
.chip.s-mint b { background: var(--mint-bg); color: var(--mint); }
.chip-msg.has b { background: var(--brand); color: #fff; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] {
    flex: 1 1 280px; max-width: 460px;
    padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.date-filter { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.date-filter input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.spacer { flex: 1; }

/* ---------- Tabelle ---------- */
.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 210px); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
    position: sticky; top: 0; z-index: 2;
    background: #f9fafb; color: var(--muted);
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
    text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover td { background: #f9fafb; }
tbody tr.checked td { background: #eef2ff; }
tbody tr.selected td { background: var(--sel); }
tbody tr.selected td:first-child { box-shadow: inset 4px 0 0 var(--sel-line); }
.col-check { width: 34px; text-align: center; }
.col-check input { width: 16px; height: 16px; cursor: pointer; }
.num { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.part { color: #111; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.notes { max-width: 240px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.age-warn { color: var(--red); cursor: help; }
.empty { text-align: center; color: var(--muted); padding: 40px; margin: 0; }

.pill {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.s-red    .pill, .pill.s-red    { background: var(--red-bg); color: var(--red); }
.pill.s-yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill.s-green  { background: var(--green-bg); color: var(--green); }
.pill.s-orange { background: var(--orange-bg); color: var(--orange); }
.pill.s-mint   { background: var(--mint-bg); color: var(--mint); }
.pill.s-grey   { background: #f3f4f6; color: var(--muted); }

.chat-badge {
    border: 1px solid var(--line); background: #fff; border-radius: 999px;
    padding: 2px 10px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.chat-badge:hover { border-color: #9ca3af; }
.chat-badge.empty { color: #9ca3af; }
.chat-badge.waiting { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(229,9,20,.18); } }

/* ---------- Aktionsleiste unten ---------- */
.actionbar {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30;
    width: min(1100px, calc(100% - 24px));
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 10px 14px;
}
.actionbar[hidden] { display: none; }
.actionbar-bulk { border-color: #c7d2fe; }
.actionbar-info { flex: 1 1 260px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actionbar-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Dialoge ---------- */
.dlg {
    border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100% - 24px));
    box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--text);
}
.dlg-wide { width: min(760px, calc(100% - 24px)); }
.dlg-wide.with-chat { width: min(1180px, calc(100% - 24px)); }
.dlg::backdrop { background: rgba(17,24,39,.55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg { max-height: calc(100vh - 24px); }
.dlg > form { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dlg-body { padding: 16px 20px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: #f9fafb; border-radius: 0 0 14px 14px; }
.dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 10px; }
.dlg label small { font-weight: 400; color: var(--muted); }
.dlg input, .dlg select, .dlg textarea {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-weight: 400; width: 100%;
}
.dlg input:focus, .dlg select:focus, .dlg textarea:focus, .toolbar input:focus {
    outline: 2px solid rgba(229,9,20,.25); border-color: var(--brand);
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.meta { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.form-error { background: var(--red-bg); color: var(--red); padding: 8px 12px; border-radius: 8px; margin: 10px 0 0; font-weight: 600; }
.form-error[hidden] { display: none; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }

.entry-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
.with-chat .entry-layout { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
.chat[hidden] { display: none; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; background: #f9fafb; border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 360px; }
.chat h3 { margin: 0 0 8px; font-size: 14px; }
.chat-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; max-height: 380px; padding-right: 4px; }
.chat-empty { color: var(--muted); font-size: 13px; margin: auto 0; text-align: center; }
.msg { max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.msg-head { font-size: 11px; font-weight: 600; opacity: .7; margin-bottom: 2px; }
.msg-mine { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg-mine a { color: #fff; }
.msg-other { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-legacy { align-self: stretch; max-width: none; background: #fffbeb; border: 1px dashed #f59e0b; }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 8px; }
.chat-quick button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.chat-quick button:hover { border-color: #9ca3af; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; resize: vertical; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; }

/* ---------- Meldung ---------- */
.toast {
    position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 100;
    background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600;
}
.toast[hidden] { display: none; }
.toast-error { background: #b91c1c; }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: radial-gradient(circle at 30% 20%, #3a3b40 0%, #1f2023 55%, #111214 100%);
}
.login-card {
    width: min(380px, 100%); background: #fff; border-radius: 16px; padding: 32px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4); text-align: center;
}
.login-logo { height: 44px; background: var(--dark); padding: 8px 14px; border-radius: 10px; margin-bottom: 14px; }
.login-card h1 { font-size: 18px; margin: 0 0 20px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: 13px; font-weight: 600; margin-bottom: 14px; color: #374151; }
.login-card input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; }
.login-card input:focus { outline: 2px solid rgba(229,9,20,.25); border-color: var(--brand); }
.login-small { font-weight: 400; color: var(--muted); font-size: 12px; }
.login-error { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 8px; font-weight: 600; margin: 14px 0 0; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 900px) {
    .grid { grid-template-columns: 1fr 1fr; }
    .span3 { grid-column: span 2; }
    .with-chat .entry-layout { grid-template-columns: 1fr; }
    .table-wrap { max-height: none; }
}

/* ================= Workstation: allgemeine Bausteine ================= */
.page-narrow { max-width: 980px; }
.list-head { margin-bottom: 10px; }
.list-head h2 { margin: 0; font-size: 22px; }
.list-head .meta { margin: 2px 0 0; }
td.c-kat:not(:empty) { font-size: 12px; font-weight: 600; color: #4338ca; }
.page-medium { max-width: 1400px; }

/* Belege gestalten */
.seg-mini { display: inline-flex; background: #f3f4f6; border-radius: 999px; padding: 3px; }
.seg-mini button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg-mini button.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.design-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.design-controls select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-weight: 400; background: #fff; }
.design-controls .grid { gap: 0 12px; }
.design-controls .check-row { margin-bottom: 6px !important; }
.field-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.sticky-save { position: sticky; bottom: 0; background: #fff; padding: 10px 0; border-top: 1px solid var(--line); }
.design-preview {
    position: sticky; top: 90px; height: var(--h, 600px); overflow: hidden;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow);
}
#preview { width: 794px; height: 1123px; border: 0; transform: scale(var(--s, .6)); transform-origin: top left; display: block; }
@media (max-width: 1000px) {
    .design-layout { grid-template-columns: 1fr; }
    .design-preview { position: relative; top: 0; }
}
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 18px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 12px; }
.stack input, .stack textarea { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-weight: 400; }
.notice { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.notice-soft { background: #f9fafb; border-color: var(--line); color: #374151; font-size: 13px; margin-bottom: 12px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row-actions input[type=text] { flex: 1; min-width: 160px; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 8px; }
.dlg label.check-row, label.check-row { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 500; }
.dlg label.check-row input, label.check-row input { width: auto; margin-top: 3px; }
.check-big { background: #fffbeb; border: 1px solid #fde68a; padding: 10px 12px; border-radius: 8px; }
.check-inline { align-self: end; margin-bottom: 18px !important; }
.grid-2 { grid-template-columns: 1fr 1fr; }
h3.sub { font-size: 14px; margin: 14px 0 8px; color: #111; }
.field-hint { font-weight: 500; color: var(--muted); min-height: 1em; }
.field-hint.good, .good { color: #15803d; }
.field-hint.bad, .bad { color: #b91c1c; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.login-hint { font-size: 13px; color: var(--muted); text-align: left; margin: -8px 0 16px; }
.spender-hint { display: inline-block; font-size: 11px; font-weight: 700; color: #15803d; background: var(--green-bg); border-radius: 999px; padding: 1px 8px; text-decoration: none; white-space: nowrap; }

/* Benutzer */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: grid; grid-template-columns: 1fr; gap: 4px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.user-row:hover { border-color: #9ca3af; }
.user-row.inactive { opacity: .55; }
.user-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.perm-list { display: flex; flex-direction: column; gap: 2px; }
.perm-list .check-row { margin-bottom: 6px; }
.perm-admin { border-top: 1px solid var(--line); padding-top: 8px; color: var(--red) !important; }
.perm-list label.disabled { opacity: .45; }
.chef-toggle { margin-top: 12px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.presets button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; cursor: pointer; }
.presets button:hover { border-color: #9ca3af; background: #f9fafb; }
.area-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dlg label.area-tile {
    position: relative; flex-direction: row; align-items: center; gap: 10px; margin: 0;
    border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #fff;
    transition: border-color .15s, background .15s;
}
.dlg label.area-tile input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }
.area-tile:hover { border-color: #c7cbd1; }
.area-tile.on { border-color: #16a34a; background: #f0fdf4; }
.area-icon { font-size: 22px; }
.area-text { display: flex; flex-direction: column; line-height: 1.25; }
.area-text b { font-size: 14px; color: var(--text); }
.area-text small { font-weight: 400; color: var(--muted); font-size: 12px; }
.area-check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: transparent; border: 2px solid #d1d5db; }
.area-tile.on .area-check { background: #16a34a; border-color: #16a34a; color: #fff; }
.is-admin .area-tile { opacity: .7; }
@media (max-width: 600px) { .area-tiles { grid-template-columns: 1fr; } }

/* Geräte-Übersicht */
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.view-head h2 { margin: 0; font-size: 22px; }
.view-head .meta { margin: 2px 0 0; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-good .stat-value { color: #15803d; }
.stat-bad .stat-value { color: #b91c1c; }
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dev-card { display: flex; flex-direction: column; text-align: left; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .1s, box-shadow .15s; }
.dev-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.dev-img { height: 150px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.dev-img img { width: 100%; height: 100%; object-fit: cover; }
.dev-noimg { font-size: 44px; opacity: .35; }
.grid-vitrine .dev-img { height: 200px; }
.dev-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.dev-top { display: flex; justify-content: space-between; align-items: center; }
.dev-name { font-weight: 700; font-size: 16px; }
.dev-details { font-size: 13px; color: #374151; }
.dev-prices { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-top: 4px; }
.price-big { font-size: 20px; font-weight: 800; }
.dev-foot { margin-top: auto; padding-top: 6px; }
.herkunft-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px 14px; margin: -4px 0 14px; }
.herkunft-title { display: block; font-weight: 700; font-size: 13px; margin-bottom: 8px; color: #166534; }
.seg-small { margin-bottom: 8px; }
.dlg .seg-small label { padding: 8px 12px; font-size: 13px; background: #fff; }
.dlg .herkunft-info { margin-bottom: 4px; }
.box-nr { display: inline-block; background: #1f2937; color: #fff; font-weight: 800; font-size: 13px; padding: 2px 10px; border-radius: 6px; letter-spacing: .5px; }
.dev-top .box-nr { font-size: 15px; padding: 3px 11px; }
.dlg .box-input { max-width: 140px; font-size: 20px; font-weight: 800; }
.herkunft-chip { font-size: 12px; font-weight: 600; color: #166534; }
.part-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.part-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; }
.part-chip.ok { background: var(--green-bg); color: var(--green); font-weight: 600; }

/* Geräte-Dialog */
.dlg-title { display: flex; flex-direction: column; gap: 4px; }
.dlg-sub { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; padding: 10px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--brand); }
.tabs button[hidden] { display: none; }
.wizard .tabs button:not(.active) { color: #9ca3af; }
.wizard .tabs button.active { color: var(--brand); }
h3.sub-first { margin-top: 0; }
.tab-pane[hidden] { display: none; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.dlg .seg label { flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; margin: 0; }
.dlg .seg label:has(input:checked) { border-color: var(--brand); background: #fff1f2; }
.dlg .seg input { width: auto; }
.dlg-foot-split { justify-content: space-between; flex-wrap: wrap; }
.foot-left, .foot-right { display: flex; gap: 6px; flex-wrap: wrap; }
.foot-right { margin-left: auto; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; background: #f3f4f6; border: 1px solid var(--line); }
.thumbs-big .thumb { width: 140px; height: 140px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-pending { outline: 2px dashed #f59e0b; outline-offset: -2px; }
.thumb-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.file-btn { position: relative; }
.photo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.photo-row-label { font-size: 13px; font-weight: 600; color: #374151; }
.sig-wrap { position: relative; border: 2px dashed #d1d5db; border-radius: 10px; background: #fff; }
#sigPad { display: block; width: 100%; height: auto; aspect-ratio: 900 / 260; touch-action: none; cursor: crosshair; }
#sigPad[hidden], #sigImg[hidden], .sig-line[hidden] { display: none; }
#sigImg { display: block; width: 100%; height: auto; }
.sig-line { position: absolute; left: 16px; right: 16px; bottom: 14px; border-top: 1px solid #d1d5db; padding-top: 4px; font-size: 12px; color: #9ca3af; pointer-events: none; }
.parts { display: flex; flex-direction: column; gap: 6px; }
.part-row { display: grid; grid-template-columns: minmax(140px, 1fr) auto minmax(100px, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.part-row.z-row-brauchbar { background: #f0fdf4; border-color: #bbf7d0; }
.part-row.z-row-defekt { background: #fef2f2; border-color: #fecaca; }
.part-row.z-row-ausgebaut { opacity: .6; }
.part-name { font-weight: 600; }
.part-seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.part-seg button { border: 0; background: #fff; padding: 6px 9px; font-size: 12px; cursor: pointer; border-right: 1px solid var(--line); white-space: nowrap; }
.part-seg button:last-child { border-right: 0; }
.part-seg button.active.z-unbekannt { background: #e5e7eb; }
.part-seg button.active.z-brauchbar { background: #16a34a; color: #fff; }
.part-seg button.active.z-defekt { background: #dc2626; color: #fff; }
.part-seg button.active.z-ausgebaut { background: #6b7280; color: #fff; }
.dlg .part-note { padding: 5px 8px; font-size: 13px; }
.icon-btn.small { font-size: 20px; }
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; }

/* Öffentliches Schaufenster */
body.shop { background: #111214; color: #fff; min-height: 100vh; }
.shop-head { display: flex; align-items: center; gap: 20px; padding: 24px 32px; background: linear-gradient(90deg, #1f2023, #2a2b30); }
.shop-logo { height: 52px; }
.shop-head h1 { margin: 0; font-size: 28px; }
.shop-head p { margin: 4px 0 0; opacity: .7; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; padding: 24px 32px; }
.shop-card { background: #fff; color: #111; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.shop-card.reserved { opacity: .75; }
.shop-img { position: relative; height: 230px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; }
.shop-img img { width: 100%; height: 100%; object-fit: cover; }
.shop-noimg { font-size: 64px; opacity: .3; }
.shop-badge { position: absolute; top: 12px; left: 12px; background: #f59e0b; color: #111; font-weight: 800; padding: 4px 12px; border-radius: 999px; }
.shop-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.shop-body h2 { margin: 0; font-size: 20px; }
.shop-details { margin: 0; color: #4b5563; font-size: 14px; }
.shop-text { margin: 4px 0; font-size: 14px; }
.shop-price { margin-top: auto; padding-top: 8px; font-size: 28px; font-weight: 800; color: var(--brand); }
.shop-empty { grid-column: 1 / -1; text-align: center; opacity: .7; font-size: 18px; padding: 60px 0; }
.shop-foot { text-align: center; opacity: .5; padding: 10px 0 30px; font-size: 13px; }

/* ================= Dienstfahrten ================= */
.page-fahrten { max-width: 980px; }
.btn-lg { padding: 14px 20px; font-size: 16px; border-radius: 12px; }
.btn-dark { background: #2e3137; color: #fff; }
.btn-dark:hover { background: #1f2126; }
.fa-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fa-head h2 { margin: 0; font-size: 24px; }
.fa-head .meta { margin: 2px 0 0; }
.fa-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fa-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-bottom: 16px; }
.running {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
    background: linear-gradient(135deg, #fff1f2, #fff); border: 2px solid #fecdd3; border-radius: 16px; padding: 14px 16px;
}
.running-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(229,9,20,.5); animation: runpulse 1.6s infinite; flex: 0 0 auto; }
@keyframes runpulse { 70% { box-shadow: 0 0 0 12px rgba(229,9,20,0); } 100% { box-shadow: 0 0 0 0 rgba(229,9,20,0); } }
.running-info { flex: 1 1 200px; }
.running-title { font-weight: 800; font-size: 17px; }
.running-sub { color: #374151; font-size: 14px; }
.month-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 4px 0 12px; }
.month-label { font-size: 18px; font-weight: 800; min-width: 170px; text-align: center; }
.icon-round { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.icon-round:disabled { opacity: .35; cursor: default; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.fa-filter { display: flex; gap: 8px; margin-bottom: 12px; }
.fa-filter select { flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.trip-list { display: flex; flex-direction: column; gap: 8px; }
.day-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 10px 2px 0; }
.trip {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.trip:hover { border-color: #c7cbd1; }
.trip-open { border: 2px solid #fecdd3; background: #fff7f7; }
.trip-icon { width: 42px; height: 42px; border-radius: 12px; background: #f3f4f6; display: grid; place-items: center; font-size: 21px; flex: 0 0 auto; }
.trip-main { flex: 1; min-width: 0; }
.trip-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-km { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; }
.trip-km b { font-size: 16px; }
.trip-km span { font-size: 13px; color: #15803d; font-weight: 600; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { font-size: 44px; }
.empty-state b { display: block; color: var(--text); margin: 6px 0 4px; }

.row-inline { display: flex; gap: 8px; }
.row-inline select { flex: 1; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.field-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.choice { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 13px; font-weight: 600; font-size: 14px; cursor: pointer; }
.choice.active { background: #2e3137; color: #fff; border-color: #2e3137; }
.quick-ziele { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.chip-sm { padding: 4px 10px; font-size: 12px; }
.km-box { background: #f9fafb; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.dlg .km-input { font-size: 26px; font-weight: 800; letter-spacing: 1px; padding: 10px 12px; }
.km-result { font-size: 16px; min-height: 1.2em; margin: 4px 0 8px; }
.cam-btn { width: 100%; padding: 12px; margin-top: 6px; }
.photo-pair { display: flex; gap: 8px; margin-top: 6px; }
.photo-pair .file-btn { flex: 1; }
.thumb-label { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; text-align: center; padding: 2px; }
details.more { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; margin-bottom: 12px; }
details.more > summary { cursor: pointer; padding: 11px 0; font-weight: 600; }
details.more[open] { padding-bottom: 10px; }
.beleg-btn { align-self: end; margin-bottom: 10px !important; }
.trip-summary { background: #fff7f7; border: 1px solid #fecdd3; border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.ts-row { display: flex; gap: 12px; align-items: center; font-size: 15px; }
.ts-row > span { font-size: 26px; }
.fz-list { display: flex; flex-direction: column; gap: 6px; }
.fz-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.fz-row .muted { flex: 1; }
.plate {
    font-family: "DIN 1451", "Arial Narrow", Arial, sans-serif; font-weight: 800; letter-spacing: 1px; font-size: 15px;
    border: 2px solid #111; border-left: 12px solid #1d4ed8; border-radius: 5px; padding: 2px 8px; background: #fff;
}
.rep-preview { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 10px 12px; font-weight: 600; margin: 4px 0 10px; }
.rep-preview:empty { display: none; }

/* Fahrten – vereinfachtes Formular */
.fa-add { margin-bottom: 16px; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.trip-form > label, .trip-form .grid label { margin-bottom: 12px; }
.route { display: flex; gap: 12px; background: #f9fafb; border: 1px solid var(--line); border-radius: 14px; padding: 12px 12px 4px; margin-bottom: 12px; }
.route-line { display: flex; flex-direction: column; align-items: center; padding: 30px 0 34px; }
.route-line .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.route-line .dot-a { border: 3px solid #6b7280; background: #fff; }
.route-line .dot-b { background: var(--brand); box-shadow: 0 0 0 3px rgba(229,9,20,.2); }
.route-line .bar { flex: 1; width: 2px; background: repeating-linear-gradient(#cbd5e1 0 5px, transparent 5px 9px); margin: 4px 0; }
.route-fields { flex: 1; min-width: 0; }
.route-fields label { margin-bottom: 10px !important; }
.route-fields .row-inline input { flex: 1; }
.km-panel { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.km-panel .km-label { margin-bottom: 4px !important; }
.km-panel input[name="km"] { font-size: 22px; font-weight: 800; max-width: 140px; }
.switch-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; margin: 8px 0 6px !important; cursor: pointer; font-size: 15px !important; }
.switch-row input { position: absolute; opacity: 0; width: 1px !important; pointer-events: none; }
.switch { width: 46px; height: 26px; border-radius: 999px; background: #d1d5db; position: relative; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch-row input:checked + .switch { background: #16a34a; }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 2px solid rgba(22,163,74,.4); outline-offset: 2px; }
.km-total { font-size: 17px; min-height: 1.3em; }
@media (max-width: 700px) { .stats.stats-3 { grid-template-columns: repeat(3, 1fr); gap: 6px; } .stats-3 .stat { padding: 8px 10px; } .stats-3 .stat-value { font-size: 15px; } }

/* ================= Tablet: Menü in eigener Zeile, mittig ================= */
@media (max-width: 1180px) {
    .topbar-inner { grid-template-columns: 1fr auto; row-gap: 10px; }
    .mainnav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: center; }
    .mainnav a { justify-content: center; }
}

/* ================= Handy-Ansicht ================= */
.m-only { display: none; }

@media (max-width: 700px) {
    .m-only { display: inline; }
    .d-only { display: none; }
    body { font-size: 15px; }
    body.has-bar { padding-bottom: 150px; }

    /* Kopfzeile kompakt: Menü als Icon-Leiste über die ganze Breite */
    .topbar-inner { padding: 8px 10px 10px; gap: 8px; }
    .brand-logo { height: 24px; }
    .brand-sub { display: none; }
    .usermenu-name { display: none; }
    .usermenu summary { padding: 3px 8px 3px 3px; }
    .mainnav { border-radius: 14px; padding: 3px; }
    .mainnav a { flex: 1 1 0; flex-direction: column; gap: 3px; padding: 7px 2px; border-radius: 11px; font-size: 10.5px; min-width: 0; }
    .mainnav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .ico { width: 20px; height: 20px; }

    /* Fahrten */
    .fa-actions { grid-template-columns: 1fr; }
    .fa-head-actions { width: 100%; }
    .fa-head-actions .btn { flex: 1; }
    .stats-4 { grid-template-columns: 1fr 1fr; }
    .running .btn-lg { width: 100%; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .dlg .grid-3 label:first-child { grid-column: span 2; }
    .choice { padding: 9px 12px; }

    /* Geräte */
    .view-head h2 { font-size: 19px; }
    .view-actions { width: 100%; }
    .view-actions .btn { flex: 1; }
    #ankaufBtn { padding: 12px; font-size: 16px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat { padding: 10px 12px; }
    .stat-value { font-size: 18px; }
    .device-grid { grid-template-columns: 1fr; gap: 10px; }
    .dev-card { flex-direction: row; }
    .dev-img { width: 110px; height: auto; min-height: 120px; flex: 0 0 110px; }
    .grid-vitrine .dev-card { flex-direction: column; }
    .grid-vitrine .dev-img { width: 100%; height: 190px; flex: none; }
    .part-row { grid-template-columns: 1fr auto; }
    .part-row .part-seg { grid-column: 1 / -1; order: 3; }
    .part-row .part-note { grid-column: 1 / -1; order: 4; }
    .part-seg button { flex: 1; padding: 9px 4px; }
    .dlg-foot-split .foot-left { width: 100%; }
    .dlg-foot-split .foot-left .btn { flex: 1 1 auto; font-size: 13px; padding: 9px 8px; }
    .dlg-foot-split .foot-right { width: 100%; }
    .thumbs-big .thumb { width: calc(50% - 4px); height: 150px; }
    .shop-head { padding: 16px; gap: 12px; }
    .shop-head h1 { font-size: 20px; }
    .shop-logo { height: 36px; }
    .shop-grid { padding: 16px; gap: 14px; }

    /* Filter wischbar in einer Zeile */
    .page { padding: 10px 10px; }
    .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -10px 10px; padding: 0 10px 4px; scrollbar-width: none; }
    .chips::-webkit-scrollbar { display: none; }
    .chip { flex: 0 0 auto; padding: 7px 12px; }
    .toolbar { gap: 8px; }
    .toolbar input[type=search] { flex: 1 1 100%; max-width: none; font-size: 16px; padding: 10px 14px; }
    .date-filter { font-size: 12px; }
    .date-filter input { font-size: 15px; padding: 6px 8px; }
    .toolbar .spacer { display: none; }
    #clearFilter { padding: 8px 10px; font-size: 13px; }
    #newBtn { flex: 1 1 100%; padding: 12px; font-size: 16px; }

    /* Tabelle wird zu Karten */
    .table-wrap { background: transparent; box-shadow: none; overflow: visible; max-height: none; }
    #table, #table tbody { display: block; }
    #table thead { display: none; }
    #tbody tr {
        display: grid;
        grid-template-columns: 30px auto 1fr auto;
        grid-template-areas:
            "check nr    art    status"
            ".     geraet geraet geraet"
            ".     teil   teil   preis"
            ".     qual   qual   menge"
            ".     lief   lief   lief"
            ".     notes  notes  notes"
            ".     erf    geaendert chat";
        column-gap: 8px; row-gap: 2px;
        background: #fff; border: 1px solid var(--line); border-radius: 12px;
        padding: 12px 12px 10px 8px; margin-bottom: 10px;
        box-shadow: 0 1px 2px rgba(0,0,0,.05);
    }
    #tbody tr td { display: block; padding: 0; border: 0; background: transparent !important; box-shadow: none !important; min-width: 0; }
    #tbody tr td:empty { display: none; }
    #tbody tr.selected { background: var(--sel); border-color: var(--sel-line); box-shadow: 0 0 0 2px var(--sel-line); }
    #tbody tr.checked { background: #eef2ff; border-color: #c7d2fe; }
    #tbody tr:hover td { background: transparent; }

    .c-check  { grid-area: check; align-self: start; }
    .c-check input { width: 20px; height: 20px; margin: 1px 0 0; }
    .c-nr     { grid-area: nr; font-size: 15px; }
    .c-art    { grid-area: art; font-size: 12px; align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .c-status { grid-area: status; justify-self: end; }
    .c-geraet { grid-area: geraet; margin-top: 4px; }
    .c-geraet .muted { display: inline; margin-left: 6px; }
    .c-geraet div { display: inline; }
    .c-teil   { grid-area: teil; font-size: 17px; margin-top: 2px; }
    .c-preis  { grid-area: preis; align-self: end; font-weight: 700; }
    .c-qual   { grid-area: qual; color: var(--muted); font-size: 13px; }
    .c-qual::before { content: "Qualität: "; }
    .c-menge  { grid-area: menge; color: var(--muted); font-size: 13px; }
    .c-menge::before { content: "Menge "; }
    .c-lief   { grid-area: lief; font-size: 13px; }
    .c-lief::before { content: "Lieferant: "; color: var(--muted); }
    .c-notes  { grid-area: notes; max-width: none; font-size: 13px; background: #f9fafb !important; border-radius: 8px; padding: 6px 8px !important; margin-top: 4px; }
    .c-erf    { grid-area: erf; font-size: 12px; color: var(--muted); align-self: center; margin-top: 6px; }
    .c-erf::before { content: "Erfasst "; }
    .c-geaendert { grid-area: geaendert; align-self: center; margin-top: 6px; display: flex !important; gap: 4px; flex-wrap: wrap; font-size: 11px; }
    .c-geaendert div:first-child::before { content: "· geändert "; }
    .c-geaendert:not(.has-ch) { display: none !important; }
    .c-chat   { grid-area: chat; justify-self: end; align-self: center; margin-top: 6px; }
    .chat-badge { padding: 6px 12px; font-size: 13px; }

    /* Aktionsleiste unten über die ganze Breite */
    .actionbar {
        left: 0; right: 0; bottom: 0; transform: none; width: 100%;
        border-radius: 16px 16px 0 0; border-width: 1px 0 0;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        gap: 8px;
    }
    .actionbar-info { flex: 1 1 100%; font-size: 13px; }
    .actionbar-buttons { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; gap: 6px; }
    .actionbar-bulk .actionbar-buttons { grid-template-columns: repeat(2, 1fr); }
    .actionbar-buttons .btn { padding: 11px 6px; font-size: 14px; }
    .toast { bottom: 150px; width: calc(100% - 32px); text-align: center; }

    /* Fenster als Vollbild */
    .dlg, .dlg-wide, .dlg-wide.with-chat {
        width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0;
    }
    .dlg > form { display: flex; flex-direction: column; height: 100%; }
    .dlg-head { padding: 12px 14px; }
    .dlg-body { flex: 1; max-height: none; padding: 14px; }
    .dlg-foot { border-radius: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
    .dlg-foot .btn { flex: 1; padding: 12px; font-size: 16px; }
    .dlg input, .dlg select, .dlg textarea, .chat-input textarea { font-size: 16px; padding: 10px 12px; }
    #confirmDlg, #orderDlg { height: auto; margin: auto auto 0; border-radius: 16px 16px 0 0; }
    #confirmDlg > form, #orderDlg > form { height: auto; }
    .grid { grid-template-columns: 1fr 1fr; gap: 0 10px; }
    .grid label:has(textarea), .span2, .span3 { grid-column: span 2; }
    .with-chat .entry-layout { grid-template-columns: 1fr; }
    .entry-layout { grid-auto-rows: max-content; align-content: start; }
    .chat { display: block; min-height: auto; }
    .chat-first .chat { order: -1; }
    .chat-list { display: flex; flex: none; max-height: 50vh; min-height: 60px; }
    .chat-quick button { padding: 6px 12px; font-size: 13px; }
}
