/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Bauhaus/Swiss Style Color Palette */
    --black: #000000;
    --white: #ffffff;
    --gray-10: #1a1a1a;
    --gray-20: #333333;
    --gray-30: #4d4d4d;
    --gray-40: #666666;
    --gray-50: #808080;
    --gray-80: #cccccc;
    --gray-90: #e5e5e5;
    --gray-95: #f5f5f5;
    --gray-98: #fafafa;

    --paper: #f7f5ef;
    --paper-grid: rgba(0, 0, 0, 0.035);

    /* Primary Colors - Bauhaus inspired */
    --red: #e63946;
    --blue: #1d3557;
    --yellow: #ffc300;
    --green: #2a9d8f;
    --primary-green: #2a9d8f;
    --secondary-green: #1d3557;

    /* Activity Colors - Simplified Palette */
    /* Greenhouse indicated by border, not color */
    --color-si: #6FA8DC;  /* Cornflower blue - sow indoors */
    --color-s: #93C47D;   /* Pistachio green - sow outdoors */
    --color-sg: #93C47D;  /* Same green (greenhouse = border) */
    --color-t: #B4A7D6;   /* Lavender - transplant */
    --color-tg: #B4A7D6;  /* Same lavender (greenhouse = border) */
    --color-h: #d8c27a;   /* Muted gold - harvest */
    --color-B: #9B7EBD;   /* Purple - bulbs */
    --color-special: #A8B5A8;   /* Neutral sage - special handling */

    /* Null cell alternating shades */
    --empty-cell-odd: #fafafa;
    --empty-cell-even: #f0f0f0;

    /* Flower highlight color */
    --flower-bg: #fffaed;
    --flower-bg-alt: #f5f0d8;

    /* Grid column sizing */
    --grid-half-month-width: 28px;
}

@media (max-width: 768px) {
    :root {
        --grid-half-month-width: 20px;
    }
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--gray-95);
    color: var(--black);
    line-height: 1.4;
    font-weight: 400;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    padding-bottom: 30px;
}

.container {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0;
    background-color: var(--white);
    border: 1px solid var(--gray-80);
    position: relative;
}

@media (max-width: 768px) {
    .container {
        max-width: 100%;
        margin: 0;
        border: 0;
        box-shadow: none;
    }
}

/* Accessibility Helpers */
[hidden] {
    display: none !important;
}

.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 8px 12px;
    background-color: var(--black);
    color: var(--white);
    border: 1px solid var(--black);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    transform: translateY(-200%);
    transition: transform 0.15s ease;
    z-index: 1000;
}

