/* Noto & Gödeker – Lager-Tool */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/Montserrat-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue-900: #0a4f8a;
  --blue-800: #0b5690;
  --blue-700: #0c5d99;
  --blue-500: #0f71af;
  --blue-100: #e6f0f8;
  --blue-50: #f2f7fb;
  --orange: #f49b26;
  --orange-100: #fef1df;
  --orange-700: #a8620a;
  --ink: #1b2633;
  --ink-2: #3a4a5c;
  --muted: #627284;
  --line: #dde4ec;
  --line-2: #eef2f6;
  --bg: #f5f7fa;
  --white: #ffffff;
  --red: #b42318;
  --red-100: #fdecea;
  --green: #17784b;
  --green-100: #e5f4ec;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 40, 70, .06), 0 2px 8px rgba(16, 40, 70, .05);
  --font-head: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--blue-500); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); color: var(--blue-900); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: .98rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--blue-900); }
.brand:hover { text-decoration: none; }
.brand-mark { height: 34px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; font-family: var(--font-head); line-height: 1.1; }
.brand-text strong { font-size: 1.02rem; font-weight: 800; letter-spacing: .01em; }
.brand-text small { font-size: .72rem; font-weight: 600; color: var(--orange-700); letter-spacing: .14em; text-transform: uppercase; }
.client-pill {
  margin-left: 10px; padding: 3px 12px; border-radius: 999px;
  background: var(--blue-100); color: var(--blue-900);
  font-family: var(--font-head); font-weight: 600; font-size: .82rem;
}
.usermenu { margin-left: auto; position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--blue-50); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-900); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: .9rem;
}
.uname { font-weight: 600; color: var(--ink-2); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  min-width: 220px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 40, 70, .14);
  padding: 6px; display: flex; flex-direction: column;
}
.menu a, .menu .linklike { padding: 8px 12px; border-radius: 6px; color: var(--ink); text-align: left; font-size: .94rem; }
.menu a:hover, .menu .linklike:hover { background: var(--blue-50); text-decoration: none; }
.menu-role { padding: 6px 12px 8px; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu form { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; }

/* ---------- Navigation ---------- */
.mainnav {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 0 20px;
  background: var(--blue-900);
}
.mainnav a {
  position: relative;
  padding: 12px 14px 11px;
  color: rgba(255, 255, 255, .82);
  font-family: var(--font-head); font-weight: 600; font-size: .9rem;
  border-bottom: 3px solid transparent;
}
.mainnav a:hover { color: var(--white); text-decoration: none; background: rgba(255, 255, 255, .06); }
.mainnav a.active { color: var(--white); border-bottom-color: var(--orange); }
.mainnav .count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; background: var(--orange); color: var(--ink);
  font-size: .75rem; line-height: 19px; text-align: center; font-weight: 700;
}

