:root {
    color-scheme: light;
    --ink: #17231d;
    --muted: #68736b;
    --line: #d9dfd8;
    --paper: #fbfcf8;
    --panel: #ffffff;
    --field: #e6eddf;
    --leaf: #2f7d46;
    --leaf-dark: #235f36;
    --soil: #9b6b43;
    --sun: #d99a2b;
    --berry: #9b3d57;
    --water: #3c78a8;
    --shadow: 0 16px 45px rgba(43, 59, 49, 0.12);
}

html,
body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--paper);
    color: var(--ink);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

.content {
    padding: 24px;
}

.dashboard {
    display: grid;
    gap: 20px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--paper);
}

.login-panel {
    display: grid;
    gap: 16px;
    width: min(420px, 100%);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.login-panel h1 {
    margin: 0;
}

.login-panel label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

.login-panel input {
    border: 1px solid #cbd5c8;
    border-radius: 6px;
    padding: 10px 11px;
}

.login-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 6px;
    background: #f8e6ea;
    color: #8a2438;
    font-weight: 700;
}

.center-link {
    display: inline-flex;
    justify-content: center;
    text-decoration: none;
}

.logout-form {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.header-band {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    min-height: 168px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(rgba(17, 35, 28, 0.26), rgba(17, 35, 28, 0.18)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='320' viewBox='0 0 1200 320'%3E%3Crect width='1200' height='320' fill='%23d7e3cf'/%3E%3Cg fill='none' stroke='%2380a36f' stroke-width='16' opacity='.48'%3E%3Cpath d='M0 250 C180 195 300 290 480 235 S780 205 980 245 1130 225 1200 205'/%3E%3Cpath d='M0 288 C170 235 315 310 500 260 S785 230 990 275 1132 260 1200 238'/%3E%3C/g%3E%3Cg stroke='%23876645' stroke-width='5' opacity='.44'%3E%3Cpath d='M80 300 370 122'/%3E%3Cpath d='M230 314 520 122'/%3E%3Cpath d='M380 318 670 122'/%3E%3Cpath d='M530 320 820 122'/%3E%3Cpath d='M680 320 970 122'/%3E%3Cpath d='M830 320 1120 122'/%3E%3C/g%3E%3Ccircle cx='1010' cy='70' r='34' fill='%23d99a2b' opacity='.85'/%3E%3C/svg%3E") center/cover;
    box-shadow: var(--shadow);
    color: white;
}

.home-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 22px;
    align-items: center;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(23, 35, 29, 0.94), rgba(47, 125, 70, 0.82)),
        #17231d;
    color: white;
    box-shadow: var(--shadow);
}

.home-hero img {
    width: clamp(72px, 12vw, 116px);
    height: clamp(72px, 12vw, 116px);
    padding: clamp(8px, 1.6vw, 14px);
    border-radius: 8px;
    background: #f7f1df;
    box-shadow: inset 0 0 0 1px rgba(60, 45, 24, 0.14);
    object-fit: contain;
}

.home-hero h1 {
    margin: 0;
    font-size: clamp(2.25rem, 6vw, 5rem);
    line-height: 0.95;
}

.home-hero .primary-link {
    background: white;
    color: var(--leaf-dark);
}

.header-band h1 {
    margin: 0;
    max-width: 720px;
    font-size: clamp(2.1rem, 6vw, 4.7rem);
    line-height: 0.95;
    letter-spacing: 0;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}

.eyebrow,
.season-card span,
.metric span,
.panel-heading span,
small,
dt {
    color: var(--muted);
}

.eyebrow {
    margin: 0 0 10px;
    color: rgba(255, 255, 255, 0.86);
    text-transform: uppercase;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.season-card {
    display: grid;
    gap: 3px;
    min-width: 190px;
    padding: 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
}

.season-card strong {
    font-size: 1.2rem;
}

.metrics,
.workspace,
.lower-grid {
    display: grid;
    gap: 16px;
}

.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric,
.plot-list,
.plot-board,
.detail-panel,
.task-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 10px 28px rgba(43, 59, 49, 0.07);
}

.metric {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.metric strong {
    font-size: 1.35rem;
}

.workspace {
    grid-template-columns: 260px minmax(420px, 1fr) 340px;
    align-items: start;
}

.lower-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
}

.tasks-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}

.market-focus-layout {
    display: grid;
    grid-template-columns: minmax(340px, 1fr) minmax(0, 2fr);
    gap: 16px;
    align-items: start;
}

.market-planning-column,
.market-inventory-column {
    display: grid;
    gap: 16px;
    align-content: start;
}

.page-heading,
.task-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.page-heading h1,
.task-callout h2 {
    margin: 0;
}