.skip-link:focus {
    transform: translateY(0);
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.results-summary {
    margin: 0;
    font-size: 0.65rem;
    color: var(--gray-30);
    display: none;
}

.btn:focus-visible,
.search-input:focus-visible,
.select-input:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

.checkbox-label:focus-within {
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

.legend-note code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 600;
    padding: 2px 4px;
    background-color: var(--gray-90);
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Header */
header {
    background-color: var(--white);
    color: var(--black);
    padding: 20px 40px;
    border-bottom: 1px solid var(--gray-80);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.view-switch-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.view-switch {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border: 1px solid var(--gray-80);
    border-radius: 16px;
    background-color: var(--white);
    gap: 4px;
}

.view-switch-btn {
    border: 0;
    background: transparent;
    color: var(--gray-30);
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.view-switch-btn:hover {
    background-color: var(--gray-95);
    color: var(--black);
}

.view-switch-btn.active {
    background-color: var(--black);
    color: var(--white);
}

.view-switch-hint {
    margin: 0;
    font-size: 0.7rem;
    color: var(--gray-30);
    max-width: 240px;
    text-align: right;
}

.header-switch-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.dataset-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--gray-80);
    border-radius: 999px;
    background: var(--gray-95);
}

.dataset-switch-btn {
    border: 0;
    background: transparent;
    color: var(--gray-30);
    padding: 3px 7px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dataset-switch-btn:hover {
    color: var(--black);
}

.dataset-switch-btn.active {
    background: var(--black);
    color: var(--white);
}

main {
    position: relative;
}

header h1 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0;
    line-height: 1.1;
}

.subtitle {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--gray-30);
}

.subtitle-mobile {
    display: none;
}

/* Controls Section */
.controls {
    background: var(--white);
    padding: 8px 40px;
    border-bottom: 1px solid var(--gray-80);
}

@media (min-width: 980px) {
    .controls {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        align-items: center;
        justify-content: space-between;
    }

    .control-group {
        margin-bottom: 0;
    }

    .filter-group {
        margin-left: auto;
    }
}

.control-group {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group h3 {
    color: var(--black);
    margin: 0;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* Hide search toggle on desktop - only show on mobile */
.search-toggle {
    display: none;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    background-color: var(--white);
    color: var(--black);
    border: 1px solid var(--gray-80);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
    background-color: var(--gray-95);
    border-color: var(--black);
}

.btn.active {
    background-color: #6fa8dc;
    color: var(--white);
    border: 2px solid #4a7ba7;
}

.btn-secondary {
    background-color: var(--gray-95);
    border-color: var(--gray-80);
}

.btn-secondary:hover {
    background-color: var(--gray-90);
    border-color: var(--gray-30);
}

/* Input Styles */
.search-input,
.select-input {
    padding: 6px 10px;
    border: 1px solid var(--black);
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: border-color 0.15s ease;
    background-color: var(--white);
}

.search-input {
    min-width: 200px;
    flex: 1;
}

.search-input:focus,
.select-input:focus {
    outline: none;
    border-width: 2px;
    padding: 5px 9px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 10px;
    background-color: var(--white);
    border: 1px solid var(--black);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
}

.checkbox-label:hover {
    background-color: var(--gray-95);
}

.checkbox-label.flowers-label {
    background-color: var(--flower-bg);
    border-color: var(--gray-80);
}

.checkbox-label.flowers-label:hover {
    background-color: var(--flower-bg);
    border-color: var(--black);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Shared tooltip styles */
.checkbox-label[data-tooltip]::after,
.legend-item::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: max-content;
    max-width: 200px;
    padding: 6px 10px;
    background-color: var(--black);
    color: var(--white);
    border: 1px solid var(--black);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 400;
    font-style: normal;
    text-transform: none;
    letter-spacing: 0.01em;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 9999;
    white-space: normal;
    text-align: center;
}

.checkbox-label[data-tooltip]:hover::after,
.legend-item:hover::after {
    opacity: 1;
}

.checkbox-with-tooltip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

@media (max-width: 768px) {
    .header-top {
        gap: 8px;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle .btn {
        flex: 1;
    }
}

/* Legend */
.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    background: var(--white);
    border: 1px solid var(--gray-80);
    border-radius: 100px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.legend-item:hover {
    background-color: var(--gray-95);
    border-color: var(--black);
}

.legend-item.active {
    background-color: #6fa8dc;
    color: var(--white);
    border: 2px solid #4a7ba7;
}

.legend-item.active .legend-badge {
    border-color: var(--white);
}

.legend-badge {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 0px;
    font-weight: 600;
    font-size: 0.6rem;
    color: var(--white);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Activity Badge Colors */
.activity-all { background-color: var(--gray-50); color: var(--white); }
.activity-si { background-color: var(--color-si); color: rgba(0, 0, 0, 0.3); }
.activity-t { background-color: var(--color-t); color: rgba(0, 0, 0, 0.3); }
.activity-s { background-color: var(--color-s); color: rgba(0, 0, 0, 0.3); }
.activity-sg { background-color: var(--color-sg); color: rgba(0, 0, 0, 0.3); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.activity-tg { background-color: var(--color-tg); color: rgba(0, 0, 0, 0.3); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.activity-h {
    background-color: transparent;
    color: var(--gray-20);
}
.legend-badge.activity-h {
    background-color: var(--color-h);
    color: rgba(0, 0, 0, 0.45);
}
.activity-o,
.activity-special { background-color: var(--color-special); color: rgba(0, 0, 0, 0.3); }
.activity-B { background-color: var(--color-s); color: rgba(0, 0, 0, 0.3); }

/* Views */
.view {
    display: none;
    background: var(--white);
    padding: 0;
}

.view.active {
    display: block;
}

/* Grid View */
.table-container {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    margin: 0;
    padding: 0;
    -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
}

/* Sticky header outside the horizontal scroll container (keeps header sticky on page scroll) */
.grid-sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--gray-95);
    border-bottom: 1px solid var(--gray-80);
}

.grid-sticky-header .icon-col {
    position: sticky;
    left: 0;
    z-index: 51;
    background: var(--gray-95);
}

.grid-sticky-header-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    scrollbar-width: none; /* Firefox */
}

.grid-sticky-header-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

body.has-grid-sticky-header #gridTable thead {
    display: none;
}

.calendar-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.65rem;
    font-weight: 400;
}

.calendar-table col.col-icon {
    width: 48px;
}

.calendar-table col.col-plant {
    width: 180px;
}

/* Half-month columns auto-fill remaining space equally */
.calendar-table col.col-half-month {
    width: auto;
}

.calendar-table thead tr:first-child th {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-30);
    letter-spacing: 0.12em;
    background: var(--gray-95);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--gray-80);
}

