:root {
    --primary: #2d5a27;
    --primary-light: #4c8c4a;
    --accent: #f29f05;
    --bg-dark: #121412;
    --surface: rgba(255, 255, 255, 0.08);
    --surface-bright: rgba(255, 255, 255, 0.15);
    --text: #e0e0e0;
    --text-dim: #a0a0a0;
    --sidebar-width: 260px;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
}

h1,
h2,
.logo {
    font-family: 'Outfit', sans-serif;
}

#app {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Main Content area - Needs to take full space */
main {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

/* Base Map - Always covers the parent 'main' */
#view-map {
    display: block !important;
    position: absolute;
    inset: 0;
    z-index: 1;
}

#map-container,
#map {
    width: 100%;
    height: 100%;
}

/* Floating Toggle Buttons */
.floating-menu-btn {
    position: absolute;
    top: 20px;
    z-index: 5000;
    background: var(--primary);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-menu-btn:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.sidebar-btn {
    left: 20px;
}

.tools-btn {
    right: 20px;
}

/* Sidebar Navigation */
.sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background: rgba(18, 20, 18, 0.95);
    border-right: 1px solid var(--glass-border);
    padding: 5rem 1rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 3000;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.sidebar-minimized .sidebar {
    transform: translateX(-100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--primary-light);
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.nav-links li:hover,
.nav-links li.active {
    background: var(--surface);
    color: white;
}

.nav-links li.active {
    border-left: 4px solid var(--primary-light);
}

/* Map Controls / Tools (Right side) */
.map-controls {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.tools-minimized .map-controls {
    transform: translateX(150%);
    opacity: 0;
    pointer-events: none;
}

/* パネル表示中にツールボタンを強制的に隠すクラス */
.controls-hidden {
    display: none !important;
}

/* --- View Header Styles --- */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-close-view {
    background: var(--surface);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
}

.btn-close-view:hover {
    background: var(--surface-bright);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--surface-bright);
}

.btn-delete {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

.btn-delete:hover {
    background: #dc2626;
}

/* --- Table Styles --- */
.table-container {
    overflow-x: auto;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: var(--surface-bright);
    font-weight: 600;
    color: var(--text);
}

td {
    color: var(--text-dim);
}

tbody tr:hover {
    background: var(--surface-bright);
}

/* --- Form Styles --- */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal {
    background: var(--bg-dark);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

.modal .form-group {
    margin-bottom: 1.5rem;
}

.modal .btn-group {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.hidden {
    display: none !important;
}

/* --- Bottom Navigation (Mobile) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(18, 20, 18, 0.95);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
    background: var(--surface);
    color: white;
}

.nav-item i {
    font-size: 1.2rem;
}

/* --- Gantt Chart Styles (from yearly-gantt-planner) --- */
.gantt-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
}

.gantt-container {
    min-width: 1800px;
    display: flex;
    flex-direction: column;
}

.timeline-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--glass-border);
}

.task-info-header {
    width: 250px;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    border-right: 1px solid var(--glass-border);
    background: var(--surface);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dim);
}

.col-crop {
    width: 100px;
    padding: 1rem 0.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.col-task {
    width: 150px;
    padding: 1rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.months-row {
    flex: 1;
    display: flex;
}

.month-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

.month-label {
    padding: 4px;
    text-align: center;
    font-size: 0.75rem;
    background: var(--surface-bright);
    border-bottom: 1px solid var(--glass-border);
}

.weeks-row {
    display: flex;
}

.week-label {
    text-align: center;
    font-size: 0.6rem;
    padding: 2px 0;
    color: var(--text-dim);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.crop-section {
    display: flex;
    border-bottom: 2px solid var(--glass-border);
    transition: background 0.2s;
}

.crop-section[draggable="true"]:active {
    opacity: 0.5;
}

.drag-handle {
    cursor: grab;
    padding: 0 4px;
    display: flex;
    align-items: center;
    color: var(--text-dim);
    transition: color 0.2s;
}

.drag-handle:hover {
    color: var(--primary);
}

.drag-handle:active {
    cursor: grabbing;
}

.crop-sidebar-cell {
    width: 100px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--surface);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    padding: 10px 5px;
    position: sticky;
    left: 0;
    z-index: 60;
}

.crop-rows-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gantt-row {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}

.gantt-row[draggable="true"]:active {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.05);
}

.task-name-cell {
    width: 150px;
    flex-shrink: 0;
    padding: 10px 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-right: 1px solid var(--glass-border);
    font-size: 0.85rem;
    font-weight: 600;
    position: sticky;
    left: 100px;
    z-index: 50;
    transition: background 0.2s;
}

.task-name-cell:hover {
    background: rgba(255, 255, 255, 0.02);
}

.grid-cells {
    flex: 1;
    position: relative;
    background-image: linear-gradient(to right, var(--glass-border) 1px, transparent 1px);
    background-size: 35px 100%;
    top: 0;
}

.layer-track {
    position: absolute;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.task-item {
    position: absolute;
    z-index: 30;
    cursor: pointer;
    overflow: visible;
    height: 64px;
}

.task-details {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.status-check-btn {
    margin-right: 6px;
    font-size: 0.95rem;
    pointer-events: auto;
    user-select: none;
    line-height: 1;
}

.task-label {
    font-size: 0.75rem;
    color: var(--text);
    font-weight: 500;
}

.task-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 12px;
    display: flex;
    align-items: center;
    width: 100%;
}

.arrow-icon {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1;
    transform: translateY(-2px);
    margin-left: 5px;
}

.arrow-line {
    position: absolute;
    left: 2px;
    right: 2px;
    height: 2px;
    background-color: var(--primary);
}

.arrow-left-head {
    position: absolute;
    left: -4px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 6px 4px 0;
    border-color: transparent var(--primary) transparent transparent;
}

.arrow-right-head {
    position: absolute;
    right: -4px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent var(--primary);
}

.task-item.p-0 .arrow-icon {
    color: var(--primary);
}

.task-item.p-0 .arrow-line {
    background-color: var(--primary);
}

.task-item.p-0 .arrow-left-head {
    border-right-color: var(--primary);
}

.task-item.p-0 .arrow-right-head {
    border-left-color: var(--primary);
}

.task-item.overlap-c1.p-0 .arrow-line {
    background-color: #f59e0b;
}

.task-item.overlap-c1.p-0 .arrow-left-head {
    border-right-color: #f59e0b;
}

.task-item.overlap-c1.p-0 .arrow-right-head {
    border-left-color: #f59e0b;
}

.task-item.overlap-c1 .task-label {
    color: #fbbf24;
}

.task-item.overlap-c2.p-0 .arrow-line {
    background-color: #ec4899;
}

.task-item.overlap-c2.p-0 .arrow-left-head {
    border-right-color: #ec4899;
}

.task-item.overlap-c2.p-0 .arrow-right-head {
    border-left-color: #ec4899;
}

.task-item.overlap-c2 .task-label {
    color: #f472b6;
}

.task-item.overlap-c3.p-0 .arrow-line {
    background-color: #8b5cf6;
}

.task-item.overlap-c3.p-0 .arrow-left-head {
    border-right-color: #8b5cf6;
}

.task-item.overlap-c3.p-0 .arrow-right-head {
    border-left-color: #8b5cf6;
}

.task-item.overlap-c3 .task-label {
    color: #a78bfa;
}

.task-item.overlap-c4.p-0 .arrow-line {
    background-color: #14b8a6;
}

.task-item.overlap-c4.p-0 .arrow-left-head {
    border-right-color: #14b8a6;
}

.task-item.overlap-c4.p-0 .arrow-right-head {
    border-left-color: #14b8a6;
}

.task-item.overlap-c4 .task-label {
    color: #2dd4bf;
}

.task-item.overlap-c5.p-0 .arrow-line {
    background-color: #ef4444;
}

.task-item.overlap-c5.p-0 .arrow-left-head {
    border-right-color: #ef4444;
}

.task-item.overlap-c5.p-0 .arrow-right-head {
    border-left-color: #ef4444;
}

.task-item.overlap-c5 .task-label {
    color: #f87171;
}

.task-item.p-100 .task-label {
    text-decoration: line-through;
    opacity: 0.6;
}

.task-item.p-100 .arrow-icon {
    color: var(--accent);
}

.task-item.p-100 .arrow-line {
    background-color: var(--accent);
}

.task-item.p-100 .arrow-left-head {
    border-color: transparent var(--accent) transparent transparent;
}

.task-item.p-100 .arrow-right-head {
    border-color: transparent transparent transparent var(--accent);
}

.row-delete-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 4px;
}

.task-name-cell:hover .row-delete-btn {
    opacity: 1;
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-overlay .modal {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    width: 400px;
    border: 1px solid var(--glass-border);
}

#modal-overlay input,
#modal-overlay select {
    width: 100%;
    padding: 8px;
    margin: 4px 0 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: #fff;
    border-radius: 6px;
}

#modal-overlay .btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

#modal-overlay .btn-primary:hover {
    background: var(--primary-light);
}

#modal-overlay .btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

#modal-overlay .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

#modal-overlay .btn-delete {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

#modal-overlay .btn-delete:hover {
    background: #dc2626;
}
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-close-view:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

