:root {
    --primary: #0984e3;
    --success: #00b894;
    --danger: #e74c3c;
    --bg: #f8f9fa;
    --border: #dfe6e9;
}

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; } }

/* 🚀 [신규] 대시보드 3단(좌-중-우) 레이아웃 */
.dashboard-wrapper { display: flex; gap: 15px; height: calc(100vh - 160px); 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: 20px; 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; }

.chart-card { display: flex; flex-direction: column; }
.timeline-card { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#timeline_container { flex: 1; overflow-y: auto; padding-right: 5px; }
#map_container { flex: 1; border-radius: 10px; background: #f8f9fa; border: 1px solid var(--border); z-index: 1; }

.log-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid #f1f2f6; font-size: 12px; }
.log-item:last-child { border-bottom: none; }
.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-responsive { width: 100%; overflow-x: auto; max-height: calc(100vh - 280px); overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 800px; margin: 0; }
.data-table th { position: sticky; top: 0; z-index: 10; background: #f1f2f6; padding: 10px 6px; text-align: left; color: #636e72; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.data-table td { padding: 6px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.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: 6px; box-sizing: border-box; transition: 0.2s; }
.table-input:focus, .search-filter-bar input:focus { border: 1px solid var(--primary); background: white; border-radius: 4px; }
.table-input[readonly] { cursor: pointer; color: var(--primary); font-weight: 500; }
.td-flex { display: flex; align-items: center; gap: 4px; overflow: visible; }

.row-inactive td { opacity: 0.5; background: #fafafa; }
.row-inactive .table-input { color: #999; }

.btn-primary, .btn-danger, .btn-reg, .btn-outline, .btn-success { border: none; cursor: pointer; font-weight: bold; border-radius: 4px; box-sizing: border-box; }
.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; }

.action-buttons { display: flex; gap: 4px; justify-content: center; align-items: center; height: 100%; flex-wrap: wrap; }
.action-buttons button { height: 26px !important; line-height: 26px !important; padding: 0 8px !important; font-size: 11px; margin: 0; display: inline-block; vertical-align: middle; box-sizing: border-box; }
.data-table td > button.btn-danger { height: 26px; line-height: 26px; padding: 0 10px; font-size: 11px; margin: 0; display: block; margin: 0 auto; box-sizing: border-box; }

.badge-agri { background: #e74c3c; color: white; font-size: 10px; padding: 2px 4px; border-radius: 4px; font-weight: bold; white-space: nowrap; flex-shrink: 0; line-height: 1; }
.badge-const { background: #0984e3; color: white; font-size: 10px; padding: 2px 4px; border-radius: 4px; font-weight: bold; white-space: nowrap; flex-shrink: 0; line-height: 1; }
.label-general { color: #00b894; font-size: 10px; font-weight: bold; border: 1px solid #00b894; padding: 2px 4px; border-radius: 3px; margin-left: 5px; }

.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; transition: 0.2s; }
.category-btn.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 2px 5px rgba(9,132,227,0.3); }
.category-add-btn { background: #f8f9fa; border: 1px dashed #b2bec3; color: #636e72; font-weight: bold; }
.category-add-btn:hover { background: #dfe6e9; }
.category-btn-del { display: none; position: absolute; top: -6px; right: -6px; background: var(--danger); color: white; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; text-align: center; line-height: 18px; cursor: pointer; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.category-btn-wrap:hover .category-btn-del { display: block; }

.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; }
.btn-close:hover { color: #e74c3c; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: center; margin-bottom: 10px; }
.spec-table th { background: #f1f2f6; padding: 10px; border: 1px solid var(--border); font-weight: bold; color: #2d3436; }
.spec-table td { padding: 10px; 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; padding: 10px; }
    .nav-links { justify-content: center; }
    .dashboard-wrapper, .dashboard-center, .dashboard-right { flex-direction: column; height: auto !important; width: 100%; }
    .dashboard-left { width: 100%; }
    .dashboard-charts { flex-direction: column; height: auto; }
    #map_container { min-height: 350px; }
    .form-box > div { flex-direction: column; align-items: stretch !important; gap: 10px; }
    .form-box select, .form-box input { width: 100% !important; margin: 0 !important; }
    .search-filter-bar { flex-direction: column; align-items: stretch; }
    .table-responsive { max-height: 60vh; }
}

@media print { header, .form-box, button, .search-filter-bar, .modal-overlay, .category-menu, .dashboard-wrapper { display: none !important; } .container { width: 100%; box-shadow: none; padding: 0; } }