/* Buchbestellung – Stile (Montserrat, lokal eingebunden) */
@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/Montserrat-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --grau: #7a7a7a;
  --text: #2b2b2b;
  --text-leise: #6b6b6b;
  --linie: #e2e2e2;
  --hinter: #f4f4f2;
  --flaeche: #ffffff;
  --akzent: #3d6b8f;
  --akzent-dunkel: #2c5272;
  --ok: #2e7d4f;     --ok-hell: #e3f3e9;
  --offen: #b26a00;  --offen-hell: #fff1dc;
  --fehler: #b3261e; --fehler-hell: #fbe4e2;
  --info: #3d6b8f;   --info-hell: #e4eef6;
  --radius: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Montserrat', Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--hinter);
}
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 .75rem; }
a { color: var(--akzent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
.hinweis { color: var(--text-leise); font-size: .9rem; }

/* Kopfzeile */
.topbar {
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .6rem 1rem;
}
.marke { font-weight: 600; color: var(--grau); text-decoration: none; letter-spacing: .3px; }
.topbar nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.topbar nav a, .topbar nav .spaeter, .topbar nav .link { display: inline-block; padding: .35rem .1rem; text-decoration: none; color: var(--text); font-size: .95rem; }
.topbar nav a.aktiv { color: var(--akzent); font-weight: 600; border-bottom: 2px solid var(--akzent); }
.topbar nav .spaeter { color: #b5b5b5; cursor: default; }
.topbar nav form { margin: 0; }
.nav-toggle { display: none; margin-left: auto; }

.inhalt { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

/* Karten und Formulare */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.karte.schmal { max-width: 440px; margin: 2rem auto; }
label { display: block; margin-bottom: .9rem; font-size: .9rem; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  font: inherit; font-weight: 400; color: var(--text);
  padding: .6rem .7rem; border: 1px solid #c9c9c9; border-radius: 6px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: 1px; border-color: var(--akzent); }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 .5rem 0 0; transform: scale(1.2); }
label.check { display: flex; align-items: flex-start; gap: .25rem; font-weight: 400; }
label.check input { margin-top: .3rem; }
.zeile { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.zeile > label { flex: 1 1 180px; }
.zeile > label.schmal { flex: 0 1 96px; }
.zeile > label.breit { flex: 3 1 160px; }
.zeile > label.land { flex: 1 1 150px; }
input.zahl { max-width: 7rem; }

.knopf {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: .65rem 1.2rem; border-radius: 6px; border: 1px solid var(--akzent);
  background: var(--akzent); color: #fff; text-decoration: none;
}
.knopf:hover { background: var(--akzent-dunkel); }
.knopf.zweit { background: #fff; color: var(--akzent); }
.knopf.gefahr { background: var(--fehler); border-color: var(--fehler); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--akzent); cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

/* Meldungen und Badges */
.meldung { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; border-left: 4px solid; }
.meldung.ok { background: var(--ok-hell); border-color: var(--ok); }
.meldung.fehler { background: var(--fehler-hell); border-color: var(--fehler); }
.meldung.warnung { background: var(--offen-hell); border-color: var(--offen); }
.meldung.info { background: var(--info-hell); border-color: var(--info); }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.badge.ok { background: var(--ok-hell); color: var(--ok); }
.badge.offen { background: var(--offen-hell); color: var(--offen); }
.badge.fehler { background: var(--fehler-hell); color: var(--fehler); }
.badge.info { background: var(--info-hell); color: var(--info); }

/* Reiter */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--linie); }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--text); border-radius: 6px 6px 0 0; }
.tabs a.aktiv { background: var(--flaeche); border: 1px solid var(--linie); border-bottom-color: var(--flaeche); margin-bottom: -1px; font-weight: 600; }

/* Tabellen */
.tabelle-scroll { overflow-x: auto; margin-bottom: 1rem; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabelle th, .tabelle td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: middle; }
.tabelle th { font-weight: 600; color: var(--text-leise); white-space: nowrap; }
.tabelle td input { margin-top: 0; }

img.qr { background: #fff; border: 1px solid var(--linie); border-radius: 6px; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; font: inherit; padding: .35rem .7rem; border: 1px solid var(--linie); border-radius: 6px; background: #fff; }
  .topbar nav { display: none; width: 100%; }
  .topbar nav.offen { display: block; }
  .topbar nav ul { flex-direction: column; align-items: flex-start; padding-bottom: .5rem; }
  .karte { padding: 1rem; }
  .karte.schmal { margin: 1rem auto; }
}
.tabelle td input[name$="[name]"] { min-width: 14rem; }

/* ===== Öffentliche Seiten ===== */
.briefkopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); padding: 1.1rem 16px; text-align: right; }
.briefkopf-name { font-size: 1.35rem; font-weight: 600; color: var(--grau); letter-spacing: .5px; }
.briefkopf-zeile { font-size: .8rem; color: var(--grau); line-height: 1.35; }
.schmal-inhalt { max-width: 720px; }
.fusszeile { text-align: center; font-size: .85rem; color: var(--text-leise); padding: 1.5rem 16px 2rem; }
.fusszeile a { color: var(--text-leise); }

fieldset.karte { margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 600; font-size: 1.05rem; padding: 0 .4rem; margin-left: -.4rem; }
.weiche { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.option { display: flex; gap: .6rem; align-items: flex-start; margin: 0; padding: .9rem 1rem; border: 2px solid var(--linie);
          border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.option input { margin-top: .35rem; }
.option:has(input:checked) { border-color: var(--akzent); background: var(--info-hell); }
.produkt { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.produkt label { margin: 0; }
.produkt select { width: 5rem; margin: 0; }
.total { text-align: right; font-size: 1.05rem; margin: .5rem 0 0; }
.pflicht-rechnung { display: none; }
.ist-rechnung .pflicht-rechnung { display: inline; }
.versteckt { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.knopf.gross { width: 100%; padding: .9rem; font-size: 1.05rem; margin-top: .5rem; }
.knopf:disabled { opacity: .6; cursor: wait; }
.meldung ul { margin: .4rem 0 0 1.1rem; padding: 0; }
.rechtstext h1 { font-size: 1.35rem; }
.rechtstext h2 { font-size: 1.02rem; margin: 1.2rem 0 .3rem; }
.rechtstext p, .rechtstext li { font-size: .95rem; }
.klein { font-size: .85rem; color: var(--text-leise); }

/* Ticketseite */
.ampel { font-size: 1.4rem; font-weight: 700; color: #fff; text-align: center; padding: 1.4rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.ampel.gruen { background: var(--ok); }
.ampel.blau { background: var(--akzent); }
.ampel.orange { background: #c77700; }
.ampel.rot { background: var(--fehler); }
ul.liste { padding-left: 1.2rem; }

@media (max-width: 560px) {
  .weiche { grid-template-columns: 1fr; }
  .briefkopf-name { font-size: 1.1rem; }
}

/* ===== Verwaltung: Bestellungen ===== */
h3 { font-size: 1rem; font-weight: 600; margin: 1.1rem 0 .5rem; }
h2.abstand { margin-top: 1.5rem; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kachel { display: flex; align-items: center; gap: .8rem; background: var(--flaeche); border: 1px solid var(--linie);
          border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: var(--text); line-height: 1.3; }
.kachel:hover { border-color: var(--akzent); }
.kachel-zahl { font-size: 1.7rem; font-weight: 700; color: var(--akzent); min-width: 2.2rem; text-align: center; }
.kachel.warn .kachel-zahl { color: var(--fehler); }
form.filter { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; }
form.filter label { flex: 0 1 150px; }
form.filter label.breit { flex: 1 1 220px; }
form.filter .knopf { margin-bottom: .9rem; }
.tabelle .r, .tabelle th.r { text-align: right; }
.tabelle tr.summe td { font-weight: 600; border-top: 2px solid var(--text); }
.tabelle.bestellungen td { vertical-align: top; }
.tabelle.bestellungen .badge { margin: 0 .2rem .2rem 0; }
.badge.grau { background: #ececec; color: #666; }
.spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.spalten > .karte { margin-bottom: 0; }
.spalten + .karte { margin-top: 1rem; }
dl.werte { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
dl.werte dt { color: var(--text-leise); font-size: .9rem; }
dl.werte dd { margin: 0; }
.aktionen { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
form.aktion { margin: 0; display: flex; gap: .5rem; align-items: flex-end; }
.inline-label { margin: 0; font-size: .8rem; }
.inline-label input { margin-top: .15rem; padding: .5rem; }
.links a { white-space: nowrap; }
details.korrektur { margin-top: 1.2rem; border-top: 1px solid var(--linie); padding-top: .8rem; }
details.korrektur summary { cursor: pointer; color: var(--text-leise); margin-bottom: .6rem; }
ul.verlauf { margin: 0; padding-left: 1.1rem; font-size: .92rem; }
textarea + .knopf { margin-top: .5rem; }
@media (max-width: 860px) { .spalten { grid-template-columns: 1fr; } }
/* Bestellliste auf dem Handy als Karten */
@media (max-width: 720px) {
  .tabelle.bestellungen thead { display: none; }
  .tabelle.bestellungen, .tabelle.bestellungen tbody { display: block; }
  .tabelle.bestellungen tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .7rem; padding: .7rem 0; border-bottom: 1px solid var(--linie); }
  .tabelle.bestellungen td { display: block; border: 0; padding: 0; text-align: left; }
  .tabelle.bestellungen td:nth-child(3) { order: -1; flex-basis: 100%; font-weight: 500; }
  .tabelle.bestellungen td:nth-child(2), .tabelle.bestellungen td:nth-child(6) { color: var(--text-leise); font-size: .88rem; }
  .tabelle.bestellungen td:nth-child(4)::after { content: " Ex."; }
  .tabelle.bestellungen td:nth-child(5)::before { content: "CHF "; }
  .tabelle.bestellungen td:nth-child(7), .tabelle.bestellungen td:nth-child(8) { flex-basis: 100%; font-size: .85rem; color: var(--text-leise); }
  .tabelle.bestellungen td:nth-child(7)::before { content: "Zahlung "; }
  .tabelle.bestellungen td:nth-child(8)::before { content: "Abholung "; }
  .tabelle.bestellungen td:nth-child(8):empty { display: none; }
  .tabelle-scroll:has(.bestellungen) { overflow: visible; }
}

/* ===== Lesung und Schnellverkauf ===== */
.kasse { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.kasse > div { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .6rem .9rem; display: flex; flex-direction: column; }
.kasse > div:last-child { background: none; border: 0; padding: 0; margin-left: auto; }
.kasse strong { font-size: 1.25rem; }
.suche-gross { display: flex; gap: .5rem; margin-bottom: 1rem; }
.suche-gross input { margin: 0; font-size: 1.15rem; padding: .8rem .9rem; }
ul.lesung-liste { list-style: none; margin: 0; padding: 0; }
ul.lesung-liste li { border-bottom: 1px solid var(--linie); }
.lesung-zeile { display: flex; gap: .8rem; align-items: center; padding: .7rem .2rem; text-decoration: none; color: var(--text); }
.punkt { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; }
.punkt.gruen { background: var(--ok); } .punkt.blau { background: var(--akzent); }
.punkt.orange { background: #c77700; } .punkt.rot { background: var(--fehler); }
.lesung-karte h2 { font-size: 1.4rem; margin: .2rem 0 .2rem; }
ul.liste.gross { font-size: 1.15rem; margin: .8rem 0 1rem; }
.lesung-knoepfe { display: flex; flex-direction: column; gap: .6rem; }
.lesung-knoepfe form { margin: 0; }
.lesung-knoepfe .knopf.gross { margin-top: 0; }
.knopf.gruen { background: var(--ok); border-color: var(--ok); }
.knopf.gruen:hover { background: #24663f; }

/* ===== Jahresübersicht ===== */
.kopfzeile { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.kopfzeile h1 { margin: 0; }
.jahr-wahl { display: flex; gap: .5rem; align-items: center; }
.jahr-wahl select { margin: 0; width: auto; }
.kachel .betrag { font-size: 1.3rem; }
.kachel.gut .betrag { color: var(--ok); }
.kachel.warn .betrag { color: var(--fehler); }
form.erfassen { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--linie); }
form.erfassen label { flex: 0 1 160px; }
form.erfassen label.breit { flex: 1 1 260px; }
form.erfassen .knopf { margin-bottom: .9rem; }
form.erfassen input[type=file] { padding: .45rem; }
.tabelle tr.leer td { color: #b0b0b0; }
.links .knopf { margin-right: .5rem; }

/* ===== Vereinte Übersicht (Bestelleingang) ===== */
.kennzahlen { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.kz { display: flex; flex-direction: column; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
      padding: .55rem .75rem; text-decoration: none; color: var(--text); min-width: 0; }
a.kz:hover { border-color: var(--akzent); }
.kz.aktiv { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); }
.kz-wert { font-size: 1.2rem; font-weight: 700; color: var(--akzent); white-space: nowrap; }
.kz.warn .kz-wert { color: var(--fehler); }
.kz-label { font-size: .78rem; color: var(--text-leise); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
form.filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
form.filter > * { margin: 0; }
form.filter .suchfeld { flex: 1 1 240px; width: auto; }
form.filter select { flex: 0 1 auto; width: auto; }
form.filter .knopf { margin: 0; }
.tabelle.einzeilig td, .tabelle.einzeilig th { white-space: nowrap; vertical-align: middle; padding: .45rem .5rem; }
.tabelle.einzeilig td.mail { color: var(--text-leise); max-width: 15rem; overflow: hidden; text-overflow: ellipsis; }
.tabelle.einzeilig .badge { margin: 0 .15rem 0 0; }
.tabelle.einzeilig tbody tr:hover { background: #f7f9fb; }
.legende { margin-top: .6rem; }
.legende .punkt { display: inline-block; width: 10px; height: 10px; margin: 0 .25rem 0 .7rem; vertical-align: middle; }
.legende .punkt:first-child { margin-left: 0; }
@media (max-width: 1000px) { .kennzahlen { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Handy: eine Zeile mit Farbpunkt, Name, Exemplare, Betrag */
@media (max-width: 720px) {
  .kennzahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabelle.einzeilig thead, .tabelle.einzeilig td.mail, .tabelle.einzeilig td.nr, .tabelle.einzeilig td.datum,
  .tabelle.einzeilig td.art, .tabelle.einzeilig td.zahlung, .tabelle.einzeilig td.abholung { display: none; }
  .tabelle.einzeilig td.name { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .tabelle.einzeilig td.ex::after { content: " Ex."; }
  .tabelle.einzeilig td { padding: .65rem .35rem; }
  form.filter select { flex: 1 1 30%; }
}
/* Detailansicht: Abholblock zuoberst */
.h1-nr { font-size: .95rem; font-weight: 500; color: var(--text-leise); white-space: nowrap; }
.karte.abhol .ampel { margin-bottom: .8rem; }
@media (min-width: 721px) {
  .karte.abhol .lesung-knoepfe { flex-direction: row; flex-wrap: wrap; }
  .karte.abhol .lesung-knoepfe form { flex: 1 1 220px; }
}
.punkt { display: inline-block; vertical-align: middle; }
form.filter .suchfeld { flex: 1 1 150px; min-width: 0; }
.kz-label { white-space: normal; overflow: visible; }
/* «offen» in der Liste als Knopf */
.badge-knopf { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: .78rem; font-weight: 600; line-height: inherit; }
.badge-knopf:hover { border-color: var(--offen); background: #ffe3b8; }
.badge-knopf:hover::after { content: " → bezahlt"; }
