/* ═══════════════════════════════════════════════════════════════
   Farm-E — Market Garden Manager
   Dark agricultural theme with green accent
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    --bg: #0a0f0a;
    --bg-alt: #0d140d;
    --surface: #141f14;
    --surface-hover: #1a2a1a;
    --surface-active: #1f331f;
    --border: #243524;
    --border-light: #2d4a2d;
    --text: #e0e8e0;
    --text-dim: #8a9f8a;
    --text-muted: #5a6f5a;
    --accent: #4caf50;
    --accent-dim: #2e7d32;
    --accent-bright: #66bb6a;
    --accent-glow: rgba(76, 175, 80, 0.15);
    --gold: #c9a84c;
    --gold-dim: #8a7333;
    --red: #ef5350;
    --red-dim: #b71c1c;
    --orange: #ff9800;
    --orange-dim: #e65100;
    --blue: #42a5f5;
    --blue-dim: #1565c0;
    --purple: #ab47bc;
    --purple-dim: #6a1b9a;
    --cyan: #26c6da;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 4px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 2px 12px rgba(76, 175, 80, 0.2);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --header-h: 56px;
    --nav-h: 44px;
    --transition: 0.2s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-alt);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dim);
}

/* ── Typography ── */
h1, h2, h3, h4 {
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
}
h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }

a {
    color: var(--accent-bright);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--accent); }

code, .mono {
    font-family: var(--font-mono);
    font-size: 0.88em;
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */

/* ── App Header ── */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-h);
    background: linear-gradient(180deg, #0f180f 0%, #0a120a 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    backdrop-filter: blur(12px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-bright);
    letter-spacing: -0.02em;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.brand-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.header-weather {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dim);
    margin-left: auto;
    margin-right: 12px;
}
.header-weather .hw-temp {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}
.header-weather .hw-desc {
    font-size: 12px;
}
.header-weather .hw-frost {
    color: var(--orange);
    font-weight: 600;
    font-size: 11px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.farm-selector,
.year-selector {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 28px 6px 10px;
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%235a6f5a' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.15s;
    color-scheme: dark;
}
.farm-selector:focus,
.year-selector:focus {
    border-color: var(--accent);
}
.farm-selector {
    max-width: 200px;
}
.year-selector {
    width: 90px;
}
.btn-accent {
    background: var(--accent-dim) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}
.btn-accent:hover {
    background: var(--accent) !important;
}
.btn-settings {
    background: none !important;
    border: 1px solid var(--border) !important;
    font-size: 16px !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    cursor: pointer;
    transition: border-color 0.15s;
}
.btn-settings:hover {
    border-color: var(--accent) !important;
    background: var(--surface) !important;
}

/* ── App Nav ── */
.app-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 99;
    height: var(--nav-h);
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 0 12px;
}

.app-nav a {
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dim);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}
.app-nav a:hover {
    color: var(--text);
    background: var(--surface);
}
.app-nav a.active {
    color: var(--accent-bright);
    border-bottom-color: var(--accent);
    background: var(--accent-glow);
}

/* ── App Content ── */
.app-content {
    margin-top: calc(var(--header-h) + var(--nav-h));
    padding: 24px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.3s ease;
}

/* ── View Header ── */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.view-header h1 {
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition);
}
.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 {
    margin-bottom: 0;
}
.card + .card {
    margin-top: 16px;
}

