/* Machwerk – dunkel & edel: Anthrazit, Kupfer-Akzent, ruhige Flächen, 3D-Icons (Blender) bringen die Farbe */
:root {
  --bg: #16171b;
  --bg-2: #121317;
  --card: #1e2026;
  --card-2: #262830;
  --card-3: #2e313a;
  --field: #18191e;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --ink: #ececec;
  --ink-2: #a9abb3;
  --ink-3: #767983;
  --accent: #d4945a;
  --accent-2: #e6ac78;
  --accent-ink: #1a1b1f;
  --accent-soft: rgba(212, 148, 90, 0.13);
  --ok: #86c29c;     --ok-soft: rgba(134, 194, 156, 0.11);
  --warn: #e3b657;   --warn-soft: rgba(227, 182, 87, 0.11);
  --bad: #e5806f;    --bad-soft: rgba(229, 128, 111, 0.11);
  --info: #86b6d8;   --info-soft: rgba(134, 182, 216, 0.11);
  --violet: #ab9fe0; --violet-soft: rgba(171, 159, 224, 0.12);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --radius: 18px;
  --radius-s: 12px;
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-head: "Segoe UI Variable Display", "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --tabbar-h: 70px;
  --host-badge: 0px;        /* Höhe eines eingeblendeten Hosting-Hinweises (z. B. Netlify-Badge), siehe main.js */
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f3f0; --bg-2: #ebe9e4; --card: #ffffff; --card-2: #f3f2ef; --card-3: #e9e7e2; --field: #ffffff;
  --line: rgba(20, 20, 30, 0.08); --line-2: rgba(20, 20, 30, 0.14);
  --ink: #1d1f24; --ink-2: #5b5e67; --ink-3: #8d9099;
  --accent: #b8743c; --accent-2: #c98650; --accent-ink: #ffffff; --accent-soft: rgba(184, 116, 60, 0.11);
  --ok: #3f8f5c; --warn: #a77a12; --bad: #c2523f; --info: #3b7cab; --violet: #6d5cc2;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.05), 0 8px 24px rgba(20, 20, 30, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15.5px; line-height: 1.5; color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(212, 148, 90, 0.07), transparent 60%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; color: var(--ink-2); }
p { margin: 0 0 .7em; }
a { color: var(--accent-2); }
small, .muted { color: var(--ink-2); }
.tiny { font-size: .8rem; color: var(--ink-3); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* 3D-Icons */
.i3d { display: inline-block; object-fit: contain; flex-shrink: 0; user-select: none; -webkit-user-drag: none; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }
#sidebar { display: none; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
#view { flex: 1; padding: 18px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom) + var(--host-badge)); max-width: 1120px; width: 100%; margin: 0 auto; outline: none; }
#tabbar {
  position: fixed; left: 0; right: 0; bottom: var(--host-badge); z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 4px 6px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: .7rem; font-weight: 600; border-radius: 14px; }
#tabbar a .i3d { width: 30px; height: 30px; opacity: .72; transition: transform .2s, opacity .2s; }
#tabbar a.active { color: var(--accent-2); }
#tabbar a.active .i3d { opacity: 1; transform: translateY(-2px) scale(1.12); }

@media (min-width: 900px) {
  #sidebar {
    display: flex; flex-direction: column; gap: 2px; width: 248px; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px;
    background: var(--bg-2); border-right: 1px solid var(--line);
  }
  #sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; text-decoration: none; color: var(--ink); }
  #sidebar .brand img { width: 38px; height: 38px; border-radius: 10px; }
  #sidebar .brand b { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
  #sidebar .grp { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 650; padding: 14px 10px 6px; }
  #sidebar a.nav { display: flex; align-items: center; gap: 11px; padding: 6px 10px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 550; position: relative; }
  #sidebar a.nav .i3d { width: 28px; height: 28px; }
  #sidebar a.nav:hover { background: var(--card); color: var(--ink); }
  #sidebar a.nav.active { background: var(--card-2); color: var(--ink); }
  #sidebar a.nav.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
  #tabbar { display: none; }
  #view { padding: 32px 36px calc(56px + var(--host-badge)); }
}

