/* 준시스템 ERP - 얼마예요형 레이아웃 */

:root {
  --erp-blue: #0066cc;
  --erp-blue-dark: #004c99;
  --erp-blue-light: #dce6f1;
  --erp-header-bg: #1e4d7b;
  --erp-module-bg: #e8eef5;
  --erp-sidebar-bg: #f2f2f2;
  --erp-sidebar-group-bg: #dce6f1;
  --erp-sidebar-group-bg-hover: #cfd9e8;
  --erp-sidebar-submenu-bg: #f8f9fb;
  --erp-border: #b8c4d0;
  --erp-border-light: #d9dee5;
  --erp-text: #222;
  --erp-text-muted: #666;
  --erp-toolbar-bg: #f5f7fa;
  --erp-table-head: #e4ecf5;
  --erp-row-odd: #fff;
  --erp-row-even: #f8f9fb;
  --erp-row-hover: #eef5fc;
  --erp-active-bg: #0066cc;
  --erp-font-size: 12px;
  --erp-sidebar-width: 210px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--erp-font-size);
  height: 100%;
}

body.erp-body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: var(--erp-font-size);
  color: var(--erp-text);
  background: #d8dde4;
}

/* ── 상단 헤더 ── */
.erp-header {
  flex-shrink: 0;
}

/* ── 단일 헤더 바 ── */
.erp-header-bar {
  display: flex;
  align-items: stretch;
  height: 46px;
  padding: 0 8px 0 0;
  background: linear-gradient(180deg, #255a8a 0%, var(--erp-header-bg) 100%);
  color: #fff;
  border-bottom: 1px solid #153a5e;
  overflow: hidden;
}

/* 레거시 클래스 — 제거됨 */
.erp-brand-bar { display: none; }
.erp-brand-left,
.erp-brand-right { display: none; }

.erp-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #ff9900;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.erp-logo-text {
  font-size: 14px;
  letter-spacing: -0.5px;
}

.erp-select {
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
  border: 1px solid #8aa8c4;
  border-radius: 2px;
  background: #fff;
  color: #333;
}

.erp-user-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.erp-util-link {
  color: #dce8f5;
  text-decoration: none;
  font-size: 11px;
  padding: 2px 6px;
  white-space: nowrap;
}

.erp-util-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.erp-logout {
  color: #ffd4a8;
}

/* ── 헤더 로고 ── */
.erp-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 0 12px;
  border-right: 1px solid rgba(255,255,255,0.18);
  flex-shrink: 0;
}

.erp-logo:hover {
  color: #fff;
  opacity: 0.9;
}

/* ── 헤더 우측 유틸 영역 ── */
.erp-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.18);
  margin-left: auto;
}

/* ── 모듈 메뉴 — 헤더 안에 수평 배치 ── */
.erp-module-nav {
  display: flex;
  align-items: stretch;
  flex: 1;
  overflow-x: auto;
  background: transparent;
  border: none;
  /* 스크롤바 숨김 */
  scrollbar-width: none;
}
.erp-module-nav::-webkit-scrollbar { display: none; }

.erp-module-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  padding: 0 13px;
  text-decoration: none;
  color: rgba(255,255,255,0.88);
  border-right: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

.erp-module-item i {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
}

.erp-module-item span {
  font-size: 12px;
  white-space: nowrap;
}

.erp-module-item:hover:not(.disabled) {
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.erp-module-item:hover:not(.disabled) i {
  color: #fff;
}

.erp-module-item.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border-bottom: 3px solid #ff9900;
}

.erp-module-item.active i {
  color: #ffcc66;
}

.erp-module-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── 셸 (사이드바 + 본문) ── */
.erp-shell {
  display: flex;
  height: calc(100vh - 46px);
  overflow: hidden;
}

/* ── 좌측 사이드바 ── */
.erp-sidebar {
  width: var(--erp-sidebar-width, 210px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--erp-header-bg);  /* 헤더와 동일한 진한 파란색 */
  border-right: 1px solid #153a5e;
  position: relative;
}

.erp-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
  background: var(--erp-header-bg);
}

.erp-sidebar-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
  background: transparent;
}

.erp-sidebar-resizer:hover {
  background: rgba(0, 102, 204, 0.25);
}

.erp-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.erp-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.erp-tree-group {
  margin-bottom: 2px;
}

.erp-tree-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: var(--erp-menu-spacing-y, 6px) 10px;
  border: none;
  /* 헤더와 동일한 그라디언트 배경 */
  background: linear-gradient(180deg, #255a8a 0%, var(--erp-header-bg) 100%);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.erp-tree-toggle:hover {
  background: linear-gradient(180deg, #2e6ba0 0%, #255a8a 100%);
  color: #fff;
}

.erp-tree-group.open > .erp-tree-toggle {
  background: linear-gradient(180deg, #1e5080 0%, #194470 100%);
  color: #fff;
  border-bottom-color: rgba(255,255,255,0.12);
}

.erp-tree-group.has-active > .erp-tree-toggle {
  background: linear-gradient(180deg, #1e5080 0%, #194470 100%);
  color: #fff;
  border-left: 3px solid #ff9900;
  font-weight: 700;
}

/* 모듈 아이콘 (헤더와 동일) */
.erp-tree-toggle .erp-tree-module-icon {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  width: 16px;
  flex-shrink: 0;
}

.erp-tree-toggle:hover .erp-tree-module-icon,
.erp-tree-group.open > .erp-tree-toggle .erp-tree-module-icon,
.erp-tree-group.has-active > .erp-tree-toggle .erp-tree-module-icon {
  color: #ffcc66;
}

/* 우측 chevron */
.erp-tree-toggle .erp-tree-chevron {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.erp-tree-items {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #0f2d46;  /* 대메뉴보다 약간 더 어둡게 */
}

.erp-tree-items .erp-tree-group .erp-tree-toggle {
  padding-left: 20px;
  font-size: 11px;
  font-weight: 600;
}

.erp-tree-items .erp-tree-group .erp-tree-link {
  padding-left: 36px;
}

.erp-tree-link {
  display: block;
  padding: var(--erp-menu-spacing-y, 5px) 8px var(--erp-menu-spacing-y, 5px) 28px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 12px;
  border-left: 3px solid transparent;
  background: transparent;
}

.erp-tree-link:hover:not(.disabled):not(.active) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.erp-tree-link.active {
  background: rgba(255, 153, 0, 0.22);
  color: #fff;
  border-left-color: #ff9900;
  font-weight: 600;
}

.erp-tree-link.active:hover {
  background: rgba(255, 153, 0, 0.3);
  color: #fff;
}

.erp-tree-link.disabled {
  color: rgba(255, 255, 255, 0.35);
  cursor: not-allowed;
}

/* 사이드바 2단계 하위 메뉴 (예: 그룹웨어 > 메일) */
.erp-tree-subgroup {
  margin: 0;
}

.erp-tree-subtoggle {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: var(--erp-menu-spacing-y, 5px) 8px var(--erp-menu-spacing-y, 5px) 24px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  text-align: left;
  cursor: pointer;
}

.erp-tree-subtoggle:hover {
  background: #e8eef5;
  color: var(--erp-blue);
}

.erp-tree-subgroup.open > .erp-tree-subtoggle,
.erp-tree-subgroup.has-active > .erp-tree-subtoggle {
  color: var(--erp-blue-dark);
}

.erp-tree-subtoggle i {
  font-size: 10px;
  width: 12px;
  color: #5a6b7d;
}

.erp-tree-subitems {
  list-style: none;
  margin: 0;
  padding: 0;
}

.erp-tree-subitems .erp-tree-link {
  padding-left: 40px;
}

.erp-quick-menu {
  border-top: 1px solid var(--erp-border);
  padding: 6px;
  background: #eaeaea;
}

.erp-quick-title {
  font-size: 10px;
  font-weight: 700;
  color: #555;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.erp-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.erp-quick-grid a,
.erp-quick-grid span {
  display: block;
  padding: 3px 4px;
  font-size: 11px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--erp-border-light);
  color: #333;
  text-decoration: none;
}

.erp-quick-grid a:hover {
  background: var(--erp-blue-light);
  color: var(--erp-blue);
}

.erp-quick-grid span.disabled {
  color: #aaa;
  background: #f8f8f8;
}

/* ── 메인 영역 ── */
.erp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
}

.erp-tab-bar {
  display: flex;
  align-items: flex-end;
  height: 30px;
  background: #d5dbe3;
  border-bottom: 1px solid var(--erp-border);
  padding-left: 4px;
  padding-right: 4px;
  overflow: hidden;
  gap: 2px;
}

.erp-tab-list {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  overflow: hidden;  /* 스크롤 없이 탭 영역 내에서만 표시 */
}

.erp-tab-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
  padding-bottom: 2px;
}

.erp-tab-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--erp-border);
  border-radius: 2px;
  background: #eef2f7;
  color: #555;
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.erp-tab-action-btn:hover {
  background: #fff;
  color: var(--erp-blue);
}

.erp-tab-action-label {
  line-height: 1;
}

.erp-tab {
  display: flex;
  align-items: center;
  height: 26px;
  padding: 0 7px 0 10px;
  margin-right: 2px;
  background: #c8d0da;
  border: 1px solid var(--erp-border);
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  font-size: 12px;
  color: #444;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  /* 기본은 내용 크기 그대로, 많아지면 균등 축소 (최소 50px) */
  flex: 0 1 auto;
  min-width: 50px;
  max-width: 160px;
}

.erp-tab-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 5px;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #666;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.erp-tab-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #c0392b;
}

