/* 총무의 정석 - 회계 ERP 웹모드 & 모바일 앱모드 통합 스타일시트 */
:root {
  --erp-header: #0F172A;
  --erp-bg: #F1F5F9;
  --erp-surface: #FFFFFF;
  --erp-surface-subtle: #F8FAFC;
  --erp-border: #E2E8F0;
  --erp-border-light: #EDF2F7;
  --erp-text: #1E293B;
  --erp-muted: #64748B;
  --erp-primary: #2563EB;
  --erp-primary-hover: #1D4ED8;
  --erp-pos: #15803D;
  --erp-pos-bg: #F0FDF4;
  --erp-pos-border: #BBF7D0;
  --erp-neg: #BE123C;
  --erp-neg-bg: #FFF1F2;
  --erp-neg-border: #FECDD3;
  --erp-warn: #D97706;
  --erp-warn-bg: #FFFBEB;
  --erp-warn-border: #FDE68A;
}

html.dark, body.dark {
  --erp-header: #070B12;
  --erp-bg: #0B0F17;
  --erp-surface: #141B29;
  --erp-surface-subtle: #0E131D;
  --erp-border: #1E293B;
  --erp-border-light: #162032;
  --erp-text: #F1F5F9;
  --erp-muted: #94A3B8;
  --erp-primary: #3B82F6;
  --erp-primary-hover: #2563EB;
  --erp-pos: #4ADE80;
  --erp-pos-bg: rgba(21, 128, 61, 0.2);
  --erp-pos-border: rgba(74, 222, 128, 0.3);
  --erp-neg: #FB7185;
  --erp-neg-bg: rgba(190, 18, 60, 0.2);
  --erp-neg-border: rgba(251, 113, 133, 0.3);
  --erp-warn: #FBBF24;
  --erp-warn-bg: rgba(217, 119, 6, 0.2);
  --erp-warn-border: rgba(251, 191, 36, 0.3);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--erp-bg);
  color: var(--erp-text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  letter-spacing: -0.015em;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tabular-nums { font-variant-numeric: tabular-nums; }

/* 스크롤바 미세화 */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--erp-bg); }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
html.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* 공통 배지 & 버튼 */
.erp-badge {
  background: var(--erp-primary);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-icon-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
}

/* ========================================================= */
/* [1] 공통 상단 헤더 */
/* ========================================================= */
.erp-topbar {
  min-height: 46px;
  background-color: var(--erp-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  z-index: 50;
}

.erp-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.erp-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.erp-select {
  background: #1E293B;
  color: #E2E8F0;
  border: 1px solid #334155;
  border-radius: 4px;
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
}

.erp-sync-pill {
  font-size: 10px;
  color: #34D399;
  background: rgba(6, 78, 59, 0.7);
  border: 1px solid rgba(5, 150, 105, 0.5);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.erp-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34D399;
  flex-shrink: 0;
}

.topbar-btn {
  height: 28px;
  padding: 0 10px;
  background: #1E293B;
  border: 1px solid #334155;
  color: #E2E8F0;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.topbar-btn:hover { background: #334155; }
.topbar-btn-primary { background: #2563EB; border-color: #2563EB; color: #FFFFFF; font-weight: 600; }
.topbar-btn-primary:hover { background: #1D4ED8; }

/* ========================================================= */
/* [2] 지능형 단일 통합 레이아웃 */
/* ========================================================= */
.erp-app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 좌측 스텝 사이드바 */
.erp-sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--erp-surface);
  border-right: 1px solid var(--erp-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* 지능형 반응형: 화면이 860px 미만일 때 사이드바가 상단 가로 탭 바로 유기적 자동 전환 */
@media (max-width: 859px) {
  #app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .erp-app-layout {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .erp-sidebar {
    width: 100%;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--erp-border);
    position: static;
    z-index: 40;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow-y: visible;
  }

  .sidebar-step-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    padding: 6px 8px !important;
    gap: 4px !important;
  }

  .sidebar-title {
    display: none !important;
  }

  .sidebar-step-item {
    flex: 1 1 calc(20% - 4px) !important;
    min-width: 60px !important;
    padding: 6px 4px !important;
    font-size: 11px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 2px !important;
    border-radius: 6px !important;
  }

  .sidebar-step-item div {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
  }

  .sidebar-step-item .step-no {
    margin-right: 0 !important;
  }

  .sidebar-step-item .step-badge {
    font-size: 9px !important;
    padding: 1px 4px !important;
    line-height: 1.1 !important;
  }

  .sidebar-widget {
    display: none !important;
  }

  .erp-main-workspace {
    flex: 1 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 10px !important;
  }
}

.sidebar-step-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-title {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--erp-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--erp-text);
  font-size: 12px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sidebar-step-item:hover {
  background: var(--erp-surface-subtle);
}

.sidebar-step-item.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--erp-primary);
  font-weight: 700;
}