.calendar-table thead th {
    background: var(--gray-95);
    color: var(--black);
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.14em;
    border: none;
    border-bottom: 1px solid var(--gray-80);
    transition: background-color 0.15s ease, color 0.15s ease;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 11;
}

.calendar-table thead tr:first-child th {
    top: 0;
}

.calendar-table thead tr.half-month-header th {
    top: 33px; /* Height of first header row */
}

.calendar-table thead tr.half-month-header th:not(.sticky-col):hover {
    background-color: var(--black);
    color: var(--white);
}

.calendar-table .sticky-col {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 11;
    text-align: left;
}

.calendar-table thead th.plant-col {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.calendar-table thead .sticky-col {
    background: var(--gray-95);
    color: var(--black);
    border-right: 1px solid var(--gray-80);
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 11;
}

/* Icon column (sticky) */
.icon-col {
    text-align: center;
}

.calendar-table thead th.icon-col,
.calendar-table thead th.col-icon {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 25;
}

.calendar-table thead tr:first-child th.sticky-col {
    z-index: 30;
}

.calendar-table tbody .icon-col {
    background-color: var(--white);
    color: var(--black);
    border-right: none;
    padding: 4px 4px 4px 8px;
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 2;
}

/* Alternating backgrounds for icon and plant columns */
.calendar-table tbody tr:nth-child(odd) .icon-col,
.calendar-table tbody tr:nth-child(odd) .plant-col {
    background-color: var(--empty-cell-odd);
}

.calendar-table tbody tr:nth-child(even) .icon-col,
.calendar-table tbody tr:nth-child(even) .plant-col {
    background-color: var(--empty-cell-even);
}

/* Merged plant header */
.plant-header-merged {
    background: var(--gray-95);
    color: var(--black);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-align: left;
    padding-left: 8px;
    border-right: 2px solid var(--black);
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 12;
}

/* First row plant header at top */
.calendar-table thead tr:first-child .plant-header-merged {
    top: 0;
}

/* Second row plant header below first */
.calendar-table thead tr.half-month-header .plant-header-merged {
    top: 33px;
}

/* Plant name column */
.plant-col {
    background-color: var(--white);
    color: var(--black);
    font-weight: 800;
    padding: 4px 8px 4px 0;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
    text-transform: none;
    text-align: left;
    border-right: 2px solid var(--black);
    white-space: nowrap;
}

/* Flower row highlighting with alternating backgrounds */
.calendar-table tbody tr.flower-row:nth-child(odd) .icon-col,
.calendar-table tbody tr.flower-row:nth-child(odd) .plant-col,
.calendar-table tbody tr.flower-row:nth-child(odd) td {
    background-color: var(--flower-bg);
}

.calendar-table tbody tr.flower-row:nth-child(even) .icon-col,
.calendar-table tbody tr.flower-row:nth-child(even) .plant-col,
.calendar-table tbody tr.flower-row:nth-child(even) td {
    background-color: var(--flower-bg-alt);
}

.plant-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.plant-icon-svg {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}

.month-plant-icon-svg {
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
}

.plant-name {
    display: inline-block;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.plant-name-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.review-confidence-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border: 1px solid transparent;
}

.review-confidence-high {
    background-color: #3f8f4e;
    border-color: #2d6a39;
}

.review-confidence-medium {
    background-color: #c9921f;
    border-color: #9d6d09;
}

.review-confidence-low {
    background-color: #c45a43;
    border-color: #953c29;
}

.plant-marker {
    width: 8px;
    height: 8px;
    border: 1px solid var(--gray-80);
    flex: 0 0 auto;
    display: none;
}

.plant-marker.is-vegetable {
    background: var(--green);
}

.plant-marker.is-flower {
    background: var(--yellow);
    border-radius: 50%;
}

/* Plant cell tooltips */
.icon-col[data-tooltip],
.plant-col[data-tooltip] {
    cursor: help;
}

.plant-col[data-tooltip] {
    position: relative;
}

.icon-col[data-tooltip]::after,
.plant-col[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    width: max-content;
    max-width: 200px;
    padding: 6px 10px;
    background-color: var(--black);
    color: var(--white);
    border: 1px solid var(--black);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 400;
    font-style: normal;
    text-transform: none;
    letter-spacing: 0.01em;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 9999;
    white-space: normal;
    text-align: left;
}

.icon-col[data-tooltip]:hover::after,
.plant-col[data-tooltip]:hover::after {
    opacity: 1;
}

.half-month-header th {
    background: var(--gray-90);
    font-size: 0.65rem;
    padding: 6px 4px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--gray-80);
    position: -webkit-sticky;
    position: sticky;
    top: 33px;
    z-index: 9;
}