.erp-tab.active {
  background: #fff;
  color: var(--erp-blue);
  font-weight: 600;
  border-bottom: 1px solid #fff;
  margin-bottom: -1px;
  z-index: 1;
}

.erp-tab-panels {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.erp-tab-panels:empty {
  flex: 0 0 auto;
  display: none;
}

.erp-tab-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.erp-tab-panel[hidden] {
  display: none !important;
}

.erp-tab-iframe {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.erp-embed-body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
}

.erp-embed-workspace {
  height: 100%;
}

.erp-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
}

.erp-workspace > .erp-tab-panel,
.erp-workspace > #erpInitialPanel {
  flex: 1 1 auto;
  min-height: 0;
}

.erp-workspace > .erp-filter-bar,
.erp-workspace > form.erp-filter-bar,
.erp-workspace > .erp-toolbar,
.erp-workspace > .erp-alert,
.erp-tab-panel > .erp-filter-bar,
.erp-tab-panel > form.erp-filter-bar,
.erp-tab-panel > .erp-toolbar,
.erp-tab-panel > .erp-alert {
  flex-shrink: 0;
}

/* 목록 영역: 화면 폭에 맞추고 그리드 내부에서 가로·세로 스크롤 */
.erp-workspace > .erp-grid-wrap,
.erp-workspace > .erp-split-view,
.erp-workspace > form:has(.erp-grid-wrap),
.erp-workspace > .erp-list-host,
.erp-tab-panel > .erp-grid-wrap,
.erp-tab-panel > .erp-split-view,
.erp-tab-panel > form:has(.erp-grid-wrap),
.erp-tab-panel > .erp-list-host {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.erp-workspace > form:has(.erp-grid-wrap),
.erp-workspace > .erp-list-host,
.erp-tab-panel > form:has(.erp-grid-wrap),
.erp-tab-panel > .erp-list-host {
  display: flex;
  flex-direction: column;
}

/* ── 목록 화면 공통: 남은 높이 전체 사용 + 페이저·네비게이션 하단 고정 ── */
.erp-workspace > .erp-mail-inbox,
.erp-tab-panel > .erp-mail-inbox {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

/* 기존 최상위 툴바 — 레거시 참조 유지 (실제 DOM 사용 안 함) */
.erp-mail-inbox > .erp-mail-toolbar,
.erp-mail-inbox > .erp-toolbar {
  flex-shrink: 0;
}

.erp-mail-inbox > .erp-mail-split-view,
.erp-mail-inbox > .erp-split-view {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.erp-split-left,
.erp-split-right,
.erp-mail-split-left,
.erp-mail-split-right {
  min-height: 0;
}

.erp-split-left > .erp-split-title,
.erp-split-right > .erp-split-title {
  flex-shrink: 0;
}

.erp-split-left > .erp-grid-wrap,
.erp-mail-split-left > .erp-grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.erp-split-right > .erp-mail-preview {
  /* flex 대신 position absolute 로 오른쪽 패널 채움 */
  position: absolute;
  /* inset: 0 → 툴바(.erp-mail-body-toolbar) 아래부터 시작하도록 top 을 덮어씀 */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* 메일 받은함: 본문 툴바(34px) 아래부터 미리보기 표시 */
.erp-mail-split-right > .erp-mail-preview {
  top: 34px;
}

.erp-grid-wrap > .erp-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
}

.erp-grid-wrap > .erp-pager {
  flex-shrink: 0;
  margin-top: auto;
}

.erp-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  background: #e8eef5;
  border-top: 1px solid var(--erp-border);
  font-size: 10px;
  color: #666;
}

/* ── 조회/필터 바 ── */
.erp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border-bottom: 1px solid var(--erp-border-light);
  max-width: 100%;
  overflow-x: auto;
}

.erp-filter-label {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
}

.erp-filter-input {
  height: 24px;
  padding: 0 6px;
  font-size: 12px;
  border: 1px solid var(--erp-border);
  border-radius: 2px;
  min-width: 100px;
}

.erp-filter-input.date {
  width: 110px;
}

.erp-filter-input.search {
  width: 160px;
}

.erp-month-btns {
  display: flex;
  gap: 1px;
}

.erp-month-btn {
  height: 22px;
  min-width: 28px;
  padding: 0 4px;
  font-size: 10px;
  border: 1px solid var(--erp-border);
  background: #f8f9fb;
  cursor: pointer;
  color: #444;
}

.erp-month-btn:hover,
.erp-month-btn.active {
  background: var(--erp-blue);
  color: #fff;
  border-color: var(--erp-blue-dark);
}

/* ── 액션 툴바 ── */
.erp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 8px;
  background: var(--erp-toolbar-bg);
  border-bottom: 1px solid var(--erp-border-light);
}

.erp-toolbar-left,
.erp-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.erp-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  border: 1px solid var(--erp-border);
  border-radius: 2px;
  background: linear-gradient(180deg, #fff 0%, #eef2f6 100%);
  color: #333;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.erp-btn:hover {
  background: linear-gradient(180deg, #fff 0%, #dce8f5 100%);
  border-color: #8aaccc;
  color: var(--erp-blue-dark);
}

.erp-btn.primary {
  background: linear-gradient(180deg, #3399ee 0%, var(--erp-blue) 100%);
  border-color: var(--erp-blue-dark);
  color: #fff;
}

.erp-btn.primary:hover {
  background: linear-gradient(180deg, #55aaee 0%, #0077dd 100%);
  color: #fff;
}

.erp-btn.danger:hover {
  background: #fee;
  border-color: #c66;
  color: #a00;
}

.erp-btn.warning:hover {
  background: #fff8e6;
  border-color: #cc9;
  color: #886600;
}

.erp-btn.success:hover {
  background: #e8f8ee;
  border-color: #6a6;
  color: #060;
}

.erp-btn i {
  font-size: 13px;
}

.erp-check-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  margin-left: 6px;
  cursor: pointer;
}

.erp-check-label input {
  margin: 0;
}

/* ── 데이터 그리드 ── */
.erp-grid-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #fff;
}

.erp-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  background: #fff;
}

