/* ============================================================
   WeZON CRM — Black & White Theme
   PCT 스타일 참조 · 단일 색상 체계 (B&W)
   ============================================================ */

/* ═══ Theme Variables ═══ */
:root,
[data-theme="dark"] {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-tertiary: #334155;
  --bg-card: #1E293B;
  --bg-hover: #293548;

  /* 고대비 · 고령 사용자 친화 */
  --text-primary: #FFFFFF;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --border: #475569;
  --border-light: #64748B;

  --accent: #F1F5F9;
  --accent-hover: #FFFFFF;
  --accent-text: #0F172A;

  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #60A5FA;
  --blue: #3B82F6;
  --purple: #8B5CF6;

  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

[data-theme="white"] {
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-tertiary: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-hover: #F1F5F9;

  /* 고대비 · 고령 사용자 친화 */
  --text-primary: #000000;
  --text-secondary: #334155;
  --text-muted: #64748B;

  --border: #CBD5E1;
  --border-light: #94A3B8;

  --accent: #0F172A;
  --accent-hover: #1E293B;
  --accent-text: #FFFFFF;

  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --info: #2563EB;
  --blue: #3B82F6;
  --purple: #8B5CF6;

  --shadow: rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
}

[data-theme="earth"] {
  --bg-primary: #FCF9F4;
  --bg-secondary: #F8F1E7;
  --bg-tertiary: #EFE2D2;
  --bg-card: #FFFDFB;
  --bg-hover: #F4ECE1;

  --text-primary: #4A392D;
  --text-secondary: #685748;
  --text-muted: #887665;

  --border: #E3D5C4;
  --border-light: #F1E7DB;

  --accent: #826958;
  --accent-hover: #6F594B;
  --accent-text: #FFFCF7;

  --success: #748A74;
  --warning: #F59E0B;
  --danger: #BE8C7E;
  --info: #8395A4;
  --blue: #3B82F6;
  --purple: #8B5CF6;

  --shadow: rgba(101, 67, 33, 0.05);
  --shadow-lg: 0 10px 25px rgba(101, 67, 33, 0.08);
}

/* ═══ Reset ═══ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* 고령 사용자 친화 — 큰 글자 + 강한 대비 + 굵은 레이블 */
h1, h2, h3, h4 { letter-spacing: -0.01em; font-weight: 800; }
strong, b { font-weight: 800; }

.page-title { font-size: 1.4rem !important; font-weight: 800 !important; letter-spacing: -0.015em; }
.page-subtitle { font-size: 1rem !important; color: var(--text-secondary); }
.card-title { font-size: 1.1rem !important; font-weight: 700; }
.kpi-label { font-size: 1rem !important; font-weight: 700; }
.kpi-value { font-size: 1.6rem !important; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-delta { font-size: 1rem !important; }





.menu-label { font-size: 1rem !important; font-weight: 600; }
.sidebar-section-title { font-size: 1rem !important; font-weight: 700; text-transform: uppercase; }
.sidebar-menu-item > a, .sidebar-menu-item > button { padding: 0.5rem 0.85rem !important; font-size: 1rem; }
.submenu-item { font-size: 1rem !important; padding: 0.4rem 0.85rem !important; }

.btn { font-size: 1rem; font-weight: 600; padding: 0.45rem 0.9rem; }
.btn-sm { font-size: 1rem; padding: 0.3rem 0.65rem; }
.btn-lg { font-size: 1.1rem; padding: 0.55rem 1.1rem; }

.breadcrumb { font-size: 1rem !important; font-weight: 600; }
.badge { font-size: 1rem; font-weight: 700; padding: 2px 7px; }
.form-control { font-size: 1rem; padding: 0.4rem 0.6rem; }
label { font-size: 1rem; }

/* 작은 텍스트 강화 */
.text-muted { font-size: 1rem; }
.text-secondary { font-size: 1rem; }
/* 필터 chip · tag 등 소형 UI */
.filter-chip, .status-chip, .preset-btn, .cat-chip, .risk-chip { font-size: 1rem !important; padding: 0.35rem 0.8rem !important; }

/* Kanban 카드 확대 */
#kanban-container .wzk-card { font-size: 1rem !important; }
#kanban-container .wzk-card-title { font-size: 1.05rem !important; font-weight: 700; }

/* 입력 필드 placeholder 가독성 */
input::placeholder, textarea::placeholder { font-size: 1rem; color: var(--text-muted); opacity: 0.85; }

/* ═══ Light(White) 테마 — 추가 가독성 보강 ═══ */
[data-theme="white"] .page-subtitle,
[data-theme="white"] .text-secondary,
[data-theme="white"] .kpi-delta,
[data-theme="white"] .card-subtitle { color: #334155 !important; }

[data-theme="white"] .text-muted,
[data-theme="white"] .sidebar-section-title { color: #475569 !important; }

[data-theme="white"] .brand-img { filter: brightness(0) saturate(100%); }

[data-theme="white"] .table th {
  background: #F1F5F9 !important;
  color: #0F172A !important;
}
[data-theme="white"] .table tr:hover { background: #F8FAFC !important; }
[data-theme="white"] .badge-muted {
  background: #E2E8F0 !important; color: #334155 !important;
}
[data-theme="white"] .badge-info {
  background: #DBEAFE !important; color: #1E3A8A !important;
}
[data-theme="white"] .badge-success {
  background: #DCFCE7 !important; color: #14532D !important;
}
[data-theme="white"] .badge-danger {
  background: #FEE2E2 !important; color: #7F1D1D !important;
}
[data-theme="white"] .badge-warning {
  background: #FEF3C7 !important; color: #713F12 !important;
}

[data-theme="earth"] .page-subtitle,
[data-theme="earth"] .text-secondary,
[data-theme="earth"] .kpi-delta,
[data-theme="earth"] .card-subtitle { color: #685748 !important; }

[data-theme="earth"] .text-muted,
[data-theme="earth"] .sidebar-section-title { color: #887665 !important; }

[data-theme="earth"] .brand-img { filter: brightness(0) saturate(100%); }

[data-theme="earth"] .table th {
  background: #F4EBDD !important;
  color: #5C4A3B !important;
}
[data-theme="earth"] .table tr:hover { background: #FCF8F2 !important; }
[data-theme="earth"] .badge-muted {
  background: #F5EDE4 !important; color: #685748 !important;
}
[data-theme="earth"] .badge-info {
  background: #EEF2F5 !important; color: #667987 !important;
}
[data-theme="earth"] .badge-success {
  background: #EBF1EB !important; color: #627762 !important;
}
[data-theme="earth"] .badge-danger {
  background: #F6EAE6 !important; color: #9E7267 !important;
}
[data-theme="earth"] .badge-warning {
  background: #F6EEE4 !important; color: #826958 !important;
}

[data-theme="white"] .quick-cr-btn span,
[data-theme="earth"] .quick-cr-btn span { color: #4A2800 !important; font-weight: 800 !important; }
[data-theme="white"] .quick-cr-btn i,
[data-theme="earth"] .quick-cr-btn i { color: #8A4008 !important; }
/* 밝은 테마에서 테두리·배경을 조금 더 또렷하게 잡아 글자가 떠 보이지 않게 한다 */
[data-theme="white"] .quick-cr-btn { background:#FDEBC8 !important; border-color:#8A4008 !important; }
[data-theme="earth"] .quick-cr-btn { background:#F2E0C2 !important; border-color:#7A4A10 !important; }

/* ═══ Dark 테마 — 추가 가독성 보강 ═══ */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .sidebar-section-title { color: #CBD5E1 !important; }

[data-theme="dark"] .kpi-delta,
[data-theme="dark"] .page-subtitle { color: #E2E8F0 !important; }

[data-theme="dark"] .table th { color: #F1F5F9 !important; }

/* 입력 필드 — 두 테마 공통 큰 사이즈 · 강한 border */
[data-theme="white"] .form-control,
[data-theme="white"] input, [data-theme="white"] select, [data-theme="white"] textarea {
  border: 1.5px solid #CBD5E1;
}
[data-theme="white"] .form-control:focus,
[data-theme="white"] input:focus, [data-theme="white"] select:focus, [data-theme="white"] textarea:focus {
  border-color: #2563EB; outline: 2px solid rgba(37,99,235,0.15);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  border: 1.5px solid #475569;
}
[data-theme="dark"] .form-control:focus {
  border-color: #60A5FA; outline: 2px solid rgba(96,165,250,0.2);
}
[data-theme="earth"] .form-control,
[data-theme="earth"] input, [data-theme="earth"] select, [data-theme="earth"] textarea {
  border: 1.5px solid #E3D5C4;
}
[data-theme="earth"] .form-control:focus,
[data-theme="earth"] input:focus, [data-theme="earth"] select:focus, [data-theme="earth"] textarea:focus {
  border-color: #826958; outline: 2px solid rgba(130,105,88,0.1);
}

/* 날짜 입력 달력 아이콘 가시성 보강 */
input[type="date"],
input[type="datetime-local"] {
  color-scheme: dark;
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 16px 16px;
  padding-right: 2.3rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E2E8F0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

[data-theme="white"] input[type="date"],
[data-theme="white"] input[type="datetime-local"] {
  color-scheme: light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

[data-theme="earth"] input[type="date"],
[data-theme="earth"] input[type="datetime-local"] {
  color-scheme: light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23826958' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

input[type="date"],
input[type="datetime-local"] {
  position: relative;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  cursor: pointer;
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 1;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ═══ Layout ═══ */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 34px 1fr;
  height: 100vh;
}

.sidebar {
  grid-row: 1 / 4;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: all 0.25s ease;
}

.app-layout.sidebar-collapsed { grid-template-columns: 60px 1fr; }
.app-layout.sidebar-collapsed .brand-text,
.app-layout.sidebar-collapsed .brand-img-full,
.app-layout.sidebar-collapsed .menu-label,
.app-layout.sidebar-collapsed .sidebar-section-title,
.app-layout.sidebar-collapsed .sidebar-submenu,
.app-layout.sidebar-collapsed .sidebar-menu-item.open > .sidebar-submenu {
  display: none !important;
}
/* 접힌 사이드바에서 아이콘 중앙 정렬 */
.app-layout.sidebar-collapsed .sidebar-menu-item > a,
.app-layout.sidebar-collapsed .sidebar-menu-item > button {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.app-layout.sidebar-collapsed .sidebar-menu-item > button i:last-child {
  display: none;  /* chevron ∨ 숨김 */
}

.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Tab Bar */
.tab-bar-wrap {
  grid-row: 2; grid-column: 2;
  display: flex; align-items: stretch;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-width: 0; overflow: hidden;
}
.tab-bar {
  flex: 1; min-width: 0;
  background: var(--bg-secondary);
  display: flex; align-items: stretch;
  overflow-x: auto; overflow-y: hidden;
  padding: 0 0.3rem;
  gap: 2px;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-item {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0 0.7rem; height: 100%;
  font-size: 0.85rem; white-space: nowrap;
  color: var(--text-secondary);
  cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  max-width: 180px;
  position: relative;
}
.tab-item:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-item.active {
  color: var(--text-primary); font-weight: 700;
  border-bottom-color: var(--accent);
  background: var(--bg-primary);
}
.tab-item .tab-icon { font-size: 0.72rem; opacity: 0.7; }
.tab-item .tab-label { overflow: hidden; text-overflow: ellipsis; }
.tab-item .tab-close {
  font-size: 0.65rem; opacity: 0; margin-left: 0.2rem;
  padding: 2px 3px; border-radius: 3px; line-height: 1;
  transition: opacity 0.15s;
}
.tab-item:hover .tab-close { opacity: 0.6; }
.tab-item .tab-close:hover { opacity: 1; background: rgba(239,68,68,0.25); color: #EF4444; }

.tab-close-all {
  display: flex; align-items: center; justify-content: center;
  padding: 0 0.6rem; flex-shrink: 0;
  font-size: 0.78rem; color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
  border: none; background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  transition: color 0.15s;
}
.tab-close-all:hover { color: #EF4444; }

/* Title bookmark star */
.title-bookmark-star {
  cursor: pointer; margin-left: 0.5rem;
  color: var(--text-muted); font-size: 0.85em;
  transition: color 0.2s;
}
.title-bookmark-star:hover { color: #ffc600; }
.title-bookmark-star.active { color: #ffc600; }

.main-content {
  grid-row: 3; grid-column: 2;
  background: var(--bg-primary);
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  min-width: 0;
}

/* ═══ Sidebar ═══ */
.sidebar-brand {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.brand-logo { color: var(--accent); font-size: 1.4rem; }
.brand-text {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}
.brand-img { height: 22px; max-width: 140px; width: auto; object-fit: contain; }
.brand-img-mini { display: none; }
.app-layout.sidebar-collapsed .brand-img-mini { display: block; height: 24px; max-width: 36px; margin: 0 auto; }
.app-layout.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0.8rem 0.5rem; flex-wrap: wrap; gap: 0.3rem; }
.app-layout.sidebar-collapsed .sidebar-toggle-top { margin-left: 0; }
.sidebar-toggle-top {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.sidebar-toggle-top:hover { color: var(--accent); }

.sidebar-nav { padding: 0.5rem 0; }

.sidebar-section-title {
  padding: 0.75rem 1.25rem 0.4rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-menu-item { position: relative; }

.sidebar-menu-item > a,
.sidebar-menu-item > button {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-align: left;
}

.sidebar-menu-item > a:hover,
.sidebar-menu-item > button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-menu-item.active > a {
  background: var(--bg-hover);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: calc(1.25rem - 3px);
  font-weight: 600;
}

.menu-icon { width: 18px; text-align: center; font-size: 0.85rem; }
.menu-label { flex: 1; }

.sidebar-submenu {
  display: none;
  background: var(--bg-primary);
  padding: 0.25rem 0;
}
.sidebar-menu-item.open > .sidebar-submenu { display: block; }
.sidebar-menu-item.open > button i:last-child { transform: rotate(180deg); }

.sidebar-submenu a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 2.75rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: all 0.15s ease;
}
.sidebar-submenu a:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-submenu a.active {
  color: var(--accent);
  background: var(--bg-hover);
  font-weight: 600;
}

.bookmark-star {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  font-size: 0.78rem;
  color: #cbd5e1;
  opacity: 0.72;
  transition: all 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-submenu a:hover .bookmark-star { opacity: 1; color: #fbbf24; }
.sidebar-submenu a:hover .bookmark-star:not(.active) { transform: scale(1.08); }
.bookmark-star.active { opacity: 1 !important; color: #ffc600; }
.bookmark-star:hover { color: #ffc600; opacity: 1 !important; }
[data-theme="white"] .bookmark-star {
  color: #64748b;
  opacity: 0.62;
}

/* ═══ Navbar ═══ */
.navbar-left, .navbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
/* 좁은 화면: navbar 버튼 텍스트 숨기고 아이콘만 */
@media (max-width: 900px) {
  .navbar-right { gap: 0.4rem; }
  .navbar-right .wezard-btn span,
  .navbar-right .user-info span,
  .navbar-right #themeLabel { display: none; }
  .navbar-right .user-info { padding: 0.35rem; }
  .navbar-right .wezard-btn { padding: 0.3rem 0.5rem; }
}

.breadcrumb {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  border-radius: 18px;
  background: var(--bg-tertiary);
  font-size: 0.8rem;
  color: var(--text-primary);
  transition: background 0.15s;
}
.user-info:hover { background: var(--bg-hover); }

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline { background: transparent; }

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-lg { padding: 0.6rem 1.2rem; font-size: 0.9rem; }

/* ═══ Cards ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.9rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
}
.kpi-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}
.kpi-delta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
a.kpi-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.kpi-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}
a.kpi-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.06);
}

/* ═══ 공통 Alert/Confirm 모달 (window.alert·wzConfirm) ═══ */
.wz-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.18s ease;
  backdrop-filter: blur(2px);
}
.wz-modal-overlay.open { opacity: 1; }
.wz-modal-box {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  width: 440px;
  max-width: 92vw;
  padding: 1.35rem 1.5rem 1.1rem;
  transform: translateY(-8px) scale(0.97);
  transition: transform 0.18s ease;
  font-family: inherit;
}
.wz-modal-overlay.open .wz-modal-box { transform: none; }
.wz-modal-head {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.55rem;
}
.wz-modal-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.wz-modal-icon.info    { background: rgba(59,130,246,0.15);  color: #60A5FA; }
.wz-modal-icon.success { background: rgba(34,197,94,0.15);   color: #22C55E; }
.wz-modal-icon.warning { background: rgba(245,158,11,0.18);  color: #F59E0B; }
.wz-modal-icon.error   { background: rgba(239,68,68,0.18);   color: #EF4444; }
.wz-modal-icon.question{ background: rgba(139,92,246,0.15);  color: #A78BFA; }
.wz-modal-title {
  font-size: 1rem; font-weight: 700; flex: 1;
  color: var(--text-primary);
}
.wz-modal-body {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1.1rem;
  max-height: 50vh;
  overflow-y: auto;
}
.wz-modal-actions {
  display: flex; justify-content: flex-end; gap: 0.5rem;
}
.wz-modal-actions .btn { min-width: 78px; }
.wz-modal-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 0.5rem;
}

/* ═══ Tables ═══ */





/* ═══ Forms ═══ */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

/* ═══ Badges ═══ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-warning { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(96, 165, 250, 0.15); color: var(--info); }
.badge-muted { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ═══ Login ═══ */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.login-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.login-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.7rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

/* ═══ Kanban ═══ */
.kanban-board {
  display: grid;
  grid-auto-columns: minmax(260px, 1fr);
  grid-auto-flow: column;
  gap: 0.9rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}
.kanban-column {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 400px;
}
.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.6rem;
  margin-bottom: 0.7rem;
  border-bottom: 2px solid var(--accent);
}
.kanban-column-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}
.kanban-count {
  background: var(--accent);
  color: var(--accent-text);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
}
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8rem;
  margin-bottom: 0.6rem;
  cursor: grab;
  transition: all 0.15s ease;
}
.kanban-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--shadow);
}
.kanban-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}
.kanban-card-customer {
  font-size: 0.73rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.kanban-card-amount {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}
.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ═══ Utilities ═══ */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* ============================================================
   SF UI Standard Final Overrides
   design.md 기준 공통 일괄 보정
   ============================================================ */

html, body {
  font-size: 15px;
}

body,
input,
select,
textarea,
button,
table {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.page-title {
  font-size: 1.4rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.015em;
}

.page-subtitle {
  font-size: 1rem !important;
  font-weight: 400;
  color: var(--text-secondary);
}

.card-title,
.kanban-column-title,
.kanban-card-title {
  font-weight: 700 !important;
}

.card-title {
  font-size: 1.1rem !important;
}

.breadcrumb,
.menu-label,
.form-control,
label,
.text-muted,
.text-secondary {
  font-size: 1rem !important;
}

.sidebar-section-title {
  font-size: 1rem !important;
  font-weight: 700 !important;
}

.sidebar-menu-item > a,
.sidebar-menu-item > button,
.sidebar-submenu a {
  font-size: 1rem !important;
}

.sidebar-menu-item > a,
.sidebar-menu-item > button {
  padding: 0.55rem 1.25rem !important;
}

.sidebar-submenu a {
  padding: 0.45rem 2.75rem !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.45rem 0.85rem;
  font-size: 1rem !important;
  font-weight: 600 !important;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.btn-lg {
  min-height: 40px;
  padding: 0.6rem 1.2rem;
  font-size: 1rem !important;
}

.btn-sm {
  min-height: 30px;
  padding: 0.3rem 0.6rem;
  font-size: 1rem !important;
}

.btn-default {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #334155;
}

.btn-default:hover {
  background: #E2E8F0;
  border-color: #94A3B8;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}

.btn-success:hover {
  filter: brightness(0.96);
}

.btn-info {
  background: #64748B;
  border-color: #64748B;
  color: #FFFFFF;
}

.btn-info:hover {
  background: #475569;
  border-color: #475569;
}

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: #FFFFFF;
}

.btn-warning:hover {
  filter: brightness(0.96);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}

.btn-danger:hover {
  filter: brightness(0.96);
}

.btn-outline-default,
.btn-outline-primary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-danger {
  background: transparent;
  border-width: 1px;
  border-style: solid;
}

.btn-outline-default {
  border-color: #CBD5E1;
  color: #334155;
}

.btn-outline-primary {
  border-color: #3B82F6;
  color: #3B82F6;
}

.btn-outline-success {
  border-color: var(--success);
  color: var(--success);
}

.btn-outline-info {
  border-color: #64748B;
  color: #64748B;
}

.btn-outline-warning {
  border-color: var(--warning);
  color: var(--warning);
}

.btn-outline-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-outline-default:hover,
.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-info:hover,
.btn-outline-warning:hover,
.btn-outline-danger:hover {
  background: var(--bg-hover);
}

.btn-rounded {
  border-radius: 20px !important;
}

.btn-icon {
  width: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 50% !important;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  margin-bottom: 0.35rem;
  font-size: 1rem !important;
  font-weight: 600;
}

.form-control,
input.form-control,
select.form-control,
textarea.form-control {
  min-height: 34px;
  padding: 0.4rem 0.6rem;
  font-size: 1rem !important;
  border: 1.5px solid var(--border);
  border-radius: 6px;
}

textarea.form-control {
  min-height: 90px;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.15) !important;
  outline-offset: 0;
}

.input-icon-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-group > i:first-child {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.input-icon-group .form-control {
  padding-left: 2.2rem !important;
}













.badge,
.status-chip,
.filter-chip,
.cat-chip,
.risk-chip {
  font-size: 1rem !important;
  font-weight: 700 !important;
}

.badge {
  padding: 2px 7px;
  border-radius: 4px;
}

.card {
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.kpi-grid {
  gap: 1rem;
}

.kpi-card {
  border-radius: 8px;
  padding: 1.1rem;
}

a.kpi-card:hover {
  transform: translateY(-2px);
}

.wz-modal-box {
  width: 440px;
  max-width: 92vw;
  border-radius: 12px;
}

.wz-modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.wz-modal-body {
  font-size: 1rem;
}

.wz-modal-actions,
.wz-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.page-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.8rem;
}

[data-theme="dark"] select,
[data-theme="dark"] select option {
  background-color: #1e293b;
  color: #e2e8f0;
}
[data-theme="dark"] select option:checked {
  background-color: #3b82f6;
  color: #fff;
}

/* PTC 이동 버튼: 라이트 테마(white/earth)는 진한 파랑, 다크 테마는 옅은 흰색 */
.ptc-btn,
.ptc-btn span,
.ptc-btn i { color: #1D4ED8; }
[data-theme="dark"] .ptc-btn,
[data-theme="dark"] .ptc-btn span,
[data-theme="dark"] .ptc-btn i { color: #E5E7EB; }

/* 반응형 2단 그리드 공통 유틸 (1fr 1fr → 모바일 1열). 본문 2단 인라인 그리드 대체용. gap/margin은 인라인 유지 */
.grid-2-resp { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid-2-resp { grid-template-columns: 1fr; } }

/* ── 인라인 style → 공통 유틸 (퍼블리싱 1번, 사점팔_2). 인라인과 동일 우선순위 보장 위해 !important ── */
.u-tac { text-align: center !important; }
.u-tar { text-align: right !important; }
.u-muted { color: var(--text-muted) !important; }
.u-flex1 { flex: 1 !important; }
.u-ovx { overflow-x: auto !important; }
.u-fs78 { font-size: 0.78rem !important; }
.u-fs82 { font-size: 0.82rem !important; }
.u-fs80 { font-size: 0.8rem !important; }
.u-fw6 { font-weight: 600 !important; }
.u-mt1 { margin-top: 1rem !important; }
.u-mt05 { margin-top: 0.5rem !important; }
.u-mb08 { margin-bottom: 0.8rem !important; }
.u-mb06 { margin-bottom: 0.6rem !important; }
.u-pl12 { padding-left: 1.2rem !important; }
.u-tp { color: var(--text-primary) !important; }
.u-w150 { width: 150px !important; }
.u-w140 { width: 140px !important; }
.u-w120 { width: 120px !important; }


/* ============================================================
   화면명 옆 사용자 매뉴얼 버튼 (base.html 이 JS 로 심는다)

   도움말은 거들 뿐이라 제목보다 먼저 눈에 들어오면 안 된다. 속을 비우고
   테두리로만 그리고 평소에는 물러나 있다가, 누르러 가면 채워지며 또렷해진다.
   색을 currentColor 로 두는 이유가 있다 — 제목 색을 그대로 물려받으므로
   다크·라이트에 규칙을 따로 두지 않아도 맞는다. 배경을 흰색으로 못 박으면
   기본 테마(다크)에서 하얀 점이 튄다.
   ============================================================ */
.page-title { display: inline-flex; align-items: center; }
.crm-help-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; margin-left: 0.5rem; flex: 0 0 auto;
  border: 1px solid currentColor; border-radius: 50%; cursor: pointer;
  background-color: transparent; color: inherit; opacity: 0.4;
  font-size: 0.66rem; font-weight: 700; line-height: 1;
  vertical-align: middle; text-decoration: none;
  transition: opacity 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
}
.crm-help-btn:hover,
.crm-help-btn:focus {
  opacity: 1; background-color: var(--info);
  border-color: var(--info); color: #fff; text-decoration: none;
}
/* 글자 ? 를 원 안에 정확히 앉힌다 */
.crm-help-btn span { display: block; transform: translateY(0.2px); }
