/* Green Bloom Field: tylko jasny motyw (ADR-0007). Kolory jako tokeny, żeby ciemny dało się dodać później. */
:root {
  --bg: #fbf6ea; --panel: #fffdf7; --line: #dde3cf; --text: #1f3a1a; --muted: #66745c;
  --accent: #5e7f3a; --accent-ink: #ffffff; --accent-soft: #e8efd9;
  --rack: #e9edde; --steel: #c3cab9; --tray: #2f3436;
  --blackout: #3b3f46; --light: #f4d77a; --ready: #c9822e;
  --danger: #a3402f; --danger-soft: #f6e3de; --warn: #8a5a00;
  --shadow: 0 1px 2px #4a4a2a1f, 0 6px 20px #4a4a2a14;
  --radius: 14px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Lora, Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.2; }
h1 { font-size: 1.3rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.error { color: var(--danger); min-height: 1.2em; } .warn { color: var(--warn); }

.banner { background: #fff1c9; color: #5b4300; text-align: center; padding: 6px 16px; font-size: .85rem; border-bottom: 1px solid #ecd58a; }
.shell { max-width: 720px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.center { padding: 40vh 16px 0; text-align: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.center-card { margin: 10vh 16px 0; display: flex; flex-direction: column; gap: 10px; }
.center-card h1 { margin-top: 8px; }

label, .label { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: default; opacity: .55; }
.primary, .action, .danger { min-height: 44px; padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.primary { background: var(--accent); color: var(--accent-ink); }
.action { background: var(--accent-soft); color: var(--text); }
.action.primary { background: var(--accent); color: var(--accent-ink); }
.danger, .action.danger { background: var(--danger-soft); color: var(--danger); }
.link { background: none; color: var(--accent); padding: 6px 0; text-decoration: underline; }
.busy { position: relative; color: transparent !important; }
.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { background: none; width: 44px; height: 44px; border-radius: 50%; font-size: 1.1rem; color: var(--muted); flex: none; }
.pill { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.brand-sub { font-size: .75rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); z-index: 2; border-bottom: 1px solid var(--line); }
.top-right { text-align: right; }
.farm-name { font-weight: 600; font-size: .9rem; }

.content { flex: 1; padding: 16px 16px 96px; display: flex; flex-direction: column; gap: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }

/* regał */
.rack { background: var(--rack); border: 6px solid var(--steel); border-radius: 12px; padding: 4px; display: flex; flex-direction: column; gap: 4px; }
.rack.germination { background: #e4e2dc; }
.shelf { display: grid; grid-template-columns: 34px 1fr; gap: 4px; align-items: stretch; border-bottom: 4px solid var(--steel); padding-bottom: 4px; }
.shelf:last-child { border-bottom: 0; padding-bottom: 0; }
.shelf-label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.lamp { writing-mode: vertical-rl; transform: rotate(180deg); background: var(--light); color: #5b4300; border-radius: 6px; padding: 4px 1px; font-size: .62rem; letter-spacing: .05em; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.slot { position: relative; min-height: 96px; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; text-align: left; overflow: hidden; }
.slot.empty { background: #ffffff8c; border: 2px dashed var(--steel); justify-content: center; align-items: center; color: var(--muted); }
.slot-pos { position: absolute; top: 4px; left: 6px; font-size: .7rem; }
.slot-plus { font-size: 1.6rem; line-height: 1; color: var(--accent); }
.slot.taken { background: var(--tray); color: #fff; box-shadow: inset 0 -3px 0 #0003; }
.slot.stage-blackout { background: var(--blackout); }
.slot.stage-under_light { box-shadow: inset 0 3px 0 var(--light); }
.slot.stage-ready { box-shadow: inset 0 0 0 3px var(--ready); }
.slot-img { position: absolute; inset: 0; width: 100%; height: 62%; object-fit: cover; opacity: .9; }
.slot.stage-blackout .slot-img { filter: saturate(.3) brightness(.85); }
.slot-code, .slot-species, .slot-meta { position: relative; text-shadow: 0 1px 2px #000b; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-code { font-size: .68rem; opacity: .8; }
.slot-species { font-size: .76rem; font-weight: 700; }
.slot-meta { font-size: .66rem; opacity: .9; }

/* zakładki */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); z-index: 3; }
.tab { flex: 1; max-width: 220px; min-height: 52px; background: none; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tab.active { background: var(--accent-soft); color: var(--accent); }
.tab-count { font-size: .72rem; font-weight: 500; }

/* arkusz */
.backdrop { position: fixed; inset: 0; background: #1f3a1a59; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { background: var(--panel); width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.sheet-head p { font-size: .85rem; margin-top: 2px; }
@media (min-width: 720px) { .backdrop { align-items: center; } .sheet { border-radius: 18px; } }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 > div { display: flex; flex-direction: column; gap: 6px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fact { background: var(--bg); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.amount { display: grid; grid-template-columns: 1fr auto; gap: 6px; grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--text); }
.check input { width: 22px; min-height: 22px; height: 22px; flex: none; }
.species-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.species { background: var(--bg); border: 2px solid transparent; border-radius: 10px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; }
.species img { width: 52px; height: 40px; object-fit: contain; }
.species.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history li { display: grid; grid-template-columns: 110px 1fr; gap: 8px; font-size: .88rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.history time { color: var(--muted); }

/* magazyn */
.store { display: flex; flex-direction: column; gap: 12px; }
.store-group { display: flex; flex-direction: column; gap: 8px; }
.store-group .section-head { margin: 0; }
.tray-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tray-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tray-list li:last-child { border-bottom: 0; }
.tray-list .action { min-height: 38px; padding: 6px 12px; }
.code { font-weight: 600; font-variant-numeric: tabular-nums; }

/* powiadomienia */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 20; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 480px; font-size: .9rem; }
.toast.err { background: var(--danger); }
@media (prefers-reduced-motion: reduce) { .busy::after { animation: none; } }
