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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f6f7;
    color: #333;
    font-size: 15px;
}

/* Navbar */
.navbar {
    background: #2d6a4f;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    min-height: 54px;
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
}

.navbar .brand {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.navbar ul {
    list-style: none;
    display: flex;
    gap: 4px;
    flex: 1;
    flex-wrap: wrap;
}

.navbar ul a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
}

.navbar ul a:hover,
.navbar ul a.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.lang-switcher-group {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.lang-switcher {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    flex-shrink: 0;
}

.lang-switcher.lang-active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    cursor: default;
}

.lang-switcher:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.lang-select {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    font-size: 13px;
    padding: 4px 6px;
    cursor: pointer;
    outline: none;
}

.lang-select option {
    background: #2d6a4f;
    color: #fff;
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    flex-shrink: 0;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* User dropdown */
.nav-user-dropdown {
    position: relative;
    flex-shrink: 0;
}

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

.nav-user-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.nav-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-caret {
    font-size: 10px;
    opacity: 0.7;
}

.nav-user-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border-radius: 10px;
    min-width: 170px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.nav-user-panel.open {
    display: block;
}

.nav-user-info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #374151;
}

.nav-user-logout {
    display: block;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #dc2626;
    text-decoration: none;
    transition: background 0.1s;
}

.nav-user-logout:hover {
    background: #fef2f2;
}

/* Nav mega-dropdowns (Farms, Settings) */
.nav-dropdown-li {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    cursor: pointer;
    padding: 1px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-family: inherit;
}

.nav-dropdown-btn:hover,
.nav-dropdown-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.nav-caret {
    font-size: 10px;
    opacity: 0.7;
}

/*
 * SPECIFICITY FIX: .navbar ul is 0,1,1 and overrides .nav-dropdown-menu (0,1,0).
 * Using .nav-dropdown-li > .nav-dropdown-menu gives 0,2,0 which beats 0,1,1.
 * Also reset flex properties inherited from .navbar ul.
 */
.nav-dropdown-li>.nav-dropdown-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    flex-direction: column;
    flex: none;
    flex-wrap: nowrap;
    gap: 0;
    background: #fff;
    border-radius: 8px;
    min-width: 160px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 200;
    border: 1px solid #e5e7eb;
    padding: 4px 0;
    list-style: none;
    width: auto;
    margin: 0;
}

/* .nav-dropdown-li > .nav-dropdown-menu.open = 0,3,0 beats .navbar ul.open (0,2,1) */
.nav-dropdown-li>.nav-dropdown-menu.open {
    display: flex;
}

/* 0,2,2 beats .navbar ul a (0,1,2) and .navbar ul li (0,1,1) */
.nav-dropdown-li .nav-dropdown-menu li {
    width: auto;
}

.nav-dropdown-li .nav-dropdown-menu li a {
    display: block;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 400;
    color: #374151;
    text-decoration: none;
    white-space: nowrap;
    background: transparent;
    border-radius: 0;
}

.nav-dropdown-li .nav-dropdown-menu li a:hover {
    background: #f0fdf4;
    color: #2d6a4f;
}

.nav-dropdown-li .nav-dropdown-menu li a.active {
    background: #dcfce7;
    color: #2d6a4f;
    font-weight: 600;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 20px;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 13px;
    color: #888;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #2d6a4f;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 6px;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
}

/* Cards grid */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.card .meta {
    font-size: 13px;
    color: #777;
    margin-bottom: 12px;
}

.card .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.summary-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.summary-card .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #888;
    margin-bottom: 6px;
}

.summary-card .value {
    font-size: 28px;
    font-weight: 700;
    color: #2d6a4f;
}

.summary-card .sub {
    font-size: 12px;
    color: #aaa;
    margin-top: 2px;
}

/* Table */
.table-wrap {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 28px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f0f4f1;
    text-align: left;
    padding: 11px 16px;
    font-size: 13px;
    color: #555;
    font-weight: 600;
}

td {
    padding: 11px 16px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
    vertical-align: middle;
}

tr:hover td {
    background: #fafcfb;
}

td a {
    color: #2d6a4f;
    font-weight: 600;
    text-decoration: none;
}
td a:hover { text-decoration: underline; }