.btn-close-view i {
    width: 20px;
    height: 20px;
}


/* --- View Base Management --- */
.view {
    display: none;
    position: absolute;
    z-index: 5500;
    flex-direction: column;
    padding: 1.5rem;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.view.active {
    display: flex;
    opacity: 1;
}

/* Base Map Exception */
#view-map.view {
    display: block !important;
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 1 !important;
    padding: 0;
    transform: none !important;
}

/* Floating Panels - Farms & Fields (Right side floating) */
#view-farms,
#view-fields {
    top: 20px;
    right: 20px;
    bottom: 20px;
    width: 60%;
    max-width: 800px;
    background: rgba(18, 20, 18, 0.45);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    transform: translateX(120%);
}

#view-farms.active,
#view-fields.active {
    transform: translateX(0);
}

/* Full Screen Views - History & Gantt (Cover absolute everything) */
#view-history,
#view-gantt {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    z-index: 8000 !important; /* Lowered from 9999 to ensure overlay(50000) is always on top */
    background-color: var(--bg-dark) !important;
    background: var(--bg-dark) !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    padding: 2rem !important;
    transform: translateY(100%) !important;
}

#view-history.active,
#view-gantt.active {
    transform: translateY(0) !important;
}

/* Hidden state for panels when tools are closed */
/* Hidden state for panels when tools are closed - REMOVED to allow independent control */
/* .tools-minimized .view:not(#view-map) {
    display: none !important;
} */

