/* ==========================================================================
   Bauwagen Manage: Farben kommen aus dem App-Icon
   (Himmelblau bis Königsblau, Nachtblau der Räder, Gelb des Fensters)
   ========================================================================== */
:root {
  color-scheme: light dark;

  --navy: #0e2a6e;
  --royal: #1f5cff;
  --sun: #ffcd00;
  --brand-grad: linear-gradient(140deg, #0e2a6e 0%, #1b4fd8 62%, #3f8cff 100%);

  --bg: #f2f4f9;
  --card: #ffffff;
  --sheet: #ffffff;
  --inset: #f2f4f9;           /* Flächen innerhalb von Karten und Dialogen */
  --thumb: #ffffff;           /* aktiver Teil eines Umschalters */
  --bar: rgba(242,244,249,.78);
  --tabbar: rgba(255,255,255,.82);

  --text: #101a33;
  --muted: #5d6881;
  --border: rgba(16,26,51,.09);
  --fill: rgba(16,26,51,.06);

  --primary: #1f5cff;         /* Flächen */
  --primary-dark: #1a4ed8;
  --primary-ink: #1a50e0;     /* Text und Symbole auf Karten */
  --primary-soft: rgba(31,92,255,.1);
  --danger: #e5342b;   --danger-ink: #c4251d;
  --warn: #f08c00;     --warn-ink: #a35a00;
  --ok: #1fae55;       --ok-ink: #127a3a;
  --violet: #6d3fe0;   --violet-ink: #5a30c8;

  --radius: 20px;
  --radius-lg: 28px;
  --shadow: 0 1px 2px rgba(16,26,51,.04), 0 10px 28px -12px rgba(16,26,51,.12);
  --shadow-lift: 0 12px 34px -10px rgba(16,26,51,.3);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.32,.72,0,1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1c;
    --card: #141b2d;
    --sheet: #171f33;
    --inset: #0e1424;
    --thumb: #2c3653;
    --bar: rgba(10,15,28,.78);
    --tabbar: rgba(26,34,54,.82);

    --text: #eef2fb;
    --muted: #9aa5bd;
    --border: rgba(255,255,255,.09);
    --fill: rgba(255,255,255,.08);

    --primary: #2f6bff;
    --primary-dark: #5b8cff;
    --primary-ink: #8db0ff;
    --primary-soft: rgba(95,140,255,.17);
    --danger: #ff5a50;   --danger-ink: #ff8f87;
    --warn: #ffb020;     --warn-ink: #ffc65c;
    --ok: #2ecc71;       --ok-ink: #62e39d;
    --violet: #a58bff;   --violet-ink: #bfaeff;

    --shadow: 0 0 0 .5px rgba(255,255,255,.07);
    --shadow-lift: 0 14px 34px -10px rgba(0,0,0,.7);
  }
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;      /* kein Auto-Zoom der Schrift */
  touch-action: manipulation;          /* kein Doppeltipp-Zoom */
  overscroll-behavior: none;           /* Safari wertet das am html-Element aus: kein Gummiband, kein Mitziehen des Hintergrunds */
  background: var(--bg);
}
/* Solange ein Dialog offen ist, bewegt sich die Seite dahinter nicht */
html.modal-open, html.modal-open body { overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.38;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  -webkit-user-select: none; user-select: none;          /* App-Gefühl: keine Textauswahl auf der Oberfläche */
  -webkit-touch-callout: none;                           /* kein Kontextmenü bei Langdruck */
  overscroll-behavior-y: none;                           /* kein Gummiband-Overscroll */
  -webkit-tap-highlight-color: transparent;
}
/* Eingabefelder bleiben auswähl- und bearbeitbar */
input, textarea, select { -webkit-user-select: text; user-select: text; }
/* Interaktive Elemente: sofort reagieren, nie zoomen */
.btn, .check, .chip, .iconbtn, .tabbar button, .tabs button { touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary-ink); }
h1, h2, h3 { letter-spacing: -.022em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* Symbole */
.i { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.24em; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Laden ---------- */
.splash { height: 100dvh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--fill); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(12px + var(--safe-top)) max(20px, calc(50vw - 364px)) 10px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar > div { min-width: 0; }
.topbar h1 { font-size: 1.75rem; line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -.032em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.topbar .sub:empty { display: none; }
.iconbtn {
  background: var(--fill); color: var(--primary-ink); border: 0; border-radius: 50%;
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  font-size: 1.05rem; flex: 0 0 auto; transition: transform .12s;
}
.iconbtn:active { transform: scale(.92); }
.iconbtn.me { background: var(--c, var(--primary)); color: #fff; font-weight: 700;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px color-mix(in srgb, var(--c, var(--primary)) 40%, transparent); }

main { padding: 8px 16px 16px; max-width: 760px; margin: 0 auto;
  padding-bottom: calc(112px + var(--safe-bottom)); animation: view-in .26s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Schwebende Tab-Leiste ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 12px; right: 12px; max-width: 520px; margin: 0 auto;
  bottom: max(12px, calc(var(--safe-bottom) - 8px));
  display: flex; padding: 6px; gap: 2px; border-radius: 26px;
  background: var(--tabbar);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-lift), inset 0 0 0 .5px var(--border);
}
.tabbar button {
  position: relative; flex: 1; min-width: 0; background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 3px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: .64rem; font-weight: 600; letter-spacing: -.005em; transition: color .2s;
}
.tabbar button .ico { display: grid; place-items: center; width: 46px; height: 30px; border-radius: 15px; font-size: 1.12rem;
  transition: background .25s var(--ease), transform .25s var(--ease); }
.tabbar button:active .ico { transform: scale(.9); }
.tabbar button.active { color: var(--primary-ink); }
.tabbar button.active .ico { background: var(--primary-soft); }
.tabbar button.active .i { stroke-width: 2.25; }
@media (max-width: 350px) {
  .tabbar { left: 8px; right: 8px; padding: 5px 3px; }
  .tabbar button { font-size: .57rem; letter-spacing: -.02em; }
  .tabbar button .ico { width: 40px; }
}
.tbadge { position: absolute; top: 0; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: .65rem; line-height: 17px; font-weight: 700; text-align: center;
  box-shadow: 0 0 0 2px var(--card); }
.tbadge:empty { display: none; }

/* ---------- Karten ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 4px 16px 6px; margin-bottom: 16px; overflow: hidden; }
.card.slim { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.card > h2, .card > .section-title { margin: 12px 0 4px; padding: 0; }
.card > .section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card > h2, .card > .section-title h2 { display: flex; align-items: center; gap: 10px; min-width: 0;
  margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: -.015em; color: var(--text); }
.card > h2 { margin: 12px 0 4px; }
.card > h2.muted { color: var(--muted); }
.card > .section-title .btn.sm { padding: 6px 12px; flex: none; }
.card.cal > .section-title h2 { font-size: 1.05rem; }
.restock-link { cursor: pointer; box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 55%, transparent); transition: transform .12s; }
.restock-link:active { transform: scale(.98); }
.hico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; flex: none; font-size: .92rem;
  background: var(--primary-soft); color: var(--primary-ink); }
.hico.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok-ink); }
.hico.warn { background: color-mix(in srgb, var(--warn) 17%, transparent); color: var(--warn-ink); }
.hico.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-ink); }
.hico.violet { background: color-mix(in srgb, var(--violet) 15%, transparent); color: var(--violet-ink); }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 4px 10px; }
.section-title h2 { margin: 0; font-size: 1.3rem; font-weight: 700; }
#view > .section-title { margin: 4px 2px 12px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; font-size: .92rem; }

.row { display: flex; gap: 10px; align-items: center; }
.space-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Heute-Karte ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: var(--brand-grad); border-radius: 24px;
  padding: 18px 18px 14px; margin-bottom: 16px; box-shadow: 0 16px 32px -18px rgba(14,42,110,.75); }
.hero-art { position: absolute; right: -4px; top: 12px; width: 164px; pointer-events: none; }
.hero-main { position: relative; min-height: 86px; cursor: pointer; padding-right: 96px; }
.hero-over { font-size: .8rem; font-weight: 600; color: rgba(255,255,255,.78); }
.hero-big { font-size: 1.72rem; line-height: 1.12; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.hero-sub { font-size: .94rem; font-weight: 500; margin-top: 4px; color: rgba(255,255,255,.88);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-pills { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 0; color: #fff; cursor: pointer; font-size: .85rem; font-weight: 600;
  padding: 7px 12px; border-radius: 980px; background: rgba(255,255,255,.17);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: transform .12s; }
.pill:active { transform: scale(.96); }
.pill b { font-weight: 800; font-variant-numeric: tabular-nums; }
.pill.alert { background: var(--sun); color: #2b2100; }

/* Schnellaktionen unter den Widgets */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 8px; }
.quick .btn { padding: 12px 8px; font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--primary); color: #fff; border: 0; border-radius: 14px;
  padding: 14px 20px; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  transition: transform .12s, opacity .12s, background .15s;
}
.btn:not(.ghost):not(.danger-soft) { box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--primary) 85%, #000); }
.btn:active { transform: scale(.97); opacity: .86; }
.btn:disabled { opacity: .42; cursor: default; box-shadow: none; transform: none; }
.btn.block { width: 100%; }
.btn.big { padding: 19px 20px; font-size: 1.15rem; font-weight: 700; border-radius: 18px; }
.btn.okbtn { background: #1a9a4b; box-shadow: 0 8px 18px -10px #127a3a !important; }
.btn.ghost { background: var(--primary-soft); color: var(--primary-ink); }
.btn.danger { background: #d92d24; box-shadow: none; }
.btn.danger-soft { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-ink); }
.btn.sm { padding: 8px 15px; font-size: .9rem; border-radius: 980px; }
a.btn { display: inline-block; text-align: center; text-decoration: none; }
.linkbtn { background: none; border: 0; color: var(--muted); font-size: .75rem; margin-left: 6px; cursor: pointer; text-decoration: underline; }
.lock .linkbtn { margin-top: 24px; }
.rowdel { flex: none; width: 38px; height: 38px; margin: -9px -10px -9px 0; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; touch-action: manipulation; }
.rowdel:active { color: var(--danger-ink); }

/* Zeile im Stil einer Einstellung (Profil, Menüs) */
.rowbtn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 0; border: 0; background: none; color: var(--text);
  font-weight: 600; font-size: .95rem; text-align: left; cursor: pointer; border-bottom: .5px solid var(--border); }
.rowbtn::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 1.15rem; line-height: 1; }
.rowbtn .i { color: var(--primary-ink); }
.modal-body [data-menu] { justify-content: flex-start; text-align: left; padding: 14px 16px; background: var(--inset); color: var(--text); }

