/* Profi-Merch Lager — Oberfläche
   Palette: Recyclingkarton als Grund, zwei Spotfarben wie im Siebdruck. */

:root {
  --ground:  #edefea;
  --card:    #f7f8f5;
  --ink:     #171b18;
  --ink-mid: #5c645e;
  --line:    #d5d8d1;
  --line-2:  #c2c7bd;
  --spot:    #0a6e86;   /* Prozess-Cyan: alles Interaktive */
  --spot-2:  #a81e63;   /* Magenta: leer / kritisch */
  --amber:   #b4541a;   /* unter Mindestbestand */
  --green:   #2e6b3e;

  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r: 3px;
  --shadow: 0 1px 0 var(--line-2), 0 8px 24px -20px rgba(23, 27, 24, .6);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

a { color: var(--spot); }

.mono, input.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  margin: 0 0 .5rem;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

h1, h2, h3 { margin: 0; letter-spacing: -.015em; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; }

/* ------------------------------------------------------------------ Kopfleiste */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: .7rem 1.25rem;
  background: var(--ink);
  color: var(--ground);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }

.brand__mark {
  width: 22px; height: 22px; border-radius: 2px;
  background:
    linear-gradient(var(--spot) 0 0) 0 2px / 100% 5px no-repeat,
    linear-gradient(var(--ground) 0 0) 0 9px / 100% 5px no-repeat,
    linear-gradient(var(--spot-2) 0 0) 0 16px / 62% 5px no-repeat;
}

.brand__text { font-weight: 680; letter-spacing: -.01em; }

.brand__sub {
  display: block;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  opacity: .6;
  margin-top: -2px;
}

.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }

.nav a {
  padding: .35rem .7rem;
  border-radius: var(--r);
  color: rgba(237, 239, 234, .72);
  text-decoration: none;
  font-size: .875rem;
}

.nav a:hover { background: rgba(237, 239, 234, .1); color: var(--ground); }
.nav a[aria-current="page"] { background: var(--spot); color: #fff; }

.account { display: flex; align-items: center; gap: .75rem; }
.account__name { font-size: .8rem; color: rgba(237, 239, 234, .7); }

/* ---------------------------------------------------------------------- Layout */

.view { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.1rem;
}

.card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .85rem;
}

.grid { display: grid; gap: .9rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------- Formulare, Buttons */

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; }

.field label, .lbl {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

input[type="text"], input[type="password"], input[type="number"],
input[type="search"], input[type="color"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: .45rem .6rem;
  width: 100%;
}

textarea { min-height: 4.5rem; resize: vertical; }
input[type="color"] { padding: 2px; height: 2.3rem; }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--spot);
  outline-offset: 2px;
}

.btn {
  font: inherit;
  font-size: .875rem;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  border-radius: var(--r);
  padding: .45rem .9rem;
  cursor: pointer;
}

