:root {
  --orange: #f36d00; --orange-dunkel: #c75900; --orange-hell: #fff3e8;
  --text: #1f2328; --grau: #59636e; --linie: #e4e7eb; --flaeche: #f6f7f9; --weiss: #fff;
  --gruen: #1a7f37; --gelb: #9a6700; --rot: #cf222e; --blau: #0969da;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
  background: var(--flaeche); }
a { color: var(--orange-dunkel); }
.kopf { background: var(--weiss); border-bottom: 1px solid var(--linie); }
.kopf-innen { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px;
  min-height: 60px; flex-wrap: wrap; }
.marke { font-weight: 800; font-size: 20px; color: var(--orange); text-decoration: none; letter-spacing: -.3px; }
.marke small { color: var(--grau); font-weight: 500; font-size: 12px; margin-left: 4px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; padding: 18px 10px; border-bottom: 3px solid transparent; }
.nav a.aktiv, .nav a:hover { border-bottom-color: var(--orange); color: var(--orange-dunkel); }
.werkzeuge { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--grau); }
.werkzeuge select, .werkzeuge button { font: inherit; border: 1px solid var(--linie); border-radius: 6px;
  background: var(--weiss); padding: 4px 8px; cursor: pointer; }
.ansicht { background: #1f2328; color: #fff; font-size: 14px; }
.ansicht .kopf-innen { min-height: 44px; justify-content: space-between; }
.ansicht button { font: inherit; background: var(--orange); color: #fff; border: 0; border-radius: 6px; padding: 4px 12px;
  cursor: pointer; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 24px; margin: 0 0 4px; }
.unter { color: var(--grau); margin: 0 0 20px; }
.karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; padding: 16px 18px; }
.karte .titel { color: var(--grau); font-size: 13px; }
.karte .wert { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.karte .zusatz { color: var(--grau); font-size: 13px; }
.box { background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; padding: 18px; margin-bottom: 20px;
  overflow-x: auto; }
.box h2 { font-size: 17px; margin: 0 0 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
th { font-size: 13px; color: var(--grau); font-weight: 600; background: var(--flaeche); }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
tr.summe td { font-weight: 700; border-top: 2px solid var(--text); }
.status { font-weight: 600; font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--flaeche); }
.status.geprueft { color: var(--gruen); background: #e9f7ee; }
.status.bezahlt { color: var(--blau); background: #e8f1fd; }
.status.entwurf { color: var(--gelb); background: #fff6db; }
.filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filter label { font-size: 13px; color: var(--grau); display: grid; gap: 2px; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #c9ced4; border-radius: 6px; background: var(--weiss); }
.knopf { font: inherit; font-weight: 600; background: var(--orange); color: #fff; border: 0; border-radius: 6px;
  padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; }
.knopf:hover { background: var(--orange-dunkel); }
.knopf.zweit { background: var(--weiss); color: var(--text); border: 1px solid var(--linie); }
.leer { color: var(--grau); padding: 24px 0; text-align: center; }
.posten td:first-child { white-space: normal; }
.minus { color: var(--rot); }
/* Anmeldung */
.anmeldung { max-width: 420px; margin: 48px auto; }
.anmeldung .box { padding: 28px; }
.anmeldung form p { margin: 0 0 14px; }
.anmeldung label { display: block; font-size: 13px; color: var(--grau); margin-bottom: 3px; }
.anmeldung input { width: 100%; }
.fehler { background: #ffebe9; color: var(--rot); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }
.hinweis { background: var(--orange-hell); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.qr { text-align: center; margin: 8px 0 12px; }
.schluessel { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; text-align: center;
  color: var(--grau); }
.codes { columns: 2; font-family: ui-monospace, monospace; font-size: 15px; padding-left: 18px; }
.meldungen { list-style: none; padding: 0; margin: 0 0 16px; }
.meldungen li { padding: 10px 12px; border-radius: 6px; background: var(--orange-hell); }
@media (max-width: 640px) {
  /* Kopf: Marke und Werkzeuge in einer Zeile, Menü darunter in einer seitlich wischbaren Zeile */
  .kopf-innen { gap: 6px 12px; padding-top: 8px; min-height: 0; }
  .werkzeuge { margin-left: auto; gap: 8px; }
  .werkzeuge span { display: none; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px;
    padding: 0 8px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 10px 10px; white-space: nowrap; }
  main { padding-top: 16px; }
  .karten { grid-template-columns: 1fr 1fr; gap: 10px; }
  .karte { padding: 12px 14px; }
  .karte .wert { font-size: 20px; }
  .box { padding: 14px; }
  /* Tabellen mit Kopfzeile als Karten (portal.js setzt die Spaltentitel) */
  table.liste, table.liste tbody, table.liste tr, table.liste td { display: block; width: 100%; }
  table.liste tr.kopfzeile { display: none; }
  table.liste tr { border: 1px solid var(--linie); border-radius: 8px; margin-bottom: 10px; padding: 4px 0; }
  table.liste td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0;
    padding: 5px 12px; white-space: normal; text-align: right; }
  table.liste td::before { content: attr(data-label); color: var(--grau); font-size: 13px; text-align: left;
    flex-shrink: 0; }
  table.liste td:not([data-label])::before { content: none; }
  table.liste td:first-child { font-weight: 600; }
  table.liste td:empty { display: none; }
  table.liste tr.frei { display: flex; justify-content: space-between; flex-wrap: wrap; border: 0; border-radius: 0;
    margin: 0; padding: 2px 0; }
  table.liste tr.frei td { width: auto; display: block; padding: 4px 12px; }
  table.liste tr.summe td { border-top: 0; }
  .menge { width: 120px; }
}
@media print {
  .kopf, .filter, .nicht-drucken { display: none; }
  body { background: #fff; }
  .box, .karte { border: 0; }
}
.status.neu { color: var(--rot); background: #ffebe9; }
.status.bestaetigt { color: var(--gelb); background: #fff6db; }
.status.vorbereitet { color: var(--blau); background: #e8f1fd; }
.status.geliefert { color: var(--gruen); background: #e9f7ee; }
.status.storniert { color: var(--grau); }
.menge { width: 110px; text-align: right; }
.zeile-knoepfe { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.bestellform textarea { font: inherit; width: 100%; max-width: 560px; padding: 8px 10px; border: 1px solid #c9ced4;
  border-radius: 6px; }
.status.offen { color: var(--rot); background: #ffebe9; }
.status.verrechnet { color: var(--gruen); background: #e9f7ee; }

/* Fusszeile mit Datenschutz und Impressum */
.fuss { max-width: 1100px; margin: 24px auto 32px; padding: 0 16px; font-size: 13px; color: var(--grau); text-align: center; }
.fuss a { color: var(--grau); }
.rechtstext h2 { font-size: 17px; margin-top: 22px; }
.rechtstext p, .rechtstext li { line-height: 1.55; }

/* Logo */
.marke { display: inline-flex; align-items: center; gap: 6px; }
.marke img { height: 40px; width: auto; display: block; }
.anmelde-logo { display: block; margin: 0 auto 12px; height: 110px; width: auto; }

/* Kopf auf breiten Bildschirmen: oben Logo und Werkzeuge, darunter das ganze Menü (8 Punkte passen sonst nicht) */
@media (min-width: 641px) {
  .kopf-innen { gap: 0 24px; padding-top: 10px; }
  .werkzeuge { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; margin-left: -10px; }
  .nav a { padding: 12px 10px 13px; }
  .kopf-innen > .nav:empty { display: none; }
}