/* ---------- Formulare ---------- */
label { display: block; font-size: .8rem; letter-spacing: .01em; color: var(--muted); margin: 14px 2px 5px; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 13px 15px; border: 0; outline: 2px solid transparent; font-size: 1rem;
  border-radius: 13px; background: var(--fill); color: var(--text);
  transition: outline-color .15s; appearance: none; -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238390a8' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
input:focus, select:focus, textarea:focus { outline-color: var(--primary); }
textarea { min-height: 76px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.checks:has(.swrow) { display: block; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; margin: 0;
  border-radius: 980px; background: var(--fill); color: var(--text); cursor: pointer;
  font-size: .86rem; user-select: none; transition: background .15s, color .15s;
}
.chip input { width: auto; }
/* Checkbox ganz ausblenden (kein Leerraum, kein dunkler Punkt); aktive Chips zeigen ein Häkchen */
.chip > input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; pointer-events: none; }
.chip.on { background: var(--primary); color: #fff; }
.chip.on::before { content: '✓'; font-weight: 700; }

/* Schalter */
.swrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 12px 0;
  border-bottom: .5px solid var(--border); color: var(--text); font-size: 1rem; font-weight: 400; cursor: pointer; }
.swrow:last-child { border-bottom: 0; }
.swrow > span { flex: 1; min-width: 0; }
input.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 51px; height: 31px; padding: 0; margin: 0;
  border-radius: 31px; background: rgba(120,120,128,.32); outline: 0; cursor: pointer; transition: background .25s; touch-action: manipulation; }
