/* Layout: eine Spalte für das Handy; feste Kopfzeile, Inhalt scrollt, Tab-Leiste unten; Projektwahl als Bottom-Sheet. */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --sunk: #e3e8ef;
  --ink: #14202e;
  --muted: #566577;
  --line: #cdd5df;
  --accent: #1f3f8f;
  --accent-ink: #ffffff;
  --accent-soft: #dde6fa;
  --ok: #17703f;
  --ok-soft: #d8f0e2;
  --wait: #9a4d06;
  --wait-soft: #fbe7cf;
  --err: #b3261e;
  --f-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Consolas, "Roboto Mono", monospace;
  --r: 12px;
  --bar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1420; --surface: #161f2e; --sunk: #0a101a; --ink: #e7edf5; --muted: #98a6b8; --line: #2a3648;
    --accent: #7ea2ff; --accent-ink: #0b1220; --accent-soft: #1d2d52;
    --ok: #6fd39a; --ok-soft: #153325; --wait: #f0b36a; --wait-soft: #3a2a14; --err: #ff8f86;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1420; --surface: #161f2e; --sunk: #0a101a; --ink: #e7edf5; --muted: #98a6b8; --line: #2a3648;
  --accent: #7ea2ff; --accent-ink: #0b1220; --accent-soft: #1d2d52;
  --ok: #6fd39a; --ok-soft: #153325; --wait: #f0b36a; --wait-soft: #3a2a14; --err: #ff8f86;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 var(--f-ui);
  -webkit-text-size-adjust: 100%;
  display: flex; flex-direction: column;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) 8px;
}
.top h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }
.pill {
  font: 600 .78rem var(--f-mono); padding: 4px 10px; border-radius: 99px;
  background: var(--sunk); color: var(--muted); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.wait { background: var(--wait-soft); color: var(--wait); }
.pill.err { background: var(--wait-soft); color: var(--err); }

main {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding-block: 4px 24px; max-width: 720px; width: 100%; margin-inline: auto; outline: none;
}

.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin-inline: -16px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs button {
  position: relative; min-height: 52px; border: 0; background: transparent; border-radius: 10px;
  color: var(--muted); font-size: .8rem; font-weight: 600; display: grid; place-items: center; gap: 0;
}
.tabs button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.tabs .ico { font-size: 1.25rem; line-height: 1; }
.tabs b {
  position: absolute; top: 2px; right: calc(50% - 30px); min-width: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--wait); color: var(--surface); font: 700 .72rem/20px var(--f-mono); text-align: center;
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.stack { display: grid; gap: 14px; }
.label { font: 600 .74rem var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.field {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
textarea.field { min-height: 160px; resize: vertical; font-size: 1.1rem; line-height: 1.5; }
.hint { color: var(--muted); font-size: .86rem; margin: 6px 2px 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 16px;
  font-weight: 600; font-size: .95rem; min-height: 44px;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.pick {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 14px; min-height: 52px;
}
.pick .nm { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.pick .chev { color: var(--accent); font: 600 .85rem var(--f-mono); white-space: nowrap; }

.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 16px; font-weight: 600; min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 1.05rem; min-height: 54px; width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }

.list { display: grid; gap: 10px; }
.group { margin-top: 18px; }
.group > h2 { margin: 0 0 8px; display: flex; justify-content: space-between; font: 600 .74rem var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.item > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.item > summary::-webkit-details-marker { display: none; }
.item[open] { border-color: var(--accent); }
.item .nm { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.item .one { grid-column: 1 / -1; color: var(--muted); font-size: .94rem; }
.item .body { padding: 0 14px 14px; display: grid; gap: 8px; }
.item dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .94rem; }
.item dt { font: 600 .72rem var(--f-mono); color: var(--muted); padding-top: 3px; text-transform: uppercase; }
.item dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.st { font: 600 .72rem var(--f-mono); padding: 2px 9px; border-radius: 99px; align-self: start; white-space: nowrap; }
.st.active, .st.zugeordnet, .st.erledigt { background: var(--ok-soft); color: var(--ok); }
.st.parked, .st.neu, .st.queued { background: var(--wait-soft); color: var(--wait); }
.st.uebergeben, .st.client { background: var(--accent-soft); color: var(--accent); }
.st.verworfen { background: var(--sunk); color: var(--muted); }

.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.note.queued { border-style: dashed; border-color: var(--wait); }
.note .meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font: 500 .78rem var(--f-mono); color: var(--muted); }
.note .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.note .res { font-size: .92rem; color: var(--muted); }

.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 22px 18px; color: var(--muted); margin-top: 14px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.login { margin-top: 40px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.login p { margin: 0; color: var(--muted); max-width: 32ch; }
.login .btn.primary { width: auto; padding-inline: 28px; }

.footer { margin-top: 28px; color: var(--muted); font-size: .84rem; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.footer .link { background: none; border: 0; padding: 4px 0; color: var(--accent); text-decoration: underline; font-size: .84rem; min-height: 32px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bar) + 20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; max-width: min(92vw, 520px); font-weight: 600; z-index: 30;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.err { background: var(--err); color: #fff; }

.scrim { position: fixed; inset: 0; background: rgba(8, 12, 20, .5); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86%;
  background: var(--surface); border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 36px rgba(0,0,0,.3);
}
.sheet-in { width: 100%; max-width: 720px; margin-inline: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-top h2 { margin: 0; font-size: 1.15rem; }
.sheet-list { overflow-y: auto; min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; }
.sheet-list > * { flex: none; }
.sheet-list h3 { margin: 12px 4px 2px; font: 600 .72rem var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.opt {
  display: block; text-align: left; width: 100%;
  border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 10px 12px; min-height: 48px;
}
.opt:hover { background: var(--sunk); }
.opt[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt .nm { display: block; font-weight: 650; overflow-wrap: anywhere; }
.opt .one { display: block; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: up .18s ease-out; }
  @keyframes up { from { transform: translateY(26px); opacity: .6; } }
}