.half-month-header th:not(.icon-col):not(.plant-col) {
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
}

.calendar-table td {
    padding: 0;
    text-align: center;
    border: none;
    height: 18px;
    position: relative;
}

/* Month divider borders - add border after every 2nd half-month (end of each month) */
.calendar-table thead tr.half-month-header th:nth-child(even):not(.icon-col):not(.plant-col),
.calendar-table tbody td:nth-child(even) {
    border-right: 1px solid var(--gray-80);
}

/* Column hover effect */
.calendar-table thead th.column-hover:not(.icon-col):not(.plant-col) {
    box-shadow: inset 0 0 0 2px rgba(111, 168, 220, 0.5) !important;
}

.calendar-table tbody td.column-hover {
    position: relative;
}

.calendar-table tbody td.column-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-left: 2px solid rgba(111, 168, 220, 0.4);
    border-right: 2px solid rgba(111, 168, 220, 0.4);
    pointer-events: none;
    z-index: 1;
}

.calendar-table tbody tr {
    border-bottom: 1px solid var(--gray-90);
}

.calendar-table tbody tr:hover {
    background-color: var(--gray-95);
}

/* Alternating empty cell backgrounds */
.calendar-table tbody tr:not(.flower-row):nth-child(odd) td .activity-cell:not(.has-activity) {
    background-color: var(--empty-cell-odd);
}

.calendar-table tbody tr:not(.flower-row):nth-child(even) td .activity-cell:not(.has-activity) {
    background-color: var(--empty-cell-even);
}

/* Flower row empty cell backgrounds */
.calendar-table tbody tr.flower-row:nth-child(odd) td .activity-cell:not(.has-activity) {
    background-color: var(--flower-bg);
}

