:root {
  --bg: #f4f6f4;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #6b766f;
  --line: #e2e7e3;
  --accent: #2e7d4f;
  --accent-soft: #e3f2e8;
  --warn: #c0392b;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --card: #1c221f; --text: #e8eee9; --muted: #93a098;
    --line: #2c3530; --accent: #4caf7a; --accent-soft: #1f3a2a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); font-weight: normal; }

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--accent); color: #fff; font-size: 19px;
}
.top .muted { color: #d6eadd; }
.icon { text-decoration: none; font-size: 22px; }

/* Layout: Handy einspaltig, Tablet zweispaltig */
.layout { max-width: 1300px; margin: 0 auto; padding: 14px; display: grid; gap: 16px; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 1fr 1.2fr; align-items: start; }
  .add { position: sticky; top: 70px; }
  body { font-size: 19px; }
}

/* Suche */
.searchbox { position: relative; }
#q, #aq {
  width: 100%; padding: 15px 44px 15px 16px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--card); font-size: 1.1em; outline: none;
}
#q:focus, #aq:focus { border-color: var(--accent); }
#q::-webkit-search-cancel-button, #aq::-webkit-search-cancel-button { display: none; }
.clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; font-size: 20px; color: var(--muted); padding: 8px;
}
.suggest { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sugg {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  text-align: left; padding: 13px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card);
}
.sugg:active { background: var(--accent-soft); }
.sugg small { color: var(--muted); font-size: .8em; white-space: nowrap; }
.sugg b { color: var(--accent); }
.sugg.drauf { opacity: .6; }
.sugg.neu { border-style: dashed; color: var(--accent); font-weight: 600; }

.newform {
  margin-top: 10px; padding: 14px; border-radius: var(--radius);
  background: var(--accent-soft); display: grid; gap: 10px;
}
.newform select { padding: 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }

/* Häufig gekauft */
h3 { font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card);
}
.chip:active { background: var(--accent-soft); }

/* Liste */
.group h3:first-child { margin-top: 6px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  background: var(--card); border-radius: var(--radius); margin-bottom: 6px;
  border: 1px solid var(--line); user-select: none; -webkit-user-select: none;
}
.item:active { background: var(--accent-soft); }
.box {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--accent); display: grid; place-items: center;
  color: #fff; font-weight: bold;
}
.name { flex: 1; display: flex; flex-direction: column; }
.name small { color: var(--muted); font-size: .7em; }
.menge {
  border: 0; background: var(--accent-soft); color: var(--accent);
  padding: 6px 10px; border-radius: 999px; font-size: .85em; font-weight: 600;
}
.menge.leer { background: none; color: var(--muted); font-weight: normal; }
.del { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 6px 8px; }
.item.done { opacity: .55; }
.item.done .box { background: var(--accent); }
.item.done .name { text-decoration: line-through; }

.donehead { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 1.1em; }

/* Buttons & Formulare */
.btn {
  display: inline-block; text-align: center; text-decoration: none;
  padding: 13px 18px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.btn.small { padding: 8px 12px; font-size: .85em; }
.btn.ghost { background: none; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--warn); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); background: #222; color: #fff;
  padding: 11px 18px; border-radius: 999px; z-index: 20; font-size: .95em;
}

