/* Arbeitsplatz am Skibazar.

   Anders als beim Standverkauf wird hier getippt, nicht getippt-und-gewischt:
   Namen, Bezeichnungen, Preise. Die Oberflaeche ist deshalb auf Tastatur und
   Scanner ausgelegt -- grosse Felder, klare Reihenfolge, und nach jedem
   erfassten Stueck steht der Fokus wieder am Anfang.

   Die Farbe ist bewusst ein anderes Blau als das Indigo des Standverkaufs:
   beide laufen am selben Wochenende auf denselben Geraeten, da hilft es, wenn
   man auf einen Blick sieht, worin man gerade arbeitet. Aufbau, Menue und
   "Zurueck" sind dagegen gleich.

   Hell/dunkel und Schriftgroesse folgen dem Geraet; Schriften deshalb in rem
   (1rem = 17 Pixel bei normaler Groesse, unter iOS die Einstellung "Textgroesse"). */

:root {
  color-scheme: light dark;
  --blau: #0067d6;
  --blau-hell: #0058b8;
  --akzent-text: #0067d6;
  --akzent-leicht: #e6f0fb;
  --grund: #f2f2f7;
  --flaeche: #ffffff;
  --flaeche-2: #f2f2f7;
  --linie: #e0e0e6;
  --text: #1c1c1e;
  --leise: #6c6c70;
  --rot: #d70015;
  --gruen: #15803d;
  --schatten: rgba(0, 0, 0, .08);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blau: #0a6fd6;
    --blau-hell: #0a84ff;
    --akzent-text: #4da3ff;
    --akzent-leicht: #10243d;
    --grund: #000000;
    --flaeche: #1c1c1e;
    --flaeche-2: #2c2c2e;
    --linie: #38383a;
    --text: #f2f2f7;
    --leise: #a1a1a6;
    --rot: #ff453a;
    --gruen: #248a3d;
    --schatten: rgba(0, 0, 0, .5);
  }
}

html { font-size: 106.25%; }
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html { font: -apple-system-body; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}
/* Ein ueberlanges Wort (Name ohne Leerzeichen) bricht um, statt die Seite seitlich aufzuschieben. */
body { overflow-wrap: anywhere; }
/* Tabellen nicht: dort wuerden Spalten schmaler und Codes mitten im Wort brechen. */
table, code { overflow-wrap: break-word; }

button {
  font: inherit;
  font-weight: 600;
  min-height: 56px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}
button.gross {
  background: var(--blau);
  border-color: var(--blau);
  color: #fff;
  padding: 0 20px;
}
button.gross[disabled] { opacity: .45; }
button.flach { padding: 0 16px; }
@media (hover: hover) {
  button.gross:hover { background: var(--blau-hell); }
  button.flach:hover { background: var(--flaeche-2); }
}

input, select {
  font: inherit;
  font-size: 1.059rem;
  min-height: 56px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--text);
}
input:focus { outline: 3px solid color-mix(in srgb, var(--blau) 45%, transparent); outline-offset: 1px; }
.preisfeld { text-align: right; font-variant-numeric: tabular-nums; }

label { font-size: 0.882rem; color: var(--leise); display: block; margin-bottom: 4px; }
.leise { color: var(--leise); font-size: 0.882rem; }
.hinweis { color: var(--leise); font-size: 0.882rem; margin: 0; }
.fehler { color: var(--rot); font-weight: 600; }

.mitte { max-width: 420px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.mitte h1 { margin: 0; font-size: 1.647rem; }
.rechtliches { margin: 0; text-align: center; font-size: 0.765rem; }
.rechtliches a { color: var(--leise); display: inline-block; padding: 10px 4px; }
/* Verweis zur Verwaltung: leise, aber mit fingergrosser Tippflaeche. */
.nebenweg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--akzent-text);
  font-size: 0.882rem;
}

/* ------------------------------------------------------------ Geruest */
#arbeit > header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--flaeche);   /* Safari vor 16.2 kennt color-mix nicht */
  background: color-mix(in srgb, var(--flaeche) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--linie);
}
.kopfzeile { display: grid; min-width: 0; }
.kopfzeile strong, .kopfzeile .leise { overflow-wrap: anywhere; }
#zum-menue { min-height: 44px; }

/* Arbeitsbereiche als Umschalter wie unter iOS, nicht als Karteireiter. */
.reiter {
  grid-column: 1 / -1;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--flaeche-2);
}
.reiter button {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 2px;
  line-height: 1.15;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--text);
  font-weight: 500;
}
.reiter button.aktiv {
  background: var(--flaeche);
  font-weight: 700;
  box-shadow: 0 1px 4px var(--schatten);
}
@media (prefers-color-scheme: dark) {
  .reiter button.aktiv { background: #636366; }
}
@media (max-width: 480px) {
  #arbeit > header { padding-left: 8px; padding-right: 8px; }
  .reiter button { font-size: 0.82rem; }
}
/* Die Kopfleiste nahm am Tablet mit offener Tastatur ein Drittel des Bildes.
   Ab Tabletbreite steht darum alles in einer Zeile: Platz, Umschalter, Menue. */
@media (min-width: 700px) {
  #arbeit > header {
    grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) auto;
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }

}
/* Am Handy: Platz und Bazar in einer Zeile, damit die Leiste niedrig bleibt. */
@media (max-width: 699px) {
  #arbeit > header { padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px;
    gap: 6px 12px; }
  .kopfzeile { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kopfzeile strong, .kopfzeile .leise { overflow-wrap: normal; }
  .kopfzeile .leise::before { content: " · "; }
  #zum-menue { min-height: 40px; }
  .reiter button { min-height: 40px; }
}