.erp-grid {
  border-collapse: collapse;
  font-size: var(--erp-grid-body-font-size, 12px);
  table-layout: fixed;
}

.erp-grid th,
.erp-grid td {
  border: 1px solid var(--erp-border-light);
  padding: 3px 6px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 5px;
}

.erp-grid th {
  background: var(--erp-table-head);
  font-weight: 600;
  color: #333;
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
  font-size: var(--erp-grid-title-font-size, 12px);
  font-family: var(--erp-grid-title-font-family, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif);
}

.erp-grid td {
  font-size: var(--erp-grid-body-font-size, 12px);
  font-family: var(--erp-grid-body-font-family, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif);
  background: inherit;
}

.erp-grid tbody tr {
  background: var(--erp-row-odd);
}

.erp-grid tbody tr:nth-child(even) {
  background: var(--erp-row-even);
}

.erp-grid tbody tr:hover {
  background: var(--erp-row-hover);
}

.erp-grid tbody tr.inactive {
  background: #f5f5f5;
  color: #888;
}

.erp-grid tbody tr.inactive:nth-child(even) {
  background: #f0f0f0;
}

.erp-grid tbody tr.inactive:hover {
  background: #ececec;
}

.erp-grid .col-check {
  width: 28px;
  text-align: center;
}

.erp-grid .col-radio {
  width: 28px;
  text-align: center;
}

.erp-grid .col-radio input[type="radio"] {
  pointer-events: none;
}

.erp-grid .col-actions {
  width: 180px;
  text-align: center;
}

.erp-grid tfoot td {
  background: #fff;
  font-weight: 600;
  text-align: right;
  border-top: 2px solid var(--erp-border);
}

.erp-grid .text-center {
  text-align: center;
}

.erp-grid .text-right {
  text-align: right;
}

.erp-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 2px;
  font-weight: 600;
}

.erp-badge.master { background: #fdd; color: #900; border: 1px solid #faa; }
.erp-badge.admin { background: #ddf; color: #006; border: 1px solid #aaf; }
.erp-badge.user { background: #eee; color: #555; border: 1px solid #ccc; }
.erp-badge.active { background: #dfd; color: #060; border: 1px solid #aca; }
.erp-badge.inactive { background: #eee; color: #888; border: 1px solid #ccc; }

.erp-btn-sm {
  height: 22px;
  padding: 0 6px;
  font-size: 10px;
}

.erp-empty-msg {
  padding: 24px;
  text-align: center;
  color: #888;
  font-size: 13px;
}

/* ── 페이지네이션 ── */
.erp-pager {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  background: #fff;
  border-top: 1px solid var(--erp-border-light);
}

.erp-pager-btn {
  height: 22px;
  min-width: 24px;
  padding: 0 4px;
  font-size: 10px;
  border: 1px solid var(--erp-border);
  background: #fff;
  cursor: pointer;
}

a.erp-pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
}

.erp-pager-btn.disabled {
  opacity: 0.45;
  cursor: default;
}

.erp-pager-btn.active {
  background: var(--erp-blue);
  color: #fff;
  border-color: var(--erp-blue-dark);
}

.erp-pager-info {
  margin-left: 8px;
  font-size: 11px;
  color: #666;
}

.erp-pager-size {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 11px;
  color: #555;
}

.erp-pager-size-label {
  margin: 0;
  white-space: nowrap;
}

.erp-page-size-select {
  height: 22px;
  min-width: 52px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid var(--erp-border);
  border-radius: 2px;
  background: #fff;
}

.erp-pager-size-unit {
  white-space: nowrap;
}

/* ── 알림 ── */
.erp-alert {
  margin: 6px 8px 0;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid;
  border-radius: 2px;
}

.erp-alert.success {
  background: #e8f8ee;
  border-color: #8c8;
  color: #060;
}

.erp-alert.danger {
  background: #fee;
  border-color: #c88;
  color: #900;
}

/* ── 폼 패널 ── */
.erp-form-panel {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
}

.erp-form-table {
  width: 100%;
  max-width: 720px;
  border-collapse: collapse;
}

.erp-form-table th,
.erp-form-table td {
  border: 1px solid var(--erp-border-light);
  padding: 5px 8px;
  font-size: 12px;
  vertical-align: middle;
}

.erp-form-table th {
  width: 120px;
  background: var(--erp-table-head);
  text-align: right;
  font-weight: 600;
  color: #444;
}

.erp-form-table td {
  background: #fff;
}

.erp-form-table .form-control,
.erp-form-table .form-select {
  height: 26px;
  padding: 2px 6px;
  font-size: 12px;
  border: 1px solid var(--erp-border);
  border-radius: 2px;
}

.erp-form-table textarea.form-control {
  height: auto;
}

.erp-form-table .form-text {
  font-size: 10px;
  margin-top: 2px;
}

.erp-receivable-no-counterparty {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #a94442;
  background: #fdf2f2;
  border: 1px solid #f0caca;
  border-radius: 4px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.4;
}

.erp-receivable-no-counterparty:hover {
  color: #843534;
  background: #fce8e8;
  border-color: #e8b4b4;
  text-decoration: none;
}

.erp-form-hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #777;
}

.erp-form-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--erp-border-light);
  display: flex;
  gap: 4px;
}

/* ── 홈 대시보드 ── */
.erp-dashboard {
  padding: 16px;
  overflow: auto;
}

.erp-dashboard-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--erp-blue-dark);
  margin-bottom: 4px;
}

.erp-dashboard-sub {
  font-size: 12px;
  color: #666;
  margin-bottom: 16px;
}

.erp-dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.erp-dash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 10px;
  background: #f8fafc;
  border: 1px solid var(--erp-border-light);
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.erp-dash-card:hover:not(.disabled) {
  border-color: var(--erp-blue);
  box-shadow: 0 2px 6px rgba(0, 102, 204, 0.15);
  color: var(--erp-blue);
}

.erp-dash-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.erp-dash-card i {
  font-size: 28px;
  color: var(--erp-blue);
  margin-bottom: 6px;
}

.erp-dash-card span {
  font-size: 12px;
  font-weight: 600;
}

/* ── 로그인 ── */
.erp-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e4d7b 0%, #0066cc 50%, #004c99 100%);
}

.erp-login-box {
  width: 380px;
  background: #fff;
  border: 1px solid var(--erp-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.erp-login-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--erp-module-bg);
  border-bottom: 1px solid var(--erp-border);
}

.erp-login-header .erp-logo-mark {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.erp-login-header h1 {
  margin: 0;
  font-size: 18px;
  color: var(--erp-blue-dark);
}

.erp-login-body {
  padding: 20px;
}

.erp-login-body .form-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
}

.erp-login-body .form-control {
  height: 32px;
  font-size: 13px;
  border-radius: 2px;
}

.erp-login-body .erp-btn {
  width: 100%;
  height: 34px;
  justify-content: center;
  font-size: 13px;
  margin-top: 8px;
}

.erp-login-footer {
  padding: 10px 20px;
  background: #f5f7fa;
  border-top: 1px solid var(--erp-border-light);
  font-size: 11px;
  color: #888;
  text-align: center;
}

/* ── 반응형 ── */
@media (max-width: 991px) {
  body.erp-body {
    overflow: auto;
    height: auto;
  }

  .erp-shell {
    flex-direction: column;
    height: auto;
  }

  .erp-sidebar {
    width: 100%;
    max-height: 200px;
  }

  .erp-main {
    min-height: 60vh;
  }

  .erp-module-item {
    padding: 0 8px;
  }
}

@media (max-width: 576px) {
  .erp-header-right .erp-util-link:not(.erp-logout) {
    display: none;
  }

  .erp-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .erp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .erp-grid .col-actions {
    width: auto;
  }
}

