:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel2: #f1f5f9;
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.65);
  /* abgeleitet von rifa-kanttechnik.de (Divi Default Blue) */
  --accent: #2ea3f2;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --border: rgba(15, 23, 42, 0.18);
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, #ffffff 60%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.container.wide { max-width: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .container { padding-top: 6px; padding-bottom: 6px; }
.topbar .row { padding: 0 !important; min-height: 50px; gap: 8px; }

.prod-top { padding: 0; gap: 8px; min-height: 50px; align-items: center; }
.page-production .pill { padding: 4px 10px; }
.topbar .brand {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  padding-left: 85px;
  background: url("/assets/rifa-weblogo.svg") left center / auto auto no-repeat;
  min-height: 42px;
  justify-content: center;
}
.topbar .brand-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}
.topbar .brand-logo {
  display: inline-block;
  width: 77px;
  min-width: 77px;
  height: 42px;
  background: url("/assets/rifa-weblogo.svg") left center / auto auto no-repeat;
}
.topbar .brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
  min-height: 42px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand-title { font-size: 15px; }
.brand-sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.topbar .btn {
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
}
.topbar .btn:not(.top-logout):not(.admin-shortcut):not(.dashboard-shortcut):not(.mode-btn) {
  background: rgba(241, 245, 249, 0.95);
  border-color: var(--border);
  color: var(--text);
}
.topbar .btn.primary:not(.top-logout):not(.admin-shortcut):not(.dashboard-shortcut):not(.mode-btn),
.topbar .btn.ghost:not(.top-logout):not(.admin-shortcut):not(.dashboard-shortcut):not(.mode-btn),
.topbar .btn.danger:not(.top-logout):not(.admin-shortcut):not(.dashboard-shortcut):not(.mode-btn) {
  background: rgba(241, 245, 249, 0.95);
  border-color: var(--border);
  color: var(--text);
}
.topbar .btn:not(.top-logout):not(.admin-shortcut):not(.dashboard-shortcut):not(.mode-btn):hover {
  border-color: rgba(46, 163, 242, 0.55);
}
.topbar .btn.prod-warehouse-btn.primary:not(.top-logout):not(.admin-shortcut):not(.dashboard-shortcut):not(.mode-btn) {
  background: rgba(250, 204, 21, 0.35);
  border-color: #ca8a04;
  color: #111827;
}
.topbar .top-logout,
.topbar .admin-shortcut,
.topbar .dashboard-shortcut { min-width: 38px; padding-left: 10px; padding-right: 10px; }
.topbar .top-logout { font-weight: 700; }
.topbar .top-logout {
  background: #dc2626;
  border-color: var(--border);
  color: #ffffff;
}
.topbar .top-logout:hover { filter: brightness(0.95); }
.topbar .dashboard-shortcut { order: 997; text-decoration: none; }
.topbar .admin-shortcut { order: 998; text-decoration: none; }
.topbar form[action="/logout"] { order: 999; }
.topbar .prod-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar .prod-mode-group .mode-btn {
  min-width: 108px;
}
.page-production .prod-top .prod-spacer-tight {
  flex: 0 0 0;
}
.page-production .prod-top .prod-mode-group.mode-two {
  flex: 1 1 340px;
  min-width: 220px;
}
.page-production .prod-top .prod-mode-group.mode-two .mode-btn {
  flex: 1 1 0;
  min-width: 0;
}
.page-production .prod-search {
  width: clamp(120px, 16vw, 200px);
  min-width: 120px;
  padding: 8px 12px !important;
  font-size: 15px !important;
  min-height: 40px;
  transition: width 0.18s ease, min-width 0.18s ease;
}
.page-production .prod-search:focus {
  width: min(420px, 40vw);
  min-width: 220px;
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 1100px) {
  .grid-2 { grid-template-columns: 1.25fr 0.75fr; }
}
.stack { display: flex; flex-direction: column; gap: 12px; }

.brand { font-weight: 700; letter-spacing: 0.2px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.95);
  color: var(--muted);
  font-size: 13px;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(241, 245, 249, 0.95);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