/* Wechselgeld im Verkauf */
.wechselgeld { display: grid; gap: 8px; }
.wechselgeld label { margin: 0; }
.gegeben-zeile { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 8px; }
.gegeben-zeile button { padding: 0; font-size: 1.294rem; color: var(--leise); }
.scheine { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.scheine button { min-height: 48px; padding: 0; }
.rueckgeld { margin: 0; font-weight: 700; font-size: 1.294rem; text-align: right; }
.rueckgeld:empty { display: none; }

.ansicht {
  display: grid;
  gap: 20px;
  padding: 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  align-content: start;
}
.spalte { display: grid; gap: 10px; align-content: start; min-width: 0; }
/* Beim Hinrollen nicht unter der klebenden Kopfzeile verschwinden. */
.spalte { scroll-margin-top: calc(110px + env(safe-area-inset-top)); }
.spalte h2 { margin: 0; font-size: 1.059rem; }

/* Ab Tabletbreite nebeneinander: links erfassen, rechts die Liste. So sieht
   man beim Tippen, was schon drinsteht. */
@media (min-width: 820px) {
  .ansicht { grid-template-columns: 1fr 1fr; gap: 28px; }
}

.artikelzeile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 64px;
  gap: 8px;
}
.artikelzeile button { min-width: 64px; padding: 0; font-size: 1.412rem; }
/* Die Preisabfrage im Verkauf hat nur zwei Spalten. */
#v-preisfrage .artikelzeile { grid-template-columns: minmax(0, 1fr) auto; }
#v-preisfrage .artikelzeile button { min-width: 0; padding: 0 20px; font-size: 1rem; }

/* ------------------------------------------------------------- Posten */
.posten { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.posten li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 44px;
  align-items: center;
  gap: 10px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 56px;
}
.posten .nummer {
  font: 600 0.882rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--leise);
}
.posten .name { min-width: 0; overflow-wrap: anywhere; }
.posten .betrag { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.posten .weg {
  min-height: 44px;
  width: 44px;
  border: none;
  background: none;
  color: var(--rot);
  font-size: 1.294rem;
}

.summenzeile {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--linie);
  padding-top: 10px;
}
.summenzeile strong { font-size: 1.647rem; font-variant-numeric: tabular-nums; }
.gebuehr { margin: 0; font-size: 0.941rem; color: var(--leise); min-height: 22px; }
.aktionen { display: grid; grid-template-columns: auto 1fr; gap: 10px; }