/* ── Stat Cards ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all var(--transition);
}
.stat-card:hover {
    border-color: var(--accent-dim);
    box-shadow: var(--shadow-accent);
    transform: translateY(-1px);
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-bright);
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.stat-value.gold { color: var(--gold); }
.stat-value.blue { color: var(--blue); }
.stat-value.orange { color: var(--orange); }
.stat-value.red { color: var(--red); }
.stat-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.stat-sublabel {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Grid Layouts ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.card-grid-sm {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}
.data-table th {
    background: var(--bg-alt);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr {
    transition: background var(--transition);
}
.data-table tbody tr:hover {
    background: var(--surface-hover);
}
.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}
.data-table tbody tr:nth-child(even):hover {
    background: var(--surface-hover);
}
.data-table td.actions {
    white-space: nowrap;
}
.data-table td.mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}
.data-table td.right,
.data-table th.right {
    text-align: right;
}

/* ═══════════════════════════════════════════════════════════════
   BADGES & PILLS
   ═══════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    line-height: 1.6;
}
.badge-planned { background: rgba(138, 159, 138, 0.2); color: var(--text-dim); }
.badge-seeded { background: rgba(66, 165, 245, 0.15); color: var(--blue); }
.badge-transplanted { background: rgba(171, 71, 188, 0.15); color: var(--purple); }
.badge-growing { background: rgba(76, 175, 80, 0.15); color: var(--accent-bright); }
.badge-harvesting { background: rgba(255, 152, 0, 0.15); color: var(--orange); }
.badge-done { background: rgba(201, 168, 76, 0.15); color: var(--gold); }
.badge-failed { background: rgba(239, 83, 80, 0.15); color: var(--red); }
.badge-active { background: rgba(76, 175, 80, 0.15); color: var(--accent-bright); }
.badge-ready { background: rgba(38, 198, 218, 0.15); color: var(--cyan); }
.badge-hardening { background: rgba(255, 152, 0, 0.15); color: var(--orange); }
.badge-germinating { background: rgba(171, 71, 188, 0.15); color: var(--purple); }
.badge-organic { background: rgba(76, 175, 80, 0.15); color: var(--accent-bright); }
.badge-cool { background: rgba(66, 165, 245, 0.15); color: var(--blue); }
.badge-warm { background: rgba(239, 83, 80, 0.15); color: var(--red); }
.badge-any { background: rgba(138, 159, 138, 0.15); color: var(--text-dim); }

/* ── Family Color Dot ── */
.family-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Tags ── */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 500;
    background: var(--surface-hover);
    color: var(--text-dim);
    border: 1px solid var(--border);
    gap: 4px;
}
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text);
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent-dim);
    color: var(--text);
}
.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent);
    box-shadow: var(--shadow-accent);
    color: #fff;
}

.btn-danger {
    background: transparent;
    border-color: var(--red-dim);
    color: var(--red);
}
.btn-danger:hover {
    background: rgba(239, 83, 80, 0.1);
    border-color: var(--red);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-dim);
    padding: 4px 8px;
}
.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

input,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    color-scheme: dark;
}
/* Kill number spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}
select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a6f5a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
textarea {
    min-height: 80px;
    resize: vertical;
}
input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
}

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filter-bar input,
.filter-bar select {
    max-width: 200px;
    padding: 6px 10px;
    font-size: 0.82rem;
}
.filter-bar label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--transition);
}
.modal-close:hover {
    color: var(--red);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: slideUp 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
    max-width: 400px;
    border-left: 4px solid;
}
.toast-success {
    background: #102010;
    border-left-color: var(--accent);
    color: var(--accent-bright);
}
.toast-error {
    background: #201010;
    border-left-color: var(--red);
    color: var(--red);
}
.toast-warning {
    background: #201a10;
    border-left-color: var(--orange);
    color: var(--orange);
}
.toast-info {
    background: #101620;
    border-left-color: var(--blue);
    color: var(--blue);
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATES & LOADING
   ═══════════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}
.empty-state h3 {
    color: var(--text-dim);
    margin-bottom: 8px;
}
.empty-state p {
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: middle;
    animation: spin 0.8s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════════════════════════════ */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.5s ease;
    min-width: 2px;
}
.progress-fill.over {
    background: var(--gold);
}
.progress-fill.low {
    background: var(--orange);
}
.progress-fill.critical {
    background: var(--red);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.88rem;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.alert-success {
    background: rgba(76, 175, 80, 0.08);
    border-left-color: var(--accent);
    color: var(--accent-bright);
}
.alert-warning {
    background: rgba(255, 152, 0, 0.08);
    border-left-color: var(--orange);
    color: var(--orange);
}
.alert-error {
    background: rgba(239, 83, 80, 0.08);
    border-left-color: var(--red);
    color: var(--red);
}
.alert-info {
    background: rgba(66, 165, 245, 0.08);
    border-left-color: var(--blue);
    color: var(--blue);
}

/* ═══════════════════════════════════════════════════════════════
   ROTATION GRID
   ═══════════════════════════════════════════════════════════════ */

.rotation-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.rotation-grid {
    display: grid;
    min-width: max-content;
}
.rotation-grid .rg-header {
    background: var(--bg-alt);
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}
.rotation-grid .rg-label {
    background: var(--surface);
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    position: sticky;
    left: 0;
    z-index: 1;
    white-space: nowrap;
}

.rotation-cell {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    font-size: 0.78rem;
    min-width: 100px;
    text-align: center;
    transition: background var(--transition);
}
.rotation-cell:hover {
    filter: brightness(1.2);
}
.rotation-cell.conflict {
    outline: 2px solid var(--red);
    outline-offset: -2px;
}

.rotation-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.rotation-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-dim);
}
.legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   TASK LIST
   ═══════════════════════════════════════════════════════════════ */