.calendar-table tbody tr.flower-row:nth-child(even) td .activity-cell:not(.has-activity) {
    background-color: var(--flower-bg-alt);
}

.activity-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 18px;
    position: relative;
    overflow: hidden;
}

.activity-cell.has-activity {
    flex-direction: row;
    flex-wrap: wrap;
    font-size: 0.55rem;
    font-weight: 800;
    color: rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 1px;
}

.activity-token {
    display: inline;
    color: inherit;
}

.activity-token-h {
    color: var(--color-h);
}

.timeline-half {
    white-space: nowrap;
}

.activity-cell.greenhouse {
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.activity-cell.harvest-only,
.timeline-half.harvest-only {
    background-color: var(--color-h);
}

.activity-cell.harvest-only .activity-token-h,
.timeline-half.harvest-only .activity-token-h {
    color: rgba(0, 0, 0, 0.3);
}

.activity-cell.filtered-out {
    background-color: var(--gray-90) !important;
    color: rgba(0, 0, 0, 0.15);
    opacity: 0.4;
}

.activity-badge {
    display: none;
}

/* Month View */
.month-selector {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 12px 40px;
    border-bottom: 1px solid var(--gray-80);
    background-color: var(--white);
}

.month-title-with-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.month-nav-btn {
    padding: 8px 16px;
    border: 1px solid var(--black);
    border-radius: 4px;
    background-color: var(--white);
    font-size: 1.2rem;
    min-width: 44px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.month-nav-btn:hover {
    background-color: var(--black);
    color: var(--white);
}

#currentMonthTitle {
    color: var(--black);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

#monthContent {
    padding: 16px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.month-activity-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.month-activity-header {
    color: var(--black);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--gray-80);
}

.month-plants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
}

.month-plant-card {
    --month-edge-left: transparent;
    --month-edge-right: transparent;
    --month-edge-left-glow: transparent;
    --month-edge-right-glow: transparent;
    border: 1px solid var(--gray-80);
    border-radius: 6px;
    padding: 8px;
    background-color: var(--white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow:
        inset 5px 0 0 var(--month-edge-left),
        inset -5px 0 0 var(--month-edge-right),
        inset 12px 0 0 var(--month-edge-left-glow),
        inset -12px 0 0 var(--month-edge-right-glow);
    display: flex;
    gap: 12px;
    align-items: center;
}

.month-plant-card--new {
    --month-edge-left: rgba(73, 134, 197, 0.92);
    --month-edge-left-glow: rgba(73, 134, 197, 0.18);
}

.month-plant-card--ending {
    --month-edge-right: rgba(184, 145, 52, 0.92);
    --month-edge-right-glow: rgba(184, 145, 52, 0.18);
}

.month-plant-card:hover {
    border-color: var(--gray-30);
}

.month-plant-card[data-tooltip] {
    position: relative;
}

.month-plant-card[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: min(260px, calc(100vw - 32px));
    padding: 8px 10px;
    background-color: var(--black);
    color: var(--white);
    border: 1px solid var(--black);
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 400;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 20;
    white-space: normal;
    text-align: left;
}

.month-plant-card[data-tooltip]:hover::after,
.month-plant-card[data-tooltip]:focus-within::after {
    opacity: 1;
}

.month-plant-card.flower-card {
    background-color: var(--flower-bg);
}

.month-plant-icon-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    line-height: 1;
    width: 50px;
    height: 50px;
}

.month-plant-icon-container .month-plant-icon-svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.month-plant-info-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.month-plant-name {
    color: var(--black);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.month-plant-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.month-plant-deer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    line-height: 1;
    opacity: 0.8;
    cursor: help;
}

.month-plant-spacing,
.month-plant-days {
    font-size: 0.75rem;
    color: var(--gray-30);
    line-height: 1.4;
}