/* Sortable table headers */
th a.sort-th {
    color: #555;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
th a.sort-th:hover { color: #2d6a4f; }
th a.sort-th .sort-icon { color: #c4cdd6; font-size: 11px; line-height: 1; }
th a.sort-th.active { color: #2d6a4f; }
th a.sort-th.active .sort-icon { color: #2d6a4f; }

.empty-row td {
    color: #aaa;
    text-align: center;
    padding: 32px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

.badge-yellow {
    background: #fef3c7;
    color: #92400e;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.badge-gray {
    background: #f3f4f6;
    color: #374151;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: opacity .15s;
}

.btn:hover {
    opacity: .85;
}

.btn-primary {
    background: #2d6a4f;
    color: #fff;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-sm {
    padding: 5px 11px;
    font-size: 13px;
}

.btn-warning {
    background: #d97706;
    color: #fff;
}

/* Forms */
.form-card {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    max-width: 600px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #333;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2d6a4f;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, .12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.filter-bar label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 4px;
}

.filter-bar select,
.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar input[type="number"] {
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #333;
    min-width: 120px;
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: #2d6a4f;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, .12);
}

.filter-bar .btn,
.filter-bar button {
    padding: 7px 16px;
    font-size: 13px;
    border-radius: 7px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .filter-bar {
        gap: 8px;
    }
    .filter-bar > div {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }
    .filter-bar select,
    .filter-bar input[type="text"],
    .filter-bar input[type="date"] {
        width: 100%;
        min-width: 0;
    }
}

/* Searchable select dropdown */
.search-select-wrap {
    position: relative;
}

.search-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 7px 7px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-select-dropdown .ss-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.search-select-dropdown .ss-item:hover {
    background: #f0fdf4;
    color: #2d6a4f;
}

.search-select-dropdown .ss-item:last-child {
    border-bottom: none;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: #bbb;
    font-size: 13px;
    margin-top: 40px;
}

/* Section heading */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    margin-top: 32px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 24px;
    gap: 4px;
}

.tab {
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #777;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 7px 7px 0 0;
}

.tab:hover {
    color: #2d6a4f;
    background: #f0f4f1;
}

.tab.active {
    color: #2d6a4f;
    border-bottom-color: #2d6a4f;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Stage progress bar */
.stage-bar {
    display: flex;
    align-items: flex-start;
    margin: 20px 0 28px;
}

.stage-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.stage-step::before {
    content: '';
    position: absolute;
    top: 6px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

.stage-step:first-child::before {
    display: none;
}

.stage-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e5e7eb;
    border: 2px solid #e5e7eb;
    z-index: 1;
    position: relative;
}

.stage-step.done .stage-dot {
    background: #2d6a4f;
    border-color: #2d6a4f;
}

.stage-step.done::before {
    background: #2d6a4f;
}

.stage-step.active .stage-dot {
    background: #fff;
    border-color: #2d6a4f;
    width: 16px;
    height: 16px;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, .15);
}

.stage-label {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
}

.stage-step.done .stage-label {
    color: #2d6a4f;
}

.stage-step.active .stage-label {
    color: #2d6a4f;
    font-weight: 700;
}

.stage-day {
    font-size: 11px;
    color: #2d6a4f;
    font-weight: 600;
    margin-top: 2px;
}

/* Lifecycle timeline (perennial — Phase 19) */
.lifecycle-timeline {
    display: flex;
    align-items: flex-start;
    margin: 20px 0 28px;
}

.lifecycle-timeline .stage-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.lifecycle-timeline .stage-step::before {
    content: '';
    position: absolute;
    top: 6px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: #e5e7eb;
}

.lifecycle-timeline .stage-step:first-child::before {
    display: none;
}

.lifecycle-timeline .stage-step.done .stage-dot {
    background: #2d6a4f;
    border-color: #2d6a4f;
}

.lifecycle-timeline .stage-step.done::before {
    background: #2d6a4f;
}

.lifecycle-timeline .stage-step.active .stage-dot {
    background: #fff;
    border-color: #2d6a4f;
    width: 16px;
    height: 16px;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, .15);
}

.lifecycle-timeline .stage-step.active .stage-label {
    color: #2d6a4f;
    font-weight: 700;
}

.lifecycle-timeline .stage-step.done .stage-label {
    color: #2d6a4f;
}

.stage-range {
    font-size: 10px;
    color: #b0b0b0;
    margin-top: 2px;
    text-align: center;
}

.lifecycle-timeline .stage-step.active .stage-range {
    color: #2d6a4f;
    font-weight: 600;
}

/* Settings landing cards */
.settings-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.settings-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: border-color .15s, box-shadow .15s;
}

.settings-card:hover {
    border-color: #2d6a4f;
    box-shadow: 0 2px 8px rgba(45, 106, 79, .12);
}

.settings-card h3 {
    color: #2d6a4f;
    margin-bottom: 8px;
    font-size: 18px;
}

.settings-card p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.settings-card .settings-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

/* Sortable directions list (SOPs) */
.directions-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
}

.directions-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    background: #f9fafb;
    border-radius: 6px;
    padding: 8px;
    border: 1px solid #e5e7eb;
}

.directions-list li.dragging {
    opacity: .45;
    background: #e0f2e9;
}

.drag-handle {
    cursor: grab;
    color: #9ca3af;
    font-size: 18px;
    padding-top: 6px;
    user-select: none;
    flex-shrink: 0;
}

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

.directions-list textarea {
    flex: 1;
    min-height: 44px;
    resize: vertical;
}

/* Inline stage add/edit row */
.stage-add-row td {
    background: #f0f9f4;
}

.stage-add-row input,
.stage-add-row select {
    padding: 6px 9px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}

/* KPI colours */
.kpi-high {
    color: #2d6a4f;
    font-weight: 700;
}

.kpi-mid {
    color: #d97706;
    font-weight: 700;
}

.kpi-low {
    color: #dc2626;
    font-weight: 700;
}

/* ── Enhancement 5: 3-col and 4-col form rows ─────────────────────────── */
.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

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

/* Advanced toggle button — hidden on desktop, shown on mobile */
.toggle-advanced-btn {
    display: none;
    width: 100%;
    margin: 12px 0 4px;
    padding: 12px;
    background: #f0f4f1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #2d6a4f;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background .15s;
}

.toggle-advanced-btn:hover {
    background: #e0ece4;
}

/* Environment subsection */
.env-section {
    background: #f9fafb;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.env-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 10px;
}

/* ── Enhancement 9: SOP checklist card ────────────────────────────────── */
.sop-checklist-card {
    border: 2px solid #2d6a4f;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.sop-checklist-header {
    background: #2d6a4f;
    color: #fff;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
}

.sop-checklist-name {
    font-weight: 400;
    font-size: 13px;
    opacity: .85;
}

.sop-checklist-body {
    padding: 4px 0;
}

.sop-check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid #f0f0f0;
}

