/* Inventur Tool – Farben und Schriften nach design.md (Frank Wingerath) */
@font-face { font-family: "Figtree"; font-weight: 600; font-display: swap; src: url("fonts/figtree-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 700; font-display: swap; src: url("fonts/figtree-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }

:root {
  --brand-50: #f0f7f8; --brand-100: #d9eaec; --brand-200: #b3d4d8; --brand-500: #2e717b;
  --brand-600: #1e5d66; --brand-700: #194d56; --brand-800: #163f47; --brand-900: #0e2c33; --brand-950: #081c21;
  --accent-400: #f5b342; --accent-500: #e8a132; --accent-600: #c78220; --accent-700: #9c6519;
  --ink-50: #fafafa; --ink-100: #f4f4f5; --ink-200: #e4e4e7; --ink-300: #d4d4d8;
  --ink-500: #71717a; --ink-600: #52525b; --ink-800: #27272a; --ink-900: #18181b;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  --font-head: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--ink-50); color: var(--ink-800);
  font: 400 1rem/1.55 var(--font-body);
}
h1, h2, h3, .h3 { font-family: var(--font-head); color: var(--ink-900); line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 600; }
.h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; }
a { color: var(--brand-600); }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-600); }
.small { font-size: .875rem; }
.eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-600); font-weight: 600; }
.mt { margin-top: .75rem; }
[hidden] { display: none !important; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--brand-900); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem max(16px, env(safe-area-inset-left)); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; min-width: 0; }
.brand img { background: #fff; border-radius: 9999px; padding: 2px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.brand-tenant { font-size: .8rem; color: var(--brand-200); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mainnav { display: flex; gap: .25rem; }
.mainnav a { color: var(--brand-100); text-decoration: none; padding: .45rem .7rem; border-radius: 6px; font-weight: 500; font-size: .95rem; }
.mainnav a.active, .mainnav a:hover { background: var(--brand-700); color: #fff; }

@media (max-width: 640px) {
  body { padding-bottom: 64px; }
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: #fff; border-top: 1px solid var(--ink-200);
    padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .mainnav a { color: var(--ink-600); flex: 1; text-align: center; padding: .6rem .25rem; }
  .mainnav a.active, .mainnav a:hover { background: var(--brand-50); color: var(--brand-700); }
}

.container { width: 100%; max-width: 56rem; margin: 0 auto; padding: 1.25rem 16px 2rem; flex: 1; }
.footer { text-align: center; font-size: .8rem; color: var(--ink-500); padding: 1rem 16px 1.5rem; }
.footer a { color: var(--ink-600); }

/* Bausteine */
.card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-card); padding: 1rem; margin-bottom: 1rem; }
.stack > * + * { margin-top: .75rem; }
.stack { display: block; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between, .between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.row.wrap > label.grow { flex: 1 1 9rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

label { display: block; font-size: .875rem; font-weight: 500; color: var(--ink-800); }
label > input, label > select, label > .row { margin-top: .3rem; }
input, select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink-900);
  padding: .65rem .75rem; border: 1px solid var(--ink-300); border-radius: 8px; background: #fff;
  min-height: 44px;
}
input:focus, select:focus { outline: 2px solid var(--brand-500); outline-offset: 1px; border-color: var(--brand-500); }
.row > input, .row > select { width: auto; }
.row > input.grow, .row > select.grow { width: 100%; }
label.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; white-space: nowrap; }
label.check input { width: auto; min-height: 0; }
.qty-input { font-size: 1.6rem; font-weight: 600; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 500 1rem var(--font-head); padding: .7rem 1.2rem; min-height: 44px;
  border-radius: 6px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .2s, box-shadow .2s; white-space: nowrap;
}
.btn-sm { padding: .45rem .8rem; min-height: 36px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); box-shadow: var(--shadow-card); }
.btn-accent { background: var(--accent-500); color: var(--brand-900); }
.btn-accent:hover { background: var(--accent-400); box-shadow: var(--shadow-card); }
.btn-secondary { background: #fff; color: var(--brand-700); border-color: var(--brand-200); }
.btn-secondary:hover { background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--brand-700); }
.btn-ghost:hover { background: var(--brand-50); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-link { background: none; border: 0; padding: .25rem; font: inherit; font-size: .9rem; color: var(--brand-600); cursor: pointer; text-decoration: underline; }
.danger { color: var(--accent-700); }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .2rem .6rem; border-radius: 9999px; background: var(--brand-100); color: var(--brand-800); }
.badge-closed { background: var(--ink-200); color: var(--ink-600); }

