/* =========================================================================
   Stundenportal – mobile first
   Die Eingabe erfolgt fast ausschliesslich am Handy: grosse Touchflaechen,
   16px Schriftgroesse in Feldern (verhindert das Zoomen in iOS Safari),
   Hauptnavigation unten als Tab-Leiste in Daumenreichweite.
   ========================================================================= */
:root {
  --tief: #1F3864;
  --tief-hell: #2E4F8F;
  --tief-blass: #EDF1F9;
  --gold: #B8903C;
  --gold-blass: #FBF3E2;
  --tinte: #1C1F26;
  --tinte-weich: #5A6272;
  --linie: #E2E6EF;
  --flaeche: #FFFFFF;
  --hintergrund: #F6F7FA;
  --gruen: #2E7D32;
  --gruen-blass: #E8F5E9;
  --rot: #B3261E;
  --rot-blass: #FBEAEA;
  --gelb-blass: #FFF7E0;
  --lila: #4C3FB3;
  --lila-blass: #EEF0FB;
  --radius: 12px;
  --schatten: 0 1px 3px rgba(28,31,38,0.08), 0 1px 2px rgba(28,31,38,0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--hintergrund);
  color: var(--tinte);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--tief-hell); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Kopfzeile ---------- */
.topbar {
  background: var(--tief);
  border-bottom: 3px solid var(--gold);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: 36px; width: auto; display: block; }
.brand-text { color: #fff; font-weight: 600; font-size: 15px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-user {
  color: rgba(255,255,255,0.9); font-size: 13.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 42vw;
  /* Fuehrt zum eigenen Konto; dezent unterstrichen, damit erkennbar ist,
     dass man darauf tippen kann */
  text-decoration: none; border-bottom: 1px dotted rgba(255,255,255,0.45);
  padding-bottom: 1px;
}
.topbar-user:hover { color: #fff; border-bottom-color: rgba(255,255,255,0.9); }
.topbar-link {
  color: #fff; font-size: 13px; padding: 7px 10px; border-radius: 8px;
  background: rgba(255,255,255,0.12); white-space: nowrap;
}
.topbar-link:hover { background: rgba(255,255,255,0.22); text-decoration: none; color: #fff; }

/* ---------- Tab-Navigation unten (Handy) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: var(--flaeche); border-top: 1px solid var(--linie);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 8px rgba(28,31,38,0.06);
}
.tabbar a {
  flex: 1; text-align: center; padding: 9px 2px 7px;
  color: var(--tinte-weich); font-size: 11px; line-height: 1.25;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 56px; justify-content: center;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--tief); font-weight: 600; }
.tabbar a.active .tab-icon { background: var(--tief-blass); }
.tab-icon {
  width: 40px; height: 26px; padding: 3px 0;
  display: block; border-radius: 13px; transition: background 0.15s;
  /* SVG-Symbole: nur Konturen, Farbe folgt der Textfarbe des Tabs */
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Seiteninhalt ---------- */
.page {
  max-width: 1100px; margin: 0 auto;
  padding: 18px 16px calc(84px + env(safe-area-inset-bottom));
}

h1 { font-size: 23px; margin: 0 0 4px; color: var(--tief); }
h2 { font-size: 19px; margin: 0 0 12px; color: var(--tief); }
h3 { font-size: 16px; margin: 0 0 10px; color: var(--tief); }
.untertitel { color: var(--tinte-weich); font-size: 14.5px; margin: 0 0 18px; }

.card {
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--schatten);
}
.card-titel {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.card-titel h2, .card-titel h3 { margin: 0; }

/* ---------- Kennzahlen ---------- */
.kennzahlen { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.kennzahl {
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 13px 14px; box-shadow: var(--schatten);
}
.kennzahl-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--tinte-weich); font-weight: 600; margin-bottom: 5px;
}
.kennzahl-wert { font-size: 25px; font-weight: 700; color: var(--tief); line-height: 1.15; }
.kennzahl-wert.positiv { color: var(--gruen); }
.kennzahl-wert.negativ { color: var(--rot); }
.kennzahl-zusatz { font-size: 12.5px; color: var(--tinte-weich); margin-top: 3px; }
.kennzahl.hervor { background: var(--tief); border-color: var(--tief); }
.kennzahl.hervor .kennzahl-label { color: rgba(255,255,255,0.75); }
.kennzahl.hervor .kennzahl-wert { color: #fff; }
.kennzahl.hervor .kennzahl-zusatz { color: rgba(255,255,255,0.8); }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; color: var(--tinte); }
label:first-child { margin-top: 0; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], select, textarea {
  width: 100%; padding: 12px 13px; font-size: 16px; /* 16px: kein iOS-Zoom */
  border: 1px solid var(--linie); border-radius: 10px;
  background: var(--flaeche); color: var(--tinte); font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--tief-hell);
  box-shadow: 0 0 0 3px rgba(46,79,143,0.14);
}
textarea { resize: vertical; min-height: 70px; }
.hilfetext { font-size: 12.5px; color: var(--tinte-weich); margin: 5px 0 0; }