.sop-check-row:last-child {
    border-bottom: none;
}

.sop-check-row:hover {
    background: #f0f9f4;
}

.sop-check-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: #2d6a4f;
    cursor: pointer;
}

.sop-step-num {
    color: #9ca3af;
    font-size: 13px;
    min-width: 20px;
    margin-top: 1px;
    flex-shrink: 0;
}

.sop-step-text {
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.sop-check-row input:checked~.sop-step-text {
    color: #2d6a4f;
}

/* ── Enhancement 1: Dashboard BI styles ────────────────────────────────── */
.alert-panel {
    margin-bottom: 24px;
}

.alert-panel .alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-left: 4px solid #dc2626;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    font-size: 14px;
}

.alert-panel .alert-item.warn {
    border-left-color: #d97706;
}

.alert-panel .alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.kpi-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.kpi-progress-row:last-child {
    border-bottom: none;
}

.kpi-progress-label {
    width: 140px;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.kpi-progress-bar-wrap {
    flex: 1;
    background: #e5e7eb;
    border-radius: 99px;
    height: 10px;
}

.kpi-progress-bar {
    height: 100%;
    border-radius: 99px;
    min-width: 4px;
}

.kpi-progress-pct {
    width: 48px;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.kpi-progress-kg {
    width: 130px;
    text-align: right;
    font-size: 12px;
    color: #9ca3af;
    flex-shrink: 0;
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.monthly-table th,
.monthly-table td {
    text-align: right;
}

.monthly-table th:first-child,
.monthly-table td:first-child {
    text-align: left;
}

.monthly-total {
    font-weight: 700;
    color: #2d6a4f;
}

/* ── Enhancement 6: Analytics Chart Panel ───────────────────────────────── */
.chart-panel {
    background: #fff;
    border-radius: 12px;
    border-top: 3px solid #2d6a4f;
    box-shadow: 0 2px 8px rgba(45, 106, 79, .10);
    margin-bottom: 28px;
    overflow: hidden;
}

.chart-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid #d8ece2;
    background: #f0f9f4;
}

.chart-controls-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.chart-controls-title {
    font-size: 15px;
    font-weight: 700;
    color: #2d6a4f;
    white-space: nowrap;
}

.chart-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.chart-range-btns {
    display: flex;
    gap: 4px;
}

.chart-range-btn {
    padding: 5px 11px;
    border: 1px solid #c3d9cc;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background: #f0f9f4;
    color: #2d6a4f;
    cursor: pointer;
    transition: all .15s;
}

.chart-range-btn:hover {
    background: #d8ece2;
    border-color: #2d6a4f;
}

.chart-range-btn.active {
    background: #2d6a4f;
    border-color: #2d6a4f;
    color: #fff;
}

.chart-date-range {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chart-date-input {
    padding: 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
    color: #333;
    cursor: pointer;
}

.chart-date-sep {
    color: #9ca3af;
    font-size: 12px;
}

.chart-section {
    padding: 16px 20px 20px;
    border-top: 1px solid #eef2ef;
}

.chart-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.chart-section-accent {
    width: 3px;
    height: 14px;
    border-radius: 99px;
    flex-shrink: 0;
}

.chart-section-label {
    font-size: 12px;
    color: #374151;
    font-weight: 700;
}

.chart-series-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.series-toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #9ca3af;
    cursor: pointer;
    user-select: none;
    transition: all .15s;
}

.series-toggle-pill.active {
    background: #f0f9f4;
    border-color: #2d6a4f;
    color: #374151;
}

.series-toggle-pill input {
    display: none;
}

.pill-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #9ca3af;
}

.pill-dashed {
    background: none !important;
    border: 2px dashed;
    border-radius: 50%;
    width: 10px;
    height: 10px;
}

.chart-canvas-wrap {
    position: relative;
    height: 230px;
    background: #fafcfb;
    border-radius: 8px;
    border: 1px solid #eef2ef;
    padding: 4px 0;
}

/* ── Enhancement 10: Compare table ──────────────────────────────────────── */
.compare-table {
    width: 100%;
    border-collapse: collapse;
}

.compare-metric-col {
    width: 180px;
}

.compare-plot-col {
    text-align: center;
    min-width: 120px;
}

.compare-table thead th {
    background: #f0f4f1;
    padding: 12px 16px;
    font-size: 13px;
    color: #555;
    font-weight: 600;
}

.compare-label {
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.compare-value {
    padding: 11px 16px;
    font-size: 14px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.compare-table tr:hover .compare-value {
    background: #fafcfb;
}

.cmp-null {
    color: #d1d5db;
}

/* ── Mobile overrides ─────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Navbar: show hamburger, collapse nav links */
    .navbar {
        padding: 0 14px;
        gap: 8px;
    }

    .navbar .brand {
        flex: 1;
        line-height: 54px;
        font-size: 16px;
    }

    .nav-toggle {
        display: block;
        align-self: center;
    }

    .lang-switcher-group {
        align-self: center;
    }

    .lang-switcher {
        font-size: 12px;
        padding: 4px 8px;
    }

    /* Nav links hidden by default; open as full-width panel below top bar */
    .navbar ul {
        display: none;
        flex-direction: column;
        flex: none;
        width: calc(100% + 28px);
        margin: 0 -14px;
        padding: 8px 14px 14px;
        background: #245a40;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        order: 99;
        gap: 2px;
    }

    .navbar ul.open {
        display: flex;
    }

    .navbar ul li {
        width: 100%;
    }

    .navbar ul a {
        display: block;
        padding: 10px 12px;
        font-size: 15px;
        border-radius: 6px;
    }

    /* User dropdown panel: shift right to stay within viewport */
    .nav-user-panel {
        right: -14px;
        min-width: 180px;
    }

    /* Hide the name text on mobile — show just the icon + caret */
    .nav-user-name {
        display: none;
    }

    /* Nav dropdowns: expand inline inside the hamburger panel */
    .nav-dropdown-btn {
        width: 100%;
        padding: 10px 12px;
        font-size: 15px;
        border-radius: 6px;
        justify-content: space-between;
    }

    .nav-dropdown-li>.nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: rgba(0, 0, 0, 0.15);
        border-radius: 6px;
        padding: 2px 0;
        margin: 2px 0 4px 12px;
        width: auto;
    }

    .nav-dropdown-li .nav-dropdown-menu li a {
        color: rgba(255, 255, 255, 0.85);
        padding: 9px 14px;
        font-size: 14px;
        background: transparent;
    }

    .nav-dropdown-li .nav-dropdown-menu li a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .nav-dropdown-li .nav-dropdown-menu li a.active {
        background: rgba(255, 255, 255, 0.18);
        color: #fff;
    }

    /* Tables */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    /* Container */
    .container {
        padding: 0 12px;
        margin: 16px auto;
    }

    /* Cards */
    .cards {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 16px;
    }

    /* Summary cards */
    .summary-cards {
        grid-template-columns: 1fr 1fr;
    }

    .summary-card {
        padding: 14px 16px;
    }

    .summary-card .value {
        font-size: 22px;
    }
}

@media (max-width: 640px) {
    .toggle-advanced-btn {
        display: block;
    }

    .advanced-fields {
        display: none;
    }

    .advanced-fields.open {
        display: block;
    }

    /* Prevent iOS auto-zoom on focus */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        min-height: 48px;
        padding: 12px 14px;
    }

    /* Forms */
    .form-row,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

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

    /* Tables */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 11px;
    }

    th,
    td {
        padding: 6px 8px;
        font-size: 11px;
    }

    .compare-metric-col {
        width: 120px;
    }

    .compare-plot-col {
        min-width: 90px;
    }

    /* KPI progress row */
    .kpi-progress-row {
        gap: 6px;
        flex-wrap: wrap;
    }

    .kpi-progress-label {
        width: 100%;
        order: 1;
    }

    .kpi-progress-bar-wrap {
        flex: 1;
        order: 3;
        min-width: 100%;
    }

    .kpi-progress-pct {
        width: auto;
        order: 2;
        margin-left: auto;
    }

    .kpi-progress-kg {
        display: none;
    }

    /* Charts */
    .chart-controls-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-controls-right {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .chart-canvas-wrap {
        height: 190px;
    }

    .chart-date-input {
        width: 120px;
    }

    /* Images */
    .img-thumb {
        width: 60px;
        height: 60px;
    }

    .img-thumb-lg {
        width: 70px;
        height: 70px;
    }

    /* Alerts and panels */
    .alert-panel .alert-item {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Section titles */
    .section-title {
        font-size: 16px;
        margin-bottom: 12px;
        margin-top: 20px;
    }
}

/* ── Worker Quick Actions ────────────────────────────────────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 22px 12px 20px;
    border-radius: 14px;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.13);
    transition: transform .15s, box-shadow .15s;
    text-align: center;
    line-height: 1.2;
}

.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    opacity: 1;
}

.quick-action-btn:active {
    transform: translateY(-1px);
}

.quick-action-btn .qa-icon {
    font-size: 34px;
    line-height: 1;
    display: block;
}

.quick-action-btn .qa-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    display: block;
}

.qa-report {
    background: linear-gradient(145deg, #2d6a4f 0%, #40916c 100%);
}

.qa-harvest {
    background: linear-gradient(145deg, #b45309 0%, #d97706 100%);
}

.qa-event {
    background: linear-gradient(145deg, #1d4ed8 0%, #3b82f6 100%);
}

.qa-scout {
    background: linear-gradient(145deg, #6d28d9 0%, #8b5cf6 100%);
}

.qa-expense {
    background: linear-gradient(145deg, #b45309 0%, #f59e0b 100%);
}

/* Planting picker cards */
.pick-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 560px;
}