/* ── 부가서비스 import 메뉴 ── */
.erp-import-menu .erp-tree-link.import-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: var(--erp-menu-spacing-y, 5px) 8px var(--erp-menu-spacing-y, 5px) 12px;
  font-size: 11px;
  border-left: 3px solid transparent;
}

.erp-import-menu .erp-tree-link.import-item i {
  font-size: 12px;
  color: #5588bb;
  flex-shrink: 0;
}

.erp-import-menu .erp-tree-link.import-item.active {
  background: var(--erp-active-bg);
  color: #fff;
  border-left-color: #004080;
}

.erp-import-menu .erp-tree-link.import-item.active i {
  color: #fff;
}

/* ── 마스터-디테일 분할 ── */
.erp-split-view {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.erp-split-left {
  width: 340px;
  flex: 0 0 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: none;
  background: #fafbfc;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.erp-split-resizer {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: #c8d0da;
  border-left: 1px solid var(--erp-border-light);
  border-right: 1px solid var(--erp-border-light);
  position: relative;
  z-index: 5;
  align-self: stretch;
  touch-action: none;
  user-select: none;
}

.erp-split-resizer:hover {
  background: rgba(0, 102, 204, 0.35);
}

.erp-split-right {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}

.erp-split-right > form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.erp-split-title {
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  background: var(--erp-table-head);
  border-bottom: 1px solid var(--erp-border-light);
  color: #333;
}

.erp-split-sub {
  font-weight: 400;
  color: #666;
  margin-left: 8px;
}

.erp-split-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-height: none;
  overflow: auto;
}

.erp-selectable-row {
  cursor: pointer;
}

.erp-selectable-row.selected {
  background: #d6e8f8 !important;
}

.erp-selectable-row.selected:nth-child(even) {
  background: #d6e8f8 !important;
}

.erp-selectable-row.selected td {
  /* 선택 시 굵게 표시하지 않음 — 배경색으로만 구분 */
}

/* ── 가져오기 패널 ── */
.erp-import-panel {
  border-top: 2px solid var(--erp-blue);
  background: #f0f6fc;
  padding: 10px 12px;
}

.erp-import-panel-inner {
  max-width: 900px;
}

.erp-import-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--erp-blue-dark);
}

.erp-import-steps {
  margin: 0 0 10px 18px;
  padding: 0;
  font-size: 12px;
  color: #444;
}

.erp-import-steps li {
  margin-bottom: 3px;
}

.erp-import-file-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.erp-import-file-row input[type="file"] {
  max-width: 420px;
}

.erp-import-note {
  margin: 8px 0 0;
  font-size: 10px;
  color: #777;
}

/* ── 준비중 placeholder ── */
.erp-placeholder-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.erp-placeholder-icon {
  font-size: 48px;
  color: #aaccee;
  margin-bottom: 12px;
}

.erp-placeholder-page h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #333;
}

@media (max-width: 991px) {
  .erp-split-view {
    flex-direction: column;
  }

  .erp-split-left {
    width: 100%;
    max-height: 180px;
  }
}

/* ── UI 설정: 메뉴 간격 조절 ── */
.erp-menu-spacing-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #e4e4e4;
  border-top: 1px solid var(--erp-border);
  border-bottom: 1px solid var(--erp-border);
  flex-shrink: 0;
}

.erp-menu-spacing-label {
  font-size: 10px;
  color: #666;
  white-space: nowrap;
}

.erp-menu-spacing-handle {
  flex: 1;
  height: 8px;
  background: linear-gradient(180deg, #ccc 0%, #aaa 100%);
  border: 1px solid #999;
  border-radius: 2px;
  cursor: ns-resize;
}

.erp-menu-spacing-handle:hover {
  background: linear-gradient(180deg, #99c2ee 0%, #6699cc 100%);
}

/* ── UI 설정: 컬럼 폭 조절 ── */
.erp-grid th {
  overflow: visible;
}

.erp-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  background: transparent;
}

.erp-col-resizer:hover {
  background: rgba(0, 102, 204, 0.35);
}

/* ── 팝업 창 (금융거래 수금 등 · 모달형) ── */
body.erp-popup-body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: #8c939a;
}

.erp-popup-backdrop {
  display: flex;
  align-items: stretch;
  justify-content: center;
  height: 100vh;
  padding: 0;
  box-sizing: border-box;
}

.erp-popup-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.erp-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 52px;
  padding: 0 16px 0 22px;
  background: linear-gradient(180deg, #f3f8fd 0%, #e8f1fa 100%);
  border-bottom: 1px solid #d4e3f2;
}

.erp-popup-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #222;
  letter-spacing: -0.4px;
}

.erp-popup-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #555;
  font-size: 18px;
  cursor: pointer;
}

.erp-popup-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #222;
}

.erp-popup-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 12px;
  background: #fff;
}

.erp-popup-body > .erp-filter-bar,
.erp-popup-body > form.erp-filter-bar,
.erp-popup-body > .erp-toolbar,
.erp-popup-body > .erp-alert,
.erp-popup-body > .erp-receivable-summary,
.erp-popup-body > .erp-form-panel,
.erp-popup-body > .erp-popup-panel {
  flex-shrink: 0;
}

.erp-popup-body > .erp-grid-wrap,
.erp-popup-body > .erp-form-panel .erp-grid-scroll,
.erp-popup-body > form:has(.erp-grid-wrap) {
  flex: 1 1 auto;
  min-height: 0;
}

.erp-popup-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 14px 20px 18px;
  background: #fff;
  border-top: 1px solid #e8edf2;
}

.erp-popup-form-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  margin-top: 16px;
  padding: 14px 0 4px;
  border-top: 1px solid #e8edf2;
}

.erp-quotation-form-actions.erp-toolbar {
  margin-top: 16px;
  margin-bottom: 8px;
}

.erp-popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 38px;
  padding: 0 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.erp-popup-btn-outline {
  border: 1px solid var(--erp-blue);
  background: #fff;
  color: var(--erp-blue);
}

.erp-popup-btn-outline:hover {
  background: #f0f7ff;
}