.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid var(--brand-600); background: var(--brand-50); color: var(--brand-900); }
.flash-error { border-left-color: var(--accent-700); background: #fff; color: var(--accent-700); box-shadow: var(--shadow-card); }
.hint { background: var(--brand-50); border-radius: 8px; padding: .75rem 1rem; font-size: .9rem; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; background: #fff; border-radius: 16px; box-shadow: var(--shadow-card); overflow: hidden; }
.list > li { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-top: 1px solid var(--ink-100); }
.list > li:first-child { border-top: 0; }
.list > li.empty { display: block; padding: 1.25rem 1rem; }
.list > li:has(> .row-link) { padding: 0; }
.row-link { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; width: 100%; color: inherit; text-decoration: none; }
a.row-link:hover { background: var(--brand-50); }
.qty { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--brand-700); text-align: right; white-space: nowrap; }
.qty.zero { color: var(--ink-300); }
.qty .unit { font-family: var(--font-body); font-weight: 400; font-size: .8rem; color: var(--ink-500); }
.count-row { align-items: flex-start !important; flex-wrap: wrap; }
.count-row details.edit { text-align: right; }
.count-row details[open] { flex-basis: 100%; text-align: left; }
details > summary { cursor: pointer; font-weight: 500; }
details > summary.row { list-style: none; }
details > summary.row::-webkit-details-marker { display: none; }
.menu-list .row-link { font-weight: 500; }

.total-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.total { font-family: var(--font-head); font-weight: 700; font-size: 1.75rem; color: var(--brand-700); }
.filters input[type=search] { margin-bottom: .5rem; }
.filters select { width: auto; flex: 1 1 10rem; }

/* Scanner */
.scanner-card > * + * { margin-top: .75rem; }
.reader { width: 100%; border-radius: 12px; overflow: hidden; background: var(--brand-950); }
.reader video { width: 100% !important; display: block; }
#manual-form input { width: 100%; }
.assign { border-top: 1px solid var(--ink-200); padding-top: .9rem; }
.assign input { margin-top: .4rem; }
.assign-results { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 18rem; overflow-y: auto; }
.assign-results li + li { border-top: 1px solid var(--ink-100); }
.assign-item { display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left;
  background: none; border: 0; padding: .6rem .25rem; font: inherit; color: inherit; cursor: pointer; }
.assign-item:hover { background: var(--brand-50); }
.assign-text { display: flex; flex-direction: column; }

/* Artikelbilder */
.thumb { width: 48px; height: 48px; flex: none; border-radius: 8px; object-fit: cover; background: #fff; border: 1px solid var(--ink-200); }
.thumb-empty { display: inline-block; background: var(--ink-100); border-color: var(--ink-100); }
.article-image { width: 96px; height: 96px; flex: none; border-radius: 12px; object-fit: cover; background: #fff; border: 1px solid var(--ink-200); }
.count-head { align-items: flex-start; }
.mb { margin-bottom: 1rem; }

/* Anmeldung */
.login { max-width: 24rem; margin: 2rem auto 0; text-align: center; }
.login form { text-align: left; margin-top: 1.5rem; }
.login-logo { border-radius: 9999px; }

/* Rückmeldung */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0;
  max-width: calc(100% - 32px); padding: .75rem 1rem; border-radius: 8px; z-index: 50;
  background: var(--brand-900); color: #fff; box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  transition: opacity .2s, transform .2s; pointer-events: none; font-weight: 500;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--accent-500); color: var(--brand-900); }
@media (min-width: 641px) { .toast { bottom: 24px; } }
