/* EcomPilot: Ergänzungen zum Designsystem (Dialoge, Formulare, Tabellen, Cockpit, Regeln, Dokumente). */
.wordmark { font-weight: 800; letter-spacing: -.035em; color: var(--ink); }
.wordmark i { font-style: normal; color: var(--accent); }
.brand-text b.wordmark { font-size: 1.12rem; }
.badge.alert { background: var(--bad-solid); color: #fff; animation: pulse-bad 2s infinite; }
@keyframes pulse-bad { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad-solid) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.demo-banner { gap: 10px; flex-wrap: wrap; }
.demo-banner .btn { min-height: 28px; }
.btn.danger-solid { background: var(--bad-solid); border-color: var(--bad-solid); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); background: var(--bad-solid); color: #fff; }
.btn.big { min-height: 48px; padding: 0 20px; font-size: 1rem; border-radius: 12px; }
.barcode-wrap { display: inline-block; line-height: 0; }
.barcode-wrap svg { display: block; max-width: 100%; height: auto; background: #fff; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); }
@media (min-width: 861px) { .brand { padding-bottom: 12px; } }

/* Dialoge */
.ep-backdrop { position: fixed; inset: 0; z-index: 220; background: var(--scrim); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: grid; place-items: center; padding: 16px; animation: fade .18s ease both; }
.ep-modal { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; animation: pop .2s var(--ease) both; }
.ep-modal.wide { width: min(940px, 100%); }
.ep-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 14px 22px; border-bottom: 1px solid var(--line); }
.ep-modal-head h2 { margin: 0; font-size: 1.1rem; }
.ep-modal-body { padding: 18px 22px; overflow: auto; }
.ep-modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 210; background: var(--scrim); backdrop-filter: blur(4px); animation: fade .18s ease both; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 211; width: min(760px, 100vw); background: var(--bg); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); overflow: auto; animation: drawer-in .25s var(--ease) both; display: flex; flex-direction: column; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drawer-body { padding: 20px 22px 60px; display: grid; gap: 16px; align-content: start; }

/* Formulare */
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.formgrid .span2 { grid-column: span 2; }
.formgrid .full { grid-column: 1 / -1; }
.toggle { display: inline-flex; align-items: center; gap: 9px; font-weight: 560; font-size: .92rem; cursor: pointer; }
.toggle + .toggle { margin-left: 14px; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }
.field.compact span { font-size: .78rem; }
input.sm, select.sm { min-height: 32px; padding: 4px 8px; font-size: .88rem; border-radius: 8px; }
.pwd-dots { letter-spacing: .3em; }
.check-grid { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0; }
.check-grid label { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; }