.erp-popup-btn-primary {
  border: 1px solid var(--erp-blue-dark);
  background: linear-gradient(180deg, #3399ee 0%, var(--erp-blue) 100%);
  color: #fff;
}

.erp-popup-btn-primary:hover {
  background: linear-gradient(180deg, #55aaee 0%, #0077dd 100%);
}

.erp-popup-btn-primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.erp-popup-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}

.erp-popup-panel {
  background: #f7f9fc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.erp-popup-panel-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #333;
  text-align: center;
}

.erp-popup-section {
  margin-bottom: 12px;
}

.erp-popup-section-title {
  margin: 0 0 8px;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  border-bottom: 1px solid var(--erp-border-light);
}

.erp-popup-body .erp-filter-bar.erp-popup-filter {
  border-bottom: none;
  background: transparent;
  padding: 0;
  margin: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.erp-popup-body .erp-form-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.erp-receivable-summary {
  flex-shrink: 0;
  padding: 0;
  margin-bottom: 12px;
  background: transparent;
  border-bottom: none;
}

.erp-receivable-summary .erp-split-title {
  display: none;
}

.erp-receivable-summary .erp-grid-wrap {
  flex: none;
  min-height: auto;
  margin-bottom: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.erp-popup-toolbar {
  flex-shrink: 0;
  padding: 6px 8px;
  background: var(--erp-toolbar-bg);
  border-bottom: 1px solid var(--erp-border-light);
  text-align: right;
}

/* ── 메인 화면 위 모달 (iframe) ── */
body.erp-main-modal-open {
  overflow: hidden;
}

.erp-main-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.erp-main-modal[hidden] {
  display: none !important;
}

.erp-main-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.erp-main-modal-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1280px, 100%);
  height: min(92vh, 900px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

/* 드래그 이동 중에는 fixed 포지션으로 자유롭게 이동 */
.erp-main-modal-shell.is-dragging {
  user-select: none;
}

/* ── 모달 타이틀 바 ── */
.erp-main-modal-title-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 10px 0 14px;
  background: var(--erp-header-bg);
  border-radius: 10px 10px 0 0;
  cursor: grab;
  user-select: none;
  gap: 8px;
}

.erp-main-modal-title-bar:active {
  cursor: grabbing;
}

.erp-main-modal-title {
  flex: 1;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-main-modal-close-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}

.erp-main-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.erp-main-modal-frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* 드래그 중 iframe 마우스 이벤트 차단 */
.erp-main-modal-shell.is-dragging .erp-main-modal-frame {
  pointer-events: none;
}

/* 모달 iframe 내부 (_LayoutModal) */
body.erp-modal-embed-body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #fff;
}

.erp-modal-embed-dialog {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

/* 제출 견적 — 품목 검색 */
.erp-item-search-wrap {
  position: relative;
}

.erp-item-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.erp-item-search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.erp-item-search-item:hover {
  background: #e8f0fe;
}

.erp-version-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* 그룹웨어 게시판 */
.erp-board-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.erp-board-title-link {
  color: inherit;
  text-decoration: none;
}

.erp-board-title-link:hover {
  color: var(--erp-primary, #2563eb);
  text-decoration: underline;
}

tr.notice-row td {
  background: #fffbeb;
}

.erp-board-detail {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  margin-top: 12px;
}

.erp-board-detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.erp-board-detail-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
}

.erp-board-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: #64748b;
}

.erp-board-detail-body {
  padding: 20px;
  min-height: 200px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 14px;
}

.erp-board-content-input {
  min-height: 320px;
  font-family: inherit;
  line-height: 1.6;
}

.erp-mail-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 받은메일함·자료실 (좌우 분할 목록) */
.erp-mail-inbox {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--erp-border);
}

.erp-mail-split-view {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

.erp-mail-split-view > .erp-split-left,
.erp-mail-split-view > .erp-mail-split-left {
  flex-shrink: 0;
  overflow: hidden;
}

.erp-mail-split-view > .erp-split-resizer {
  flex: 0 0 6px;
  width: 6px;
  min-width: 6px;
  z-index: 12;
}

/* 개인 받은메일: 목록·본문 분할선 (회사받은메일과 동일 구조) */
.erp-mail-personal-inbox > .erp-mail-split-view > .erp-split-resizer {
  flex: 0 0 8px;
  width: 8px;
  min-width: 8px;
  z-index: 30;
  position: relative;
  pointer-events: auto;
}

.erp-mail-personal-inbox > .erp-mail-split-view > .erp-split-left,
.erp-mail-personal-inbox > .erp-mail-split-view > .erp-mail-split-left {
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}

.erp-split-title-slot {
  flex-shrink: 0;
  height: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
}

/* 메일 목록 마지막 컬럼도 리사이저 허용 */

/* 외부메일 배지 (내부 메일은 텍스트 없음) */
.erp-mail-ext-badge {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  background: none;
  border: none;
  padding: 0;
}

.erp-mail-ext-badge.ext1 {
  color: #1a56db;
}

.erp-mail-ext-badge.ext2 {
  color: #b45309;
}

.erp-mail-personal-inbox .erp-mail-split-right .erp-mail-preview,
.erp-mail-personal-inbox .erp-mail-split-right .erp-mail-preview-header,
.erp-mail-personal-inbox .erp-mail-split-right .erp-mail-preview-body,
.erp-mail-personal-inbox .erp-mail-split-right .erp-mail-preview-meta {
  min-width: 0;
  max-width: 100%;
}

.erp-mail-split-view > .erp-split-right,
.erp-mail-split-view > .erp-mail-split-right {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}

.erp-mail-grid-wrap .erp-grid {
  table-layout: auto;
  width: 100%;
}

.erp-mail-grid-wrap .erp-grid th,
.erp-mail-grid-wrap .erp-grid td {
  width: auto;
  min-width: 5px;
}

.erp-mail-grid-wrap .erp-grid .col-check {
  width: auto;
}

.erp-mail-split-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.erp-mail-grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: none;
}

.erp-mail-grid-wrap .erp-pager {
  flex-shrink: 0;
  border-top: 1px solid var(--erp-border-light);
  background: #fafafa;
}

.erp-mail-split-right {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;  /* 미리보기 absolute 기준점 */
}

/* ── 메일 목록 폰트 한 단계 크게 ── */
.erp-mail-grid-wrap .erp-grid th,
.erp-mail-grid-wrap .erp-grid td {
  font-size: 13px;
}

/* ── 아이콘 통합 셀 ──
   체크(22px) + 읽음(18px) + 첨부(16px) + 외부(18px) = 74px
   슬롯 너비 고정 → 첨부 없어도 외부 아이콘 위치 일정 */
/* 헤더와 행 셀을 동일한 좌측 패딩으로 정렬 */
.col-mail-icons,
.mail-icon-cell {
  width: 78px;
  text-align: left !important;
  padding: 0 4px 0 5px !important;
  vertical-align: middle;
  white-space: nowrap;
}

/* 각 슬롯: inline-block + 고정 너비 */
.mail-icon-cell .mi-check,
.mail-icon-cell .mi-status,
.mail-icon-cell .mi-attach,
.mail-icon-cell .mi-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.mail-icon-cell .mi-check  { width: 22px; }
.mail-icon-cell .mi-status { width: 18px; }
.mail-icon-cell .mi-attach { width: 16px; }
.mail-icon-cell .mi-ext    { width: 20px; }

/* 체크박스 클릭 전파 차단은 이미 td onclick 에서 처리 */
.mail-icon-cell .mi-check input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

/* 읽음 아이콘 */
.mail-icon-cell .mi-status i {
  font-size: 13px;
  color: #8a9bb0;
}

tr.mail-inbox-row.unread .mail-icon-cell .mi-status i {
  color: #3d6db3;
}

/* 첨부 아이콘 */
.mail-icon-cell .mi-attach i {
  font-size: 13px;
  color: #777;
}

/* ── 메일 목록 하단 페이지네이션 폰트 한 단계 크게 ── */
.erp-mail-grid-wrap .erp-pager .erp-pager-btn {
  font-size: 12px;
  height: 24px;
  min-width: 28px;
}

.erp-mail-grid-wrap .erp-pager .erp-pager-info {
  font-size: 13px;
}

.erp-mail-grid-wrap .erp-pager .erp-pager-size {
  font-size: 13px;
}

.erp-mail-grid-wrap .erp-pager .erp-page-size-select {
  font-size: 12px;
  height: 24px;
}

tr.mail-inbox-row.unread td {
  color: #111;
}

tr.mail-inbox-row .mail-inbox-status {
  color: #8a9bb0;
}

tr.mail-inbox-row.unread .mail-inbox-status {
  color: #3d6db3;
}

.erp-mail-attach-icon {
  color: #888;
  font-size: 12px;
}

#mailInboxGrid th.col-status,
#mailInboxGrid th.col-attach {
  width: 28px;
  padding: 0 2px;
}

#mailInboxGrid td.mail-inbox-attach {
  width: 28px;
  padding: 0 2px;
  font-size: 0;
  line-height: 1;
}

#mailInboxGrid td.mail-inbox-attach .erp-mail-attach-icon {
  font-size: 12px;
}

.erp-mail-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  padding: 2px 8px;
  border: 1px solid var(--erp-border);
  border-radius: 3px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.erp-mail-filter-toggle input {
  margin: 0;
}

.erp-mail-filter-toggle.is-active {
  border-color: var(--erp-blue);
  background: #eef5ff;
  color: var(--erp-blue);
}