input.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.25), 0 1px 1px rgba(0,0,0,.16); transition: transform .25s cubic-bezier(.3,.9,.3,1.1), width .2s; }
input.switch:checked { background: var(--ok); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:active::after { width: 33px; }
input.switch:checked:active::after { transform: translateX(14px); }
input.switch:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }

/* Gruppen in Dialogen */
.fgroup { background: var(--inset); border-radius: 16px; padding: 2px 14px 14px; margin-top: 14px; }
.modal-body > .fgroup:first-of-type { margin-top: 4px; }
.fgroup-title { padding-top: 12px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.fgroup input:not(.switch), .fgroup select, .fgroup textarea { background: var(--sheet); }
.fgroup .chip { background: var(--sheet); }
.fgroup .chip.on { background: var(--primary); }
.fgroup .fold { border-top: 0; margin-top: 0; }
.fgroup .fold + .fold { border-top: .5px solid var(--border); }
.fgroup .frow { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: .5px solid var(--border); }
.fgroup .frow:last-child { border-bottom: 0; }
.fgroup .readlist { margin-top: 6px; }
.fgroup .swrow:last-child, .fgroup .swrow + .swrow:last-child { border-bottom: 0; }
.swtitle { margin: 16px 4px 6px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.swgroup { background: var(--inset); border-radius: 14px; padding: 0 14px; }
.swgroup input.swsel, .swgroup select.swsel { width: auto; min-width: 96px; padding: 8px 30px 8px 12px; background-color: var(--sheet); }

.fold { border-top: .5px solid var(--border); margin-top: 10px; padding-top: 2px; }
.fold > summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: .95rem; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: '›'; float: right; color: var(--muted); transition: transform .15s; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold > summary .i { color: var(--primary-ink); margin-right: 10px; }

/* ---------- Abzeichen ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .71rem; padding: 3px 9px; border-radius: 980px;
  font-weight: 600; white-space: nowrap; line-height: 1.3; }
.badge .i { width: 1.05em; height: 1.05em; vertical-align: 0; }
.badge.low, .badge.event { background: var(--primary-soft); color: var(--primary-ink); }
.badge.medium { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet-ink); }
.badge.high, .badge.warn { background: color-mix(in srgb, var(--warn) 17%, transparent); color: var(--warn-ink); }
.badge.urgent { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger-ink); }
.badge.shift, .badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok-ink); }
.badge.label { background: color-mix(in srgb, var(--c) 17%, transparent); color: color-mix(in srgb, var(--c) 72%, var(--text)); }
/* Priorität in Listen: Punkt statt Pille, damit die Zeilen ruhig bleiben */
.list-item .meta .badge.low, .list-item .meta .badge.medium, .list-item .meta .badge.high, .list-item .meta .badge.urgent {
  background: none; padding: 0; font-size: .8rem; gap: 5px; }
.list-item .meta .badge.low::before, .list-item .meta .badge.medium::before,
.list-item .meta .badge.high::before, .list-item .meta .badge.urgent::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Personen ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--c, var(--muted)); color: #fff; font-weight: 700; font-size: 1.05rem; }
.avatar.admin { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--ok); }
.people { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.stack { display: inline-flex; flex: none; }
.av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: .64rem; font-weight: 700;
  color: #fff; background: var(--c, var(--muted)); box-shadow: 0 0 0 2px var(--card); }
.av + .av { margin-left: -6px; }
.modal .av { box-shadow: 0 0 0 2px var(--sheet); }
.list-item.person { gap: 12px; align-items: center; }
.list-item.person .sum { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; line-height: 1.3; }
.list-item.person .sum > span { display: inline; }
.list-item.person > span { font-size: .95rem; flex: none; }
.profile-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 8px; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 1.35rem; }
.profile-head .title { font-weight: 700; font-size: 1.1rem; letter-spacing: -.015em; }
.profile-head .meta { font-size: .85rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

/* ---------- Listen ---------- */
.list-item { display: flex; gap: 13px; align-items: flex-start; padding: 13px 0; border-bottom: .5px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; letter-spacing: -.012em; }
.list-item .title .badge { vertical-align: 1px; }
.list-item.done .title { text-decoration: line-through; color: var(--muted); }
.list-item .meta { font-size: .8rem; color: var(--muted); margin-top: 4px; display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; }
.list-item .meta > span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.list-item .meta strong { color: var(--text); }
[data-open] { cursor: pointer; }
.list-item[data-open]::after { content: '›'; color: var(--muted); font-size: 1.4rem; line-height: 1; align-self: center; flex: none; opacity: .7; }
.list-item[data-open], .list-item[data-user], .list-item[data-label] { transition: opacity .12s; }
.list-item[data-open]:active, .list-item[data-user]:active, .list-item[data-label]:active { opacity: .55; }
.list-item.compact { align-items: center; padding: 10px 0; cursor: pointer; }
.list-item.compact .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item.compact .corner { flex: none; align-self: center; margin-left: auto; }

/* Kalenderblatt in Listen */
.dtile { flex: none; width: 46px; height: 50px; border-radius: 13px; overflow: hidden; display: flex; flex-direction: column; align-items: center;
  background: var(--inset); text-align: center; align-self: center; }
.dtile span { width: 100%; font-size: .6rem; line-height: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--primary-soft); color: var(--primary-ink); }
.dtile b { flex: 1; display: grid; place-items: center; font-size: 1.22rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.dtile.shift span { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok-ink); }
.dtile.today { background: var(--primary); color: #fff; }
.dtile.today span { background: rgba(0,0,0,.14); color: #fff; }
.list-item .dtile + .main { align-self: center; }

/* Aufgaben-Kreis: größere Trefffläche, sanftes Abhaken */
.check { position: relative; width: 27px; height: 27px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 45%, transparent);
  display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; background: transparent; color: transparent;
  font-size: .9rem; font-weight: 700; transition: transform .15s, background .2s, border-color .2s; }
.check::after { content: ''; position: absolute; inset: -9px; }
.check:active { transform: scale(.88); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; animation: pop .25s cubic-bezier(.3,.9,.3,1.5); }
@keyframes pop { 50% { transform: scale(1.18); } }

/* ---------- Inventur ---------- */
.stepper { display: inline-flex; align-items: center; flex: none; align-self: center; background: var(--inset); border-radius: 13px; padding: 3px; }
.stepper button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--card); color: var(--primary-ink); font-size: 1.15rem; font-weight: 600;
  cursor: pointer; display: grid; place-items: center; touch-action: manipulation; box-shadow: 0 1px 2px rgba(16,26,51,.08); transition: transform .1s; }