/* ---------- Inhalt ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 26px 28px 48px; }
.footer { text-align: center; color: var(--muted); font-size: .78rem; padding: 0 0 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px;
}
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-3-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }

/* Abstände innerhalb von Karten */
.card > .row, .card > label, .card > .actions, .card > .field, .card > form { margin-top: 14px; }
.card > h2 + .row, .card > h2 + label, .card > h2 + p + .row, .card > p + .row { margin-top: 10px; }
.book-box > .btn, .book-box > button { margin-top: 18px; }
.card > .table-wrap + .actions { margin-top: 14px; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; color: var(--blue-900); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .note { font-size: .82rem; color: var(--muted); }
.stat.accent { border-color: var(--orange); background: linear-gradient(0deg, var(--white), var(--white)) padding-box; box-shadow: inset 4px 0 0 var(--orange), var(--shadow); }
.stat.accent .value { color: var(--orange-700); }

/* Aufgabenliste */
.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); margin-bottom: 10px;
  box-shadow: inset 4px 0 0 var(--orange);
}
.task:hover { border-color: var(--blue-500); }
.task-icon {
  width: 38px; height: 38px; border-radius: 9px; background: var(--orange-100); color: var(--orange-700);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-family: var(--font-head);
}
.task-icon.in { background: var(--blue-100); color: var(--blue-900); }
.task-title { font-weight: 700; color: var(--ink); }
.task-meta { font-size: .86rem; color: var(--muted); }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--white); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; line-height: 1.6; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2);
}
.badge-ok { background: var(--green-100); color: var(--green); }
.badge-warn { background: var(--orange-100); color: var(--orange-700); }
.badge-bad { background: var(--red-100); color: var(--red); }
.badge-blue { background: var(--blue-100); color: var(--blue-900); }
.badge-type-in { background: var(--green-100); color: var(--green); }
.badge-type-out { background: var(--blue-100); color: var(--blue-900); }
.badge-type-transfer { background: #efe9fb; color: #5b3a9e; }
.badge-type-display { background: var(--orange-100); color: var(--orange-700); }
.badge-type-shipping { background: #e9eef4; color: var(--ink-2); }
.badge-type-inventory { background: var(--red-100); color: var(--red); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
th {
  font-family: var(--font-head); font-size: .74rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody tr:hover { background: var(--blue-50); }
tr.cat-row td { background: var(--line-2); font-family: var(--font-head); font-weight: 700; color: var(--blue-900); font-size: .84rem; }
tr.neg td.stockcell, td.neg { color: var(--red); font-weight: 700; }
td.zero { color: var(--muted); }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.row-link { color: inherit; }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.hint { font-weight: 400; font-size: .8rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink);
  padding: 9px 11px; border: 1px solid #c9d3de; border-radius: var(--radius-sm); background: var(--white);
  min-width: 0; width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(15, 113, 175, .3); outline-offset: 1px; border-color: var(--blue-500);
}
textarea { min-height: 80px; resize: vertical; }
input[type=file] { font: inherit; font-weight: 400; padding: 10px; border: 1px dashed #b8c4d1; border-radius: var(--radius-sm); background: var(--blue-50); width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-family: var(--font-head); font-weight: 700; color: var(--blue-900); padding: 0 6px; font-size: .92rem; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.radio-card { position: relative; display: block !important; border: 1px solid #c9d3de; border-radius: var(--radius); padding: 12px 14px 12px 40px; cursor: pointer; background: var(--white); font-weight: 600; }
.radio-card input { position: absolute; left: 14px; top: 15px; }
.radio-card span { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: 2px; }
.radio-card:has(input:checked) { border-color: var(--blue-500); background: var(--blue-50); box-shadow: 0 0 0 1px var(--blue-500) inset; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { font-size: .8rem; min-width: 150px; }
.filters .field.wide { min-width: 260px; flex: 1; }
.inline-form { display: inline; margin: 0; }
.qty-input { width: 100px !important; text-align: right; }
.code-input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-family: var(--font-head); }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid #c3cfdb; background: var(--white); color: var(--blue-900);
  font-family: var(--font-head); font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--blue-50); text-decoration: none; }
.btn-primary { background: var(--blue-900); border-color: var(--blue-900); color: var(--white); }
.btn-primary:hover { background: var(--blue-700); }
.btn-accent { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.btn-accent:hover { background: #e58b14; }
.btn-danger { color: var(--red); border-color: #e7b7b2; }
.btn-danger:hover { background: var(--red-100); }
.btn-small { padding: 5px 10px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Meldungen ---------- */
.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; font-size: .92rem; }
.flash-success { background: var(--green-100); border-color: #b5dec7; color: #0f5233; }
.flash-error { background: var(--red-100); border-color: #f2c3be; color: #7a1a12; }
.flash-info { background: var(--blue-50); border-color: #c5dbec; color: var(--blue-900); }
.flash-warn { background: var(--orange-100); border-color: #f6cf98; color: #6e4005; }

/* ---------- Auftragsdetail ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: .86rem; }
.facts dd { margin: 0; font-weight: 600; }
.doc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.doc-list a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); }
.doc-list a:hover { border-color: var(--blue-500); text-decoration: none; background: var(--blue-50); }
.doc-kind { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--blue-900); background: var(--blue-100); padding: 2px 8px; border-radius: 4px; }
.preview { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--line-2); }
.preview-img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); display: block; }
.items td { vertical-align: top; }
.items .raw { font-size: .86rem; color: var(--ink-2); max-width: 280px; }
.items .product-input { min-width: 300px; }
.sugs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sug { border: 1px dashed var(--blue-500); background: var(--blue-50); color: var(--blue-900); border-radius: 999px; padding: 2px 10px; font-size: .78rem; cursor: pointer; font-weight: 600; }
.sug:hover { background: var(--blue-100); }
.match { font-size: .76rem; margin-top: 4px; display: block; }
.match.ok { color: var(--green); }
.match.check { color: var(--orange-700); font-weight: 700; }
.book-box { border: 2px solid var(--blue-900); }
.danger-zone { border-color: #f0d0cc; }

/* ---------- Anmeldung ---------- */
body.bare { background: linear-gradient(160deg, var(--blue-50) 0%, var(--bg) 55%); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 460px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px rgba(16, 40, 70, .1); padding: 30px 30px 24px; }
.auth-logo { display: block; width: 210px; height: auto; margin: 0 auto 22px; }
.auth-title { text-align: center; font-size: 1.25rem; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; letter-spacing: .06em; background: var(--blue-50); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 6px 0; word-break: break-all; }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; font-size: .86rem; columns: 2; }
.checklist .ok { color: var(--green); }
.checklist .bad { color: var(--red); font-weight: 700; }
.error-page { max-width: 640px; margin: 80px auto; padding: 24px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.error-page pre { white-space: pre-wrap; font-size: .75rem; }

/* ---------- Abrechnung ---------- */
.month-total { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--blue-900); }
.month-card { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center; }
.breakdown { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-2); font-size: .92rem; }
.breakdown strong { color: var(--ink); }

/* ---------- Druck (Inventurliste) ---------- */
.print-only { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.sheet-logo { width: 190px; height: auto; }
.sheet td.count-cell { width: 120px; border-bottom: 1px solid #9aa7b5; }
.sheet td.note-cell { width: 160px; border-bottom: 1px solid #9aa7b5; }
.sign-line { margin-top: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; font-size: .85rem; color: var(--muted); }
.sign-line div { border-top: 1px solid #9aa7b5; padding-top: 6px; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; font-size: 10.5pt; }
  .topbar, .mainnav, .footer, .no-print, .flash { display: none !important; }
  .print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; }
  th, td { padding: 5px 6px; }
  tbody tr:hover { background: none; }
  tr { page-break-inside: avoid; }
  tr.cat-row td { background: #eef2f6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; }
}

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3-1 { grid-template-columns: 1fr; }
  .month-card { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand-text small, .uname, .client-pill { display: none; }
  .mainnav { padding: 0 8px; overflow-x: auto; flex-wrap: nowrap; }
  .mainnav a { white-space: nowrap; padding: 11px 10px; }
  .container { padding: 18px 16px 40px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .task { grid-template-columns: auto 1fr; }
  .task > :last-child { grid-column: 1 / -1; }
  .checklist { columns: 1; }
  .auth-card { padding: 24px 18px; }
}