.step-no {
  font-weight: 700;
  color: var(--erp-muted);
  margin-right: 6px;
  white-space: nowrap;
}

.sidebar-step-item.active .step-no {
  color: var(--erp-primary);
}

.step-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--erp-surface-subtle);
  border: 1px solid var(--erp-border);
  color: var(--erp-muted);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-step-item.active .step-badge {
  background: var(--erp-primary);
  color: #FFFFFF;
  border-color: var(--erp-primary);
}

/* 사이드바 수금 위젯 */
.sidebar-widget {
  margin: 8px;
  padding: 10px;
  background: var(--erp-surface-subtle);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  border-bottom: 1px solid var(--erp-border);
  padding-bottom: 6px;
}

.widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.progress-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--erp-border);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--erp-pos);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* 중앙 메인 워크스페이스 */
.erp-main-workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto !important;
  overflow-x: hidden;
  background: var(--erp-bg);
  padding: 14px;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* 상단 슬림 액션 리본 */
.erp-action-ribbon {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.ribbon-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ribbon-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ribbon-title-bar {
  width: 4px;
  height: 14px;
  background: var(--erp-primary);
  border-radius: 2px;
  display: inline-block;
}

.ribbon-tip {
  font-size: 11px;
  color: var(--erp-muted);
  border-left: 1px solid var(--erp-border);
  padding-left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ribbon-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* KPI 메트릭 카드 */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

.kpi-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-title {
  font-size: 11px;
  color: var(--erp-muted);
  font-weight: 600;
}

.kpi-number {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 2px;
}

/* 차수별 분담 기준 전표 (가로 스트립) */
.round-strip-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  padding: 10px 12px;
  flex-shrink: 0;
}

.round-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--erp-border-light);
}

