@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #0b0b0b;
  --ink: #f4f2ee;
  --dim: #8a8782;
  --line: #2a2928;
  --wash: #161615;
  --field: #121211;
  --laser: #ff3b1f;
  --ok: #3ddc84;
  --warn: #ffb020;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: 16px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f2ee; --ink: #0b0b0b; --dim: #77736d; --line: #d9d5ce; --wash: #e9e6e0; --field: #ffffff;
    --ok: #0f8a4a; --warn: #a86400; color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--laser); color: #fff; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--laser); outline-offset: 3px; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.mono { font: 400 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.dim { color: var(--dim); }
.laser { color: var(--laser); }

#app { min-height: 100vh; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--pad); }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 52px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand i { width: 10px; height: 10px; border: 1.5px solid currentColor; position: relative; }
.brand i::after { content: ""; position: absolute; left: -5px; right: -5px; top: 3px; height: 1.5px; background: var(--laser); }
.top nav { display: flex; gap: 18px; }
.top nav a[aria-current="page"] { color: var(--laser); }
@media (max-width: 720px) { .top nav { display: none; } }

/* Search */
.hero { padding: 28px 0 8px; }
.hero h1 { margin: 0 0 4px; font: 800 clamp(40px, 9vw, 88px)/.9 var(--sans); letter-spacing: -.035em; }
.hero p { margin: 10px 0 0; }
.search { position: relative; margin: 22px 0 14px; }
.search input {
  width: 100%; height: 60px; padding: 0 52px 0 0; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0;
  background: transparent; color: var(--ink); font: 600 26px/1 var(--sans); letter-spacing: -.01em; outline: none;
}
.search input::placeholder { color: var(--dim); font-weight: 400; }
.search input:focus { border-color: var(--laser); }
.search .clear { position: absolute; right: 0; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 22px; color: var(--dim); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.chip b { font-weight: 400; color: var(--dim); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] b { color: inherit; opacity: .6; }

/* Item list */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row:hover .name { color: var(--laser); }
.thumb { width: 64px; height: 64px; background: var(--wash); object-fit: cover; }
.thumb.empty { display: grid; place-items: center; color: var(--dim); }
.thumb.empty svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.row .name { font: 650 17px/1.2 var(--sans); letter-spacing: -.01em; overflow-wrap: anywhere; }
.row .meta { margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .qty { text-align: right; }
.row .qty strong { display: block; font: 750 22px/1 var(--sans); letter-spacing: -.02em; }
.row .qty span { display: block; margin-top: 4px; max-width: 92px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 64px 0; text-align: center; }
.empty-state h2 { font: 750 28px/1.1 var(--sans); margin: 0 0 10px; letter-spacing: -.02em; }
.more { display: block; width: 100%; padding: 16px 0; }

/* Bottom dock */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px var(--pad) calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  display: flex; justify-content: center; align-items: center; gap: 22px; pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock a.side { width: 64px; text-align: center; }
.dock a.side[aria-current="page"] { color: var(--laser); }
.shutter {
  width: 68px; height: 68px; border-radius: 50%; background: var(--laser); color: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--laser);
}
.shutter svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 1.6; fill: none; }
.shutter:active { transform: scale(.96); }

/* Buttons and fields */
.btn {
  height: 46px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid var(--ink); font: 600 15px/1 var(--sans); white-space: nowrap;
}
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.laser { background: var(--laser); border-color: var(--laser); color: #fff; }
.btn.ghost { border-color: var(--line); }
.btn.danger { border-color: var(--laser); color: var(--laser); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.block { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; margin-bottom: 6px; }
.f input, .f select, .f textarea, .spec input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 0;
  background: var(--field); color: var(--ink); font: 400 16px/1.35 var(--sans); outline: none;
}
.f textarea { min-height: 88px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus, .spec input:focus { border-color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 > :first-child { grid-column: 1 / -1; } }
.specs { margin-bottom: 14px; }
.spec { display: grid; grid-template-columns: 1fr 1.3fr 36px; gap: 6px; margin-bottom: 6px; }
.spec button { color: var(--dim); font-size: 20px; }
.add-spec { padding: 8px 0; }

/* Page sections */
.page { padding: 26px 0 0; }
.page h1 { margin: 0 0 6px; font: 800 clamp(34px, 7vw, 60px)/.95 var(--sans); letter-spacing: -.035em; }
.page .lede { margin: 10px 0 24px; max-width: 60ch; color: var(--dim); }
.back { display: inline-block; margin-bottom: 18px; }
.section { border-top: 1px solid var(--line); padding: 20px 0 8px; margin-top: 18px; }
.section > .mono:first-child { margin-bottom: 14px; }

/* Capture */
.drop {
  display: grid; place-items: center; gap: 14px; text-align: center; padding: 40px 16px;
  border: 1px dashed var(--line); min-height: 240px;
}
.drop svg { width: 46px; height: 46px; stroke: var(--laser); stroke-width: 1.3; fill: none; }
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 16px; }
.strip figure { position: relative; margin: 0; flex: none; }
.strip img { width: 96px; height: 96px; object-fit: cover; background: var(--wash); }
.strip button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: 15px; line-height: 1; }