a.btn { text-decoration: none; display: inline-flex; }
.btn.block { display: block; width: 100%; text-align: left; }
.btn:hover { border-color: rgba(46, 163, 242, 0.55); }
.btn.primary { background: rgba(46, 163, 242, 0.18); border-color: rgba(46, 163, 242, 0.45); }
.btn.danger { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.45); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ui {
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
  line-height: 1;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 14px;
  padding: 14px;
}

.offer-head-grid {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) minmax(420px, 0.72fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}
.offer-head-block {
  border-radius: 12px;
  padding: 12px;
}
.offer-data-card {
  display: flex;
  flex-direction: column;
  align-content: start;
  gap: 10px;
}
.offer-head-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 0;
}
.offer-field-short { width: auto; flex: 0 0 auto; min-width: 92px; }
.offer-field-date { width: auto; flex: 0 0 auto; min-width: 0; }
.offer-field-half { flex: 1 1 0; min-width: 0; }
.offer-field-medium { flex: 1 1 320px; min-width: 220px; }
.offer-field-info { flex: 1 1 320px; min-width: 220px; }
.offer-head-row input:not([type="checkbox"]):not([type="radio"]),
.offer-head-row select,
.offer-head-row .btn {
  min-height: 38px;
  height: 38px;
  box-sizing: border-box;
}
.offer-date-input { width: auto; min-width: 0; }
.offer-percent-input { width: auto; min-width: 0; max-width: 82px; }
.offer-info-textarea {
  min-height: 38px;
  height: 38px;
  resize: none;
  overflow: hidden;
}

.offer-summary-card { margin: 0; padding-right: 18px; }
.offer-summary-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(270px, 1.05fr);
  gap: 14px 20px;
  margin-top: 10px;
}
.offer-summary-col {
  display: grid;
  gap: 6px;
}
.offer-summary-item {
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
}
.offer-summary-item b { color: var(--text); }
.offer-summary-ratio { color: var(--muted); margin-left: 8px; }
.offer-summary-item-title { font-weight: 700; color: var(--text); }
.offer-summary-item-spacer { min-height: 1.35em; }

.offer-lines-wrap.table-wrap { overflow: auto; border-radius: 0; }
.offer-lines-table { min-width: 1450px; border-collapse: collapse; }
.offer-lines-table thead th { white-space: nowrap; padding: 6px 8px; }
.offer-lines-table tbody td { padding: 4px 2px; vertical-align: middle; }
.offer-lines-table .btn { width: 100%; min-width: 0; min-height: 34px; padding: 6px 8px; }
.offer-lines-table input[type="text"],
.offer-lines-table input[type="number"],
.offer-lines-table input[type="date"] {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 5px 6px;
  border-radius: 0 !important;
}
.offer-lines-table input.is-readonly {
  background: #f8fafc;
  color: var(--muted);
}
.offer-readonly-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}
.offer-readonly-fieldset input:disabled,
.offer-readonly-fieldset select:disabled,
.offer-readonly-fieldset textarea:disabled {
  background: #edf2f7;
  color: #64748b;
  border-color: #cbd5e1;
  opacity: 1;
  cursor: not-allowed;
}
.offer-data-card input[disabled],
.offer-data-card input:disabled,
.offer-data-card select[disabled],
.offer-data-card select:disabled,
.offer-data-card textarea[disabled],
.offer-data-card textarea:disabled {
  background: #edf2f7;
  color: #64748b;
  border-color: #cbd5e1;
  -webkit-text-fill-color: #64748b;
  opacity: 1;
  cursor: not-allowed;
}
.offer-lines-table input[disabled],
.offer-lines-table input:disabled,
.offer-lines-table select[disabled],
.offer-lines-table select:disabled,
.offer-lines-table textarea[disabled],
.offer-lines-table textarea:disabled {
  background: #edf2f7 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
  -webkit-text-fill-color: #64748b;
  opacity: 1 !important;
  cursor: not-allowed;
}
.offer-lines-table td:has(input:disabled),
.offer-lines-table td:has(select:disabled),
.offer-lines-table td:has(textarea:disabled) {
  background: rgba(226, 232, 240, 0.28);
}
.offer-readonly-fieldset .offer-value-text {
  color: #64748b;
}
.offer-readonly-fieldset .offer-line-remove:disabled {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #94a3b8;
  opacity: 1;
}
.offer-lines-table select[data-field="material_code"] {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 0 !important;
  background: #fff;
  box-shadow: none;
}
.offer-lines-table .btn { justify-content: center; }
.offer-lines-table .offer-line-remove {
  min-height: 34px;
  height: 34px;
  border-radius: 0 !important;
  padding: 0;
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}
.offer-lines-table .offer-line-remove:hover {
  background: #b91c1c;
  border-color: #991b1b;
  color: #ffffff;
}
.offer-lines-table tbody tr:hover { background: rgba(46, 163, 242, 0.05); }
.offer-cell-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}
.offer-value-text {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .offer-head-grid { grid-template-columns: 1fr; }
  .offer-summary-grid { grid-template-columns: 1fr; }
  .offer-head-row { flex-wrap: wrap; }
  .offer-data-card { gap: 10px; }
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: rgba(241, 245, 249, 0.98);
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
thead th.th-sortable { cursor: pointer; user-select: none; }
thead th.th-sortable:hover { background: rgba(226, 232, 240, 0.98); }
thead th.th-sortable.sorted-asc::after { content: " \25B2"; font-size: 11px; color: var(--muted); }
thead th.th-sortable.sorted-desc::after { content: " \25BC"; font-size: 11px; color: var(--muted); }
tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: top;
}
tbody tr:hover { background: rgba(46, 163, 242, 0.09); }
.td-click { cursor: pointer; }
.wh-stock-selected { outline: 2px solid rgba(46, 163, 242, 0.55); outline-offset: -2px; }