.round-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.round-mini-box {
  background: var(--erp-surface-subtle);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.round-mini-box.sponsor-box {
  background: var(--erp-warn-bg);
  border-color: var(--erp-warn-border);
}

/* 고밀도 데이터 그리드 테이블 */
.erp-datagrid-section {
  flex: 1;
  min-height: 0;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.datagrid-toolbar {
  padding: 6px 12px;
  background: var(--erp-surface-subtle);
  border-bottom: 1px solid var(--erp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.filter-group {
  display: inline-flex;
  background: var(--erp-border);
  padding: 2px;
  border-radius: 4px;
}

.filter-btn {
  border: none;
  background: transparent;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  color: var(--erp-muted);
}

.filter-btn.active {
  background: var(--erp-surface);
  color: var(--erp-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-btn.btn-unpaid.active { color: var(--erp-neg); font-weight: 700; }
.filter-btn.btn-paid.active { color: var(--erp-pos); font-weight: 700; }

.datagrid-scroll-area {
  flex: 1;
  overflow-y: auto;
}

.erp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11px;
}

.erp-table th {
  position: sticky;
  top: 0;
  background: var(--erp-surface-subtle);
  border-bottom: 1px solid var(--erp-border);
  padding: 8px 12px;
  font-weight: 600;
  color: var(--erp-muted);
  border-right: 1px solid var(--erp-border);
  z-index: 5;
}

.erp-table th:last-child { border-right: none; }

.erp-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--erp-border-light);
  border-right: 1px solid var(--erp-border-light);
}

.erp-table td:last-child { border-right: none; }

.erp-table tr:hover {
  background-color: var(--erp-surface-subtle);
}

/* 칩 태그 */
.breakdown-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-right: 4px;
  border: 1px solid transparent;
}

.chip-blue {
  background: rgba(37, 99, 235, 0.08);
  color: var(--erp-primary);
  border-color: rgba(37, 99, 235, 0.2);
}

.chip-gold {
  background: var(--erp-warn-bg);
  color: var(--erp-warn);
  border-color: var(--erp-warn-border);
}

.chip-gray {
  background: var(--erp-surface-subtle);
  color: var(--erp-muted);
  border-color: var(--erp-border);
}

.chip-status {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid transparent;
}

.chip-status.unpaid {
  background: var(--erp-neg-bg);
  color: var(--erp-neg);
  border-color: var(--erp-neg-border);
}

.chip-status.paid {
  background: var(--erp-pos-bg);
  color: var(--erp-pos);
  border-color: var(--erp-pos-border);
}

/* 하단 트랜잭션 바 */
.erp-bottom-bar {
  height: 40px;
  flex-shrink: 0;
  background: var(--erp-surface);
  border-top: 1px solid var(--erp-border);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

/* ========================================================= */
/* [3] 모바일 앱 모드 레이아웃 */
/* ========================================================= */
.erp-mobile-layout {
  width: 100%;
  max-width: 448px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--erp-surface-subtle);
  border-left: 1px solid var(--erp-border);
  border-right: 1px solid var(--erp-border);
  padding-bottom: 56px;
}

.mobile-content {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.mobile-card-header {
  padding: 6px 10px;
  background: var(--erp-surface-subtle);
  border-bottom: 1px solid var(--erp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 0;
  text-align: center;
}

.mobile-kpi-col {
  padding: 2px 4px;
  border-right: 1px solid var(--erp-border-light);
}

.mobile-kpi-col:last-child { border-right: none; }

.mobile-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mobile-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  color: var(--erp-text);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mobile-action-btn:hover {
  background: var(--erp-surface-subtle);
}

.mobile-sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 448px;
  margin: 0 auto;
  background: #0F172A;
  color: #FFFFFF;
  border-top: 1px solid #1E293B;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}

/* 모바일 멤버 로우 */
.mobile-member-row {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--erp-border-light);
  font-size: 11px;
}

.mobile-member-row:last-child { border-bottom: none; }

/* 단계 폼 컨테이너 (모임정보, 참여자, 차수등록 등) */
.step-form-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.receipt-file-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--erp-text);
}

.form-input, .form-select {
  height: 34px;
  padding: 4px 10px;
  background: var(--erp-surface-subtle);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--erp-text);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--erp-primary);
  background: var(--erp-surface);
}

/* 토스트 */
.toast-container {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  background: #0F172A;
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  text-align: center;
  pointer-events: auto;
  border: 1px solid #334155;
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================= */
/* [4] Step 2 참석자 칩 스타일 */
/* ========================================================= */
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--erp-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.member-chip:hover {
  border-color: var(--erp-primary);
  background: var(--erp-surface-subtle);
}

.member-chip-text {
  white-space: nowrap;
  line-height: 1.2;
}

.btn-chip-del {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--erp-muted);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-chip-del:hover {
  background: #FEE2E2;
  color: #DC2626;
}

/* ========================================================= */
/* [5] Step 3 차수 카드 & 실시간 분담금 & 영수증 */
/* ========================================================= */
.round-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  flex-shrink: 0;
}

.round-card:hover {
  border-color: #CBD5E1;
}