.task-list {
    list-style: none;
    padding: 0;
}
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.task-item:last-child {
    border-bottom: none;
}
.task-item:hover {
    background: var(--surface-hover);
}
.task-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 85px;
    flex-shrink: 0;
}
.task-type {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 100px;
    min-width: 75px;
    text-align: center;
    flex-shrink: 0;
}
.task-type.sow { background: rgba(66, 165, 245, 0.15); color: var(--blue); }
.task-type.transplant { background: rgba(171, 71, 188, 0.15); color: var(--purple); }
.task-type.harvest { background: rgba(255, 152, 0, 0.15); color: var(--orange); }
.task-type.bed_prep { background: rgba(138, 159, 138, 0.15); color: var(--text-dim); }
.task-type.nursery_transplant { background: rgba(38, 198, 218, 0.15); color: var(--cyan); }
.task-detail {
    flex: 1;
    font-size: 0.88rem;
}
.task-detail strong {
    color: var(--text);
}
.task-detail .task-location {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════════════════════
   NURSERY PIPELINE
   ═══════════════════════════════════════════════════════════════ */

.pipeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.pipeline-column {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.pipeline-column-header {
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pipeline-column-header .count {
    font-size: 0.72rem;
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 100px;
    color: var(--text-dim);
}
.pipeline-items {
    padding: 10px;
    min-height: 80px;
}
.pipeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    transition: all var(--transition);
}
.pipeline-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}
.pipeline-card:last-child {
    margin-bottom: 0;
}
.pipeline-card .crop-name {
    font-weight: 600;
    margin-bottom: 4px;
}
.pipeline-card .tray-info {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════════
   INLINE HARVEST FORM
   ═══════════════════════════════════════════════════════════════ */

.inline-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 14px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.inline-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 120px;
}
.inline-form .form-group label {
    font-size: 0.72rem;
}
.inline-form input,
.inline-form select {
    padding: 7px 10px;
    font-size: 0.82rem;
}

/* ═══════════════════════════════════════════════════════════════
   DEMAND PLAN
   ═══════════════════════════════════════════════════════════════ */

.demand-results {
    margin-top: 20px;
}
.demand-metric {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.demand-metric:last-child {
    border-bottom: none;
}
.demand-metric-label {
    color: var(--text-dim);
    min-width: 160px;
}
.demand-metric-value {
    font-weight: 600;
    font-family: var(--font-mono);
}
.feasible { color: var(--accent-bright); }
.infeasible { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   ZONE / PLANCHE DETAILS
   ═══════════════════════════════════════════════════════════════ */

.zone-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    transition: all var(--transition);
}
.zone-card:hover {
    border-color: var(--border-light);
}
.zone-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    transition: background var(--transition);
}
.zone-card-header:hover {
    background: var(--surface-hover);
}
.zone-card-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.zone-card-header .zone-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.zone-card-body {
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
    display: none;
}
.zone-card-body.expanded {
    display: block;
}
.zone-chevron {
    transition: transform var(--transition);
    color: var(--text-muted);
    font-size: 0.82rem;
}
.zone-chevron.open {
    transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════════ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-bright); }