.app-toast-host {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.app-toast {
  min-width: 240px;
  max-width: min(92vw, 520px);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.app-toast.show { opacity: 1; transform: translateY(0); }
.app-toast.ok { border-color: rgba(34, 197, 94, 0.45); color: #166534; }
.app-toast.err { border-color: rgba(239, 68, 68, 0.55); color: #991b1b; }

/* Production list: full width + scroll container + sticky header */
.page-production {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel2: #ffffff;
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.65);
  --border: rgba(15, 23, 42, 0.18);
}
body.page-production { background: #ffffff; color: var(--text); overflow: hidden; }
.page-production .topbar { background: rgba(255, 255, 255, 0.96); backdrop-filter: none; }
.page-production .pill { background: rgba(255, 255, 255, 0.92); color: var(--muted); }
.page-production .btn { background: rgba(15, 23, 42, 0.04); color: var(--text); }
.page-production .btn.primary {
  background: rgba(46, 163, 242, 0.18);
  border-color: rgba(46, 163, 242, 0.45);
}
.page-production .topbar .top-logout {
  background: #dc2626;
  border-color: var(--border);
  color: #ffffff;
}
.page-production .btn.ghost { background: transparent; }
.page-production a { color: #0b76d1; }
.page-production dialog { background: #ffffff; color: var(--text); }
.page-production dialog .card { background: rgba(248, 250, 252, 0.98); }
.page-production .msg { background: rgba(248, 250, 252, 0.98); color: var(--text); border-color: rgba(15, 23, 42, 0.15); }
.page-production .msg.ok { border-color: rgba(34, 197, 94, 0.45); color: rgba(21, 128, 61, 1); }
.page-production .msg.err { border-color: rgba(239, 68, 68, 0.55); color: rgba(185, 28, 28, 1); }

.page-production label { color: rgba(15, 23, 42, 0.75); font-size: 14px; }
.page-production select,
.page-production input[type="text"],
.page-production input[type="password"],
.page-production input[type="number"],
.page-production textarea {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.2);
  padding: 14px 14px;
  font-size: 18px;
}
.page-production select { min-height: 52px; }
.page-production select:focus,
.page-production input:focus,
.page-production textarea:focus { outline: 2px solid rgba(46, 163, 242, 0.35); border-color: rgba(46, 163, 242, 0.75); }

.page-production input[type="color"] {
  width: 56px;
  min-width: 56px;
  height: 52px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #ffffff;
}
.page-production input[type="color"]::-webkit-color-swatch-wrapper { padding: 6px; }
.page-production input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 10px; }
.page-production input[type="color"]::-moz-color-swatch { border: 0; border-radius: 10px; }

.dlg-card { border-color: rgba(15, 23, 42, 0.15); }
.dlg-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; align-items: center; }
.dlg-l { color: rgba(15, 23, 42, 0.72); font-weight: 700; font-size: 14px; }
.dlg-v { color: var(--text); font-size: 16px; }

.page-production .container { max-width: none; }
.page-production .prod-body { height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; overflow: hidden; padding-top: 10px; padding-bottom: 12px; }
.page-production .prod-body #msg { flex: 0 0 auto; }
.page-production .prod-body .table-wrap { flex: 1 1 auto; max-height: none; background: #ffffff; }
.page-production .prod-warehouse-panel { flex: 1 1 auto; min-height: 0; border: 1px solid rgba(15, 23, 42, 0.14); background: #ffffff; }
.page-production .prod-warehouse-panel iframe { width: 100%; height: 100%; border: 0; display: block; background: #ffffff; }
.page-production .prod-body.warehouse-mode { padding-top: 8px; padding-bottom: 0; }
.page-production .prod-body.warehouse-mode .prod-warehouse-panel { border: 0; border-radius: 0; }
.page-lager .prod-body { overflow: auto; }
.page-lager-view .prod-body { padding-left: 8px; padding-right: 8px; }
.page-production .table-wrap { overflow: auto; }
.page-production thead th { background: rgba(248, 250, 252, 0.98); }
.page-production tbody td { border-bottom-color: rgba(15, 23, 42, 0.1); }
.page-production tbody tr:hover { background: rgba(46, 163, 242, 0.10); }
.page-production table { border-collapse: separate; border-spacing: 0; }
.page-production thead th { position: sticky; top: 0; z-index: 2; }
.page-production thead th { box-shadow: 0 1px 0 rgba(15, 23, 42, 0.12); }

/* Android-App: argb(50,0,255,0) / argb(50,255,128,0) / argb(50,255,0,0) */
.job--today { background: rgba(0, 255, 0, 0.1960784314); }
.job--overdue { background: rgba(255, 128, 0, 0.1960784314); }
.job--overdue-fix { background: rgba(255, 0, 0, 0.1960784314); }

.wh-mv-in td { background: rgba(34, 197, 94, 0.08); }
.wh-mv-out td { background: rgba(239, 68, 68, 0.08); }
.wh-mv-move td { background: rgba(46, 163, 242, 0.08); }

.page-production thead th { font-size: 14px; }
.page-production tbody td { font-size: 16px; padding: 14px 12px; }
.page-production .topbar .btn { padding: 0 12px; font-size: 14px; }
.page-production .topbar .btn:not(.top-logout):not(.admin-shortcut):not(.dashboard-shortcut):not(.mode-btn) {
  background: rgba(241, 245, 249, 0.95);
  border-color: var(--border);
  color: var(--text);
}

.btn.mode-btn.primary.mode-schere { background: rgba(46, 163, 242, 0.18); border-color: rgba(46, 163, 242, 0.45); }
.btn.mode-btn.primary.mode-fertigung { background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.45); }
.btn.mode-btn.primary.mode-abholung { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.45); }
.page-production .mode-btn,
.page-production .prod-warehouse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mode-btn-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}
.mode-btn-icon-cut { background-image: url("/assets/cut-icon.svg"); }
.mode-btn-icon-user { background-image: url("/assets/user-icon.svg"); }
.mode-btn-icon-production { background-image: url("/assets/production-icon.svg"); }
.mode-btn-icon-pickup { background-image: url("/assets/pickup-icon.svg"); }
.mode-btn-icon-warehouse { background-image: url("/assets/warehouse-icon.svg"); }
.mode-btn-icon-stock { background-image: url("/assets/stock-icon.svg"); }
.mode-btn-icon-list { background-image: url("/assets/list-icon.svg"); }
.mode-btn-icon-book { background-image: url("/assets/book-icon.svg"); }
.mode-btn-icon-folder { background-image: url("/assets/folder-icon.svg"); }
.mode-btn-icon-pdf { background-image: url("/assets/pdf-icon.svg"); background-size: 20px 20px; }
.pdf-mode-toggle {
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  align-self: center;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.pdf-mode-toggle .mode-btn-icon-pdf {
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.pdf-mode-toggle.is-external .mode-btn-icon-pdf {
  filter: grayscale(1) saturate(0) brightness(0.62);
  opacity: 0.82;
}
.pdf-mode-toggle.is-internal .mode-btn-icon-pdf {
  filter: none;
  opacity: 1;
}
.btn-icon-pdf,
.btn-icon-folder,
.btn-icon-copy,
.btn-icon-print,
.btn-icon-mail,
.btn-icon-customer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 22px 22px;
  text-decoration: none;
  color: transparent !important;
}
.btn-icon-pdf { background-image: url("/assets/pdf-icon.svg"); background-size: 30px 30px; }
.btn-icon-folder { background-image: url("/assets/folder-icon.svg"); background-size: 24px 24px; }
.btn-icon-copy { background-image: url("/assets/copy-icon.svg"); background-size: 22px 22px; }
.btn-icon-print { background-image: url("/assets/printer-icon.svg"); }
.btn-icon-mail { background-image: url("/assets/mail-icon.svg"); }
.btn-icon-customer { background-image: url("/assets/user-icon.svg"); }
.btn-icon-pdf:hover,
.btn-icon-folder:hover,
.btn-icon-copy:hover { filter: brightness(1.06); }
.btn-icon-print:hover,
.btn-icon-mail:hover,
.btn-icon-customer:hover { filter: brightness(1.06); }

.offer-delete-x {
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}
.offer-delete-x:hover {
  background: #b91c1c;
  border-color: #991b1b;
}
.page-production .btn-icon-pdf {
  border: 0;
  border-radius: 0;
  background-color: transparent;
}
.page-production .btn-icon-folder {
  border: 0;
  border-radius: 0;
  background-color: transparent;
}
.page-production th.col-pdf,
.page-production td.td-pdf { text-align: center; }
.page-production td.td-pdf { vertical-align: middle; }

/* Lager: Grundriss + Lagerplaetze */
.lager-layout { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 1100px) {
  .lager-layout { grid-template-columns: 1.35fr 0.65fr; }
}
.page-lager-view .lager-layout { grid-template-columns: 1fr; }

.plan-stage {
  position: relative;
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}
.plan-stage img { width: 100%; height: auto; display: block; }
.plan-stage--empty { min-height: 260px; display: flex; align-items: center; justify-content: center; color: var(--muted); }

.plan-overlay { position: absolute; inset: 0; }
.plan-overlay.draw-mode { touch-action: none; cursor: crosshair; }

.wh-loc {
  position: absolute;
  border: 2px solid rgba(15, 23, 42, 0.55);
  border-radius: 0;
  background: #c0c0c0;
  padding: 6px 8px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  color: #000000;
}
.wh-loc:hover { border-color: rgba(46, 163, 242, 0.85); }
.wh-loc.selected { outline: 3px solid rgba(46, 163, 242, 0.55); border-color: rgba(46, 163, 242, 0.95); }
.wh-loc.stock-highlight {
  z-index: 3;
  border-color: #92400e;
  outline: 4px solid rgba(245, 158, 11, 0.95);
  outline-offset: -2px;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.95), inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}
.wh-loc.inactive { opacity: 0.45; border-style: dashed; }
.wh-loc.preview { border-style: dashed; pointer-events: none; }

.wh-draft {
  position: absolute;
  border: 2px dashed rgba(46, 163, 242, 0.95);
  background: rgba(46, 163, 242, 0.15);
  border-radius: 0;
  pointer-events: none;
}

.wh-list { display: flex; flex-direction: column; gap: 10px; max-height: 56vh; overflow: auto; padding-right: 4px; }
.wh-admin-grid { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
@media (min-width: 900px) {
  .wh-admin-grid { grid-template-columns: 0.62fr 0.38fr; }
}

.fix { color: rgba(255, 0, 0, 0.95); font-weight: 800; }
.td-multiline { white-space: pre-line; }

.pdf-dlg { width: calc(100vw - 24px); max-width: none; height: calc(100vh - 24px); }
.pdf-dlg { display: flex; flex-direction: column; }
.pdf-dlg .dlg-head { display: flex; align-items: center; gap: 10px; }
.pdf-body { padding: 10px; overflow: hidden; flex: 1 1 auto; }
.pdf-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #ffffff; }
.frame-dlg {
  width: min(1200px, calc(100vw - 24px));
  max-width: none;
  height: min(90vh, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
}
.frame-dlg:not([open]) { display: none !important; }
.frame-dlg .dlg-body { padding: 0; overflow: hidden; flex: 1 1 auto; }
.frame-dlg iframe { width: 100%; height: 100%; border: 0; display: block; background: #ffffff; }
.order-edit-dlg {
  width: calc(100vw - 24px);
  max-width: none;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.order-edit-dlg .dlg-body {
  padding: 0;
  overflow: hidden;
  max-height: calc(100vh - 24px);
  flex: 1 1 auto;
}
.order-edit-dlg .order-edit-host {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: transparent;
}
.order-edit-dlg .order-edit-host .card {
  padding: 10px;
  height: 100%;
  border-radius: 0;
}
.order-edit-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.order-edit-shell-head {
  flex: 0 0 auto;
}
.order-edit-shell-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
  .order-edit-shell-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  padding-right: 0;
  display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .order-edit-shell-source {
    flex: 0 0 auto;
    min-height: 0;
    padding-top: 10px;
  }
.order-edit-top-row {
  display: grid;
  grid-template-columns: max-content max-content max-content max-content max-content minmax(180px, 1fr);
  gap: 8px;
  align-items: start;
}
.order-edit-top-row > div {
  min-width: 0;
}
.order-edit-top-number .pill {
  justify-content: flex-start;
  min-height: 38px;
}
.order-edit-top-row .pill,
.order-edit-top-row input,
.order-edit-top-row select,
.order-canceled-inline {
  min-height: 38px;
}
.order-edit-top-coater {
  min-width: 180px;
}
.order-edit-invoiced {
  flex: 0 1 auto;
  min-width: 0;
}
.order-edit-shell-foot {
  flex: 0 0 auto;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
}
.order-edit-head-actions .btn,
.order-edit-head-actions form .btn {
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.order-edit-head-actions .order-head-btn {
  min-width: 0;
  width: auto;
  text-align: center;
}
.order-edit-head-actions .order-head-btn.with-icon {
  gap: 8px;
}
.order-edit-head-actions .order-head-btn.icon-only {
  min-width: 38px;
  width: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
.order-edit-head-actions .btn-icon-pdf.order-head-btn.icon-only {
  background-size: 30px 30px;
}
.order-edit-head-actions .btn-icon-print.order-head-btn.icon-only,
.order-edit-head-actions .btn-icon-mail.order-head-btn.icon-only,
.order-edit-head-actions .btn-icon-customer.order-head-btn.icon-only {
  background-size: 24px 24px;
}
.order-edit-head-actions .order-label-type-select {
  min-height: 38px;
  height: 38px;
  padding-top: 0;
  padding-bottom: 0;
}
.order-edit-head-actions .btn-static {
  opacity: 1;
  cursor: default;
  pointer-events: none;
  color: var(--muted);
}
.order-edit-head-actions form {
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.order-value-label {
  display: block;
  text-align: center;
}
.order-canceled-inline {
  display: inline-flex;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
}
.order-canceled-inline span {
  font-weight: 700;
  color: rgba(220, 38, 38, 0.95);
}
.order-status-box {
  min-height: 56px;
  height: auto;
  max-height: none;
  overflow: auto;
  resize: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(241, 245, 249, 0.98);
  color: var(--text);
  line-height: 1.25;
  white-space: pre-wrap;
}
.order-edit-status-row {
  flex: 1 1 auto;
  min-height: 0;
}
.order-edit-status-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.order-info-box,
.order-status-box {
  flex: 1 1 auto;
  min-height: 56px;
}
.th-pdf,
.td-pdf { text-align: center; }
.td-pdf { vertical-align: middle; }
.order-edit-host {
  height: 100%;
  overflow: auto;
  padding: 10px;
  background: #ffffff;
}
.order-edit-host .card {
  margin: 0 !important;
  max-width: none !important;
}
.order-edit-form input.pickup-time-compact {
  width: auto;
  min-width: 54px;
  flex: 0 0 auto;
  padding-left: 8px;
  padding-right: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
}
.order-offer-source-block {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.98);
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre;
  overflow: auto;
  max-height: calc(1.35em * 5 + 16px);
}
  .order-edit-divider {
    margin: 12px 0;
    border: 0;
    border-top: 1px solid var(--border);
  }
.order-recipient-list {
  max-height: 170px;
  overflow: auto;
}
.order-coater-compact {
  width: 100%;
  min-width: 0;
  max-width: none;
}
  .order-source-offer-wrap {
    margin-top: 0;
  }
.order-source-offer-wrap label {
  margin-bottom: 6px;
}
.fix-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 2px 0;
  border: 0 !important;
  background: transparent !important;
}
.fix-inline input[type="checkbox"] { margin: 0; }
.order-mail-dlg {
  width: min(680px, calc(100vw - 24px));
  max-width: none;
}
.order-mail-dlg .dlg-body textarea {
  min-height: 220px;
}
.order-actions-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 0;
}
.order-actions-inline form {
  margin: 0;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.order-actions-inline form .btn { margin: 0; }
.order-actions-inline .btn,
.order-actions-inline a.btn {
  min-width: 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
}
.order-actions-inline .btn-icon-pdf { background-size: 30px 30px; }
.order-actions-inline .btn-icon-print,
.order-actions-inline .btn-icon-mail { background-size: 24px 24px; }
.offer-actions-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-height: 38px;
  line-height: 0;
}
.offer-actions-inline form,
.offer-action-form {
  margin: 0;
  display: flex;
  align-items: center;
  vertical-align: middle;
  align-self: center;
}
.offer-actions-inline .btn,
.offer-actions-inline a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  line-height: 1;
  vertical-align: middle;
}
.offer-actions-inline .btn-icon-copy,
.offer-actions-inline .btn-icon-folder {
  background-size: 22px 22px;
}
.offer-actions-inline .btn-icon-pdf {
  background-size: 30px 30px;
}
.customer-order-row td.no-order-open {
  text-align: center;
  vertical-align: middle;
}

.orders-split {
  --orders-left: 62%;
  display: grid;
  grid-template-columns: minmax(280px, var(--orders-left)) 10px minmax(44px, 1fr);
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - 340px);
}
.orders-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.orders-status-filter {
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}
.orders-status-filter input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.orders-status-filter span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(241, 245, 249, 0.95);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.orders-status-filter:hover span {
  border-color: rgba(46, 163, 242, 0.55);
}
.orders-status-filter input:checked + span {
  background: rgba(46, 163, 242, 0.18);
  border-color: rgba(46, 163, 242, 0.45);
}
.orders-status-filter input:focus-visible + span {
  outline: 2px solid rgba(96, 165, 250, 0.35);
  outline-offset: 1px;
  border-color: rgba(96, 165, 250, 0.6);
}
.orders-status-filter-all span {
  background: rgba(15, 23, 42, 0.04);
  border-style: dashed;
}
.orders-status-filter-all input:checked + span {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
}
.orders-page-shell {
  height: calc(100vh - 58px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.page-orders {
  overflow: hidden;
}
.orders-page-shell > .card,
.orders-page-shell > .msg,
.orders-page-shell > #ordersGlobalMsg {
  flex: 0 0 auto;
}
.orders-pane-left,
.orders-pane-right {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.orders-table-wrap {
  margin: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  flex: 1 1 auto;
  overflow: auto !important;
  border-radius: 0 !important;
}
.orders-table-wrap table { min-width: 1380px; }
.orders-split-handle {
  align-self: stretch;
  width: 10px;
  min-height: 100%;
  cursor: col-resize;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.09);
  border: 1px solid rgba(15, 23, 42, 0.14);
}
.orders-split-handle:hover { background: rgba(46, 163, 242, 0.16); border-color: rgba(46, 163, 242, 0.45); }
body.orders-split-dragging,
body.orders-split-dragging * { cursor: col-resize !important; user-select: none !important; }
.orders-pdf-panel {
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
}
.orders-pdf-view {
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #ffffff;
  position: relative;
}
.orders-pdf-view iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.orders-pdf-view .pdf-pages {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}
.orders-pdf-view .pdf-pages.pdf-pages--embed {
  padding: 0;
  overflow: hidden;
}
.orders-pdf-view .pdf-page {
  border-radius: 0;
}
.orders-pdf-view .orders-pdf-embed {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #ffffff;
}
.orders-pdf-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: 14px;
}
.orders-row { cursor: pointer; }
tr[data-customer-row] { cursor: pointer; }
.orders-row-selected { outline: 2px solid rgba(46, 163, 242, 0.55); outline-offset: -2px; }
.mailjob-row { cursor: pointer; }
.customer-order-row { cursor: pointer; }
.customer-mail-row { cursor: pointer; }
.mailjob-row-open { background: rgba(46, 163, 242, 0.08); }
.mailjob-detail-row td {
  padding: 0 12px 12px 12px;
  background: rgba(241, 245, 249, 0.7);
}
.customer-mail-detail-row td {
  padding: 0 12px 12px 12px;
  background: rgba(241, 245, 249, 0.7);
}
.mailjob-detail-body {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  padding: 10px 12px;
}
.mailjob-detail-head {
  display: grid;
  gap: 6px;
  color: var(--text);
  margin-bottom: 8px;
}
.mailjob-detail-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}
.mailjob-detail-empty { color: var(--muted); }
.order-number-link { text-decoration: none; }
.order-number-link:hover { text-decoration: underline; }
@media (max-width: 1200px) {
  .order-edit-top-row {
    grid-template-columns: 1fr 1fr;
  }
  body.page-orders { overflow: auto; }
  .orders-split { display: block; }
  .orders-split-handle { display: none; }
  .orders-page-shell {
    height: auto;
    overflow: visible;
  }
  .orders-table-wrap { max-height: none; height: auto; }
  .orders-pdf-panel { margin-top: 12px; }
  .orders-pdf-view {
    height: 62vh;
    min-height: 260px;
  }
}
.pdf-pages {
  height: 100%;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.98);
}
.pdf-page {
  margin: 0 auto 12px auto;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}
.pdf-page canvas { display: block; max-width: 100%; height: auto; }

.msg {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(241, 245, 249, 0.98);
  color: var(--text);
  font-size: 14px;
}
.msg.ok { border-color: rgba(34, 197, 94, 0.4); color: rgba(34, 197, 94, 0.95); }
.msg.err { border-color: rgba(239, 68, 68, 0.45); color: rgba(239, 68, 68, 0.95); }

dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100% - 24px));
}
dialog:not([open]) { display: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dlg-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.dlg-body { padding: 16px; }
.dlg-foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
select,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="time"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
textarea { min-height: 110px; resize: vertical; }
select:focus, input:focus, textarea:focus { outline: 2px solid rgba(96, 165, 250, 0.35); border-color: rgba(96, 165, 250, 0.6); }

.chk-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.95);
  padding: 10px;
  display: grid;
  gap: 10px;
}
.chk {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
}
.chk input[type="checkbox"] {
  margin: 0;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.chk input[type="checkbox"]:disabled { opacity: 0.55; }

.field { margin-bottom: 12px; }
.form { max-width: 420px; margin: 40px auto; }
.form h1 { margin: 0 0 10px 0; font-size: 22px; }
.form p { margin: 0 0 16px 0; color: var(--muted); }
.form .field { margin-bottom: 12px; }
.form .actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 14px; }

body.page-print { background: #ffffff; }
@media print {
  .no-print { display: none !important; }
  body.page-print .table-wrap { overflow: visible; }
  body.page-print .card { border: none; }
  body.page-print .table-wrap { border: none; }
  body.page-print a { color: inherit; text-decoration: none; }
}