.page-heading h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.eyebrow.dark {
    color: var(--leaf-dark);
}

.primary-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 6px;
    background: var(--leaf);
    color: white;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.plot-list,
.plot-board,
.detail-panel,
.task-panel {
    padding: 18px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.plot-option,
.task-row {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    text-align: left;
}

.plot-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 12px;
    border-radius: 8px;
}

.row-sort-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 8px;
}

.row-sort-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.icon-button {
    display: grid;
    place-items: center;
    min-width: 48px;
    min-height: 30px;
    padding: 4px 8px;
    font-size: 0.72rem;
}

.plot-option span {
    display: grid;
    gap: 2px;
}

.plot-option em {
    color: var(--muted);
    font-style: normal;
    white-space: nowrap;
}

.plot-option.active,
.plot-option:hover {
    border-color: #b9cbb7;
    background: #eef5eb;
}

.bed-map {
    display: grid;
    gap: 8px;
}

.bed-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
}

.bed-row {
    transition: transform 160ms ease, opacity 140ms ease;
}

.bed-row.draggable-row .row-label {
    align-content: center;
}

.row-drag-handle {
    width: 28px;
    height: 24px;
    padding: 0;
    border: 1px solid #d8cda8;
    border-radius: 6px;
    background: #fff9e7;
    color: var(--leaf-dark);
    cursor: grab;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0;
}

.row-drag-handle:active {
    cursor: grabbing;
}

.row-drop-placeholder {
    min-height: 58px;
    border: 2px dashed #9bb694;
    border-radius: 8px;
    background: #eef5eb;
    transition: height 160ms ease;
}

.row-drag-ghost {
    position: fixed;
    z-index: 2000;
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
    pointer-events: none;
    opacity: 0.92;
    filter: drop-shadow(0 18px 24px rgba(23, 35, 29, 0.2));
}

.row-being-dragged {
    opacity: 0;
}

.row-label {
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 3px;
    min-height: 58px;
    padding: 7px;
    border-radius: 8px;
    background: #f1efe7;
}

.spaces {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 8px;
}

.space-tile {
    display: grid;
    align-content: space-between;
    gap: 5px;
    min-height: 58px;
    padding: 8px 10px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--field);
    color: var(--ink);
    text-align: left;
}

.space-tile span {
    font-size: 0.72rem;
    color: rgba(23, 35, 29, 0.7);
}

.space-tile strong {
    font-size: 0.86rem;
    line-height: 1.15;
}

.row-label strong {
    line-height: 1.1;
}

.row-label span {
    font-size: 0.72rem;
    color: var(--muted);
}

.space-tile small {
    font-size: 0.7rem;
}

.space-tile strong {
    overflow-wrap: anywhere;
}

.space-tile.selected {
    border-color: var(--ink);
}

.space-tile.open {
    background: #f8f8f0;
    border-style: dashed;
}

.space-tile.vegetable {
    background: #dcebd6;
}

.space-tile.herb {
    background: #d9eee5;
}

.space-tile.flower {
    background: #f1dde4;
}

.space-tile.fruit {
    background: #f4e3d1;
}

.space-tile.covercrop {
    background: #e3e9cd;
}

.space-tile.walkway,
.walkway-row .row-label {
    background: #ece9df;
    color: #5d574d;
}

.space-tile.walkway {
    border-style: dashed;
}