/* 자료실 업무/개인 구분 뱃지 */
.erp-mail-filter-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.erp-mail-filter-badge.shared {
  background: #e8f0fe;
  color: #1967d2;
}

.erp-mail-filter-badge.personal {
  background: #fce8f3;
  color: #a142a4;
}

.erp-mail-address-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 640px;
}

.erp-mail-address-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.erp-mail-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.erp-mail-picker-modal[hidden] {
  display: none !important;
}

.erp-mail-picker-dialog {
  width: min(520px, 92vw);
  max-height: 80vh;
  background: #fff;
  border: 1px solid var(--erp-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
}

.erp-mail-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--erp-border);
}

.erp-mail-picker-close {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.erp-mail-picker-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--erp-border);
}

.erp-mail-picker-list {
  flex: 1;
  overflow: auto;
  padding: 6px 0;
  min-height: 200px;
  max-height: 360px;
}

.erp-mail-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.erp-mail-picker-item:hover {
  background: #f5f9ff;
}

.erp-mail-picker-item-text {
  font-size: 12px;
  line-height: 1.4;
}

.erp-mail-picker-sub {
  color: #888;
}

.erp-mail-picker-empty {
  padding: 16px 12px;
  color: #888;
  font-size: 12px;
}

.erp-mail-picker-empty.danger {
  color: #c0392b;
}

.erp-mail-picker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--erp-border);
}

.erp-mail-member-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.erp-mail-member-grid {
  max-width: 640px;
}

tr.mail-inbox-row .mail-inbox-attach {
  color: #888;
}

.erp-mail-preview {
  display: flex;
  flex-direction: column;
  /* flex: 1 1 0 제거 — position: absolute 로 높이 확보 */
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.erp-mail-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 200px;
  color: #888;
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

.erp-mail-preview-empty i {
  font-size: 28px;
  color: #b8c4d4;
}

.erp-mail-preview-empty.danger {
  color: #b94a48;
}

.erp-mail-preview-header {
  flex-shrink: 0;
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e5e5;
  background: #fafbfc;
  overflow: hidden;
}

.erp-mail-preview-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #222;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.erp-mail-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #444;
  min-width: 0;
}

/* 각 행: flex 로 [라벨 고정폭] [값 가변] [날짜(선택)] 정렬 */
.erp-mail-meta-row {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  width: 100%;
}

/* 라벨: 쓰기 폼의 .mc-label 과 동일한 72px 고정 폭 */
.erp-mail-meta-label {
  flex: 0 0 72px;
  font-weight: 600;
  color: #5f6368;
  font-size: 12px;
  padding: 2px 8px 0 0;
  white-space: nowrap;
}

/* 값: 남은 공간 채우고 줄바꿈 시 동일 위치에서 시작 */
.erp-mail-meta-value {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 날짜: 우측 끝 고정 */
.erp-mail-meta-date {
  flex-shrink: 0;
  white-space: nowrap;
  color: #888;
  font-size: 12px;
  padding: 2px 0 0 10px;
  margin-left: auto;
}

.erp-mail-participant-add {
  display: inline;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.erp-mail-participant-unregistered {
  color: #0066cc;
  text-decoration: underline;
}

.erp-mail-participant-add:hover .erp-mail-participant-unregistered {
  color: #004999;
}

.erp-mail-list-participant.is-registered {
  text-align: left;
}

.erp-mail-list-participant.is-unregistered {
  text-align: right;
}

.erp-mail-sender-address-alert {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  background: #f5b7b1;
  color: #111;
  font-weight: 600;
}

.erp-mail-preview-actions {
  margin-top: 10px;
}

.erp-mail-preview-actions .erp-btn,
.erp-mail-inbox .erp-mail-tool-btn {
  font-size: var(--erp-mail-button-font-size, 12px);
}

.erp-mail-attachments {
  flex-shrink: 0;
  min-width: 0;
  padding: 8px 14px;
  border-bottom: 1px solid var(--erp-border-light);
  background: #f8fafc;
  overflow: hidden;
}

.erp-mail-attachments-title {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.erp-mail-attachments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.erp-mail-attachments-list li {
  margin: 0;
}

.erp-mail-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--erp-border);
  border-radius: 3px;
  background: #fff;
  color: #2f5f9e;
  font-size: 12px;
  text-decoration: none;
}

.erp-mail-attachment-link:hover {
  background: #eef4fc;
  border-color: #9bb8dc;
  color: #1f4f8a;
}

.erp-mail-attachment-size {
  color: #888;
  font-size: 11px;
}

.erp-mail-preview-body {
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;
  padding: 14px;
  overflow: auto;
}

/* erp-split-scroll 의 flex: 1 1 auto 를 !important 로 덮어씀 */
.erp-mail-preview > .erp-mail-preview-body {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow: auto !important;
}

.erp-mail-text-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 13px;
}

.erp-document-version-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.erp-document-version-label {
  font-size: 12px;
  color: #555;
  margin: 0;
}

.erp-document-version-select {
  width: auto;
  min-width: 220px;
  max-width: 360px;
  height: 26px;
  font-size: 12px;
}

.document-current-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.document-current-file-item.marked-remove {
  opacity: 0.55;
  text-decoration: line-through;
}

.document-current-file-item.marked-remove .document-current-file-name {
  text-decoration: line-through;
}
  display: flex;
  align-items: center;
  gap: 6px;
}

.erp-mail-category-select {
  width: 120px;
  height: 28px;
  font-size: 12px;
}

/* ── 이전 단일 툴바 (레거시 스타일 — 제거 시 오류 방지용 유지) ── */
.erp-mail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 8px;
  border-bottom: 1px solid #e5e5e5;
  background: #fafafa;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.erp-mail-toolbar-left,
.erp-mail-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── 좌측 목록 툴바 ── */
.erp-mail-list-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid #e5e5e5;
  background: #fafafa;
  flex-shrink: 0;
  flex-wrap: nowrap;
  min-height: 34px;
}

.erp-mail-list-count {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  margin: 0 4px;
}

/* 검색박스가 남은 공간 차지 */
.erp-mail-list-toolbar .erp-mail-search {
  flex: 1 1 120px;
  min-width: 80px;
}

/* ── 우측 본문 툴바 ── */
.erp-mail-body-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid #e5e5e5;
  background: #fafafa;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 34px;
}

/* 작성 모드 툴바 — 배경 살짝 구분 */
.erp-mail-compose-toolbar {
  background: #f0f4ff;
  border-bottom-color: #b8c8ff;
}

.erp-mail-compose-mode-label {
  font-size: 12px;
  color: #666;
  margin-left: 4px;
}