/* Glassmorphism Classes */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Buttons */
button {
    padding: 0.6rem 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--primary-light);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: #333 !important;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-delete {
    background: rgba(235, 64, 52, 0.1);
    color: #eb4034;
    border: 1px solid rgba(235, 64, 52, 0.2);
}

.btn-delete:hover {
    background: #eb4034;
    color: white;
}

.btn-delete.hidden {
    display: none;
}

#btn-draw {
    background: var(--primary);
    color: white;
}

#btn-draw.drawing {
    background: var(--accent);
}

/* Table Styles */
.history-container,
.fields-container,
.farms-container {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--glass-border);
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px;
    transition: background 0.2s ease;
}

th.sortable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sort-icon {
    width: 14px;
    height: 14px;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

th.active-sort .sort-icon {
    opacity: 1;
    color: var(--primary);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
    color: var(--text);
}

.media-list-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 130px;
}

.history-media-thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: transform 0.2s ease;
}

.history-media-thumb:hover {
    transform: scale(1.1);
}

/* Field Labels on Map */
.field-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: white !important;
    font-weight: 700 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    text-align: center;
}

.label-crop {
    display: none;
    font-size: 0.8rem;
    font-weight: 400;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
}

#map.zoom-high .label-crop {
    display: block;
}

/* Modals */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85); /* Darker for better contrast */
    z-index: 999999; /* body直下なのでどの要素より前面に表示される */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}


#modal-overlay.hidden {
    display: none;
}

.modal {
    width: 92%;
    max-width: 550px;
    height: auto;
    max-height: 90vh;
    padding: 2.5rem;
    overflow-y: auto;
    border-radius: 24px;
    background: #1a1c1a;
    border: 1px solid var(--glass-border);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    z-index: 100000;
    position: relative;
}


/* Login modal should stay small if not specifically requested full screen */
#modal-login {
    width: 95%;
    max-width: 350px;
    height: auto;
    max-height: 90vh;
    border-radius: 16px;
    margin: auto;
}

.modal.hidden {
    display: none;
}

.modal header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    color: var(--text-dim);
    font-size: 0.9rem;
}

