/* ========================================
   건물관리 종합 대시보드 - 메인 스타일
   ======================================== */

:root {
  --green-dark: #1a5c2a;
  --green-main: #2e7d32;
  --green-light: #4caf50;
  --green-pale: #e8f5e9;
  --yellow: #f9a825;
  --orange: #ef6c00;
  --red: #c62828;
  --blue: #1565c0;
  --gray-bg: #f5f6fa;
  --gray-border: #ddd;
  --gray-text: #555;
  --white: #fff;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
  --radius: 6px;
  --font: 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--gray-bg); color: #222; font-size: 13px; }

/* ===== 스크롤바 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }

/* ===== 메뉴바 ===== */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--green-dark);
  padding: 0 20px; height: 52px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.nav-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 15px; font-weight: 700; }
.nav-brand i { font-size: 18px; color: #a5d6a7; }
.nav-menu { display: flex; list-style: none; gap: 2px; }
.nav-link {
  display: block; padding: 6px 14px; color: #c8e6c9;
  text-decoration: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover, .nav-link.active { background: var(--green-light); color: #fff; }
.nav-dropdown { position: relative; }
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0;
  background: #fff; border: 1px solid #ddd; border-radius: var(--radius);
  min-width: 90px; box-shadow: var(--shadow); z-index: 2000;
  padding: 4px 0;
}
.dropdown-item {
  display: block; padding: 7px 16px; color: #333;
  text-decoration: none; font-size: 13px;
  transition: background 0.15s;
}
.dropdown-item:hover { background: var(--green-pale); color: var(--green-main); }

/* ===== 공통 버튼 ===== */
.btn-search {
  padding: 7px 18px; background: var(--green-main); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  transition: background 0.2s;
}
.btn-search:hover { background: var(--green-dark); }
.btn-save {
  padding: 7px 18px; background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  transition: background 0.2s;
}
.btn-save:hover { background: #0d47a1; }
.btn-danger {
  padding: 7px 18px; background: var(--red); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 600;
}

/* ===== 페이지 컨테이너 ===== */
.main-container { padding: 14px 16px; max-width: 1600px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 14px; }
.page-header h2 { font-size: 18px; font-weight: 700; color: var(--green-dark); }
.page-header h2 i { margin-right: 8px; }

/* ===== 필터바 ===== */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  background: #fff; padding: 10px 14px; border-radius: var(--radius);
  margin-bottom: 14px; box-shadow: var(--shadow);
}
.filter-bar select, .filter-bar input {
  padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px;
  font-family: var(--font); font-size: 13px; background: #fff;
}

/* ===== 빈 상태 ===== */
.empty-state {
  text-align: center; padding: 60px 20px; color: #aaa;
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ===== 공통 박스 타이틀 ===== */
.box-title {
  font-size: 12px; font-weight: 700; padding: 5px 10px;
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
}
.green-bg { background: var(--green-main); }
.no-data { text-align: center; color: #aaa; font-size: 12px; }

/* ========================================
   칸반 페이지
   ======================================== */

/* 헤더바 */
.kanban-header-bar {
  display: flex; align-items: center; gap: 12px;
  background: #fff; padding: 10px 14px;
  border-radius: var(--radius); margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.select-group { display: flex; align-items: center; gap: 6px; }
.select-group label { font-weight: 600; font-size: 13px; color: var(--green-dark); white-space: nowrap; }
.select-group select {
  padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px;
  font-family: var(--font); font-size: 13px;
}

/* 상단 정보 테이블 */
.kanban-top-table {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 10px; overflow-x: auto;
}
.info-table { width: 100%; border-collapse: collapse; }
.info-table th {
  background: var(--green-dark); color: #fff;
  padding: 8px 10px; text-align: center; font-size: 12px;
  border: 1px solid #1a5c2a;
}
.info-table td {
  padding: 10px 12px; text-align: center; border: 1px solid #e0e0e0;
  font-size: 13px;
}
.info-table .branch-row td { background: #fff; }
.info-table .region-row td { background: #f9fff9; }
.month-cell { font-size: 20px; font-weight: 800; color: var(--green-dark); }
.branch-name-cell { font-size: 18px; font-weight: 700; }
.score-cell { font-size: 18px; font-weight: 800; }
.score-cell.green { color: var(--green-light); }
.score-cell.red { color: #e53935; }
.rank-cell { font-size: 14px; font-weight: 600; }
.region-rank { color: var(--orange); }
.accent-col { background: #c8e6c9 !important; color: var(--green-dark) !important; }
.sub-label { font-size: 10px; font-weight: 400; }
.grade-badge {
  display: inline-block; padding: 4px 14px;
  background: #fff3e0; border: 2px solid var(--orange);
  border-radius: 4px; font-size: 20px; font-weight: 800;
  color: var(--orange);
}

/* 중단 섹션 */
.kanban-mid-section {
  display: flex; gap: 10px; margin-bottom: 10px;
  align-items: flex-start;
}

/* 등급기준표 */
.grade-criteria-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 170px; flex-shrink: 0;
}
.grade-table { width: 100%; border-collapse: collapse; }
.grade-table th {
  background: #e8f5e9; color: var(--green-dark);
  padding: 5px 6px; font-size: 11px; border: 1px solid #c8e6c9;
  text-align: center;
}
.grade-table td {
  padding: 5px 6px; text-align: center; border: 1px solid #e8e8e8;
  font-size: 11px;
}
.grade-table td:first-child { font-weight: 700; color: var(--green-dark); }
.signal {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  vertical-align: middle;
}
.signal.green { background: #43a047; }
.signal.yellow { background: #fdd835; }
.signal.orange { background: #fb8c00; }
.signal.red { background: #e53935; }
.radar-total-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: #f1f8e9;
  border-top: 1px solid #c8e6c9;
  font-size: 12px; font-weight: 700; color: var(--green-dark);
}
.total-score-val { font-size: 16px; color: var(--green-main); }

/* 레이더 차트 박스 */
.radar-chart-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 280px; flex-shrink: 0;
  display: flex; flex-direction: column;
}
.radar-chart-box canvas { padding: 10px; }

/* 도넛 차트 박스 */
.donut-charts-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  flex: 1; overflow: hidden;
}
.donut-row {
  display: flex; gap: 0; justify-content: space-around;
  padding: 10px 6px 6px;
  border-bottom: 1px solid #f0f0f0;
}
.donut-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 1;
}
.donut-label {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--green-dark); line-height: 1.3;
}
.donut-label small { font-size: 9px; font-weight: 400; color: #888; }
.donut-wrap {
  position: relative; width: 90px; height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.donut-wrap canvas { position: absolute; top: 0; left: 0; }
.donut-center {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
}
.donut-score { font-size: 16px; font-weight: 800; color: #333; line-height: 1.1; }
.donut-rank { font-size: 11px; color: #888; }

/* 신호등 그리드 */
.signal-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0; padding: 6px;
}
.signal-item {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 6px; border: 1px solid #f0f0f0;
  font-size: 11px; line-height: 1.3;
}
.signal-dot {
  display: inline-block; width: 14px; height: 14px; min-width: 14px;
  border-radius: 50%; background: #ccc;
  flex-shrink: 0;
}
.signal-dot.green { background: #43a047; }
.signal-dot.yellow { background: #fdd835; }
.signal-dot.orange { background: #fb8c00; }
.signal-dot.red { background: #e53935; }
.signal-dot.gray { background: #bdbdbd; }

/* 피드백 섹션 */
.feedback-section {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 10px; overflow: hidden;
}
.feedback-row {
  display: flex; align-items: stretch;
  border-bottom: 1px solid #e8e8e8;
  min-height: 36px;
}
.feedback-row:last-child { border-bottom: none; }
.feedback-label {
  background: var(--green-dark); color: #fff;
  padding: 8px 12px; font-size: 12px; font-weight: 700;
  min-width: 80px; display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
}
.feedback-content {
  padding: 8px 14px; font-size: 12px; line-height: 1.5;
  flex: 1; color: #333;
}

/* 하단 섹션 */
.kanban-bottom-section {
  display: flex; gap: 10px; align-items: flex-start;
}
.bottom-left {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  flex: 1; overflow: hidden; min-width: 0;
}
.bottom-table-wrap { overflow-x: auto; }
.bottom-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.bottom-table th {
  background: #e8f5e9; color: var(--green-dark);
  padding: 5px 4px; font-size: 10px; border: 1px solid #c8e6c9;
  text-align: center; white-space: nowrap;
}
.bottom-table td {
  padding: 5px 4px; text-align: center; border: 1px solid #e8e8e8;
  font-size: 11px;
}
.bottom-table tr:first-child td { font-weight: 700; background: #f9f9f9; }
.bottom-table td.highlight-max { background: #e8f5e9; color: var(--green-main); font-weight: 700; }
.bottom-table td.highlight-min { background: #ffebee; color: var(--red); font-weight: 700; }
.bottom-table td.highlight-cur { background: #fff9c4; color: #f57f17; font-weight: 700; }

.bottom-right {
  display: flex; flex-direction: column; gap: 10px;
  min-width: 440px; max-width: 500px;
}
.monthly-summary-box, .area-score-box {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.monthly-table, .area-score-table { width: 100%; border-collapse: collapse; }
.monthly-table th, .area-score-table th {
  background: #e8f5e9; color: var(--green-dark);
  padding: 5px 5px; font-size: 10px; border: 1px solid #c8e6c9;
  text-align: center; white-space: nowrap;
}
.monthly-table td, .area-score-table td {
  padding: 5px 5px; text-align: center; border: 1px solid #e8e8e8;
  font-size: 11px;
}
.monthly-table tr.highlight-row td { background: #fff9c4; font-weight: 700; }

/* ========================================
   종합 페이지
   ======================================== */
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.summary-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; transition: transform 0.15s;
}
.summary-card:hover { transform: translateY(-2px); }
.summary-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--green-pale);
}
.summary-card-branch { font-size: 15px; font-weight: 700; color: var(--green-dark); }
.summary-card-grade { font-size: 18px; font-weight: 800; color: var(--orange); }
.summary-card-scores { display: flex; gap: 6px; flex-wrap: wrap; }
.score-badge {
  padding: 3px 8px; border-radius: 20px; font-size: 11px;
  font-weight: 600; background: #f5f5f5; color: #555;
}
.score-badge.fms { background: #e3f2fd; color: #1565c0; }
.score-badge.sms { background: #e8f5e9; color: #2e7d32; }
.score-badge.ems { background: #f3e5f5; color: #6a1b9a; }
.score-badge.kaizen { background: #fff8e1; color: #e65100; }
.score-badge.risk { background: #fce4ec; color: #880e4f; }
.summary-card-total {
  margin-top: 10px; text-align: right;
  font-size: 22px; font-weight: 800; color: var(--green-main);
}
.summary-card-rank { font-size: 12px; color: #888; font-weight: 400; }

/* ========================================
   누적 페이지
   ======================================== */
.cumulative-table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.cum-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.cum-table th {
  background: var(--green-dark); color: #fff;
  padding: 7px 8px; font-size: 11px; border: 1px solid #1a5c2a;
  text-align: center; white-space: nowrap;
}
.cum-table td {
  padding: 6px 8px; border: 1px solid #e0e0e0;
  font-size: 12px; text-align: center;
}
.cum-table tr.region-row td { background: #e8f5e9; font-weight: 700; }
.cum-table tr:hover td { background: #f5f5f5; }
.rank-badge {
  display: inline-block; width: 24px; height: 24px; border-radius: 50%;
  background: var(--green-main); color: #fff; font-size: 11px;
  font-weight: 700; line-height: 24px; text-align: center;
}
.rank-badge.rank1 { background: #f57f17; }
.rank-badge.rank2 { background: #9e9e9e; }
.rank-badge.rank3 { background: #795548; }

/* ========================================
   월별 데이터 페이지
   ======================================== */
.monthly-data-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.monthly-data-table { width: 100%; border-collapse: collapse; min-width: 1200px; }
.monthly-data-table th {
  background: var(--green-dark); color: #fff;
  padding: 6px 5px; font-size: 10px; border: 1px solid #1a5c2a;
  text-align: center; white-space: nowrap;
}
.monthly-data-table td {
  padding: 5px 5px; border: 1px solid #e0e0e0;
  font-size: 11px; text-align: center;
}
.monthly-data-table tr.region-avg td { background: #e8f5e9; font-weight: 700; }
.monthly-data-table tr:hover td { background: #f9f9f9; }

/* ========================================
   피드백 입력 페이지
   ======================================== */
.feedback-input-form {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.feedback-input-form h3 { color: var(--green-dark); margin-bottom: 16px; font-size: 15px; }
.form-section { margin-bottom: 20px; }
.form-section-title {
  font-size: 13px; font-weight: 700; color: var(--green-dark);
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--green-pale);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: 12px; font-weight: 600; color: #555; }
.form-field input[type="number"], .form-field input[type="text"] {
  padding: 7px 10px; border: 1px solid #ccc; border-radius: 4px;
  font-family: var(--font); font-size: 13px;
  transition: border-color 0.2s;
}
.form-field input:focus { outline: none; border-color: var(--green-light); }
.form-field textarea {
  padding: 7px 10px; border: 1px solid #ccc; border-radius: 4px;
  font-family: var(--font); font-size: 13px; resize: vertical; min-height: 60px;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.score-preview {
  background: var(--green-pale); border-radius: var(--radius); padding: 12px 16px;
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
}
.score-preview-item { text-align: center; }
.score-preview-label { font-size: 11px; color: #666; }
.score-preview-val { font-size: 18px; font-weight: 800; color: var(--green-dark); }

/* ========================================
   기준 페이지
   ======================================== */
.criteria-container { display: flex; flex-direction: column; gap: 14px; }
.criteria-section {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.criteria-section-title {
  background: var(--green-main); color: #fff; padding: 8px 14px;
  font-size: 13px; font-weight: 700;
}
.criteria-table { width: 100%; border-collapse: collapse; }
.criteria-table th {
  background: #e8f5e9; color: var(--green-dark);
  padding: 7px 10px; font-size: 11px; border: 1px solid #c8e6c9;
  text-align: center;
}
.criteria-table td {
  padding: 7px 10px; border: 1px solid #e8e8e8;
  font-size: 12px; vertical-align: top;
}
.criteria-table td:first-child { font-weight: 700; color: var(--green-dark); white-space: nowrap; }
.criteria-table tr:nth-child(even) td { background: #fafafa; }
.weight-badge {
  display: inline-block; padding: 2px 7px; border-radius: 10px;
  background: var(--green-main); color: #fff; font-size: 11px; font-weight: 700;
}

/* ========================================
   반응형
   ======================================== */
@media (max-width: 1100px) {
  .kanban-mid-section { flex-wrap: wrap; }
  .donut-charts-box { min-width: 100%; }
  .kanban-bottom-section { flex-direction: column; }
  .bottom-right { min-width: 100%; max-width: 100%; }
}
@media (max-width: 700px) {
  .navbar { flex-direction: column; height: auto; padding: 8px; }
  .nav-menu { flex-wrap: wrap; gap: 4px; }
  .signal-grid { grid-template-columns: repeat(2, 1fr); }
  .donut-row { flex-wrap: wrap; }
}