.month-plant-info {
    font-size: 0.75rem;
    color: var(--gray-30);
    line-height: 1.4;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.month-activities {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.month-activity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.month-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.month-task-card {
    padding: 8px 10px;
    background-color: var(--gray-95);
    border: 1px solid var(--gray-80);
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--black);
    transition: border-color 0.15s ease, background-color 0.15s ease;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.month-task-card:hover {
    border-color: var(--gray-30);
    background-color: var(--white);
}

.task-emoji {
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

/* Footer */
footer {
    text-align: center;
    padding: 24px;
    background-color: var(--gray-95);
    border-top: 1px solid var(--gray-80);
    color: var(--gray-30);
    font-size: 0.7rem;
}

footer a {
    color: var(--black);
    text-decoration: none;
    font-weight: 700;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .calendar-table {
        font-size: 0.6rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 12px 16px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.7rem;
        line-height: 1.3;
    }

    .title-zone {
        display: none;
    }

    .subtitle-desktop {
        display: none;
    }

    .subtitle-mobile {
        display: block;
    }

    .view-switch-wrap {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
    }

    .view-switch {
        width: 100%;
    }

    .view-switch-btn {
        flex: 1 1 0;
        padding: 8px 10px;
        font-size: 0.64rem;
    }

    .view-switch-hint {
        font-size: 0.62rem;
        max-width: none;
        text-align: left;
    }

    .header-switch-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .controls {
        padding: 6px 12px;
        display: flex;
        flex-direction: column;
    }

    .legend {
        padding: 6px 12px;
    }

    .legend-group {
        order: 2;
    }

    .filter-group {
        order: 1;
    }

    .control-group {
        padding: 3px;
    }

    .button-group {
        flex-direction: column;
    }

    /* Hide "Filters" heading on mobile */
    .control-group h3 {
        display: none;
    }

    .filter-controls {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
    }

    /* Search toggle button - mobile only, match checkbox style */
    .search-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        padding: 3px 10px;
        font-size: 1.1rem;
        background: var(--white);
        border: 1px solid var(--gray-80);
        border-radius: 12px;
        cursor: pointer;
        flex: 0 0 auto;
        font-weight: 500;
    }

    .search-toggle:hover {
        background-color: var(--gray-95);
        border-color: var(--black);
    }

    .search-toggle[aria-expanded="true"] {
        background-color: var(--black);
        color: var(--white);
        border-color: var(--black);
    }

    /* Hide search input initially on mobile */
    .filter-controls .search-input {
        display: none;
    }

    /* Show search when expanded - compact width */
    .filter-controls.search-expanded .search-input {
        display: block;
        flex: 0 1 auto;
        width: 120px;
        min-width: 100px;
    }

    .filter-controls .checkbox-label {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* Hide results summary and reset button on mobile */
    .results-summary,
    #resetFilters {
        display: none;
    }

    .search-input {
        min-width: 100%;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 2px 10px;
        border: 1px solid var(--gray-80);
        border-radius: 12px;
        height: 31px;
        line-height: 1.2;
    }

    /* Compact legend items */
    .legend-items {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 6px;
    }

    .legend-item {
        padding: 4px 6px;
        font-size: 0.65rem;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Compact button touch targets */
    .btn {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* Table adjustments */
    .calendar-table {
        font-size: 0.6rem;
        width: auto;
    }

    .calendar-table th {
        padding: 2px 2px;
    }

    .calendar-table thead th {
        padding: 4px 2px;
    }

    .calendar-table td {
        min-width: 22px;
    }

    .calendar-table col.col-half-month {
        width: 22px;
    }

    /* Compact header format on mobile: 1/2 and 2/2 for all months */
    .calendar-table thead tr.half-month-header th:nth-child(n+3) {
        font-size: 0;
    }

    .calendar-table thead tr.half-month-header th:nth-child(n+3)::after {
        font-size: 0.6rem;
    }

    /* First half of each month = 1/2 (odd columns starting from 3) */
    .calendar-table thead tr.half-month-header th:nth-child(odd):nth-child(n+3)::after { content: "1/2"; }

    /* Second half of each month = 2/2 (even columns starting from 4) */
    .calendar-table thead tr.half-month-header th:nth-child(even):nth-child(n+4)::after { content: "2/2"; }

    /* Icon column stays sticky and narrow on mobile */
    .calendar-table .icon-col {
        width: 32px;
        min-width: 32px;
        max-width: 32px;
        padding: 4px;
    }

    .calendar-table col.col-icon {
        width: 32px;
    }

    .calendar-table col.col-plant {
        width: 120px;
    }

    .plant-icon {
        display: block;
    }

    .plant-icon-svg {
        width: 20px;
        height: 20px;
    }

    /* Plant name column not sticky on mobile */
    .calendar-table .plant-col {
        position: relative;
        min-width: 80px;
        max-width: 120px;
        text-align: left;
        padding: 4px 8px 4px 4px;
    }

    .plant-name {
        font-size: 0.75rem;
    }

    /* Flower row highlighting on mobile */
    .calendar-table .flower-row .icon-col,
    .calendar-table .flower-row .plant-col {
        background-color: var(--flower-bg);
    }

    /* Activity cells min-width on mobile */
    .activity-cell {
        min-width: 19px;
    }

    /* Month view improvements */
    #monthContent {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .month-plant-card {
        padding: 6px;
        gap: 8px;
    }

    .month-plant-icon-container {
        font-size: 1.4rem;
        width: 32px;
        height: 32px;
    }

    .month-plant-icon-svg {
        width: 22px;
        height: 22px;
    }

    /* Better sticky icon column shadow on mobile */
    .calendar-table tbody .icon-col {
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    }

    /* Better focus visibility on mobile */
    button:focus-visible,
    .legend-item:focus-visible {
        outline: 3px solid var(--blue);
        outline-offset: 2px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 12px 16px;
    }

    header h1 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 0.7rem;
    }

    .controls,
    .legend {
        padding: 12px 16px;
    }

    /* Full width buttons */
    .btn {
        width: 100%;
        min-height: 48px;
        font-size: 0.9rem;
    }

    .view-toggle .btn {
        min-height: 44px;
    }

    /* Compact legend items on small screens */
    .legend-item {
        padding: 3px 8px;
     
        font-size: 0.65rem;
    }

    /* Better table readability */
    .calendar-table {
        font-size: 0.55rem;
    }

    /* Month navigation buttons */
    .month-nav button {
        min-height: 48px;
        min-width: 48px;
    }

    /* Checkbox and filter controls */
    input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    label {
        font-size: 0.85rem;
    }
}

/* Mini Footer */
.mini-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--gray-95);
    border-top: 1px solid var(--gray-80);
    padding: 6px 16px;
    text-align: center;
    z-index: 50;
}

