:root {
  --primary: #2F6B3A; --primary-dark: #1F4A28; --light: #9BCB6B; --ground: #F6F3E8; --accent: #E8833A; --text: #2E2A24;
  --muted: #5A5347; --line: #E4DFD0; --card: #FFFFFF; --soft: #EEF5E6;
  --ok-bg: #DCEFD6; --ok-fg: #1D4A25; --beob-bg: #FBEFC5; --beob-fg: #5C4507; --over-bg: #FBDDC8; --over-fg: #7A3410;
  --krit: #B3261E; --krit-bg: #F6D3D1; --krit-fg: #7D1A14; --note: #3A6EA5;
  --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45;
  padding-top: env(safe-area-inset-top); }
a { color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 800; margin-top: 8px; }
h4 { font-size: 15px; margin: 10px 0 2px; }
p { margin: 0 0 8px; }
small { display: block; color: var(--muted); font-size: 13px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

main#view { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
body.focus-mode .tabbar { display: none; }
body.focus-mode main#view { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }

.top { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.top h1 { flex: 1; font-size: 24px; }
.top.home h1 { font-size: 30px; }
.top .grow, .top.home > div { flex: 1; }
.sub { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.logo-tile { width: 48px; height: 48px; border-radius: 14px; background: var(--primary); display: grid; place-items: center; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn svg, .tabbar svg, .btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn.flip svg { transform: scaleX(-1); }

.card { background: var(--card); border-radius: var(--r-lg); padding: 16px; box-shadow: 0 1px 2px rgba(46, 42, 36, .07); display: flex; flex-direction: column; gap: 10px; border: 0; text-align: left; font: inherit; color: inherit; }
.card.warn { background: #FFF4E8; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-head .right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.list { padding: 2px 14px; gap: 0; }
.list .listrow + .listrow { border-top: 1px solid #EDE8DA; }
.listrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.listrow.col { flex-direction: column; align-items: flex-start; }
.listrow img { max-height: 160px; border-radius: var(--r-sm); }
.pad { padding: 4px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.big { font-size: 30px; font-weight: 800; margin: 2px 0 0; }
.small-h { font-size: 15px; color: var(--muted); }
.lead { font-size: 16px; color: #4A443B; }
.note { background: var(--card); border-radius: var(--r-md); padding: 10px 14px; margin: 0; }
.hint { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0; }
.hint.warn { background: #FFF4E8; color: #5A2A0C; }
.txt-accent { color: var(--primary); font-weight: 800; font-size: 14px; white-space: nowrap; }
.txt-over { color: var(--over-fg); font-weight: 800; font-size: 14px; white-space: nowrap; }
.txt-krit { color: var(--krit); }
.tag { font-size: 12px; font-weight: 700; color: var(--primary-dark); background: var(--soft); padding: 2px 7px; border-radius: 999px; }

.btn { font: inherit; font-weight: 800; font-size: 15px; min-height: 48px; padding: 0 18px; border-radius: var(--r-md); border: 0; background: var(--primary); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: #EDE8DA; color: var(--text); }
.btn-small { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.btn-alert { background: #fff; color: var(--krit); box-shadow: inset 0 0 0 2px var(--krit); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btnrow.end { justify-content: flex-end; }
.btnrow.tight { gap: 6px; justify-content: flex-end; }
.danger { margin-top: 12px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 999px; background: #fff; color: var(--text); border: 0; white-space: nowrap; }
button.chip { cursor: pointer; min-height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.filter .chip { border: 1px solid #CFC8B6; }
.chips.filter .chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.st-ok { background: var(--ok-bg); color: var(--ok-fg); }
.st-beob { background: var(--beob-bg); color: var(--beob-fg); }
.st-over { background: var(--over-bg); color: var(--over-fg); }
.st-krit { background: var(--krit-bg); color: var(--krit-fg); }
.st-skip { background: #EDE8DA; color: var(--muted); }
.chip.cur { background: var(--primary); color: #fff; }

.banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--soft); border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; }
.empty { text-align: center; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); }

.daily-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); background: var(--ground); }
.daily-row.done { background: var(--soft); }
.daily-row b { display: block; }
.daily-row > div:first-child { flex: 1; min-width: 0; }
.daily-row .btnrow { flex-wrap: nowrap; }
label.check > span { display: block; }

.rowcard, .rowlink { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px; padding: 12px 14px; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(46, 42, 36, .07); border: 0; font: inherit; text-align: left; width: 100%; cursor: pointer; }
.rowlink { box-shadow: none; padding: 6px 0; background: none; }
.rowcard .grow { flex: 1; min-width: 0; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: #D8D2C2; }
.avatar-empty { display: grid; place-items: center; font-weight: 800; color: var(--muted); font-size: 18px; }

.profile { display: flex; gap: 16px; align-items: center; }
.profile .avatar { border: 3px solid var(--light); }
.statusbtn { margin-top: 8px; background: none; border: 0; padding: 0; text-align: left; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.notecard img, .evcard img { max-height: 180px; border-radius: var(--r-sm); margin-top: 6px; }
.histcard p { margin: 0; }

.chart { width: 100%; height: auto; }
.ch-line { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--primary); }
.ch-last { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.ch-norm { stroke: var(--light); stroke-width: 1.5; stroke-dasharray: 4 4; }
.ch-label { font-size: 11px; fill: #3F6B2A; font-family: var(--font); }
.ch-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

details.info { background: var(--soft); border-radius: var(--r-md); padding: 10px 14px; }
details.card.info { background: var(--card); }
details.info summary { font-weight: 800; color: var(--primary-dark); cursor: pointer; min-height: 28px; display: flex; align-items: center; }
details.info p, details.info li { font-size: 15px; }
details.info ul { padding-left: 20px; margin: 6px 0; }
.src { font-size: 14px; }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
input, select, textarea { font: inherit; font-size: 16px; font-weight: 400; padding: 10px 12px; border-radius: 12px; border: 1px solid #CFC8B6; background: #FFFDF7; color: var(--text); min-height: 44px; width: 100%; }
textarea { resize: vertical; }
input.num { width: 72px; display: inline-block; min-height: 36px; padding: 4px 8px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; min-height: 36px; }
label.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--primary); flex: none; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
legend { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.seg-field { flex-direction: row; flex-wrap: wrap; gap: 16px; }
.seg-field.col { flex-direction: column; gap: 6px; }
.seg-field label { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.seg-field input { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.photofield { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.photofield img { max-height: 180px; border-radius: var(--r-md); }
.photofield label.btn { flex-direction: row; font-size: 15px; }

.seg { display: inline-flex; background: #EDE8DA; border-radius: 12px; padding: 3px; align-self: flex-start; }
.seg button { font: inherit; font-weight: 700; border: 0; background: transparent; padding: 8px 16px; border-radius: 10px; cursor: pointer; min-height: 40px; }
.seg button.on { background: #fff; }

/* Interview & Check */
.progress { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.progress span { height: 6px; border-radius: 999px; background: var(--line); }
.progress span.done { background: var(--primary); }
.progress span.cur { background: var(--accent); }
.iv { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.q { font-size: 26px; text-align: center; }
.q2 { font-size: 20px; text-align: center; margin-top: 8px; }
.iv > .lead { text-align: center; }
.choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice button { font: inherit; font-size: 17px; font-weight: 800; min-height: 60px; border-radius: 18px; border: 2px solid #CFC8B6; background: #fff; color: var(--text); cursor: pointer; padding: 6px; }
.choice button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.choice button.alert { border-color: var(--krit); color: var(--krit); }
.choice button.alert.on { background: var(--krit); color: #fff; }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.checkcard .pointname { font-size: 26px; }

/* Kalender */
.calnav { display: flex; align-items: center; justify-content: space-between; }
.cal { padding: 14px 8px; }
.cal .wd, .cal .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.cal .wd span { font-size: 12px; font-weight: 800; color: var(--muted); padding-bottom: 4px; }
.day { height: 48px; border: 2px solid transparent; background: none; border-radius: 12px; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text); padding: 0; }
.day span { font-size: 15px; font-weight: 600; }
.day i { display: flex; gap: 2px; height: 6px; }
.day.today { border-color: var(--primary); }
.day.today span { font-weight: 800; }
.day.sel { background: var(--primary); color: #fff; }
.day.sel .dot { outline: 1.5px solid #fff; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.d-c { background: var(--light); } .d-a { background: var(--krit); } .d-n { background: var(--note); } .d-g { background: var(--primary); } .d-t { background: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; font-size: 12px; color: var(--muted); padding-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend .dot { width: 8px; height: 8px; }
.evcard { flex-direction: row; align-items: flex-start; gap: 10px; cursor: default; }
button.evcard { cursor: pointer; }
.evcard .dot { width: 10px; height: 10px; margin-top: 6px; }

/* Tabbar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.tabbar a.active { color: var(--primary); font-weight: 800; }

/* Sheet & Toast */
dialog#sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px; max-height: 88vh; border-radius: 22px 22px 0 0; background: var(--ground); color: var(--text); }
dialog#sheet::backdrop { background: rgba(46, 42, 36, .45); }
.sheet-inner { padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; z-index: 20; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (min-width: 700px) { dialog#sheet { margin: auto; border-radius: 22px; } }
.btn.txt-krit { color: var(--krit); }