/* ---------- Banner (Lizenz / Demo) ---------- */
#banner:empty { display: none; }
.banner { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: center; padding: 8px 16px; font-size: .86rem; font-weight: 550; border-bottom: 1px solid var(--line); text-align: center; color: var(--ink-2); }
.banner.trial { background: var(--accent-soft); color: var(--accent-2); }
.banner.free { background: var(--info-soft); }
.banner.demo { background: var(--violet-soft); color: var(--violet); }
.banner a, .banner button.link { color: inherit; font-weight: 700; }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-bottom: 22px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 12px; }
.page-head h1 .i3d { width: 46px; height: 46px; }
.page-head h1 .emo { font-size: 1.5rem; }
.page-head .spacer { flex: 1; }
.page-head .sub { color: var(--ink-2); font-size: .92rem; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-3); font-weight: 550; font-size: .9rem; margin-bottom: 10px; }
.back:hover { color: var(--ink); }

/* ---------- Karten ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.pad-s { padding: 12px; }
.card h2 { display: flex; align-items: center; gap: 10px; }
.card h2 .i3d { width: 30px; height: 30px; }
.card.pink { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--card); border-color: rgba(212, 148, 90, 0.22); }
.card.gelb { background: linear-gradient(var(--warn-soft), var(--warn-soft)), var(--card); border-color: rgba(227, 182, 87, 0.2); }
.card.tuerkis { background: linear-gradient(var(--info-soft), var(--info-soft)), var(--card); border-color: rgba(134, 182, 216, 0.2); }
.card.lila { background: linear-gradient(var(--violet-soft), var(--violet-soft)), var(--card); border-color: rgba(171, 159, 224, 0.2); }
.card.gruen { background: linear-gradient(var(--ok-soft), var(--ok-soft)), var(--card); border-color: rgba(134, 194, 156, 0.22); }
.card.rot { background: linear-gradient(var(--bad-soft), var(--bad-soft)), var(--card); border-color: rgba(229, 128, 111, 0.22); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 16px; }
.stack > * + * { margin-top: 10px; }

/* ---------- Kennzahlen ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; background: var(--card); min-height: 92px; text-decoration: none; color: inherit; display: block; }
.kpi .lbl { font-size: .74rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; }
.kpi .val { font-family: var(--font-head); font-size: 1.55rem; font-weight: 700; line-height: 1.25; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--ink-3); }
.kpi .i3d { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 58px; height: 58px; opacity: .95; }
.kpi.has-ico { padding-right: 76px; }
.kpi.pink .val { color: var(--accent-2); }
.kpi.gruen .val { color: var(--ok); }
.kpi.rot .val { color: var(--bad); }
.kpi.gelb .val { color: var(--warn); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--card-2); color: var(--ink);
  font-weight: 600; font-size: .93rem; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--card-3); border-color: rgba(255, 255, 255, 0.16); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .i3d { width: 22px; height: 22px; margin: -4px 0; }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 18px rgba(212, 148, 90, 0.22);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.tuerkis, .btn.gelb, .btn.lila { background: var(--card-2); }
.btn.danger { background: var(--bad-soft); color: var(--bad); border-color: rgba(229, 128, 111, 0.3); }
.btn.danger:hover { background: rgba(229, 128, 111, 0.2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--card-2); color: var(--ink); }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .86rem; border-radius: 10px; }
.btn.icon { width: 42px; padding: 0; }
.btn.small.icon { width: 34px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
button.link { background: none; border: 0; padding: 0; color: var(--accent-2); font-weight: 600; cursor: pointer; }
button.link:hover { text-decoration: underline; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom) + var(--host-badge)); z-index: 25;
  width: 58px; height: 58px; border-radius: 18px; font-size: 1.9rem; font-weight: 400; padding: 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border: 0;
  box-shadow: 0 10px 30px rgba(212, 148, 90, 0.35);
}
@media (min-width: 900px) { .fab { display: none; } }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 14px; }
.form .row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 600; font-size: .84rem; color: var(--ink-2); }
.field .hint { font-size: .76rem; color: var(--ink-3); font-weight: 400; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=tel], input[type=search], input[type=url], input[type=time], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s);
  background: var(--field); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 550; cursor: pointer; }
.suffix { display: flex; align-items: stretch; }
.suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.suffix em { font-style: normal; font-weight: 600; font-size: .86rem; color: var(--ink-2); padding: 0 12px; min-height: 42px; display: flex; align-items: center; white-space: nowrap; border: 1px solid var(--line-2); border-left: 0; border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--card-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-weight: 550; font-size: .86rem; cursor: pointer; user-select: none; transition: background .15s, color .15s; }
.chip:hover { color: var(--ink); background: var(--card); }
.chip.on { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(212, 148, 90, 0.35); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: .73rem; font-weight: 600; background: var(--card-3); color: var(--ink-2); white-space: nowrap; }
.tag.pink { background: var(--accent-soft); color: var(--accent-2); }
.tag.tuerkis { background: var(--info-soft); color: var(--info); }
.tag.gelb { background: var(--warn-soft); color: var(--warn); }
.tag.lila { background: var(--violet-soft); color: var(--violet); }
.tag.gruen { background: var(--ok-soft); color: var(--ok); }
.tag.rot { background: var(--bad-soft); color: var(--bad); }

.search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.search input { padding-left: 38px; }
.search::before { content: ""; position: absolute; left: 14px; top: 50%; width: 11px; height: 11px; border: 2px solid var(--ink-3); border-radius: 50%; transform: translateY(-62%); }
.search::after { content: ""; position: absolute; left: 25px; top: 55%; width: 6px; height: 2px; background: var(--ink-3); transform: rotate(45deg); border-radius: 2px; }

/* ---------- Listen ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: inherit; cursor: pointer; min-width: 0; transition: background .15s, border-color .15s; }
.item:hover { background: var(--card-2); border-color: var(--line-2); }
.item .thumb { width: 50px; height: 50px; flex-shrink: 0; border-radius: 13px; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; overflow: hidden; }
.item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.item .thumb .i3d { width: 40px; height: 40px; object-fit: contain; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: .8rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.item .end { text-align: right; flex-shrink: 0; }
.item .end b { font-family: var(--font-head); font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 30px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); }
.empty .i3d { width: 96px; height: 96px; display: block; margin: 0 auto 10px; }
.empty .emo { font-size: 2.4rem; display: block; margin-bottom: 6px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 9px 6px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
.tbl tr.sum td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }

.line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line span:last-child { font-variant-numeric: tabular-nums; }
.line.total { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; padding-top: 9px; margin-top: 4px; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---------- Hinweise ---------- */
.note { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-radius: 14px; border: 1px solid rgba(227, 182, 87, 0.22); background: var(--warn-soft); font-size: .9rem; margin-bottom: 12px; color: var(--ink); }
.note.warn { background: var(--bad-soft); border-color: rgba(229, 128, 111, 0.25); }
.note.ok { background: var(--ok-soft); border-color: rgba(134, 194, 156, 0.25); }
.note.info { background: var(--info-soft); border-color: rgba(134, 182, 216, 0.22); }
.note .emo { font-size: 1.05rem; line-height: 1.35; }
.note .i3d { width: 34px; height: 34px; margin: -4px 0; }