.plot-task-list {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.text-button,
.primary-button {
    border: 0;
    border-radius: 6px;
    font-weight: 700;
}

.text-button {
    padding: 8px 10px;
    background: #eef5eb;
    color: var(--leaf-dark);
}

.text-button.danger {
    background: #f3e3e7;
    color: #8d2f49;
}

.primary-button {
    width: 100%;
    padding: 11px 14px;
    background: var(--leaf);
    color: white;
}

.primary-button.fit {
    width: fit-content;
}

.danger-button {
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-radius: 6px;
    background: #9b3d57;
    color: white;
    font-weight: 800;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.action-row.left {
    justify-content: flex-start;
}

.lookup-form-grid {
    display: grid;
    grid-template-columns: minmax(180px, 1.1fr) minmax(220px, 2fr) minmax(120px, 0.7fr) auto;
    gap: 10px;
    align-items: end;
}

.form-message {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #eef5eb;
    color: var(--leaf-dark);
    font-weight: 700;
}

.plant-card {
    display: grid;
    gap: 12px;
}

.plant-card h3 {
    margin: 0;
    font-size: 2rem;
}

.plant-card p {
    margin: 0;
}

.status {
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eef5eb;
    color: var(--leaf-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

dt,
dd {
    margin: 0;
}

dd {
    font-weight: 800;
}

.notes {
    padding: 12px;
    border-left: 4px solid var(--sun);
    background: #fff7e8;
}

.quiet {
    margin: 0;
    color: var(--muted);
}

.plant-summary {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f6f8f1;
}

.plant-summary span {
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 12px;
}

.form-stack.compact {
    gap: 10px;
}

.form-stack label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.check-label {
    display: flex !important;
    align-items: center;
    gap: 8px !important;
}

.check-label input {
    width: auto !important;
}

.form-stack input,
.form-stack select,
.form-stack textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5c8;
    border-radius: 6px;
    background: #fbfcf8;
    color: var(--ink);
    padding: 10px 11px;
}

.form-stack textarea {
    min-height: 78px;
    resize: vertical;
}

.checkline {
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: var(--ink) !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    text-transform: none !important;
}

.checkline input {
    width: 18px !important;
    min-height: 18px !important;
}

.two-up {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.task-panel {
    scroll-margin-top: 20px;
}

.task-toolbar {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 6px;
}

.sort-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    gap: 10px;
}

.sort-controls label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.sort-controls select {
    width: 100%;
    border: 1px solid #cbd5c8;
    border-radius: 6px;
    background: #fbfcf8;
    color: var(--ink);
    padding: 10px 11px;
}

.task-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom-color: var(--line);
}

.task-row.active {
    padding-inline: 10px;
    border-color: #b9cbb7;
    border-radius: 8px;
    background: #eef5eb;
}

.task-row.subtle {
    padding-left: 40px;
    color: var(--muted);
}

.task-row.log-row {
    grid-template-columns: minmax(0, 1fr) minmax(140px, auto) auto;
}

.task-row.planting-history-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
}

.task-row.inventory-total-row,
.task-row.inventory-lot-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.grid-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.8fr) repeat(3, minmax(120px, 0.8fr));
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.grid-toolbar label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.grid-toolbar input,
.grid-toolbar select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cbd5c8;
    border-radius: 6px;
    background: #fbfcf8;
    color: var(--ink);
    padding: 8px 10px;
    font-size: 0.92rem;
    text-transform: none;
}

.data-grid-shell {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf8;
}

.data-grid {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.data-grid th,
.data-grid td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-grid th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f1efe7;
    color: var(--leaf-dark);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.sort-header {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: inherit;
    text-transform: inherit;
}

.numeric .sort-header {
    text-align: right;
}

.data-grid td {
    color: var(--ink);
    font-size: 0.91rem;
}

.data-grid tbody tr {
    cursor: pointer;
}

.data-grid tbody tr:hover,
.data-grid tbody tr.active {
    background: #eef5eb;
}

.data-grid tbody tr:last-child td {
    border-bottom: 0;
}

.data-grid .numeric {
    text-align: right;
    white-space: nowrap;
}

.empty-grid {
    margin: 0;
    padding: 16px;
    color: var(--muted);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
}

.pager .text-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.summary-grid div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf8;
}

.summary-grid span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.history-block {
    padding-block: 6px;
    border-bottom: 1px solid var(--line);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(16, 27, 21, 0.48);
}

.modal-panel {
    width: min(620px, 100%);
    max-height: min(820px, 92vh);
    overflow: auto;
    padding: 20px;
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.modal-panel > .panel-heading {
    position: sticky;
    top: -20px;
    z-index: 2;
    margin: -20px -20px 16px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.modal-panel.wide {
    width: min(980px, 100%);
}

.modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.catalog-tree,
.catalog-varieties {
    display: grid;
    gap: 10px;
}

.catalog-group {
    display: grid;
    gap: 8px;
}

.catalog-group h3 {
    margin: 0;
    color: var(--leaf-dark);
    font-size: 0.95rem;
}

.catalog-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf8;
    color: var(--ink);
    text-align: left;
}

.catalog-item span {
    display: grid;
    gap: 3px;
}

.catalog-item.active,
.task-row.active {
    border-color: #9bb694;
    background: #eef5eb;
}

.list-group {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fbfcf8;
}

.list-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    background: #f1efe7;
    color: var(--leaf-dark);
    cursor: pointer;
    font-weight: 800;
}

.list-group summary span {
    color: var(--muted);
    font-size: 0.82rem;
}

.list-group .task-row {
    padding-inline: 12px;
}

.map-layout {
    grid-template-columns: 320px minmax(0, 1fr);
}

.map-panel {
    min-width: 0;
}