.text-gold { color: var(--gold); }
.text-red { color: var(--red); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    :root {
        --header-h: 50px;
    }

    .app-header {
        padding: 0 12px;
    }
    .brand-sub {
        display: none;
    }
    .header-controls {
        gap: 6px;
    }
    .farm-selector {
        max-width: 140px;
    }

    .app-nav {
        padding: 0 4px;
    }
    .app-nav a {
        padding: 0 10px;
        font-size: 0.76rem;
    }

    .app-content {
        padding: 16px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

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

    .two-col {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar input,
    .filter-bar select {
        max-width: 100%;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal {
        max-width: calc(100vw - 24px);
        max-height: 90vh;
    }

    .inline-form {
        flex-direction: column;
    }

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

    .data-table {
        font-size: 0.82rem;
    }
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .toast-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
    }
    .toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    #print-btn {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════ */

@media print {
    .app-header,
    .app-nav,
    .toast-container,
    .modal-overlay,
    .btn,
    .filter-bar {
        display: none !important;
    }
    .app-content {
        margin-top: 0;
        padding: 0;
        max-width: 100%;
    }
    body {
        background: white;
        color: #111;
    }
    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        background: white;
    }
    .data-table th {
        background: #eee;
        color: #333;
    }
    .data-table td {
        border-color: #ccc;
    }
    .stat-card {
        background: white;
        border: 1px solid #ccc;
    }
    .stat-value {
        color: #111;
    }
    a {
        color: #111;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Farm Canvas — Interactive 2D Map
   ═══════════════════════════════════════════════════════════════ */

.canvas-container {
    position: relative;
    width: 100%;
    background: #080e08;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}
.farm-canvas {
    display: block;
    width: 100%;
    cursor: default;
    touch-action: none;
}
.canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.canvas-toolbar button {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.canvas-toolbar button:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}
.toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
}
.toolbar-hint {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: auto;
}
.canvas-sidebar {
    position: absolute;
    right: 12px;
    top: 52px;
    width: 260px;
    max-height: calc(100% - 64px);
    background: rgba(10, 15, 10, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transform: translateX(12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
}
.canvas-sidebar.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}
.canvas-sidebar h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.canvas-sidebar .sidebar-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.canvas-sidebar .sidebar-close:hover { color: var(--text); }
.canvas-sidebar .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 12px;
}
.canvas-sidebar .detail-label {
    color: var(--text-dim);
}
.canvas-sidebar .detail-value {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    max-width: 55%;
}
.canvas-add-bar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.canvas-add-bar button {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.canvas-add-bar button:hover {
    background: var(--accent-dim);
    color: #fff;
    border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   Plant Search Results
   ═══════════════════════════════════════════════════════════════ */
.plant-results { margin-top: 12px; max-height: 400px; overflow-y: auto; }
.plant-result-card {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; margin-bottom: 6px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); transition: border-color 0.15s;
}
.plant-result-card:hover { border-color: var(--accent); }
.plant-thumb { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.plant-result-info { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.family-select-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.family-select-btn { text-align: left !important; padding: 8px 12px !important; }

/* Canvas toolbar v2 additions */
.canvas-toolbar button.active,
.canvas-toolbar button:active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: #fff;
}
.canvas-toolbar .toolbar-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.canvas-toolbar .toolbar-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   NUCLEAR: Kill ALL white/default form styling
   This overrides everything — no white inputs allowed.
   ═══════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
    color-scheme: dark;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea,
.modal input:not([type="checkbox"]):not([type="radio"]),
.modal select,
.modal textarea,
.modal-body input:not([type="checkbox"]):not([type="radio"]),
.modal-body select,
.modal-body textarea {
    background: #141f14 !important;
    color: #e0e8e0 !important;
    border: 1px solid #243524 !important;
    border-radius: 6px !important;
    padding: 9px 12px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.88rem !important;
    outline: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
}

/* Focus state */
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: #4caf50 !important;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2) !important;
}

/* Placeholder */
input::placeholder,
textarea::placeholder {
    color: #5a6f5a !important;
}

/* Number spinners — GONE */
input[type="number"] {
    -moz-appearance: textfield !important;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    display: none !important;
    margin: 0 !important;
}

/* Select dropdown arrow — custom dark SVG */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a8a5a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    padding-right: 32px !important;
}

/* Date input calendar icon — dark */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7) sepia(0.3) hue-rotate(90deg) !important;
    cursor: pointer;
}

/* Autofill — prevent browser white flash */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #141f14 inset !important;
    -webkit-text-fill-color: #e0e8e0 !important;
    border-color: #243524 !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* Scrollbar in modals and textareas */
.modal-body::-webkit-scrollbar,
textarea::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
    background: #0a0f0a;
}
.modal-body::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
    background: #2d4a2d;
    border-radius: 3px;
}