/* ---------- Fortschritt ---------- */
.bar { height: 8px; border-radius: 999px; background: var(--card-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

/* ---------- Diagramme ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

/* ---------- Dialog ---------- */
dialog.modal { border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--card); color: var(--ink); }
dialog.modal::backdrop { background: rgba(8, 8, 12, 0.6); backdrop-filter: blur(4px); }
dialog.modal .m-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; position: sticky; top: 0; z-index: 2; background: var(--card); border-radius: 22px 22px 0 0; }
dialog.modal .m-head h2 { margin: 0; flex: 1; font-size: 1.12rem; }
dialog.modal .m-body { padding: 6px 18px 18px; overflow-y: auto; }
dialog.modal .m-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--card); border-radius: 0 0 22px 22px; }
@media (max-width: 600px) {
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0; }
}

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 22px + var(--host-badge)); transform: translateX(-50%) translateY(16px); z-index: 100; pointer-events: none; opacity: 0; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#toast .t { display: flex; gap: 14px; align-items: center; background: var(--card-3); color: var(--ink); padding: 11px 18px; border-radius: 14px; font-weight: 550; font-size: .92rem; border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
#toast .t button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 9px; padding: 4px 12px; font-weight: 700; cursor: pointer; }
@media (min-width: 900px) { #toast { bottom: calc(28px + var(--host-badge)); } }

/* ---------- Stoppuhr ---------- */
#timer-pill { position: fixed; left: 12px; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom) + var(--host-badge)); z-index: 26; display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 8px; border-radius: 999px; background: var(--card-3); color: var(--ink); border: 1px solid rgba(212, 148, 90, 0.4); box-shadow: var(--shadow-lg); font-weight: 650; cursor: pointer; font-variant-numeric: tabular-nums; }
#timer-pill[hidden] { display: none; }
#timer-pill .i3d { width: 28px; height: 28px; }
#timer-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: blink 1.2s infinite; }
#timer-pill.paused .dot { animation: none; background: var(--ink-3); }
#timer-pill .tiny { color: var(--ink-3); }
@keyframes blink { 50% { opacity: .2; } }
@media (min-width: 900px) { #timer-pill { bottom: calc(20px + var(--host-badge)); left: 268px; } }

/* ---------- Produktkacheln / Marktmodus ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--card); cursor: pointer; user-select: none; text-align: left; padding: 0; color: inherit; transition: border-color .15s, transform .1s; }
.tile:hover { border-color: var(--line-2); }
.tile:active { transform: scale(.97); }
.tile .pic { aspect-ratio: 1.15; background: radial-gradient(circle at 50% 40%, var(--card-3), var(--card-2)); display: flex; align-items: center; justify-content: center; font-size: 2.6rem; }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.tile .pic .i3d { width: 62%; height: 62%; object-fit: contain; }
.tile .txt { padding: 9px 12px 11px; }
.tile .txt b { display: block; font-size: .88rem; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .txt span { font-family: var(--font-head); font-weight: 650; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.tile .count { position: absolute; top: 8px; right: 8px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
.tile .stock { position: absolute; top: 8px; left: 8px; backdrop-filter: blur(6px); }
.tile.pop { animation: pop .25s; }
@keyframes pop { 40% { transform: scale(.95); } }
.tile.soldout { opacity: .5; }

.marketbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; margin: -4px 0 14px; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.marketbar .sum { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 14px; font-weight: 600; font-size: .88rem; cursor: pointer; min-height: 34px; border-radius: 9px; }
.seg button.on { background: var(--card-3); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }

/* ---------- Foto-Feld ---------- */
.photo-field { display: flex; align-items: center; gap: 14px; }
.photo-field .ph { width: 96px; height: 96px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 2rem; overflow: hidden; flex-shrink: 0; }
.photo-field .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo-field .ph .i3d { width: 70%; height: 70%; object-fit: contain; }

/* ---------- Kalkulation ---------- */
.price-big { font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.calc-card { position: sticky; top: 16px; }
@media (max-width: 899px) { .calc-card { position: static; order: -1; } }

/* ---------- Onboarding ---------- */
.onb { max-width: 640px; margin: 0 auto; padding-top: 16px; }
.onb .logo { width: 110px; height: 110px; display: block; margin: 0 auto 12px; border-radius: 26px; box-shadow: 0 18px 50px rgba(212, 148, 90, 0.18); }
.onb h1 { text-align: center; font-size: 2rem; }
.onb .lead { text-align: center; color: var(--ink-2); font-size: 1.02rem; }
.craft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.craft { border: 1px solid var(--line); border-radius: 18px; padding: 14px 12px; background: var(--card); text-align: center; cursor: pointer; font-weight: 600; user-select: none; color: var(--ink); text-decoration: none; transition: border-color .15s, background .15s, transform .1s; }
.craft:hover { border-color: var(--line-2); background: var(--card-2); }
.craft .i3d { width: 76px; height: 76px; display: block; margin: 0 auto 6px; }
.craft .emo { font-size: 2rem; display: block; }
.craft.on { background: var(--accent-soft); border-color: rgba(212, 148, 90, 0.55); color: var(--accent-2); }
.craft.on .tiny { color: var(--ink-2); }
.onb-nav {
  position: sticky; bottom: calc(12px + env(safe-area-inset-bottom) + var(--host-badge)); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 20px; padding: 10px 12px; border-radius: 18px; border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--card) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
}
.onb-nav .btn.primary { min-width: 130px; }
.onb-nav > .tiny { flex: 1; text-align: center; }
/* Während der Einrichtung: keine Menüleiste, damit unten nichts im Weg ist */
html.onboarding #tabbar, html.onboarding #sidebar { display: none !important; }
html.onboarding #view { padding-bottom: calc(24px + env(safe-area-inset-bottom) + var(--host-badge)); }
@media (max-width: 600px) {
  .onb .craft-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .onb .craft { padding: 10px 4px; font-size: .8rem; line-height: 1.25; }
  .onb .craft .i3d { width: 52px; height: 52px; margin-bottom: 4px; }
  .onb .logo { width: 72px; height: 72px; border-radius: 18px; }
  .onb h1 { font-size: 1.55rem; }
  .onb .lead { font-size: .95rem; }
}
.steps { display: flex; justify-content: center; gap: 6px; margin: 12px 0 20px; }
.steps i { width: 26px; height: 4px; border-radius: 4px; background: var(--card-3); }
.steps i.on { background: var(--accent); }

/* ---------- Rechnung (Druck) ---------- */
.invoice-sheet { background: #fff; color: #222; border-radius: 10px; padding: 40px 44px; max-width: 800px; margin: 0 auto; font-family: "Segoe UI", system-ui, sans-serif; font-size: 14px; box-shadow: var(--shadow-lg); }
.invoice-sheet h1 { font-size: 26px; color: #222; }
.invoice-sheet .inv-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.invoice-sheet .sender-line { font-size: 10px; color: #666; text-decoration: underline; margin-bottom: 6px; }
.invoice-sheet table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.invoice-sheet th, .invoice-sheet td { padding: 7px 6px; border-bottom: 1px solid #ccc; text-align: left; }
.invoice-sheet td.num, .invoice-sheet th.num { text-align: right; }
.invoice-sheet tr.sum td { font-weight: 700; border-top: 2px solid #222; border-bottom: 0; }
.invoice-sheet .foot { margin-top: 40px; font-size: 11px; color: #555; border-top: 1px solid #ccc; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 28px; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #222; }
  #sidebar, #tabbar, #banner, #timer-pill, #toast, .no-print, .fab { display: none !important; }
  #view { padding: 0 !important; max-width: none; }
  .invoice-sheet { border: 0; padding: 0; max-width: none; box-shadow: none; }
  .card { box-shadow: none; border-color: #ccc; background: #fff; color: #222; }
}

/* ---------- Kleinkram ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 16px; } .mb0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.check-list { display: flex; flex-direction: column; gap: 2px; }
.check-list label { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.check-list label:hover { background: var(--card-2); }
.check-list label.done span { text-decoration: line-through; color: var(--ink-3); }
.stars { display: inline-flex; gap: 2px; font-size: 1.25rem; cursor: pointer; }
.stars span { color: var(--card-3); }
.stars span.on { color: var(--warn); }
.serial { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; float: right; color: var(--ink-3); font-weight: 400; }
details[open] > summary::after { content: "–"; }
.hero-ico { width: 120px; height: 120px; display: block; }

/* Ausgeblendet bleibt ausgeblendet, auch wenn eine Klasse display setzt (z. B. .marketbar der Inventur) */
[hidden] { display: none !important; }

/* Gewinn-Rechnung (finance.js) */
.fin-group { border-bottom: 1px solid var(--line); }
.fin-group > summary { display: flex; align-items: center; gap: 10px; padding: 10px 2px; cursor: pointer; }
.fin-group > summary > b { margin-left: auto; }
.fin-group > summary::after { margin-left: 2px; width: 12px; text-align: center; }
.fin-group .calc { padding: 0 2px 10px 12px; }
.fin-group .calc .line { font-size: .88rem; }
.fin-sum { display: flex; justify-content: space-between; padding: 12px 2px 0; font-weight: 700; }

/* Tutorial (views/tutorial.js) */
.tut-kapitel { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tut-kap { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; margin: 0; }
.tut-kap:hover { border-color: var(--accent); }
.tut-step { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tut-text h3 { margin: 4px 0 6px; }
.tut-nr { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.tut-phone { justify-self: center; width: min(300px, 100%); border-radius: 26px; padding: 7px; background: #0e0f12; border: 1px solid var(--line-2, var(--line)); box-shadow: var(--shadow); }
.tut-phone img { display: block; width: 100%; height: auto; border-radius: 20px; }
@media (min-width: 900px) {
  .tut-step { grid-template-columns: 1fr 300px; align-items: center; }
  .tut-phone { justify-self: end; }
}

/* Materialbibliothek (matsymbole.js) */
.mat-sym { display: block; object-fit: contain; }
.item .thumb .mat-sym { object-fit: contain; }
.sym-field { display: flex; align-items: center; gap: 14px; }
.sym-field .ph { width: 96px; height: 96px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sym-picker input[type="search"] { width: 100%; margin: 6px 0 10px; }
.sym-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2, var(--line)); padding: 0; cursor: pointer; }
.swatch.orig { background: linear-gradient(135deg, #d9735f 50%, #ee9a82 50%); }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.sym-groups h3 { margin: 16px 0 8px; font-size: .95rem; color: var(--ink-2, var(--ink)); }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.sym-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 9px; border-radius: var(--radius-s); border: 1px solid transparent; background: var(--card-2); color: inherit; font: inherit; font-size: .74rem; line-height: 1.15; text-align: center; cursor: pointer; }
.sym-tile img { width: 56px; height: 56px; object-fit: contain; }
.sym-tile:hover { border-color: var(--line-2, var(--line)); }
.sym-tile.on { border-color: var(--accent); background: var(--accent-soft); }
