/* Preisfinder – iOS-Stil mit Glas-Optik
   Grouped Lists, große Titel, durchscheinende Flächen über weichem Farbhintergrund. */
:root {
  color-scheme: light dark;
  --accent: light-dark(#da291c, #ff453a);
  --accent-press: light-dark(#b81f14, #ff6961);
  --bg: light-dark(#eef0f5, #000000);
  --ink: light-dark(#000000, #ffffff);
  --muted: light-dark(rgba(60,60,67,.62), rgba(235,235,245,.62));
  --faint: light-dark(rgba(60,60,67,.3), rgba(235,235,245,.3));
  --sep: light-dark(rgba(60,60,67,.18), rgba(84,84,88,.55));
  --fill: light-dark(rgba(118,118,128,.12), rgba(118,118,128,.24));
  --fill-2: light-dark(rgba(118,118,128,.08), rgba(118,118,128,.16));
  --glass: light-dark(rgba(255,255,255,.58), rgba(38,38,42,.52));
  --glass-strong: light-dark(rgba(255,255,255,.78), rgba(32,32,36,.78));
  --glass-edge: light-dark(rgba(255,255,255,.85), rgba(255,255,255,.1));
  --glass-shadow: light-dark(0 8px 32px -10px rgba(30,40,80,.18), 0 8px 32px -10px rgba(0,0,0,.6));
  --blur: blur(28px) saturate(180%);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --pad: max(4vw, 16px);
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }

* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.4 var(--font); letter-spacing: -.01em; overflow-x: clip;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
/* Weicher Farbhintergrund, damit das Glas sichtbar wird */
body::before, .auth-bg {
  content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 34% at 12% 8%, light-dark(rgba(218,41,28,.20), rgba(255,69,58,.28)), transparent 70%),
    radial-gradient(40% 38% at 92% 18%, light-dark(rgba(10,132,255,.16), rgba(10,132,255,.22)), transparent 70%),
    radial-gradient(46% 40% at 70% 96%, light-dark(rgba(255,159,10,.14), rgba(191,90,242,.18)), transparent 70%),
    radial-gradient(30% 30% at 8% 80%, light-dark(rgba(175,82,222,.10), rgba(255,69,58,.12)), transparent 70%);
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-weight: 400; }

.glass, .group, .panel, .top, .bottom, .search, .chip, .sheet, .menu, .avatar, .auth-form {
  background: var(--glass);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: inset 0 0.5px 0 var(--glass-edge), var(--glass-shadow);
}

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--muted); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Kopfleiste ---------- */
.top {
  position: sticky; top: 0; z-index: 20; border-radius: 0;
  box-shadow: inset 0 -0.5px 0 var(--sep);
  padding-top: env(safe-area-inset-top, 0px);
}
.top-in { max-width: 1000px; margin: 0 auto; padding: 0 var(--pad); height: 54px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 17px; white-space: nowrap; color: var(--ink); }
.mark, .appicon { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); display: grid; place-items: center; flex: none; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.mark svg { width: 18px; height: 18px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1; margin-top: 2px; }
.tabs { display: flex; gap: 2px; margin: 0 auto; background: var(--fill-2); padding: 3px; border-radius: 99px; }
.tab { padding: 6px 16px; border-radius: 99px; color: var(--ink); font-weight: 500; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.tab[aria-current=page] { background: var(--glass-strong); box-shadow: 0 1px 4px rgba(0,0,0,.12); font-weight: 600; }
.tab .count { color: var(--muted); font-size: 13px; font-weight: 500; }
.spacer { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; font-weight: 600; font-size: 13px; display: grid; place-items: center; margin-left: auto; }

/* ---------- Tab-Leiste unten (iPhone) ---------- */
.bottom { display: none; }
@media (max-width: 760px) {
  .tabs { display: none; }
  .bottom {
    display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 4px;
    position: fixed; left: 14px; right: 14px; bottom: calc(10px + var(--safe-b)); z-index: 30;
    border-radius: 32px; padding: 5px;
  }
  .bottom button {
    border: 0; background: none; display: grid; justify-items: center; gap: 1px; padding: 6px 0 5px; border-radius: 26px;
    font-size: 10.5px; font-weight: 600; color: var(--ink); letter-spacing: 0;
  }
  .bottom button svg { width: 24px; height: 24px; }
  .bottom button[aria-current=page] { color: var(--accent); background: var(--fill); }
  main { padding-bottom: calc(110px + var(--safe-b)) !important; }
}

main { max-width: 1000px; margin: 0 auto; padding: 6px var(--pad) 60px; }
h1.large { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; margin: 14px 4px 10px; }

/* ---------- Suche ---------- */
.search-band {
  position: sticky; top: calc(54px + env(safe-area-inset-top, 0px)); z-index: 10;
  margin: 0 calc(-1 * var(--pad)) 4px; padding: 6px var(--pad) 10px;
  isolation: isolate;
}
.search-band::before {
  content: ""; position: absolute; inset: 0 0 -14px; z-index: -1; pointer-events: none;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent);
}
.search { position: relative; display: flex; align-items: center; border-radius: 14px; }
.search svg { position: absolute; left: 12px; width: 19px; height: 19px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; border: 0; background: none; outline: none; height: 46px; padding: 0 44px 0 40px; font-size: 17px; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button, .search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search:focus-within { box-shadow: inset 0 0.5px 0 var(--glass-edge), 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent), var(--glass-shadow); }
.search .clear { position: absolute; right: 6px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); display: none; place-items: center; }
.search .clear svg { position: static; width: 16px; height: 16px; padding: 3px; width: 22px; height: 22px; background: var(--faint); color: var(--bg); border-radius: 50%; }
.search.has .clear { display: grid; }
.filters { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.filters:empty { display: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; height: 34px;
  padding: 0 30px 0 14px; font-size: 15px; font-weight: 500; max-width: 240px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='%23999' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.chip.on { background-color: var(--accent); color: #fff; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 16px 8px; }

/* ---------- Gruppierte Listen (wie iOS Einstellungen) ---------- */
.group { border-radius: 22px; overflow: hidden; }
.sec { color: var(--muted); font-size: 15px; font-weight: 600; margin: 24px 16px 8px; display: flex; align-items: center; gap: 10px; }
.sec .link, button.link { border: 0; background: none; color: var(--accent); font-size: 17px; font-weight: 400; padding: 4px 0; margin-left: auto; }
.res {
  position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 2px 12px; align-items: center;
  width: 100%; border: 0; background: none; text-align: left; padding: 11px 14px 11px 16px; min-height: 58px; color: var(--ink);
}
.group > .res:not(:first-child)::before, .group > .item:not(:first-child)::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep);
}
.res:active, .res:hover { background: var(--fill-2); }
.res .t { font-weight: 500; font-size: 17px; line-height: 1.28; overflow-wrap: anywhere; }
.res .sub { color: var(--muted); font-size: 15px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .sub > span + span::before { content: "· "; color: var(--faint); }
.res .nr { font-variant-numeric: tabular-nums; }
.res .star svg { width: 14px; height: 14px; color: #ff9f0a; vertical-align: -1px; }
.price { text-align: right; white-space: nowrap; }
.price b { display: block; font-family: var(--display); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.price span { display: block; font-size: 13px; color: var(--muted); }
.price .new { color: var(--accent); font-size: 15px; }
.chev { width: 8px; height: 14px; color: var(--faint); }
mark { background: none; color: inherit; font-weight: 700; }
.results:not(.group) { display: grid; gap: 0; }
.load-more { margin: 14px auto 0; display: flex; }

.empty { text-align: center; padding: 70px 16px; color: var(--muted); display: grid; justify-items: center; gap: 4px; }
.empty svg { width: 46px; height: 46px; color: var(--faint); margin-bottom: 6px; }
.empty h2 { color: var(--ink); font-size: 20px; font-weight: 600; margin: 0; }
.empty p { margin: 0 0 12px; }

/* ---------- Knöpfe & Felder ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 0; background: var(--fill); font-weight: 600; font-size: 16px; white-space: nowrap; color: var(--accent);
}
.btn:active { opacity: .7; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-press); }
.btn.danger { color: var(--accent); }
.btn.ghost { background: none; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 15px; border-radius: 99px; font-weight: 500; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn svg { width: 17px; height: 17px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label.f { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
label.f > span.h { font-weight: 400; }
.in, select.in {
  width: 100%; min-height: 46px; border: 0; background: var(--fill); border-radius: 12px; padding: 0 14px; font-size: 17px; color: var(--ink);
}
.in::placeholder { color: var(--muted); }
.in:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.err { color: var(--accent); font-size: 15px; min-height: 1.2em; }

/* ---------- Verwaltung ---------- */
.panel { border-radius: 22px; padding: clamp(16px, 3vw, 22px); }
.panel h2 { font-size: 20px; font-weight: 600; margin: 0 0 2px; }
.panel p.lead { margin: 0; color: var(--muted); font-size: 15px; }
.drop {
  border: 1.5px dashed var(--faint); border-radius: 18px; padding: 28px 18px; text-align: center; display: grid; justify-items: center; gap: 4px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: var(--fill-2); border-color: var(--accent); }
.drop svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 4px; }
.drop b { font-size: 17px; font-weight: 600; color: var(--accent); }
.drop small { color: var(--muted); font-size: 14px; }
.steps { display: grid; gap: 20px; margin-top: 18px; }
.seg { display: inline-flex; background: var(--fill); border-radius: 10px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; border-radius: 8px; min-height: 32px; padding: 0 14px; font-weight: 500; font-size: 14px; }
.seg button[aria-pressed=true] { background: light-dark(#fff, #636366); box-shadow: 0 2px 6px rgba(0,0,0,.12); font-weight: 600; }
.seg button[disabled] { opacity: .4; }
.map { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.pricepick { display: flex; flex-wrap: wrap; gap: 6px; }
.pricepick label { display: inline-flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 99px; padding: 6px 13px; font-size: 15px; cursor: pointer; }
.pricepick input { position: absolute; opacity: 0; pointer-events: none; }
.pricepick label:has(input:checked) { background: var(--accent); color: #fff; }
.pricepick label:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }

.tbl-wrap { overflow-x: auto; border-radius: 14px; background: var(--fill-2); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; border-bottom: 0.5px solid var(--sep); text-align: left; vertical-align: top; }
th { font-weight: 600; white-space: nowrap; font-size: 13px; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.preview td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
th.tag-art, th.tag-name, th.tag-price, th.tag-cat, th.tag-sup { color: var(--accent); }

#up { margin-top: 6px; }
.items.group { display: block; }
.item { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 14px; align-items: center; padding: 12px 14px 12px 16px; }
.item .t { font-weight: 500; }
.item .d { color: var(--muted); font-size: 14px; }
@media (max-width: 560px) { .item { grid-template-columns: 1fr; } }
.progress { height: 4px; background: var(--fill); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top, 0px)) 18px 24px; }
.auth-bg { z-index: 0; inset: 0; transform: scale(1.4); filter: saturate(1.2); }
.auth-form { position: relative; z-index: 1; width: min(100%, 400px); border-radius: 28px; padding: 30px 26px 26px; }
.auth-head { display: grid; justify-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.auth-head .appicon { width: 64px; height: 64px; border-radius: 15px; }
.auth-head .appicon svg { width: 36px; height: 36px; }
.auth-head b { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-head small { color: var(--muted); font-size: 14px; margin-top: -8px; }
.auth-form form { display: grid; gap: 14px; }
.auth-form h2 { font-size: 17px; font-weight: 600; margin: 0; text-align: center; color: var(--muted); }
.auth-form .btn.primary { min-height: 50px; font-size: 17px; border-radius: 14px; margin-top: 4px; }
.auth-form .foot { margin: 2px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 480px) {
  .auth { place-items: start center; padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  .auth-form { background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 10px 6px; }
}

/* ---------- Detail-Blatt ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.28); display: grid; place-items: center; padding: 18px; animation: fade .2s ease; }
.sheet {
  width: min(100%, 560px); max-height: min(88vh, 900px); overflow: auto; border-radius: 28px;
  background: var(--glass-strong); padding: 20px 20px 22px; animation: pop .22s cubic-bezier(.2,.8,.2,1); overscroll-behavior: contain;
}
.sheet.small { width: min(100%, 420px); }
.sheet h3 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.sheet .subtitle { color: var(--muted); font-size: 15px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.sheet-head .x { margin-left: auto; flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--fill); color: var(--muted); display: grid; place-items: center; }
.sheet-head .x svg { width: 15px; height: 15px; }
.big-price { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; margin-bottom: 16px; }
.big-price div { background: var(--fill-2); border-radius: 16px; padding: 12px 14px; }
.big-price div span { display: block; color: var(--muted); font-size: 13px; }
.big-price div b { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.big-price div:not(:first-child) b { font-size: 22px; font-weight: 600; }
dl.kv { display: grid; grid-template-columns: auto minmax(0,1fr); margin: 0; background: var(--fill-2); border-radius: 16px; overflow: hidden; }
dl.kv dt, dl.kv dd { margin: 0; padding: 11px 16px; font-size: 16px; border-top: 0.5px solid var(--sep); }
dl.kv dt { color: var(--ink); padding-right: 8px; }
dl.kv dd { color: var(--muted); text-align: right; overflow-wrap: anywhere; }
dl.kv > :nth-child(-n+2) { border-top: 0; }
.srcline { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 13px; margin: 12px 16px 0; }
.srcline span + span::before { content: "·"; margin-right: 10px; }
@media (max-width: 600px) {
  .scrim { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; max-height: 92vh; border-radius: 30px 30px 0 0; padding-bottom: calc(22px + var(--safe-b)); animation: up .32s cubic-bezier(.2,.9,.2,1); }
  .sheet::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 9px; background: var(--faint); margin: -10px auto 12px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes up { from { transform: translateY(100%); } }

/* ---------- Menü & Hinweise ---------- */
.menu { position: fixed; z-index: 60; background: var(--glass-strong); border-radius: 16px; padding: 6px; min-width: 250px; animation: pop .14s ease; transform-origin: top right; }
.menu .who { padding: 8px 12px 10px; }
.menu .who b { display: block; font-weight: 600; }
.menu .who span { color: var(--muted); font-size: 13px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 12px; border: 0; background: none; padding: 11px 12px; border-radius: 10px; text-align: left; font-size: 16px; }
.menu > button { border-top: 0.5px solid var(--sep); border-radius: 0; }
.menu button:hover { background: var(--fill-2); }
.menu svg { width: 19px; height: 19px; color: var(--muted); }
.menu .seg button { border: 0; justify-content: center; padding: 0; font-size: 14px; }

#toast {
  position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translate(-50%, 16px); z-index: 80;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: inset 0 0.5px 0 var(--glass-edge), var(--glass-shadow);
  padding: 11px 18px; border-radius: 99px; font-weight: 500; font-size: 15px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) { #toast { bottom: calc(96px + var(--safe-b)); } }

@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

#up .err:empty { display: none; }
