/* 전도 분석 입력 — 엑셀 "빌립지파 전도현황 보고" 시트를 눈으로 복제한다.
   서식 근거(openpyxl 실측, '12월' 시트):
     제목 A1 HY견고딕 22pt 굵게, 아래 medium 테두리 / 본문 함초롬바탕 11pt 가운데 정렬
     머리글·라벨·계산 셀 채움 = 테마8 tint 0.8 ≈ #DDEBF7 / 지파 합계 블록 = #FFFFCC
     입력 셀·합계 SUM 셀은 채움 없음(흰색) / 블록 외곽 medium, 안쪽 thin
     열너비 라벨 9.9·숫자 9.2·간격열 2.7 / 행높이 제목 33pt·기수 17.4pt·컬럼라벨 45pt
   문서를 그대로 옮긴 화면이라 다크모드에서도 흰 종이 톤을 유지한다. */

.evr-panel {
  padding: 14px 14px 10px;
}

.evr-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.evr-year {
  margin: 0;
}

/* 저장·엑셀 단추(32px)와 같은 높이·글씨로 한 줄에 맞춘다. */
.evr-year select {
  height: 32px;
  min-height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.evr-legend {
  margin: 0;
  flex: 1 1 320px;
}

.evr-legend-swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1px solid #8b8b8b;
  vertical-align: -1px;
  margin-right: 3px;
}