.mini-footer p {
    margin: 0;
    font-size: 0.65rem;
    color: var(--gray-30);
}

.mini-footer a {
    color: var(--gray-30);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mini-footer a:hover {
    color: var(--black);
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }

    .controls,
    footer,
    .mini-footer,
    .btn {
        display: none;
    }

    .view {
        padding: 0;
    }

    .calendar-table {
        font-size: 0.5rem;
    }

    .calendar-table th,
    .calendar-table td {
        padding: 1px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--gray-30);
    font-size: 0.9rem;
    font-weight: 400;
}

.calendar-table thead th.is-current-month {
    background: var(--gray-95);
}

.calendar-table thead tr.half-month-header th.is-now {
    background: var(--gray-90);
    color: var(--black);
    box-shadow: inset 2px 0 0 var(--black);
}

.calendar-table td.is-now-col {
    background-color: transparent;
    box-shadow: inset 2px 0 0 var(--black);
}

.calendar-table td.is-now-col .activity-cell {
    box-shadow: inset 2px 0 0 var(--black);
}

.calendar-table td.is-now-col .activity-cell.greenhouse {
    box-shadow:
        inset 2px 0 0 var(--black),
        inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

/* Clickable plant cells and cards */
.plant-name-clickable {
    cursor: pointer !important;
    transition: background-color 0.15s ease;
}

.plant-name-clickable:hover {
    background-color: rgba(74, 124, 47, 0.05);
}

.plant-name-clickable:focus-visible {
    outline: 2px solid var(--secondary-green);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================
   Plant Detail Panel (Slide-in from Right)
   ============================================ */

body.panel-open {
    overflow: hidden;
}

.plant-detail-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.plant-detail-panel[hidden] {
    display: flex !important;
    opacity: 0;
}

.plant-detail-panel:not([hidden]) {
    pointer-events: auto;
    opacity: 1;
}

/* Overlay (darkens background) */
.panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

.plant-detail-panel[hidden] .panel-overlay {
    opacity: 0;
}

/* Panel Content (slides in from right) */
.panel-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 90%;
    max-width: 500px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.plant-detail-panel[hidden] .panel-content {
    transform: translateX(100%);
}

/* Panel Header */
.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--gray-90);
    background: var(--gray-98);
}

