/* ==========================================================================
   Punkteverwaltung – Stylesheet

   Schriften bewusst aus dem System (keine Einbindung externer Font-Dienste),
   damit beim Aufruf keine Daten an Dritte fliessen (DSGVO, Abschnitt 10).
   ========================================================================== */

:root {
  --papier:        #edf0ea;
  --flaeche:       #ffffff;
  --flaeche-leise: #f6f8f4;
  --tinte:         #16211d;
  --tinte-leise:   #5a6a63;
  --linie:         #d2dbd1;
  --linie-stark:   #b6c2b5;
  --marke:         #1a5c49;
  --marke-tief:    #124137;
  --marke-hell:    #e2efe8;
  --punkt:         #8a5a12;
  --punkt-hell:    #f6eddc;
  --gefahr:        #8f2d2d;
  --gefahr-hell:   #f6e6e4;

  --radius:   6px;
  --schrift:  "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --zahl:     "SF Mono", "DejaVu Sans Mono", "Liberation Mono", Consolas, monospace;
  --schatten: 0 1px 2px rgba(22, 33, 29, .06), 0 8px 24px -16px rgba(22, 33, 29, .35);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font-family: var(--schrift);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

:focus-visible {
  outline: 2px solid var(--marke);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Kopf -- */

.kopf {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--marke-tief);
  color: #eaf2ee;
  position: sticky;
  top: 0;
  z-index: 20;
}

.kopf__marke { font-weight: 600; letter-spacing: .01em; }

.reiter { display: flex; gap: 2px; }

.reiter__knopf {
  border: 0;
  background: transparent;
  color: #b7cfc4;
  font: inherit;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.reiter__knopf:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.reiter__knopf.ist-aktiv { color: var(--marke-tief); background: #eaf2ee; font-weight: 600; }

.kopf__sitzung { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.kopf__benutzer { color: #b7cfc4; font-size: 13px; }

.kopf .knopf--leise {
  background: rgba(255, 255, 255, .1);
  border-color: transparent;
  color: #eaf2ee;
}
.kopf .knopf--leise:hover { background: rgba(255, 255, 255, .2); }

/* ------------------------------------------------------------- Inhalt -- */

.inhalt {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

.ansicht { display: none; }
.ansicht.ist-sichtbar { display: block; }

.bereichskopf { margin-bottom: 16px; }
.bereichskopf h2 { margin-bottom: 4px; }

.notiz { margin: 0; color: var(--tinte-leise); font-size: 13px; }

.leerzustand {
  margin: 32px 0;
  text-align: center;
  color: var(--tinte-leise);
}
.leerzustand--klein { margin: 12px 0 0; text-align: left; font-size: 13px; }

/* -------------------------------------------------------------- Suche -- */
/* Das Suchfeld ist der Einstieg in praktisch jeden Arbeitsschritt und
   deshalb das einzige bewusst grosse Element der Oberflaeche. */

.suche {
  position: relative;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--schatten);
}

.suche__label {
  display: block;
  font-size: 13px;
  color: var(--tinte-leise);
  margin-bottom: 6px;
}

.suche__feld {
  width: 100%;
  font-family: inherit;
  font-size: 26px;
  line-height: 1.2;
  padding: 8px 4px 12px;
  border: 0;
  border-bottom: 2px solid var(--linie-stark);
  background: transparent;
  color: var(--tinte);
}
.suche__feld::placeholder { color: #9aa8a1; font-size: 20px; }
.suche__feld:focus { outline: none; border-bottom-color: var(--marke); }

.suche__hinweis { margin: 8px 0 0; font-size: 12px; color: var(--tinte-leise); }

.treffer {
  position: absolute;
  left: 20px;
  right: 20px;
  top: calc(100% - 8px);
  z-index: 15;
  background: var(--flaeche);
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px -12px rgba(22, 33, 29, .4);
  overflow: hidden;
}

.treffer__eintrag {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--linie);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.treffer__eintrag:hover,
.treffer__eintrag.ist-markiert { background: var(--marke-hell); }

.treffer__name { font-weight: 600; }
.treffer__kontakt { color: var(--tinte-leise); font-size: 13px; }
.treffer__punkte {
  margin-left: auto;
  font-family: var(--zahl);
  font-variant-numeric: tabular-nums;
  color: var(--punkt);
  font-size: 13px;
  white-space: nowrap;
}

.treffer__leer {
  padding: 10px 14px;
  color: var(--tinte-leise);
  font-size: 13px;
  border-bottom: 1px solid var(--linie);
}

.treffer__neu {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  background: var(--flaeche-leise);
  font: inherit;
  font-weight: 600;
  color: var(--marke);
  text-align: left;
  cursor: pointer;
}
.treffer__neu:hover { background: var(--marke-hell); }

/* -------------------------------------------------------- Kundenkarte -- */

.kunde { margin-top: 28px; }

.kunde__kopf {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.kunde__name { font-size: 22px; }
.kunde__nummer { color: var(--tinte-leise); font-size: 13px; font-family: var(--zahl); }
.kunde__kopf .knopf { margin-left: auto; }

.raster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
}

.karte__titel {
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--linie);
}

.karte__untertitel {
  margin: 22px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--linie);
  color: var(--tinte-leise);
}

/* ------------------------------------------------------------- Felder -- */

.feld { margin-bottom: 14px; }

.feld label {
  display: block;
  font-size: 13px;
  color: var(--tinte-leise);
  margin-bottom: 4px;
}

.feld input,
.feld select {
  width: 100%;
  font: inherit;
  color: var(--tinte);
  padding: 7px 9px;
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius);
  background: var(--flaeche);
}
.feld input:focus,
.feld select:focus { outline: none; border-color: var(--marke); box-shadow: 0 0 0 3px var(--marke-hell); }

.feld input[readonly] {
  background: var(--flaeche-leise);
  color: var(--tinte-leise);
  border-style: dashed;
}

.feld input.ist-fehlerhaft { border-color: var(--gefahr); }

.feld--inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.feld--inline label,
.feld--inline > span { margin: 0; white-space: nowrap; }
.feld--inline input { width: 160px; }
.feld--inline input[type="number"] { width: 90px; }

.feld-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feld-paar--plz { grid-template-columns: 100px 1fr; }
/* Name des Angebots braucht viel Platz, Punkte sind höchstens zweistellig. */
.feld-paar--angebot { grid-template-columns: 1fr 84px; }

.feldfehler {
  display: none;
  margin-top: 4px;
  font-size: 12px;
  color: var(--gefahr);
}
.feldfehler.ist-sichtbar { display: block; }

/* ------------------------------------------------------------- Knöpfe -- */

.knopf {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--tinte);
  cursor: pointer;
}
.knopf:hover:not(:disabled) { border-color: var(--tinte-leise); }
.knopf:disabled { opacity: .45; cursor: not-allowed; }

.knopf--primaer {
  background: var(--marke);
  border-color: var(--marke);
  color: #fff;
  font-weight: 600;
}
.knopf--primaer:hover:not(:disabled) { background: var(--marke-tief); border-color: var(--marke-tief); }

.knopf--gefahr { color: var(--gefahr); border-color: #d8b6b2; }
.knopf--gefahr:hover:not(:disabled) { background: var(--gefahr-hell); border-color: var(--gefahr); }

.knopf--leise { padding: 5px 10px; font-size: 13px; }
.knopf--breit { width: 100%; padding: 10px; }
.knopf--winzig { padding: 3px 8px; font-size: 12px; }

.knopfreihe { display: flex; gap: 8px; }

/* -------------------------------------------------------- Punktekarte -- */

/* overflow: hidden schneidet den Kopfbereich an den abgerundeten
   Kartenecken ab, damit das Band nicht über den Rahmen hinaussteht. */
.karte--punkte { overflow: hidden; }

.karte-punkte__band {
  margin: -18px -20px 18px;
  padding: 16px 20px 14px;
  background: var(--punkt-hell);
}
.karte-punkte__band .karte__titel {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(138, 90, 18, .18);
}
.karte-punkte__label {
  display: block;
  font-size: 13px;
  color: var(--tinte-leise);
}

.punktestand { margin-bottom: 18px; }

.punktestand__wert {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--zahl);
  font-variant-numeric: tabular-nums;
  font-size: 40px;
  line-height: 1.1;
  font-weight: 600;
  color: var(--punkt);
}
.punktestand__wert:focus { outline: none; }

.neues-angebot {
  margin: 0 0 14px;
  padding: 14px;
  background: var(--flaeche-leise);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

/* Besuchsliste */

.besuche { list-style: none; margin: 0; padding: 0; }

.besuche__zeile {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--linie);
}
.besuche__zeile:last-child { border-bottom: 0; }

.besuche__name { font-weight: 600; }
.besuche__datum { color: var(--tinte-leise); font-size: 13px; font-family: var(--zahl); }
.besuche__punkte {
  margin-left: auto;
  font-family: var(--zahl);
  font-variant-numeric: tabular-nums;
  color: var(--punkt);
}

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

.werkzeugleiste {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}
.werkzeugleiste__luecke { flex: 1 1 auto; }
.werkzeugleiste__auswahl { font-size: 13px; color: var(--tinte-leise); }

.tabellenrahmen {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow-x: auto;
}

.tabelle { width: 100%; border-collapse: collapse; }

.tabelle th,
.tabelle td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--linie);
  vertical-align: top;
}

