/* ==========================================================================
   QB-Produktion – globale Basis-Styles

   Reihenfolge:
   1. Designvariablen und Grundelemente
   2. Seitenaufbau, Karten, Tabellen und Formulare
   3. Wiederverwendbare Hilfskomponenten
   4. Seitennavigation und mobile Darstellung
   5. Fachmodule, die auf mehreren Seiten verwendet werden
   ========================================================================== */

/* 1. Designvariablen und Grundelemente */
:root {
  --navy: #0d2137;
  --blue: #1677ff;
  --cyan: #45d7d0;
  --paper: #f4f7fa;
  --ink: #172332;
  --muted: #6d7b8b;
  --line: #dce4eb;
  --danger: #b42318;
  --ok: #087f5b;
  --warn: #9a6700;
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
}

/* Kopfzeile und allgemeines Branding */
.topbar {
  min-height: 68px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 max(20px, calc((100vw - 1280px)/2));
  gap: 28px;
  box-shadow: 0 2px 12px #001a3340;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.brand span, .login-mark {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 9px;
  width: 38px;
  height: 38px;
  margin-right: 7px;
}

.topbar nav {
  display: flex;
  gap: 5px;
  flex: 1;
}

.topbar nav a {
  color: #cbd8e5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 7px;
}

.topbar nav a:hover, .topbar .scan-link {
  background: #ffffff16;
  color: #fff;
}

.logout {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.logout a {
  color: #fff;
  text-decoration: none;
}

.link-button {
  border: 0;
  background: none;
  color: #9fd6ff;
  cursor: pointer;
}

/* 2. Seitenaufbau und Überschriften */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

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

.page-head h1 {
  font-size: 30px;
  margin: 0 0 5px;
}

.page-head p, .muted {
  margin: 0;
  color: var(--muted);
}

.live, .audit-ok, .audit-bad {
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 99px;
}

.live, .audit-ok {
  color: var(--ok);
  background: #dff8ef;
}

.audit-bad {
  color: var(--danger);
  background: #fff0ee;
}

.live i {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #18b17e;
  border-radius: 50%;
  margin-right: 5px;
  box-shadow: 0 0 0 5px #18b17e25;
}

/* Kennzahlen, Karten und Statusanzeigen */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.kpis article, .panel, .form-card, .scanner-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 18px #12304c0b;
}

.kpis article {
  padding: 20px;
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpis strong {
  display: block;
  font-size: 27px;
  margin-top: 7px;
}

/* Schaltflächen und Aktionsleisten */
.actions {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

.primary, .secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  background: var(--blue);
  color: white;
}

.secondary {
  background: #e6edf4;
  color: var(--navy);
}

.wide {
  width: 100%;
}

.big {
  min-height: 56px;
  font-size: 18px;
}

.panel {
  padding: 20px;
  margin: 18px 0;
}

.panel h2, .form-card h2 {
  margin: 0 0 16px;
}

/* Tabellen */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody tr:hover {
  background: #f7faff;
}

.tag {
  display: inline-block;
  background: #eaf2ff;
  color: #1459a6;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.shortage {
  background: #fff0ee!important;
  color: var(--danger);
}

.total-row {
  background: #eef5fc;
}

.status-ok {
  color: var(--ok);
  font-weight: 700;
}

.status-warn {
  color: var(--warn);
  font-weight: 700;
}

.status-bad {
  color: var(--danger);
  font-weight: 700;
}

/* Formulare und Scanneransichten */
.form-card, .scanner-card {
  max-width: 620px;
  padding: 24px;
}

.recipe-master {
  max-width: none;
}

.scanner-card {
  margin: auto;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 15px 0 6px;
}

input, select {
  width: 100%;
  border: 1px solid #bac7d4;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  font: inherit;
}

input:focus, select:focus {
  outline: 3px solid #1677ff25;
  border-color: var(--blue);
}

input[type=checkbox] {
  width: auto;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 9px 0;
  font-weight: 500;
}

.permission-panel {
  margin: 0;
}

.permission-panel fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 13px 0;
  padding: 8px 14px;
}

.permission-panel legend {
  font-weight: 800;
  padding: 0 6px;
}

.password-reset {
  margin-top: 24px;
}

.scan-input {
  font-family: ui-monospace, monospace;
  font-size: 18px;
}

.validation {
  color: var(--danger);
  font-size: 13px;
}

.validation ul {
  padding-left: 18px;
}