/* Header selectors — consistent with form fields */
.farm-selector,
.year-selector {
    background: #141f14 !important;
    color: #e0e8e0 !important;
    border: 1px solid #243524 !important;
    padding: 6px 28px 6px 10px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235a8a5a' d='M1 0l4 5 4-5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Option elements inside selects */
option {
    background: #141f14 !important;
    color: #e0e8e0 !important;
}

/* ── Sidebar tabs & inline editing ── */
.sidebar-tabs {
    display: flex;
    gap: 0;
    margin: 10px -14px;
    padding: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-tab {
    flex: 1;
    background: none;
    border: none;
    color: #5a6f5a;
    font-size: 11px;
    font-weight: 500;
    padding: 7px 4px;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s, background 0.15s;
    border-bottom: 2px solid transparent;
}
.sidebar-tab:hover { color: #8a9f8a; background: rgba(255,255,255,0.03); }
.sidebar-tab.active { color: #4caf50; border-bottom-color: #4caf50; background: rgba(76,175,80,0.05); }
.sidebar-tab-panel { padding: 6px 0; }
.sidebar-edit-btn {
    background: none;
    border: none;
    color: #5a6f5a;
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.sidebar-edit-btn:hover { color: #4caf50; }
.sidebar-name { font-weight: 600; }
.sb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 11px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sb-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sb-item-name { flex: 1; color: #e0e8e0; }
.sb-item-meta { font-size: 10px; }
.sb-loading { color: #5a6f5a; font-size: 11px; padding: 4px 0; }

/* ═══════════════════════════════════════════════════════════════
   Today View
   ═══════════════════════════════════════════════════════════════ */
.today-section { margin-bottom: 20px; }
.today-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.today-cards { display: flex; flex-direction: column; gap: 6px; }
.today-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, background 0.15s;
}
.today-card:hover { border-color: var(--border-light); background: var(--surface-hover); }
.today-card-urgent { background: rgba(76,175,80,0.08); border-color: var(--accent-dim); }
.today-card-nursery { border-left: 3px solid var(--accent); }
.today-card-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.today-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    flex: 1;
}
.today-card-body strong { color: var(--text); font-weight: 600; text-transform: capitalize; }
.today-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.today-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Sidebar actions & quality stars ── */
.sb-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sb-select {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    font-size: 11px !important;
    padding: 3px 20px 3px 6px !important;
    border-radius: 4px !important;
    max-width: 120px;
}
.quality-stars {
    display: flex;
    gap: 2px;
    margin-top: 4px;
}
.star-btn {
    background: none !important;
    border: none !important;
    font-size: 20px !important;
    cursor: pointer;
    padding: 0 2px !important;
    width: auto !important;
    color: #3a3a3a;
    transition: color 0.1s;
}
.star-btn:hover { color: #f9a825 !important; }

/* ═══════════════════════════════════════════════════════════════
   Light Mode — for field use under sun glare
   ═══════════════════════════════════════════════════════════════ */
body.light-mode {
    --bg: #f5f5f0;
    --bg-alt: #eeeee8;
    --surface: #ffffff;
    --surface-hover: #f0f0ea;
    --surface-active: #e8e8e2;
    --border: #d0d0c8;
    --border-light: #b8b8b0;
    --text: #1a1a18;
    --text-dim: #555550;
    --text-muted: #888880;
    --accent: #2e7d32;
    --accent-dim: #1b5e20;
    --accent-bright: #43a047;
    --accent-glow: rgba(46, 125, 50, 0.15);
    --red: #c62828;
    --orange: #e65100;
}
body.light-mode .app-header { background: #ffffff; border-color: #d0d0c8; }
body.light-mode .app-nav { background: #fafaf5; border-color: #d0d0c8; }
body.light-mode .app-nav a { color: #555550; }
body.light-mode .app-nav a.active { color: #2e7d32; border-color: #2e7d32; }
body.light-mode .brand-name { color: #1a1a18; }
body.light-mode .farm-canvas { background: #f0f0ea !important; }
body.light-mode .modal { background: #ffffff; border-color: #d0d0c8; }
body.light-mode .modal-header { border-color: #d0d0c8; }
body.light-mode .canvas-sidebar { background: rgba(255,255,255,0.95); border-color: #d0d0c8; }
body.light-mode .canvas-toolbar { background: #fafaf5; border-color: #d0d0c8; }
body.light-mode .canvas-toolbar button { background: #ffffff; border-color: #d0d0c8; color: #333; }
body.light-mode input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.light-mode select,
body.light-mode textarea {
    background: #ffffff !important;
    color: #1a1a18 !important;
    border-color: #d0d0c8 !important;
}
body.light-mode option { background: #ffffff !important; color: #1a1a18 !important; }
body.light-mode .badge { color: #fff; }
body.light-mode .toast { background: #333; color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   Mobile Navigation — hamburger menu on small screens
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .app-header { padding: 8px 12px; }
    .brand-sub { display: none; }
    .header-controls { gap: 6px; }
    .farm-selector { max-width: 120px !important; font-size: 12px !important; }
    .year-selector { width: 70px !important; font-size: 12px !important; }

    .app-nav {
        flex-wrap: wrap;
        gap: 0;
        padding: 0 4px;
    }
    .app-nav a {
        font-size: 11px;
        padding: 6px 8px;
        white-space: nowrap;
    }

    .app-content { padding: 12px; }
    .page-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .page-header > div { width: 100%; display: flex; gap: 4px; flex-wrap: wrap; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .modal { max-width: 95vw; max-height: 90vh; }
    .canvas-sidebar { width: 220px; right: 4px; top: 44px; }
    .canvas-toolbar { flex-wrap: wrap; padding: 4px 8px; }
    .toolbar-hint { display: none; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 6px 8px; }
}

@media (max-width: 480px) {
    .app-nav a { font-size: 10px; padding: 5px 6px; }
    .stat-grid { grid-template-columns: 1fr; }
    .canvas-sidebar { width: 200px; }
}

/* ── Planting Wizard ── */
.wizard-steps { display: flex; gap: 4px; margin-bottom: 16px; }
.wizard-step {
    flex: 1; text-align: center; padding: 8px 4px;
    font-size: 11px; font-weight: 500; color: var(--text-muted);
    border-bottom: 2px solid var(--border); transition: all 0.15s;
}
.wizard-step.active { color: var(--accent); border-color: var(--accent); }
.wizard-step.done { color: var(--text-dim); border-color: var(--accent-dim); }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-option {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin: 4px 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.wizard-option:hover { border-color: var(--accent-dim); background: var(--surface-hover); }
.wizard-option.selected { border-color: var(--accent); background: rgba(76,175,80,0.1); }
.wizard-option .family-dot { width: 12px; height: 12px; }

/* ═══════════════════════════════════════════════════════════════
   Weather Bar
   ═══════════════════════════════════════════════════════════════ */
.weather-bar {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 16px; margin-bottom: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
}
.weather-bar.frost-risk { border-color: var(--orange); background: rgba(255,152,0,0.08); }
.weather-current { display: flex; align-items: center; gap: 12px; }
.weather-temp { font-size: 28px; font-weight: 700; color: var(--accent); }
.weather-desc { font-size: 14px; font-weight: 500; }
.weather-detail { font-size: 12px; color: var(--text-dim); }
.weather-forecast { display: flex; gap: 12px; margin-left: auto; }
.weather-day { text-align: center; font-size: 11px; padding: 4px 8px; }
.weather-day-date { color: var(--text-dim); font-weight: 500; margin-bottom: 2px; }
.weather-day-temps { font-weight: 600; }
.weather-day-rain { color: var(--text-muted); margin-top: 2px; }
.frost-alert { width: 100%; padding: 6px 10px; background: rgba(255,152,0,0.15); border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--orange); margin-top: 4px; }
@media (max-width: 768px) {
    .weather-forecast { margin-left: 0; width: 100%; justify-content: space-around; }
    .weather-temp { font-size: 22px; }
}

/* ═══════════════════════════════════════════════════════════════
   Season Comparison
   ═══════════════════════════════════════════════════════════════ */
.compare-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.compare-col h4 { text-align: center; margin-bottom: 8px; color: var(--accent); }
.compare-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.04); }

/* ── AI Advisor ── */
.advisor-answer {
    font-size: 14px;
    line-height: 1.7;
}
.advisor-answer h3, .advisor-answer h4 {
    color: var(--accent);
    margin: 16px 0 8px;
}
.advisor-answer ul {
    margin: 8px 0;
    padding-left: 20px;
}
.advisor-answer li {
    margin: 4px 0;
}
.advisor-answer strong {
    color: var(--accent-bright);
}

.header-weather .hw-loc {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