.btn:hover { border-color: var(--ink-mid); }
.btn--primary { background: var(--spot); border-color: var(--spot); color: #fff; font-weight: 600; }
.btn--primary:hover { background: #085a6e; border-color: #085a6e; }
.btn--danger { color: var(--spot-2); border-color: #e0b7cb; }
.btn--ghost { background: transparent; border-color: rgba(237, 239, 234, .3); color: var(--ground); }
.btn--ghost:hover { background: rgba(237, 239, 234, .12); border-color: rgba(237, 239, 234, .5); }
.btn--wide { width: 100%; padding: .6rem; }
.btn--small { padding: .2rem .5rem; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* -------------------------------------------------------------------- Tabellen */

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }

thead th {
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mid);
  border-bottom: 1px solid var(--line-2);
}

tbody tr:hover { background: rgba(10, 110, 134, .05); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------- Signatur: Bestandsraster */

.matrix { border-collapse: separate; border-spacing: 0; min-width: max-content; }

.matrix th, .matrix td { border: 1px solid var(--line); padding: 0; }

.matrix thead th {
  background: var(--ground);
  padding: .45rem .5rem;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: center;
  min-width: 4.2rem;
}

.matrix thead th:first-child, .matrix tbody th {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 2;
  min-width: 11rem;
}

.matrix thead th:first-child { background: var(--ground); z-index: 3; }

.matrix tbody th { padding: .4rem .55rem; font-weight: 500; }

.swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(23, 27, 24, .35);
  vertical-align: -2px;
  margin-right: .5rem;
}

.cell input {
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding: .45rem .3rem;
  width: 100%;
}

.cell input:focus-visible { outline-offset: -2px; background: #fff; }
.cell--empty { background: rgba(168, 30, 99, .07); }
.cell--empty input { color: var(--spot-2); }

/* Raster-Schraffur wie ein Siebdruck-Halbton: Bestand unter Mindestmenge. */
.cell--low {
  background-image: repeating-linear-gradient(
    -45deg, rgba(180, 84, 26, .16) 0 3px, transparent 3px 7px);
}
.cell--low input { color: var(--amber); font-weight: 600; }
.cell--none { background: repeating-linear-gradient(-45deg, var(--ground) 0 4px, var(--card) 4px 8px); }
.cell--changed { box-shadow: inset 0 0 0 2px var(--spot); }

.matrix tfoot td, .matrix tfoot th {
  background: var(--ground);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: .4rem;
  font-size: .82rem;
}

.matrix tfoot th { text-align: left; padding-left: .55rem; }

.matrix-bar {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line);
}

.matrix-bar .grow { flex: 1; min-width: 12rem; }

/* --------------------------------------------------------------------- Badges */

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .12rem .45rem;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.badge--low { color: var(--amber); }
.badge--ok { color: var(--green); }
.badge--muted { color: var(--ink-mid); }

.stat { display: flex; gap: 2rem; flex-wrap: wrap; }
.stat__v { font-family: var(--mono); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat__k { font-family: var(--mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mid); }

.muted { color: var(--ink-mid); }
.small { font-size: .82rem; }

.empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--ink-mid);
}

.msg { padding: .55rem .7rem; border-radius: var(--r); font-size: .875rem; margin: 0 0 .8rem; }
.msg--error { background: rgba(168, 30, 99, .1); color: #7d1449; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: .2rem .6rem; font-size: .82rem; background: #fff; cursor: pointer;
}

.chip input { width: auto; margin: 0; accent-color: var(--spot); }
.chip:has(input:checked) { border-color: var(--spot); background: rgba(10, 110, 134, .09); }

/* --------------------------------------------------------------- Anmeldeseite */

.gate { min-height: 100dvh; display: grid; place-content: center; gap: 1rem; padding: 1.5rem; }

.gate__card {
  width: min(400px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
  border-radius: var(--r);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.gate__title { font-size: 1.9rem; margin-bottom: .3rem; }
.gate__lead { margin: 0 0 1.4rem; color: var(--ink-mid); font-size: .9rem; }
.gate__foot { text-align: center; font-size: .75rem; color: var(--ink-mid); margin: 0; }

/* --------------------------------------------------------------------- Hinweis */

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: var(--ground);
  padding: .6rem 1.1rem; border-radius: var(--r);
  font-size: .875rem; z-index: 50; box-shadow: var(--shadow);
}

.toast--error { background: var(--spot-2); }

@media (max-width: 620px) {
  .topbar { gap: .75rem; }
  .account__name { display: none; }
  .view { padding: 1.25rem .9rem 3rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
}

/* ------------------------------------------------------- Bearbeitungssperre */

.lockbar {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--spot);
  border-radius: var(--r);
  background: var(--card);
  padding: .6rem .85rem;
  margin: 0 0 1.1rem;
  font-size: .875rem;
}

.lockbar .grow { flex: 1; min-width: 14rem; }
.lockbar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--spot); flex: none; }
.lockbar--other { border-left-color: var(--amber); background: rgba(180, 84, 26, .07); }
.lockbar--other .lockbar__dot { background: var(--amber); }

@media (prefers-reduced-motion: no-preference) {
  .lockbar--mine .lockbar__dot { animation: puls 2.4s ease-in-out infinite; }
  @keyframes puls { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
}