.evr-legend-input { background: #ffffff; }
.evr-legend-calc { background: #ddebf7; }

.evr-saving {
  font-size: 12px;
  color: #2f6f3f;
  white-space: nowrap;
}

.evr-scroll {
  overflow: auto;
  max-height: calc(100vh - 250px);
  background: #ffffff;
  border: 1px solid #c9d3dd;
  border-radius: 2px;
  padding: 0 0 6px;
}

.evr-scroll:focus {
  outline: 2px solid #1f7a3d;
  outline-offset: -2px;
}

/* ---------------------------------------------------------------- 격자 */

.evr-grid {
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
  color: #000000;
  font-family: "함초롬바탕", "HCR Batang", "HY중고딕", Batang, "바탕", "Noto Serif KR", serif;
  font-size: 14.7px; /* 11pt */
  line-height: 1.15;
}

.evr-grid td {
  border: 1px solid #000000;
  text-align: center;
  vertical-align: middle;
  height: 20px;
  padding: 0 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 제목: A1 병합, HY견고딕 22pt 굵게 + 아래 medium */
.evr-title-row td {
  height: 44px;
  border: 0;
  border-bottom: 2px solid #000000;
  font-family: "HY견고딕", "HYGothic", "맑은 고딕", "Malgun Gothic", sans-serif;
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* 머리글·부서 라벨·계산 셀 */
.evr-hd {
  background: #ddebf7;
  font-weight: 700;
}

.evr-grid td.evr-calc {
  background: #ddebf7;
  font-weight: 400;
}

.evr-grid td.evr-tribe {
  background: #ffffcc;
}

.evr-grid tr.evr-collabel-row td {
  height: 45px;
  white-space: normal;
  line-height: 1.12;
  font-size: 13.3px;
}

/* 부서 라벨 셀(왼쪽 라벨열)은 엑셀에서 굵지 않다 */
.evr-grid tbody tr:not(.evr-collabel-row):not(.evr-total-row) td.evr-hd {
  font-weight: 400;
}

.evr-church {
  background: #ffffff;
  font-weight: 400;
}

.evr-grid td.evr-input {
  background: #ffffff;
}

/* 교회 합계·지파 합계의 SUM 칸은 엑셀에서 채움이 없다(흰색이지만 계산값) */
.evr-grid td.evr-sum {
  background: #ffffff;
}

.evr-total-row td {
  height: 21px;
  font-weight: 700;
  background: #ddebf7;
}

.evr-total-row td.evr-tribe {
  background: #ffffcc;
}

/* 블록 외곽 medium — JS(withOutlines)가 가장자리 셀에 evr-b* 를 준다 */
.evr-grid td.evr-bt { border-top: 2px solid #000000; }
.evr-grid td.evr-bb { border-bottom: 2px solid #000000; }
.evr-grid td.evr-bl { border-left: 2px solid #000000; }
.evr-grid td.evr-br { border-right: 2px solid #000000; }

.evr-cohort-name,
.evr-cohort-date {
  background: #ffffff;
  position: relative;
  padding: 0 18px 0 4px;
}

.evr-meta-input {
  width: 100%;
  height: 20px;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: center;
  padding: 0;
}

.evr-meta-input:focus {
  outline: 2px solid #1f7a3d;
  outline-offset: -2px;
  background: #f4fbf6;
}

.evr-meta-text {
  display: block;
  text-align: center;
}

.evr-cohort-remove {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  line-height: 13px;
  border: 1px solid #c9b0b0;
  border-radius: 2px;
  background: #fff;
  color: #a33;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

.evr-cohort-remove:hover {
  background: #fdeaea;
}

.evr-spacer,
.evr-blank {
  border: 0 !important;
  background: transparent;
}

.evr-addslot {
  border: 1px dashed #9fb6cc;
  background: #f7fbff;
  vertical-align: middle;
}

.evr-add-cohort {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid #9fb6cc;
  border-radius: 4px;
  background: #ffffff;
  color: #1f4e79;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
}

.evr-add-cohort span[aria-hidden="true"] {
  font-size: 20px;
  line-height: 1;
}

.evr-add-cohort:hover {
  background: #eaf3fb;
}

/* ---------------------------------------------------------------- 선택·편집 */

.evr-grid td.evr-editable {
  cursor: cell;
}

.evr-grid td.is-selected {
  outline: 2px solid #1f7a3d;
  outline-offset: -2px;
}

.evr-grid td.is-editing {
  outline: 2px solid #1f7a3d;
  outline-offset: -2px;
  padding: 0;
}

.evr-cell-input {
  width: 100%;
  height: 100%;
  min-height: 18px;
  border: 0;
  background: #ffffff;
  font: inherit;
  color: inherit;
  text-align: center;
  padding: 0;
}

.evr-cell-input:focus {
  outline: none;
}

/* ---------------------------------------------------------------- 시트 탭 */

.evr-sheet-tabs {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  margin-top: -1px;
  padding: 0 4px;
  border-top: 1px solid #c9d3dd;
  background: #eef1f4;
  overflow-x: auto;
}

.evr-sheet-tab {
  border: 1px solid #c9d3dd;
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: #e2e8ee;
  color: #33404d;
  font-size: 12.5px;
  font-family: inherit;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.evr-sheet-tab:hover {
  background: #eef4fa;
}

.evr-sheet-tab.is-active {
  background: #ffffff;
  color: #14803a;
  font-weight: 700;
  border-bottom-color: #ffffff;
  box-shadow: inset 0 -2px 0 #14803a;
}

.evr-footnote {
  margin: 8px 0 0;
}

@media (max-width: 720px) {
  .evr-scroll { max-height: calc(100vh - 300px); }
  .evr-title-row td { font-size: 22px; height: 36px; }
}

/* ---------------------------------------------------------------- 저장 버튼·미저장 표시 */

.evr-save-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.evr-saving.is-dirty {
  color: #b45309;
  font-weight: 600;
}

.evr-save {
  min-width: 88px;
}

.evr-grid td.evr-dirty {
  box-shadow: inset 0 0 0 9999px rgba(255, 213, 79, 0.28);
  position: relative;
}

.evr-grid td.evr-dirty::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  border-top: 7px solid #e67e22;
  border-right: 7px solid transparent;
}

/* 기수 추가: 좁은 한 열 전체가 버튼 */
.evr-grid td.evr-addslot {
  padding: 3px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #c9d6e3;
  background: #f4f8fc;
}

.evr-grid .evr-add-cohort {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-height: 150px;
  padding: 8px 0;
  border: 1px dashed #6f9cc6;
  border-radius: 4px;
  background: #ffffff;
  color: #1f4e79;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.evr-grid .evr-add-cohort:hover {
  background: #e3effa;
  border-style: solid;
}

.evr-grid .evr-add-plus {
  font-size: 18px;
  line-height: 1;
}

.evr-grid .evr-add-label {
  writing-mode: vertical-rl;
  letter-spacing: 2px;
}

/* 마지막 기수 바로 옆(빈 기수 자리 첫 칸)에 붙는 버튼 — 끝 열과 같은 폭으로 왼쪽에 붙인다 */
.evr-grid td.evr-addslot-inline {
  text-align: left;
  border: 0;
  background: #ffffff;
}

.evr-grid td.evr-addslot-inline .evr-add-cohort {
  width: 32px;
}

.evr-grid td.evr-addgap {
  border: 0;
  background: #ffffff;
}

/* ---------------------------------------------------------------- 종합 시트 */

.evr-dday {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin: 4px 0 14px;
}

.evr-dday-box {
  min-width: 170px;
  padding: 10px 14px;
  border: 2px solid #3c3c3c;
  background: #ffffff;
  text-align: center;
  font-family: "함초롬바탕", "HCR Batang", Batang, "바탕", "Noto Serif KR", serif;
}

.evr-dday-box:nth-child(2) { background: #fde9e7; }
.evr-dday-box:nth-child(3) { background: #fff4d6; }
.evr-dday-box:nth-child(4) { background: #ddebf7; }

.evr-dday-label {
  font-size: 14px;
  font-weight: 700;
}

.evr-dday-count {
  margin: 4px 0;
  font-family: "HY견고딕", "HYGothic", "맑은 고딕", "Malgun Gothic", sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #c00000;
}

.evr-dday-count.is-empty {
  color: #8b8b8b;
}

.evr-dday-sub {
  font-size: 13px;
  color: #333333;
}

.evr-dday-input {
  font-size: 13px !important;
  height: 28px !important;
  border: 1px solid #8b8b8b;
  background: #ffffff;
}

.evr-dday-box .evr-dirty,
.evr-dday-input.evr-dirty {
  background: #fff1c2;
  outline: 2px solid #e67e22;
}

.evr-dday-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
  color: #5b6672;
}

.evr-summary-grids {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.evr-grid-summary .evr-collabel-row td {
  height: 45px;
}

.evr-dday-church {
  align-self: center;
  padding: 0 6px;
  font-family: "HY견고딕", "HYGothic", "맑은 고딕", "Malgun Gothic", sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.evr-grid td.evr-date-cell {
  padding: 0 2px;
}

.evr-grid .evr-dday-input-cell {
  width: 100%;
  height: 20px !important;
  border: 0;
  background: transparent;
  font-size: 13px !important;
  font-family: inherit;
  text-align: center;
}

.evr-grid td.evr-dday-cell {
  color: #c00000;
  font-weight: 700;
}

.evr-grid td.evr-dday-cell.is-empty {
  color: #8b8b8b;
  font-weight: 400;
}
