/* Freiraum Buchhaltung – hell, Schrift Outfit und Farben wie www.freiraum-regau.at */
@font-face { font-family: Outfit; src: url(/schriften/Outfit-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Outfit; src: url(/schriften/Outfit-SemiBold.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --magenta: #e50050;
  --magenta-hell: #fde6ee;
  --text: #1a1a18;
  --grau: #6f6c66;
  --linie: #e6e2d8;
  --flaeche: #fffcf5;
  --karte: #ffffff;
  --gruen: #1f8a4c;
  --gruen-hell: #e3f4ea;
  --gelb: #9a6a00;
  --gelb-hell: #fff3d1;
  --rot: #c62828;
  --rot-hell: #fde8e8;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: Outfit, -apple-system, 'Helvetica Neue', Arial, sans-serif; font-size: 16px; line-height: 1.4;
  color: var(--text); background: var(--flaeche);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--magenta); }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 .6rem; }
.hinweis-text, .klein { color: var(--grau); font-size: .9rem; }
[hidden] { display: none !important; }

/* Kopfzeile */
.kopf {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .6rem 1rem; background: rgba(255, 252, 245, .96); border-bottom: 1px solid var(--linie); backdrop-filter: blur(8px);
}
.marke { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 600; }
.marke img { height: 26px; }
.version { color: var(--grau); font-size: .8rem; }
nav { margin-left: auto; display: flex; gap: .25rem; }
nav a { padding: .5rem .8rem; border-radius: 999px; text-decoration: none; color: var(--text); font-weight: 600; }
nav a.aktiv { background: var(--text); color: #fff; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* Bedienelemente – groß genug für Finger am iPad */
button, .knopf {
  font: inherit; font-weight: 600; min-height: 44px; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
}
button.haupt, .knopf.haupt { background: var(--magenta); border-color: var(--magenta); color: #fff; }
button.gefahr { color: var(--rot); border-color: #f1c4c4; }
button:disabled { opacity: .45; cursor: default; }
button.klein-knopf { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
input, select, textarea {
  font: inherit; width: 100%; min-height: 44px; padding: .5rem .7rem; border: 1px solid var(--linie); border-radius: 10px;
  background: #fff; color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--magenta); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: .85rem; color: var(--grau); margin-bottom: .25rem; }
.feld { margin-bottom: .9rem; }
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.leiste { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.leiste .rechts { margin-left: auto; }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }

/* Filter-Chips */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { min-height: 38px; padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--linie); background: #fff; font-weight: 600; }
.chip.aktiv { background: var(--text); color: #fff; border-color: var(--text); }
.chip .zahl { opacity: .7; font-weight: 400; margin-left: .25rem; }

/* Listen */
.liste { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.zeile {
  display: grid; grid-template-columns: 6.5rem 1fr auto auto; gap: .25rem 1rem; align-items: center;
  padding: .75rem 1rem; border-bottom: 1px solid var(--linie); text-decoration: none; color: inherit;
}
.zeile:last-child { border-bottom: 0; }
.zeile:hover { background: #fdfaf2; }
.zeile .nr { font-weight: 600; font-variant-numeric: tabular-nums; }
.zeile .wer { min-width: 0; }
.zeile .wer div:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .betrag { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.leer { padding: 2rem 1rem; text-align: center; color: var(--grau); }

.marke-status { font-size: .8rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.s-entwurf { background: #efece4; color: var(--grau); }
.s-offen { background: var(--gelb-hell); color: var(--gelb); }
.s-ueberfaellig { background: var(--rot-hell); color: var(--rot); }
.s-bezahlt { background: var(--gruen-hell); color: var(--gruen); }
.s-storniert { background: #eee; color: #888; text-decoration: line-through; }
.s-storno { background: var(--magenta-hell); color: var(--magenta); }

/* Positionen-Editor */
.positionen { width: 100%; border-collapse: collapse; }
.positionen th { text-align: left; font-size: .8rem; color: var(--grau); font-weight: 600; padding: .3rem .25rem; }
.positionen td { padding: .25rem; vertical-align: top; }
.positionen td.zahl, .positionen th.zahl { text-align: right; }
.positionen input, .positionen select { min-height: 40px; padding: .35rem .5rem; }
.positionen .netto-anzeige { padding-top: .6rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summen { margin-left: auto; max-width: 320px; font-variant-numeric: tabular-nums; }
.summen div { display: flex; justify-content: space-between; padding: .2rem 0; }
.summen .gesamt { font-weight: 600; font-size: 1.1rem; border-top: 1px solid var(--linie); margin-top: .3rem; padding-top: .5rem; }

.warnung { background: var(--gelb-hell); color: #6b4a00; border-radius: 10px; padding: .7rem .9rem; margin: .8rem 0; white-space: pre-line; }
.fehler-box { background: var(--rot-hell); color: var(--rot); border-radius: 10px; padding: .7rem .9rem; margin: .8rem 0; white-space: pre-line; }
.daten { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.daten dt { color: var(--grau); }
.daten dd { margin: 0; white-space: pre-line; }

/* Kundenübernahme */
.imp-zeile { grid-template-columns: auto 1fr auto; cursor: pointer; margin: 0; color: inherit; font-size: 1rem; }
.imp-zeile input[type=checkbox] { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--magenta); }
.imp-zeile.imp-da { opacity: .55; cursor: default; }
.imp-pruefen { background: var(--gelb-hell); color: #6b4a00; border-radius: 8px; padding: .3rem .55rem; margin-top: .35rem; font-size: .85rem; }
.zs-zeile { grid-template-columns: 1fr auto; }
.zs-eingabe { display: flex; align-items: center; gap: .4rem; }
.zs-eingabe input { width: 9.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.zs-eingabe .klein { width: 2.2rem; }
input.zs-warnung { outline: 2px solid var(--gelb); background: var(--gelb-hell); }
.mv-aendern summary { cursor: pointer; color: var(--magenta); margin-top: .3rem; }
.imp-fuss { position: sticky; bottom: 0; background: rgba(255, 252, 245, .96); padding: .6rem 0; border-top: 1px solid var(--linie); }

/* Anmeldung */
.anmeldung { max-width: 380px; margin: 3rem auto; }
.anmeldung img.logo { height: 44px; margin-bottom: 1.5rem; }
.qr { display: block; margin: .5rem auto 1rem; width: 220px; height: 220px; }
.geheim { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; word-break: break-all; background: #f6f3ea; padding: .5rem; border-radius: 8px; }

.meldung {
  position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--text); color: #fff; padding: .75rem 1.2rem; border-radius: 12px; max-width: calc(100% - 2rem); box-shadow: 0 6px 24px rgba(0,0,0,.18);
  white-space: pre-line;
}
.meldung.fehler { background: var(--rot); }

/* Handy */
@media (max-width: 640px) {
  .kopf { padding: .5rem .75rem; }
  .marke span { display: none; }
  nav a { padding: .45rem .65rem; }
  main { padding: 1rem .75rem 4rem; }
  /* Zeile 1: Nummer, Status, Betrag – Zeile 2: Kunde und Text */
  .zeile { grid-template-columns: auto 1fr auto; }
  .zeile .nr { grid-column: 1; grid-row: 1; }
  .zeile .marke-status { grid-column: 2; grid-row: 1; justify-self: start; }
  .zeile .betrag { grid-column: 3; grid-row: 1; }
  .zeile .wer { grid-column: 1 / -1; grid-row: 2; }
  .zeile .wer .klein { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .imp-zeile .wer .klein, .mv-zeile .wer .klein, .zs-zeile .wer .klein { white-space: normal; }
  .zs-zeile { grid-template-columns: 1fr auto; }
  .pa-zeile .wer { grid-row: 1; grid-column: 1; }
  .pa-zeile .betrag { grid-row: 1; grid-column: 3; }
  .pa-zeile button { grid-row: 2; grid-column: 1; justify-self: start; }
  .zs-zeile .wer { grid-row: 1; grid-column: 1; }
  .zs-eingabe input { width: 7.5rem; }
  /* Positionen als Karten statt Tabelle */
  .positionen thead { display: none; }
  .positionen tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .3rem; padding: .6rem 0; border-bottom: 1px solid var(--linie); }
  .positionen td { padding: 0; min-width: 0; }
  .positionen input, .positionen select { width: 100% !important; }
  .positionen td.text { grid-column: 1 / -1; }
  .positionen td[data-titel]::before { content: attr(data-titel); display: block; font-size: .75rem; color: var(--grau); }
}