.farm-map {
    position: relative;
    min-height: 780px;
    overflow: hidden;
    border: 1px solid #c9d7c5;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(150, 172, 142, 0.16) 1px, transparent 1px),
        linear-gradient(rgba(150, 172, 142, 0.16) 1px, transparent 1px),
        #eef3e8;
    background-size: 18px 18px;
    touch-action: none;
}

.map-plot {
    position: absolute;
    display: grid;
    align-content: start;
    gap: 3px;
    min-width: 86px;
    min-height: 74px;
    padding: 10px;
    border: 2px solid #7a9a72;
    border-radius: 8px;
    background: rgba(250, 252, 248, 0.92);
    color: var(--ink);
    cursor: grab;
    text-align: left;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 22px rgba(34, 49, 39, 0.12);
}

.map-plot.dragging {
    z-index: 5;
    border-color: var(--leaf-dark);
    cursor: grabbing;
}

.map-plot strong,
.map-plot small {
    position: relative;
    z-index: 2;
    overflow-wrap: anywhere;
}

.row-lines {
    position: absolute;
    inset: 8px;
    z-index: 1;
    pointer-events: none;
}

.row-lines i {
    position: absolute;
    min-height: 2px;
    min-width: 2px;
    border-radius: 999px;
    background: rgba(150, 158, 146, 0.58);
}

.row-lines i.planted {
    background: rgba(42, 132, 75, 0.78);
}

.row-lines i.open {
    background: rgba(150, 158, 146, 0.58);
}

.row-lines i.walkway {
    border-radius: 999px;
    background: rgba(116, 107, 94, 0.32);
}

.calendar-month {
    display: grid;
    gap: 10px;
    margin-bottom: 22px;
}

.calendar-month h2 {
    margin: 0;
    color: var(--leaf-dark);
    font-size: 1.05rem;
}

.harvest-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 120px;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf8;
}

.harvest-row span {
    display: grid;
    gap: 3px;
}

.harvest-current-panel {
    border-color: #a8c99c;
    background: #f4fbf0;
}

.active-harvest {
    border-color: #b4d6a8;
    background: #f8fff4;
}

.active-harvest time,
.active-harvest strong {
    color: var(--leaf-dark);
}

.task-row:last-child {
    border-bottom-color: transparent;
}

.task-row.done {
    opacity: 0.58;
}

.task-row span:nth-child(2) {
    display: grid;
    gap: 3px;
}

.check {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid #bac8b8;
    border-radius: 50%;
    color: var(--leaf-dark);
    font-weight: 900;
}

.check:empty {
    display: none;
}

.task-row:has(> .check:empty) {
    grid-template-columns: minmax(0, 1fr) auto;
}

.list-group.catalog-family,
.list-group.catalog-crop {
    margin-bottom: 0;
}

.catalog-family {
    padding: 8px;
}

.catalog-family > summary {
    border-radius: 6px;
}

.catalog-crop {
    margin: 10px 0 0;
    border-color: #e8e2d2;
}

.catalog-crop > summary {
    border-radius: 6px;
    background: #faf8ef;
}

.catalog-varieties {
    padding: 10px;
}

.divider {
    height: 1px;
    margin: 18px 0;
    background: var(--line);
}

.form-field {
    display: grid;
    gap: 7px;
}

.field-label {
    color: var(--leaf-dark);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.field-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.multi-select-list {
    display: grid;
    gap: 6px;
    max-height: 190px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf8;
}

.multi-select-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.multi-select-option:hover {
    background: #eef5eb;
}

.panel-heading.tight {
    margin-bottom: 10px;
}

.market-calendar-panel {
    margin-bottom: 16px;
}

.compact-market-calendar {
    padding: 14px;
}

.compact-market-calendar .panel-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
}

.compact-market-calendar .action-row {
    width: 100%;
    justify-content: space-between;
}

.calendar-weekdays,
.market-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    gap: 6px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.calendar-weekdays span {
    padding: 0 6px;
}

.market-calendar {
    gap: 6px;
}

.calendar-day {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 118px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf8;
}

.compact-market-calendar .calendar-weekdays {
    gap: 3px;
    font-size: 0.68rem;
}

.compact-market-calendar .calendar-weekdays span {
    padding: 0 2px;
    text-align: center;
}

.compact-market-calendar .market-calendar {
    gap: 4px;
}

.compact-market-calendar .calendar-day {
    min-height: 68px;
    gap: 4px;
    padding: 6px;
    border-radius: 6px;
}

.compact-market-calendar .calendar-date {
    font-size: 0.82rem;
}

.compact-market-calendar .market-chip {
    min-height: 22px;
    padding: 3px 5px;
    border-radius: 5px;
    font-size: 0.72rem;
}

.compact-market-calendar .market-chip small {
    display: none;
}

