/* Eigene Regeln zu Sneat. Das Theme selbst bleibt unangetastet.

   Die Werte stammen aus der Token-Tabelle des Entwurfs AvrasyaStock v2. Sneat
   bringt Primary, Radius und Kartenschatten bereits in diesen Werten mit -
   hier steht nur, was darueber hinausgeht oder abweicht. */

:root {
  --avc-primary: #696cff;
  --avc-primary-dark: #5a5de0;
  --avc-primary-tint: #e7e7ff;
  --avc-primary-tint-soft: #f0f0fb;

  --avc-success: #5fbe2c;
  --avc-success-text: #4a9c22;
  --avc-success-tint: #eefadf;

  --avc-warning: #d99000;
  --avc-warning-text: #b87c00;
  --avc-warning-tint: #fff3d6;

  --avc-danger: #e03e20;
  --avc-danger-tint: #ffe7e4;
  --avc-danger-surface: #fff5f3;

  --avc-info: #0a9cbd;
  --avc-info-text: #0a7d99;
  --avc-info-tint: #e0f8fd;

  --avc-heading: #384551;
  --avc-body: #646e78;
  --avc-muted: #8592a3;
  --avc-muted-soft: #a1acb8;

  --avc-border: #d9dee3;
  --avc-table-line: #f2f2f5;
  --avc-card-border: #eceef1;

  --avc-page-bg: #f5f5f9;
  --avc-zebra: #fafafc;
}

/* ---------------------------------------------------------------- Typografie */

.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--avc-heading);
  margin-bottom: 0.125rem;
}

.page-subtitle {
  color: var(--avc-muted);
  font-size: 0.875rem;
  margin-bottom: 0;
}

.card-title-sm {
  font-size: 1rem;
  font-weight: 600;
  color: var(--avc-heading);
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ Tabellen */

.table thead th {
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.5px;
  color: var(--avc-muted-soft);
  font-weight: 700;
  background-color: var(--avc-zebra);
}

.table tbody td {
  font-size: 0.84375rem;
  border-bottom-color: var(--avc-table-line);
}

.table td.numeric,
.table th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.unit {
  font-size: 0.75em;
  color: var(--avc-muted);
  margin-left: 0.15rem;
}

.table-scroll {
  overflow-x: auto;
}

/* Aufklappbare Detailzeile: Buchungen, Unterchargen, Rezeptpositionen. Die
   Zeile hebt sich ab, damit sie nicht als weitere Bestandszeile gelesen wird. */
.movement-row td,
.detail-row > td {
  background-color: var(--avc-zebra);
  font-size: 0.8125rem;
}

.row-toggle {
  border: 0;
  background: none;
  color: var(--avc-muted);
  padding: 0;
  width: 1.5rem;
  line-height: 1;
}

.row-toggle:hover {
  color: var(--avc-primary);
}

/* ------------------------------------------------------------- Kennzahlen */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--avc-card-border);
  border-radius: 0.375rem;
  box-shadow: 0 2px 6px rgba(67, 89, 113, 0.08);
  padding: 1.125rem 1.1875rem;
}

.kpi-card .kpi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.kpi-card .kpi-label {
  font-size: 0.78125rem;
  font-weight: 500;
  color: var(--avc-muted);
}

.kpi-card .kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.kpi-card .kpi-value {
  font-size: 1.5625rem;
  font-weight: 700;
  color: var(--avc-heading);
  line-height: 1.2;
  margin-top: 0.5rem;
}

.kpi-card .kpi-value .unit {
  font-size: 0.84375rem;
  font-weight: 600;
}

.kpi-card .kpi-note {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.125rem;
}

/* Summenkacheln ueber Lagerlisten. Schmaler als die KPI-Karten des
   Dashboards, weil sie eine Tabelle einleiten und sie nicht ersetzen. */
.summary-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-tile {
  background: #fff;
  border: 1px solid var(--avc-card-border);
  border-radius: 0.375rem;
  padding: 0.75rem 0.875rem;
}

.summary-tile .label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--avc-muted-soft);
}

.summary-tile .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--avc-heading);
  line-height: 1.3;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--avc-heading);
}

/* ---------------------------------------------------------------- Ampeln */

/* Restzeit bis zur Mindesthaltbarkeit. Die Schwellen unterscheiden sich je
   Lagerstufe und stehen deshalb im Python-Code, nicht hier. */
.mhd-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.4375rem;
  border-radius: 0.25rem;
  white-space: nowrap;
}

.mhd-badge.red {
  background: var(--avc-danger-tint);
  color: var(--avc-danger);
}

.mhd-badge.yellow {
  background: var(--avc-warning-tint);
  color: var(--avc-warning-text);
}

.mhd-badge.green {
  background: var(--avc-success-tint);
  color: var(--avc-success-text);
}

.mhd-legend {
  display: flex;
  gap: 0.875rem;
  font-size: 0.6875rem;
  color: var(--avc-muted);
  align-items: center;
}

.mhd-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 0.25rem;
}

.value-critical {
  color: var(--avc-danger);
  font-weight: 600;
}

/* ------------------------------------------------------- Ausbeute-Anzeige */

.yield-block {
  background: var(--avc-primary-tint-soft);
  border-radius: 0.375rem;
  padding: 1rem 1.125rem;
}

.yield-block .value {
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1;
  color: var(--avc-heading);
}

.yield-block .bar {
  height: 6px;
  border-radius: 3px;
  background: #e4e6ea;
  overflow: hidden;
  margin: 0.625rem 0 0.375rem;
}

