/* =========================================================
   Weißalm Kasse — Stylesheet
   Mobile first, and built to feel like a native iPhone app:
   system font, grouped lists, tab bar, sheets, alerts,
   light and dark mode, a choice of colour schemes. Tap targets are sized for cold fingers.
   ========================================================= */

/* Custom properties ("CSS variables"). Defined once here, used
   everywhere below as var(--name). The names describe the JOB of a
   colour, not the colour itself — so dark mode and the colour schemes
   only have to swap the values in one place (see right below).

   Which values apply is decided by two attributes on <html>, set from
   the settings (js/prefs.js): data-theme="light|dark" and
   data-accent="forest|ocean|…". */
:root {
  color-scheme: light;                     /* the browser's own controls follow */
  --header: #1b4332;                       /* top bar, always dark green */
  --tint: #2d6a4f;                         /* buttons, links, selection */
  --on-tint: #ffffff;

  --bg: #f2f2f7;                           /* page background */
  --surface: #ffffff;                      /* cards, list groups */
  --surface-raised: #ffffff;               /* alerts, action sheets */
  --segment: #ffffff;                      /* the selected segment */
  --bar: rgba(249, 249, 249, 0.86);        /* translucent tab/bottom bar */
  --fill: rgba(120, 120, 128, 0.14);       /* chips, steppers, tracks */
  --pressed: rgba(120, 120, 128, 0.2);
  --separator: rgba(60, 60, 67, 0.22);
  --text: #000000;
  --text-dim: rgba(60, 60, 67, 0.68);
  --text-faint: rgba(60, 60, 67, 0.34);

  --red: #d70015;
  --amber: #b25000;
  --amber-bg: #fff4d6;
  --green: #248a3d;
  --backdrop: rgba(0, 0, 0, 0.4);

  --radius: 14px;
  --radius-sm: 10px;
  --gutter: 16px;                          /* space left and right of content */
  --tap: 50px;                             /* comfortable button height */
  --tabbar: 50px;

  /* Safe areas: the iPhone notch / home-indicator margins */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Set from JavaScript (ui.js): the part of the screen not covered
     by the keyboard. Falls back to the whole screen. */
  --visible-height: 100%;
  --visible-top: 0px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --header: #12291f;
  --tint: #40916c;

  --bg: #000000;
  --surface: #1c1c1e;
  --surface-raised: #2c2c2e;
  --segment: #636366;
  --bar: rgba(22, 22, 24, 0.86);
  --fill: rgba(120, 120, 128, 0.28);
  --pressed: rgba(120, 120, 128, 0.4);
  --separator: rgba(84, 84, 88, 0.7);
  --text: #ffffff;
  --text-dim: rgba(235, 235, 245, 0.64);
  --text-faint: rgba(235, 235, 245, 0.3);

  --red: #ff6961;
  --amber: #ffb340;
  --amber-bg: #3a2a00;
  --green: #30d158;
  --backdrop: rgba(0, 0, 0, 0.6);
}

/* Colour schemes. Each one only replaces the top bar and the accent
   colour, once for light and once for dark. "forest" (green) is the
   default above. --on-tint is the text colour on top of the accent. */