.panel-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-plant-icon {
    font-size: 32px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-plant-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#panelPlantName {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-green);
    margin: 0;
}

.panel-title-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.panel-quick-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-meta-item {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 10px;
    background: var(--white);
    border: 1px solid var(--gray-90);
    border-radius: 999px;
}

.quick-meta-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-40);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.quick-meta-value {
    font-size: 0.9rem;
    font-weight: 900;
    color: var(--black);
    white-space: nowrap;
}

.panel-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
    color: var(--gray-40);
}

.panel-close-btn:hover {
    background: var(--gray-90);
    color: var(--black);
}

/* Panel Body */
.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.panel-section {
    margin-bottom: 32px;
}

.panel-section:last-child {
    margin-bottom: 0;
}

/* Meta Information */
.panel-meta {
    display: flex;
    gap: 24px;
    padding: 16px;
    background: var(--gray-98);
    border-radius: 8px;
    border: 1px solid var(--gray-90);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-40);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--black);
}

/* Section Titles */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-green);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--secondary-green);
}

/* Varieties Content */
.varieties-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--gray-20);
}

.varieties-content strong {
    color: var(--black);
    font-weight: 600;
}

/* Tips Content */
.tips-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--gray-20);
}

.tips-content p {
    margin: 0 0 12px 0;
}

.tips-content p:last-child {
    margin-bottom: 0;
}

/* Panel lists (varieties + tips) */
.panel-bullets {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
    color: var(--gray-20);
    font-size: 0.95rem;
    line-height: 1.6;
}

.panel-empty-note {
    font-size: 0.9rem;
    color: var(--gray-30);
    background: var(--gray-98);
    border: 1px dashed var(--gray-80);
    border-radius: 10px;
    padding: 12px 14px;
}

.panel-review-item {
    color: var(--gray-20);
}

.panel-review-label {
    font-weight: 700;
    color: var(--black);
}

.panel-review-links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    vertical-align: top;
}

.panel-review-link {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--gray-80);
    background: var(--gray-98);
    color: var(--gray-20);
    font-size: 0.85rem;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.panel-review-link:hover,
.panel-review-link:focus-visible {
    background: var(--white);
    border-color: var(--gray-50);
    color: var(--black);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .panel-content {
        width: 100%;
        max-width: none;
    }

    .panel-header {
        padding: 16px;
    }

    #panelPlantName {
        font-size: 1.25rem;
    }

    .panel-title-row {
        align-items: flex-start;
    }

    .quick-meta-item {
        padding: 6px 8px;
    }

    .panel-body {
        padding: 16px;
    }

    .panel-meta {
        flex-direction: column;
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plant-detail-panel,
    .panel-overlay,
    .panel-content {
        transition: none !important;
    }
}