.stepper button:active { transform: scale(.9); }
.stepper b { min-width: 30px; text-align: center; font-size: .98rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper input { width: 52px; padding: 6px 2px; text-align: center; font-weight: 700; background: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rsrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: .5px solid var(--border); }
.rsname { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.rsname span { display: block; font-weight: 400; font-size: .8rem; }
.qty { flex: none; align-self: center; text-align: right; font-size: .78rem; color: var(--muted); }
.qty b { display: block; font-size: 1.15rem; color: var(--text); font-variant-numeric: tabular-nums; }
.meter { height: 5px; border-radius: 3px; background: var(--fill); margin-top: 8px; overflow: hidden; max-width: 170px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--ok); transition: width .3s var(--ease); }
.meter.low i { background: var(--warn); }

/* ---------- Kennzahlen ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.stat { background: var(--card); border-radius: 18px; padding: 15px 10px; text-align: center; box-shadow: var(--shadow); }
.stat[data-goto] { cursor: pointer; }
.stat[data-goto]:active { transform: scale(.97); }
.stat .n { font-size: 1.35rem; line-height: 1.2; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.card > .stat-row { padding: 8px 0 !important; }
.card > .stat-row .stat { box-shadow: none; background: var(--inset); }
.balance { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.balance.neg { color: var(--danger-ink); }
.balance.sm { font-size: clamp(1.2rem, 6.2vw, 1.5rem); line-height: 1.15; white-space: nowrap; }
.slim-label { font-size: .8rem; color: var(--muted); }
.acc { display: flex; align-items: center; gap: 12px; min-width: 0; }
.card.slim > .btn { flex: none; }
.neg-text { color: var(--danger-ink); font-weight: 600; }
.warn-text { color: var(--warn-ink); font-weight: 600; }
.ok-mark { color: var(--ok-ink); font-weight: 700; }

/* ---------- Dialoge ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 40; background: rgba(6,12,28,.42);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; background: var(--sheet); width: 100%; max-width: 540px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0 20px calc(20px + var(--safe-bottom)); max-height: 92dvh; overflow-y: auto;
  overscroll-behavior: contain;        /* am Anfang/Ende des Dialogs nicht an den Hintergrund weitergeben */
  -webkit-overflow-scrolling: touch;
  animation: sheet .3s var(--ease);
}
@keyframes sheet { from { transform: translateY(100%); } }
/* Kopf bleibt beim Scrollen sichtbar, mit Griff */
.modal-head { position: sticky; top: 0; z-index: 3; background: var(--sheet); margin: 0 -20px 8px; padding: 22px 20px 8px; touch-action: none; }
.modal-bg.locked .modal-head::before { display: none; }
.modal-head::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px;
  background: color-mix(in srgb, var(--muted) 42%, transparent); }