.round-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--erp-surface-subtle);
  border-bottom: 1px solid var(--erp-border);
  flex-wrap: wrap;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.round-badge-pill {
  font-size: 11px;
  font-weight: 700;
  background: var(--erp-primary);
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.round-calc-live-banner {
  padding: 7px 12px;
  background: #EFF6FF;
  border-bottom: 1px solid #DBEAFE;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #1E40AF;
  flex-wrap: wrap;
  gap: 6px;
}

html.dark .round-calc-live-banner {
  background: rgba(30, 58, 138, 0.25);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93C5FD;
}

.round-calc-live-banner.zero {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}

html.dark .round-calc-live-banner.zero {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(251, 191, 36, 0.3);
  color: #FCD34D;
}

/* 영수증 다중 첨부 구역 */
.round-receipts-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--erp-border-light);
  background: var(--erp-surface);
}

.receipts-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.receipt-add-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--erp-primary);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.receipt-add-label:hover {
  background: rgba(37, 99, 235, 0.16);
}

.receipt-empty-dropzone {
  padding: 12px;
  border: 1.5px dashed var(--erp-border);
  border-radius: 6px;
  text-align: center;
  font-size: 11px;
  color: var(--erp-muted);
  background: var(--erp-surface-subtle);
  line-height: 1.5;
}

.round-receipts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.receipt-item-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--erp-surface-subtle);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  margin-top: 0;
  box-sizing: border-box;
}

.receipt-item-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--erp-border);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.receipt-item-thumb:hover {
  transform: scale(1.05);
}

.receipt-item-details {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.receipt-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-remove-single-receipt {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--erp-border);
  background: var(--erp-surface);
  color: var(--erp-neg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.btn-remove-single-receipt:hover {
  background: var(--erp-neg-bg);
  border-color: var(--erp-neg-border);
}

/* 영수증 라이트박스 모달 */
.receipt-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.receipt-lightbox-content {
  background: var(--erp-surface);
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--erp-border);
}

.receipt-lightbox-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--erp-border);
  background: var(--erp-surface-subtle);
  font-size: 12px;
  font-weight: 700;
}

.receipt-lightbox-body {
  padding: 10px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-lightbox-body img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 4px;
}

/* ========================================================= */
/* [6] Step 4 개인별 특별 설정 ERP 원장 & Step 3 토글 칩 */
/* ========================================================= */
.s4-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

.s4-kpi-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exempt-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--erp-border);
  background: var(--erp-surface-subtle);
  color: var(--erp-muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.exempt-toggle-btn:hover {
  border-color: var(--erp-warn);
  color: var(--erp-warn);
}

.exempt-toggle-btn.active {
  background: var(--erp-warn-bg);
  border-color: var(--erp-warn-border);
  color: var(--erp-warn);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.12);
}

/* Step 3 차수별 참석자 토글 칩 */
.attendee-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  border: 1px solid var(--erp-border);
  background: var(--erp-surface-subtle);
  color: var(--erp-muted);
  white-space: nowrap;
}

.attendee-pill:hover {
  border-color: var(--erp-primary);
  color: var(--erp-primary);
}

.attendee-pill.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--erp-primary);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}

.attendee-pill.exempt-active {
  background: var(--erp-warn-bg);
  border-color: var(--erp-warn-border);
  color: var(--erp-warn);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.1);
}

/* Step 3 찬조 설정 카드 */
.sponsor-config-card {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--erp-surface-subtle);
  border: 1px solid var(--erp-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s ease;
}

.sponsor-config-card.active {
  background: rgba(254, 243, 199, 0.4);
  border-color: var(--erp-warn-border);
}

