:root {
  --ink: #14232b; --muted: #64757f; --line: #dfe5e9; --bg: #f2f5f7; --card: #fff;
  --brand: #1f6f8f; --brand-2: #3a8fb0; --brand-soft: #e6f1f6; --danger: #c0392b; --ok: #1e8a5a;
  --r: 16px; --shadow: 0 1px 2px rgba(20,35,43,.06), 0 6px 20px rgba(20,35,43,.06);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* Kopfzeile */
.bar { position: sticky; top: 0; z-index: 5; background: rgba(242,245,247,.92); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); padding-top: env(safe-area-inset-top); border-bottom: 1px solid transparent; }
.bar .wrap { display: flex; align-items: center; gap: 8px; height: 56px; }
.bar h1 { font-size: 20px; margin: 0; flex: 1; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .state { font-size: 13px; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; flex: none; }
.icon-btn:active { background: var(--line); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-weight: 700; flex: none; }

/* Buttons & Felder */
.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 650; background: var(--brand); color: #fff; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:active { transform: scale(.985); filter: brightness(.95); }
.btn[disabled] { opacity: .55; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.plain { background: transparent; color: var(--brand); }
.btn.danger { background: #fbeceb; color: var(--danger); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; border-radius: 10px; font-size: 14px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input.in { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; min-height: 48px; outline: 0; }
input.in:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(58,143,176,.15); }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.muted { color: var(--muted); }
.err { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 20px; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 0;
  background: linear-gradient(160deg, #fff 0%, var(--bg) 55%, #dbe7ee 100%); }
.login .box { width: min(380px, 100% - 32px); }
.login .logo { width: 72px; height: 72px; border-radius: 20px; display: block; margin: 0 auto 18px; box-shadow: var(--shadow); }
.login h1 { text-align: center; margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login p { text-align: center; margin: 0 0 18px; color: var(--muted); }

/* Projektliste */
.plist a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.plist .t { flex: 1; min-width: 0; }
.plist .n { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist .s { font-size: 13px; color: var(--muted); }
.plist svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 2; flex: none; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

/* Editor */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 2px; font-weight: 600; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: #c9d3d9; position: relative; margin: 0; transition: background .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(20px); }
.add { display: flex; gap: 8px; }
.add input { flex: 1; min-width: 0; text-transform: uppercase; }
.add input::placeholder { text-transform: none; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; flex: none; }
h2.sec.sp { margin: 18px 0 8px; }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 0; }
.item { padding: 12px; }
.item .top { display: flex; gap: 12px; }
.item .pic { width: 68px; height: 68px; border-radius: 12px; background: #f6f8f9; border: 1px solid var(--line); flex: none; display: grid; place-items: center; overflow: hidden; }
.item .pic img { max-width: 100%; max-height: 100%; }
.item .meta { flex: 1; min-width: 0; }
.item .ti { font-weight: 650; line-height: 1.25; }
.item .su { font-size: 13px; color: var(--muted); margin-top: 2px; }
.item .ar { font-size: 13px; margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { background: var(--brand-soft); color: var(--brand); border-radius: 8px; padding: 2px 8px; font-weight: 650; font-size: 13px; }
.item .bad { color: var(--danger); }
.item .row2 { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.item .mthumb { width: 64px; height: 44px; border-radius: 8px; object-fit: cover; background: #eef2f4; flex: none; }
.item .mlabel { flex: 1; font-size: 14px; min-width: 0; }
.item .mlabel small { display: block; color: var(--muted); }
.item .acts { display: flex; gap: 2px; margin-left: auto; }
.skel { background: linear-gradient(90deg, #eef2f4 25%, #f7f9fa 50%, #eef2f4 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; margin: 4px 0 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.cta { position: sticky; bottom: 0; z-index: 2; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); margin-top: 16px; }
.foot { text-align: center; padding: 0 0 calc(20px + env(safe-area-inset-bottom)); }
.foot .btn { color: var(--muted); font-weight: 500; }
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Sheet */
#sheet { position: fixed; inset: 0; z-index: 20; background: rgba(20,35,43,.45); display: flex; align-items: flex-end; justify-content: center; }
#sheet .panel { background: var(--bg); width: min(720px, 100%); max-height: 92dvh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
  animation: up .22s ease-out; padding-bottom: env(safe-area-inset-bottom); }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
#sheet .hd { display: flex; align-items: center; padding: 14px 16px 10px; gap: 8px; }
#sheet .hd h2 { flex: 1; margin: 0; font-size: 18px; }
#sheet .bd { overflow-y: auto; padding: 0 16px 18px; -webkit-overflow-scrolling: touch; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 4px; }
.mgrid button { border: 2.5px solid transparent; padding: 0; border-radius: 12px; overflow: hidden; background: #fff; text-align: left; box-shadow: var(--shadow); }
.mgrid button.sel { border-color: var(--brand); }
.mgrid img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; background: #e9eef1; }
.mgrid span { display: block; font-size: 12.5px; padding: 6px 8px 8px; line-height: 1.2; }
.mgrid .none { display: grid; place-items: center; aspect-ratio: 3/2; color: var(--muted); font-size: 14px; background: #e9eef1; }
.stack > * + * { margin-top: 10px; }

#toast { position: fixed; left: 50%; top: calc(66px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14.5px; max-width: calc(100% - 32px); box-shadow: var(--shadow); text-align: center; }
@media (min-width: 760px) { .bar h1 { font-size: 22px; } .item .pic { width: 84px; height: 84px; } }