.calendar-day.muted {
    background: #f6f3ea;
    color: var(--muted);
}

.calendar-day.today {
    border-color: #9bb694;
    box-shadow: inset 0 0 0 1px #9bb694;
}

.calendar-date {
    color: var(--leaf-dark);
    font-weight: 900;
}

.market-chip {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 7px 8px;
    border: 1px solid #cfdcc8;
    border-radius: 7px;
    background: #eef5eb;
    color: var(--ink);
    text-align: left;
}

.market-chip.active {
    border-color: var(--leaf);
    background: #dfeedd;
}

.market-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.market-chip small {
    color: var(--muted);
}

time {
    color: var(--muted);
    white-space: nowrap;
}

#blazor-error-ui {
    color-scheme: light only;
    display: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    max-width: 420px;
    padding: 12px 44px 12px 14px;
    border-radius: 8px;
    background: #7a1f2d;
    color: white;
    box-shadow: var(--shadow);
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 12px;
    top: 10px;
    cursor: pointer;
}

@media (max-width: 1180px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace,
    .lower-grid,
    .market-focus-layout,
    .tasks-layout {
        grid-template-columns: 1fr;
    }

    .plot-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 8px;
    }

    .plot-list .panel-heading {
        grid-column: 1 / -1;
    }

}

@media (max-width: 720px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    .content {
        padding: 10px;
    }

    .header-band {
        align-items: flex-start;
        flex-direction: column;
        min-height: 132px;
        padding: 18px;
    }

    .header-band h1 {
        font-size: 2.25rem;
        line-height: 1;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .bed-row,
    .two-up {
        grid-template-columns: 1fr;
    }

    .row-label {
        min-height: auto;
    }

    .spaces {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .season-card {
        width: 100%;
        box-sizing: border-box;
    }

    .page-heading,
    .task-callout,
    .task-toolbar,
    .home-hero {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .page-heading h1 {
        font-size: 2.15rem;
    }

    .plot-list,
    .plot-board,
    .detail-panel,
    .task-panel,
    .metric {
        padding: 14px;
    }

    .sort-controls {
        grid-template-columns: 1fr;
    }

    .grid-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .grid-toolbar .search-field {
        grid-column: 1 / -1;
    }

    .lookup-form-grid {
        grid-template-columns: 1fr;
    }

    .modal-grid {
        grid-template-columns: 1fr;
    }

    .calendar-weekdays {
        display: none;
    }

    .market-calendar {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        min-height: auto;
    }

    .calendar-day.muted:not(:has(.market-chip)) {
        display: none;
    }

    .modal-backdrop {
        align-items: end;
        padding: 8px;
    }

    .modal-panel,
    .modal-panel.wide {
        width: 100%;
        max-height: 92dvh;
        box-sizing: border-box;
        padding: 16px;
    }

    .modal-panel > .panel-heading {
        top: -16px;
        margin: -16px -16px 14px;
        padding: 16px;
    }

    .task-row {
        grid-template-columns: 24px minmax(0, 1fr);
        gap: 10px;
        min-height: 48px;
        padding: 12px 0;
    }

    .task-row time,
    .task-row > .action-row {
        grid-column: 2;
        justify-self: start;
        white-space: normal;
    }

    .catalog-item {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
    }

    .data-grid {
        min-width: 640px;
    }

    .action-row {
        justify-content: flex-start;
    }

    .primary-button,
    .text-button,
    .danger-button,
    .primary-link,
    .form-stack input,
    .form-stack select,
    .form-stack textarea,
    .sort-controls select,
    .login-panel input {
        min-height: 44px;
    }

    .map-layout {
        grid-template-columns: 1fr;
    }

    .farm-map {
        min-height: 520px;
        overflow: auto;
    }

    .map-plot {
        min-width: 72px;
        min-height: 60px;
        padding: 8px;
    }

    .map-plot small {
        font-size: 0.72rem;
    }

    dl {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 460px) {
    .content {
        padding: 8px;
    }

    .top-row span {
        display: none;
    }

    .logout-form {
        width: 100%;
        justify-content: space-between;
    }

    .spaces {
        grid-template-columns: 1fr;
    }

    .space-tile {
        min-height: 78px;
    }

    .panel-heading {
        align-items: start;
        flex-direction: column;
        gap: 6px;
    }

    .list-group summary {
        padding: 12px 10px;
    }

    .grid-toolbar,
    .pager {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .grid-toolbar {
        display: grid;
    }

    .grid-toolbar .search-field {
        grid-column: auto;
    }

    .pager {
        display: grid;
    }

    .farm-map {
        min-height: 460px;
    }
}