.yield-block .bar > span {
  display: block;
  height: 100%;
  border-radius: 3px;
}

.yield-hero {
  background-color: var(--avc-primary-tint-soft);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
}

.yield-hero .value {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
}

/* --------------------------------------------------------- Wochenkalender */

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.625rem;
}

.week-day {
  border: 1px solid var(--avc-card-border);
  border-radius: 0.375rem;
  padding: 0.625rem 0.5rem;
  min-height: 170px;
  background: #fff;
}

.week-day.today {
  border-color: #c9caff;
  background: #fbfbff;
}

.week-day .day-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--avc-muted-soft);
}

.week-day .day-date {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--avc-heading);
  line-height: 1.2;
}

.week-entry {
  border-radius: 0.25rem;
  padding: 0.25rem 0.375rem;
  margin-top: 0.375rem;
  font-size: 0.6875rem;
  line-height: 1.35;
}

.week-entry .when {
  font-weight: 700;
}

@media (max-width: 991.98px) {
  .week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-day {
    min-height: auto;
  }
}

/* ----------------------------------------------------------- Hinweisliste */

.notice-item {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--avc-table-line);
  color: inherit;
  text-decoration: none;
}

.notice-item:last-child {
  border-bottom: 0;
}

.notice-item:hover {
  background: var(--avc-zebra);
}

.notice-item .marker {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  margin-top: 0.375rem;
  flex: none;
}

.notice-item .title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--avc-heading);
}

.notice-item .text {
  font-size: 0.75rem;
  color: var(--avc-muted);
}

/* Zaehler an der Glocke in der Topbar. */
.notice-count {
  position: absolute;
  top: 0.125rem;
  right: 0;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 0.5rem;
  background: var(--avc-danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

/* ----------------------------------------------------------- Erfassung */

/* Erfassungsmasken werden an Tablets mit Arbeitshandschuhen bedient:
   grosse Ziele, kein Zielen mit der Fingerspitze. */
.touch-form .form-control,
.touch-form .form-select {
  min-height: 3rem;
  font-size: 1.0625rem;
}

.touch-form .btn {
  min-height: 3rem;
  font-size: 1.0625rem;
}

.form-control-xl {
  min-height: 4.25rem !important;
  font-size: 2.25rem !important;
  font-weight: 700;
  color: var(--avc-heading);
}

/* Die automatisch vergebene Chargennummer ist keine Eingabe, sondern eine
   Zusage an den Erfasser - deshalb steht sie gross und ohne Feldrahmen. */
.batch-preview {
  background: var(--avc-primary-tint-soft);
  border-radius: 0.375rem;
  padding: 0.875rem 1rem;
}

.batch-preview .code {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--avc-primary-dark);
  line-height: 1.1;
}

.segment-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.segment-choice label {
  border: 1px solid var(--avc-border);
  border-radius: 0.375rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  min-height: 3rem;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

.segment-choice input {
  display: none;
}

.segment-choice label:has(input:checked) {
  background-color: var(--avc-primary);
  border-color: var(--avc-primary);
  color: #fff;
}

.employee-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.employee-choice label {
  border: 1px solid var(--avc-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  min-height: 3rem;
  display: flex;
  align-items: center;
}

.employee-choice input {
  display: none;
}

.employee-choice input:checked + span,
.employee-choice label:has(input:checked) {
  background-color: var(--avc-primary);
  border-color: var(--avc-primary);
  color: #fff;
}

/* ------------------------------------------------------------ Mobile Scan */

.mobile-shell {
  background-color: var(--bs-body-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mobile-header {
  border-bottom: 1px solid var(--avc-border);
}

.mobile-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.scan-result {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  color: #fff;
}

/* Dunkle Schrift auf Gruen und Amber: Weiss auf diesen Flaechen ist im
   Kuehlhaus mit beschlagener Scheibe nicht mehr lesbar. */
.scan-result.ok {
  background-color: var(--avc-success);
  color: #10250a;
}

.scan-result.already {
  background-color: var(--avc-warning);
  color: #33220a;
}

.scan-result.error {
  background-color: var(--avc-danger);
}

.scan-result .headline {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 1.5rem;
}

/* Der Sucherrahmen zeigt, wohin der Code gehalten wird - im Kuehlhaus mit
   Handschuhen ist Zielen sonst Gluecksache. Er liegt ueber dem Kamerabild und
   faengt keine Klicks ab. */
.scan-frame {
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 0.75rem;
  pointer-events: none;
}

.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  height: 20%;
  border: 3px solid var(--avc-primary);
  border-radius: 0.75rem;
}

.scan-frame::before {
  top: -2px;
  border-bottom: 0;
}

.scan-frame::after {
  bottom: -2px;
  border-top: 0;
}

.btn-scan {
  min-height: 4rem;
  font-size: 1.25rem;
  font-weight: 600;
  width: 100%;
}

#scan-reader video {
  width: 100% !important;
  border-radius: 0.5rem;
}

/* Das Häkchen der Erfolgsmeldung muss aus zwei Metern erkennbar sein. */
.scan-result .bx-check {
  width: 4rem;
  height: 4rem;
}

/* --------------------------------------------------------------- Sonstiges */

/* Das Bedienfeld des Theme-Customizers gehört nicht in eine Betriebsanwendung.
   Das Objekt selbst wird gebraucht, weil das Theme seine Einstellungen liest. */
.template-customizer,
.template-customizer-open-btn {
  display: none !important;
}
