/* AgroPlan — mobile-first (375px) */
* { box-sizing: border-box; }
:root {
  --green: #2e7d32; --green-dark: #1b5e20; --green-light: #e8f5e9;
  --bg: #f6f8f6; --card: #ffffff; --line: #dde5dd; --text: #1f2a1f; --muted: #6b7a6b;
  --red: #c62828; --orange: #ef6c00; --blue: #1565c0;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; }

.topbar { background: var(--green-dark); color: #fff; position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
.brand { font-size: 1.05rem; }
.brand-sub { opacity: .8; font-size: .85rem; }
.fb-toggle { background: #fff3; color: #fff; border: 1px solid #fff6; border-radius: 20px;
  padding: 7px 12px; cursor: pointer; font-size: .8rem; min-height: 36px; }
.fb-toggle.on { background: #ffb300; color: #222; border-color: #ffb300; font-weight: 700; }

.tabs { display: flex; overflow-x: auto; background: var(--green); }
.tab { flex: 1; min-width: 90px; background: none; border: none; color: #fffc; padding: 10px 8px;
  cursor: pointer; font-size: .9rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: #fff; font-weight: 700; border-bottom-color: #ffb300; }

main { max-width: 1000px; margin: 0 auto; padding: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
h2 { margin: 0 0 10px; font-size: 1.05rem; color: var(--green-dark); }
h3 { margin: 8px 0 6px; font-size: .95rem; }
.muted { color: var(--muted); font-weight: 400; font-size: .82rem; }
.hint { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }
.hidden { display: none !important; }

.tabpane { display: none; }
.tabpane.active { display: block; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .grid2, .grid3 { grid-template-columns: 1fr 1fr; } }

label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; padding: 6px 0; color: var(--text); }
input[type=number], select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: .95rem; background: #fff; color: var(--text); min-height: 40px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); flex-shrink: 0; }

.parcel-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.parcel-btn { background: var(--green-light); border: 1px solid var(--green); color: var(--green-dark);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: .85rem; text-align: left; min-height: 44px; }
.parcel-btn.sel { background: var(--green); color: #fff; }
.parcel-info { margin-top: 10px; background: #fffde7; border: 1px solid #f0e6a0; border-radius: 8px;
  padding: 10px; font-size: .84rem; }
.parcel-info table { border-collapse: collapse; margin: 6px 0; }
.parcel-info td, .parcel-info th { padding: 3px 10px 3px 0; text-align: left; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.num-table { border-collapse: collapse; width: 100%; font-size: .82rem; }
.num-table th, .num-table td { border: 1px solid var(--line); padding: 6px 7px; text-align: right; white-space: nowrap; }
.num-table th { background: var(--green-light); color: var(--green-dark); }
.num-table td:first-child, .num-table th:first-child { text-align: left; }
.num-table tr.total td { font-weight: 700; background: #f1f6f1; }
.val-neg { color: var(--green); }
.val-pos { color: var(--red); font-weight: 600; }
.val-missing { color: #bbb; }

.stage { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.stage-head { background: var(--green-light); padding: 8px 10px; display: flex; justify-content: space-between;
  align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-head b { color: var(--green-dark); }
.stage-when { font-size: .78rem; color: var(--muted); }
.stage-body { padding: 8px 10px; }
.fert-line { display: grid; grid-template-columns: minmax(140px, 2fr) 90px auto 34px; gap: 6px;
  align-items: center; margin-bottom: 6px; }
@media (max-width: 480px) { .fert-line { grid-template-columns: 1fr 80px auto 34px; } }
.fert-line .chips { font-size: .72rem; color: var(--muted); grid-column: 1 / -1; }
.chip { display: inline-block; background: #eef4ee; border-radius: 10px; padding: 1px 7px; margin: 1px 2px 1px 0; }
.chip.cost { background: #fff3e0; color: #a05a00; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px;
  cursor: pointer; font-size: .88rem; min-height: 40px; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.small { padding: 4px 9px; min-height: 30px; font-size: .8rem; }
.btn.danger { color: var(--red); }
.add-line { margin-top: 4px; }
.ziel-row { display: flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--muted); margin: 2px 0 8px; flex-wrap: wrap; }
.ziel-row select, .ziel-row input { width: auto; min-height: 32px; padding: 4px 6px; font-size: .8rem; }

.covbar { margin-bottom: 8px; }
.covbar .lbl { display: flex; justify-content: space-between; font-size: .78rem; margin-bottom: 2px; }
.covbar .track { background: #e8ede8; border-radius: 6px; height: 12px; overflow: hidden; }
.covbar .fill { height: 100%; border-radius: 6px; background: var(--green); transition: width .3s; }
.covbar.over .fill { background: var(--orange); }
.covbar.low .fill { background: var(--red); }
.covbar.surplus .track { background: #dcefdc; }

.totals-box { background: var(--green-light); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: .9rem; }

/* Feedback mode */
body.fb-mode [data-fb] { outline: 2px dashed #ffb300; outline-offset: 2px; cursor: pointer; border-radius: 4px; }
body.fb-mode [data-fb]:hover { background: #fff8e1; }
body.fb-mode .num-table td { cursor: pointer; }
body.fb-mode .num-table td:hover { background: #fff8e1; outline: 2px solid #ffb300; outline-offset: -2px; }
.fb-badge { display: inline-block; background: #ffb300; color: #222; font-size: .68rem; border-radius: 8px;
  padding: 0 5px; margin-left: 4px; font-weight: 700; vertical-align: middle; }

.fb-overlay { position: fixed; inset: 0; background: #0007; z-index: 100; display: flex;
  align-items: center; justify-content: center; padding: 16px; }
.fb-dialog { background: #fff; border-radius: 14px; padding: 16px; width: 100%; max-width: 440px; }
.fb-dialog h3 { margin: 0 0 8px; }
.fb-target, .fb-current { font-size: .84rem; margin: 4px 0; }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--green-dark);
  color: #fff; padding: 10px 18px; border-radius: 24px; z-index: 200; font-size: .9rem;
  box-shadow: 0 4px 14px #0004; }

footer { text-align: center; padding: 16px; font-size: .78rem; color: var(--muted); }
footer a { color: var(--green); }

@media print {
  .topbar, .no-print, footer, .fb-toggle, .parcel-btns, .add-line, .ziel-row, .fert-line button { display: none !important; }
  .card { border: none; page-break-inside: avoid; padding: 4px 0; }
  body { background: #fff; font-size: 12px; }
}
