/* Stundenzettel-Portal – Galabau */
:root {
  --gruen: #2f5d34;
  --gruen-d: #234827;
  --gruen-h: #e7f0e4;
  --erde: #8a6a43;
  --bg: #f4f3ee;
  --card: #ffffff;
  --text: #1f2620;
  --muted: #6b7268;
  --line: #e2e2da;
  --rot: #b3261e;
  --rot-h: #fbe9e7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --tabbar-h: 64px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: var(--gruen); }
h1 { font-size: 1.5rem; margin: .4em 0 .6em; }
h2 { font-size: 1.15rem; margin: 0 0 .6em; }
h3 { font-size: 1rem; margin: 0 0 .5em; }
code { background: #eee; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.ico { width: 20px; height: 20px; flex: none; vertical-align: -4px; }

/* Layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 12px 14px; }
.wrap.narrow { max-width: 520px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--gruen); color: #fff;
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand img { background: #fff; border-radius: 7px; padding: 2px; }
.mainnav { display: none; margin-left: auto; gap: 4px; }
.mainnav a { color: #dfe9dc; text-decoration: none; padding: 8px 10px; border-radius: 8px; display: flex; gap: 6px; align-items: center; font-size: .92rem; }
.mainnav a:hover, .mainnav a.active { background: var(--gruen-d); color: #fff; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .72rem; }
.tabbar a.active { color: var(--gruen); font-weight: 600; }
.tabbar .ico { width: 24px; height: 24px; }
.tabbar .tab-plus .ico { background: var(--gruen); color: #fff; border-radius: 50%; width: 38px; height: 38px; padding: 8px; margin-top: -6px; box-shadow: 0 2px 6px rgba(47,93,52,.35); }

@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .mainnav { display: flex; }
  .tabbar { display: none; }
  .wrap { padding: 20px 24px; }
  .hide-desktop { display: none !important; }
}
@media (max-width: 899px) {
  .hide-mobile { display: none !important; }
}

/* Karten */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .btn { margin-top: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--gruen); color: #fff; border: 0; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px;
}
.btn:hover { background: var(--gruen-d); }
.btn-ghost { background: var(--gruen-h); color: var(--gruen-d); }
.btn-ghost:hover { background: #d8e7d3; }
.btn-danger { background: var(--rot-h); color: var(--rot); }
.btn-danger:hover { background: #f6d4d0; }
.btn-big { min-height: 52px; font-size: 1.05rem; padding: 12px 26px; }
.btn-block { width: 100%; }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: .85rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.4rem; text-decoration: none; }
.icon-btn:hover { background: var(--gruen-h); color: var(--gruen); }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); background: rgba(244,243,238,.92); backdrop-filter: blur(6px); padding: 10px 0; z-index: 5; }
.sticky-actions .btn-big { flex: 1; max-width: 320px; }
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }

/* Formulare */
.form label { display: block; font-size: .88rem; font-weight: 600; color: #3b443a; margin-bottom: 12px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .filterbar input, .filterbar select {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; color: var(--text);
  padding: 10px 12px; border: 1px solid #cfd2c8; border-radius: 10px; background: #fff; min-height: 46px;
}
.form textarea { min-height: 70px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--gruen); outline-offset: 0; border-color: var(--gruen); }
.form .check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.form .check input { width: 22px; height: 22px; accent-color: var(--gruen); }
.check-inline { align-self: end; min-height: 46px; }
.grid2, .grid3 { display: grid; gap: 0 12px; }
@media (min-width: 600px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr 1fr; }
  .span2 { grid-column: span 2; }
}
.grid-filter { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.grid-filter > label:first-of-type { grid-column: 1 / -1; }
@media (min-width: 900px) { .grid-filter { grid-template-columns: 2fr 1.2fr 1fr 1fr 1fr; } .grid-filter > label:first-of-type { grid-column: auto; } }
fieldset.neue-baustelle { border: 1px dashed var(--gruen); border-radius: 10px; padding: 10px 14px 2px; margin: 0 0 14px; background: #fafcf8; }
fieldset legend { font-weight: 700; color: var(--gruen); padding: 0 6px; }
.pw-row { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.pw-row input { margin-top: 0 !important; }
.filterbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filterbar input { flex: 2 1 220px; margin: 0; }
.filterbar select { flex: 1 1 140px; width: auto; margin: 0; }

/* Mitarbeiter-Zeilen */
.zeile { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fcfcfa; }
.zeile-top { display: flex; gap: 6px; align-items: center; }
.zeile-top select { margin-top: 0 !important; font-weight: 600 !important; }
.zeile-zeiten { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; margin-top: 8px; }
.zeile-zeiten label { margin: 0; font-size: .78rem; }
.zeile-zeiten input, .zeile-zeiten select { padding: 8px 6px !important; }
.zeile-std { font-weight: 700; color: var(--gruen); min-width: 64px; text-align: right; white-space: nowrap; }
.zeile-std.fehler { color: var(--rot); }

/* Stempeluhr */
.stempel { border-left: 6px solid var(--gruen); }
.stempel.st-pause { border-left-color: #d49a1f; background: #fffaf0; }
.stempel.st-fertig { border-left-color: var(--erde); background: #fbf7f1; }
.st-btn { width: 100%; min-height: 64px; border: 0; border-radius: 14px; font: inherit; font-size: 1.2rem; font-weight: 800; cursor: pointer; color: #fff; letter-spacing: .01em; }
.st-btn:disabled { opacity: .6; }
.st-start { background: var(--gruen); box-shadow: 0 3px 10px rgba(47,93,52,.3); }
.st-pause { background: #d49a1f; }
.st-weiter { background: var(--gruen); }
.st-stopp { background: var(--rot); }
.st-buttons { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 12px; }
.st-anzeige { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.st-status { font-weight: 800; text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; color: var(--gruen); }
.st-pause .st-status { color: #b07a0c; }
.st-fertig .st-status { color: var(--erde); }
.st-zeiten { font-size: .92rem; color: var(--muted); }
.st-uhr { font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.st-hinweis { margin: 10px 0 0; }
.st-verwerfen { background: none; border: 0; color: var(--muted); font: inherit; font-size: .8rem; text-decoration: underline; padding: 8px 0 0; cursor: pointer; }
.stempel-banner { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); border-left: 6px solid var(--gruen); }
.stempel-banner.st-pause { border-left-color: #d49a1f; }
.stempel-banner.st-fertig { border-left-color: var(--erde); }
.st-punkt { width: 14px; height: 14px; border-radius: 50%; background: var(--gruen); flex: none; animation: st-blink 1.6s infinite; }
.st-pause .st-punkt { background: #d49a1f; }
.st-fertig .st-punkt { background: var(--erde); animation: none; }
@keyframes st-blink { 50% { opacity: .25; } }

/* Material & Maschinen */
.position { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fbfaf6; }
.pos-top { display: flex; gap: 6px; align-items: center; }
.pos-top select { margin-top: 0 !important; }
.pos-frei input { margin-top: 8px !important; }
.pos-menge { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.pos-menge input { margin-top: 0 !important; max-width: 140px; }
.pos-einheit { font-weight: 700; color: var(--erde); min-width: 40px; }
.form label.mt { margin-top: 10px; }
.pos-liste { margin-top: 4px; font-size: .83rem; color: var(--erde); }
.pos-liste div { white-space: nowrap; }

/* Meldungen */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 500; }
.flash-ok { background: #e3f1df; color: #1f4f24; }
.flash-err { background: var(--rot-h); color: var(--rot); }

/* Übersicht */
.monatsnav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; }
.stat-val { font-size: 1.5rem; font-weight: 700; color: var(--gruen); }
.stat-lbl { font-size: .8rem; color: var(--muted); }
.segmented { display: inline-flex; background: #e6e6de; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.segmented a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; }
.segmented a.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.tag-head { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 4px 8px; }
.einsatz-card { display: block; text-decoration: none; color: inherit; position: relative; padding-right: 40px; }
.einsatz-card:hover { box-shadow: 0 0 0 2px var(--gruen-h), var(--shadow); }
.ec-top { display: flex; justify-content: space-between; gap: 10px; }
.ec-top .muted { display: block; font-size: .85rem; }
.ec-std { font-weight: 700; color: var(--gruen); white-space: nowrap; }
.ec-text { margin: 6px 0; font-size: .93rem; }
.ec-team { display: flex; flex-wrap: wrap; gap: 6px; }
.ec-edit { position: absolute; right: 12px; top: 14px; color: var(--muted); }
.chip { background: #f0f0ea; border-radius: 20px; padding: 3px 10px; font-size: .8rem; }
.chip-me { background: var(--gruen-h); color: var(--gruen-d); font-weight: 600; }
.badge { display: inline-block; background: var(--gruen-h); color: var(--gruen-d); border-radius: 20px; padding: 3px 10px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.badge-grey { background: #ececec; color: #666; }
.badge-big { font-size: 1.05rem; padding: 6px 14px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--line); padding: 8px; }
.tbl td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: top; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--text); border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl-compact td { padding: 6px 8px; }
.tbl tr.inaktiv td { color: var(--muted); }
.tbl tr.tag-ende td { border-bottom-color: #c9cbc2; }
.tbl tr.geld td { color: var(--gruen-d); border-top: 0; }
.material { margin-top: 4px; font-size: .83rem; color: var(--erde); }
.link-plain { color: inherit; text-decoration: none; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.danger-zone { margin: 28px 0 10px; padding-top: 16px; border-top: 1px dashed #d4d4cc; }
.baustelle-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.baustelle-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.menu-list .card { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); font-weight: 600; padding: 18px 16px; margin-bottom: 10px; }
.menu-list .ico { color: var(--gruen); }

/* Tabellen auf dem Handy als Karten */
.mobile-only { display: none; }
@media screen and (max-width: 699px) {
  .mobile-only { display: inline; }
  .tbl-stack thead { display: none; }
  .tbl-stack, .tbl-stack tbody, .tbl-stack tfoot { display: block; width: 100%; }
  .tbl-stack tbody tr {
    display: grid; grid-template-columns: 1fr auto; column-gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--line);
  }
  .tbl-stack tbody td { border: 0; padding: 1px 0; text-align: left; white-space: normal; }
  .tbl-stack tbody td.c-kopf { grid-column: 1; font-weight: 700; }
  .tbl-stack tbody td.c-wert { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; color: var(--gruen-d); white-space: nowrap; }
  .tbl-stack tbody td.c-sub { grid-column: 1; color: var(--muted); font-size: .85rem; }
  .tbl-stack tbody td.c-sub2 { grid-column: 1; color: var(--muted); font-size: .85rem; }
  .tbl-stack tbody td.c-wert2 { grid-column: 2; text-align: right; white-space: nowrap; font-weight: 600; }
  .tbl-stack tbody td.c-voll { grid-column: 1 / -1; }
  .tbl-stack tbody td.c-ma { margin-top: 4px; color: var(--muted); }
  .tbl-stack tbody td.c-tag { grid-column: 1 / -1; text-align: right; font-size: .85rem; }
  .tbl-stack tbody td.c-tag:empty { display: none; }
  .tbl-stack tbody td.hide-mobile { display: none; }
  .tbl-stack tbody td .nowrap { white-space: normal; }
  .tbl-stack tfoot tr { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
  .tbl-stack tfoot tr:first-child { border-top: 2px solid var(--text); }
  .tbl-stack tfoot td { border: 0; padding: 0; }
  .tbl-stack tfoot td:empty { display: none; }
  .tbl-stack tfoot td.num { white-space: nowrap; }
  /* Mitarbeiter-Detail: Zeit + Pause nebeneinander */
  .stack-ma tbody td.c-sub { grid-column: 1; }
  .stack-ma tbody td.c-sub2 { grid-column: 2; text-align: right; }
  .stack-ma tbody tr.tag-ende { border-bottom: 2px solid #c9cbc2; }
  .hide-mobile-inline { display: none; }
  .stack-pos tbody td.c-kopf { grid-row: 1; }
  .stack-pos tbody td.c-wert { grid-row: 1; }
  .stack-pos tbody td.c-sub { grid-row: 2; grid-column: 1; }
  .stack-pos tbody td.c-sub2 { grid-row: 3; grid-column: 1; text-align: left; }
  .stack-pos tbody td.c-wert2 { grid-row: 3; grid-column: 2; }
  .stack-sum tbody td.c-sub, .stack-sum tbody td.c-sub2 { text-align: left; }
  .card-head { flex-wrap: wrap; }
  .filter .actions .btn { flex: 1 1 auto; }
}

/* App-Installation */
.install-banner { display: flex; align-items: center; gap: 12px; border: 1px solid var(--gruen-h); }
.install-banner img { border-radius: 11px; flex: none; }
.ib-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ib-actions { display: flex; align-items: center; gap: 4px; }

/* Login */
.login { max-width: 420px; margin: 6vh auto 0; }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo h1 { margin: 10px 0 0; font-size: 1.35rem; }
.login-logo p { margin: 2px 0 0; }
.login .btn-big { width: 100%; }

/* Druck */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 15mm 14mm; }
  body { background: #fff; padding: 0; font-size: 10pt; }
  .no-print, .topbar, .tabbar, .flash, .screen-only { display: none !important; }
  .print-only { display: block; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; padding: 0; margin-bottom: 10pt; border-radius: 0; }
  .table-wrap { overflow: visible; }
  .tbl { font-size: 9pt; }
  .tbl th { color: #000; }
  .tbl td { padding: 4pt 5pt; }
  .hide-mobile { display: table-cell !important; }
  a { color: inherit; text-decoration: none; }
  .badge { background: none; padding: 0; color: #000; }
  .page-break + .page-break, .report + .page-break { break-before: page; }
  tr { break-inside: avoid; }
  .druckkopf { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.5pt solid var(--gruen); padding-bottom: 6pt; margin-bottom: 12pt; }
  .dk-firma { font-size: 8.5pt; color: #333; }
  .dk-firma strong { font-size: 11pt; color: var(--gruen); }
  .dk-titel { text-align: right; }
  .dk-titel h2 { margin: 0; font-size: 13pt; }
  .anschrift { margin: 6pt 0 18pt; font-size: 10.5pt; min-height: 25mm; }
  .unterschriften { display: flex; gap: 20mm; margin-top: 22mm; }
  .unterschriften div { flex: 1; border-top: .8pt solid #000; padding-top: 3pt; font-size: 8.5pt; }
  .report-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; }
}