.pick-card {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    transition: border-color .15s, box-shadow .15s;
}

.pick-card:hover {
    border-color: #2d6a4f;
    box-shadow: 0 2px 10px rgba(45, 106, 79, 0.15);
}

.pick-card-info {
    flex: 1;
}

.pick-card-name {
    font-weight: 700;
    font-size: 16px;
}

.pick-card-meta {
    font-size: 13px;
    color: #6b7280;
    margin-top: 3px;
}

.pick-card-sub {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 3px;
}

.pick-card-arrow {
    font-size: 22px;
    color: #2d6a4f;
    margin-left: 12px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .quick-action-btn {
        padding: 20px 10px 16px;
    }

    .quick-action-btn .qa-icon {
        font-size: 30px;
    }

    .quick-action-btn .qa-label {
        font-size: 13px;
    }
}

/* ── Media Attachments ───────────────────────────────────────────────────── */
.upload-area {
    border: 2px dashed #c3d9cc;
    border-radius: 8px;
    background: #f0f9f4;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s;
    margin-top: 6px;
}

.upload-area:hover {
    border-color: #2d6a4f;
}

.upload-input {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #2d6a4f;
    font-size: 14px;
    font-weight: 500;
}

.upload-hint {
    color: #9ca3af;
    font-size: 11px;
    font-weight: 400;
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}

