:root {
  --bg: #f7f7f5; --surface: #ffffff; --text: #1d1d1f; --muted: #6b6b70; --line: #e4e4e0;
  --accent: #3b6fd8; --ok: #2f7d4f; --busy: #9a6a00; --err: #b3261e; --off: #6b6b70;
  --radius: 10px; --gap: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141416; --surface: #1d1d20; --text: #ececee; --muted: #a0a0a8; --line: #2e2e33;
          --accent: #7aa2ff; --ok: #6fcf97; --busy: #e8b44a; --err: #ff8a80; --off: #a0a0a8; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; }
header, main, footer { max-width: 720px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 16px; }
.top { display: flex; align-items: baseline; justify-content: space-between; }
h1 { font-size: 22px; margin: 0 0 8px; }
h1 small { font-size: 13px; color: var(--muted); font-weight: 400; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 13px; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.busy { color: var(--busy); } .pill.error { color: var(--err); } .pill.offline { color: var(--off); }
.warn { color: var(--err); font-size: 14px; margin: 0 0 8px; }
button { font: inherit; font-size: 14px; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
         background: var(--surface); color: var(--text); cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.ghost { border-color: transparent; background: none; color: var(--muted); }
.switch { font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
nav button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
nav button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
#composer { margin: 14px 0 6px; }
#new { width: 100%; resize: vertical; min-height: 44px; padding: 10px 12px; font: inherit; border-radius: var(--radius);
       border: 1px solid var(--line); background: var(--surface); color: var(--text); }
ul { list-style: none; padding: 0; margin: 8px 0; }
li { display: flex; align-items: center; gap: var(--gap); padding: 10px 12px; background: var(--surface);
     border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; }
li.done .label { text-decoration: line-through; color: var(--muted); }
li.group { background: none; border: none; color: var(--muted); font-size: 13px; padding: 12px 4px 4px; }
li.empty { color: var(--muted); justify-content: center; border-style: dashed; }
li input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.grow { flex: 1; min-width: 0; }
.label { cursor: text; }
.qty { margin-left: 8px; font-size: 13px; color: var(--muted); }
.sub { font-size: 13px; color: var(--muted); }
.acts { display: flex; gap: 4px; }
.acts button { min-width: 36px; padding: 0 8px; }
li.conflict { align-items: flex-start; }
code { font-size: 12px; }
footer { color: var(--muted); font-size: 12px; padding-bottom: 80px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg);
         padding: 8px 8px 8px 16px; border-radius: 999px; display: flex; gap: 12px; align-items: center; }
#toast[hidden] { display: none; }
#toast button { background: none; color: var(--bg); border-color: transparent; font-weight: 600; }

/* ---------- Ab 0.2: Anmeldung, Listen, Teilen, Verwaltung ---------- */
[hidden] { display: none !important; }
.login-card { max-width: 380px; margin: 12vh auto; padding: 24px; background: var(--surface); border: 1px solid var(--line);
              border-radius: 14px; display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
input:not([type=checkbox]), select { font: inherit; min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
         background: var(--surface); color: var(--text); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.err { color: var(--err); font-size: 14px; min-height: 1em; margin: 0; }
.sub { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.chip { border-radius: 999px; min-height: 34px; padding: 0 12px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); font-weight: 600; }
.chip .badge, .badge { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.chip.add { border-style: dashed; color: var(--muted); }
#list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
#list-head h2 { font-size: 18px; margin: 0; flex: 1; min-width: 160px; }
.perm-note { font-size: 13px; color: var(--muted); width: 100%; }
.claim { font-size: 12px; color: var(--accent); margin-left: 8px; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); max-width: 680px; width: calc(100% - 24px); }
dialog::backdrop { background: rgb(0 0 0 / 0.35); }
dialog h2 { margin: 0 0 4px; font-size: 18px; }
.perm-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.perm-table th, .perm-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; }
.add-share { display: flex; flex-wrap: wrap; gap: 8px; }
.dlg-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.panel-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.panel-section h3 { margin: 0 0 10px; font-size: 16px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table td, .admin-table th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table .acts { flex-wrap: wrap; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
.form-row label { flex: 1; min-width: 140px; }
.members { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; }
label.switch, label.inline { flex-direction: row; align-items: center; }

/* ---------- Ab 0.3: Werkzeugleiste, Ansichten, Ladenaufbau ---------- */
#toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; }
#toolbar input[type=search] { flex: 1; min-width: 140px; }
#toolbar select, #toolbar input { min-height: 36px; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; border-radius: 0; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
li.sect { background: none; border: none; padding: 14px 4px 4px; font-weight: 600; color: var(--muted); font-size: 13px;
          text-transform: uppercase; letter-spacing: .04em; }
li.sect .badge { text-transform: none; letter-spacing: 0; }
.handle { cursor: grab; touch-action: none; user-select: none; color: var(--muted); padding: 6px 4px; font-size: 18px; line-height: 1; }
li.dragging { opacity: .85; box-shadow: 0 4px 16px rgb(0 0 0 / .18); border-color: var(--accent); position: relative; z-index: 2; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.tag.warn { color: var(--err); border-color: currentColor; }
.prio { font-weight: 700; color: var(--busy); margin-right: 4px; }
/* Einkaufen: groß, ruhig, nur abhaken */
ul.shop li { padding: 14px 14px; font-size: 18px; cursor: pointer; }
ul.shop li input[type=checkbox] { width: 28px; height: 28px; }
ul.shop li .qty { font-size: 15px; }
ul.shop li.sect { font-size: 13px; padding: 16px 4px 4px; cursor: default; }
.shop-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 10px 0; }
/* Training */
.hint { border: 1px solid var(--busy); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; background: var(--surface); font-size: 14px; }
.hint h4 { margin: 0 0 6px; font-size: 14px; }
.hint .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0; }
.hint select { min-height: 32px; font-size: 14px; }
/* Ladenaufbau */
.store-sect { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 8px; }
.store-sect > .head { display: flex; align-items: center; gap: 8px; }
.store-sect > .head strong { flex: 1; }
.store-sect ul { margin: 6px 0 0 28px; }
.store-sect ul li { padding: 4px 8px; margin-bottom: 4px; font-size: 14px; }
.pool { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px; margin-top: 10px; }
.pool .row { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-size: 14px; }
.dlg-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dlg-choices button { text-align: left; min-height: 44px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
/* Ladenaufbau: Gang-Karten untereinander statt in einer Zeile */
#sect-list { margin: 0; }
li.store-sect { display: block; padding: 10px 12px; }
li.store-sect > .head { display: flex; align-items: center; gap: 6px; }
li.store-sect > ul { margin: 8px 0 8px 26px; }
li.store-sect > ul > li { display: flex; align-items: center; gap: 6px; padding: 4px 8px; margin-bottom: 4px; font-size: 14px; }
li.store-sect > ul > li .grow { min-width: 0; }
li.store-sect select { min-height: 32px; font-size: 13px; max-width: 46%; }
li.store-sect > select { margin-left: 26px; max-width: calc(100% - 26px); }
li.store-sect .acts button, li.store-sect button { min-width: 32px; min-height: 32px; padding: 0 6px; }

/* 0.4: zweiter Faktor, Erinnerungen, Panels */
.qr { display: flex; justify-content: center; margin: 8px 0; }
.qr svg { width: 220px; height: 220px; background: #fff; border-radius: 8px; }
code.secret { font-size: 15px; word-break: break-all; user-select: all; }
pre.codes { font-size: 17px; line-height: 1.6; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; user-select: all; }
ol.steps { padding-left: 18px; margin: 4px 0; }
.warn-text { color: var(--err); }
.hint.inline-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint.inline-hint > span { flex: 1 1 200px; }
details summary { cursor: pointer; margin: 6px 0; }

/* Panel-Modus (Windows-App): nur eine Liste, kompakt */
body.panel-mode header, body.panel-mode #meta, body.panel-mode #lists-bar, body.panel-mode #list-head { display: none !important; }
body.panel-mode main { padding: 6px 8px 10px; max-width: none; }
body.panel-mode #composer textarea { min-height: 34px; padding: 6px 10px; }
body.panel-mode ul li { padding: 6px 8px; margin-bottom: 4px; }
body.panel-mode .acts button { min-width: 28px; min-height: 28px; }
#panel-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 3; -webkit-app-region: drag; app-region: drag; }
#panel-head[hidden] { display: none; }
#panel-head select, #panel-head button { -webkit-app-region: no-drag; app-region: no-drag; }
#panel-head select { font-weight: 600; max-width: 60%; min-height: 30px; }
#panel-head button { min-width: 30px; min-height: 30px; padding: 0 6px; background: transparent; border: none; }
#panel-head button[aria-pressed="true"] { background: var(--accent); color: #fff; border-radius: 6px; }
#panel-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
#panel-head .dot.ok { background: #2e9d57; } #panel-head .dot.busy { background: var(--busy); } #panel-head .dot.error, #panel-head .dot.offline { background: var(--err); }
/* Schmale Bildschirme: Reiter scrollen in sich, die Seite bleibt fest */
nav#tabs { overflow-x: auto; scrollbar-width: none; }
nav#tabs::-webkit-scrollbar { display: none; }
nav#tabs button { flex-shrink: 0; }
@media (max-width: 480px) { nav#tabs button { padding-left: 8px; padding-right: 8px; } }
.panel-section { overflow-x: auto; }