input,
select,
textarea {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0.8rem;
    color: #333;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-light);
}

.btn-submit {
    width: 100%;
    background: var(--primary-light);
    color: white;
    justify-content: center;
    margin-top: 1rem;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Mobile Utilities */
.hide-mobile {
    display: block;
}

/* Bottom Navigation (Hidden on Desktop) */
.bottom-nav {
    display: none;
    /* Desktop default */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 6000;
    background: rgba(18, 20, 18, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    justify-content: space-around;
    padding: 0.8rem 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.75rem;
    gap: 4px;
    cursor: pointer;
}

.nav-item.active {
    color: var(--primary-light);
}

.editable-cell {
    cursor: pointer;
    color: white;
    transition: color 0.2s ease;
}

.editable-cell:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Toast Notification */
#toast-container {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: rgba(45, 90, 39, 0.95);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: toast-in 0.4s ease forwards, toast-out 0.4s ease 2.6s forwards;
}

@keyframes toast-in {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }

    .sidebar {
        display: none;
    }

    main {
        padding: 10px 10px 80px 10px !important;
    }

    .history-container,
    .fields-container,
    .farms-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        width: 100%;
    }

    table {
        min-width: 600px;
    }

    .modal {
        width: 95% !important;
        padding: 1.2rem !important;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }

}

/* --- Gantt Chart Specific Styles --- */
.gantt-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.crop-section {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.crop-sidebar-cell {
    width: 100px;
    flex-shrink: 0;
    background: rgba(45, 90, 39, 0.1);
    border-right: 1px solid var(--glass-border);
    padding: 1rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: var(--primary-light);
    cursor: grab;
}

.crop-rows-container {
    flex: 1;
}

.gantt-row {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
    cursor: default;
}

.task-name-cell {
    width: 150px;
    flex-shrink: 0;
    border-right: 1px solid var(--glass-border);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
}

.grid-cells {
    flex: 1;
    position: relative;
    padding: 10px 0;
}

.layer-track {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.task-item {
    position: absolute;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 5;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.task-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.task-item.period {
    background: linear-gradient(90deg, #38bdf8, #0ea5e9);
}

.task-item.deadline {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.task-item.p-100 {
    background: linear-gradient(90deg, #10b981, #059669) !important;
}

/* Overlapping Colors */
.task-item.overlap-c1 { filter: hue-rotate(45deg); }
.task-item.overlap-c2 { filter: hue-rotate(90deg); }
.task-item.overlap-c3 { filter: hue-rotate(180deg); }
.task-item.overlap-c4 { filter: hue-rotate(270deg); }

.task-details {
    position: absolute;
    left: 4px;
    white-space: nowrap;
    font-size: 11px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,1);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 10px;
    cursor: pointer;
}

.status-check-btn {
    cursor: pointer;
    font-size: 12px;
}

.task-arrow {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 12px;
    margin-top: -6px;
    pointer-events: none;
}

.arrow-line {
    position: absolute;
    top: 50%;
    left: 2px;
    right: 2px;
    height: 2px;
    background: rgba(255,255,255,0.7);
    margin-top: -1px;
}

.arrow-left-head, .arrow-right-head {
    position: absolute;
    top: 50%;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-top: -4px;
}

.arrow-left-head {
    left: 0;
    border-right: 6px solid rgba(255,255,255,0.7);
}

.arrow-right-head {
    right: 0;
    border-left: 6px solid rgba(255,255,255,0.7);
}

.drag-handle {
    cursor: grab;
    display: flex;
    align-items: center;
    color: var(--text-dim);
}

.row-delete-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.2);
    padding: 4px;
    cursor: pointer;
    opacity: 0;
}

.gantt-row:hover .row-delete-btn {
    opacity: 1;
}

.row-delete-btn:hover {
    color: #ef4444;
}

.months-row {
    height: 50px;
    display: flex;
}

.month-col {
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.month-label {
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid var(--glass-border);
}

.weeks-row {
    height: 25px;
    display: flex;
}

.week-label {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-dim);
    border-right: 1px solid rgba(255,255,255,0.05);
}

@media (max-width: 768px) {
    .view {
        width: 100% !important;
        max-width: 100% !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
    }
}

@media (max-width: 768px) {
    .floating-menu-btn.sidebar-btn {
        bottom: 20px;
        left: 20px;
    }
}