.scan { position: relative; overflow: hidden; background: var(--wash); aspect-ratio: 4 / 3; max-height: 60vh; }
.scan img { width: 100%; height: 100%; object-fit: cover; opacity: .75; filter: grayscale(.4); }
.scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--laser);
  box-shadow: 0 0 14px 3px rgba(255, 59, 31, .65); animation: scan 1.8s ease-in-out infinite alternate;
}
.scan .mono { position: absolute; left: 12px; bottom: 12px; background: var(--bg); padding: 6px 8px; }
@keyframes scan { from { top: 0; } to { top: calc(100% - 2px); } }
@media (prefers-reduced-motion: reduce) { .scan::after { animation: none; top: 50%; } }

.card { border: 1px solid var(--line); padding: 16px; margin-bottom: 14px; }
.card.saved { opacity: .5; }
.card header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.card header strong { font: 700 20px/1.15 var(--sans); letter-spacing: -.01em; }
.conf-hoch { color: var(--ok); } .conf-mittel { color: var(--warn); } .conf-niedrig { color: var(--laser); }
.remark { border-left: 2px solid var(--laser); padding: 4px 0 4px 12px; margin: 0 0 18px; }

/* Item detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; gap: 20px; } }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--wash); }
.gallery .small { display: flex; gap: 6px; margin-top: 6px; }
.gallery .small img { width: 64px; height: 64px; cursor: pointer; }
.detail h1 { margin: 6px 0 8px; font: 800 clamp(30px, 5vw, 48px)/1 var(--sans); letter-spacing: -.03em; overflow-wrap: anywhere; }
.counter { display: flex; align-items: center; gap: 0; margin: 20px 0; border: 1px solid var(--line); width: max-content; }
.counter button { width: 52px; height: 52px; font-size: 24px; }
.counter output { min-width: 84px; text-align: center; font: 750 28px/1 var(--sans); }
.counter small { display: block; margin-top: 4px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 18px 0; }
dl.facts dt { padding-top: 2px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.tags a { border: 1px solid var(--line); padding: 4px 8px; }

/* Project check */
.check-line { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.check-line .st { padding-top: 3px; }
.st-vorhanden { color: var(--ok); } .st-teilweise, .st-alternative { color: var(--warn); } .st-fehlt { color: var(--laser); }
.check-line strong { display: block; font-weight: 650; }
.check-line .links { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.check-line .links a { text-decoration: underline; text-underline-offset: 2px; }
.summary { font: 600 20px/1.35 var(--sans); letter-spacing: -.01em; margin: 0 0 12px; max-width: 60ch; }

/* Settings */
.code {
  font: 400 13px/1.5 var(--mono); background: var(--field); border: 1px solid var(--line); padding: 12px;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 8px 0;
}
.cat-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-row input { min-height: 40px; padding: 8px 10px; border: 1px solid transparent; background: transparent; color: var(--ink); font: 500 16px var(--sans); width: 100%; }
.cat-row input:focus { border-color: var(--line); background: var(--field); outline: none; }
.cat-row button { padding: 8px; }

/* Login */
.login { min-height: 100vh; display: grid; align-content: center; padding: 32px var(--pad); max-width: 560px; margin: 0 auto; }
.login h1 { font: 800 clamp(56px, 16vw, 112px)/.85 var(--sans); letter-spacing: -.045em; margin: 22px 0 18px; }
.login p { color: var(--dim); max-width: 38ch; margin: 0 0 28px; }
.login .err { color: var(--laser); margin-bottom: 18px; }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 16px; font: 600 14px/1.2 var(--sans);
  opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--laser); color: #fff; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