.img-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}

.img-gallery-form {
    margin-bottom: 8px;
}

.img-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: block;
    flex-shrink: 0;
    background: #f3f4f6;
}

.img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.img-thumb-new {
    border: 2px solid #2d6a4f;
}

.img-thumb-lg {
    width: 100px;
    height: 100px;
}

.img-thumb-sm {
    width: 52px;
    height: 52px;
}

.img-thumb-removed {
    opacity: 0.35;
}

.img-remove-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0;
}

.img-remove-btn:hover {
    background: #dc2626;
}

/* ── Weather Forecast Strip ──────────────────────────────────────────────── */
.weather-forecast-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 28px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.weather-day-card {
    flex: 0 0 auto;
    width: 145px;
    background: #fff;
    border-radius: 10px;
    padding: 10px 10px 8px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    font-size: 12px;
}

.weather-day-card--today {
    border-color: #2d6a4f;
    border-width: 2px;
    background: #f0f9f4;
}

/* Day card header row */
.wdc-date {
    font-weight: 700;
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 5px;
}

.wdc-daily-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 2px;
}

.wdc-sep {
    color: #d1d5db;
    font-weight: 400;
}

.wdc-high {
    color: #dc2626;
}

.wdc-low {
    color: #2563eb;
}

.wdc-uv-badge {
    font-size: 9px;
    color: #d97706;
    background: #fef3c7;
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 2px;
    font-weight: 600;
}