.modal h3 { margin: 0; font-size: 1.32rem; font-weight: 800; letter-spacing: -.028em; }
.modal-head .iconbtn { width: 32px; height: 32px; background: var(--fill); color: var(--muted); font-size: .85rem; }
.modal-body .meta { font-size: .85rem; color: var(--muted); margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.modal-body .meta .badge { line-height: 1.3; }
.modal-body #read-box:not(:empty), .modal-body #extra-box > div:not(:empty), .modal-body #comments-box {
  margin-top: 18px; padding-top: 2px; border-top: .5px solid var(--border); }
.modal-body #read-box h3, .modal-body #extra-box h3, .modal-body #comments-box h3 {
  font-size: .82rem !important; font-weight: 700; letter-spacing: -.005em; color: var(--muted); margin: 14px 2px 8px !important; }
@media (min-width: 640px) {
  .modal-bg { align-items: center; }
  .modal { border-radius: var(--radius-lg); animation: fade .2s ease; }
  .modal-head::before { display: none; }
  .modal-head { padding-top: 18px; }
}

/* ---------- Anmeldung ---------- */
.auth { position: relative; isolation: isolate; min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) 20px 24px; }
.auth::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 50dvh; z-index: -1; background: var(--brand-grad); border-radius: 0 0 36px 36px; }
.auth .box { width: 100%; max-width: 400px; animation: view-in .35s var(--ease); }
.auth .logo { text-align: center; margin-bottom: 20px; color: #fff; }
.auth .logo .mark { display: block; width: 84px; height: 84px; border-radius: 22px; margin: 0 auto 12px; object-fit: cover; box-shadow: 0 16px 34px -12px rgba(0,0,0,.5); }
.auth .logo h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; }
.auth .logo .muted { color: rgba(255,255,255,.8); font-weight: 500; }
.auth .card { box-shadow: var(--shadow-lift); padding: 18px; }

