/* Corporate Design YR Richartz Garten GmbH: Lindgrün #81B445, Anthrazit #292929, Schriften Exo 2 + Merriweather */
@font-face { font-family: "Exo 2"; font-weight: 400; font-display: swap; src: url(fonts/exo-2-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-weight: 600; font-display: swap; src: url(fonts/exo-2-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-weight: 700; font-display: swap; src: url(fonts/exo-2-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Merriweather"; font-weight: 400; font-display: swap; src: url(fonts/merriweather-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Merriweather"; font-weight: 700; font-display: swap; src: url(fonts/merriweather-latin-700-normal.woff2) format("woff2"); }

:root {
  --lime: #81B445; --dark: #292929;
  --green: #4F7A23;          /* dunkles Markengrün für Text & Überschriften (gut lesbar auf Weiß) */
  --green-2: #81B445; --green-soft: #eef6e4;
  --bg: #f3f3f3; --card: #fff; --text: #292929; --muted: #5e5e5e; --line: #e4e4e4;
  --danger: #b3261e; --amber: #8a5a00; --amber-soft: #fff1d6; --blue: #1f5b8f; --blue-soft: #e3eef8;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* sonst überstimmen Klassen mit display:flex/grid das hidden-Attribut */
html, body { margin: 0; }
body { font: 16px/1.45 "Exo 2", "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); padding-bottom: 40px; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; background: var(--dark); color: #fff; border-bottom: 4px solid var(--lime); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.top-right { flex: none; }
.brand img { width: 40px; height: 40px; border-radius: 50%; background: #fff; object-fit: contain; flex: none; }
.brand-name { font-family: Merriweather, Georgia, serif; font-weight: 700; font-size: 16px; line-height: 1.1; white-space: nowrap; }
.brand-sub { display: block; font-family: "Exo 2", sans-serif; font-weight: 400; font-size: 12px; color: var(--lime); letter-spacing: .3px; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.15); white-space: nowrap; }
.badge.live { background: var(--lime); color: var(--dark); font-weight: 700; }
.badge.error { background: #ffd9d6; color: var(--danger); }

.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 60px; z-index: 9; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; padding: 12px 14px; border: 0; background: none; font: inherit; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--dark); border-bottom-color: var(--lime); font-weight: 700; }

main { max-width: 760px; margin: 0 auto; padding: 12px 16px; }
.view { display: none; }
.view.active { display: block; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
h2 { margin: 0 0 10px; font-size: 16px; color: var(--green); }
h2 small { color: var(--muted); font-weight: 400; font-size: 12px; }
.pad { padding: 0 4px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-2); border-color: transparent; }
input[readonly], fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--bg); }
input[type=checkbox] { width: auto; display: inline-block; margin: 0 6px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }

.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar input, .toolbar select { margin-top: 0; }
.toolbar .grow { flex: 1; margin: 0; }
.toolbar #me { max-width: 45%; }
.icon { padding: 10px 12px !important; }

.combo { position: relative; }
.dropdown { position: absolute; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 260px; overflow: auto; z-index: 70; }
.dropdown li { padding: 10px 12px; cursor: pointer; color: var(--text); }
.dropdown li small { display: block; color: var(--muted); }
.dropdown li:hover { background: var(--green-soft); }

/* Zeilen-Editoren */
.line { display: grid; gap: 6px; padding: 10px 0; border-top: 1px dashed var(--line); }
.line:first-child { border-top: 0; padding-top: 0; }
.line input, .line select { margin-top: 0; }
.line.labor { grid-template-columns: 2fr 1fr 1fr 1fr; }
.line .full { grid-column: 1 / -1; }
.line .sum { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.line .del { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0 0 0 8px; }
.mini { font-size: 12px; color: var(--muted); }

button { font: inherit; cursor: pointer; border-radius: 8px; }
button:disabled { opacity: .5; cursor: default; }
.add { border: 1px dashed var(--green-2); background: var(--green-soft); color: var(--green); padding: 8px 12px; margin: 6px 6px 0 0; }
.primary, .secondary, .ghost { padding: 12px 14px; border: 0; }
.primary { background: var(--lime); color: var(--dark); font-weight: 700; }
.primary:hover:not(:disabled) { background: #93c45a; }
.secondary { background: #fff; color: var(--green); border: 1px solid var(--green); }
.ghost { background: none; color: var(--muted); border: 1px solid var(--line); }
.danger { color: var(--danger); }
.small { padding: 6px 10px !important; font-size: 14px; }
.wide { width: 100%; margin-top: 8px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.actions .primary { grid-column: 1 / -1; }

.photo-btn { display: inline-block; padding: 10px 14px; background: var(--green-soft); color: var(--green); border-radius: 8px; cursor: pointer; font-size: 15px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin: 10px 0; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.photos button { position: absolute; top: 3px; right: 3px; border: 0; background: rgba(0,0,0,.6); color: #fff; width: 24px; height: 24px; border-radius: 50%; padding: 0; }

.sig { width: 100%; height: 160px; border: 1px solid var(--line); border-radius: 8px; background: repeating-linear-gradient(transparent 0 119px, var(--line) 119px 120px, transparent 120px); touch-action: none; display: block; margin-bottom: 10px; }

.totals table { width: 100%; border-collapse: collapse; }
.totals td { padding: 4px 0; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals tr.grand td { font-weight: 700; font-size: 18px; border-top: 2px solid var(--text); padding-top: 8px; }

/* Status */
.ln-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.status.s-in-arbeit { background: var(--amber-soft); color: var(--amber); }
.status.s-abgeschlossen, .status.s-erledigt { background: var(--blue-soft); color: var(--blue); }
.status.s-abgerechnet { background: var(--green-soft); color: var(--green); font-weight: 600; }

/* Listen */
.item { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item .meta { font-size: 13px; color: var(--muted); }
.item .side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 99px; color: var(--muted); }
.chips button.active { background: var(--lime); color: var(--dark); border-color: var(--lime); font-weight: 600; }
.job.done { opacity: .7; }
.tag { display: inline-block; font-size: 12px; background: var(--bg); border-radius: 6px; padding: 1px 6px; margin: 2px 4px 0 0; color: var(--muted); }

.bill-ln { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); }
.bill-ln .grow { flex: 1; }
.bill-sum { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }

.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 10px; }
.checks label { display: flex; align-items: center; color: var(--text); font-size: 15px; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 16px; border-radius: 10px; max-width: calc(100% - 32px); z-index: 90; white-space: pre-wrap; }
.toast.err { background: var(--danger); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 16px; z-index: 60; overflow-y: auto; }
.modal > .box { background: #fff; border-radius: var(--radius); padding: 16px; max-width: 640px; width: 100%; margin: auto 0; }
.modal pre { background: var(--bg); padding: 10px; border-radius: 8px; font-size: 12px; overflow: auto; max-height: 50vh; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.modal h3 { font-size: 14px; color: var(--green); margin: 14px 0 6px; }

/* Stufe 3: Vor Ort, Winterdienst, Sprache, Auswertung */
.actions .wide-btn { grid-column: 1 / -1; }
#checkins div { padding: 4px 0; border-top: 1px dashed var(--line); }
#checkins div:first-child { margin-top: 8px; }
#checkins a { color: var(--blue); }
.mic { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 2px 8px; font-size: 14px; margin-left: 4px; vertical-align: middle; }
.mic.listening { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.w-entry { display: grid; grid-template-columns: 1fr 2fr 2fr 1fr; gap: 6px; padding: 10px 0; border-top: 1px dashed var(--line); }
.w-entry:first-child { border-top: 0; padding-top: 0; }
.w-entry input, .w-entry select { margin-top: 0; }
.w-entry .full { grid-column: 1 / -1; }
.w-entry .half { grid-column: span 2; }
.w-entry .sum { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.w-entry .del { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.kpi .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--muted); }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 6px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 6px 7px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.good { color: var(--green); font-weight: 600; }
.bad { color: var(--danger); font-weight: 600; }
.bar { height: 6px; background: var(--bg); border-radius: 3px; margin-top: 3px; min-width: 60px; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--green-2); }

/* Kategorien: Pflege / Baustelle / Winterdienst */
:root { --c-pflege: #4F7A23; --c-pflege-bg: #eef6e4; --c-baustelle: #b86a00; --c-baustelle-bg: #fff1dc; --c-winter: #1f5b8f; --c-winter-bg: #e3eef8; }
.cat { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; flex: none; vertical-align: middle; }
.cat svg { width: 16px; height: 16px; }
.cat-pflege { color: var(--c-pflege); background: var(--c-pflege-bg); }
.cat-baustelle { color: var(--c-baustelle); background: var(--c-baustelle-bg); }
.cat-winter { color: var(--c-winter); background: var(--c-winter-bg); }
.cat.sm { width: 18px; height: 18px; }
.cat.sm svg { width: 12px; height: 12px; }
.job-title { display: flex; align-items: center; gap: 8px; }
.job.k-pflege { border-left: 5px solid var(--lime); }
.job.k-baustelle { border-left: 5px solid #e08a00; }
.job.k-winter { border-left: 5px solid #4a90d0; }
.job.planned { border-style: dashed; border-width: 1px 1px 1px 5px; border-color: var(--line); box-shadow: none; background: #fafafa; }

/* Kalender */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head h2 { margin: 0; font-family: Merriweather, Georgia, serif; color: var(--dark); font-size: 18px; text-align: center; flex: 1; }
.cal-tools { margin: 10px 0; }
.cal-tools #cal-me { flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-top: 6px; }
.cal-dow { font-size: 12px; color: var(--muted); text-align: center; font-weight: 600; padding: 2px 0; }
.cal-cell { min-height: 74px; border: 1px solid var(--line); border-radius: 8px; padding: 3px; background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; text-align: left; color: var(--text); overflow: hidden; }
.cal-cell.out { background: #f8f8f8; color: #aaa; }
.cal-cell.we { background: #fbfbf7; }
.cal-cell.today .cal-num { background: var(--dark); color: #fff; }
.cal-cell.sel { outline: 3px solid var(--lime); outline-offset: -1px; }
.cal-num { font-size: 12px; font-weight: 700; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; }
.cal-ev { display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; padding: 1px 3px; }
.cal-ev.k-pflege { background: var(--c-pflege-bg); }
.cal-ev.k-baustelle { background: var(--c-baustelle-bg); }
.cal-ev.k-winter { background: var(--c-winter-bg); }
.cal-ev.planned { background: none; border: 1px dashed var(--line); color: var(--muted); }
.cal-ev.done { opacity: .55; text-decoration: line-through; }
.cal-evs { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 3px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); align-items: center; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .pl { display: inline-block; width: 22px; height: 12px; border: 1px dashed #999; border-radius: 3px; }
.linkish { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--green); text-decoration: underline; font-size: 14px; }
.auth.setup .login-only { display: none; }
.pwreq { background: var(--amber-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
@media (max-width: 480px) {
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 52px; padding: 2px; }
  .cal-ev .t { display: none; }        /* auf dem Handy nur die Symbole */
  .cal-ev { padding: 0; background: none !important; border: 0 !important; justify-content: center; }
  .cal-ev.planned .cat { opacity: .5; outline: 1px dashed #999; }
  .cal-evs { flex-direction: row; flex-wrap: wrap; gap: 1px; }
}

/* Anmeldung & Rollen */
.top-right { display: flex; align-items: center; gap: 8px; }
.user-btn { border: 1px solid rgba(255,255,255,.5); background: none; color: #fff; padding: 4px 10px; border-radius: 99px; font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto;
  background: linear-gradient(rgba(41,41,41,.55), rgba(41,41,41,.75)), url(img/garten.jpg) center / cover no-repeat, var(--dark); }
.auth .box { background: #fff; border-radius: var(--radius); padding: 24px 20px; width: 100%; max-width: 380px; box-shadow: 0 8px 30px rgba(0,0,0,.3); border-top: 5px solid var(--lime); }
.auth h1 { margin: 0 0 2px; font-family: Merriweather, Georgia, serif; font-size: 20px; color: var(--dark); text-align: center; }
.auth .auth-logo { display: block; width: 110px; height: 110px; margin: 0 auto 8px; object-fit: contain; }
.auth .auth-sub { text-align: center; color: var(--green); font-weight: 600; margin: 0 0 6px; }
.auth #auth-intro { text-align: center; margin: 0 0 16px; }
.auth:not(.setup) .setup-only { display: none; }
body[data-role=kolonne] .office-only { display: none !important; }
body:not([data-role=admin]) .admin-only { display: none !important; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px dashed var(--line); }
.user-row:first-child { border-top: 0; }
.user-row.inactive { opacity: .55; }

@media (max-width: 480px) {
  .line.labor { grid-template-columns: 1fr 1fr 1fr; }
  .line.labor select.emp { grid-column: 1 / -1; }
  .line.gen { grid-template-columns: repeat(3, 1fr) !important; }
  .line.gen > .first { grid-column: 1 / -1; }
  .u-name { display: none; }
  .brand-name { font-size: 14px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar #day { flex: 1; }
  .toolbar #me { flex: 1 0 100%; max-width: none; }
  .w-entry { grid-template-columns: 1fr 1fr; }
  .w-entry .half { grid-column: 1 / -1; }
}