:root[data-accent="ocean"] { --header: #12355b; --tint: #1f6fb5; }
:root[data-accent="ocean"][data-theme="dark"] { --header: #0c2238; --tint: #3d8fd9; }

:root[data-accent="berry"] { --header: #5c1a2e; --tint: #a3324f; }
:root[data-accent="berry"][data-theme="dark"] { --header: #3a101d; --tint: #cf5674; }

:root[data-accent="sunset"] { --header: #7a3310; --tint: #b8500f; }
:root[data-accent="sunset"][data-theme="dark"] { --header: #4a1f0a; --tint: #f08a45; --on-tint: #1f0d02; }

:root[data-accent="slate"] { --header: #2b2f36; --tint: #4b5563; }
:root[data-accent="slate"][data-theme="dark"] { --header: #1c1e22; --tint: #b4bcc8; --on-tint: #101214; }

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must always win, even over display:flex below. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.3 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;            /* no rubber-band bounce of the whole page */
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  /* An app's labels and buttons can't be selected or "peeked" by a long press */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  /* no double-tap zoom, so quick repeated taps register immediately */
  touch-action: manipulation;
}

button, input {
  font: inherit;
  color: inherit;
  margin: 0;
}
button {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
input {
  -webkit-user-select: text;
  user-select: text;
}
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }

.icon { width: 24px; height: 24px; flex: none; }

/* ---------------------------------------------------------
   Screens — only those with .is-active are visible
   --------------------------------------------------------- */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  background: var(--bg);
  z-index: 1;
}
.screen.is-active { display: flex; }
/* Pushed screens lie above the tab bar and cover it. */
.screen--pushed {
  z-index: 10;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}

.scroll-area {
  flex: 1;                              /* takes all leftover height */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--gutter);
}
/* On tab screens the content must be able to scroll clear of the tab bar. */
.scroll-area--tabbed {
  padding-bottom: calc(var(--tabbar) + var(--safe-bottom) + var(--gutter));
}

/* ---------------------------------------------------------
   Top bar
   --------------------------------------------------------- */
.navbar {
  flex: none;
  padding-top: var(--safe-top);
  background: var(--header);
  color: #fff;
}
/* The test copy (…/beta/) wears warning stripes on every top bar, so it
   is never mistaken for the real app. */
.is-beta .navbar {
  background-image: repeating-linear-gradient(135deg, rgba(255, 190, 0, 0.4) 0 12px, transparent 12px 24px);
}
.navbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
}
.navbar-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.navbar-side { display: flex; align-items: center; min-width: 0; }
.navbar-side--right { justify-content: flex-end; grid-column: 3; }

/* Main screens: a big title below the button row, like iOS "large titles" */
.large-title {
  padding: 0 var(--gutter) 10px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: #fff;
}
.nav-btn:active { opacity: 0.5; }
.nav-btn:disabled { opacity: 0.35; }
.nav-btn--back {
  justify-content: flex-start;
  padding-right: 8px;
  font-size: 17px;
  overflow: hidden;
}
.nav-btn--back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn--back .icon { margin-right: -2px; }
/* Name of the catalog in use, top left on the Tische screen */
.nav-btn--catalog {
  justify-content: flex-start;
  max-width: 100%;
  padding: 0 10px;
  font-size: 15px;
  font-weight: 600;
}
.nav-btn--catalog span {
  padding: 4px 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   Tab bar
   --------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  height: calc(var(--tabbar) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bar);
  /* frosted glass: blur whatever scrolls underneath */
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}
.tabbar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 500;
}
.tabbar-btn.is-active { color: var(--tint); }

/* ---------------------------------------------------------
   Bottom bar + buttons
   --------------------------------------------------------- */
.bottombar {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 10px var(--gutter) calc(var(--safe-bottom) + 10px);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}
.bottombar--split > .btn { flex: 0 0 44%; }

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn:disabled { opacity: 0.35; }
.btn-block { width: 100%; }
.btn-primary { background: var(--tint); color: var(--on-tint); }

.btn-text {
  min-height: 44px;
  padding: 0 4px;
  color: var(--tint);
  font-size: 17px;
  font-weight: 600;
}
.btn-text:active { opacity: 0.5; }

/* ---------------------------------------------------------
   Grouped lists — the building block of most screens.
   A .group is a rounded card; each .row inside is one line,
   separated from the next by a hairline.
   --------------------------------------------------------- */
.group {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.group + .group { margin-top: 20px; }

.group-header {
  margin: 24px var(--gutter) 7px;
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: var(--text-dim);
}
.group-header:first-child { margin-top: 4px; }
.group + .group-header, div + .group-header { margin-top: 24px; }
.group-footer {
  margin: 8px var(--gutter) 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-dim);
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px var(--gutter);
  background: var(--surface);
}
/* Hairline between rows, starting at the text like on iOS */
.row + .row::before,
#screen-count .group > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: 0;
  border-top: 0.5px solid var(--separator);
}
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-text .row-label { flex: none; }
.row-detail { font-size: 13px; color: var(--text-dim); }
.row-value {
  flex: none;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;     /* all digits equally wide, so columns line up */
}
.row-value.is-good { color: var(--green); }
.row-value.is-bad { color: var(--red); }
.row-value--big { font-size: 24px; color: var(--text); }
.row-value--big.is-missing { color: var(--red); }
.row > .icon { width: 16px; height: 16px; color: var(--text-faint); margin-left: -4px; }

/* cursor:pointer also matters on iOS: Safari only sends click events to
   elements it considers clickable. */
.row--link, .sheet-backdrop, .modal-backdrop { cursor: pointer; }
.row--link:active, .row--button:active { background: var(--pressed); }
.row--button { color: var(--tint); cursor: pointer; }
.row--button.is-danger { color: var(--red); }
.row--total { font-weight: 600; }
.row--total .row-value { color: var(--text); }

.row-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  background: transparent;
  text-align: right;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
  caret-color: var(--tint);
}
.row-input::placeholder { color: var(--text-faint); font-weight: 400; }

.empty-hint {
  margin: 48px 24px;
  text-align: center;
  color: var(--text-dim);
  line-height: 1.5;
}

.card {
  padding: 14px var(--gutter);
  background: var(--surface);
  border-radius: var(--radius);
}

/* ---------------------------------------------------------
   Tables screen
   --------------------------------------------------------- */
.table-grid {
  display: grid;
  /* as many columns as fit: two on a phone, more on a tablet */
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 12px;
}

.table-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 116px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
  transition: transform 0.08s ease;
}
.table-card:active { transform: scale(0.97); background: var(--pressed); }
.table-card-name { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.table-card-meta { font-size: 13px; color: var(--text-dim); }
.table-card-paid { color: var(--amber); }
.table-card-total {
  margin-top: auto;
  padding-top: 8px;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.table-card--new {
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1.5px dashed var(--text-faint);
  color: var(--tint);
  font-size: 15px;
  font-weight: 600;
}
.table-card--new .icon { width: 28px; height: 28px; }
/* Below a table plan the "extra table" tile is a side note, not the main action */
.table-card--slim { flex-direction: row; min-height: 62px; }
.table-card--slim .icon { width: 22px; height: 22px; }

/* The table plan: one block per area, a tile per fixed table or room */
.area-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 4px 8px;
}
.area-header:first-child { margin-top: 4px; }
.area-title { font-size: 17px; font-weight: 600; }
.area-count { font-size: 13px; color: var(--text-dim); }

.place-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
/* short names like "U1": four in a row */
.place-grid--compact { grid-template-columns: repeat(4, 1fr); }
.place-grid--compact .place-tile { align-items: center; text-align: center; padding: 8px 4px; }

.place-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  min-height: 62px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-dim);                  /* free = quiet */
  text-align: left;
  transition: transform 0.08s ease;
}
.place-tile:active { transform: scale(0.96); background: var(--pressed); }
.place-name { max-width: 100%; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.place-note {
  max-width: 100%;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}
.place-amount { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* occupied = filled in the app's green, so it stands out at a glance */
.place-tile.is-busy { background: var(--tint); color: var(--on-tint); }
.place-tile.is-busy:active { background: var(--tint); opacity: 0.8; }
/* part of the bill is already paid */
.place-tile.is-partly-paid { background: var(--amber-bg); color: var(--text); }
.place-tile.is-partly-paid:active { background: var(--amber-bg); }
.place-tile.is-partly-paid .place-amount { color: var(--amber); }

/* In the "Umsetzen" sheet: occupied places can't be chosen */
.place-tile:disabled { opacity: 0.38; }
/* reserved for later today: spoken for, whether free or taken until then */
.place-tile.is-reserved { box-shadow: inset 0 0 0 1.5px var(--amber); }
.place-tile.is-reserved:not(.is-busy) .place-note { color: var(--amber); }
.place-tile.is-busy.is-reserved { box-shadow: inset 0 0 0 2.5px var(--amber); }
.place-tile.is-current { opacity: 0.7; box-shadow: inset 0 0 0 1.5px var(--tint); }

.plan-edit-link { display: block; margin: 18px auto 0; font-weight: 400; font-size: 15px; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}
.notice strong { display: block; font-size: 15px; }
.notice p { margin-top: 2px; font-size: 13px; line-height: 1.35; color: var(--text-dim); }
.notice > div { flex: 1; }
.notice > .icon { color: var(--tint); }
.notice > .icon:last-child { align-self: center; width: 16px; height: 16px; color: var(--text-faint); }
.notice--warning { background: var(--amber-bg); }
.notice--warning > .icon { color: var(--amber); }
.notice--warning p { color: var(--text); }
.notice--action:active { background: var(--pressed); }

/* ---------------------------------------------------------
   Order screen — like a waiter's handheld: the order so far on
   top, category tabs and a dense product grid underneath.
   --------------------------------------------------------- */

/* The order so far. Its height is fixed on purpose: if it grew with
   every new line, the product grid below would slide away under the
   finger in the middle of a fast run of taps. */
.order-list {
  position: relative;                    /* rows measure their offset against this */
  flex: 0 0 27%;
  min-height: 132px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
}
.order-list-empty {
  padding: 28px 24px;
  text-align: center;
  font-size: 15px;
  color: var(--text-dim);
}

.order-row {
  position: relative;
  overflow: hidden;
  /* sideways drags are ours (swipe), up/down stays with the browser (scroll) */
  touch-action: pan-y;
}
.order-row + .order-row { border-top: 0.5px solid var(--separator); }

.order-row-content {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  background: var(--surface);
  transition: transform 0.2s ease-out;
}
/* While the finger is down the line must follow it exactly, without easing. */
.order-row.is-swiping .order-row-content { transition: none; }
.order-row.is-changed .order-row-content { animation: row-flash 0.7s ease-out; }
@keyframes row-flash { from { background: color-mix(in srgb, var(--tint) 30%, var(--surface)); } }

.order-row-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  align-self: stretch;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  color: var(--tint);
}
.order-row-btn:active { background: var(--pressed); }
.order-row-btn:disabled { opacity: 0.25; }
.order-row-btn--remove { color: var(--red); }
.order-row-btn .icon { width: 20px; height: 20px; }

/* the quantity is a button: tap it to type the amount */
.order-row-qty {
  flex: none;
  align-self: stretch;
  min-width: 36px;
  margin-right: 6px;
  padding: 0 4px;
  border-radius: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.order-row-qty:active { background: var(--pressed); }
.order-row-name {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  text-align: left;
  padding: 4px 0;
  font-size: 16px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.order-row-name small { font-size: 12px; color: var(--amber); white-space: nowrap; }
#report-note { margin-top: 12px; }
.order-row-name small.order-row-given { color: var(--tint); font-weight: 600; }
.order-row-total {
  flex: none;
  padding-left: 8px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* What shows through underneath a line while it is swiped aside:
   amber "−1" on the left, red "Alle entfernen" on the right. */
.order-row-hint {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  align-items: center;
  padding: 0 16px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  opacity: 0.55;
}
.order-row-hint--minus { background: var(--amber); justify-content: flex-start; }
.order-row-hint--remove { background: var(--red); justify-content: flex-end; }
.order-row.is-swiping-minus .order-row-hint--minus,
.order-row.is-swiping-remove .order-row-hint--remove { display: flex; }
/* dragged far enough: letting go now does it */
.order-row.is-armed .order-row-hint { opacity: 1; }
:root[data-theme="dark"] .order-row-hint { color: #000; }

/* The strip between order and products; tap it to give the order the whole screen. */
.order-list-toggle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  background: var(--surface);
  border-top: 0.5px solid var(--separator);
  border-bottom: 0.5px solid var(--separator);
  color: var(--text-faint);
}
.order-list-toggle:active { background: var(--pressed); }
.order-list-toggle .icon { width: 20px; height: 20px; transition: transform 0.2s ease; }

#screen-order.is-expanded .order-list { flex: 1; }
#screen-order.is-expanded .order-list-toggle .icon { transform: rotate(180deg); }
#screen-order.is-expanded .tabs-row,
#screen-order.is-expanded .scroll-area { display: none; }

/* The "1×" quantity button, fixed at the left, and the category tabs,
   which scroll sideways next to it. */
.tabs-row {
  flex: none;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 0.5px solid var(--separator);
}
.qty-btn {
  flex: none;
  min-width: 46px;
  height: 36px;
  margin-left: 10px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--tint);
  color: var(--tint);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qty-btn:active { background: var(--pressed); }
/* armed: the next product is added this many times */
.qty-btn.is-active { background: var(--tint); color: var(--on-tint); }

.tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 15px;
  border-radius: 18px;
  background: var(--fill);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.tab.is-active { background: var(--tint); color: var(--on-tint); }

/* Small tiles, three in a row: as many products as possible reachable
   without scrolling. */
#screen-order .scroll-area { padding: 10px; }
.item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
@media (min-width: 600px) {
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
}

.item-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  min-height: 58px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  transition: transform 0.08s ease;
}
.item-btn:active { transform: scale(0.95); background: var(--pressed); }
.item-btn.is-soldout { opacity: 0.45; }
.item-btn.is-soldout .item-btn-name { text-decoration: line-through; }
.item-btn-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
  /* long German words break at syllables ("Johannis-beerlikör") */
  -webkit-hyphens: auto;
  hyphens: auto;
}
.item-btn-price { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
/* How many are on the table: sits on the tile's corner, so it costs the name no room */
.item-btn-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--tint);
  color: var(--on-tint);
  box-shadow: 0 0 0 2px var(--bg);
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.item-btn-badge.is-bumped { animation: bump 0.22s ease-out; }
@keyframes bump { 40% { transform: scale(1.3); } }

/* "Layout bearbeiten": the product grid as an editor. The order and the
   pay bar step aside; every tile shows a star and can be dragged. */
#edit-bar { display: none; align-items: center; }
.edit-bar-hint { flex: 1; font-size: 13px; line-height: 1.3; color: var(--text-dim); }
#screen-order.is-editing #edit-bar { display: flex; }
#screen-order.is-editing #order-bar,
#screen-order.is-editing .order-list,
#screen-order.is-editing .order-list-toggle,
#screen-order.is-editing .qty-btn,
#screen-order.is-editing #btn-order-more { display: none; }
#screen-order.is-editing .item-btn { outline: 1.5px dashed var(--text-faint); outline-offset: -1.5px; }
#screen-order.is-editing .item-btn-name { padding-right: 18px; }
.item-btn-star {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 18px;
  line-height: 1;
  color: var(--amber);
}
/* whatever is being dragged (a tile, a row): above the others, and
   transparent to the pointer so the one underneath can be found */
.is-lifted {
  position: relative;
  z-index: 5;
  pointer-events: none;
  transition: none;
  opacity: 0.92;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.row.is-lifted::before, .row.is-lifted + .row::before { display: none; }

/* Order summary in the bottom bar */
.order-summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--fill);
  text-align: left;
}
.order-summary-count { font-size: 12px; color: var(--text-dim); }
.order-summary-total { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------
   Kassenabschluss
   --------------------------------------------------------- */
.count-day { margin: 0 var(--gutter); font-size: 15px; font-weight: 600; color: var(--text); }
/* the counting aid: "50 €  ×  [ 3 ]        150,00 €" */
.count-piece .row-label { flex: 0 0 78px; font-variant-numeric: tabular-nums; }
.count-times { color: var(--text-faint); }
.count-input {
  width: 64px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: var(--fill);
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.count-piece-sum { flex: 1; text-align: right; }
/* hairlines between the rows of a list where some rows are a <label> in an <li> */
#screen-count .group > li { position: relative; }
/* the difference: green when it matches, red when it doesn't */
#screen-count .is-good { color: var(--green); }
#screen-count .is-missing { color: var(--red); }

/* ---------------------------------------------------------
   Stepper (− 2 +)
   --------------------------------------------------------- */
.stepper {
  flex: none;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  background: var(--fill);
}
.stepper-btn {
  flex: none;
  width: 44px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  font-size: 22px;
  line-height: 1;
}
.stepper .stepper-btn { background: transparent; }
.stepper-btn:active { background: var(--pressed); }
.stepper-btn:disabled { opacity: 0.3; }
.stepper-value {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}


/* ---------------------------------------------------------
   Payment screen
   --------------------------------------------------------- */
.segmented {
  display: flex;
  padding: 2px;
  margin-bottom: var(--gutter);
  border-radius: 9px;
  background: var(--fill);
}
.segmented-btn {
  flex: 1;
  height: 34px;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 500;
}
.segmented-btn.is-active {
  background: var(--segment);
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.06);
}

.pay-due {
  display: flex;
  flex-direction: column;
  margin: var(--gutter) 0 0;
  padding: 14px var(--gutter);
  border-radius: 16px;
  background: var(--header);
  color: #fff;
}
.pay-due-label { font-size: 13px; opacity: 0.75; }
.pay-due-value { font-size: 40px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pay-due-note { font-size: 13px; opacity: 0.75; }
.pay-due-note:empty { display: none; }

.pick-line { cursor: pointer; }
.pick-line:active { background: var(--pressed); }
.pick-count {
  flex: none;
  min-width: 46px;
  text-align: right;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.pick-line.is-picked .pick-count { color: var(--tint); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  height: 40px;
  padding: 0 15px;
  border-radius: 20px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chip:active { background: var(--pressed); }
.chip.is-active { background: var(--tint); color: var(--on-tint); }
.chip:disabled { opacity: 0.35; }

.pay-result { margin-top: 20px; }
.pay-result .row-value { color: var(--text); }
#pay-tip { color: var(--amber); }

/* ---------------------------------------------------------
   Menu editor — drag handles
   --------------------------------------------------------- */
.drag-handle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px -12px -6px -6px;
  color: var(--text-faint);
  cursor: grab;
  /* the browser must not scroll the page while we drag */
  touch-action: none;
}

/* ---------------------------------------------------------
   Report
   --------------------------------------------------------- */
/* Tag | Woche | Monat | Jahr above the arrows */
.report-periods { flex: none; padding: 8px var(--gutter) 2px; background: var(--surface); }
.report-periods .segmented { display: flex; width: 100%; }

.day-switcher {
  flex: none;
  display: flex;
  align-items: center;
  padding: 4px 6px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--separator);
}
.day-switcher-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--tint);
}
.day-switcher-btn:active { opacity: 0.5; }
.day-switcher-btn:disabled { color: var(--text-faint); }
.day-switcher-label { flex: 1; text-align: center; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
}
.stat-label { font-size: 13px; color: var(--text-dim); }
.stat-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat--hero { grid-column: 1 / -1; }
.stat--hero .stat-value { font-size: 40px; line-height: 1.1; }

/* Bar chart: one column per hour. The track is the plotting area with
   the baseline at its bottom edge; the bar grows up from it. */
.chart-readout { font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-plot { display: flex; gap: 2px; height: 160px; margin-top: 12px; }
.chart-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chart-track {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid var(--separator);
  /* Grid lines: a hairline at the top of each axis step. --steps is
     set on the chart from JavaScript. */
  background-image: linear-gradient(to bottom, var(--separator) 1px, transparent 1px);
  background-size: 100% calc(100% / var(--steps, 4));
}
.chart-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 4px 4px 0 0;
  background: var(--tint);
  opacity: 0.45;
}
.chart-col.is-selected .chart-bar { opacity: 1; }
.chart-tick { padding-top: 5px; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.chart-col.is-selected .chart-tick { color: var(--text); font-weight: 600; }

/* The amounts on the right. Each label hangs at the height of its step. */
.chart-axis { flex: none; display: flex; flex-direction: column; min-width: 38px; margin-left: 6px; }
.chart-axis .chart-tick { visibility: hidden; }
.chart-axis-track { flex: 1; position: relative; }
.chart-axis-label {
  position: absolute;
  left: 0;
  transform: translateY(50%);
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* small variant of the segmented control, next to a heading */
.segmented--small { flex: none; margin: 0; text-transform: none; letter-spacing: 0; }
.segmented--small .segmented-btn { height: 28px; padding: 0 12px; font-size: 13px; color: var(--text); }

/* "Kategorien" view: one card per category, its totals as the first row */
.item-stat--category { background: var(--fill); }
.item-stat--category .row-label { font-weight: 700; }
.item-stat--category .item-stat-revenue { color: var(--text); font-weight: 600; }
#report-body .group + .group { margin-top: 12px; }

.item-stat-track { height: 4px; margin-top: 6px; border-radius: 2px; background: var(--fill); }
.item-stat-bar { display: block; height: 100%; min-width: 4px; border-radius: 2px; background: var(--tint); }
.item-stat-qty { flex: none; min-width: 38px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.item-stat-revenue { flex: none; min-width: 74px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------
   Bottom sheets
   --------------------------------------------------------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  animation: fade-in 0.25s ease-out;
}
.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 88%;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  animation: sheet-up 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-grabber {
  flex: none;
  width: 36px;
  height: 5px;
  margin: 6px auto 0;
  border-radius: 3px;
  background: var(--text-faint);
}
.sheet-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px var(--gutter) 6px;
}
.sheet-title { font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px var(--gutter) calc(var(--safe-bottom) + var(--gutter));
}
.sheet-scroll > .group-footer:first-child { margin-top: 0; margin-bottom: 12px; }
/* Action sheet: floating groups of big centred buttons */
.action-sheet-panel {
  position: relative;
  padding: 0 8px calc(var(--safe-bottom) + 8px);
  animation: sheet-up 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}
.action-sheet-group { border-radius: var(--radius); overflow: hidden; background: var(--surface-raised); }
.action-sheet-title {
  padding: 14px var(--gutter);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 0.5px solid var(--separator);
}
.action-sheet-btn {
  display: block;
  width: 100%;
  min-height: 57px;
  padding: 0 var(--gutter);
  background: var(--surface-raised);
  color: var(--tint);
  font-size: 20px;
}
.action-sheet-btn + .action-sheet-btn { border-top: 0.5px solid var(--separator); }
.action-sheet-btn:active { background: var(--pressed); }
.action-sheet-btn.is-danger { color: var(--red); }
.action-sheet-cancel { margin-top: 8px; border-radius: var(--radius); font-weight: 600; }

/* ---------------------------------------------------------
   Modal (alert) + toast
   --------------------------------------------------------- */
.modal {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--visible-top);
  height: var(--visible-height);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  animation: fade-in 0.2s ease-out;
}
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 300px;
  max-height: 100%;
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--surface-raised);
  text-align: center;
  animation: alert-in 0.22s ease-out;
}
@keyframes alert-in { from { transform: scale(1.12); opacity: 0; } }