.tabelle thead th {
  background: var(--flaeche-leise);
  font-size: 13px;
  color: var(--tinte-leise);
  font-weight: 600;
  white-space: nowrap;
}

.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover { background: var(--flaeche-leise); }
.tabelle tbody tr.ist-gewaehlt { background: var(--marke-hell); }

.spalte-auswahl { width: 36px; }
.spalte-zahl { text-align: right; }
.tabelle td.spalte-zahl {
  text-align: right;
  font-family: var(--zahl);
  font-variant-numeric: tabular-nums;
  color: var(--punkt);
}
.spalte-aktionen { width: 1%; white-space: nowrap; }

.zelle-leise { color: var(--tinte-leise); font-size: 13px; }

.marke-inaktiv {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--flaeche-leise);
  border: 1px solid var(--linie-stark);
  color: var(--tinte-leise);
  font-size: 12px;
}
.marke-aktiv {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--marke-hell);
  border: 1px solid #a8cbba;
  color: var(--marke-tief);
  font-size: 12px;
}

.tabelle .feld-in-zelle {
  font: inherit;
  padding: 4px 7px;
  border: 1px solid var(--linie);
  border-radius: 4px;
  width: 100%;
  max-width: 260px;
  background: var(--flaeche);
}
.tabelle .feld-in-zelle[type="number"] { width: 90px; text-align: right; font-family: var(--zahl); }