.feldreihe { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.feldreihe input[type=checkbox] { width: 22px; height: 22px; margin: 0; flex-shrink: 0; }
.feldreihe label { margin: 0; font-weight: 500; }

.feldgruppe { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Wochentag-Auswahl als Pillen */
.tage-wahl { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.tage-wahl input { position: absolute; opacity: 0; pointer-events: none; }
.tage-wahl label {
  margin: 0; padding: 9px 13px; border: 1.5px solid var(--linie);
  border-radius: 20px; cursor: pointer; font-size: 14px; font-weight: 500;
  background: var(--flaeche); user-select: none; min-width: 48px; text-align: center;
}
.tage-wahl input:checked + label {
  background: var(--tief); color: #fff; border-color: var(--tief);
}

/* ---------- Wochentagszeilen im Arbeitszeitmodell ---------- */
.planzeile {
  border: 1.5px solid var(--linie); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 9px; background: var(--flaeche);
}
.planzeile.an { border-color: var(--tief); background: #fff; }
.planzeile-kopf { display: flex; align-items: center; gap: 9px; }
.planzeile-kopf label { margin: 0; font-weight: 600; cursor: pointer; flex: 1; }
.planzeile-kopf input[type="checkbox"] { width: 21px; height: 21px; flex-shrink: 0; }
.plan-summe { font-size: 13px; color: var(--tinte-weich); white-space: nowrap; }
.planzeile.an .plan-summe { color: var(--tief); font-weight: 600; }
/* Zeiten erst zeigen, wenn der Tag auch wirklich ein Arbeitstag ist */
.planzeile-felder { display: none; gap: 8px; margin-top: 9px; }
/* Auf dem Handy passen drei Felder nicht nebeneinander: Beginn und Ende
   teilen sich die Zeile, die Pause steht darunter ueber die volle Breite. */
.planzeile.an .planzeile-felder { display: grid; grid-template-columns: 1fr 1fr; }
.planzeile-felder > div:last-child { grid-column: 1 / -1; }
.planzeile-felder label { margin: 0 0 3px; }
.planzeile-felder input { margin: 0; }
@media (min-width: 560px) {
  .planzeile.an .planzeile-felder { grid-template-columns: 1fr 1fr 1fr; }
  .planzeile-felder > div:last-child { grid-column: auto; }
}

/* ---------- Schaltflächen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; font-size: 15px; font-weight: 600; border-radius: 10px;
  border: 1.5px solid transparent; cursor: pointer; font-family: inherit;
  min-height: 46px; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primaer { background: var(--tief); color: #fff; }
.btn-primaer:hover { background: var(--tief-hell); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.08); color: #fff; }
.btn-rand { background: var(--flaeche); color: var(--tief); border-color: var(--linie); }
.btn-rand:hover { background: var(--tief-blass); color: var(--tief); }
.btn-gefahr { background: var(--rot-blass); color: var(--rot); border-color: #F0C8C5; }
.btn-gefahr:hover { background: #F7DAD8; color: var(--rot); }
.btn-klein { padding: 7px 12px; font-size: 13px; min-height: 36px; }
.btn-breit { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-reihe .btn { flex: 1; min-width: 130px; }

/* ---------- Meldungen ---------- */
.meldungen { margin-bottom: 14px; }
.meldung {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 9px;
  font-size: 14.5px; border: 1px solid transparent;
}
.meldung-success { background: var(--gruen-blass); color: var(--gruen); border-color: #C6E6C8; }
.meldung-danger  { background: var(--rot-blass); color: var(--rot); border-color: #F0C8C5; }
.meldung-warning { background: var(--gelb-blass); color: #8A6100; border-color: #F2E0AE; }
.meldung-info    { background: var(--tief-blass); color: var(--tief); border-color: #CAD6EC; }

/* ---------- Abzeichen ---------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-urlaub { background: var(--gruen-blass); color: var(--gruen); }
.badge-krankheit { background: var(--rot-blass); color: var(--rot); }
.badge-zeitausgleich { background: var(--lila-blass); color: var(--lila); }
.badge-feiertag { background: var(--gold-blass); color: #8A6100; }
.badge-neutral { background: var(--tief-blass); color: var(--tief); }

/* ---------- Tagesliste (Zeiten) ---------- */
.tagzeile {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--linie); align-items: flex-start;
}
.tagzeile:last-child { border-bottom: none; }
.tagzeile.kein-arbeitstag { opacity: 0.55; }
/* Tage, die noch bevorstehen: sichtbar, aber zurueckgenommen */
.tagzeile.zukunft { opacity: 0.6; }
.tagzeile.zukunft .tagsoll { display: block; line-height: 1.3; }
.tagzeile.heute { background: var(--gold-blass); margin: 0 -16px; padding: 12px 16px; }
.tagdatum { flex-shrink: 0; width: 52px; text-align: center; }
.tagdatum .tagnr { font-size: 19px; font-weight: 700; color: var(--tief); line-height: 1.1; }
.tagdatum .tagwt { font-size: 11px; color: var(--tinte-weich); text-transform: uppercase; font-weight: 600; }
.taginhalt { flex: 1; min-width: 0; }
.tagzeiten { font-size: 14.5px; }
/* Sichtbarer Weg zum Korrigieren eines Eintrags - grosszuegige Tippflaeche */
.aendern {
  display: inline-block; font-size: 12.5px; white-space: nowrap;
  color: var(--tief); background: var(--tief-blass);
  border-radius: 20px; padding: 3px 10px; margin-left: 7px;
  text-decoration: none;
}
.aendern:hover { background: var(--tief); color: #fff; text-decoration: none; }
.tagsaldo { flex-shrink: 0; text-align: right; font-size: 14px; font-weight: 600; min-width: 62px; }
.tagsaldo.positiv { color: var(--gruen); }
.tagsaldo.negativ { color: var(--rot); }
.tagsaldo .tagsoll { font-size: 11.5px; color: var(--tinte-weich); font-weight: 400; display: block; }

/* ---------- Kalender ---------- */
.kalender { width: 100%; border-collapse: collapse; table-layout: fixed; }
.kalender th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--tinte-weich); padding: 7px 2px; font-weight: 700; text-align: center;
}
.kalender td {
  border: 1px solid var(--linie); vertical-align: top; padding: 0;
  height: 62px; width: 14.28%;
}
.ktag { padding: 4px 3px; height: 100%; display: flex; flex-direction: column; gap: 2px; }
.ktag-nr { font-size: 12.5px; font-weight: 600; color: var(--tinte); line-height: 1; }
.ktag.fremd { background: #FAFBFC; }
.ktag.fremd .ktag-nr { color: #BCC2CE; }
.ktag.heute { outline: 2px solid var(--gold); outline-offset: -2px; }
.ktag.feiertag { background: var(--gold-blass); }
.ktag.urlaub { background: var(--gruen-blass); }
.ktag.krankheit { background: var(--rot-blass); }
.ktag.zeitausgleich { background: var(--lila-blass); }
.ktag.arbeitstag-frei { background: #FCFCFD; }
.ktag-wert { font-size: 11px; font-weight: 700; color: var(--tief); line-height: 1.1; }
.ktag-mini { font-size: 9.5px; line-height: 1.15; color: var(--tinte-weich);
  overflow: hidden; text-overflow: ellipsis; }

.legende { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 12.5px; }
.legende span { display: flex; align-items: center; gap: 5px; color: var(--tinte-weich); }
.legende i { width: 13px; height: 13px; border-radius: 3px; display: inline-block;
  border: 1px solid var(--linie); }

/* ---------- Monatsnavigation ---------- */
.monatsnav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.monatsnav .titel { font-weight: 700; font-size: 17px; color: var(--tief); text-align: center; flex: 1; }
.monatsnav .btn { min-height: 42px; padding: 9px 15px; }

/* ---------- Tabellen ---------- */
table.daten { width: 100%; border-collapse: collapse; font-size: 14px; }
table.daten th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--tinte-weich); font-weight: 700;
  padding: 9px 8px; border-bottom: 2px solid var(--linie);
}
table.daten td { padding: 10px 8px; border-bottom: 1px solid var(--linie); }
table.daten tr:last-child td { border-bottom: none; }
.rechts { text-align: right; }
.positiv { color: var(--gruen); font-weight: 600; }
.negativ { color: var(--rot); font-weight: 600; }

/* ---------- Balken (Auswertung) ---------- */
.balken-zeile { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.balken-label { width: 74px; flex-shrink: 0; font-size: 13.5px; font-weight: 600; }
.balken-feld { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.balken { height: 11px; border-radius: 6px; background: var(--linie); position: relative; overflow: hidden; }
.balken i { display: block; height: 100%; border-radius: 6px; }
.balken.soll i { background: #AEB8CC; }
.balken.ist i { background: var(--tief); }
.balken-wert { flex-shrink: 0; width: 64px; text-align: right; font-size: 13px; font-weight: 600; }

/* ---------- Leerzustand ---------- */
.leer {
  text-align: center; padding: 28px 16px; color: var(--tinte-weich);
  font-size: 14.5px; background: var(--flaeche); border: 1px dashed var(--linie);
  border-radius: var(--radius);
}

/* ---------- Anmeldung ---------- */
.login-seite {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; background: var(--tief);
}
.login-box {
  background: var(--flaeche); border-radius: 16px; padding: 28px 24px;
  width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.22);
}
.login-wappen { text-align: center; margin-bottom: 16px; }
.login-wappen img { height: 84px; width: auto; }
.login-box h1 { text-align: center; font-size: 21px; margin-bottom: 4px; }
.login-box .untertitel { text-align: center; margin-bottom: 20px; font-size: 14px; }

/* ---------- Trenner & Kleintext ---------- */
hr.trenner { border: none; border-top: 1px solid var(--linie); margin: 18px 0; }
.klein { font-size: 12.5px; }
.weich { color: var(--tinte-weich); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Ab Tablet ---------- */
@media (min-width: 700px) {
  .kennzahlen { grid-template-columns: repeat(4, 1fr); }
  .page { padding: 24px 24px 40px; }
  h1 { font-size: 27px; }
  .kalender td { height: 84px; }
  .ktag-mini { font-size: 11px; }
  /* Navigation wandert nach oben in die Kopfzeile */
  .tabbar {
    position: static; border-top: none; box-shadow: none;
    background: transparent; max-width: 1100px; margin: 0 auto;
    padding: 0 24px; gap: 4px;
  }
  .tabbar a {
    flex: 0 0 auto; flex-direction: row; gap: 7px; font-size: 14px;
    padding: 10px 14px; border-radius: 10px; min-height: 0; color: rgba(255,255,255,0.88);
  }
  .tabbar a.active { background: var(--gold); color: #fff; }
  .tabbar a.active .tab-icon { background: transparent; }
  .tabbar a:hover { background: rgba(255,255,255,0.14); color: #fff; }
  .tabbar a.active:hover { background: var(--gold); }
  .tab-icon { width: 18px; height: 18px; padding: 0; background: transparent; }
  .tabbar-huelle { background: var(--tief); }
  .topbar { border-bottom: none; }
  .tabbar-huelle { border-bottom: 3px solid var(--gold); position: sticky; top: 56px; z-index: 49; }
}

@media (max-width: 699px) {
  .tabbar-huelle { display: contents; }
  .feldgruppe { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .tabbar, .tabbar-huelle, .btn, .monatsnav { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