/* ========================================================= */
/* [7] 전표 저장 히스토리 관리 모달 */
/* ========================================================= */
.hist-modal-content {
  width: 95%;
  max-width: 620px;
  max-height: 85vh;
  background: var(--erp-surface);
  border-radius: 10px;
  border: 1px solid var(--erp-border);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hist-top-banner {
  padding: 10px 14px;
  background: var(--erp-surface-subtle);
  border-bottom: 1px solid var(--erp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.hist-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hist-item-card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s ease;
}

.hist-item-card:hover {
  border-color: var(--erp-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.hist-item-card.is-current {
  border-color: var(--erp-pos);
  background: rgba(16, 185, 129, 0.03);
}

.hist-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--erp-text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hist-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.hist-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--erp-surface-subtle);
  border: 1px solid var(--erp-border);
  color: var(--erp-muted);
}

/* ========================================================= */
/* [8] 공통 단계별 KPI 메트릭 행 (Step 1 ~ 3 일관된 대시보드 룩) */
/* ========================================================= */
.s1-kpi-row, .s2-kpi-row, .s3-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

/* 다중 찬조자 관리 */
.multi-sponsor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.multi-sponsor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  padding: 4px 8px;
  border-radius: 6px;
  flex-wrap: wrap;
}

.s3-sponsor-total-banner {
  padding: 6px 10px;
  background: var(--erp-warn-bg);
  border: 1px solid var(--erp-warn-border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--erp-warn);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ========================================================= */
/* [9] 정산 보고서 및 영수증 증빙 모달 & 1~4열 갤러리 그리드 */
/* ========================================================= */
.report-modal-content {
  width: 95%;
  max-width: 960px;
  max-height: 92vh;
  background: var(--erp-surface);
  border-radius: 10px;
  border: 1px solid var(--erp-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.report-top-controls {
  padding: 10px 16px;
  background: var(--erp-surface-subtle);
  border-bottom: 1px solid var(--erp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.report-size-btn-group {
  display: inline-flex;
  background: var(--erp-border);
  padding: 2px;
  border-radius: 4px;
}

.btn-receipt-size {
  border: none;
  background: transparent;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  color: var(--erp-muted);
  transition: all 0.15s ease;
}

.btn-receipt-size.active {
  background: var(--erp-surface);
  color: var(--erp-primary);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.report-scroll-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #475569;
}

.printable-report-area {
  background: #FFFFFF;
  color: #0F172A;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 32px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-sizing: border-box;
}

.report-doc-header {
  border-bottom: 2px solid var(--erp-primary);
  padding-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.report-doc-title-box h2 {
  font-size: 18px;
  font-weight: 800;
  color: #0F172A;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
}

.report-doc-meta {
  font-size: 11px;
  color: #64748B;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.report-quote-box {
  background: #F8FAFC;
  border-left: 4px solid var(--erp-primary);
  padding: 8px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.report-kpi-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px 14px;
}

.report-kpi-label {
  font-size: 11px;
  color: #64748B;
  font-weight: 600;
  margin-bottom: 4px;
}

.report-kpi-value {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.report-rounds-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.report-round-item {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 영수증 증빙 1~4열 반응형 그리드 */
.report-receipts-standalone-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-receipts-cards-grid {
  display: grid;
  gap: 12px;
  transition: all 0.2s ease;
}

.report-receipts-cards-grid.mode-1 {
  grid-template-columns: 1fr;
  max-width: 680px;
  margin: 0 auto;
}

.report-receipts-cards-grid.mode-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-receipts-cards-grid.mode-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-receipts-cards-grid.mode-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 800px) {
  .report-receipts-cards-grid.mode-4,
  .report-receipts-cards-grid.mode-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.report-receipt-card {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.report-receipt-card-header {
  padding: 6px 10px;
  background: #F1F5F9;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.report-receipt-card-body {
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0F172A;
  min-height: 140px;
}

.report-receipt-full-img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  cursor: pointer;
  border-radius: 4px;
}

.report-receipt-card-footer {
  padding: 6px 10px;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  font-size: 10px;
  color: #475569;
}

.report-account-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.report-doc-footer {
  text-align: center;
  font-size: 10px;
  color: #94A3B8;
  border-top: 1px dashed #CBD5E1;
  padding-top: 10px;
}

@media print {
  body * {
    visibility: hidden;
  }
  .printable-report-area, .printable-report-area * {
    visibility: visible;
  }
  .printable-report-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    padding: 0;
    box-shadow: none;
    border: none;
  }
  .no-print {
    display: none !important;
  }
}