.wdc-sun {
    font-size: 9px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.wdc-day-rain {
    font-size: 9px;
    color: #2563eb;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #f3f4f6;
}

/* Period rows (morning / afternoon / evening) */
.wdc-period {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 0;
    border-top: 1px solid #f3f4f6;
    text-align: left;
}

.wdc-plabel {
    color: #9ca3af;
    font-size: 9px;
    width: 32px;
    flex-shrink: 0;
    white-space: nowrap;
}

.wdc-picon {
    font-size: 13px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.wdc-ptemp {
    font-weight: 700;
    color: #374151;
    font-size: 11px;
    width: 22px;
    flex-shrink: 0;
}

.wdc-prain {
    color: #2563eb;
    font-size: 9px;
    flex: 1;
}

/* Legacy selectors kept for compatibility */
.wdc-icon {
    font-size: 26px;
    margin-bottom: 4px;
}

.wdc-desc {
    font-size: 10px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.wdc-temp {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 3px;
}

.wdc-rain,
.wdc-humidity,
.wdc-uv {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

/* ── AI Advisor Box ──────────────────────────────────────────────────────── */
.ai-advice-box {
    background: #f0f9f4;
    border-left: 3px solid #2d6a4f;
    border-radius: 0 8px 8px 0;
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-line;
    color: #374151;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.ai-advice-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 12px;
}

.ai-history-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ai-history-item:last-child {
    border-bottom: none;
}

.ai-history-date {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.ai-history-preview {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* ── Dashboard Weather Mini Widget ──────────────────────────────────────── */
.weather-mini-widget {
    background: #fff;
    border-radius: 10px;
    padding: 14px 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    border-top: 3px solid #2d6a4f;
}

.weather-mini-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.weather-mini-title {
    font-weight: 700;
    font-size: 14px;
}

.weather-mini-link {
    font-size: 12px;
    color: #2d6a4f;
    text-decoration: none;
}

.weather-mini-link:hover {
    text-decoration: underline;
}

.weather-mini-days {
    display: flex;
    gap: 8px;
}

.weather-mini-day {
    flex: 1;
    text-align: center;
}

.wmd-date {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 3px;
}

.wmd-icon {
    font-size: 20px;
    margin-bottom: 3px;
}

.wmd-temp {
    font-weight: 700;
    font-size: 13px;
    color: #374151;
    margin-bottom: 2px;
}

.wmd-rain {
    font-size: 11px;
    color: #2563eb;
    min-height: 16px;
}

/* ── Mobile weather overrides ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .weather-day-card {
        width: 130px;
        padding: 8px 8px 6px;
    }

    .wdc-plabel {
        font-size: 8px;
        width: 28px;
    }

    .wdc-picon {
        font-size: 12px;
    }

    .wdc-ptemp {
        font-size: 10px;
    }

    .ai-advice-box {
        font-size: 13px;
        max-height: 280px;
    }

    .weather-mini-days {
        gap: 4px;
    }
}

/* ── Calendar View ────────────────────────────────────────────────────────── */
.cal-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-nav a {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s;
}

.cal-nav a:hover {
    background: #f3f4f6;
}

.cal-nav .cal-month-label {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    min-width: 160px;
    text-align: center;
}

.cal-grid-wrap {
    overflow-x: auto;
}

.cal-grid-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 2px;
}

.cal-header-cell {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    padding: 8px 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.cal-day {
    min-height: 90px;
    padding: 6px;
    background: #fff;
    overflow: hidden;
}

.cal-day--today {
    background: #f0fdf4;
}

.cal-day--today .cal-day-num {
    color: #2d6a4f;
    font-weight: 700;
    background: #d1fae5;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-day--other {
    background: #f9fafb;
}

.cal-day--other .cal-day-num {
    color: #9ca3af;
}

.cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.cal-event {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    padding: 2px 5px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    color: #fff;
}

.cal-event:hover {
    opacity: 0.85;
}

.cal-event--planting {
    background: #2d6a4f;
}

.cal-event--harvest {
    background: #d97706;
}

.cal-event--scouting {
    background: #0891b2;
}

.cal-event--report {
    background: #6b7280;
}

.cal-more {
    font-size: 10px;
    color: #6b7280;
    padding: 1px 4px;
}

/* Legend dots */
.cal-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: 13px;
    color: #374151;
}

.cal-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.cal-dot--planting {
    background: #2d6a4f;
}

.cal-dot--harvest {
    background: #d97706;
}

.cal-dot--scouting {
    background: #0891b2;
}

.cal-dot--report {
    background: #6b7280;
}

/* Mobile calendar */
@media (max-width: 640px) {
    .cal-day {
        min-height: 56px;
        padding: 3px;
    }

    .cal-day-num {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .cal-event {
        font-size: 9px;
        padding: 1px 3px;
        margin-bottom: 1px;
    }

    .cal-header-cell {
        font-size: 9px;
        padding: 5px 2px;
    }

    .cal-nav .cal-month-label {
        font-size: 14px;
        min-width: 120px;
    }
}

/* Phase 2: Signup & Onboarding */
.slug-preview {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.slug-hint {
    font-size: 12px;
    margin-top: 4px;
}

.check-email-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

/* ── Phase 3: Billing ──────────────────────────────────────────────────────── */

/* Plan cards grid */
.plan-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

/* Individual plan card */
.plan-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    position: relative;
}

.plan-card--current {
    border: 2px solid #2d6a4f;
}

.plan-current-badge {
    display: inline-block;
    background: #2d6a4f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 99px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.plan-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.plan-price {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.plan-price-period {
    font-size: 14px;
    font-weight: 400;
    color: #6b7280;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    flex: 1;
    line-height: 1.8;
    font-size: 14px;
    color: #374151;
}

.plan-features li::before {
    content: '✓ ';
    color: #2d6a4f;
    font-weight: 700;
}

.plan-cta {
    margin-top: auto;
}

/* Billing status badges */
.billing-status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 13px;
}

.billing-status-active {
    background: #d1fae5;
    color: #065f46;
}

.billing-status-trial {
    background: #dbeafe;
    color: #1e40af;
}

.billing-status-grace {
    background: #fef3c7;
    color: #92400e;
}

.billing-status-suspended {
    background: #fee2e2;
    color: #991b1b;
}

/* Gateway selection grid */
.gateway-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.gateway-btn {
    width: 100%;
    min-height: 80px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 12px;
    transition: box-shadow .15s, border-color .15s;
    color: #1a1a1a;
}

.gateway-btn:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.10);
    border-color: #2d6a4f;
}

.gateway-btn--stripe:hover { border-color: #635bff; }
.gateway-btn--billplz:hover { border-color: #1d4ed8; }
.gateway-btn--senangpay:hover { border-color: #16a34a; }
.gateway-btn--airwallex:hover { border-color: #0891b2; }

.gateway-btn-icon {
    font-size: 22px;
    line-height: 1;
}

.gateway-btn-label {
    font-size: 15px;
    font-weight: 700;
}

.gateway-btn-sub {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

/* Responsive: 1024px — 2-column plan cards */
@media (max-width: 1024px) {
    .plan-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: 640px — 1-column plan cards + gateway grid */
@media (max-width: 640px) {
    .plan-cards {
        grid-template-columns: 1fr;
    }

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

/* ── Notification Toggle Switch ─────────────────────────── */
.notif-toggle-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid #f0f0f0;
}
.notif-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.notif-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.notif-toggle .toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d1d5db;
    border-radius: 24px;
    transition: background 0.15s;
}
.notif-toggle .toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.15s;
}
.notif-toggle input:checked + .toggle-slider {
    background-color: #2d6a4f;
}
.notif-toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}
.notif-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}
.notif-toggle-desc {
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    margin-top: 2px;
}

/* ── Tree Block Dashboard ─────────────────────────────────────────── */
.health-bar {
    display: flex;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    gap: 1px;
    background: #e5e7eb;
}
.health-bar > div {
    min-width: 2px;
    transition: width 0.3s;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.summary-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.summary-card .value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}
.summary-card .label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}
/* Timeline for block operations */
.timeline {
    position: relative;
    padding-left: 24px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}
.timeline-item {
    position: relative;
    padding-bottom: 20px;
}
.timeline-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2d6a4f;
    border: 2px solid #fff;
}
.timeline-content {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px 16px;
}
.hidden {
    display: none !important;
}

/* ── Nav badge (alert count in nav links) ────────────────────────────────────── */
.nav-badge {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    border-radius: 99px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1.4;
}

/* ── Weather Status Bar ──────────────────────────────────────────────────────── */
.weather-status-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: wrap;
    gap: 4px 16px;
}
.wsb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    white-space: nowrap;
    color: inherit;
}
.wsb-farm {
    font-size: 12px;
    font-weight: 600;
    color: #15803d;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wsb-icon { font-size: 16px; }
.wsb-temp { font-size: 12px; color: #374151; font-weight: 600; }
.wsb-rain { font-size: 11px; color: #0369a1; }
.wsb-more {
    margin-left: auto;
    font-size: 12px;
    color: #2d6a4f;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    padding: 2px 0;
}
.wsb-more:hover { text-decoration: underline; }
@media (max-width: 600px) {
    .weather-status-bar { flex-wrap: nowrap; overflow-x: auto; }
    .wsb-more { margin-left: 12px; }
}

/* ── Risk Cards ──────────────────────────────────────────────────────────────── */
.risk-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.risk-card {
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 220px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.risk-card-more {
    justify-content: center;
    align-items: center;
    background: #f9fafb;
    border-style: dashed;
}
.rc-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.rc-plot {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}
.rc-farm {
    font-size: 11px;
    color: #9ca3af;
}
.rc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
}
@media (max-width: 600px) {
    .risk-card { flex: 1 1 140px; max-width: 100%; }
}

/* ── Sparkline in summary cards ─────────────────────────────────────────────── */
.sparkline {
    display: block;
    margin-top: 6px;
    opacity: 0.8;
}
.summary-card { position: relative; }

/* ── Combined Active Plantings rows ─────────────────────────────────────────── */
.cp-row {
    display: grid;
    grid-template-columns: 1fr auto 180px 48px 80px;
    align-items: center;
    gap: 0 12px;
    padding: 10px 18px;
    border-bottom: 1px solid #f3f4f6;
    transition: background .12s;
}
.cp-row:last-child { border-bottom: none; }
.cp-row:hover { background: #f9fafb; }
.cp-info { min-width: 0; }
.cp-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}
.cp-bar-wrap {
    height: 6px;
    background: #f3f4f6;
    border-radius: 99px;
    overflow: hidden;
}
.cp-bar {
    height: 100%;
    border-radius: 99px;
    transition: width .3s;
}
.cp-pct {
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}
.cp-kg {
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
    white-space: nowrap;
}
@media (max-width: 768px) {
    .cp-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        row-gap: 4px;
        column-gap: 8px;
    }
    .cp-bar-wrap { grid-column: 1 / -1; }
    .cp-pct, .cp-kg { display: none; }
}

/* ── Monthly harvest collapsible ─────────────────────────────────────────────── */
.monthly-harvest-section {
    margin-bottom: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.monthly-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-align: left;
    gap: 8px;
}
.monthly-toggle:hover { background: #f3f4f6; }
.monthly-toggle-icon { color: #9ca3af; font-size: 12px; }
.monthly-summary-row {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-top: 1px solid #e5e7eb;
    -webkit-overflow-scrolling: touch;
}
.monthly-summary-cell {
    flex: 1 0 80px;
    padding: 10px 12px;
    text-align: center;
    border-right: 1px solid #f3f4f6;
}
.monthly-summary-cell:last-child { border-right: none; }
.msc-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 2px;
}
.msc-value {
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
}
.monthly-detail { border-top: 1px solid #e5e7eb; }

/* ── Floating Action Button (FAB) ───────────────────────────────────────────── */
.fab-container {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.fab-main {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #2d6a4f;
    color: #fff;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(45,106,79,.4);
    transition: background .15s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab-main:hover { background: #1e4e38; transform: scale(1.06); }
.fab-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .15s, transform .15s;
}
.fab-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.fab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 7px 14px 7px 16px;
    text-decoration: none;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    white-space: nowrap;
    transition: background .1s;
}
.fab-item:hover { background: #f9fafb; color: #2d6a4f; }
.fab-icon { font-size: 16px; }
@media (max-width: 600px) {
    .fab-container { bottom: 20px; right: 16px; }
    .fab-main { width: 48px; height: 48px; font-size: 22px; }
}

/* Farm expand toggle */
.farm-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 6px 0 0;
    color: #2d6a4f;
    font-size: 11px;
    vertical-align: middle;
    transition: transform .2s;
    display: inline-block;
    line-height: 1;
}
.farm-toggle.open { transform: rotate(90deg); }

/* Plots expansion row */
.plots-row > td {
    padding: 0 !important;
    background: #f8fbf9;
    border-top: none;
}
.plots-row-inner {
    padding: 10px 16px 14px 36px;
}
.plots-sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.plots-sub-table th {
    background: none;
    padding: 5px 10px;
    color: #6b7280;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    font-size: 12px;
}
.plots-sub-table td {
    padding: 7px 10px;
    border-top: none;
    border-bottom: 1px solid #f0f0f0;
}
.plots-sub-table tr:last-child td { border-bottom: none; }
.plots-sub-table tr:hover td { background: #f1f7f4; }
.plots-empty {
    color: #9ca3af;
    font-size: 13px;
    padding: 8px 10px;
    display: block;
}
.plots-add-link {
    font-size: 12px;
    color: #2d6a4f;
    margin-top: 8px;
    display: inline-block;
}
.planting-item + .planting-item { margin-top: 5px; }
.planting-crop { font-weight: 500; color: #1f2937; }
.planting-dates { font-size: 11px; color: #6b7280; margin-top: 1px; }
.planting-none { font-size: 12px; color: #9ca3af; }

/* ── Operation Type Pills (unified operations form) ──────────────── */
.op-type-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.op-type-pill {
    display: inline-flex; align-items: center; cursor: pointer;
    padding: 7px 14px; border: 1px solid #d1d5db; border-radius: 20px;
    font-size: 13px; font-weight: 500; color: #374151;
    transition: all 0.15s; user-select: none;
}
.op-type-pill:hover { border-color: #2d6a4f; color: #2d6a4f; }
.op-type-pill input[type="radio"] { display: none; }
.op-type-pill:has(input:checked) {
    background: #2d6a4f; color: #fff; border-color: #2d6a4f;
}
/* Fallback for browsers without :has() */
.op-type-pill input:checked + span {
    color: inherit;
}