.hint {
  max-width: 620px;
  margin: 14px auto;
  color: var(--muted);
}

.alert {
  padding: 13px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.alert.success {
  background: #dff8ef;
  color: var(--ok);
}

.alert.error {
  background: #fff0ee;
  color: var(--danger);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.two-col .form-card {
  max-width: none;
}

/* Anmeldung, Meldungen und allgemeine Hilfselemente */
.login-card {
  max-width: 400px;
  margin: 8vh auto;
  background: white;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px #12304c20;
}

.login-card h1 {
  margin-bottom: 5px;
}

.login-mark {
  color: #fff;
  font-weight: 900;
  font-size: 20px;
}

.danger-link {
  color: var(--danger);
}

details code {
  display: block;
  max-width: 440px;
  white-space: normal;
  margin-top: 8px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 20px;
}

@media (max-width: 960px) {
  .kpis {
    grid-template-columns: repeat(3, 1fr);
  }
  .topbar {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 8px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    overflow: auto;
  }
  .logout {
    margin-left: auto;
  }
}

@media (max-width: 620px) {
  .container {
    padding: 20px 12px 50px;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .actions {
    flex-direction: column;
  }
  .topbar nav a {
    padding: 9px 8px;
  }
  .logout span {
    display: none;
  }
  .panel {
    padding: 12px;
  }
  .kpis article {
    padding: 15px;
  }
}

/* 3. Wiederverwendbare Ansichtsbausteine */
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.filter-panel {
  padding: 12px 16px;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-form input {
  max-width: 480px;
}

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

.row-actions form {
  display: inline;
}

.row-actions .link-button {
  padding: 0;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 25px;
}

.series-preview {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #edf5ff;
  border: 1px solid #c8ddf5;
  border-radius: 9px;
  margin: 20px 0;
  padding: 15px;
}

.series-preview span {
  color: var(--muted);
  font-size: 13px;
}

.series-preview strong {
  font: 700 20px ui-monospace, monospace;
}

.scan-preview {
  border-radius: 7px;
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.scan-preview.ok {
  background: #dff8ef;
  color: var(--ok);
}

.scan-preview.bad {
  background: #fff0ee;
  color: var(--danger);
}

@media (max-width: 620px) {
  .three-col {
    grid-template-columns: 1fr;
  }
  .search-form {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Produktionsbedarf und Rückmeldungen */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.section-head h2 {
  margin-bottom: 5px;
}

.pick-group {
  border-top: 1px solid var(--line);
  padding: 18px 0 4px;
}

.pick-group:first-of-type {
  margin-top: 16px;
}

.pick-group h3 {
  margin: 0 0 5px;
}

.pick-shortage {
  background: #fff0ee;
  color: var(--danger);
  border-radius: 8px;
  padding: 11px 13px;
  margin-top: 10px;
}

.pick-complete {
  padding: 12px 0;
}

.compact {
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.pick-category {
  background: #e8f0ec;
  color: #173d31;
  border-left: 5px solid #176b4b;
  border-radius: 8px;
  padding: 11px 13px;
  margin: 20px 0 0;
}

.recipe-group-row td {
  background: #e8f0ec;
  color: #173d31;
  font-weight: 800;
}

.recipe-subtotal td {
  background: #f3f7f5;
  font-weight: 800;
}

.feedback-confirm {
  margin: 14px 0;
  background: #fff5dc;
  border: 1px solid #e9c979;
  border-radius: 8px;
  padding: 11px;
}

.feedback-alert {
  margin: 14px 0;
  background: #fff0ee;
  color: var(--danger);
  border-radius: 8px;
  padding: 11px 13px;
}

.form-card button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.inline-actions form {
  margin: 0;
}

.reservation-notice {
  background: #fff8db;
  color: #765b00;
  border: 1px solid #ead68a;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 16px 0;
}

@media (max-width: 620px) {
  .section-head, .inline-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.field-help {
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.warning-help {
  color: var(--warn);
  font-weight: 700;
}

.automatic-number-info {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 13px 15px;
  border: 1px solid #b9ddcf;
  border-radius: 9px;
  background: #edf8f3;
  color: #285345;
}

.automatic-number-info span {
  font-size: 12px;
}

/* Wareneingang mit einer oder mehreren Paletten */
.receive-page {
  width: min(100%, 960px);
  margin: 0 auto;
}

.receive-page-head {
  justify-content: center;
  text-align: center;
}

.receive-page-head>div {
  width: 100%;
}

.receive-page-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  place-items: center;
  border-radius: 14px;
  background: #e5f3ec;
  font-size: 24px;
}

.receive-card {
  width: min(100%, 880px);
  max-width: 880px;
  margin: 0 auto;
}

.receive-destination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 19px;
  padding: 14px 16px;
  border: 1px solid #b9ddcf;
  border-radius: 10px;
  background: #edf8f3;
  color: #285345;
}

.receive-destination>span {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 11px;
  background: #d7ebe1;
  font-size: 21px;
}

.receive-destination small,
.receive-destination strong,
.receive-destination p {
  display: block;
}

.receive-destination small {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .05em;
}

.receive-destination strong {
  margin-top: 2px;
  font-size: 17px;
}

.receive-destination p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

.receive-pallet-settings {
  display: grid;
  grid-template-columns: minmax(180px, .65fr) minmax(260px, 1.35fr);
  gap: 14px;
  margin-top: 18px;
}

.receive-quantity-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  padding: 14px;
}

.receive-quantity-panel[hidden] {
  display: none;
}

.receive-quantity-panel .section-head {
  margin-bottom: 10px;
}

.receive-quantity-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.receive-quantity-panel .section-head p {
  margin: 3px 0 0;
}

.receive-quantity-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 9px;
}

.receive-quantity-row {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}

.receive-quantity-row span {
  font-weight: 800;
}

.receive-quantity-row input {
  margin: 0;
  min-width: 0;
}

.receive-quantity-row small {
  color: var(--muted);
}

.receive-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 15px;
  margin: 14px 0 18px;
  border: 1px solid #b9ddcf;
  border-radius: 10px;
  background: #edf8f3;
  padding: 13px 15px;
  color: #285345;
}

.receive-total strong {
  grid-row: span 2;
  font-size: 1.7rem;
}

.receive-total strong em {
  font-size: 1rem;
  font-style: normal;
}

.receive-total small {
  color: #4f7165;
}

.scanner-target-info {
  margin-top: 14px;
}

@media (max-width: 760px) {
  .receive-pallet-settings {
    grid-template-columns: 1fr;
  }

  .receive-quantity-list {
    grid-template-columns: 1fr;
  }

  .receive-card {
    padding: 18px;
  }

  .receive-total {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .receive-total strong {
    grid-row: auto;
  }
}

@media (max-width: 480px) {
  .receive-page-head h1 {
    font-size: 26px;
  }

  .receive-destination {
    align-items: flex-start;
    text-align: left;
  }

  .receive-quantity-row {
    grid-template-columns: 1fr auto;
  }

  .receive-quantity-row span {
    grid-column: 1 / -1;
  }

  .receive-card .two-col {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .receive-card .big {
    min-height: 52px;
    padding: 12px;
    font-size: 15px;
    line-height: 1.3;
  }
}

/* 4. Seitliche Hauptnavigation */
:root {
  --sidebar-width: 250px;
}

.app-content {
  min-height: 100vh;
}

.authenticated .app-content {
  margin-left: var(--sidebar-width);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1002;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #fff;
  box-shadow: 3px 0 18px #001a3330;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #ffffff18;
}

.sidebar .brand span {
  flex: 0 0 38px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px;
  overflow-y: auto;
}

.sidebar nav a {
  color: #cbd8e5;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 650;
}

.sidebar nav a:hover, .sidebar nav a:focus, .sidebar nav .scan-link {
  background: #ffffff16;
  color: #fff;
}

.sidebar-user {
  margin-top: auto;
  padding: 16px 20px 20px;
  border-top: 1px solid #ffffff18;
  display: grid;
  gap: 12px;
}

.sidebar-user a {
  color: #fff;
  text-decoration: none;
}

.sidebar-user a span {
  display: block;
  color: #9eb1c5;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sidebar-user a strong {
  display: block;
  margin-top: 3px;
}

.sidebar-user .link-button {
  padding: 0;
  text-align: left;
}

.nav-toggle, .mobile-nav-button, .nav-overlay {
  display: none;
}

/* 5. Lagerübersicht */
.warehouse-groups {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.warehouse-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 18px #12304c0b;
  overflow: hidden;
}

.warehouse-group summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.warehouse-group summary::-webkit-details-marker {
  display: none;
}

.warehouse-group summary::after {
  content: "›";
  margin-left: 2px;
  font-size: 25px;
  color: var(--muted);
  transform: rotate(90deg);
  transition: transform .18s;
}

.warehouse-group[open] summary::after {
  transform: rotate(-90deg);
}

.warehouse-group[open] summary {
  border-bottom: 1px solid var(--line);
}

.warehouse-title {
  display: flex;
  flex-direction: column;
  min-width: 160px;
}

.warehouse-title strong {
  font-size: 20px;
}

.warehouse-title small {
  color: var(--muted);
  margin-top: 3px;
}

.warehouse-stats {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
}

.warehouse-stats span {
  background: #edf3f8;
  color: #42566b;
  border-radius: 99px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.warehouse-group .table-wrap {
  padding: 0 20px 8px;
}

@media (max-width: 960px) {
  .authenticated .app-content {
    margin-left: 0;
  }
  .sidebar {
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .mobile-nav-button {
    position: fixed;
    z-index: 1003;
    top: 14px;
    left: 14px;
    width: 46px;
    height: 46px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    background: var(--navy);
    border-radius: 9px;
    box-shadow: 0 4px 14px #001a3340;
    cursor: pointer;
  }
  .mobile-nav-button i {
    display: block;
    height: 3px;
    background: #fff;
    border-radius: 3px;
  }
  .nav-overlay {
    position: fixed;
    z-index: 1001;
    inset: 0;
    display: block;
    background: #001a3375;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .nav-toggle:checked~.sidebar {
    transform: translateX(0);
  }
  .nav-toggle:checked~.nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  .authenticated .container {
    padding-top: 78px;
  }
}

@media (max-width: 620px) {
  .warehouse-group summary {
    align-items: flex-start;
    padding: 15px;
    gap: 10px;
  }
  .warehouse-title {
    min-width: 105px;
  }
  .warehouse-title strong {
    font-size: 17px;
  }
  .warehouse-stats {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .warehouse-stats span {
    padding: 5px 8px;
  }
  .warehouse-group .table-wrap {
    padding: 0 10px 5px;
  }
}

/* Qualität, Detailansichten und Datenimport */
.quality-blocked {
  background: #fff0ee!important;
}

.quality-sample-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.quality-sample {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid #d39b2a;
  border-radius: 10px;
  background: #fffcf2;
}

.quality-sample.passed {
  border-left-color: #269262;
  background: #f0faf5;
}

.quality-sample.failed {
  border-left-color: var(--danger);
  background: #fff0ee;
}

.quality-sample h3 {
  margin: 7px 0 4px;
}

.quality-sample p {
  margin: 4px 0;
}

.sample-result-form {
  display: grid;
  align-content: start;
  gap: 8px;
}

.small-kpi {
  font-size: 18px!important;
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 10px 20px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .quality-sample {
    grid-template-columns: 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .detail-list dd {
    margin-bottom: 10px;
  }
}

.template-panel {
  margin: 0;
}

.template-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.template-links a {
  background: #edf5ff;
  border: 1px solid #c8ddf5;
  border-radius: 8px;
  padding: 12px;
  text-decoration: none;
  font-weight: 700;
  color: #1459a6;
}

.import-error {
  background: #fff0ee!important;
}

.import-errors {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
  white-space: normal;
  min-width: 260px;
}

/* Datenimport: verbindliche Änderungsvorschau */
.import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.import-summary article {
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
}

.import-summary article.new { border-left-color: #16865c; }
.import-summary article.changed { border-left-color: #d97706; }
.import-summary article.unchanged { border-left-color: #64748b; }
.import-summary article.error { border-left-color: var(--danger); }

.import-summary span,
.import-summary p {
  color: var(--muted);
}

.import-summary strong {
  display: block;
  margin: 4px 0;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1;
}

.import-summary p { margin: 0; }

.import-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 12px;
}

.import-legend span,
.import-row-state {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 800;
}

.import-legend .new,
.import-row-state.new { color: #08734c; background: #dcf7eb; }
.import-legend .changed,
.import-row-state.changed { color: #9a4e00; background: #fff0cf; }
.import-legend .unchanged,
.import-row-state.unchanged { color: #526070; background: #edf1f5; }
.import-row-state.error { color: #a32020; background: #ffe1df; }
.import-legend .key { color: #5542a8; background: #eeeaff; }

.import-preview-list {
  display: grid;
  gap: 14px;
}

.import-preview-row {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 5px solid #64748b;
  border-radius: 12px;
  background: #fff;
}

.import-preview-row.new { border-left-color: #16865c; }
.import-preview-row.changed { border-left-color: #d97706; }
.import-preview-row.error { border-left-color: var(--danger); }

.import-preview-row > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.import-preview-row h2 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.import-row-number {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.import-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.import-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px;
  background: #fbfcfd;
}

.import-field.changed {
  border-color: #edbb65;
  background: #fff9eb;
}

.import-field.key {
  box-shadow: inset 3px 0 #735dd0;
}

.import-field-name {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.import-field-name span {
  color: #5542a8;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.import-value {
  min-width: 0;
}

.import-value small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-weight: 700;
}

.import-value span {
  display: block;
  overflow-wrap: anywhere;
}

.import-field.changed .import-value.new span {
  color: #8a4600;
  font-weight: 800;
}

.import-arrow {
  color: var(--muted);
  font-weight: 900;
}

.import-row-errors {
  margin: 0 14px 14px;
  border-radius: 8px;
  background: #fff0ee;
  padding: 12px 14px;
  color: var(--danger);
}

.import-row-errors ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.import-commit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.import-commit p { margin: 0; }

@media (max-width: 620px) {
  .template-links {
    grid-template-columns: 1fr;
  }

  .import-summary,
  .import-field-grid {
    grid-template-columns: 1fr;
  }

  .import-preview-row > header,
  .import-commit {
    align-items: stretch;
    flex-direction: column;
  }

  .import-row-state { align-self: flex-start; }
}

/* Produktionskalender */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.calendar-toolbar h2 {
  margin: 0;
  text-transform: capitalize;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.calendar-legend span {
  border-radius: 99px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

.legend-planned {
  background: #eaf2ff;
  color: #1459a6;
}

.legend-partial {
  background: #fff1d6;
  color: #9a5800;
}

.legend-completed {
  background: #dff8ef;
  color: #087f5b;
}

.legend-overdue {
  background: #fff0ee;
  color: #b42318;
}

.legend-cancelled {
  background: #edf0f3;
  color: #657383;
}

.overdue-panel {
  background: #fff0ee;
  border-color: #f0b5af;
}

.overdue-panel h2, .overdue-panel p {
  color: #b42318;
}

.overdue-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.overdue-list a {
  display: grid;
  gap: 3px;
  background: #fff;
  border: 1px solid #f0b5af;
  border-left: 5px solid #d92d20;
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  text-decoration: none;
}

.overdue-list span {
  color: var(--muted);
  font-size: 12px;
}

.production-calendar-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
}

.production-calendar {
  min-width: 980px;
  display: grid;
  grid-template-columns: repeat(7, minmax(135px, 1fr));
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  gap: 1px;
  overflow: hidden;
}

.calendar-weekday {
  background: var(--navy);
  color: #fff;
  padding: 11px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.calendar-day {
  background: #fff;
  min-height: 150px;
  padding: 9px;
}

.calendar-day.outside {
  background: #f1f4f7;
  color: #8b98a6;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 3px var(--blue);
}

.calendar-day header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.calendar-day header strong {
  font-size: 18px;
}

.calendar-day header span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.calendar-orders {
  display: grid;
  gap: 6px;
}

.calendar-order {
  display: grid;
  gap: 2px;
  border-left: 5px solid;
  border-radius: 7px;
  padding: 7px 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 11px;
}

.calendar-order strong {
  font-size: 12px;
}

.calendar-order span, .calendar-order small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-order.planned {
  background: #eaf2ff;
  border-color: #1677ff;
}

.calendar-order.partial {
  background: #fff1d6;
  border-color: #e88700;
}

.calendar-order.completed {
  background: #dff8ef;
  border-color: #18a875;
}

.calendar-order.overdue {
  background: #fff0ee;
  border-color: #d92d20;
}

.calendar-order.cancelled {
  background: #edf0f3;
  border-color: #8996a3;
  color: #657383;
  text-decoration: line-through;
}

.schedule-form {
  max-width: 480px;
  margin-top: 14px;
}

.schedule-form input {
  min-width: 220px;
}

@media (max-width: 1100px) and (min-width: 621px) {
  .three-col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .calendar-toolbar h2 {
    text-align: center;
  }
  .three-col {
    grid-template-columns: 1fr;
  }
  .schedule-form .inline-actions {
    align-items: stretch;
  }
}
.pager{display:flex;align-items:center;justify-content:center;gap:1rem;padding:1rem;flex-wrap:wrap}
