:root {
    --primary: #0984e3;
    --success: #00b894;
    --danger: #e74c3c;
    --warning: #fdcb6e;
    --bg: #f8f9fa;
    --border: #dfe6e9;
    --table-header: #2d3436; /* 테이블 헤더 다크톤 변경 */
}

body { font-family: 'Pretendard', -apple-system, sans-serif; background: var(--bg); margin: 0; color: #2d3436; line-height: 1.6; }

header { background: #2d3436; color: white; padding: 12px 30px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1000; }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-links button { background: transparent; color: #b2bec3; border: none; padding: 8px 12px; cursor: pointer; border-radius: 4px; font-size: 13px; transition: 0.2s; }
.nav-links button:hover, .nav-links button.active { color: white; background: rgba(255,255,255,0.1); font-weight: bold; }

.container { max-width: 1450px; margin: 15px auto; background: white; padding: 20px 25px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); min-height: 85vh; }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.dashboard-wrapper { display: flex; gap: 15px; height: calc(100vh - 120px); min-height: 650px; }
.dashboard-left { display: flex; flex-direction: column; gap: 15px; width: 260px; flex-shrink: 0; }
.dashboard-center { flex: 1; display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.dashboard-right { display: flex; flex-direction: column; width: 260px; flex-shrink: 0; }
.dashboard-charts { display: flex; gap: 15px; height: 220px; flex-shrink: 0; }

.stat-card, .chart-card, .timeline-card { background: white; padding: 15px; border-radius: 10px; border: 1px solid var(--border); box-sizing: border-box; }
.stat-card { flex: 1; cursor: pointer; transition: 0.2s; text-align: center; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); }
/* 🚀 날씨 카드 사이즈 축소 및 클릭 유도 디자인 */
.weather-card { background: #2d3436; color: white; padding: 12px; border-radius: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 4px 10px rgba(0,0,0,0.2); width: 100%; box-sizing: border-box; cursor: pointer; transition: 0.2s; }
.weather-card:hover { background: #353b48; transform: scale(1.02); }

#map_container { flex: 1; border-radius: 10px; background: #f8f9fa; border: 1px solid var(--border); z-index: 1; }
#timeline_container { flex: 1; overflow-y: auto; padding-right: 5px; }

.log-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid #f1f2f6; font-size: 12px; }
.log-time { color: #a4b0be; font-weight: bold; font-family: monospace; }
.log-highlight { font-weight: bold; color: var(--primary); }

.search-filter-bar { display: flex; gap: 10px; background: #f1f3f5; padding: 15px; border-radius: 8px; margin-bottom: 15px; align-items: center; border: 1px solid var(--border); }

/* 🚀 [초강력 해결] table-layout: fixed 로 열 찌그러짐 원천 차단 */
.table-responsive { width: 100%; overflow-x: auto; max-height: calc(100vh - 230px); overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 1000px; margin: 0; table-layout: fixed; }
/* 🚀 마스터 헤더 및 완료내역 디자인 전면 개편 */
.data-table th { position: sticky; top: 0; z-index: 10; background: var(--table-header); padding: 10px 6px; text-align: left; color: white; border-bottom: 1px solid #555; border-right: 1px solid #444; font-weight: 500; }
.data-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; background: white; }
.data-table tbody tr:nth-child(even) td { background: #fafafa; } /* 얼룩말 무늬 디자인 */
.data-table th:last-child, .data-table td:last-child { border-right: none; }
.data-table tr:last-child td { border-bottom: none; }

/* 🚀 마스터 폼 높이 최적화 (높이 대폭 압축) */
.table-input { width: 100%; border: 1px solid transparent; background: transparent; outline: none; padding: 4px; box-sizing: border-box; transition: 0.2s; height: 26px; }
.table-input:focus { border: 1px solid var(--primary); background: white; border-radius: 4px; }

.fare-suggested { color: #0984e3; font-weight: bold; }
.fare-confirmed { color: #e74c3c; font-weight: bold; }
.fare-save { color: #00b894; font-weight: bold; } 
.fare-loss { color: #e74c3c; font-weight: bold; } 

.btn-primary, .btn-danger, .btn-reg, .btn-outline, .btn-success, .btn-excel { border: none; cursor: pointer; font-weight: bold; border-radius: 4px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--primary); color: white; padding: 8px 16px; }
.btn-reg { background: #4834d4; color: white; padding: 8px 20px; }
.btn-danger { background: var(--danger); color: white; padding: 8px 16px; }
.btn-success { background: var(--success); color: white; padding: 8px 16px; }
.btn-outline { background: white; color: #2d3436; border: 1px solid #dfe6e9; padding: 8px 16px; }
.btn-excel { background: #217346; color: white; padding: 8px 16px; } 

.action-buttons { display: flex; flex-direction: row; gap: 5px; justify-content: center; align-items: center; }
.action-buttons button { height: 24px !important; padding: 0 8px !important; font-size: 11px; margin: 0; }

.badge-agri { background: #e74c3c; color: white; font-size: 10px; padding: 2px 4px; border-radius: 4px; font-weight: bold; }
.badge-const { background: #0984e3; color: white; font-size: 10px; padding: 2px 4px; border-radius: 4px; font-weight: bold; }
.td-flex { display: flex; align-items: center; gap: 4px; overflow: visible; }

.category-menu { display: flex; gap: 10px; margin-bottom: 15px; border-bottom: 2px solid #eee; padding-bottom: 12px; align-items: center; flex-wrap: wrap; }
.category-btn-wrap { position: relative; display: inline-block; }
.category-btn { padding: 6px 14px; border: 1px solid #ddd; background: white; border-radius: 20px; cursor: pointer; font-size: 12px; }
.category-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { background: white; padding: 25px; border-radius: 10px; width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.btn-close { background: transparent; border: none; font-size: 22px; cursor: pointer; color: #636e72; padding: 0; line-height: 1; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: center; margin-bottom: 10px; }
.spec-table th { background: #f1f2f6; padding: 12px; border: 1px solid var(--border); font-weight: bold; color: #2d3436; }
.spec-table td { padding: 12px; border: 1px solid var(--border); }

.modal-input-group { margin-bottom: 15px; }
.modal-input-group label { display: block; font-size: 12px; color: #636e72; margin-bottom: 5px; font-weight: bold; }
.modal-input-group input, .modal-input-group select { width: 100%; padding: 8px; border: 1px solid #dfe6e9; border-radius: 4px; box-sizing: border-box; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f2f6; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #b2bec3; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #636e72; }

@media (max-width: 900px) {
    header { flex-direction: column; gap: 10px; }
    .dashboard-wrapper { flex-direction: column; height: auto !important; }
    .dashboard-left, .dashboard-right { width: 100%; }
    .form-box > div { flex-direction: column !important; }
    .modal-content { width: 95% !important; }
}