/* ============================================================
   Opa Peters - Bestell- & Zeiterfassungssystem
   Design-System v2 (mobile-first, ueberarbeitet fuer Hand & Desktop)
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f4ee;
  --text: #1c2430;
  --muted: #647085;
  --line: #e4e7ec;
  --line-strong: #cdd3dd;

  --primary: #23406b;
  --primary-2: #16294a;
  --primary-soft: #eaf0fb;
  --accent: #e28a2f;
  --accent-2: #c65a4b;
  --accent-soft: #fdf0dd;

  --green-bg: #e8f7ee;
  --green-text: #1f7a49;
  --red-bg: #fdecec;
  --red-text: #b3362b;
  --blue-bg: #e7f1fc;
  --blue-text: #1c5c94;

  --shadow: 0 20px 45px rgba(20, 29, 46, .16);
  --shadow-soft: 0 6px 18px rgba(20, 29, 46, .08);
  --shadow-tiny: 0 1px 2px rgba(20, 29, 46, .06);

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
}

/* ---------- 2. Basis / Reset ---------- */
* { box-sizing: border-box; }
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html.modal-open,
html.modal-open body { overflow: hidden; }

h1 { margin: 0; font-size: 21px; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h2 { margin: 0 0 12px; font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
h3 { margin: 12px 0 8px; font-size: 16px; font-weight: 750; }
p { line-height: 1.55; margin: 0 0 10px; }
strong { font-weight: 750; }
.muted { color: var(--muted); font-size: 14px; margin-top: 4px; }
.full { grid-column: 1 / -1; }

a { color: var(--primary); }

a:focus-visible,
button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

::selection { background: var(--accent-soft); color: var(--primary-2); }

/* ---------- 3. Kopfzeile & Navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(14px + var(--safe-top)) 24px 14px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar nav:empty { display: none; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; color: var(--text); }
.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-tiny);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 650; }

nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
nav a, nav .nav-user {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 999px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
nav a:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.nav-user { color: var(--primary) !important; background: var(--primary-soft) !important; border-color: #c9d8f2 !important; }

main { width: 100%; max-width: 1180px; margin: 24px auto 80px; padding: 0 20px; overflow-x: clip; }

/* ---------- 4. Layout-Bausteine ---------- */
.box {
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}
.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2::after, .cart-card h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.admin-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-tiny);
}
.admin-menu .button {
  width: 100%;
  min-height: 42px;
  padding: 9px 15px;
  border: none;
  box-shadow: none;
  border-radius: 999px;
  font-size: 13.5px;
}
.admin-menu .button:hover { background: var(--primary-soft); color: var(--primary); transform: none; }
.admin-menu .button.logout-button { margin-left: 0; }
.admin-mobile-menu { display: none; }
.admin-mobile-links { display: grid; gap: 8px; padding-top: 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-tiny);
}
.stat strong { display: block; font-size: 26px; line-height: 1.1; font-weight: 800; color: var(--primary); }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  background: var(--surface-2);
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}
.filters label { margin: 0; }