.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.kachel {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.kachel strong { font-size: 1.412rem; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------- Rueckmeldung */
.bestaetigung {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--leiste-h, 0px) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--grund);
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  z-index: 40;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.bestaetigung.schlecht { background: var(--rot); color: #fff; }
.bestaetigung.gut { background: var(--gruen); color: #fff; }

.vorschau {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, .45);
  display: grid;
  place-items: center;
  padding: 16px;
}
.vorschau-blatt {
  background: var(--flaeche);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 85vh;
  overflow-y: auto;
  display: grid;
  gap: 12px;
  max-width: 460px;
  width: 100%;
}
.vorschau-blatt pre {
  margin: 0;
  padding: 12px;
  background: var(--flaeche-2);
  border: 1px dashed var(--linie);
  font: 0.765rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
  overflow-x: auto;
}

/* --------------------------------------------------------- Auszahlung */
h3.klein { margin: 12px 0 0; font-size: 0.882rem; color: var(--leise); font-weight: 600; }
.rechenweg { display: grid; gap: 4px; font-size: 0.941rem; }
.rechenweg div { display: flex; justify-content: space-between; }
.rechenweg strong { font-weight: 600; font-variant-numeric: tabular-nums; }
#z-betrag { font-size: 1.882rem; }

.schalter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  font-size: 0.941rem;
  color: var(--text);
}
.schalter input { width: 24px; height: 24px; min-height: 0; }

/* -------------------------------------------------------------- Suchen */
.treffer li { cursor: pointer; grid-template-columns: auto minmax(0, 1fr) auto; }
.treffer li:active { background: var(--akzent-leicht); }
.treffer .art {
  font-size: 0.765rem;
  color: var(--leise);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* WLAN-Drucker per Adresse (Android-App). */
.netzdrucker { display: grid; gap: 8px; margin-top: 14px; }
.netzdrucker[hidden] { display: none; }

/* ---------------------------------------------------- Navigation
   Gleich wie beim Standverkauf: jede Unterseite hat links "Zurueck", in der
   Mitte den Titel; das Menue gruppiert wie die iOS-Einstellungen. */
.seite {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}
.seite .spalte { gap: 12px; }
.navleiste {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 -16px 8px;
  padding: 6px 8px;
  padding-top: calc(6px + env(safe-area-inset-top));
  background: var(--grund);   /* Safari vor 16.2 kennt color-mix nicht */
  background: color-mix(in srgb, var(--grund) 90%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--linie);
}
.navleiste h1 {
  margin: 0; font-size: 1rem; font-weight: 600; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
button.zurueck {
  justify-self: start; min-height: 44px; padding: 0 8px; border: none; background: none;
  color: var(--akzent-text); font-weight: 400; font-size: 1rem; white-space: nowrap;
}
.mitte > button.zurueck { margin: 0 -8px; }
.gruppen-titel {
  margin: 24px 16px 6px; font-size: 0.765rem; font-weight: 400;
  text-transform: uppercase; letter-spacing: .04em; color: var(--leise);
}
.gruppe { list-style: none; margin: 0; padding: 0; background: var(--flaeche);
  border-radius: var(--radius); overflow: hidden; }
.gruppe li + li { border-top: 1px solid var(--linie); }
.gruppe .zeile {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px;
  padding: 10px 16px; border: none; border-radius: 0; background: none; color: var(--text);
  font: inherit; font-weight: 400; text-align: left; text-decoration: none; white-space: normal;
}
.gruppe .zeile > span:first-child { flex: 1; min-width: 0; }
.gruppe .zeile:has(.detail) { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; }
.gruppe .zeile:has(.detail) .pfeil { grid-column: 2; grid-row: 1 / span 2; }
.gruppe .detail { grid-column: 1; color: var(--leise); font-size: 0.882rem; }
.gruppe .detail:empty { display: none; }
.gruppe .pfeil { color: var(--leise); font-size: 1.3rem; line-height: 1; }
.gruppe .zeile:active { background: var(--flaeche-2); }
@media (hover: hover) { .gruppe .zeile:hover { background: var(--flaeche-2); } }
.karte { background: var(--flaeche); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.karte h2 { margin: 0; font-size: 1.176rem; }
.karte .hinweis { margin: 0; }
.geraet-karte { gap: 2px; margin-top: 8px; }
.geraet-karte strong { font-size: 1.176rem; }
.start-kopf h1 { margin: 0; font-size: 1.765rem; }
.start-kopf .hinweis { margin: 4px 0 0; }
.seite select {
  font: inherit; min-height: 56px; width: 100%; padding: 0 12px;
  border: 1px solid var(--linie); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text);
}

/* Ziffernblock (Android-App am Tablet): fest unter der linken Spalte statt
   der Bildschirmtastatur. */
.ziffernblock {
  width: 100%;
  max-width: 340px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.ziffernblock[hidden] { display: none; }
.ziffernblock button {
  min-height: 56px;
  padding: 0;
  font-size: 1.412rem;
  font-weight: 600;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
}
.ziffernblock button:active { background: var(--akzent-leicht); }
.ziffernblock button:disabled { opacity: .35; }
.ziffernblock .ok { grid-column: span 2; background: var(--blau); border-color: var(--blau); color: #fff; }
.ziffernblock .leise-taste { color: var(--leise); }
.erledigt { color: var(--gruen); font-weight: 600; }

/* ---------------------------------------------------- Leiste
   Wie beim Standverkauf: die vier Arbeitsbereiche und die Einstellungen mit
   einem Tipp. Am Handy unten, am Tablet links am Rand. */
#arbeit > header { grid-template-columns: minmax(0, 1fr) !important; }
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: var(--flaeche);
  border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}
.leiste[hidden] { display: none; }
.leiste button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; padding: 6px 2px;
  background: none; border: 0; border-radius: 0; box-shadow: none;
  color: var(--leise); font: inherit; font-size: 0.706rem; font-weight: 600;
  overflow-wrap: normal; cursor: pointer;
}
.leiste svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.leiste button[aria-current="page"] { color: var(--akzent-text); }
body.mit-leiste { --leiste-h: calc(58px + env(safe-area-inset-bottom)); }
body.mit-leiste .ansicht { padding-bottom: calc(24px + var(--leiste-h)); }
body.mit-leiste .seite { padding-bottom: calc(32px + var(--leiste-h)); }
.seite label.schalter { display: flex; margin: 8px 0 0; }
.seite label.gross-schalter { font-size: 1.059rem !important; font-weight: 600; }
.seite details.zusatz { color: var(--leise); }
.seite details.zusatz summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }

@media (min-width: 820px) {
  .leiste {
    top: 0; right: auto; width: 84px;
    grid-auto-flow: row; grid-auto-rows: max-content; grid-auto-columns: auto;
    align-content: start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--linie);
    padding: calc(10px + env(safe-area-inset-top)) 0 env(safe-area-inset-bottom);
  }
  .leiste button { min-height: 72px; }
  body.mit-leiste { --leiste-h: 0px; padding-left: 84px; }
}
