:root {
  --ink: #28243a;
  --muted: #756f86;
  --paper: #f8f7f5;
  --surface: #ffffff;
  --line: rgba(40, 36, 58, .09);
  --lavender: #7658b5;
  --lavender-soft: #eee7fb;
  --pink: #e987ad;
  --pink-soft: #fde9f1;
  --teal: #3a9a93;
  --teal-soft: #def3ef;
  --gold: #d99a38;
  --gold-soft: #fff2d8;
  --danger: #b95062;
  --shadow: 0 8px 24px rgba(0, 0, 0, .06);
  font-family: Petrona, Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { min-height: 86px; padding: 18px clamp(20px, 4vw, 58px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(255,253,249,.88); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; gap: 13px; align-items: center; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--lavender-soft); color: var(--lavender); font-size: 26px; }
h1, h2, h3, p { margin: 0; }
.brand h1 { font-size: 21px; letter-spacing: -.02em; }
.brand p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.top-actions #addInventory { white-space: nowrap; }
.button { border: 1px solid transparent; border-radius: 12px; padding: 10px 16px; font-weight: 700; transition: background-color .15s cubic-bezier(0.22, 1, 0.36, 1), filter .15s cubic-bezier(0.22, 1, 0.36, 1); }
.button:hover { filter: brightness(.97); }
.button.primary { color: #fff; background: var(--lavender); }
.button.secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.button.danger { color: var(--danger); background: #fff5f6; border-color: #f3d5db; }
.button.small { padding: 7px 11px; border-radius: 9px; font-size: 12px; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.tabs { padding: 0 clamp(20px, 4vw, 58px); display: flex; gap: 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
.tab { border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 15px 2px 12px; color: var(--muted); font-weight: 750; }
.tab.active { color: var(--lavender); border-color: var(--lavender); }
main { padding: 26px clamp(20px, 4vw, 58px) 70px; max-width: 1650px; margin: 0 auto; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 14px; margin-bottom: 30px; }
.summary-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.summary-card p { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0; }
.summary-card strong { display: block; margin-top: 6px; font-size: 27px; letter-spacing: -.03em; }
.summary-card small { color: var(--muted); }
.reservation-warnings { margin: -14px 0 28px; padding: 15px 17px; border: 1px solid #f0cbd3; border-radius: 17px; background: #fff5f6; color: #7e3948; }
.reservation-warnings.hidden { display: none; }
.reservation-warning-head { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.reservation-warning-head strong { display: block; color: var(--danger); }
.reservation-warning-head span:not(.status) { display: block; margin-top: 3px; font-size: 12px; color: #93606b; }
.reservation-warning-list { display: grid; gap: 7px; margin-top: 12px; font-size: 12px; }
.warning-sources { display: inline-flex; flex-wrap: wrap; gap: 5px; margin-left: 7px; }
.warning-slot { border: 1px solid #e6bbc4; border-radius: 999px; padding: 3px 7px; background: #fff; color: #8d3e50; font-size: 10px; font-weight: 800; }
.view { display: none; }
.view.active { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 18px; }
.section-heading h2 { font-size: 28px; letter-spacing: -.035em; }
.eyebrow { color: var(--lavender); font-size: 11px; font-weight: 800; letter-spacing: 0; margin-bottom: 5px; }
.filters, .inventory-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
label > span { display: block; color: var(--muted); font-size: 11px; font-weight: 750; margin: 0 0 5px 3px; }
input, select { min-height: 40px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); padding: 8px 11px; outline: none; }
input:focus, select:focus { border-color: #ab94d6; box-shadow: 0 0 0 3px var(--lavender-soft); }
.search-field input { width: 220px; }
.search-field.wide input { width: min(360px, 42vw); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; color: var(--muted); font-size: 12px; margin: 0 0 24px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .map-move-help { margin-left: auto; font-style: italic; }
.legend-cell { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 900; }

.plot-regions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; }
.region-section { scroll-margin-top: 110px; }
.region-section.collapsed { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.region-section.collapsed .region-heading { margin-bottom: 0; }
.region-section.collapsed .region-map { display: none; }
.region-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 10px; }
.region-heading-actions { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 10px; }
.region-section h3 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.region-travel { color: var(--lavender); font-size: 10px; font-weight: 850; letter-spacing: 0; margin-bottom: 3px; }
.region-hint { color: var(--muted); font-size: 12px; text-align: right; }
.region-count { color: var(--muted); font-weight: 500; font-size: 12px; }
.region-checked { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 11px; font-weight: 800; white-space: nowrap; }
.region-map { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(var(--map-rows), auto); gap: 14px 10px; padding: 31px 14px 16px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(180deg, rgba(238,231,251,.45), rgba(255,255,255,.88)); overflow: hidden; }
.region-map.greenhouse-map { display: block; padding: 31px 14px 16px; }
.region-map::before { content: "W"; position: absolute; left: 7px; top: 50%; transform: translateY(-50%); color: #aaa1b4; font-size: 9px; font-weight: 850; }
.region-map::after { content: "E"; position: absolute; right: 7px; top: 50%; transform: translateY(-50%); color: #aaa1b4; font-size: 9px; font-weight: 850; }
.map-north { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); color: #958ba1; font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.plot-card { position: relative; z-index: 1; text-align: left; border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: border-color .15s cubic-bezier(0.22, 1, 0.36, 1); overflow: hidden; cursor: grab; user-select: none; }
.greenhouse-overview-card { cursor: default; user-select: text; }
.greenhouse-overview-card:hover { transform: none; }
.greenhouse-overview-card .plot-name, .greenhouse-overview-card .plot-location { max-width: none; }
.greenhouse-overview-layout { display: grid; grid-template-columns: minmax(280px, 560px) minmax(260px, 1fr); gap: 20px; align-items: start; }
.greenhouse-map-wrap { min-width: 0; }
.greenhouse-map-wrap .matrix.large { width: min(100%, 560px); max-width: 560px; aspect-ratio: 1; min-height: 0; grid-template-rows: repeat(10, minmax(0, 1fr)); margin: 0; }
.greenhouse-map-wrap .cell { border-radius: 3px; font-size: clamp(7px, 1vw, 12px); }
.greenhouse-map-key { display: flex; flex-wrap: wrap; gap: 8px 15px; margin: 9px 2px 0; color: var(--muted); font-size: 10px; }
.greenhouse-map-key span { display: inline-flex; align-items: center; gap: 5px; }
.cell-key { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line); border-radius: 4px; font-style: normal; font-size: 9px; font-weight: 900; }
.cell-key.parent-a { background: var(--lavender); color: #fff; }
.cell-key.parent-b { background: var(--pink); color: #fff; }
.cell-key.target { background: var(--teal-soft); color: var(--teal); }
.cell-key.gh-buffer { background: transparent; border-color: #ddd4e4; }
.greenhouse-job-list { max-height: 560px; overflow: auto; padding: 2px 4px 2px 0; }
.greenhouse-job-list h4 { margin: 0 0 8px; font-size: 13px; }
.greenhouse-job-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.greenhouse-job-target { min-width: 0; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.greenhouse-no-jobs, .greenhouse-edit-note, .greenhouse-conflict-note { color: var(--muted); font-size: 10px; line-height: 1.45; }
.greenhouse-edit-note { margin-top: 10px; }
.greenhouse-add-target { margin-top: 10px; }
.cell.gh-conflict, .cell-key.gh-conflict { background: #ffcf69; border-color: #bb7413; color: #532e00; }
.region-map > .plot-card { grid-column: var(--map-col) / span var(--map-span); grid-row: var(--map-row); min-width: 0; }
.plot-card:hover { transform: translateY(-2px); border-color: #c9b9e6; box-shadow: var(--shadow); }
.plot-card:focus-visible { outline: 3px solid var(--lavender-soft); border-color: var(--lavender); }
.plot-card.dragging { opacity: .42; cursor: grabbing; }
.plot-card.map-locked { cursor: pointer; }
.region-map.drag-over { border-color: #a98bd5; box-shadow: inset 0 0 0 2px rgba(169,139,213,.15); }
.map-drop-indicator { display: none; grid-column: var(--drop-col) / span var(--drop-span); grid-row: var(--drop-row); min-height: 88px; border: 2px dashed #9c7dcc; border-radius: 18px; background: rgba(238,231,251,.56); pointer-events: none; }
.map-drop-indicator.visible { display: block; }
.plot-card-head { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.plot-card-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 6px; }
.inventory-row-actions { white-space: nowrap; }
.inventory-row-actions > * + * { margin-left: 4px; }
.inventory-step-input { width: 52px; padding: 3px 6px; font: inherit; font-size: 12px; vertical-align: middle; }
.plot-fertilizer-mark { font-size: 16px; line-height: 1; cursor: help; }
.plot-fertilizer-mark.planned { opacity: .4; filter: grayscale(1); }
.plot-check { width: 28px; height: 28px; flex: none; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--line); border-radius: 50%; background: var(--surface); color: color-mix(in srgb, var(--muted) 40%, transparent); font-family: inherit; font-size: 15px; font-weight: 900; line-height: 1; cursor: pointer; transition: .15s ease; }
/* Invisible 44px tap area around the 28px circle, so a near miss doesn't open the plot. */
.plot-check { position: relative; }
.plot-check::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.plot-check:hover { border-color: var(--teal); color: var(--teal); }
.plot-check[aria-pressed="true"] { border-color: var(--teal); background: var(--teal); color: #fff; }
.plot-card.checked { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset, 0 6px 18px rgba(63,45,82,.05); }
.plot-map-lock { border: 0; border-radius: 999px; padding: 4px 7px; background: #f1eef4; color: #70677a; font-size: 9px; font-weight: 800; cursor: pointer; }
.plot-map-lock:hover { background: var(--lavender-soft); color: #6e50a3; }
.map-locked .plot-map-lock { background: var(--gold-soft); color: #8a5e1a; }
.plot-code { font-size: 15px; font-weight: 850; }
.plot-name { color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 145px; }
.plot-location { color: #948b9e; font-size: 10px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.status { border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 850; letter-spacing: 0; white-space: nowrap; }
.status.planted { background: var(--teal-soft); color: #237970; }
.status.goal_reached { background: var(--gold-soft); color: #9d6818; }
.status.plan_changed { background: var(--pink-soft); color: #a9456d; }
.status.not_recorded { background: #f1eef4; color: #70677a; }
.status.keep { background: var(--teal-soft); color: #237970; }
.status.partial_update { background: var(--gold-soft); color: #8a5e1a; }
.status.dig_up { background: #f6e3dc; color: #8a3d22; }
.status.new_work { background: var(--lavender-soft); color: #68499f; }
.status.already_complete { background: #eef1f3; color: #65707a; }
.status.review { background: var(--pink-soft); color: #a9456d; }
.status.manual, .status.no_work { background: #f1eef4; color: #70677a; }

.work-reconciliation { display: flex; align-items: flex-start; gap: 11px; margin: 10px 0 14px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 14px; background: #faf8fc; }
.work-reconciliation.keep { background: #f3fbf9; border-color: #cce9e4; }
.work-reconciliation.goal_reached, .work-reconciliation.partial_update { background: #fffaf0; border-color: #f0dfb9; }
.work-reconciliation.new_work { background: #f8f4ff; border-color: #ded1f3; }
.work-reconciliation.review { background: #fff6f8; border-color: #f2d5dc; }
.work-reconciliation > .status { flex: 0 0 auto; margin-top: 1px; }
.work-reconciliation strong { display: block; font-size: 12px; }
.work-reconciliation p { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.job-work-state { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 9px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.job-work-state > span:last-child { color: var(--muted); font-size: 10px; line-height: 1.4; }
.plot-target { min-height: 34px; font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.plot-target small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }
.matrix { display: grid; gap: 2px; padding: 6px; background: #f8f5fa; border-radius: 11px; width: 100%; aspect-ratio: 1.45; }
.matrix.large { max-width: 520px; aspect-ratio: auto; min-height: 260px; margin: 12px auto; }
.cell { min-width: 2px; min-height: 2px; border-radius: 2px; background: #fff; border: 1px solid #eee9f1; display: grid; place-items: center; color: #fff; font-size: clamp(5px, .7vw, 10px); font-weight: 900; line-height: 1; }
.cell.parent-a, .legend-cell.parent-a { background: var(--lavender); border-color: var(--lavender); }
.cell.parent-b, .legend-cell.parent-b { background: var(--pink); border-color: var(--pink); }
.cell.flower-cell, .legend-cell.flower-cell { border-color: rgba(55,45,64,.24); text-shadow: 0 1px 2px rgba(0,0,0,.22); }
.cell.target, .legend-cell.target { background: var(--teal-soft); border-color: #92d1c8; color: var(--teal); }
.cell.buffer, .legend-cell.buffer { background: #fff; border-color: #e9e3ed; }
.cell.filler { border: 2px dashed #8a7f94; font-weight: 700; }
.filler-legend { margin-top: 8px; font-size: 0.9em; }
.cell.blocked, .legend-cell.blocked { background: #d6d0da; border-color: #d6d0da; }
.cell.gh-buffer { background: transparent; border-color: transparent; }

.inventory-toolbar { margin-bottom: 14px; }
.inventory-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.filter-chip input { min-height: 0; margin: 0; padding: 0; accent-color: #8a6cc4; }
.filter-chip:has(input:checked) { border-color: #ab94d6; background: var(--lavender-soft); }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: auto; box-shadow: 0 7px 22px rgba(63,45,82,.05); }
.inventory-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.inventory-table th { position: sticky; top: 0; z-index: 1; background: #faf7fc; text-align: left; padding: 12px 16px; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.inventory-table td { border-top: 1px solid var(--line); padding: 11px 16px; font-size: 13px; }
.variant-name { font-weight: 750; }
.inventory-locations { display:flex; flex-wrap:wrap; gap:5px; min-width:92px; }
.inventory-location-link { appearance:none; border:1px solid #ddd3e7; border-radius:999px; padding:3px 8px; background:#fff; color:var(--ink); font:inherit; font-size:11px; font-weight:750; cursor:pointer; white-space:nowrap; }
.inventory-location-link:hover, .inventory-location-link:focus-visible { border-color:#9f86ba; background:#f7f1fc; outline:none; }
.inventory-location-none { color:#aaa0b0; }
.inventory-location-missing { color:#9a6c28; font-size:11px; font-weight:700; }
.variant-meta { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.number-cell { font-variant-numeric: tabular-nums; font-weight: 700; }
.number-cell.inventory-shortage { color: var(--danger); }
.number-cell.inventory-shortage span { display: block; font-size: 9px; font-weight: 750; }
.collection-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.collection-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c8c1ce; }
.collection-dot.owned::before { background: var(--teal); }
.inventory-view-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin: -6px 0 22px; }
.inventory-view-tab { border: 0; border-bottom: 3px solid transparent; padding: 12px 15px 10px; background: transparent; color: var(--muted); font-weight: 750; }
.inventory-view-tab.active { color: var(--lavender); border-color: var(--lavender); }
.collection-checklist-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 18px; }
.collection-checklist-head h3 { font-size: 20px; }
.collection-checklist-head p { max-width: 880px; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.collection-progress { flex: 0 0 auto; padding: 12px 15px; border: 1px solid #d8eee8; border-radius: 13px; background: #f0faf6; color: #27766e; font-size: 13px; font-variant-numeric: tabular-nums; }
.collection-checklist-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; }
.collection-scope-tabs { display: flex; flex: 1 0 100%; gap: 8px; overflow-x: auto; padding: 2px 1px; }
.collection-scope-tab { display: grid; justify-items: start; gap: 2px; min-width: 155px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); text-align: left; cursor: pointer; }
.collection-scope-tab span { font-size: 11px; font-weight: 800; white-space: nowrap; }
.collection-scope-tab small { font-size: 9px; font-weight: 650; }
.collection-scope-tab:hover, .collection-scope-tab.active { border-color: #cbb9e5; background: var(--lavender-soft); color: #62458f; }
.collection-pattern-tabs { display: flex; flex: 1 1 650px; min-width: 0; gap: 7px; overflow-x: auto; padding: 2px 1px 9px; scrollbar-width: thin; }
.collection-pattern-tab { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 700; }
.collection-pattern-tab small { color: #827b8e; font-size: 10px; font-variant-numeric: tabular-nums; }
.collection-pattern-tab.active { border-color: #cbb9e9; background: var(--lavender-soft); color: #563d8f; }
.collection-pattern-tab.active small { color: #654b9b; }
.collection-checklist-toolbar label { min-width: 170px; }
.collection-checklist-note { margin: 9px 2px 7px; }
.collection-grid-wrap { max-height: min(66vh, 760px); overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 7px 22px rgba(63,45,82,.05); scrollbar-gutter: stable; }
.collection-grid { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.collection-grid th, .collection-grid td { height: 50px; border-right: 1px solid #eee9f2; border-bottom: 1px solid #eee9f2; text-align: center; }
.collection-grid thead th { position: sticky; top: 0; z-index: 2; width: 88px; min-width: 88px; max-width: 104px; padding: 8px 5px; background: #f7f3fb; color: #625a70; font-size: 11px; font-weight: 750; line-height: 1.2; }
.collection-grid .collection-breed-heading { left: 0; z-index: 4; width: 190px; min-width: 190px; max-width: 190px; text-align: left; padding-left: 16px; }
.collection-grid tbody th.collection-breed { position: sticky; left: 0; z-index: 1; width: 190px; min-width: 190px; max-width: 190px; padding: 8px 14px; background: #fff; text-align: left; color: var(--ink); font-size: 12px; font-weight: 750; }
.collection-grid tbody tr:nth-child(even) th.collection-breed { background: #fcfaff; }
.collection-breed-count { margin-left: 6px; color: var(--muted, #777); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.collection-breed-count.complete { color: #216e62; }
.collection-grid td { width: 88px; min-width: 88px; padding: 5px; background: #fff; }
.collection-grid tbody tr:nth-child(even) td { background: #fcfaff; }
.collection-mark { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 38px; height: 32px; padding: 0 5px; border: 1px solid transparent; border-radius: 9px; font-size: 17px; line-height: 1; font-weight: 850; }
.collection-mark-state { display: inline-block; }
.collection-breed-flag { display: inline-grid; place-items: center; width: 14px; height: 15px; border: 1px solid transparent; border-radius: 4px; font-style: normal; font-size: 9px; line-height: 1; font-weight: 900; }
.collection-breed-flag.planted { border-color: #b8ded4; background: #dff3ed; color: #216e62; }
.collection-breed-flag.recommended { border-color: #d7cbed; background: #eee8fa; color: #6541a6; }
.collection-status-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin: 0 4px 9px; color: var(--muted); font-size: 11px; }
.collection-status-legend span { display: inline-flex; align-items: center; gap: 6px; }
.collection-status-legend small { font-size: inherit; }
button.collection-mark.acquired { border-color: #c7e7df; background: #e5f6f1; color: #26786e; }
button.collection-mark.missing { border-color: #f0d8df; background: #fff0f3; color: #b34c67; }
button.collection-mark:hover { outline: 2px solid currentColor; outline-offset: 1px; }
.collection-mark.no-goal { color: #c1bbc8; font-size: 17px; }
.collection-grid .collection-empty { height: 100px; padding: 28px; color: var(--muted); text-align: center; }
.inventory-stock-note { margin: 0 0 12px; }
#physicalInventoryPanel.hidden, #collectionChecklistPanel.hidden { display: none !important; }
.table-note { color: var(--muted); font-size: 12px; margin: 10px 4px; }
.target-summary { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 14px; margin-bottom: 28px; }
.target-section { margin-top: 28px; }
.target-section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.target-section-head h3 { font-size: 19px; }
.target-section-head .table-note { text-align: right; }
.target-table { min-width: 980px; }
.target-variant { display: inline-flex; align-items: center; gap: 10px; min-width: 190px; }
.target-variant strong { display: block; }
.target-variant small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.target-swatch { width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid rgba(55,45,64,.2); border-radius: 8px; }
.target-parents { color: var(--muted); line-height: 1.55; min-width: 190px; }
.empty-table { color: var(--muted); text-align: center; padding: 28px !important; }

.drawer { position: fixed; z-index: 50; top: 0; right: 0; width: min(560px, 94vw); height: 100vh; background: var(--surface); padding: 24px; box-shadow: -18px 0 50px rgba(41,30,54,.16); transform: translateX(105%); transition: transform .22s ease; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head, .dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 15px; margin-bottom: 18px; }
.drawer-head-actions { display:flex; align-items:start; gap:8px; flex:0 0 auto; }
.icon-button { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 24px; display: grid; place-items: center; line-height: 1; }
.scrim { position: fixed; z-index: 45; inset: 0; background: rgba(32,25,40,.32); opacity: 0; pointer-events: none; transition: .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.detail-card { border: 1px solid var(--line); border-radius: 15px; padding: 14px; margin: 12px 0; background: #fdfbfe; }
.detail-card h3 { font-size: 14px; margin-bottom: 9px; }
.detail-list { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.detail-list strong { color: var(--ink); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 16px 0; }
.plot-tools { margin: 18px 0 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.plot-tools summary { width: fit-content; color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; user-select: none; }
.plot-tools summary:hover { color: var(--ink); }
.plot-tools-help { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.secondary-actions { margin-top: 10px; }
/* Plot details: the Recommendation is its own section under what's planted. */
.rec-section { margin: 18px 0; padding: 14px 16px; border: 1px solid #d8c9ee; border-radius: 18px; background: #faf7ff; }
.rec-section.keep { background: #f6fbfa; border-color: #cce9e4; }
.rec-section.partial_update, .rec-section.goal_reached { background: #fffbf3; border-color: #f0dfb9; }
.rec-section.review { background: #fff8f9; border-color: #f2d5dc; }
.rec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rec-head h3 { margin: 0; font-size: 12px; font-weight: 900; letter-spacing: 0; color: var(--muted); }
.rec-summary { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.rec-summary strong { color: var(--ink); }
.rec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.rec-actions-main { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.rec-section > .help-text, .rec-section > .preserved-goal-notice { margin-top: 12px; }
.rec-section .plot-detail-layout { margin-top: 14px; }
.rec-section .assignment-section.recommended { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.target-fold-row { display: flex; justify-content: center; margin-top: 10px; }
.target-fold-row[hidden], .target-filter-item[hidden], .target-filter-empty[hidden], .managed-target-row[hidden], .target-manager-search[hidden] { display: none; }
.target-list-filters { margin: 0 0 10px; }
.target-list-filters .search-field input { width: 200px; }
.target-filter-empty { margin: 4px 0 0; padding: 12px; border-radius: 10px; background: #f7f5f8; color: var(--muted); font-size: 12px; }
.link-button { border: 0; background: none; padding: 0; color: #7a5bb5; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.target-manager-search { margin: 0 0 12px; }
.target-manager-search input { width: 100%; }
.plant-changed-row { display: flex; justify-content: flex-end; margin-bottom: 8px; }
dialog { width: min(560px, calc(100vw - 28px)); border: 0; border-radius: 22px; padding: 22px; color: var(--ink); box-shadow: 0 24px 70px rgba(39,27,52,.24); }
dialog::backdrop { background: rgba(32,25,40,.36); backdrop-filter: blur(3px); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid input, .form-grid select { width: 100%; }
.help-text { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 14px 2px; }
.target-preview { min-height: 78px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.warning-box, .success-box { border-radius: 14px; padding: 12px 14px; margin: 10px 0; line-height: 1.45; }
.warning-box { color: #8d3e50; background: #fff3f5; border: 1px solid #f0cbd3; }
.warning-box strong { color: var(--danger); }
.warning-box ul { margin: 7px 0 0; padding-left: 20px; }
.warning-box p { margin-top: 6px; }
.success-box { color: #237970; background: var(--teal-soft); border: 1px solid #addbd4; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.check-row { display: flex; gap: 11px; align-items: start; border: 1px solid var(--line); border-radius: 14px; padding: 13px; margin: 10px 0; }
.check-row input { min-height: 0; margin-top: 3px; }
.check-row span { margin: 0; font-size: 13px; color: var(--ink); }
.check-row small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.check-row.disabled { opacity: .62; background: #f6f3f7; }

.plot-editor-dialog { width: min(1050px, calc(100vw - 28px)); }
.plot-editor-toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: end; }
.brush-selectors { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); flex: 1 1 620px; gap: 9px; }
.brush-field { min-width: 0; }
.brush-field select { width: 100%; }
.brush-preview { width: 40px; height: 40px; flex: 0 0 40px; border: 1px solid rgba(55,45,64,.22); border-radius: 11px; }
.plot-editor-scroll { overflow: auto; padding: 5px 2px 12px; }
.plot-editor-grid { display: grid; gap: 4px; min-width: max-content; padding: 10px; border-radius: 16px; background: #f8f5fa; }
.plot-edit-cell { width: 100%; min-width: 27px; max-width: 54px; aspect-ratio: 1; padding: 0; border: 1px solid #ddd5e3; border-radius: 7px; background: #fff; color: #fff; font-size: 11px; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.24); }
.plot-edit-cell .edit-tag { font-size: 10px; letter-spacing: -.2px; }
.plot-edit-cell:hover { outline: 3px solid rgba(118,88,181,.22); border-color: var(--lavender); }
.plot-edit-cell.disabled { background: #d5d0d8; border-color: #d5d0d8; cursor: not-allowed; opacity: .55; }
.plot-edit-cell.planted { border-color: rgba(55,45,64,.38); box-shadow: inset 0 0 0 1px rgba(255,255,255,.38); }

.loading { position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center; background: rgba(255,253,249,.84); backdrop-filter: blur(5px); }
.loading.hidden { display: none; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--lavender-soft); border-top-color: var(--lavender); border-radius: 50%; animation: spin .8s linear infinite; }
.loading p { margin-top: 12px; font-weight: 750; }
.loading .button { margin-top: 16px; }
.loading .button.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 110; left: 50%; bottom: 24px; transform: translate(-50%, 120px); opacity: 0; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); transition: .25s ease; max-width: min(520px, 90vw); text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--danger); }
.empty-state { border: 1px dashed #cec4d7; border-radius: 18px; padding: 34px; text-align: center; color: var(--muted); }
.section-description { margin-top: 5px; color: var(--muted); font-size: 13px; }
.history-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.history-stat { min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.92); }
.history-stat > span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0; }
.history-stat strong { display: block; margin-top: 4px; font-size: 24px; line-height: 1.15; }
.history-stat small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.history-stat:last-child strong { font-size: 17px; }
.history-chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 22px; }
.history-chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 20px; align-items: center; }
.history-chart-head h3 { margin: 0; }
.history-chart-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.history-range { width: 128px; flex: 0 0 auto; }
.history-range span, .history-search > span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; margin: 0 0 4px 3px; }
.history-range select { width: 100%; min-height: 36px; padding: 6px 9px; }
.history-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.history-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; background: var(--series-color); }.history-new-flowers td { vertical-align: top; }
.history-new-day { white-space: nowrap; }
.history-new-count { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.history-new-list { display: flex; flex-wrap: wrap; gap: 5px; }
.history-new-flower { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12px; cursor: help; }
.history-new-flower small { color: var(--muted); font-size: 10px; font-weight: 700; }
.history-chart { min-height: 180px; margin-top: 12px; overflow-x: auto; }
.history-chart svg { display: block; min-width: 560px; width: 100%; height: auto; }
.history-chart text { fill: var(--muted); font-size: 12px; }
.history-chart-shell { position: relative; }
.history-point { cursor: crosshair; stroke: #fff; stroke-width: 1.5; }
.history-point:focus-visible { outline: none; stroke: #2c2340; stroke-width: 3; }
.history-tooltip { position: absolute; z-index: 5; display: none; width: max-content; max-width: min(270px, calc(100% - 16px)); padding: 10px 12px; border: 1px solid #d9d0e4; border-radius: 11px; background: rgba(255,255,255,.98); box-shadow: 0 8px 24px rgba(49,36,69,.18); color: var(--ink); pointer-events: none; }
.history-tooltip.visible { display: block; }
.history-tooltip-date { display: block; margin-bottom: 7px; font-size: 12px; }
.history-tooltip ul { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.history-tooltip li, .history-tooltip-label { display: flex; align-items: center; }
.history-tooltip li { justify-content: space-between; gap: 18px; font-size: 11px; }
.history-tooltip-label { gap: 7px; color: var(--muted); }
.history-tooltip-label i { display: inline-block; width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--series-color); }
.history-tooltip li > strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.history-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; margin: 0 0 12px; }
.history-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.history-filter { min-height: 35px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 750; }
.history-filter:hover, .history-filter.active { border-color: #cbb9e5; background: var(--lavender-soft); color: #5f438d; }
.history-filter:focus-visible { outline: 3px solid #ded1f1; outline-offset: 2px; }
.history-search { width: min(320px, 100%); }
.history-search input { width: 100%; min-height: 36px; padding: 7px 10px; }
.history-table { min-width: 760px; }
.history-table th:first-child { width: 150px; }
.history-table th:nth-child(2) { width: 190px; }
.history-table th:nth-child(4) { width: 150px; }
.history-table td { vertical-align: top; }
.history-time { display: block; color: var(--ink); font-weight: 750; white-space: nowrap; }
.history-time small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.history-category { display: inline-block; margin: 0 0 5px; padding: 3px 7px; border-radius: 999px; background: #f0ecf4; color: #6f647b; font-size: 9px; font-weight: 850; letter-spacing: 0; }
.history-category-inventory { background: #e4f3eb; color: #28704b; }
.history-category-plots { background: #eee8fa; color: #65489a; }
.history-category-planner { background: #fff1d9; color: #8b611d; }
.history-action, .history-detail { display: block; line-height: 1.3; }
.history-action { font-size: 12px; }
.history-detail { font-size: 13px; overflow-wrap: anywhere; }
.history-change { display: block; width: fit-content; margin-top: 4px; padding: 3px 7px; border-radius: 7px; background: #f4f1f7; color: #564d61; font-size: 11px; font-variant-numeric: tabular-nums; }
.history-metrics { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.history-snapshot { display: inline-block; padding: 5px 8px; border-radius: 8px; background: #e7f3ed; color: #28704b; font-size: 10px; font-weight: 800; white-space: nowrap; }
.history-snapshot-unavailable { display: inline-block; padding: 5px 8px; border-radius: 8px; background: #f2f0ed; color: #786f64; font-size: 10px; font-weight: 750; white-space: nowrap; }
.history-no-snapshot { color: #9b95a2; }
.history-pagination { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px 0 2px; color: var(--muted); font-size: 12px; }
.history-pagination.hidden { display: none; }
.history-pagination button:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 850px) {
  .history-summary { grid-template-columns: 1fr 1fr; }
  .history-stat:last-child { grid-column: span 2; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .target-summary { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .filters { width: 100%; }
  .filters label { flex: 1; min-width: 130px; }
  .filters input, .filters select { width: 100%; }
  .region-map { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .region-map > .plot-card { grid-column: auto; grid-row: auto; }
  .greenhouse-overview-layout { grid-template-columns: minmax(0, 1fr); }
  .greenhouse-job-list { max-height: 300px; }
}
@media (max-width: 560px) {
  .history-chart-head { align-items: flex-start; }
  .history-legend { flex-basis: 100%; }
  .history-toolbar { align-items: stretch; }
  .history-filters { justify-content: flex-start; }
  .history-search { width: 100%; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .top-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .top-actions #addInventory { margin-right: auto; }
  .brand p { display: none; }
  .top-actions .secondary { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .summary-card { padding: 14px; }
  .summary-card strong { font-size: 22px; }
  .target-summary { grid-template-columns: 1fr; }
  .region-heading { align-items: start; flex-direction: column; gap: 4px; }
  .region-heading-actions { width: 100%; align-items: center; justify-content: space-between; }
  .region-hint { text-align: left; }
  .region-map { grid-template-columns: 1fr; }
  .greenhouse-map-wrap .matrix.large { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .brush-selectors { grid-template-columns: 1fr; flex-basis: 100%; }
}

/* v4: make current farm state and replacement recommendations read as two
   distinct plans instead of a stack of duplicate cards. */
.assignment-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin: 16px 0;
}
.assignment-section.actual {
  background: #fbfafc;
  border-color: #ddd8e5;
  box-shadow: inset 4px 0 0 #92899d;
}
.assignment-section.recommended {
  background: #faf7ff;
  border-color: #d8c9ee;
  box-shadow: inset 4px 0 0 #7650bd;
}
.assignment-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.assignment-section-header h3 {
  margin: 0;
  font-size: 16px;
}
.assignment-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.assignment-section.recommended .assignment-count {
  border-color: #d8c9ee;
  color: #6543a6;
}
.assignment-section-heading-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.assignment-section-note { margin:-3px 2px 12px; color:var(--muted); font-size:11px; line-height:1.45; }
.preserved-goal-notice { margin:0 0 12px; padding:10px 12px; border:1px solid #e3d8f1; border-radius:11px; background:rgba(255,255,255,.72); color:var(--muted); font-size:12px; line-height:1.5; }
.preserved-goal-notice strong { color:var(--ink); }
.assignment-target-list {
  display: grid;
  gap: 10px;
}
.target-detail-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #fff;
}
.target-detail-card.actual {
  border-color: #e1dce7;
}
.target-detail-card.recommended {
  border-color: #dfd2f1;
}
.target-detail-card h4 {
  margin: 0 0 9px;
  font-size: 13px;
}
.target-detail-actions { display:flex; justify-content:flex-end; margin-top:12px; padding-top:10px; border-top:1px solid #eeeaf2; }
.target-detail-actions .found-job { max-width:100%; white-space:normal; text-align:center; }
.assignment-section-footer { display:flex; justify-content:flex-end; margin-top:14px; padding-top:12px; border-top:1px solid #e8def3; }
.assignment-section-footer .button { max-width:100%; }
.assignment-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.72);
}

.plan-utilization {
  margin: -10px 0 22px;
  padding: 9px 12px;
  border: 1px solid #ebe4f1;
  border-radius: 10px;
  background: #faf8fc;
  color: var(--muted);
  font-size: 12px;
}
.plan-utilization strong { color: var(--ink); }
.plan-utilization span { margin-left: 8px; color: #968ba0; }

/* v20: exact flower hover details for planted/recommended cells. */
.flower-tooltip {
  position: fixed;
  z-index: 200;
  max-width: min(280px, calc(100vw - 20px));
  padding: 10px 12px;
  border: 1px solid rgba(66, 53, 78, .18);
  border-radius: 12px;
  background: rgba(42, 36, 56, .96);
  color: #fff;
  box-shadow: 0 10px 28px rgba(36, 29, 46, .28);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);
  transition: opacity .08s ease, transform .08s ease, visibility .08s ease;
  font-size: 11px;
  line-height: 1.3;
}
.flower-tooltip.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.flower-tooltip-role { color: #cfc2ec; font-size: 9px; font-weight: 850; letter-spacing: 0; }
.flower-tooltip-name { margin-top: 2px; font-size: 13px; font-weight: 850; }
.flower-tooltip-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 9px; margin-top: 7px; color: #eee9f4; }
.flower-tooltip-meta span { display: contents; }
.flower-tooltip-meta b { color: #bdb3c8; font-size: 9px; font-weight: 750; letter-spacing: 0; }
.cell[data-flower-tooltip], .plot-edit-cell[data-flower-tooltip] { cursor: help; }

.inventory-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 10px 4px 0; }
.inventory-pagination .table-note { margin: 0; }
.pagination-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-size-control { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.page-size-control select { min-width: 72px; }
.page-indicator { min-width: 92px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 680px) {
  .inventory-pagination { align-items: stretch; }
  .pagination-controls { width: 100%; justify-content: space-between; }
  .page-size-control { width: 100%; justify-content: flex-end; }
}


/* v26: practical in-game filter summary for each recommendation. */


/* v28: target recognition for manually recorded Actual layouts. */
.manual-target-candidates { display:grid; gap:5px; margin:10px 0; padding:9px 10px; border:1px solid #e3d9ef; border-radius:10px; background:#fff; color:var(--ink); }
.manual-target-candidates > strong { font-size:11px; color:var(--muted); letter-spacing: 0; }
.manual-target-candidates > span { display:block; font-size:12px; line-height:1.45; }
.manual-target-candidates > small { color:var(--muted); }
.assignment-empty .manual-target-candidates + .button { margin-top:2px; }

/* v44: edit each plot goal independently. */
.target-manager-dialog { width:min(760px, calc(100vw - 28px)); max-height:calc(100vh - 32px); overflow:auto; }
.target-manager-section { margin:16px 0; padding:14px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.72); }
.target-manager-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px; }
.target-manager-heading h3 { margin:0; font-size:15px; }
.target-manager-heading p { margin:4px 0 0; color:var(--muted); font-size:11px; }
.target-manager-list { display:grid; gap:8px; }
.managed-target-row { display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; gap:12px; padding:10px 11px; border:1px solid #e8e3ed; border-radius:11px; background:#fff; }
.managed-target-row strong { display:block; color:var(--ink); font-size:13px; }
.managed-target-row small { display:block; margin-top:3px; color:var(--muted); font-size:11px; line-height:1.4; }
.managed-target-actions { display:flex; gap:6px; }
.managed-target-empty { margin:0; padding:12px; border-radius:10px; background:#f7f5f8; color:var(--muted); font-size:12px; }
@media (max-width:560px) {
  .drawer-head { gap:8px; flex-wrap:wrap; }
  .drawer-head > div:first-child { min-width:0; flex:1 1 150px; }
  .drawer-head-actions { gap:6px; }
  .drawer-head-actions { margin-left:auto; }
  .drawer-head-actions #managePlotTargets { padding:7px 9px; font-size:11px; }
  .assignment-section-header { align-items:flex-start; }
  .assignment-section-heading-actions { flex-wrap:wrap; }
  .target-detail-actions .found-job, .assignment-section-footer .button { width:100%; }
  .target-manager-heading { align-items:flex-start; flex-direction:column; }
  .managed-target-row { grid-template-columns:1fr; }
  .managed-target-actions .button { flex:1; }
}

@media (max-width:700px) {
  .collection-checklist-head { align-items:flex-start; flex-direction:column; }
  .collection-progress { align-self:flex-start; }
  .collection-pattern-tabs { flex-basis:100%; }
  .collection-scope-tabs { flex-basis:100%; }
  .collection-checklist-toolbar label { flex:1 1 150px; }
  .collection-grid .collection-breed-heading,
  .collection-grid tbody th.collection-breed { width:150px; min-width:150px; max-width:150px; }
  .collection-grid thead th, .collection-grid td { width:76px; min-width:76px; }
}

button.collection-mark.waiting { border-color: #dcd6e6; background: #f6f3fa; color: #6d6280; }
button.collection-mark.wait-event_now { border-color: #e4c781; background: #fff4d8; color: #805800; }
button.collection-mark.blocked { border-color: #e4c781; background: #fff4d8; color: #805800; }
button.collection-mark.breeding { border-color: #b8ded4; background: #dff3ed; color: #216e62; }
.collection-breed-flag.planted { font-size: 13px; width: 20px; height: 20px; }

/* v71.7: compact spawn-review workflow */
.spawn-dialog { width: min(760px, 96vw); max-height: 90vh; overflow: auto; }
.spawn-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; }
.spawn-controls label { display: flex; flex-direction: column; gap: 5px; flex: 1 1 140px; }
.spawn-controls label:has(input[type=checkbox]) { flex-direction: row; align-items: center; }
.spawn-controls select, .spawn-controls input[type=search] { width: 100%; min-width: 0; }
.spawn-suggestions { max-height: 52vh; overflow-y: auto; border: 1px solid var(--border, #ddd); border-radius: 9px; padding: 6px; }
.spawn-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 6px; border-bottom: 1px solid var(--border, #ddd); }
.spawn-option:last-child { border-bottom: 0; }
.spawn-option > span { min-width: 0; }
.spawn-option small { display: block; opacity: .68; }
.spawn-option > div { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.spawn-basket { max-height: 150px; overflow: auto; }
.spawn-heading { margin: 10px 6px 4px; font-size: 14px; }
.spawn-heading:first-child { margin-top: 4px; }
.spawn-group h4 { margin: 10px 6px 2px; font-size: 11px; letter-spacing: 0; color: var(--muted); }
.spawn-group h4 span { font-weight: 600; opacity: .8; }
.spawn-group .target-fold-row { margin: 6px 0 4px; }
@media(max-width: 530px) { .spawn-option { align-items: flex-start; } .spawn-option > div { flex-wrap: wrap; justify-content: flex-end; } }

/* Keep the nonblocking generation cancel button visible only during generation. */
#cancelPlan.hidden { display: none !important; }

/* v74.3: mobile / touch pass. */
.tabs { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; white-space: nowrap; }
.drawer { height: 100dvh; }
@media (hover: none) {
  .button:hover, .plot-card:hover { transform: none; }
  .plot-card:hover { box-shadow: 0 1px 2px rgba(0,0,0,.05); border-color: var(--line); }
  .plot-card { cursor: pointer; }
  .legend .map-move-help { display: none; }
}
@media (pointer: coarse) {
  .button.small { min-height: 36px; }
  .icon-button { width: 42px; height: 42px; }
  .inventory-location-link { padding: 6px 10px; }
}
@media (max-width: 850px) {
  .legend .map-move-help { display: none; }
  .plot-card { cursor: pointer; }
}
@media (max-width: 700px) {
  /* Only the tab strip stays pinned; the full header scrolls away. */
  .topbar { position: static; min-height: 0; padding: 12px 14px; gap: 10px; backdrop-filter: none; }
  .brand-mark { width: 38px; height: 38px; font-size: 22px; border-radius: 12px; }
  .brand h1 { font-size: 18px; }
  .tabs { position: sticky; top: 0; z-index: 20; padding: 0 14px; gap: 20px; }
  .tab { padding: 13px 2px 10px; }
  main { padding: 16px 14px calc(50px + env(safe-area-inset-bottom)); }
  .section-heading h2 { font-size: 23px; }
  .summary-grid { margin-bottom: 20px; }
  .region-section { scroll-margin-top: 60px; }

  .filters, .inventory-toolbar { width: 100%; }
  .filters label, .inventory-toolbar label { flex: 1 1 140px; min-width: 0; }
  .filters input, .filters select, .inventory-toolbar input, .inventory-toolbar select,
  .search-field input, .search-field.wide input { width: 100%; }
  .filters > .button { flex: 1 1 100%; }
  /* 16px stops iOS Safari from zooming into focused fields. */
  input, select { font-size: 16px; }
  .inventory-checks { flex: 1 1 100%; }
  .inventory-toolbar .filter-chip { flex: 1 1 0; }
  .inventory-toolbar .filter-chip input { width: auto; }

  .inventory-table th { padding: 10px 12px; }
  .inventory-table td { padding: 10px 12px; }
  .target-section-head { flex-wrap: wrap; align-items: start; }
  .target-section-head .table-note { text-align: left; }

  .drawer { width: 100vw; padding: 16px 14px calc(24px + env(safe-area-inset-bottom)); }
  .drawer-actions .button { flex: 1 1 auto; }

  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; overflow: auto; }
  .plot-editor-dialog, .target-manager-dialog, .spawn-dialog { width: 100vw; max-height: 100dvh; }
  .dialog-head { position: sticky; top: -16px; z-index: 3; margin: -16px -14px 14px; padding: 14px 14px 12px; background: var(--surface); }
  .dialog-head h2 { font-size: 20px; }
  .dialog-actions { flex-wrap: wrap; position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); margin: 16px -14px calc(-16px - env(safe-area-inset-bottom)); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
  .dialog-actions .button { flex: 1 1 auto; }
  .plot-editor-toolbar .button { flex: 1 1 auto; }
  .plot-edit-cell { min-width: 30px; }

  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .top-actions .button { padding: 9px 10px; font-size: 13px; }
  .top-actions .secondary { display: block; }
  .top-actions #addInventory { margin-right: 0; }
  .top-actions .hidden, .top-actions [hidden] { display: none; }
  .summary-card { padding: 12px; }
  .summary-card p { font-size: 10px; }
  .summary-card strong { font-size: 20px; }
  .history-summary { gap: 8px; }
  .history-stat { padding: 11px 12px; }
  .history-stat strong { font-size: 20px; }
  .collection-grid .collection-breed-heading,
  .collection-grid tbody th.collection-breed { width: 112px; min-width: 112px; max-width: 112px; padding-left: 9px; padding-right: 6px; font-size: 11px; }
  .collection-grid thead th, .collection-grid td { width: 64px; min-width: 64px; font-size: 10px; }
  .collection-scope-tab { min-width: 130px; }
  .collection-checklist-toolbar label { min-width: 0; }
}

/* v74.4: plot details as a centered panel. Desktop shows the grid beside
   the target list, and target cards are compact so more fit on screen. */
.target-detail-card { padding: 10px 12px; }
.target-detail-card h4 { margin: 0 0 7px; font-size: 14px; line-height: 1.3; }
.target-detail-card h4 small { margin-right: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.target-detail-card .detail-list { grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12px; }
.target-detail-card .detail-list .wide { grid-column: 1 / -1; }
.target-detail-card .job-work-state { margin-bottom: 7px; padding-bottom: 6px; }
.target-detail-card .target-detail-actions { margin-top: 8px; padding-top: 8px; }
/* Centered at every width. Left/right insets (not vw) keep it centered even
   when iOS widens the layout viewport. */
.drawer { top: 50%; left: max(24px, calc((100% - 1240px) / 2)); right: max(24px, calc((100% - 1240px) / 2)); width: auto; height: auto; max-height: calc(100dvh - 48px); padding: 0 24px 20px; border-radius: 22px; box-shadow: 0 30px 80px rgba(41,30,54,.28); opacity: 0; visibility: hidden; transform: translateY(-48%) scale(.98); transition: transform .18s ease, opacity .18s ease, visibility .18s; }
.drawer.open { opacity: 1; visibility: visible; transform: translateY(-50%); }
.drawer-head { position: sticky; top: 0; z-index: 3; margin-bottom: 12px; padding-top: 20px; background: var(--surface); }
.drawer .matrix.large { margin: 8px auto; }
@media (max-width: 700px) {
  .plot-card .cell { font-size: 9px; }
  .drawer { left: 8px; right: 8px; max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 0 14px 16px; border-radius: 18px; }
  .drawer-head { padding-top: 14px; margin-bottom: 10px; }
  .drawer-head h2 { font-size: 20px; }
}
@media (min-width: 961px) {
  .plot-detail-layout { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 20px; align-items: start; }
  .plot-detail-visual .drawer-actions { margin-bottom: 0; }
  .plot-detail-work .assignment-section { margin: 0; }
  .plot-detail-work .assignment-target-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
}
@media (max-width: 420px) {
  .target-detail-card .detail-list { grid-template-columns: 1fr; }
}
.shared-work-state { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 10px; padding: 8px 10px; border: 1px solid #e5d9f4; border-radius: 11px; background: rgba(255,255,255,.72); }
.shared-work-state .job-work-state { margin: 0; padding: 0; border: 0; }
.shared-work-scope { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0; }
/* v74.5: planting guide, one in-game filter setting per step. */
/* Phones: first in the panel. Wide: top of the right column, beside the map. */
@media (min-width: 961px) {
  .plot-detail-layout > .planting-guide { grid-column: 2; grid-row: 1; margin: 0; }
  .plot-detail-layout > .plot-detail-visual { grid-column: 1; grid-row: 1 / span 2; }
  .plot-detail-layout > .plot-detail-work { grid-column: 2; }  /* under the guide when there is one */
}
.planting-guide { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #d9c8f0; border-radius: 14px; background: rgba(255,255,255,.8); }
.planting-guide > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; cursor: pointer; font-size: 14px; }
.planting-guide > summary span { color: var(--muted); font-size: 12px; }
.pg-help { margin: 6px 0 10px; color: var(--muted); font-size: 12px; }
.pg-remove { margin: 0 0 10px; border-color: #f0cfa4; background: #fff8ef; }
.pg-remove .pg-step-number { background: #c96a1a; }
.pg-dig-list summary { margin: 0 0 6px 30px; cursor: pointer; color: #8a5e1a; font-size: 12px; font-weight: 700; }
.pg-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pg-step { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pg-step-text { flex: 1 1 220px; min-width: 0; }
.pg-step-head { display: flex; gap: 8px; align-items: flex-start; }
.pg-step-number { flex: 0 0 auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 800; }
.pg-filters { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pg-filter { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.pg-filter small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0; margin-right: 2px; }
.pg-filter b { padding: 1px 7px; border: 1px solid #d9c8f0; border-radius: 999px; background: #f6f0fd; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pg-results { margin: 4px 0 6px 30px; color: var(--muted); font-size: 11px; }
.pg-items { display: grid; gap: 4px; margin: 0 0 0 30px; padding: 0; list-style: none; font-size: 13px; }
.pg-items li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 7px; align-items: center; }
.pg-items li:has(.pg-missing) { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
.pg-missing { padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.pg-missing:hover { border-color: #e0a3b0; color: #b4405a; }
.missing-counts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 4px 0 14px; font-size: 13px; }
.missing-counts dt { color: var(--muted); }
.missing-counts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-swatch { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); font-size: 11px; font-weight: 800; }
.pg-item-name small { color: var(--muted); }
.pg-spots { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12px; text-align: right; }
.pg-map { display: grid; gap: 2px; flex: 0 0 auto; font-size: 9px; }
.pg-axis { display: grid; place-items: center; min-width: 14px; color: var(--muted); font-weight: 700; }
.pg-cell { width: 16px; height: 16px; border-radius: 3px; background: #ece7f2; }
.pg-cell.outside { background: transparent; }
.pg-cell.other { background: #cfc6da; }
.pg-cell.later { box-shadow: inset 0 0 0 1.5px #b9aecb; }
.pg-cell.plant { display: grid; place-items: center; font-weight: 800; font-size: 9px; outline: 1px solid rgba(0,0,0,.25); }
.pg-cell.dig { display: grid; place-items: center; background: #e07b24; color: #fff; font-weight: 900; font-size: 10px; outline: 1px solid #a8520e; }
@media (max-width: 420px) {
  .pg-results, .pg-items { margin-left: 0; }
  .pg-items li, .pg-items li:has(.pg-missing) { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .pg-spots { grid-column: 2; text-align: left; }
  .pg-missing { grid-column: 3; grid-row: 1 / span 2; }
}

/* Line icons (lucide, 1.5 stroke) take their text color. */
.line-icon { display: block; flex: none; }
.plot-fertilizer-mark { color: var(--muted); }
.event-icon { color: #c0577f; }

/* Petrona throughout: a soft wedge serif, at the original bold weights. */
:root { --display: Petrona, Georgia, serif; }
h1, h2, h3, .summary-card strong, .onboarding h2, .history-stat strong { font-family: var(--display); letter-spacing: 0; }
.summary-card strong { font-variant-numeric: tabular-nums; }

/* Controls in DM Sans: buttons, tabs, form fields, status badges and the plot cell tags read as app UI next to Petrona's content. */
:root { --ui: "DM Sans", "Segoe UI", system-ui, sans-serif; }
button, .button, .tab, [role=tab], select, input, textarea, .status, .cell, .cell-key, .legend-cell, .chip-toggle, .tip-jar { font-family: var(--ui); }

.found-dialog-warning { color: var(--danger); font-weight: 600; }

.filler-toggle { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; cursor: pointer; }