/* Filterleisten */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filterbar .grow { flex: 1 1 220px; min-width: 180px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 620; font-size: .85rem; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg .count { font-variant-numeric: tabular-nums; font-size: .72rem; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.seg .count.hot { background: var(--bad-soft); color: var(--bad); }

/* Tabellen */
tr.clickable { cursor: pointer; }
tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
.table-actions { display: inline-flex; gap: 6px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-sub { display: block; color: var(--muted); font-size: .8rem; }
.dot-client { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.age-hot { color: var(--bad); font-weight: 700; }
.age-warm { color: var(--warn); font-weight: 650; }

/* Cockpit */
.cp-top { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.cp-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.stat .value.big { font-size: clamp(1.8rem, 1.2rem + 1.4vw, 2.5rem); }
.stat.alert-tile { border-color: var(--bad-line); background: linear-gradient(180deg, var(--bad-soft), transparent 80%), var(--surface); }
.stat.good-tile { border-color: var(--ok-line); }
.pickup { display: grid; gap: 10px; }
.pickup-row { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: 4px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.pickup-row.ok { border-color: var(--ok-line); }
.pickup-row.tight { border-color: var(--warn-line); background: var(--warn-soft); }
.pickup-row.late { border-color: var(--bad-line); background: var(--bad-soft); }
.pickup-row .name { font-weight: 650; }
.pickup-row .big { font-size: 1.25rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-align: right; }
.pickup-row .sub { grid-column: 1 / -1; font-size: .84rem; color: var(--muted); }
.stationcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.stcard { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface-2); display: grid; gap: 6px; }
.stcard.busy { border-color: var(--accent-line); background: var(--accent-soft); }
.stcard.wait { border-color: var(--warn-line); background: var(--warn-soft); }
.stcard b { font-size: .98rem; }
.alertlist { display: grid; gap: 8px; }
.alertitem { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; }
.alertitem.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.alertitem.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.alertitem:hover { filter: brightness(.98); }
.hourbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; align-items: end; height: 150px; }
.hourbars .col { display: grid; align-items: end; height: 100%; text-align: center; }
.hourbars .bar { background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.hourbars .lbl { font-size: .7rem; color: var(--muted); margin-top: 4px; }
.hourbars .val { font-size: .72rem; font-weight: 650; }
.bar-now .bar { background: var(--ramp-2); }

/* Notfälle */
.sev-card { border-left: 4px solid var(--line); display: grid; gap: 8px; }
.sev-notfall { border-left-color: var(--bad-solid); }
.sev-warnung { border-left-color: var(--warn-dot); }
.sev-beobachten { border-left-color: var(--faint); }
.emergency-hero { border-color: var(--bad-line); background: linear-gradient(135deg, var(--bad-soft), transparent 60%), var(--surface); }
.ok-hero { border-color: var(--ok-line); background: linear-gradient(135deg, var(--ok-soft), transparent 60%), var(--surface); }
.briefing { white-space: pre-wrap; line-height: 1.6; }

/* Bestellung */
.kvgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 20px; }
.kvgrid > div > span { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.kvgrid > div > b { font-weight: 640; }
.decision { display: grid; gap: 10px; }
.decrow { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 14px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.decrow:last-child { border-bottom: 0; }
.decrow > span { color: var(--muted); font-size: .84rem; font-weight: 600; }
.decrow small { display: block; color: var(--muted); }
.trace { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.trace li { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; padding: 6px 10px; border-radius: 9px; background: var(--surface-2); }
.trace li.hit { background: var(--ok-soft); }
.trace li.stop { box-shadow: inset 3px 0 0 var(--warn-dot); }
.trace .why { color: var(--muted); }
.pricebox { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pricebox > div { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.pricebox span { display: block; font-size: .74rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.pricebox b { font-size: 1.25rem; letter-spacing: -.02em; }
.warnlist { margin: 0; padding-left: 18px; }
.tabs.inner { margin-bottom: 14px; }

/* Regeln */
.rule { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.rule.off { opacity: .55; }
.rule .num-badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-weight: 750; font-size: .85rem; }
.rule .when { color: var(--ink-2); font-size: .9rem; }
.rule .then { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rule .then .chip { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.rule-list { display: grid; gap: 10px; }
.rule.drag-over { outline: 2px dashed var(--accent); }
.rule .arrows { display: grid; gap: 4px; }
.rule .arrows button { width: 28px; height: 22px; padding: 0; }
.builder { display: grid; gap: 18px; }
.builder h3 { margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.builder .box { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.impact { margin-top: 12px; }

/* Absender, Verträge, Karten */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.addrcard { display: grid; gap: 8px; align-content: start; }
.addrcard .addr { white-space: pre-line; color: var(--ink-2); font-size: .92rem; line-height: 1.5; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--line); }
.billing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 14px; }
.code { font-family: var(--mono); letter-spacing: .04em; }

/* Abrechnung */
.report-total { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.margin-pos { color: var(--ok); font-weight: 700; }
.margin-neg { color: var(--bad); font-weight: 700; }
tr.totalrow td { font-weight: 750; border-top: 2px solid var(--ink); }

/* Zoll und Dokumente */
.docgrid { display: grid; gap: 14px; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hs-code { font-family: var(--mono); font-weight: 650; }
.missing { color: var(--bad); font-weight: 600; }
.info-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .9rem; }

/* Barcodes in der Oberfläche */
.codecard { display: grid; gap: 6px; justify-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); text-align: center; }
.empty-compact { padding: 18px; }

@media (max-width: 1180px) { .cp-top { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cp-main { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .cp-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pricebox { grid-template-columns: 1fr; } .decrow { grid-template-columns: 1fr; } .formgrid .span2 { grid-column: auto; } .rule { grid-template-columns: auto minmax(0, 1fr); } .rule .arrows, .rule .ract { grid-column: 1 / -1; } }

/* Filterleisten: Auswahlfelder nicht über die ganze Breite ziehen */
.filterbar select, .filterbar input[type=date] { width: auto; min-width: 190px; max-width: 100%; }
.filterbar .searchfield { min-width: 220px; }
.page { padding-bottom: 20px; }

/* Wareneingang (Büro): großes Scanfeld, Vorschläge als antippbare Zeilen */
.we-scan { font-family: var(--mono); font-size: 1.15rem; letter-spacing: .04em; min-height: 48px; }
.we-qty { font-size: 1.4rem; font-weight: 700; min-height: 52px; max-width: 220px; }
.we-card { margin-top: 16px; }
.we-head { display: flex; gap: 16px; align-items: flex-start; }
.we-img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.we-opt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; text-align: left; width: 100%; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); font: inherit; }
.we-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.we-opt .code { font-size: 1.15rem; }
@media (hover: hover) { .we-opt:hover { border-color: var(--accent); } }

/* Auslastung eines Lagerplatzes: schmaler Balken mit Prozent */
.fillbar { position: relative; width: 110px; height: 18px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.fillbar i { position: absolute; inset: 0 auto 0 0; background: var(--ok); border-radius: 99px; }
.fillbar i.hi { background: var(--warn-dot); }
.fillbar i.over { background: var(--bad-solid); }
.fillbar span { position: relative; display: block; text-align: center; font-size: .74rem; font-weight: 650; line-height: 18px; color: var(--ink); mix-blend-mode: normal; }

/* Lagerplan zeichnen (views/lagerplan.js): Zeichenfläche links, Einstellungen rechts; Raster, Reihen, Wände, Türen, Packplatz */
.lp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.lp-canvas { height: min(68vh, 640px); min-height: 320px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); overflow: hidden; position: relative; }
.lp-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; user-select: none; -webkit-user-select: none; }
.lp-svg:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.lp-svg.draw { cursor: crosshair; }
.lp-hall { fill: var(--surface); stroke: var(--line-strong); stroke-width: 6; }
.lp-gridline { fill: none; stroke: var(--grid); stroke-width: 2; }
.lp-row { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; cursor: move; }
.lp-rowg.haz .lp-row { fill: var(--warn-soft); stroke: var(--warn-dot); }
.lp-rowg.sel .lp-row { stroke-width: 7; stroke-dasharray: 18 8; }
.lp-rowg.bad .lp-row { fill: var(--bad-soft); stroke: var(--bad); }
.lp-div { stroke: var(--accent); stroke-width: 1.5; opacity: .6; pointer-events: none; }
.lp-face { stroke: var(--accent-deep); stroke-width: 10; stroke-linecap: butt; pointer-events: none; }
.lp-rowg.haz .lp-face { stroke: var(--warn-dot); }
.lp-txt { fill: var(--ink-2); pointer-events: none; font-weight: 650; }
.lp-wall { stroke: var(--ink-2); stroke-width: 12; stroke-linecap: square; }
.lp-door { stroke: var(--warn-dot); stroke-width: 12; stroke-linecap: butt; }
.lp-wall.sel, .lp-door.sel { stroke-width: 18; opacity: .85; }
.lp-wall.bad, .lp-door.bad { stroke: var(--bad); }
.lp-hit { stroke: transparent; stroke-width: 34; cursor: move; }
.lp-pack { fill: var(--ok); stroke: var(--surface); stroke-width: 5; cursor: move; }
.lp-packg.sel .lp-pack { stroke: var(--ink); stroke-width: 8; }
.lp-packtxt { fill: #fff; font-weight: 800; pointer-events: none; }
.lp-tourline { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 10 8; opacity: .55; }
.lp-tourdot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.lp-tourtxt { fill: #fff; font-weight: 700; }
.lp-panel { display: grid; gap: 12px; }
.lp-card h3 { margin: 0 0 10px; font-size: 1rem; }
.lp-card .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lp-card .formgrid .span2 { grid-column: 1 / -1; }
.lp-card .field input, .lp-card .field select { min-width: 0; width: 100%; }
.lp-list { margin: 6px 0 0; padding-left: 18px; }
.lp-legend { margin: 8px 2px 0; }
.lp-dirty { color: var(--warn); font-weight: 650; }
.lp-bar { align-items: center; }
@media (max-width: 980px) { .lp-grid { grid-template-columns: minmax(0, 1fr); } .lp-canvas { height: min(60vh, 520px); } }

/* Messen & Wiegen (views/messen.js) */
.ms-vals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.ms-vals .field input { font-size: 1.35rem; font-weight: 700; min-height: 52px; font-variant-numeric: tabular-nums; }
.ms-dev { display: grid; gap: 6px; margin-top: 12px; }
.ms-dev .row { align-items: center; gap: 8px; flex-wrap: wrap; }
