:root {
  color-scheme: light;
  --page: #f8f6f9;
  --surface: #fff;
  --ink: #302635;
  --muted: #665c6a;
  --border: #e5dce7;
  --accent: #704275;
  --accent-hover: #56325d;
  --sidebar: #251c2a;
  --sidebar-text: #efe4f0;
  --issue: #8b302d;
  --issue-bg: #f9e8e6;
  --winter: #394c70;
  --winter-bg: #edf0fa;
  --water: #22594c;
  --water-bg: #e7f2ed;
  --radius: 16px;
  --shadow: 0 2px 8px rgb(47 29 56 / 5%);
  font: 1rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--page); }
a { color: var(--accent-hover); text-underline-offset: .2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid #ae6cb4; outline-offset: 3px; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h1 { font-size: clamp(2rem, 4.4vw, 3rem); letter-spacing: -.045em; line-height: 1.08; font-weight: 720; }
h2 { font-size: 1.27rem; letter-spacing: -.023em; line-height: 1.25; }
h3 { font-size: 1.04rem; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
input:not([type=checkbox], [type=radio]), textarea, select {
  color: var(--ink); background-color: var(--surface); width: 100%; min-height: 2.75rem; border: 1px solid #d9cedc;
  border-radius: 8px; padding: .48rem .68rem; max-width: 100%; min-width: 0;
}
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); width: 1rem; height: 1rem; margin: 0 .35rem 0 0; vertical-align: -.15em; }
textarea { resize: vertical; }
label, legend { font-weight: 640; }
.field { display: grid; align-content: start; gap: .3rem; min-width: 0; }
.field > label { font-size: .9rem; }
.field:has(> input[type=checkbox]) { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.help, .secondary { color: var(--muted); font-size: .9rem; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.skip { position: fixed; top: -10rem; left: 1rem; z-index: 6; padding: .6rem; background: var(--surface); }
.skip:focus { top: 1rem; }
.sidebar {
  width: 15rem; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column;
  gap: 2.25rem; padding: 1.65rem 1.05rem; background: var(--sidebar); color: var(--sidebar-text); overflow: auto;
}
.brand, .login-brand { display: flex; align-items: center; gap: .7rem; font-weight: 750; font-size: 1.28rem; letter-spacing: -.035em; text-decoration: none; }
.sidebar .brand { padding-inline: .25rem; color: #fff; }
.brand-mark { flex: none; display: block; }
.brand small, .login-brand small { color: #d9b8da; font-weight: 550; font-size: .78rem; letter-spacing: 0; }
.navigation { display: flex; flex-direction: column; gap: .32rem; }
.navigation a { display: flex; align-items: center; gap: .62rem; color: var(--sidebar-text); text-decoration: none; border-radius: 9px; padding: .64rem .68rem; font-size: .95rem; white-space: nowrap; }
.navigation a span { min-width: 1.22rem; text-align: center; color: #dcb9db; }
.navigation a:hover { background: #382b3d; }
.navigation a[aria-current] { color: #fff; background: #4c3650; font-weight: 690; }
.account { border-top: 1px solid #57465c; color: var(--sidebar-text); display: flex; justify-content: space-between; gap: .5rem; align-items: center; margin-top: auto; padding: .8rem .25rem 0; font-size: .875rem; }
.account span { overflow-wrap: anywhere; }
.account button { color: inherit; background: transparent; border: 0; text-decoration: underline; }
.workspace { margin-left: 15rem; padding: clamp(1rem, 3.4vw, 3rem); max-width: 109rem; }
.app-footer { margin-top: 2.5rem; padding-top: .8rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.app-footer a { color: inherit; }
.login-workspace { min-height: 100svh; display: grid; place-content: center; padding: 1.25rem; background: radial-gradient(ellipse at 66% 28%, #704575, #251c2a 66%); }
.login-card { width: min(27rem, calc(100vw - 2.5rem)); padding: clamp(1.3rem, 5vw, 2.6rem); border-radius: 22px; color: var(--ink); background: var(--surface); box-shadow: 0 15px 55px #180f1c7a; }
.login-brand { margin-bottom: 2rem; }
.login-brand small { color: var(--accent); }
.login-card form { display: grid; gap: 1rem; }
.login-card form label { display: block; margin-bottom: .28rem; }
.hero { isolation: isolate; position: relative; overflow: hidden; min-height: 15rem; display: flex; align-items: center; padding: clamp(1.4rem, 4vw, 2.65rem); border-radius: 21px; color: #fff; background: radial-gradient(ellipse at 92% 5%, #945b97, transparent 54%), linear-gradient(120deg, #422b4a, #6b4371); margin-bottom: 1.25rem; }
.hero h1 { max-width: 17ch; }
.hero p { color: #f2e7f3; }
.hero-date { font-size: .93rem; margin-bottom: .65rem; }
.hero-flower { position: absolute; z-index: -1; right: clamp(-5rem, -5vw, 3rem); top: 50%; transform: translateY(-53%) rotate(-12deg); color: #fff1fc19; line-height: 1; font-size: clamp(15rem, 34vw, 34rem); user-select: none; pointer-events: none; }
.button {
  display: inline-flex; align-items: center; justify-content: center; padding: .54rem .85rem;
  min-height: 2.7rem; background: var(--surface); color: var(--accent-hover); border: 1px solid #dacbdd;
  border-radius: 9px; font-weight: 680; text-decoration: none; line-height: 1.2; font-size: .94rem;
}
.button:hover { background: #f3ebf4; }
.button.primary { background: var(--accent); color: #fff; border-color: transparent; }
.button.primary:hover { background: var(--accent-hover); color: #fff; }
.hero-button { margin-top: .5rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.metric, .panel, .table-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric { display: flex; flex-direction: column; justify-content: space-between; gap: .6rem; padding: 1.05rem 1.2rem; color: var(--ink); text-decoration: none; }
.metric:hover { border-color: #ba9abf; }
.metric span { color: var(--muted); font-weight: 580; font-size: .94rem; }
.metric strong { font-size: 2.15rem; font-weight: 730; line-height: 1.1; }
.metric.attention strong { color: var(--issue); }
.columns, .control-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.control-layout { grid-template-columns: minmax(16rem, .8fr) minmax(0, 1.2fr); }
.panel { padding: clamp(.95rem, 2.1vw, 1.35rem); }
.section-heading, .activity-row { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.section-heading h2, .section-heading p { margin-bottom: .3rem; }
.section-heading > a { font-size: .9rem; }
.activity-row, .timeline-item { padding: .76rem 0; border-top: 1px solid var(--border); }
.activity, .facts { margin: .75rem 0 0; }
.activity-row:first-child, .timeline-item:first-of-type { margin-top: .35rem; }
.timeline-item p { margin-block: .34rem; }
.activity-row:last-child { padding-bottom: 0; }
.plant-name { color: var(--ink); text-decoration-thickness: 1px; font-weight: 670; }
.plant-identity { display: flex; align-items: center; gap: .7rem; }
.plant-identity > div { min-width: 0; overflow-wrap: anywhere; }
.plant-control-heading, .plant-detail-heading { flex-wrap: wrap; }
.plant-preview {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 3.25rem; aspect-ratio: 1;
  overflow: hidden; background: #eeecef; border: 1px solid var(--border); border-radius: 8px;
}
.plant-preview::before { content: ""; width: 27%; height: 2px; background: #b5adb8; border-radius: 2px; }
.plant-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }
.plant-preview-dialog { width: clamp(4rem, 9vw, 7rem); }
.plant-preview-detail { width: clamp(6rem, 15vw, 11rem); aspect-ratio: 4 / 5; }
.plant-preview-detail img { object-fit: contain; }
.plant-identity .epa-button { margin-top: .35rem; }
.epa-button { white-space: nowrap; }
.pill { display: inline-flex; align-items: center; padding: .2rem .52rem; margin: .13rem 0; border-radius: 7px; background: #f2edf4; color: #523b58; font-size: .88rem; font-weight: 650; line-height: 1.3; }
.pill + .pill { margin-left: .22rem; }
.pill.issue { background: var(--issue-bg); color: var(--issue); }
.pill.winter { background: var(--winter-bg); color: var(--winter); }
.pill.water, .pill.development { background: var(--water-bg); color: var(--water); }
.scan-follow-up { margin-top: .75rem; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 10px; }
.scan-follow-up h3, .scan-follow-up ul { margin-bottom: 0; }
.scan-follow-up li:last-child { border-bottom: 0; }
.findings-follow-up { background: var(--issue-bg); border-color: #e1b6b1; border-inline-start: 4px solid var(--issue); }
.findings-follow-up h3 { color: var(--issue); }
.development-follow-up { background: #f4f8f6; }
.development-follow-up time { color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); margin: .5rem 0; }
.page-heading { margin-bottom: 1.3rem; }
.page-heading p { margin: .45rem 0 0; color: var(--muted); }
.plant-badge, .number { font-variant-numeric: tabular-nums; }
.plant-badge { color: var(--accent-hover); background: #f0e6f1; border-radius: 7px; padding: .15rem .52rem; display: inline-block; margin-bottom: .35rem; font-weight: 730; }
.messages { margin-bottom: 1rem; }
.message { background: #eee7f3; border-radius: 9px; color: #472a51; padding: .66rem .85rem; }
.message.error, .errorlist { color: var(--issue); background: var(--issue-bg); }
.message.success { color: var(--water); background: var(--water-bg); }
.message.warning { color: var(--issue); background: var(--issue-bg); }
.repeat-notice { border-left: .25rem solid var(--issue); padding-left: .9rem; margin-bottom: 1rem; }
.repeat-entry { margin-top: 1rem; }
.repeat-entry > summary { cursor: pointer; font-weight: 650; margin-bottom: .75rem; }
.revision-preview { padding: 1rem; border: 1px solid var(--border); border-radius: 9px; background: #f6f2f8; }
.errorlist { padding: .42rem .65rem .42rem 1.65rem; margin: .2rem 0; border-radius: 7px; }
.scan-entry { display: flex; align-items: flex-end; gap: .85rem; margin-bottom: 1rem; }
.scan-entry .field { flex: 1; }
.scan-entry input { letter-spacing: .015em; }
.facts { margin-bottom: 1rem; }
.facts > div { padding: .48rem 0; border-top: 1px solid var(--border); }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: .12rem 0 0; font-weight: 660; }
.compact-list { margin: .45rem 0 1rem; padding: 0; list-style: none; }
.compact-list li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr)); gap: .75rem; align-items: start; }
.filters .actions { grid-column: 1 / -1; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-top: .75rem; }
.result-count { margin: 1rem 0 .55rem; font-weight: 640; color: var(--muted); overflow-wrap: anywhere; }
.table-panel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .94rem; }
th, td { padding: .74rem .67rem; vertical-align: top; border-bottom: 1px solid var(--border); }
thead { background: #f1ebf3; }
thead th { font-size: .87rem; }
tbody tr:last-child > * { border-bottom: 0; }
.issue-row > th { border-left: 3px solid #af514d; }
.status-cell { min-width: 8rem; overflow-wrap: anywhere; }
.issue-reason + .issue-reason { margin-top: .24rem; }
.history-results, .form-stack { display: grid; gap: .8rem; }
.round-panel { margin-bottom: 1.25rem; }
.round-progress { margin-bottom: .8rem; }
.round-progress p { margin-bottom: .25rem; }
.round-progress progress { width: 100%; accent-color: var(--accent); }
.pagination { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
fieldset { border: 1px solid var(--border); margin: 0 0 .75rem; min-width: 0; border-radius: 9px; padding: .55rem .75rem .7rem; }
fieldset legend { padding-inline: .25rem; }
fieldset label:has(input) { display: inline-flex; align-items: center; min-height: 1.9rem; font-weight: 520; }
.nested { padding: .65rem; margin-top: .45rem; background: #faf6fb; border-radius: 8px; }
.nested .field { margin-top: .55rem; }
details summary { cursor: pointer; font-weight: 660; }
details[open] .field { margin-top: .6rem; }
.admin-panels { display: grid; gap: 1rem; }
.admin-panels .facts { margin-bottom: .7rem; }
.admin-panels .panel > .secondary:last-child { margin: 0; }
.admin-links a { display: block; padding: .5rem 0; }
@media (max-width: 1000px) {
  .sidebar { width: 12.75rem; }
  .workspace { margin-left: 12.75rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 740px) {
  .sidebar { position: static; width: auto; gap: .75rem; padding: .75rem; }
  .navigation { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.6rem, 1fr)); gap: .2rem; }
  .navigation a { font-size: .88rem; white-space: normal; padding: .45rem .4rem; gap: .26rem; }
  .account { padding-top: .38rem; }
  .workspace { margin-left: 0; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .scan-entry { align-items: stretch; flex-direction: column; }
  .section-heading { flex-wrap: wrap; }
}
.protocol-table { table-layout: fixed; }
.protocol-table th, .protocol-table td { vertical-align: top; overflow-wrap: anywhere; }
.protocol-table .number { white-space: nowrap; overflow-wrap: normal; }
.protocol-number { width: 14%; }
.protocol-name { width: 19%; }
.protocol-location { width: 12%; }
.protocol-water { width: 22%; }
.protocol-health { width: 33%; }
.protocol-state, .treatment-line { margin: .35em 0 0; }
.protocol-label, .protocol-counts { font-weight: 650; }
.protocol-demo { display: block; }
.protocol-finding { margin: 0 0 .35em; padding: .4em .55em; border-left: 3px solid; }
.protocol-finding:last-child { margin-bottom: 0; }
.protocol-finding-kind { font-size: .9em; font-weight: 650; }
.finding-active { color: #641c36; background: #fce8ed; border-color: #902947; }
.finding-observation { color: #61420f; background: #fff4db; border-color: #a46c17; }
.finding-resolved { color: #4a4650; background: #f4f3f5; border-color: #a6a1ab; }
.protocol-preview { display: block; width: 3rem; height: 2.3rem; margin: 0 0 .3em; object-fit: cover; border-radius: .2rem; }
@page {
  size: A4 portrait;
  margin: 11mm 10mm 13mm;
  @bottom-right { content: "Seite " counter(page) " / " counter(pages); color: #333; font: 8pt sans-serif; }
}
@media print {
  .sidebar, .no-print, .skip, .messages { display: none !important; }
  body.printing, .printing .workspace { margin: 0; padding: 0; color: #000; background: #fff; }
  .printing h1 { font-size: 21pt; }
  .printing .page-heading { margin-bottom: 4mm; }
  .protocol .page-heading p { margin: 1mm 0; font-size: 9pt; }
  .printing .table-panel { overflow: visible; border: 0; border-radius: 0; box-shadow: none; }
  .printing table { color: #000; font-size: 8pt; }
  .printing thead { display: table-header-group; background: #fff; }
  .printing th, .printing td { padding: 1.25mm 1.4mm; border: .3pt solid #555; }
  .printing thead th, .printing .pill, .printing .secondary { font-size: 8pt; color: #000; }
  .printing tr { break-inside: avoid; }
  .printing a { color: #000; text-decoration: none; }
  .printing .pill { background: #fff; padding: 0; }
  .printing .pill.issue::before { content: "Befund: "; white-space: pre; }
  .printing .issue-row > th { border: .3pt solid #555; }
  .protocol .protocol-finding { print-color-adjust: exact; }
  .protocol-monochrome .protocol-finding { background: #fff; border-color: #222; color: #000; }
  .protocol-monochrome .protocol-preview { filter: grayscale(1); }
}