/* ---------- Umschalter ---------- */
.tabs, .seg { display: flex; gap: 4px; background: var(--fill); padding: 3px; border-radius: 13px; }
.tabs { margin-bottom: 14px; }
.seg { margin: 10px 0; }
.tabs button, .seg button { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 4px; border-radius: 10px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: .92rem; transition: background .15s, color .15s; touch-action: manipulation; }
.tabs button.active, .seg button.active { background: var(--thumb); color: var(--text); box-shadow: 0 2px 6px rgba(16,26,51,.12), 0 .5px 1px rgba(16,26,51,.1); }
.tabs.seg-sm { margin: 0; width: auto; }
.tabs.seg-sm button { flex: none; padding: 6px 16px; font-size: .88rem; }
.seg.big { margin: 0 0 14px; }

/* ---------- Hinweise ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%);
  background: rgba(16,24,44,.94); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 60;
  font-size: .88rem; font-weight: 500; max-width: 90%; box-shadow: var(--shadow-lift);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: fade .2s ease;
}
.toast.err { background: #d92d24; }
.notice { padding: 11px 14px; border-radius: 12px; font-size: .88rem; margin-bottom: 12px; background: var(--primary-soft); color: var(--text); }
.notice.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok-ink); }
.notice.err { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger-ink); }
.notice.info { background: var(--primary-soft); color: var(--primary-ink); }
.readlist { margin-top: 10px; display: grid; gap: 6px; font-size: .9rem; }

/* ---------- Filter ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters input[type=search] { grid-column: 1 / -1; }
.filters .chip { justify-content: center; justify-self: start; }
.filters-top { grid-column: 1 / -1; display: flex; gap: 8px; }
.filters-top input { flex: 1; min-width: 0; }
.filters-top .btn { flex: none; }
#view > .filters select, #view > .filters input { background-color: var(--card); box-shadow: var(--shadow); }

/* ---------- Kalender ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin: 8px 0 8px; }
.cal-head { text-align: center; font-size: .7rem; font-weight: 600; color: var(--muted); padding: 2px 0; }
.cal-cell { position: relative; aspect-ratio: 1; border: 0; border-radius: 13px; background: transparent; color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 500; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
  font-variant-numeric: tabular-nums; }
.cal-cell.today { color: var(--primary-ink); font-weight: 800; background: var(--primary-soft); }
.cal-cell.sel { background: var(--primary); color: #fff; font-weight: 700; }
.cal-cell .dot { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary); font-size: 0; }
.cal-cell.sel .dot { background: #fff; }

.comment { padding: 8px 0; border-bottom: .5px solid var(--border); }
.mention { color: var(--primary-ink); font-weight: 600; }
.mention-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.mention-list:empty, .mention-list[hidden] { display: none; }
.mention-list button { text-align: left; border: 0; border-radius: 10px; padding: 10px 12px; background: var(--fill); color: var(--text); font-weight: 600; cursor: pointer; }

/* ---------- Fotos, Umfragen ---------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; cursor: pointer; background: var(--fill); }
.poll { padding: 8px 0 12px; border-bottom: .5px solid var(--border); }
.poll:last-child { border-bottom: 0; }
.poll .title { font-weight: 600; letter-spacing: -.012em; }
.poll .meta { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.poll-opt { position: relative; display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 7px;
  padding: 11px 13px; border: 1.5px solid transparent; border-radius: 12px; background: var(--inset); color: var(--text);
  font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.poll-opt .bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary-soft); transition: width .3s var(--ease); }
.poll-opt .lbl, .poll-opt .cnt { position: relative; }
.poll-opt .cnt { font-weight: 700; font-variant-numeric: tabular-nums; }
.poll-opt.on { border-color: var(--primary); font-weight: 600; }
.poll-opt:disabled { cursor: default; opacity: .85; }
.votes { font-size: .75rem; margin: 3px 0 0 4px; }

/* ---------- Buchungs-Tablet ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; min-height: 120px; padding: 12px;
  border: 2px solid transparent; border-radius: var(--radius-lg); background: var(--card); color: var(--text); cursor: pointer;
  font: inherit; text-align: center; touch-action: manipulation; box-shadow: var(--shadow); }
.tile:active { transform: scale(.97); background: color-mix(in srgb, var(--primary) 16%, var(--card)); }
.tile .tname { font-size: 1.15rem; font-weight: 700; }
.tile .tstock { color: var(--muted); font-size: .9rem; }
.tile .twagon { font-size: .8rem; font-weight: 600; color: var(--muted); }
.tile .twagon.short { color: var(--warn-ink); }
.need-strip { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 14px; padding: 14px 16px; border: 0; border-radius: 18px; cursor: pointer; text-align: left;
  background: color-mix(in srgb, var(--warn) 15%, var(--card)); color: var(--text); box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 50%, transparent); touch-action: manipulation; }
.need-strip:active { transform: scale(.99); }
.need-text { flex: 1; min-width: 0; font-size: 1.05rem; font-weight: 500; }
.need-text strong { display: block; font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }
.tile.low { border-color: var(--warn); }
.tile.low .tstock { color: var(--warn-ink); font-weight: 600; }
.tile.empty { opacity: .45; cursor: default; }
#undo-stack { position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; z-index: 30; max-width: 540px; margin: 0 auto; }
.undo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--text); color: var(--bg); box-shadow: 0 6px 24px rgba(0,0,0,.35); animation: sheet .25s ease; }
.tbanner { position: fixed; left: 16px; right: 16px; bottom: calc(16px + var(--safe-bottom)); z-index: 35; max-width: 900px; margin: 0 auto;
  padding: 14px 20px; border-radius: 22px; text-align: center; background: var(--card); color: var(--text); box-shadow: var(--shadow-lift); }
.tbanner.way { padding: 24px 22px; color: #fff; background: linear-gradient(135deg, #127a3a, #1fae55); animation: view-in .3s var(--ease); }
.tb-big { font-size: clamp(1.7rem, 5vw, 2.8rem); line-height: 1.15; font-weight: 800; letter-spacing: -.03em; }
.tb-wait { font-weight: 700; font-size: 1.05rem; }
.tb-sub { margin-top: 6px; font-size: clamp(1rem, 2.6vw, 1.4rem); font-weight: 600; opacity: .92; }
body.has-banner main { padding-bottom: calc(var(--banner-h, 150px) + 40px); }
body.has-banner #undo-stack { bottom: calc(var(--banner-h, 150px) + 28px + env(safe-area-inset-bottom)); }
body.has-banner .toast { bottom: calc(var(--banner-h, 150px) + 28px + var(--safe-bottom)); }
/* Niedrige Bildschirme (Tablet quer): Anzeige flacher, Tastenfeld kleiner, damit nichts verdeckt wird */
@media (max-height: 820px) {
  .tbanner.way { padding: 12px 18px; }
  .tb-big { font-size: 1.5rem; }
  .tb-sub { margin-top: 2px; font-size: 1rem; }
  body.has-banner .lock { margin-top: 0; }
  body.has-banner .dots { margin: 4px 0 0; font-size: 1.4rem; }
  body.has-banner .lock-msg { margin-bottom: 4px; }
  body.has-banner .keypad { max-width: 230px; gap: 8px; }
  body.has-banner .keypad button { font-size: 1.3rem; }
  body.has-banner .lock .linkbtn { margin-top: 8px; }
}
.lock { max-width: 360px; margin: 24px auto 0; text-align: center; }
.lock-title { font-size: 1.25rem; font-weight: 700; }
.dots { margin: 16px 0 6px; font-size: 2rem; letter-spacing: .5em; padding-left: .5em; }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.lock-msg { min-height: 1.4em; color: var(--danger-ink); font-size: .9rem; margin-bottom: 10px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.keypad button { aspect-ratio: 1; border: 0; border-radius: 50%; background: var(--card); color: var(--text); font: inherit;
  font-size: 1.7rem; font-weight: 600; cursor: pointer; touch-action: manipulation; box-shadow: var(--shadow); }
.keypad button:active { background: color-mix(in srgb, var(--primary) 25%, var(--card)); }
.keypad button.ghost { background: transparent; box-shadow: none; }
.shift-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* ---------- Einführung, Verwaltung, Tabellen ---------- */
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin: 7px 0; }
#adm-q { width: 100%; margin: 6px 0 0; }
.permrow { padding: 10px 0; border-bottom: .5px solid var(--border); }
.permrow:last-child { border-bottom: 0; }
.permname { font-weight: 600; margin-bottom: 6px; }
.permrow .seg { margin: 0; background: none; padding: 0; gap: 8px; }
.permrow .seg button { background: var(--fill); padding: 13px 4px; border-radius: 12px; }
.permrow .seg button.active { background: var(--ok); color: #fff; box-shadow: none; }
.kv { display: flex; gap: 14px; padding: 10px 0; border-bottom: .5px solid var(--border); }
.kv > span { flex: 0 0 74px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.kv > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 16px; }
.actions .btn { padding: 14px 6px; font-size: .92rem; }
.actions .wide { grid-column: 1 / -1; }

.daytable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.daytable th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.daytable td { padding: 9px 8px; border-bottom: .5px solid var(--border); vertical-align: top; }
.daytable tr:last-child td { border-bottom: 0; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