/* Login / Einstellungen */
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border-radius: 18px; padding: 22px; border: 1px solid var(--line); }
.login { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.login h1 { margin: 0 0 6px; text-align: center; }
label { display: grid; gap: 5px; font-size: .9em; color: var(--muted); }
label input, .card select, .card input {
  padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 1rem;
}
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.err { color: var(--warn); margin: 0; }
.ok { color: var(--accent); }

.settings { max-width: 760px; margin: 0 auto; padding: 14px; display: grid; gap: 16px; }
.settings h2 { margin: 0 0 12px; font-size: 1.15em; }
.settings form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.settings table { width: 100%; border-collapse: collapse; }
.settings td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.settings td select { padding: 6px; width: 100%; }
.settings .x { border: 0; background: none; color: var(--warn); font-size: 18px; }

/* ---------- Version 2: Reiter & Angebote ---------- */
.tabs {
  display: flex; background: var(--card); border-bottom: 1px solid var(--line);
}
.tabs button {
  flex: 1; padding: 12px; border: 0; background: none; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.notiz { color: var(--accent) !important; }
.badge {
  align-self: flex-start; margin-top: 3px; padding: 2px 8px; border-radius: 999px;
  background: #fff3cd; color: #7a5a00 !important; font-size: .72em !important;
}
@media (prefers-color-scheme: dark) { .badge { background: #3d3415; color: #f5d77a !important; } }

.angebote { max-width: 1300px; margin: 0 auto; padding: 14px; }
.angebote #themen { margin-top: 10px; }
.aopts { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 2px 6px; }
.seg { display: inline-flex; border: 1px solid var(--accent); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 7px 12px; color: var(--accent); font-size: .85em; }
.seg button.active { background: var(--accent); color: #fff; }
.ainfo { color: var(--muted); font-size: .9em; margin: 4px 2px 8px; }
.ainfo a { color: var(--accent); }
.laden::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 8px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: dreh .8s linear infinite; vertical-align: -1px; }
@keyframes dreh { to { transform: rotate(360deg); } }

.ogrid { display: grid; gap: 8px; }
@media (min-width: 700px) { .ogrid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); } }
.offer {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.oimg { width: 64px; height: 64px; border-radius: 10px; background: #fff; overflow: hidden; display: grid; place-items: center; }
.oimg img { max-width: 100%; max-height: 100%; object-fit: contain; }
.otext { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.otext b { font-size: .95em; line-height: 1.25; }
.oinfo { color: var(--muted); font-size: .75em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.otags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.otags span { font-size: .7em; padding: 2px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.otags .markt { background: var(--accent); color: #fff; font-weight: 600; }
.oprice { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.oprice b { font-size: 1.15em; color: var(--warn); }
.oprice s { font-size: .75em; color: var(--muted); }
.oprice small { font-size: .68em; color: var(--muted); white-space: nowrap; }
.oprice .btn { margin-top: 4px; }
.ogroup .mehr { margin-top: 8px; }
.keine { font-size: .9em; padding: 2px 4px 8px; }

.marktwahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-bottom: 6px; }
.thema { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.thema textarea { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; resize: vertical; }
.thema div { display: flex; gap: 8px; }

/* Version 2.2: Angebots-Suche */
.asearch { display: flex; gap: 8px; align-items: stretch; }
.asearch .searchbox { flex: 1; }
.asearch .btn { white-space: nowrap; border-radius: var(--radius); }
.thema-tag { color: var(--accent) !important; font-weight: 600; }

/* =====================================================================
   Design „Luxus“ – Cognac, Gold & Elfenbein (eigenes Muster)
   ===================================================================== */
body.theme-luxus {
  --bg: #f6eedf;
  --card: #fbf6ec;
  --text: #2b1a12;
  --muted: #8a6f55;
  --line: #e2cfa8;
  --accent: #8b5a2b;
  --accent-soft: #f1e3c6;
  --warn: #7a1f24;
  --gold: #c9a25c;
  --gold-hell: #e6cc8f;
  --dunkel: #24150e;
  --serif: "Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", "Times New Roman", Georgia, serif;

  color: var(--text);
  background-color: #2e1c13;
  background-image:
    radial-gradient(rgba(214, 178, 108, .28) 1px, transparent 1.6px),
    repeating-linear-gradient(45deg, rgba(214, 178, 108, .07) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(-45deg, rgba(214, 178, 108, .07) 0 1px, transparent 1px 22px);
  background-size: 22px 22px, auto, auto;
  background-attachment: fixed;
}

/* Kopf & Reiter */
.theme-luxus .top {
  background: linear-gradient(180deg, #3b2418, var(--dunkel));
  color: var(--gold-hell);
  border-bottom: 1px solid var(--gold);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
.theme-luxus .brand { font-family: var(--serif); }
.theme-luxus .brand .ico { display: none; }
.theme-luxus .brand::before { content: "✦"; color: var(--gold); margin-right: 8px; font-size: .8em; }
.theme-luxus .brand b { text-transform: uppercase; letter-spacing: .28em; font-weight: 400; }
.theme-luxus .top .muted { color: #b89568; font-style: italic; letter-spacing: .04em; }
.theme-luxus .top a { color: var(--gold-hell) !important; }

.theme-luxus .tabs { background: var(--dunkel); border-bottom: 1px solid rgba(201, 162, 92, .35); }
.theme-luxus .tabs button {
  color: #a88b63; font-family: var(--serif); text-transform: uppercase;
  letter-spacing: .14em; font-weight: 400; font-size: .85em;
}
.theme-luxus .tabs button.active { color: var(--gold-hell); border-bottom-color: var(--gold); }

/* Überschriften auf dunklem Grund */
.theme-luxus h3 {
  color: var(--gold-hell); font-family: var(--serif); font-weight: 400;
  letter-spacing: .18em;
}
.theme-luxus .group h3::after, .theme-luxus .ogroup h3::after {
  content: ""; display: block; height: 1px; margin-top: 6px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.theme-luxus .card h3, .theme-luxus .settings .card h3 { color: var(--accent); }
.theme-luxus h1, .theme-luxus h2 { font-family: var(--serif); font-weight: 400; letter-spacing: .06em; }
.theme-luxus .empty { color: var(--gold-hell); font-family: var(--serif); font-style: italic; }
.theme-luxus .ainfo, .theme-luxus .aopts label.check { color: #e3cfa6; }
.theme-luxus .ainfo a { color: var(--gold-hell); }
.theme-luxus .settings > .ok, .theme-luxus .settings > .err { background: var(--card); padding: 10px 14px; border-radius: 10px; }

/* Eingabefelder */
.theme-luxus #q, .theme-luxus #aq {
  background: var(--card); border: 1px solid var(--gold); color: var(--text);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08);
}
.theme-luxus #q:focus, .theme-luxus #aq:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 92, .35); }
.theme-luxus label input, .theme-luxus .card select, .theme-luxus .card input, .theme-luxus .thema textarea {
  background: #fffaf1; border-color: var(--line);
}

/* Knöpfe */
.theme-luxus .btn {
  background: linear-gradient(180deg, #a06a36, #7a4a22);
  color: #fbf1dc; border: 1px solid var(--gold);
  letter-spacing: .08em; font-weight: 500;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 2px 6px rgba(0, 0, 0, .25);
}
.theme-luxus .btn.ghost { background: transparent; color: var(--gold-hell); box-shadow: none; }
.theme-luxus .card .btn.ghost, .theme-luxus .settings .btn.ghost { color: var(--accent); border-color: var(--accent); }
.theme-luxus .btn.danger { background: linear-gradient(180deg, #8e2a2f, #6a1a1e); }
.theme-luxus .chip {
  background: rgba(36, 21, 14, .55); color: #ecdcb8; border: 1px solid rgba(201, 162, 92, .7);
  font-family: var(--serif); letter-spacing: .04em;
}
.theme-luxus .chip:active { background: var(--gold); color: var(--dunkel); }
.theme-luxus .seg { border-color: var(--gold); }
.theme-luxus .seg button { color: var(--gold-hell); }
.theme-luxus .seg button.active { background: var(--gold); color: var(--dunkel); }
.theme-luxus .clear { color: var(--muted); }

/* Vorschläge & Listeneinträge */
.theme-luxus .sugg, .theme-luxus .item, .theme-luxus .offer, .theme-luxus .card {
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
}
.theme-luxus .sugg.neu { background: rgba(251, 246, 236, .9); border: 1px dashed var(--gold); color: var(--accent); }
.theme-luxus .sugg b { color: var(--accent); }
.theme-luxus .newform { background: var(--accent-soft); border: 1px solid var(--gold); }
.theme-luxus .item { border-left: 3px solid var(--gold); }
.theme-luxus .item .name { font-family: var(--serif); font-size: 1.05em; letter-spacing: .02em; }
.theme-luxus .box { border-color: var(--gold); width: 26px; height: 26px; }
.theme-luxus .item.done { opacity: .7; }
.theme-luxus .item.done .box { background: var(--gold); color: var(--dunkel); }
.theme-luxus .menge { background: var(--accent-soft); color: var(--accent); }
.theme-luxus .menge.leer { background: none; color: var(--muted); }
.theme-luxus .badge { background: #f3e2b8; color: #6b4a14 !important; border: 1px solid var(--gold-hell); }
.theme-luxus .notiz { color: var(--accent) !important; }

/* Angebote */
.theme-luxus .otext b { font-family: var(--serif); font-weight: 400; font-size: 1em; }
.theme-luxus .oprice b { color: var(--warn); font-family: var(--serif); font-size: 1.25em; }
.theme-luxus .otags .markt { background: var(--dunkel); color: var(--gold-hell); letter-spacing: .05em; }
.theme-luxus .oimg { border: 1px solid var(--line); }

/* Sonstiges */
.theme-luxus .toast { background: var(--dunkel); color: var(--gold-hell); border: 1px solid var(--gold); }
.theme-luxus .laden::after { border-color: var(--gold); border-right-color: transparent; }
.theme-luxus .login h1 { color: var(--accent); text-transform: uppercase; letter-spacing: .25em; font-size: 1.6em; }
.theme-luxus .login h1.brand::before { font-size: .6em; vertical-align: middle; }

/* Auswahl im Einstellungsmenü */
.designwahl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dw {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 600;
}
.dw small { color: var(--muted); font-weight: normal; font-size: .8em; }
.dw.aktiv { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dw .vorschau { width: 100%; height: 56px; border-radius: 10px; margin-bottom: 4px; }
.dw-standard .vorschau { background: linear-gradient(180deg, #2e7d4f 0 35%, #f4f6f4 35%); border: 1px solid #e2e7e3; }
.dw-luxus .vorschau {
  border: 1px solid #c9a25c;
  background:
    linear-gradient(180deg, #24150e 0 35%, transparent 35%),
    radial-gradient(rgba(214, 178, 108, .45) 1px, transparent 1.6px) 0 0 / 10px 10px,
    #2e1c13;
}
.theme-luxus .top .icon { filter: sepia(1) saturate(1.6) brightness(1.1); }