.modal-body { padding: 20px var(--gutter) 18px; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-message { margin-top: 4px; font-size: 13px; line-height: 1.35; }
.modal-fields { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; text-align: left; }
.modal-field-label { display: block; margin: 0 0 4px 2px; font-size: 12px; color: var(--text-dim); }
.modal-input {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 0.5px solid var(--separator);
  border-radius: 9px;
  background: var(--bg);
  /* at least 16px, or iOS zooms into the page when the field is focused */
  font-size: 17px;
  outline: none;
}
.modal-input:focus { border-color: var(--tint); }

.modal-actions { display: flex; border-top: 0.5px solid var(--separator); }
.modal-btn {
  flex: 1;
  min-height: 46px;
  color: var(--tint);
  font-size: 17px;
}
.modal-btn + .modal-btn { border-left: 0.5px solid var(--separator); }
.modal-btn:active { background: var(--pressed); }
.modal-btn--default { font-weight: 600; }
.modal-btn--wide { display: block; width: 100%; border-top: 0.5px solid var(--separator); }
.modal-btn.is-danger { color: var(--red); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 76px);
  z-index: 40;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 22px;
  background: rgba(44, 44, 46, 0.94);
  color: #fff;
  font-size: 15px;
  text-align: center;
  pointer-events: none;
  animation: toast-in 0.22s ease-out;
}
/* A toast with a button ("Rückgängig") has to be tappable. */
.toast.has-action { display: flex; align-items: center; gap: 14px; padding-right: 8px; pointer-events: auto; }
.toast-action {
  flex: none;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}
.toast-action:active { background: rgba(255, 255, 255, 0.32); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

.fatal-error { padding: calc(var(--safe-top) + 20px) 20px 20px; color: var(--red); }

/* People who switched off animations in the iOS settings get none. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
