/* Green Bloom Studio — desktop, tylko jasny motyw (ADR-0007). Te same tokeny co Field. */
:root {
  --bg: #fbf6ea; --panel: #fffdf7; --panel-2: #f6f1e3; --line: #dde3cf; --line-2: #cbd3bb;
  --text: #1f3a1a; --muted: #5d6b53; --accent: #4f7a34; --accent-ink: #ffffff; --accent-soft: #e8efd9;
  --blackout: #34383f; --light: #f4d77a; --ready: #b86f12; --water: #2f6fa5;
  --danger: #a3402f; --danger-soft: #f6e3de; --warn: #8a5a00; --warn-soft: #fff1c9; --ok-soft: #e3efd5;
  --shadow: 0 1px 2px #4a4a2a14, 0 4px 14px #4a4a2a0f;
  --radius: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Lora, Georgia, "Times New Roman", serif;
  --side-w: 232px; --ctx-w: 380px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
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.5rem; } h2 { font-size: 1.1rem; } h3 { font-size: .95rem; margin: 0 0 6px; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: .82rem; } .block { display: block; }
.error { color: var(--danger); min-height: 1.1em; font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; }

.banner { background: var(--warn-soft); color: #5b4300; text-align: center; padding: 5px 16px; font-size: .8rem; border-bottom: 1px solid #ecd58a; }
.center { padding: 30vh 16px 0; text-align: center; }

/* przyciski i pola */
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: .5; }
.primary, .action, .danger { min-height: 36px; padding: 7px 14px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover:not(:disabled) { background: #436a2b; }
.action { background: var(--accent-soft); color: var(--text); border: 1px solid var(--line); }
.action:hover:not(:disabled) { border-color: var(--accent); }
.action.small { min-height: 28px; padding: 3px 10px; font-size: .8rem; }
.danger { background: var(--danger-soft); color: var(--danger); }
.link { color: var(--accent); text-decoration: underline; padding: 2px 0; text-align: left; }
.link.current { font-weight: 700; text-decoration: none; color: var(--text); }
.danger-link { color: var(--danger); }
.busy { opacity: .6; cursor: progress; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--panel-2); }
input, select, textarea { min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; width: 100%; }
textarea { resize: vertical; }
label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hint { font-size: .75rem; color: var(--muted); }

/* logowanie */
.login-wrap { min-height: 90vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(400px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 28px; }
.login-logo { width: 56px; height: 56px; }

/* układ: nawigacja | praca | panel */
.studio { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.studio.with-panel { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--ctx-w); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.side-brand img { width: 36px; height: 36px; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.brand-sub { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.side-group { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 500; }
.side-link:hover { background: var(--panel-2); }
.side-link.on { background: var(--accent-soft); color: #23461a; font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.side-icon { width: 18px; text-align: center; color: var(--accent); }
.side-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.farm-name { font-weight: 700; }

.center-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 16px 24px 12px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.question { margin-top: 2px; }
.top-tools { display: flex; gap: 8px; align-items: center; }
.search-box { position: relative; width: 300px; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 10; }
.search-results:empty { display: none; }
.search-hit { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.search-hit:hover, .search-hit:focus-visible { background: var(--accent-soft); }
.search-none { padding: 8px 12px; }
.work { padding: 18px 24px 48px; outline: none; }

.context { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 16px; display: none; }
.with-panel .context { display: block; }
.ctx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ctx-head h2 { font-size: 1.5rem; }
.ctx-sec { padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: 1fr; gap: 4px; margin: 0; }
.fact { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.fact dt { color: var(--muted); font-size: .82rem; }
.fact dd { margin: 0; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 6px; font-size: .82rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -17px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tl-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo { display: flex; flex-direction: column; font-size: .72rem; color: var(--muted); text-decoration: none; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* karty, liczby, siatki */
.stack { display: flex; flex-direction: column; gap: 16px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-title { font-size: 1.05rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stats.compact .stat { background: var(--panel-2); box-shadow: none; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 2px; }
.stats.compact .stat-value { font-size: 1.2rem; }
.stat-note { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.stat.warn { border-color: #e6c46f; background: var(--warn-soft); }
.stat.warn .stat-value { color: #6b4500; }
.stat.good .stat-value { color: var(--accent); }
.stat.muted .stat-value { color: var(--muted); }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); border: 1px solid #ecd58a; color: #4d3a00; margin-bottom: 14px; }
.notice.ok { background: var(--ok-soft); border-color: #c4d9ab; color: #23461a; margin: 0; }
.notice.warn { margin: 0; }
.notice.err { background: var(--danger-soft); border-color: #e7b9ae; color: var(--danger); }
.empty { color: var(--muted); padding: 8px 0; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 180px; }

/* przegląd */
.layout-overview { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-side { position: sticky; top: 88px; }
.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.att-btn { display: flex; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 9px; align-items: flex-start; }
button.att-btn:hover { background: var(--panel-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.dot.crit { background: var(--danger); } .dot.warn { background: #c98a12; } .dot.info { background: var(--accent); }
.week { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.day { background: var(--panel-2); border-radius: 9px; padding: 6px; min-height: 96px; display: flex; flex-direction: column; gap: 4px; border: 1px solid transparent; }
.day.today { border-color: var(--accent); background: var(--accent-soft); }
.day-head { display: flex; flex-direction: column; font-size: .75rem; font-weight: 600; }
.day-item { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 3px 5px; text-align: left; display: flex; flex-direction: column; font-size: .72rem; line-height: 1.2; }
.day-item:hover { border-color: var(--accent); }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

/* znaczki */
.badge { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.st-blackout { background: #e4e5e8; color: #2b2e33; }
.st-under_light { background: #fbefc4; color: #5b4300; }
.st-ready { background: #f8dfbd; color: #6d3f00; }
.st-harvested, .st-clean { background: var(--ok-soft); color: #23461a; }
.st-aborted { background: var(--danger-soft); color: #8a2f20; }
.st-ordered { background: #e1ebf5; color: #1f4d78; }
.st-dirty { background: #efe6d6; color: #5e4520; }
.st-forecast { background: #ece4f6; color: #4b3278; }

/* tabele */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.grid th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line-2); padding: 0; white-space: nowrap; }
.th-btn { padding: 7px 8px; font-weight: 600; width: 100%; text-align: inherit; color: inherit; }
table.grid td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid .num { text-align: right; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td, table.grid tr.clickable:focus-visible td { background: var(--accent-soft); }
table.grid tr.retired td { color: var(--muted); }
.row-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.sp-img { width: 32px; height: 32px; object-fit: contain; display: block; }

/* regały */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid #0002; }
.racks { display: grid; grid-template-columns: repeat(auto-fit, minmax(520px, 1fr)); gap: 16px; align-items: start; }
.rack-head { display: flex; justify-content: space-between; align-items: baseline; }
.rack-grid { background: #e9edde; border: 5px solid #c3cab9; border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 4px; }
.rack-grid.germ { background: #dedcd5; }
.rshelf { display: grid; grid-template-columns: 70px 1fr; gap: 6px; padding: 4px; border-bottom: 4px solid #c3cab9; }
.rshelf:last-child { border-bottom: 0; }
.rshelf.lit .rslots { background: linear-gradient(#fff2c480, transparent 55%); border-radius: 8px; }
.rshelf.lit.off .rslots { background: none; }
.rshelf-label { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; justify-content: center; }
.lamp { font-size: .72rem; border-radius: 999px; padding: 2px 8px; font-weight: 600; border: 1px solid var(--line-2); background: #fff; }
.lamp.on { background: var(--light); border-color: #d9b850; color: #4d3a00; }
.lamp.off { background: #3a3d43; color: #f2f2f2; border-color: #3a3d43; }
.rslots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.slot { position: relative; min-height: 86px; border-radius: 9px; padding: 6px 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; border: 1px solid #0000001f; line-height: 1.2; }
button.slot:hover { outline: 2px solid var(--accent); }
.slot-free, .sw.slot-free { background: repeating-linear-gradient(45deg, #f7f5ee, #f7f5ee 6px, #efece2 6px, #efece2 12px); color: var(--muted); }
.slot-pos { font-size: .72rem; }
.slot-blackout, .sw.slot-blackout { background: var(--blackout); color: #f4f4f4; }
.slot-under_light, .sw.slot-under_light { background: #fff6d8; color: var(--text); border-color: #e2cc80; }
.slot-ready, .sw.slot-ready { background: #f6d9ad; color: #4a2c00; border-color: #d59a4a; }
.slot-late, .sw.slot-late { background: #f3cfc6; color: #6f2416; border-color: #c96f5c; }
.slot-code { font-weight: 700; font-size: .9rem; }
.slot-sp { font-size: .8rem; }
.slot-meta, .slot-eta { font-size: .7rem; opacity: .85; }
.slot-water { position: absolute; top: 5px; right: 6px; font-size: .75rem; }

/* wykresy */
.fig { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chart { width: 100%; height: auto; max-height: 220px; }
.chart .bar { fill: var(--accent); }
.chart .bar.over { fill: var(--danger); }
.chart .axis { stroke: var(--line-2); }
.chart .cap { stroke: var(--text); stroke-dasharray: 4 3; stroke-width: 1.2; }
.chart .val { font-size: 11px; fill: var(--text); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .tick { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 140px 1fr 150px; gap: 10px; align-items: center; font-size: .85rem; }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--panel-2); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* plan */
.inline-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.forecast { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.forecast li { display: grid; grid-template-columns: 80px 1fr 110px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fc-date { display: flex; flex-direction: column; }
.fc-items { display: flex; flex-wrap: wrap; gap: 4px; }
.fc-g { text-align: right; }
.chip-btn { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.chip-btn:hover { border-color: var(--accent); }

/* formularze i modale */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
dialog.modal { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px #0003; }
dialog.modal.wide { width: min(880px, calc(100vw - 32px)); }
dialog::backdrop { background: #1f3a1a55; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-body.form-grid { display: grid; }
.modal-body.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.versions { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: .85rem; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; }
.switch .knob { width: 30px; height: 18px; border-radius: 999px; background: #cfd3c7; position: relative; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on .knob { background: var(--accent); }
.switch.on .knob::after { left: 14px; }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: #fff; padding: 9px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .9rem; }
.toast.err { background: var(--danger); }

/* szerokie ekrany: więcej kolumn zamiast rozciągania */
@media (min-width: 1900px) {
  .work { padding: 22px 32px 48px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
/* laptop 1024–1279: panel kontekstowy nachodzi na treść */
@media (max-width: 1279px) {
  :root { --side-w: 200px; --ctx-w: 340px; }
  .studio.with-panel { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .with-panel .context { position: fixed; right: 0; top: 0; width: var(--ctx-w); box-shadow: -8px 0 30px #0002; z-index: 20; }
  .layout-overview { grid-template-columns: 1fr; }
  .col-side { position: static; }
  .racks { grid-template-columns: 1fr; }
  .search-box { width: 220px; }
}
@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side-group, .side-foot { display: none; }
  .two, .form-grid, .form-grid.three, .inline-form, .modal-body.two-col { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .week { grid-template-columns: repeat(5, 1fr); }
  .top { flex-direction: column; align-items: stretch; }
}
.photos > span { grid-column: 1 / -1; }
.modal-body h3 + p { margin-bottom: 12px; }
