:root {
  color-scheme: light;
  --bg: #f6f3f8;
  --surface: #ffffff;
  --surface-2: #f0ebf3;
  --surface-3: #e9e1ed;
  --text: #17151c;
  --muted: #746e7a;
  --border: #ddd4e2;
  --accent: #6f3f79;
  --accent-strong: #52275b;
  --accent-soft: #eadcf0;
  --green: #2d6a4f;
  --green-soft: #dff1e8;
  --yellow: #8b6315;
  --yellow-soft: #f7edcf;
  --red: #9a3e48;
  --red-soft: #f5dfe2;
  --blue: #3d5d8c;
  --blue-soft: #dde7f5;
  --shadow: 0 16px 40px rgba(48, 31, 53, 0.10);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --content: 1500px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); overflow-x: clip; }
body { margin: 0; min-height: 100%; color: var(--text); background: var(--bg); overflow-x: clip; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(111, 63, 121, .28); outline-offset: 2px; }
.app-shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid rgba(221, 212, 226, .8);
  background: rgba(246, 243, 248, .92); backdrop-filter: blur(18px);
}
.brand-wrap { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: var(--text); color: #fff; box-shadow: 0 8px 20px rgba(23,21,28,.18); flex: 0 0 auto; }
.brand-mark svg { width: 21px; height: 21px; fill: currentColor; }
.brand-title { font-weight: 760; letter-spacing: -.02em; line-height: 1.05; }
.brand-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.button, .icon-button, .segment, .filter-chip, .decision-button {
  border: 0; border-radius: 12px; min-height: 42px; transition: .18s ease;
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; font-weight: 680; }
.button:hover, .icon-button:hover, .segment:hover, .filter-chip:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--text); box-shadow: 0 8px 20px rgba(23,21,28,.14); }
.button-primary:hover { background: #2a2630; }
.button-secondary { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.button-danger { color: var(--red); background: var(--red-soft); }
.button-icon { font-size: 18px; line-height: 1; }
.icon-button { width: 42px; padding: 0; background: transparent; color: var(--text); font-size: 19px; }
.main-content { width: min(var(--content), calc(100% - 32px)); margin: 0 auto; padding: clamp(28px, 5vw, 66px) 0 70px; }
.intro-section { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
h1 { margin: 0; max-width: 780px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 7vw, 78px); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.intro-section p { max-width: 720px; margin: 16px 0 0; color: var(--muted); font-size: clamp(16px, 2vw, 20px); line-height: 1.55; }
.sync-status { flex: 0 0 auto; max-width: 360px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.62); font-size: 13px; line-height: 1.4; }
.sync-status strong { color: var(--text); }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.summary-tile { position: relative; padding: 18px; min-height: 122px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); text-align: left; overflow: hidden; }
.summary-tile::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 999px; right: -30px; bottom: -36px; opacity: .7; background: var(--tile-soft, var(--accent-soft)); }
.summary-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.summary-label { color: var(--muted); font-size: 13px; font-weight: 650; }
.summary-value { margin-top: 13px; font-size: 34px; line-height: 1; font-weight: 780; letter-spacing: -.04em; }
.summary-meta { margin-top: 8px; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.search-wrap { flex: 1; max-width: 760px; position: relative; display: flex; align-items: center; }
.search-wrap > span { position: absolute; left: 15px; color: var(--muted); font-size: 22px; pointer-events: none; }
.search-wrap input { width: 100%; height: 50px; padding: 0 18px 0 46px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); color: var(--text); font-size: 15px; }
.toolbar-controls { display: flex; align-items: center; gap: 8px; }
.segmented { display: flex; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.segment { min-height: 36px; padding: 0 12px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 700; }
.segment.is-active { color: var(--text); background: var(--surface-2); }
.count-badge { min-width: 22px; height: 22px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.filter-chip { padding: 0 15px; min-height: 38px; border: 1px solid var(--border); color: var(--muted); background: rgba(255,255,255,.7); font-size: 13px; font-weight: 700; }
.filter-chip.is-active { color: #fff; border-color: var(--text); background: var(--text); }
.purchase-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.purchase-card { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: 0 5px 18px rgba(48,31,53,.055); transition: transform .18s ease, box-shadow .18s ease; }
.purchase-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-image-wrap { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: linear-gradient(145deg, #eee7f2, #ded2e4); }
.card-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(82,39,91,.72); font-family: Georgia, serif; font-size: 48px; background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.8), transparent 35%), linear-gradient(140deg, #ece4f0, #d8c9df); }
.card-badges { position: absolute; inset: 12px 12px auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; pointer-events: none; }
.shop-badge, .urgency-badge { padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); color: var(--text); font-size: 11px; font-weight: 780; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.urgency-badge.urgent { color: var(--red); background: rgba(245,223,226,.92); }
.urgency-badge.soon { color: var(--yellow); background: rgba(247,237,207,.94); }
.card-body { padding: 17px; display: flex; flex-direction: column; gap: 13px; }
.card-title { margin: 0; min-height: 2.6em; font-size: 16px; line-height: 1.3; letter-spacing: -.01em; }
.card-subline { display: flex; flex-wrap: wrap; gap: 7px 10px; color: var(--muted); font-size: 12px; }
.card-subline span { display: inline-flex; align-items: center; gap: 4px; }
.card-price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-price { font-size: 18px; font-weight: 780; letter-spacing: -.025em; }
.card-status { color: var(--muted); font-size: 11px; text-align: right; }
.decision-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.decision-button { min-height: 38px; padding: 0 7px; border: 1px solid var(--border); color: var(--muted); background: #fff; font-size: 11px; font-weight: 760; }
.decision-button[data-decision="behalten"].is-active { color: var(--green); border-color: #9ecbb6; background: var(--green-soft); }
.decision-button[data-decision="vielleicht"].is-active { color: var(--yellow); border-color: #dfc980; background: var(--yellow-soft); }
.decision-button[data-decision="zuruckgeben"].is-active { color: var(--red); border-color: #dca8ae; background: var(--red-soft); }
.card-open { width: 100%; min-height: 42px; border: 0; border-radius: 12px; color: var(--text); background: var(--surface-2); font-weight: 720; }
.purchase-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.purchase-grid.compact .purchase-card { display: grid; grid-template-columns: 118px 1fr; }
.purchase-grid.compact .card-image-wrap { aspect-ratio: auto; min-height: 100%; }
.purchase-grid.compact .card-body { padding: 14px; gap: 9px; }
.purchase-grid.compact .card-title { min-height: 0; }
.purchase-grid.images-off .card-image-wrap { display: none; }
.purchase-grid.compact.images-off .purchase-card { grid-template-columns: 1fr; }
.empty-state { padding: 80px 20px; text-align: center; color: var(--muted); }
.empty-state h2 { margin: 15px 0 6px; color: var(--text); }
.empty-icon { font-size: 52px; color: var(--accent); }
.modal { width: min(720px, calc(100dvw - 28px)); max-width: calc(100dvw - 28px); max-height: min(92dvh, 900px); padding: 0; border: 0; border-radius: 24px; color: var(--text); background: var(--surface); box-shadow: 0 28px 90px rgba(23,21,28,.26); overflow: hidden; overflow-x: clip; overscroll-behavior: contain; display: grid; grid-template-rows: auto auto minmax(0, 1fr); align-content: start; }
.modal-wide { width: min(1100px, calc(100dvw - 28px)); max-width: calc(100dvw - 28px); }
.modal:not([open]), .lightbox:not([open]) { display: none !important; }
.modal::backdrop, .lightbox::backdrop { background: rgba(16,13,18,.64); backdrop-filter: blur(5px); }
.modal-inner { padding: clamp(20px, 4vw, 34px); min-width: 0; min-height: 0; overflow-x: clip; overflow-y: auto; }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: -1px -1px 0; padding: 22px 24px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.95); backdrop-filter: blur(14px); }
.modal-header > :first-child { min-width: 0; flex: 1 1 auto; }
.modal-title { margin: 0; font-size: 25px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.modal-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.modal-feedback { position: sticky; top: 92px; z-index: 4; margin: 0 24px 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: rgba(255,255,255,.98); box-shadow: 0 10px 28px rgba(23,21,28,.12); }
.modal-feedback[hidden] { display: none; }
.modal-feedback.error { border-color: #ddb2b8; background: #fff5f6; }
.modal-feedback.success { border-color: #acd3bf; background: #f3fbf7; }
.close-button { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--surface-2); font-size: 20px; flex: 0 0 auto; }
.detail-layout { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(340px, 1.1fr); gap: 26px; min-width: 0; }
.detail-layout > * { min-width: 0; }
.gallery-main { position: relative; aspect-ratio: 4 / 5; min-height: 280px; border-radius: 20px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: #f7f4f8; }
.gallery-empty { width: 100%; height: 100%; display: grid; place-items: center; padding: 30px; text-align: center; color: var(--muted); }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0; border-radius: 999px; color: var(--text); background: rgba(255,255,255,.9); box-shadow: 0 5px 18px rgba(0,0,0,.12); }
.gallery-nav.prev { left: 12px; }
.gallery-nav.next { right: 12px; }
.gallery-counter { position: absolute; right: 12px; bottom: 12px; padding: 7px 10px; border-radius: 999px; background: rgba(23,21,28,.74); color: #fff; font-size: 11px; }
.thumbnail-row { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding: 2px 0 6px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.thumbnail { position: relative; width: 66px; height: 80px; flex: 0 0 auto; border: 2px solid transparent; border-radius: 11px; overflow: hidden; background: var(--surface-2); scroll-snap-align: start; }
.thumbnail.is-active { border-color: var(--accent); }
.thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.thumbnail-remove { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 999px; background: rgba(23,21,28,.75); color: #fff; font-size: 14px; line-height: 1; }
.image-tools-disclosure { margin-top: 12px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.78); overflow: hidden; }
.image-tools-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; font-weight: 760; }
.image-tools-summary::-webkit-details-marker { display: none; }
.image-tools-summary::after { content: "▾"; color: var(--muted); transition: transform .18s ease; }
.image-tools-disclosure[open] .image-tools-summary::after { transform: rotate(180deg); }
.image-tools-disclosure[open] .image-tools-summary { border-bottom: 1px solid var(--border); }
.image-tools-body { display: grid; gap: 10px; padding: 12px; }
.image-tools { display: grid; gap: 8px; }
.inline-row { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.inline-row > * { min-width: 0; }
.inline-row > input { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { color: var(--muted); font-size: 12px; font-weight: 730; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--text); padding: 11px 12px; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.help-box { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--muted); font-size: 13px; line-height: 1.55; }
.help-box strong { color: var(--text); }
.review-list { display: grid; gap: 10px; }
.review-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.review-item h3 { margin: 0 0 4px; font-size: 15px; }
.issue-list { display: flex; flex-wrap: wrap; gap: 6px; }
.issue-pill { padding: 5px 8px; border-radius: 999px; color: var(--yellow); background: var(--yellow-soft); font-size: 11px; font-weight: 700; }
.setting-section { display: grid; gap: 13px; padding: 17px 0; border-top: 1px solid var(--border); }
.setting-section:first-child { border-top: 0; padding-top: 0; }
.setting-section h3 { margin: 0; font-size: 17px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.setting-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.switch { width: 50px; height: 30px; padding: 3px; border: 0; border-radius: 999px; background: #cfc6d3; }
.switch::after { content: ""; display: block; width: 24px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); transition: transform .18s ease; }
.switch[aria-pressed="true"] { background: var(--accent); }
.switch[aria-pressed="true"]::after { transform: translateX(20px); }
.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; max-width: min(390px, calc(100vw - 36px)); }
.toast { padding: 13px 15px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: rgba(255,255,255,.96); box-shadow: var(--shadow); animation: toast-in .22s ease; }
.toast.error { border-color: #ddb2b8; background: #fff5f6; }
.toast.success { border-color: #acd3bf; background: #f3fbf7; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
.lightbox { width: 100dvw; height: 100dvh; max-width: none; max-height: none; padding: 0; border: 0; background: rgba(12,10,14,.96); color: #fff; }
.lightbox-inner { position: relative; width: 100%; height: 100%; display: grid; place-items: center; padding: 70px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .close-button { position: absolute; top: 18px; right: 18px; color: #fff; background: rgba(255,255,255,.14); }
.lightbox .gallery-nav { background: rgba(255,255,255,.15); color: #fff; }
.lightbox-caption { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 8px 12px; border-radius: 999px; background: rgba(0,0,0,.38); font-size: 12px; }
.connection-good { color: var(--green); }
.connection-warn { color: var(--yellow); }
.connection-bad { color: var(--red); }
.hidden { display: none !important; }
@media (max-width: 1180px) {
  .purchase-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-grid, .purchase-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-grid.compact .purchase-card { display: flex; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-wrap { max-width: none; }
  .toolbar-controls { flex-wrap: wrap; }
  .detail-layout { grid-template-columns: 1fr; }
  .intro-section { align-items: flex-start; flex-direction: column; }
  .sync-status { max-width: none; }
}
@media (max-width: 620px) {
  .topbar { align-items: flex-start; padding: 12px 14px; }
  .topbar-actions { gap: 4px; }
  .hide-mobile { display: none; }
  .button { padding-inline: 11px; }
  .topbar .button-secondary { width: 42px; padding: 0; }
  .main-content { width: min(100% - 22px, var(--content)); padding-top: 28px; }
  h1 { font-size: 48px; }
  .intro-section p { font-size: 16px; }
  .summary-grid { gap: 8px; }
  .summary-tile { min-height: 105px; padding: 14px; }
  .summary-value { font-size: 29px; }
  .purchase-grid, .purchase-grid.compact { grid-template-columns: 1fr; gap: 12px; }
  .purchase-grid.compact .purchase-card { display: grid; grid-template-columns: 105px 1fr; }
  .purchase-grid.compact.images-off .purchase-card { grid-template-columns: 1fr; }
  .purchase-grid.compact .decision-group { grid-template-columns: 1fr 1fr 1fr; }
  .review-button { margin-left: auto; }
  .toolbar-controls { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal, .modal-wide { position: fixed; inset: 0; width: 100dvw; max-width: 100dvw; min-width: 0; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .modal-header { gap: 12px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; }
  .modal-title { font-size: clamp(24px, 7vw, 30px); line-height: 1.05; }
  .modal-inner { padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .modal-feedback { top: calc(68px + env(safe-area-inset-top, 0px)); margin: 0 16px 10px; }
  .gallery-main { aspect-ratio: auto; height: min(52dvh, 420px); min-height: 240px; }
  .gallery-nav { width: 38px; height: 38px; }
  .thumbnail { width: 72px; height: 88px; }
  .lightbox-inner { padding: calc(64px + env(safe-area-inset-top, 0px)) 12px calc(60px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (max-width: 620px) {
  .image-tools-summary { padding: 13px 14px; }
  .image-tools-body { padding: 12px; }
  .image-tools .inline-row { flex-wrap: wrap; }
  .image-tools .inline-row > input { min-width: 100%; }
  .image-tools .inline-row > .button { flex: 1 1 auto; }
  .gallery-order-tools { display: grid !important; grid-template-columns: 1fr 1fr 1fr; }
  .gallery-order-tools .button { min-width: 0; min-height: 44px; padding-inline: 6px; font-size: 12px; }
  .help-box { font-size: 12px; }
  .form-actions { position: sticky; bottom: calc(-14px - env(safe-area-inset-bottom, 0px)); margin: 0 -16px calc(-24px - env(safe-area-inset-bottom, 0px)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(246,243,248,.95); backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
  .form-actions .button { flex: 1 1 0; }
}

@media (min-width: 621px) {
  .image-tools-disclosure { border: 0; background: transparent; }
  .image-tools-summary { display: none; }
  .image-tools-body { padding: 0; }
}

.optional-sync { display: block; }
.optional-sync > summary { cursor: pointer; font-weight: 750; font-size: 16px; color: var(--text); }
.optional-sync[open] > summary { margin-bottom: 14px; }
.optional-sync[open] { display: grid; }

@media (max-width: 640px) {
  .setting-section .inline-row { flex-wrap: wrap; }
  .setting-section .inline-row > .button,
  .setting-section .inline-row > label.button { flex: 1 1 100%; justify-content: center; }
}