/* ---------------------------------------------------------- Meldungen -- */

.meldungen {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 40px));
}

.meldung {
  padding: 10px 14px;
  border-radius: var(--radius);
  border-left: 3px solid var(--marke);
  background: var(--flaeche);
  box-shadow: var(--schatten);
  font-size: 14px;
}
.meldung--fehler { border-left-color: var(--gefahr); color: var(--gefahr); }

/* ------------------------------------------------------------- Anmeldung */

.seite-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 0%, #dfe8de 0, transparent 55%),
    var(--papier);
}

.anmeldung {
  width: 100%;
  max-width: 380px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--schatten);
}

.anmeldung__titel { font-size: 24px; }
.anmeldung__zeile { margin: 4px 0 24px; color: var(--tinte-leise); font-size: 14px; }
.anmeldung__fuss { margin: 20px 0 0; font-size: 12px; color: var(--tinte-leise); text-align: center; }

.hinweis {
  margin: 0 0 16px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}
.hinweis--info { background: var(--flaeche-leise); border: 1px solid var(--linie); color: var(--tinte-leise); }
.hinweis--fehler { background: var(--gefahr-hell); border: 1px solid #d8b6b2; color: var(--gefahr); }

/* ------------------------------------------------------------ Responsiv */

@media (max-width: 860px) {
  .raster { grid-template-columns: 1fr; }
  .kopf { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .kopf__sitzung { margin-left: auto; }
  .reiter { order: 3; width: 100%; }
  .reiter__knopf { flex: 1; }
  .inhalt { padding: 20px 16px 60px; }
  .suche__feld { font-size: 20px; }
  .suche__feld::placeholder { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
