:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --text: #1d1d1f;
  --muted: #6b6760;
  --line: #e2ddd4;
  --accent: #3d6b5a;
  --accent-ink: #ffffff;
  --accent-soft: #dfeae4;
  --danger: #b3261e;
  --danger-soft: #f9dedc;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 24px rgba(0,0,0,.06);
  --radius: 18px;
  --radius-sm: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181b;
    --surface: #1f2226;
    --surface-2: #2a2e33;
    --text: #ecebe8;
    --muted: #a3a09a;
    --line: #33373d;
    --accent: #8cc7ad;
    --accent-ink: #0d1f18;
    --accent-soft: #24372f;
    --danger: #f2b8b5;
    --danger-soft: #3c1f1d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; } .wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* Buttons & inputs */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: .6em 1.15em; font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .4em; text-decoration: none;
  min-height: 44px; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: .35em .9em; font-size: .9rem; }
.btn.big { width: 100%; min-height: 52px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { appearance: none; border: 0; background: var(--surface-2); color: var(--text); width: 40px; height: 40px; border-radius: 50%; font-size: 1rem; cursor: pointer; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 14px; }
input, select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .65em .8em; min-height: 46px;
}
select { width: auto; margin: 0; min-height: 40px; padding: .4em .8em; border-radius: 999px; }
input:focus-visible, select:focus-visible, .btn:focus-visible, .dropzone:focus-visible, .tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.form-error { color: var(--danger); font-size: .92rem; }

.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; text-align: left; padding: 28px; }
.login-card img { display: block; margin-bottom: 12px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.tab { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: .45em .95em; border-radius: 999px; cursor: pointer; min-height: 38px; }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (max-width: 520px) { .brand span { display: none; } }

.content { max-width: 1100px; margin: 0 auto; padding: 16px; padding-bottom: max(32px, env(safe-area-inset-bottom)); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding: 2px; }
.chip { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: .4em .9em; border-radius: 999px; font: inherit; font-size: .92rem; white-space: nowrap; cursor: pointer; min-height: 38px; }
.chip[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip .n { opacity: .7; margin-left: .35em; font-size: .85em; }

/* Upload */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px 16px; background: var(--surface); color: var(--text);
  transition: border-color .15s, background .15s; margin: 0 0 12px; font-weight: 400;
}
.dropzone svg { color: var(--accent); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.upload-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; background: var(--surface); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .9rem; }
.upload-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .bar { grid-column: 1 / -1; height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.upload-item .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-item.err .state { color: var(--danger); }
.upload-item.ok .state { color: var(--accent); }

/* Grid */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; } }
.grid li { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
@media (max-width: 520px) { .grid li { border-radius: 8px; } }
.grid button { all: unset; display: block; width: 100%; height: 100%; cursor: pointer; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.grid button:hover img { transform: scale(1.03); }
.grid button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.grid .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: .78rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.55)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Lists */
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .sub { color: var(--muted); font-size: .85rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form input { flex: 1 1 160px; margin: 0; }

/* Pairing */
.pair-result { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 16px; }
.qr { width: 180px; height: 180px; background: #fff; border-radius: var(--radius-sm); padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.pair-code { font: 700 2rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; margin: 0 0 4px; }

/* Dialogs */
dialog.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--text); border-radius: var(--radius);
  width: min(1000px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog.sheet.narrow { width: min(480px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10,10,12,.5); }
@media (max-width: 640px) {
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 94vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 20px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.sheet-head h2 { margin: 0; }
.sheet-body { padding: 6px 20px 20px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px; margin-bottom: 14px; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.focus-wrap { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); cursor: crosshair; touch-action: manipulation; margin-bottom: 8px; }
.focus-wrap img { display: block; width: 100%; max-height: 60vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.focus-dot { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.45), inset 0 0 0 2px rgba(0,0,0,.25); pointer-events: none; transition: left .12s, top .12s; }
.albums-field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px; }
.albums-field legend { font-weight: 600; font-size: .92rem; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; min-height: 36px; }
.checks input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--accent); }

/* Widget-Vorschau */
.previews { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 16px; }
.pv { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pv-box { position: relative; background-color: var(--surface-2); background-repeat: no-repeat; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.pv-box .pv-cap { position: absolute; left: 0; right: 0; bottom: 0; color: #fff; font-size: 9px; line-height: 1.25; padding: 14px 8px 6px; background: linear-gradient(transparent, rgba(0,0,0,.5)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-phone { border-radius: 14px; border: 3px solid #111; background-color: #000; }
.pv-label { font-size: .78rem; color: var(--muted); text-align: center; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(120px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .92rem; z-index: 100; transition: transform .25s; max-width: calc(100vw - 32px); }
#toast.show { transform: translateX(-50%) translateY(0); }

/* Öffentliche Seiten */
body.public { background: var(--bg); }
.public-main { max-width: 640px; margin: 0 auto; padding: 20px 16px 40px; }
.public-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; }
.public-head h1 { margin: 0; font-size: 1.45rem; }
.hero p { font-size: 1.05rem; }
.notice { background: var(--accent-soft); padding: 12px 14px; border-radius: var(--radius-sm); }
.section-title { font-size: 1.2rem; }
.steps { list-style: none; margin: 16px 0 0; padding: 0; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.step-body h2 { font-size: 1.05rem; margin: 4px 0 4px; }
.shots { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0; }
.shots figure { margin: 0; flex: 0 0 auto; }
.shots img { width: 180px; height: auto; border-radius: 14px; border: 1px solid var(--line); display: block; }