.order-search {
  grid-template-columns: minmax(240px, 1.8fr) minmax(160px, .7fr) auto auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.order-search label span {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.order-search input, .order-search select { margin-top: 0; background: #ffffff; }
.search-main input { min-height: 54px; font-size: 17px; border-radius: 999px; padding-left: 20px; }
.search-category select { border-radius: 999px; }
.product-search { margin: 16px 0 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 16px; margin: 0 0 24px; }
.category-sections { display: grid; gap: 14px; }
.category-panel {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 6px 16px 2px;
  box-shadow: var(--shadow-tiny);
}
.category-panel summary {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  font-size: 17px;
}
.category-panel summary > * { min-width: 0; }
.category-panel summary::-webkit-details-marker { display: none; }
.category-panel summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 10px;
  color: var(--accent-2);
  transition: transform .15s ease;
}
.category-panel[open] summary::before { transform: rotate(90deg); }
.category-panel summary span {
  min-width: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  text-align: center;
  background: var(--accent-soft);
  border: 1px solid #f0d3a3;
  color: #8a5417;
  font-size: 12.5px;
  font-weight: 800;
}
.category-panel .grid { margin-top: 10px; }
.admin-toggle-panel, .admin-product-panel { margin-bottom: 14px; }
.admin-toggle-panel > form, .admin-product-panel > .table-wrap { margin-top: 12px; }
.admin-toggle-panel > summary span { min-width: 36px; }
.order-combine-bar { margin-bottom: 0; }
.order-select {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
}
.order-select input, .combine-order-check {
  width: 22px;
  height: 22px;
  min-height: 22px;
  accent-color: var(--primary);
}
.location-category-visibility { grid-column: 1 / -1; }

/* ---------- 5. Formulare & Buttons ---------- */
label { display: block; font-weight: 700; margin: 12px 0; color: var(--text); font-size: 14px; }
input, select, textarea {
  width: 100%;
  margin-top: 7px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  font: inherit;
  outline: none;
  min-height: 46px;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(35, 64, 107, .12); }
input[type="file"] { padding: 10px; background: var(--surface-2); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #9aa4b2; }

.password-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 7px; }
.password-wrap input { margin-top: 0; }
.password-toggle { min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm); }

button, .button {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  cursor: pointer;
  background: #ffffff;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14.5px;
  min-height: 46px;
  white-space: nowrap;
  box-shadow: var(--shadow-tiny);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
button:hover, .button:hover { background: var(--primary-soft); border-color: #c9d8f2; }
button:active, .button:active { transform: translateY(1px); }

.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-2);
  box-shadow: 0 10px 22px rgba(35, 64, 107, .28);
}
.primary:hover { background: var(--primary-2); color: #ffffff; }

.secondary { background: var(--surface-2); color: var(--text); }

.danger, .logout-button {
  border-color: #f3c1ba;
  color: var(--red-text);
  background: var(--red-bg);
}
.danger:hover, .logout-button:hover { background: #fbdcd8; border-color: #ef9c92; }

.install-app {
  position: fixed;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 40;
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-2);
  box-shadow: var(--shadow);
}
@media (display-mode: standalone) { .install-app { display: none !important; } }
.install-help {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center; padding: 20px;
  background: rgba(15, 23, 42, .55);
}
.install-help[hidden] { display: none; }
.install-help-card {
  position: relative;
  width: min(100%, 430px);
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.install-help-close { position: absolute; right: 12px; top: 12px; min-height: 34px; width: 34px; padding: 0; border-radius: 999px; }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; align-items: start; }
.two button { align-self: end; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
.compact-form { align-items: end; }

.visibility-box { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px; margin: 11px 0; background: var(--surface-2); }
.visibility-box legend { font-weight: 750; padding: 0 8px; }
.visibility-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.visibility-option { position: relative; margin: 0; }
.visibility-option input { position: absolute; opacity: 0; pointer-events: none; }
.visibility-option span {
  display: flex; align-items: center; min-height: 48px;
  padding: 12px 14px 12px 42px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: #ffffff;
  color: var(--muted); font-weight: 700; transition: background .12s ease, border-color .12s ease;
}
.visibility-option span::before {
  content: ""; position: absolute; left: 14px; width: 17px; height: 17px;
  border-radius: 999px; border: 2px solid var(--line-strong); background: white;
}
.visibility-option input:checked + span { background: var(--green-bg); color: var(--green-text); border-color: #9ad6b5; }
.visibility-option input:checked + span::before { border-color: var(--green-text); background: var(--green-text); box-shadow: inset 0 0 0 4px white; }
.product-visibility-grid { margin: 12px 0 16px; }
.product-visibility-option span { flex-direction: column; align-items: flex-start; gap: 3px; }
.product-visibility-option small { color: var(--muted); font-size: 12px; font-weight: 650; }
.visibility-save {
  position: sticky;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 20;
  width: min(100%, 420px);
  margin: 14px auto 0;
}

.check { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 10px 0; color: var(--muted); }
.check input[type="checkbox"] {
  -webkit-appearance: checkbox; appearance: auto;
  width: 22px; height: 22px; min-height: 22px; margin: 0; padding: 0; flex: 0 0 auto;
  accent-color: var(--green-text);
}
.feature-check { min-height: 48px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #ffffff; }
.feature-check:has(input:checked) { color: var(--green-text); background: var(--green-bg); border-color: #9ad6b5; }

.location-list { display: grid; gap: 12px; margin-bottom: 14px; }
.location-row {
  display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 12px; align-items: end;
  padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.location-row label { margin: 0; }
.remove-check { min-height: 46px; align-items: center; }
.new-location { margin: 14px 0; grid-template-columns: repeat(3, minmax(170px, 1fr)); }
.personal-greeting { margin: 4px 0 0; color: var(--green-text); font-weight: 800; font-size: 16px; }
.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 4px 0 2px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #f0d3a3;
  color: #8a5417;
  font-size: 12.5px;
  font-weight: 800;
}

.choice-actions { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 18px 0; }
.choice-actions .button { min-height: 74px; font-size: 17px; border-radius: var(--radius-lg); }

.time-form select { min-height: 54px; font-size: 16px; }
.time-entry-list { display: grid; gap: 12px; }
.time-entry-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden; }
.time-entry-summary {
  min-height: 68px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.time-entry-summary::-webkit-details-marker { display: none; }
.time-entry-summary::after {
  content: "+";
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 900;
}
.time-entry-card[open] .time-entry-summary::after { content: "-"; }
.time-entry-main, .time-entry-meta { display: grid; gap: 4px; }
.time-entry-main span, .time-entry-meta span { color: var(--muted); font-size: 14px; font-weight: 700; }
.time-entry-meta { justify-items: end; text-align: right; }
.time-entry-edit { padding: 0 14px 14px; display: grid; gap: 12px; border-top: 1px solid var(--line); }
.time-entry-form { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.time-entry-form label { margin: 0; }
.entry-meta { color: var(--muted); font-size: 13px; font-weight: 700; align-self: center; }

/* ---------- 6. Produktkarten & Mengen-Auswahl ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-tiny);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  overflow: hidden;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-soft); }
.card img, .noimg {
  width: 100%; height: 150px; object-fit: contain; border-radius: var(--radius-md);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 700; border: 1px solid var(--line);
}
.card h3 { min-height: 38px; margin-bottom: 2px; font-size: 15.5px; }
.category-badge, .pill {
  display: inline-flex; width: fit-content; align-items: center; gap: 6px;
  margin-top: 10px; padding: 5px 11px; border-radius: 999px;
  background: var(--accent-soft);
  color: #8a5417; font-size: 12px; font-weight: 750; border: 1px solid #f0d3a3;
}
.pill { background: var(--blue-bg); color: var(--blue-text); border-color: #bcdcf6; }
.card label { margin-top: auto; padding-top: 8px; font-size: 13px; }
.card input[type="number"] { height: 46px; font-size: 17px; font-weight: 750; text-align: center; border-radius: var(--radius-sm); background: #ffffff; }

.quantity-control { display: grid; grid-template-columns: 48px minmax(70px, 1fr) 48px; gap: 8px; align-items: center; margin-top: auto; padding-top: 10px; }
.quantity-control button {
  width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 999px; font-size: 22px; line-height: 1;
  background: var(--primary); color: #ffffff; border-color: var(--primary-2); box-shadow: none;
}
.quantity-control button:hover { background: var(--primary-2); color: #ffffff; }
.quantity-control input { border-color: var(--line-strong); background: #ffffff; }
.quantity-control.small { grid-template-columns: 40px 60px 40px; padding: 0; margin: 0; }
.quantity-control.small button { width: 40px; height: 40px; min-height: 40px; font-size: 19px; }
.quantity-control.small input { min-height: 40px; padding: 8px; }

form[action="/order"] > button.primary {
  position: sticky; bottom: calc(14px + var(--safe-bottom)); z-index: 25;
  width: min(100%, 520px); margin: 8px auto 0; display: flex;
  min-height: 56px; border-radius: 999px; font-size: 16px;
}
.order-count { padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .35); border: 1px solid rgba(255, 255, 255, .5); font-size: 12px; }

/* ---------- 7. Tabellen ---------- */
.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: var(--radius-lg);
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; background: #ffffff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr:nth-child(even) td { background: #fafbfc; }
tr:hover td { background: var(--primary-soft); }
.thumb { width: 52px; height: 52px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); }
.edit-preview { width: min(220px, 100%); height: 160px; object-fit: contain; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-2); }
.table-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table-actions form { margin: 0; }
.table-actions .button, .table-actions button { min-height: 38px; padding: 8px 13px; border-radius: var(--radius-sm); font-size: 13.5px; }
.order-actions { justify-content: flex-end; }
.order-actions .button { min-width: 140px; }

/* ---------- 8. Overlays ---------- */
.pinpad-overlay {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 90;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  background: rgba(15, 23, 42, .55);
  overflow: auto;
  transform: translateZ(0);
  -webkit-overflow-scrolling: touch;
}
.pinpad-overlay[hidden] { display: none; }
.pinpad-card { width: min(390px, calc(100% - 36px)); max-height: calc(100% - 36px - var(--safe-top) - var(--safe-bottom)); overflow: auto; margin: auto; padding: 22px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pinpad-display {
  display: grid; place-items: center; min-height: 54px; margin: 10px 0 14px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 24px; font-weight: 800; letter-spacing: 4px;
}
.pinpad-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pinpad-grid button { min-height: 60px; border-radius: var(--radius-lg); font-size: 19px; }

.cart-review {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  background: rgba(15, 23, 42, .55);
  overflow: auto;
}
.cart-review[hidden] { display: none; }
.cart-card { width: min(720px, calc(100vw - 36px)); max-height: min(calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom)), 820px); overflow: auto; margin: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 22px; box-shadow: var(--shadow); }
.cart-details {
  margin-top: 18px; padding: 16px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--line);
}
.cart-details h3 { margin-top: 0; }
.cart-line {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 10px; background: #ffffff;
}
.cart-line:last-child { margin-bottom: 0; }
.cart-line span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.cart-remove { min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--red-text); background: var(--red-bg); border-color: #f3c1ba; }
.cart-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- 9. Mehrfachbearbeitung (Bulk-Editor) ---------- */
.bulk-editor {
  display: grid; gap: 14px; margin: 14px 0 16px; padding: 18px; border-radius: var(--radius-xl);
  border: 1px solid #c9d8f2; background: var(--primary-soft); box-shadow: var(--shadow-tiny);
}
.bulk-editor-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bulk-editor-head strong { font-size: 16.5px; color: var(--primary); }
.bulk-editor-grid { display: grid; grid-template-columns: repeat(5, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.bulk-editor-grid label { margin: 0; }
.bulk-visibility { grid-column: 1 / -1; }
.bulk-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 2px; }
.select-cell { white-space: nowrap; min-width: 100px; }
.select-cell input[type="checkbox"], .bulk-editor input[type="checkbox"] {
  width: 22px; height: 22px; min-height: 22px; margin: 0 8px 0 0; vertical-align: middle;
  accent-color: var(--primary); cursor: pointer;
}
.bulk-editor .check { display: inline-flex; align-items: center; min-height: 48px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--text); font-weight: 750; }
.bulk-selected-count { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; background: var(--green-bg); color: var(--green-text); font-weight: 800; }

/* ---------- 10. Statusmeldungen ---------- */
.error, .success { border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 16px; border: 1px solid transparent; font-weight: 700; box-shadow: var(--shadow-tiny); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.error { background: var(--red-bg); color: var(--red-text); border-color: #f3c1ba; }
.error::before { content: "\26A0"; font-size: 18px; }
.success { background: var(--green-bg); color: var(--green-text); border-color: #9ad6b5; }
.success::before { content: "\2713"; font-size: 18px; font-weight: 900; }

/* ---------- 11. Responsive Anpassungen ---------- */

@media (min-width: 981px) {
  main { padding: 0 24px; }
}

@media (max-width: 980px) {
  .topbar { justify-content: flex-start; }
  main { padding-bottom: 82px; }
  nav { justify-content: flex-start; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  .filters, .two, .inline-form, .stats, .location-row, .new-location, .time-entry-form { grid-template-columns: 1fr; }
  .order-search { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; }
  .bulk-editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-actions { justify-content: stretch; width: 100%; }
  .order-actions .button { flex: 1 1 180px; }
  .time-entry-summary { grid-template-columns: minmax(0, 1fr) 38px; }
  .time-entry-meta { grid-column: 1 / -1; justify-items: start; text-align: left; }
  form[action="/order"] > button.primary {
    position: fixed;
    left: 50%;
    bottom: calc(16px + var(--safe-bottom));
    z-index: 55;
    width: min(520px, calc(100vw - 32px));
    transform: translateX(-50%);
  }
  form[action="/order"] > button.primary:active { transform: translateX(-50%) translateY(1px); }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { background: var(--bg); }
  main { padding: 0 12px; margin: 14px auto 108px; }
  .topbar { padding: calc(10px + var(--safe-top)) 14px 10px; }
  .brand { min-width: 0; width: 100%; }
  .brand-mark { width: 44px; height: 44px; border-radius: 14px; }
  h1 { font-size: 17px; }
  h2 { font-size: 19px; }
  .brand p { font-size: 11px; }
  .order-search { gap: 8px; }
  .search-main input { min-height: 50px; }
  .cart-details { padding: 12px; }

  nav {
    position: fixed;
    left: 10px; right: 10px; bottom: calc(10px + var(--safe-bottom));
    z-index: 50;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(78px, 1fr);
    gap: 6px; padding: 7px;
    background: rgba(255, 255, 255, .97);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow-x: auto;
  }
  nav a, nav .nav-user {
    min-height: 46px; padding: 6px 8px; border-radius: 16px;
    font-size: 11px; line-height: 1.1; white-space: normal; text-align: center; box-shadow: none;
  }
  nav a:hover { transform: none; }
  .nav-user { display: none !important; }

  .admin-menu { display: none; }
  .admin-mobile-menu {
    display: block;
    margin-bottom: 14px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-tiny);
  }
  .admin-mobile-menu summary {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 850;
    color: var(--primary);
    list-style: none;
  }
  .admin-mobile-menu summary::-webkit-details-marker { display: none; }
  .admin-mobile-menu summary::after {
    content: "+";
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    font-weight: 900;
  }
  .admin-mobile-menu[open] summary::after { content: "-"; }
  .admin-mobile-links .button { width: 100%; justify-content: flex-start; }
  .admin-menu::-webkit-scrollbar { display: none; }

  .box { padding: 15px; border-radius: 20px; margin-bottom: 12px; box-shadow: var(--shadow-tiny); }
  .filters { padding: 10px; border-radius: 18px; gap: 10px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }

  .card {
    display: grid;
    grid-template-columns: 92px 1fr;
    grid-template-areas: "img badge" "img title" "img meta" "img qty";
    gap: 6px 12px;
    padding: 12px;
    border-radius: 18px;
    align-items: start;
  }
  .card img, .noimg { grid-area: img; height: 110px; border-radius: 14px; }
  .category-badge { grid-area: badge; margin-top: 0; font-size: 11px; padding: 4px 9px; }
  .card h3 { grid-area: title; min-height: 0; margin: 0; font-size: 15px; }
  .card p { grid-area: meta; margin: 0; font-size: 13px; }
  .card label { grid-area: qty; padding-top: 0; margin: 0; }
  .quantity-control { grid-area: qty; grid-template-columns: 46px minmax(60px, 1fr) 46px; padding-top: 0; }
  .card input[type="number"] { height: 44px; }

  input, select, textarea, button, .button { border-radius: 14px; min-height: 48px; font-size: 16px; }
  .box > button,
  .box > .button,
  form > button,
  form > .button,
  .cart-actions button,
  .table-actions .button,
  .table-actions button,
  .choice-actions .button,
  .admin-mobile-links .button { width: 100%; }
  .password-wrap { grid-template-columns: 1fr; }
  .password-toggle { width: 100%; }
  .pinpad-card { padding: 16px; }
  .pinpad-grid button { min-height: 56px; }
  .cart-card { padding: 16px; }
  .cart-line { grid-template-columns: 1fr; }
  .cart-actions { flex-direction: column; }
  table { display: table; width: max-content; min-width: 720px; max-width: none; white-space: nowrap; border-radius: 16px; }
  .install-app { left: 14px; right: 14px; bottom: calc(84px + var(--safe-bottom)); width: auto; min-height: 52px; }
  form[action="/order"] > button.primary {
    left: 12px;
    right: 12px;
    bottom: calc(14px + var(--safe-bottom));
    width: auto;
    transform: none;
  }
  form[action="/order"] > button.primary:active { transform: translateY(1px); }

  .bulk-editor-grid { grid-template-columns: 1fr; }
  .bulk-editor-actions {
    align-items: stretch;
    position: sticky;
    bottom: calc(82px + var(--safe-bottom));
    z-index: 20;
    padding: 12px;
    margin: 0 -6px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .bulk-editor-actions .primary, .bulk-editor .check, .bulk-selected-count { width: 100%; justify-content: center; }
  .order-actions .button { flex-basis: 100%; }
}