/* 보내기 버튼 강조 */
.erp-mail-tool-btn.is-primary {
  background: var(--erp-blue, #3a7bd5);
  color: #fff;
  border-color: var(--erp-blue-dark, #2a6ac5);
}

.erp-mail-tool-btn.is-primary:hover:not(:disabled) {
  background: var(--erp-blue-dark, #2a6ac5);
  border-color: var(--erp-blue-dark, #2a6ac5);
}

.erp-mail-toolbar-check {
  display: inline-flex;
  align-items: center;
  margin: 0 4px 0 2px;
  cursor: pointer;
}

.erp-mail-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #d8dce4;
  background: #f0f3f8;
  color: #333;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}

.erp-mail-tool-btn i {
  font-size: 13px;
  opacity: 0.85;
}

.erp-mail-tool-btn:hover:not(:disabled) {
  border-color: #b0b8cc;
  background: #e3e9f4;
  color: #111;
}

.erp-mail-tool-btn:active:not(:disabled) {
  background: #d5dff0;
}

.erp-mail-tool-btn:disabled {
  color: #aaa;
  background: #f7f8fa;
  border-color: #e0e0e0;
  cursor: not-allowed;
}

.erp-mail-tool-btn:disabled i {
  opacity: 0.45;
}

.erp-mail-tool-btn.has-caret::after {
  content: "▾";
  font-size: 10px;
  margin-left: 2px;
  color: #888;
}

.erp-mail-tool-btn.icon-only i {
  font-size: 13px;
}

.erp-mail-toolbar-count {
  margin: 0 8px;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

.erp-mail-search {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #ccc;
  background: #fff;
  padding: 3px 8px;
  min-width: 180px;
}

.erp-mail-search i {
  color: #888;
  font-size: 13px;
}

.erp-mail-search-input {
  border: none;
  outline: none;
  font-size: 12px;
  width: 100%;
  background: transparent;
}

.erp-mail-search-clear {
  border: none;
  background: transparent;
  color: #aaa;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

.erp-mail-search-clear:hover {
  color: #555;
}

tr.mail-unread td {
  background: #f0f7ff;
  font-weight: 600;
}

.erp-mail-html-body {
  line-height: 1.6;
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.erp-mail-html-body table,
.erp-mail-html-body img,
.erp-mail-html-body pre {
  max-width: 100%;
}

.erp-mail-html-body table {
  table-layout: fixed;
  width: 100% !important;
}

/* HTML 이메일 iframe – 콘텐츠 높이에 맞게 JS로 조절 */
.erp-mail-html-iframe {
  width: 100%;
  height: 100%;  /* 본문 컨테이너를 꽉 채움 – iframe 자체가 내부 스크롤 처리 */
  border: none;
  display: block;
}

/* ── 연락처 등록 (명함) ── */
/* 연락처 상세 패널 테이블 */
.erp-contact-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.erp-contact-detail-table th,
.erp-contact-detail-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--erp-border);
  vertical-align: top;
}

.erp-contact-detail-table th {
  width: 90px;
  color: var(--erp-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.erp-contact-detail-table td a {
  color: var(--erp-blue);
  text-decoration: none;
}

.erp-contact-detail-table td a:hover {
  text-decoration: underline;
}

/* 명함 이미지 영역 */
.erp-contact-card-wrap {
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid var(--erp-border);
  border-radius: 6px;
  background: #fafafa;
}

.erp-contact-card-label {
  font-size: 12px;
  color: var(--erp-text-muted);
  margin-bottom: 6px;
}

.erp-contact-card-img {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--erp-border);
}

.erp-contact-form-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.erp-contact-card-panel {
  width: 280px;
  flex-shrink: 0;
}

/* ── 명함/텍스트 분석 탭 바 ── */
.erp-contact-card-tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
  border-bottom: 2px solid var(--erp-border-light);
}

.erp-contact-card-tab {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

.erp-contact-card-tab:hover {
  color: var(--erp-blue);
  background: rgba(0, 102, 204, 0.04);
}

.erp-contact-card-tab.is-active {
  color: var(--erp-blue);
  border-bottom-color: var(--erp-blue);
  background: rgba(0, 102, 204, 0.06);
}

/* 텍스트 분석 입력 영역 */
.erp-contact-text-input {
  resize: vertical;
  width: 100%;
  font-size: 12px;
  line-height: 1.6;
  min-height: 160px;
  border: 2px dashed #b8c5d4;
  border-radius: 6px;
  background: #fafbfc;
  padding: 8px 10px;
  transition: border-color 0.15s;
}

.erp-contact-text-input:focus {
  border-color: var(--erp-blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
  background: #fff;
}

.erp-contact-fields-panel {
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.erp-contact-fields-panel .erp-form-table td {
  overflow: visible;
}

.erp-contact-fields-panel .erp-counterparty-picker-list {
  z-index: 120;
}

.erp-contact-fields-panel .erp-form-table {
  overflow: visible;
}

.erp-contact-card-dropzone {
  position: relative;
  min-height: 200px;
  border: 2px dashed #b8c5d4;
  border-radius: 6px;
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.erp-contact-card-dropzone.drag-over {
  border-color: var(--erp-blue);
  background: #eef5ff;
}

.erp-contact-card-dropzone.focused {
  border-color: var(--erp-blue);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.erp-contact-card-file-input {
  display: none;
}

.erp-contact-card-preview {
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.erp-contact-card-placeholder {
  text-align: center;
  color: #666;
  padding: 16px;
}

.erp-contact-card-placeholder i {
  font-size: 36px;
  color: #9ab;
  display: block;
  margin-bottom: 8px;
}

.erp-contact-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

/* ── 거래처 검색 콤보 ── */
.erp-counterparty-picker {
  width: var(--erp-counterparty-picker-width, 320px);
  max-width: 100%;
}

.erp-counterparty-picker-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.erp-counterparty-picker-combo {
  position: relative;
  flex: 1;
  min-width: 0;
}

.erp-counterparty-picker-search {
  width: 100%;
}

.erp-counterparty-picker-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--erp-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.erp-counterparty-picker-item {
  display: block;
  width: 100%;
  border: none;
  background: #fff;
  text-align: left;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.erp-counterparty-picker-item:hover,
.erp-counterparty-picker-item:focus {
  background: #eef5ff;
}

.erp-counterparty-picker-empty {
  padding: 8px 10px;
  color: #888;
  font-size: 12px;
}

.erp-email-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ═══════════════════════════════════════════
   Gmail 스타일 메일 작성 폼 (mc-* 클래스)
═══════════════════════════════════════════ */

/* 전체 컨테이너: iframe 높이를 꽉 채움 */
.erp-modal-embed-body {
  height: 100vh;
  overflow: hidden;
}
.erp-modal-embed-body .erp-popup-dialog {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.erp-modal-embed-body .erp-popup-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mc-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  font-size: 13px;
}

/* embed/popup 바디 안에서 mc-wrap이 직접 자식일 때 flex로 꽉 채움 */
.erp-popup-body > .mc-wrap {
  flex: 1;
  height: auto;
  min-height: 0;
}

.mc-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 에러 메시지 바 */
.mc-error-bar {
  background: #fff3cd;
  color: #664d03;
  padding: 6px 14px;
  font-size: 12px;
  border-bottom: 1px solid #ffc107;
  flex-shrink: 0;
}

/* 각 필드 행 */
.mc-field {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid #e8eaed;
  min-height: 38px;
  flex-shrink: 0;
}

/* 보내는사람 행 */
.mc-field-from {
  background: #f8f9fa;
  align-items: center;
}

/* 라벨 — 프리뷰 메타와 동일한 72px 고정폭 */
.mc-label {
  flex: 0 0 72px;
  padding: 9px 8px 9px 12px;
  color: #5f6368;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}

/* 보내는사람 텍스트 */
.mc-from-display {
  flex: 1;
  padding: 9px 0;
  color: #202124;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 입력 필드 */
.mc-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 9px 8px 9px 0;
  font-size: 13px;
  color: #202124;
  background: transparent;
  min-width: 0;
}
.mc-input:focus {
  outline: none;
}
.mc-input-subject {
  font-size: 14px;
  font-weight: 500;
}

/* 주소 선택 버튼 그룹 */
.mc-addr-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px 5px 4px;
  flex-shrink: 0;
}
.mc-pick-btn {
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: #fff;
  color: #3c4043;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.5;
}
.mc-pick-btn:hover {
  background: #f1f3f4;
  border-color: #c6cacd;
}

/* 참조 토글 버튼 행 */
/* 참조 토글 관련 클래스 — 제거됨 (참조가 받는사람과 동일한 일반 행으로 변경) */

/* 유효성 오류 */
.mc-error {
  display: block;
  color: #d93025;
  font-size: 11px;
  padding: 2px 14px;
  flex-shrink: 0;
}

/* 본문 영역 — 남은 공간 채움 */
.mc-body-wrap {
  flex: 1 1 0;       /* 남은 공간 전부 채움 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 120px;  /* 내용 입력 영역 최소 높이 확보 */
}
.mc-body {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 12px 14px;
  font-size: 13px;
  color: #202124;
  line-height: 1.6;
  width: 100%;
  min-height: 0;
}
.mc-body:focus {
  outline: none;
}

/* 하단 버튼 바 */
.mc-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid #e8eaed;
  background: #f8f9fa;
  flex-shrink: 0;
}
.mc-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.mc-send-btn:hover {
  background: #1765cc;
}
.mc-cancel-btn {
  background: none;
  border: none;
  color: #5f6368;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
}
.mc-cancel-btn:hover {
  background: #f1f3f4;
}

/* ═══════════════════════════════════════════
   메일 인라인 작성 패널
═══════════════════════════════════════════ */

/* 자료실·연락처 등 우측 미리보기·폼 패널 (툴바 34px 아래부터 절대 위치로 채움) */
.erp-mail-preview-panel {
  position: absolute;
  top: 34px;   /* erp-mail-body-toolbar 높이 */
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

/* 우측 패널 전체를 덮는 오버레이 */
/* 작성 패널: 툴바 아래 본문 영역 전체를 덮는 overlay */
.erp-mail-compose-panel {
  position: absolute;
  /* 툴바(.erp-mail-body-toolbar) 아래부터 채움 */
  top: 34px;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  z-index: 20;
}

/* 작성 iframe — 패널 전체 채움 (헤더 제거 후 단순화) */
.erp-mail-compose-frame {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 0;
}

/* ═══════════════════════════════════════════
   업무 캘린더
═══════════════════════════════════════════ */

/* 받은메일형 3분할 컨테이너 */
.cal-inbox {
  flex: 1 1 auto;
  min-height: 0;
}

.cal-inbox-alert {
  flex-shrink: 0;
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

.cal-split-outer {
  flex: 1 1 auto;
  min-height: 0;
}

/* 좌+가운데 통합 프레임 */
.cal-main-frame {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  height: 100%;
}

/* 좌측 프레임 상단 메뉴 */
.cal-main-frame > .cal-main-toolbar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--erp-border-light);
}

/* 달력·목록 + 일정 카드 영역 */
.cal-main-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

/* 통합 프레임 내 달력·목록 열 */
.cal-main-body > .cal-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  min-width: 0;
  height: 100%;
  flex-shrink: 0;
}

/* 통합 프레임 내 일정 카드 열 */
.cal-main-body > .cal-center {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
  height: 100%;
}

/* 우측 별도 프레임 (내용 조회·등록) */
.cal-preview-panel {
  min-width: 280px;
}

/* 우측 프레임 상단 본문 메뉴 */
.cal-preview-panel > .cal-preview-toolbar-wrap {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.cal-preview-panel > .cal-preview-toolbar-wrap > .erp-mail-body-toolbar {
  border-bottom: 1px solid #e5e5e5;
}

.cal-preview-panel > .erp-mail-preview-panel {
  flex: 1 1 auto;
  min-height: 0;
  position: absolute;
  top: 34px;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

/* 폼 툴바 표시 시 미리보기·작성 영역 top 조정 */
.cal-preview-panel.cal-form-mode > .erp-mail-preview-panel,
.cal-preview-panel.cal-form-mode > .erp-mail-compose-panel {
  top: 34px;
}

.cal-preview-panel > .erp-mail-compose-panel {
  top: 34px;
}

.cal-event-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-event-preview .erp-mail-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* 반복 업무 — 받은메일형 split-view */
.cal-recurring-inbox {
  height: 100%;
}

.cal-recurring-row.cal-recurring-inactive td {
  opacity: 0.7;
}

.cal-recurring-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-recurring-preview .erp-mail-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* 좌측 상단: 월간 달력 카드 */
.cal-month-panel {
  flex: 0 0 auto;
}
.cal-month-panel .card-header {
  background: #f8f9fa;
}

/* 좌측 하단: 날짜 목록 카드 */
.cal-day-list-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cal-day-list-panel .card-body.cal-day-scroll {
  overflow-y: auto;
  flex: 1;
}

/* 가운데 상/하 상세 카드 */
.cal-detail-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.cal-detail-panel .card-body.cal-detail-scroll {
  overflow-y: auto;
  flex: 1;
}

/* ── 월간 달력 그리드 ── */
.cal-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.cal-grid-table th,
.cal-grid-table td {
  padding: 2px 3px;
  text-align: center;
  vertical-align: top;
  border: 1px solid #e9ecef;
}
.cal-grid-table th {
  background: #f8f9fa;
  font-weight: 600;
  padding: 4px 2px;
}

/* 날짜 셀 */
.cal-cell {
  cursor: pointer;
  min-height: 42px;
  min-width: 42px;
}
.cal-cell:hover {
  background: #e8f0fe;
}
.cal-cell-empty {
  background: #fafafa;
  cursor: default;
}
.cal-cell-today .cal-day-num {
  background: #0d6efd;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}
.cal-cell-selected {
  background: #fff3cd;
  box-shadow: inset 0 0 0 2px #fd7e14;
}

/* 날짜 숫자 */
.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

/* 이벤트 카운트 뱃지 */
.cal-count-task,
.cal-count-trip {
  font-size: 10px;
  border-radius: 3px;
  padding: 1px 3px;
  line-height: 1.3;
  margin-top: 1px;
  display: block;
}
.cal-count-task {
  background: #cff4fc;
  color: #055160;
}
.cal-count-trip {
  background: #fff3cd;
  color: #664d03;
}

/* 일요일/토요일 색상 */
.cal-sun { color: #dc3545; }
.cal-sat { color: #0d6efd; }

/* ── 좌측 날짜 목록 ── */
.cal-day-item {
  padding: 6px 4px;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
}
.cal-day-item:hover { background: #f8f9fa; }
.cal-day-item.cal-day-today {
  background: #eff6ff;
  border-left: 3px solid #0d6efd;
  padding-left: 6px;
}
.cal-day-item.cal-day-focus {
  background: #fff8e6;
  border-left: 3px solid #fd7e14;
  padding-left: 6px;
}
.cal-day-selectable {
  cursor: pointer;
}
.cal-day-selectable:hover {
  background: #f8f9fa;
}
.cal-day-header {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 3px;
}
.cal-day-date { color: #495057; }
.cal-day-event {
  font-size: 12px;
  padding: 1px 4px;
  margin-bottom: 2px;
  border-radius: 3px;
  background: #f8f9fa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-day-event.cal-event-done {
  text-decoration: line-through;
  opacity: 0.55;
}
.cal-day-event.cal-event-selectable.selected,
.cal-event-card.cal-event-selectable.selected {
  background: #e7f1ff;
  outline: 2px solid #0d6efd;
  outline-offset: -1px;
}
.cal-event-selectable {
  cursor: pointer;
}
.cal-event-selectable:focus {
  outline: 2px solid #0d6efd;
  outline-offset: -1px;
}

/* ── 이벤트 카드 ── */
.cal-event-card {
  background: #fff;
  font-size: 13px;
}
.cal-event-card.cal-card-done {
  opacity: 0.75;
}
.cal-title-done {
  text-decoration: line-through;
  color: #6c757d;
}
.cal-day-event.cal-event-done .cal-title-done,
.cal-day-event.cal-event-done {
  opacity: 0.65;
}

/* 가운데 카드 버튼 아이콘 크기 통일 */
.cal-event-card-actions .btn-xs {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-event-card-actions .btn-xs i {
  font-size: 12px;
  line-height: 1;
}
.cal-add-btn {
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
}
.cal-add-btn i {
  font-size: 12px;
  line-height: 1;
}

/* 극소 버튼 */
.btn-xs {
  padding: 1px 6px;
  font-size: 11px;
  line-height: 1.5;
}
