/* Fahrschul-Cloud – Oberfläche */
:root {
  /* Fahrschule Frohnau: Grün und Gold aus dem Logo */
  --gruen: #2e5e3f;          /* Frohnau-Grün (Primär) */
  --gruen-hell: #eef3ea;     /* helles Grün für Flächen */
  --gruen-mittel: #b8893b;   /* Frohnau-Gold (Akzent) */
  --dunkel: #16301f;         /* Tannengrün wie im Logo */
  --grau-bg: #f4f6f3; --grau-linie: #dde4dd; --text: #1e2721; --text-2: #5d6b60;
  --rot: #b3261e; --gelb: #8a6d00; --blau: #1a56a0; --radius: 10px;
  --schatten: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--grau-bg); color: var(--text); font-size: 15px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--grau-linie); border-radius: 7px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gruen-mittel); border-color: transparent; }
a { color: var(--gruen-mittel); }

/* Layout */
#app { display: flex; min-height: 100vh; }
nav {
  width: 220px; background: linear-gradient(180deg, #16301f, #1d3f29); color: #dbe6dc; padding: 18px 0; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
nav .logo { display: flex; align-items: center; gap: 10px; font-size: 15.5px; font-weight: 800; letter-spacing: 1.2px; color: #fff; padding: 0 18px 16px; border-bottom: 1px solid #2c4f38; margin-bottom: 12px; }
nav .logo img { width: 42px; height: 42px; }
nav .logo small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: var(--gruen-mittel); text-transform: uppercase; }
nav .logo .untertitel { display: block; font-size: 10.5px; font-weight: 400; letter-spacing: .3px; color: #9cb3a2; text-transform: none; margin-top: 3px; }
nav a.nav-item { display: flex; gap: 10px; align-items: center; padding: 11px 20px; color: #dbe6dc; text-decoration: none; font-size: 14.5px; border-left: 3px solid transparent; }
nav a.nav-item:hover { background: #254732; }
nav a.nav-item.aktiv { background: #254732; color: #fff; border-left-color: var(--gruen-mittel); font-weight: 600; }
nav .fuss { margin-top: auto; padding: 14px 20px; font-size: 12.5px; color: #9cb3a2; border-top: 1px solid #2c4f38; }
nav .fuss button { background: none; border: 1px solid #4c6f56; color: #dbe6dc; border-radius: 6px; padding: 5px 12px; margin-top: 8px; }

main { flex: 1; padding: 26px 32px; max-width: 1200px; }
.kopfzeile { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.kopfzeile h1 { font-size: 22px; }
.filialwahl { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.filialwahl select { width: auto; padding: 6px 8px; }

/* Karten & Tabellen */
.karte { background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); padding: 18px 20px; margin-bottom: 18px; }
.kachel-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kachel { background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px 18px; }
.kachel .wert { font-size: 26px; font-weight: 700; color: var(--gruen); margin-top: 2px; }
.kachel .label { font-size: 13px; color: var(--text-2); }
table.liste { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten); }
table.liste th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); background: #fafbfa; padding: 10px 14px; border-bottom: 1px solid var(--grau-linie); }
table.liste td { padding: 10px 14px; border-bottom: 1px solid #eef1ef; }
table.liste tr:last-child td { border-bottom: none; }
table.liste tr.klickbar { cursor: pointer; }
table.liste tr.klickbar:hover { background: var(--gruen-hell); }
.rechts { text-align: right; }
.storniert { text-decoration: line-through; color: #999; }

/* Knöpfe & Badges */
.btn { background: var(--gruen); color: #fff; border: none; border-radius: 7px; padding: 9px 16px; font-weight: 600; font-size: 14px; }
.btn:hover { background: var(--gruen-mittel); }
.btn.zweit { background: #fff; color: var(--gruen); border: 1px solid var(--gruen); }
.btn.klein { padding: 5px 10px; font-size: 12.5px; }
.btn.gefahr { background: #fff; color: var(--rot); border: 1px solid var(--rot); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.aktiv { background: var(--gruen-hell); color: #8a6b2e; }
.badge.bestanden { background: #e3ecf8; color: var(--blau); }
.badge.ruht, .badge.abgebrochen { background: #f1ecdd; color: var(--gelb); }
.badge.bar { background: #f1ecdd; color: var(--gelb); }
.badge.ec { background: #e3ecf8; color: var(--blau); }
.badge.kreditkarte { background: #efe3f8; color: #7b3aa0; }
.badge.ueberweisung { background: #e6f2e6; color: #2e7d32; }
.saldo-plus { color: #2e7d32; font-weight: 600; }
.saldo-minus { color: var(--rot); font-weight: 600; }

/* Formulare */
.form-gitter { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.feld label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.werkzeuge { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.werkzeuge input, .werkzeuge select { width: auto; }

/* Dialog */
dialog { border: none; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 0; width: min(640px, calc(92vw / var(--zoomf, 1))); }
dialog::backdrop { background: rgba(10,25,18,.45); }
dialog .dialog-kopf { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--grau-linie); }
dialog .dialog-kopf h2 { font-size: 17px; }
dialog .dialog-inhalt { padding: 18px 22px; max-height: calc(66vh / var(--zoomf, 1)); overflow-y: auto; }
dialog .dialog-fuss { padding: 14px 22px; border-top: 1px solid var(--grau-linie); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.schliessen { background: none; border: none; font-size: 20px; color: var(--text-2); }

/* Kalender */
.kalender { display: grid; grid-template-columns: 52px repeat(6, 1fr); background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); overflow: clip; }
.kal-kopf { padding: 8px 4px; text-align: center; font-size: 12.5px; font-weight: 700; border-bottom: 2px solid var(--grau-linie); background: #fafbfa; position: sticky; top: 0; z-index: 5; }
.kal-kopf small { display: block; font-weight: 400; color: var(--text-2); }
.kal-spalte { border-left: 1px solid #eef1ef; position: relative; }
.kal-zeit { font-size: 10.5px; color: var(--text-2); text-align: right; padding-right: 5px; border-top: 1px solid #eef1ef; }
.kal-slot { border-top: 1px solid #f2f5f3; cursor: pointer; }
.kal-slot:hover { background: var(--gruen-hell); }
.termin { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: 11px; line-height: 1.25; overflow: hidden; cursor: pointer; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.termin.uebung { background: var(--gruen); }
/* Sonderfahrten farblich unterscheidbar: Überland gelb, Autobahn orange, Nacht blau */
.termin.ueberland { background: #f2c200; color: #2b2200; }
.termin.autobahn { background: #e0740b; }
.termin.nacht { background: #1a56a0; }
/* Prüfungen rot */
.termin.pruefungsvorbereitung, .termin.praktische_pruefung { background: #c22a20; }
/* Testfahrt Schaltkompetenz (B197): türkis */
.termin.testfahrt { background: #0e7a6d; }
.termin.sonstiges { background: #667; }
/* Einträge ohne Fahrschüler: Tätigkeit grau, Privat braun, Urlaub/Krank/Feiertag schwarz */
.termin.taetigkeit { background: #8a8f8a; }
.termin.privat { background: #7a4a2b; }
.termin.urlaub, .termin.krank, .termin.feiertag { background: #1c1c1c; }
.termin.ausgefallen { background: #b9c2bd; text-decoration: line-through; }
/* Fehlstunde (nicht erschienen): rot schraffiert */
.termin.fehlstunde { background: repeating-linear-gradient(45deg, #b3261e, #b3261e 7px, #7e1712 7px, #7e1712 14px); }
.termin.durchgefuehrt { opacity: .65; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 70% 30%, #33573f 0%, #16301f 55%, #0c1d13 100%); }
.login-box { background: #fff; border-radius: 16px; padding: 36px; width: min(400px, 92vw); box-shadow: 0 0 80px rgba(246,123,50,.35), 0 20px 60px rgba(0,0,0,.5); }
.login-box .marke { text-align: center; margin-bottom: 18px; }
.login-box .marke img { width: 96px; height: 96px; }
.login-box .marke .name { font-size: 26px; font-weight: 800; letter-spacing: 6px; color: #16301f; border-bottom: 3px solid #16301f; display: inline-block; padding-bottom: 2px; }
.login-box .marke .claim { font-size: 12px; font-weight: 700; letter-spacing: 4px; color: var(--gruen-mittel); text-transform: uppercase; margin-top: 6px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box p { color: var(--text-2); font-size: 13.5px; margin-bottom: 20px; }
.login-box .feld { margin-bottom: 14px; }
.fehler { background: #fdecea; color: var(--rot); border-radius: 7px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.leer { color: var(--text-2); font-style: italic; padding: 20px; text-align: center; }
.tab-reihe { display: flex; gap: 4px; border-bottom: 2px solid var(--grau-linie); margin-bottom: 16px; }
.tab-reihe button { background: none; border: none; padding: 9px 16px; font-size: 14px; color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab-reihe button.aktiv { color: var(--gruen); font-weight: 700; border-bottom-color: var(--gruen); }

/* Mobiler Kopfbereich (nur Handy) */
.mobil-kopf { display: none; }

/* Mein Tag */
.tag-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tag-nav .btn { font-size: 20px; padding: 8px 20px; }
.tag-datum { text-align: center; cursor: pointer; flex: 1; }
.tag-datum strong { display: block; font-size: 18px; }
.tag-datum span { font-size: 13px; color: var(--text-2); }
.tag-zusammenfassung { text-align: center; font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; }
.tag-karte { background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); margin-bottom: 12px; overflow: hidden; border-left: 5px solid var(--gruen-mittel); }
.tag-karte.durchgefuehrt { border-left-color: #2e7d32; opacity: .78; }
.tag-karte.ausgefallen { border-left-color: var(--rot); opacity: .78; }
.tag-karte .karte-kern { display: flex; align-items: center; gap: 14px; padding: 13px 15px; cursor: pointer; }
.tag-zeit { text-align: center; min-width: 58px; }
.tag-zeit strong { display: block; font-size: 18px; }
.tag-zeit span { font-size: 12px; color: var(--text-2); }
.tag-info { flex: 1; min-width: 0; }
.tag-info strong { font-size: 15.5px; }
.tag-art { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.tag-tel { font-size: 22px; text-decoration: none; padding: 6px; }
.tag-aktionen { display: flex; gap: 8px; align-items: center; padding: 10px 15px; border-top: 1px solid #edf1ec; background: #fbfcfa; flex-wrap: wrap; }
.tag-aktionen .btn { flex: 1; min-width: 130px; }
.tag-aktionen .btn.klein { flex: 0 0 auto; min-width: auto; white-space: nowrap; margin-left: auto; }
.tag-erledigt { font-weight: 700; color: #2e7d32; }

@media (max-width: 860px) {
  #app { flex-direction: column; }

  /* Kopfzeile oben */
  .mobil-kopf {
    display: flex; align-items: center; gap: 8px;
    background: linear-gradient(180deg, #16301f, #1d3f29); color: #fff;
    padding: 10px 14px; position: sticky; top: 0; z-index: 50;
  }
  .mobil-kopf img { width: 30px; height: 30px; }
  .mobil-kopf strong { letter-spacing: 2px; }
  .mobil-kopf .mk-name { margin-left: auto; font-size: 12.5px; color: #dbe6dc;
    flex: 1; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobil-kopf strong { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobil-kopf button { flex-shrink: 0; white-space: nowrap; }
  .mobil-kopf button { background: none; border: 1px solid #4c6f56; color: #dbe6dc; border-radius: 6px; padding: 4px 10px; font-size: 12.5px; }

  /* Navigation unten, wie eine App */
  nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; z-index: 50;
    width: 100%; height: auto; flex-direction: row; padding: 0;
    background: #16301f; border-top: 1px solid #2c4f38;
    padding-bottom: env(safe-area-inset-bottom);
  }
  nav .logo, nav .fuss { display: none; }
  nav a.nav-item {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px;
    padding: 7px 2px 8px; font-size: 10px; border-left: none; border-top: 3px solid transparent;
    text-align: center; min-width: 0;
  }
  nav a.nav-item .icon { font-size: 19px; }
  nav a.nav-item .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  nav a.nav-item.aktiv { border-left: none; border-top-color: var(--gruen-mittel); }

  main { padding: 14px 14px 92px; }
  .kopfzeile h1 { font-size: 21px; }
  .kalender { overflow-x: auto; }
  dialog { width: calc(96vw / var(--zoomf, 1)); }
  /* Reiter (z. B. in der Verwaltung) auf dem Handy als Gitter untereinander –
     nichts mehr seitwärts wischen, alles mit Hoch-/Runterwischen erreichbar */
  .tab-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; border-bottom: none; margin-bottom: 12px; }
  .tab-reihe button { border: 1.5px solid var(--grau-linie); border-radius: 11px; padding: 12px 6px;
    text-align: center; margin-bottom: 0; background: #fff; font-size: 14px; }
  .tab-reihe button.aktiv { border-color: var(--gruen); background: #eef3ea; border-bottom-color: var(--gruen); }
  /* Alle Dialog-Knöpfe (Löschen, Abbrechen, Speichern) teilen sich die Zeile
     und bleiben dadurch immer komplett sichtbar */
  dialog .dialog-fuss { padding: 12px 12px; gap: 8px; }
  dialog .dialog-fuss .btn { flex: 1 1 auto; min-width: 0; padding: 12px 8px; text-align: center; white-space: nowrap; }

  /* Auf dem Handy alles ein gutes Stück größer (bessere Lesbarkeit und Bedienung) */
  body { font-size: 17px; }
  input, select, textarea { font-size: 17px; padding: 11px 12px; }
  .btn { font-size: 16.5px; padding: 12px 18px; }
  .btn.klein { font-size: 14px; padding: 8px 12px; }
  table.liste th { font-size: 13.5px; padding: 11px 12px; }
  table.liste td { font-size: 16px; padding: 12px 12px; }
  nav a.nav-item { padding: 9px 2px 10px; font-size: 11.5px; }
  nav a.nav-item .icon { font-size: 23px; }
  .mobil-kopf .mk-name, .mobil-kopf button { font-size: 14px; }
  .feld label { font-size: 14px; }
  .badge { font-size: 13px; }
}
