/* =========================================================
   쇼핑몰 OS - High-End Minimalist Workspace Design System
   Tailored for Synology NAS Ledger & Ads Automation Integration
   ========================================================= */

:root {
  /* 배경 팔레트 */
  --bg-app: #F7F6F3;
  --bg-main: #FAFAF9;
  --bg-sidebar: #F1F0ED;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #F8F8F7;
  --bg-active: #EAE9E5;
  --bg-subtle: #F4F3F0;

  /* 테두리 */
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-card: #E8E7E3;
  --border-focus: #2E2D29;

  /* 타이포그래피 */
  --text-main: #2A2926;
  --text-secondary: #6B6965;
  --text-tertiary: #96948F;
  --text-link: #1A73E8;

  /* 지표 및 구조 컬러 (정제된 톤) */
  --color-profit: #0F7B6C;
  --color-profit-bg: #E8F5F1;
  --color-ad: #635BFF;
  --color-ad-bg: #F0EFFF;
  --color-cost: #E37426;
  --color-cost-bg: #FDF3EB;
  --color-fee: #787774;
  --color-fee-bg: #EFEFED;

  --color-danger: #D44C47;
  --color-danger-bg: #FDF0ED;
  --color-warn: #CB8B18;
  --color-warn-bg: #FDF8ED;

  /* 그림자 & 라운딩 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 3px 8px rgba(0, 0, 0, 0.05), 0 10px 24px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 48px rgba(0, 0, 0, 0.16);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --sidebar-width: 250px;
  --topbar-height: 48px;
  --font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  color: var(--text-main);
  background-color: var(--bg-app);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.os-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  background-color: var(--bg-app);
}

/* =========================================================
   1. 사이드바 & 노션 트리 아코디언
   ========================================================= */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  z-index: 20;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workspace-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-icon-box {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background-color: #FFFFFF;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
}

.workspace-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.workspace-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 10px 6px 10px;
}

.nav-list {
  list-style: none;
  margin-bottom: 8px;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.nav-link:hover {
  background-color: var(--bg-active);
  color: var(--text-main);
}

.nav-item.active > .nav-link {
  background-color: #FFFFFF;
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.nav-icon {
  font-size: 15px;
  line-height: 1;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dot-active {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--color-profit);
}

.badge-link {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--text-tertiary);
  font-weight: 500;
}

/* --- 아코디언 트리 그룹 스타일 --- */
.nav-group {
  margin-bottom: 4px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  position: relative;
}

.btn-tree-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  margin-right: 2px;
}

.btn-tree-toggle:hover {
  background-color: var(--bg-active);
  color: var(--text-main);
}

.arrow-icon {
  transition: transform 0.2s ease;
  transform: rotate(-90deg);
}

.nav-group.open .arrow-icon {
  transform: rotate(0deg);
}

.group-main-link {
  flex: 1;
  padding-left: 4px;
}

/* 하위 메뉴 리스트 */
.nav-sub-list {
  list-style: none;
  display: none;
  padding-left: 20px;
  margin-top: 2px;
  margin-bottom: 4px;
  position: relative;
}

.nav-sub-list::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 4px;
  bottom: 6px;
  width: 1px;
  background-color: #E2E1DD;
}

.nav-group.open .nav-sub-list {
  display: block;
}

.sub-item {
  margin-bottom: 1px;
}

.sub-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-link:hover {
  background-color: var(--bg-active);
  color: var(--text-main);
}

.sub-item.active .sub-link {
  background-color: #FFFFFF;
  color: var(--color-ad);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.sub-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--text-tertiary);
  transition: background-color 0.15s ease;
}

.sub-item.active .sub-dot {
  background-color: var(--color-ad);
}

.sub-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border-subtle);
}

.btn-settings {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.btn-settings:hover {
  background-color: var(--bg-active);
}

.footer-icon {
  font-size: 16px;
}

.footer-main {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: block;
}

.footer-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  display: block;
}

/* =========================================================
   2. 상단 탭 바
   ========================================================= */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background-color: var(--bg-main);
}

.top-bar {
  height: var(--topbar-height);
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  user-select: none;
  z-index: 10;
}

.tab-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}
.tab-strip::-webkit-scrollbar {
  display: none;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  background-color: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  max-width: 240px;
}

.tab-item:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.tab-item.active {
  background-color: var(--bg-main);
  border-color: var(--border-card);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  margin-left: 2px;
  font-size: 10px;
  color: var(--text-tertiary);
  transition: all 0.1s ease;
}

.tab-close:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-profit);
  box-shadow: 0 0 0 2px rgba(15, 123, 108, 0.2);
}

.btn-icon-subtle {
  background: none;
  border: 1px solid var(--border-subtle);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.btn-icon-subtle:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-card);
}

/* =========================================================
   3. 뷰 컨테이너 (정확한 show/hide 제어)
   ========================================================= */
.view-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view-pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: none !important;
}

.view-pane.active {
  display: block !important;
}

/* iframe 뷰어는 active일 때 flex로 정확하게 전환! */
#iframeView.active {
  display: flex !important;
  flex-direction: column;
}

.dashboard-scroll-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 36px 64px 36px;
}

.dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.breadcrumb-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-profit);
  background-color: var(--color-profit-bg);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}

.tag-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--color-profit);
}

.hero-title {
  font-size: 25px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.hero-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.period-button-group {
  display: flex;
  background-color: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  gap: 2px;
}

.btn-period {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-period:hover {
  color: var(--text-main);
}

.btn-period.active {
  background-color: #FFFFFF;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* =========================================================
   4. 핵심 KPI 카드 4종
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: all 0.18s ease;
  min-height: 134px;
}

.kpi-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #D6D5D0;
  transform: translateY(-2px);
}

.kpi-card.highlight-profit {
  border-color: #A9DFD5;
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FAF8 100%);
  box-shadow: 0 2px 10px rgba(15, 123, 108, 0.09);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calc-formula {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background-color: var(--color-profit-bg);
  color: var(--color-profit);
}

.source-chip {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 500;
}

.chip-profit {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-profit-bg);
  color: var(--color-profit);
}

.kpi-main-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text-main);
  font-feature-settings: "tnum";
}

.profit-color { color: var(--color-profit); }
.text-ad { color: var(--color-ad); }
.text-cost { color: var(--color-cost); }
.text-fee { color: var(--color-fee); }
.text-danger { color: var(--color-danger); }

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
}

.kpi-trend.positive { color: var(--color-profit); }
.kpi-trend.neutral { color: var(--text-secondary); }

.kpi-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-tertiary);
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}

.footer-meta strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.status-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.status-pill.safe {
  background-color: var(--color-profit-bg);
  color: var(--color-profit);
}

.mini-gauge-track {
  width: 100%;
  height: 5px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.mini-gauge-bar {
  height: 100%;
  background-color: var(--color-profit);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* =========================================================
   5. 손익 브릿지 카드
   ========================================================= */
.breakdown-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.breakdown-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background-color: #E8EDF2;
  color: #3B5A75;
}

.breakdown-title-group h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.breakdown-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.color-profit { background-color: var(--color-profit); }
.legend-dot.color-ad { background-color: var(--color-ad); }
.legend-dot.color-cost { background-color: var(--color-cost); }
.legend-dot.color-fee { background-color: var(--color-fee); }

.stacked-bar-container {
  width: 100%;
  margin-bottom: 16px;
}

.stacked-bar {
  width: 100%;
  height: 12px;
  border-radius: var(--radius-full);
  display: flex;
  overflow: hidden;
  background-color: var(--bg-subtle);
}

.bar-segment {
  height: 100%;
  transition: width 0.3s cubic-bezier(0.2, 0, 0, 1);
}
.seg-profit { background-color: var(--color-profit); }
.seg-ad { background-color: var(--color-ad); }
.seg-cost { background-color: var(--color-cost); }
.seg-fee { background-color: var(--color-fee); }

.bridge-steps-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bridge-step {
  flex: 1;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bridge-step.highlight-ad {
  background-color: var(--color-ad-bg);
  border-color: #D3CEFD;
}

.bridge-step.highlight-final {
  background-color: var(--color-profit-bg);
  border-color: #B2E3D8;
}

.step-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
}

.step-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.step-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  font-feature-settings: "tnum";
}

.step-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bridge-arrow {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-tertiary);
  padding: 0 2px;
}

/* =========================================================
   6. 하단 2단 레이아웃
   ========================================================= */
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}

.sub-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}

.sub-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.sub-panel-header h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.panel-caption {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.channel-item {
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
}

.channel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.channel-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

.channel-badge.naver {
  background-color: #E7F8ED;
  color: #03CF5D;
}

.channel-badge.owner {
  background-color: #F0F2FD;
  color: #3B5AFF;
}

.channel-share {
  font-size: 12px;
  color: var(--text-tertiary);
}

.channel-margin {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-profit);
}

.channel-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.channel-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

.c-bar-label {
  width: 28px;
  color: var(--text-tertiary);
}

.c-bar-track {
  flex: 1;
  height: 6px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.c-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

.fill-sales { background-color: #3B5AFF; }
.fill-profit { background-color: var(--color-profit); }

.c-bar-val {
  width: 90px;
  text-align: right;
  font-weight: 600;
  color: var(--text-main);
  font-feature-settings: "tnum";
}

.sim-inner-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sim-slider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sim-slider-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.slider-marks {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.sim-result-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sim-res-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.sim-res-row.final {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.sim-res-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 0;
}

.sim-res-badge-wrap {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}

.sim-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-profit-bg);
  color: var(--color-profit);
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: #DDDCD7;
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid var(--color-ad);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: grab;
}

/* =========================================================
   7. 연동된 부서별 웹 카드 그리드
   ========================================================= */
.quick-apps-section {
  margin-top: 8px;
}

.section-header {
  margin-bottom: 12px;
}

.section-heading {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.section-subtext {
  font-size: 12px;
  color: var(--text-tertiary);
}

.app-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.app-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: var(--shadow-card);
}

.app-card:hover {
  border-color: #C8C7C2;
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.app-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.app-card-body {
  flex: 1;
}

.app-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.app-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 5px;
}

.app-card-url {
  font-size: 11px;
  color: var(--text-link);
  word-break: break-all;
}

/* =========================================================
   8. 사파리/크롬 상단 툴바 (iframeView)
   ========================================================= */
.browser-navbar {
  height: 40px;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.browser-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.browser-dot.red { background-color: #FF5F56; }
.browser-dot.yellow { background-color: #FFBD2E; }
.browser-dot.green { background-color: #27C93F; }

.browser-address-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  width: 500px;
  max-width: 50vw;
  overflow: hidden;
}

.address-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-actions {
  display: flex;
  gap: 6px;
}

.btn-browser-tool {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-browser-tool:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.iframe-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: calc(100% - 40px);
}

#appFrame {
  width: 100%;
  height: 100%;
  border: none;
}

.frame-empty-state {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-card {
  text-align: center;
  max-width: 380px;
  padding: 32px 24px;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
}

.empty-icon-halo {
  font-size: 42px;
  margin-bottom: 12px;
}

.empty-card h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.btn-empty-action {
  background-color: var(--text-main);
  color: #FFFFFF;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* =========================================================
   9. 설정 모달
   ========================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(20, 20, 20, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-sheet {
  width: 540px;
  max-width: 90vw;
  background-color: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-card);
  overflow: hidden;
  animation: modalScaleUp 0.15s ease-out;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.modal-title-box h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
}

.form-row input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.btn-secondary {
  background: none;
  border: 1px solid var(--border-card);
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-save {
  background-color: var(--text-main);
  color: #FFFFFF;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-xs);
}

/* =========================================================
   9. 순수 공헌이익 관제탑 & 상품별 마진 방어 테이블
   ========================================================= */
.sync-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 8px;
  background-color: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.period-guide-note {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.4;
}

.period-guide-note .guide-icon {
  font-size: 14px;
}

.btn-sync-action {
  background: #FFFFFF;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xs);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.btn-sync-action:hover {
  background-color: var(--bg-main);
  border-color: var(--border-strong);
}

.product-cm-panel {
  margin-bottom: 24px;
}

.panel-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.defense-status-summary {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-profit);
  background-color: var(--color-profit-bg);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  background-color: #FFFFFF;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.data-table th {
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-card);
  background-color: var(--bg-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: rgba(0, 0, 0, 0.015);
}

.product-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-cell-name {
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  max-width: 380px;
  white-space: normal;
}

.product-cell-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

.profit-pill-sm {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
  font-weight: 600;
}
.profit-pill-sm.positive {
  background-color: var(--color-profit-bg);
  color: var(--color-profit);
}
.profit-pill-sm.negative {
  background-color: #FDE8E8;
  color: #C81E1E;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.safe {
  background-color: #DEF7EC;
  color: #03543F;
}
.status-pill.warn {
  background-color: #FEF08A;
  color: #713F12;
}
.status-pill.danger {
  background-color: #FDE8E8;
  color: #9B1C1C;
}

.text-danger {
  color: #C81E1E !important;
}
.text-profit {
  color: var(--color-profit) !important;
}
.text-ad {
  color: #D9730D !important;
}
.text-cost {
  color: var(--text-secondary) !important;
}

.hidden { display: none !important; }

@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-bottom-grid { grid-template-columns: 1fr; }
  .bridge-steps-grid { flex-wrap: wrap; }
  .app-card-grid { grid-template-columns: 1fr; }
}
/* =========================================================
   4대 업무 시스템 실시간 파이프라인 통합 관제 매트릭스
   ========================================================= */
.ops-matrix-panel {
  margin-top: 24px;
}
.ops-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-profit);
  background-color: var(--color-profit-bg);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}
.ops-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.ops-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.ops-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: #D1D0CB;
}
.ops-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.ops-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background-color: var(--bg-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.ops-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ops-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ops-sub {
  font-size: 10.5px;
  color: var(--text-tertiary);
  font-family: monospace;
}
.ops-status-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background-color: var(--color-profit-bg);
  color: var(--color-profit);
  white-space: nowrap;
}
.ops-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  flex: 1;
}
.ops-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
}
.ops-stat-label {
  color: var(--text-secondary);
}
.ops-stat-val {
  font-weight: 600;
  color: var(--text-main);
}
.ops-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.btn-ops-link {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-card);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-ops-link:hover {
  background-color: #2A2926;
  color: #FFFFFF;
  border-color: #2A2926;
}

@media (max-width: 1200px) {
  .ops-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 680px) {
  .ops-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   7. 맞춤형 드래그 앤 드롭 위젯 그리드 엔진
   ========================================================= */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  min-height: 250px;
  margin-bottom: 30px;
}

.widget-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.widget-card.col-12 {
  grid-column: span 12;
}

.widget-card.col-6 {
  grid-column: span 6;
}

.widget-card.col-4 {
  grid-column: span 4;
}

@media (max-width: 1100px) {
  .widget-card.col-6,
  .widget-card.col-4 {
    grid-column: span 12;
  }
}

/* 드래그 상태 시각화 */
.widget-card.is-dragging {
  opacity: 0.35;
  transform: scale(0.98);
  border: 2px dashed #4F46E5 !important;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.15);
}

.widget-card.drag-over {
  border-color: #4F46E5 !important;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.4), var(--shadow-hover);
  transform: translateY(-2px);
}

/* 위젯 카드 헤더 */
.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.widget-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-tertiary);
  cursor: grab;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
  line-height: 1;
}

.drag-handle:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.drag-handle:active {
  cursor: grabbing;
}

.widget-cat-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.widget-cat-tag.financial { color: #057A55; background: #DEF7EC; border-color: #BCF0DA; }
.widget-cat-tag.marketing { color: #1C64F2; background: #E1EFFE; border-color: #B4C6FC; }
.widget-cat-tag.security { color: #9061F9; background: #EDEBFE; border-color: #DCD7FE; }
.widget-cat-tag.seo { color: #D97706; background: #FEF3C7; border-color: #FDE68A; }
.widget-cat-tag.logistics { color: #0E9F6E; background: #DEF7EC; border-color: #BCF0DA; }
.widget-cat-tag.control { color: #4F46E5; background: #EEF2FF; border-color: #C7D2FE; }

.widget-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.widget-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-widget-remove {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-widget-remove:hover {
  background-color: #FDE8E8;
  color: #E02424;
}

.widget-body {
  padding: 18px 20px;
  flex: 1;
}

/* =========================================================
   8. 위젯 카탈로그 모달
   ========================================================= */
.catalog-modal-dialog {
  max-width: 880px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.catalog-category-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  background-color: var(--bg-subtle);
}

.catalog-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.catalog-tab.active {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-card);
  box-shadow: var(--shadow-sm);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 20px 24px;
  overflow-y: auto;
  max-height: 55vh;
}

@media (max-width: 768px) {
  .catalog-grid {
    grid-template-columns: 1fr;
  }
}

.catalog-item-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.catalog-item-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.catalog-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.catalog-item-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.catalog-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.catalog-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 12px;
  flex: 1;
}

.catalog-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.catalog-source-tag {
  font-size: 10.5px;
  font-family: monospace;
  color: var(--text-tertiary);
}

.btn-toggle-widget {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-widget.add {
  background-color: #2A2926;
  color: #FFFFFF;
  border: 1px solid #2A2926;
}

.btn-toggle-widget.add:hover {
  background-color: #000000;
}

.btn-toggle-widget.active {
  background-color: var(--color-profit-bg);
  color: var(--color-profit);
  border: 1px solid var(--color-profit-border);
}

/* =========================================================
   9. 위젯 전용 세부 컴포넌트 스타일
   ========================================================= */
.widget-stream-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stream-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
}

.stream-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stream-code {
  font-family: monospace;
  font-weight: 600;
  color: var(--text-main);
}

.stream-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

.widget-rank-table,
.widget-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.widget-rank-table th,
.widget-data-table th {
  text-align: left;
  padding: 7px 10px;
  color: var(--text-tertiary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.widget-rank-table td,
.widget-data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.widget-rank-table tr:last-child td,
.widget-data-table tr:last-child td {
  border-bottom: none;
}

.rank-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
}
.rank-badge-pill.top { background-color: #DEF7EC; color: #03543F; }
.rank-badge-pill.mid { background-color: #FEF08A; color: #713F12; }

.alert-item-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border-card);
}
.alert-item-box.warn { background-color: #FFFBEB; border-color: #FDE68A; }
.alert-item-box.safe { background-color: #F0FDF4; border-color: #BBF7D0; }
.alert-item-box.info { background-color: #EFF6FF; border-color: #BFDBFE; }
.alert-icon { font-size: 16px; line-height: 1.2; }
.alert-content { flex: 1; }
.alert-title { font-size: 12.5px; font-weight: 700; color: var(--text-main); margin-bottom: 2px; }
.alert-desc { font-size: 11.5px; color: var(--text-secondary); }

.quick-launcher-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 900px) {
  .quick-launcher-grid { grid-template-columns: repeat(2, 1fr); }
}
.quick-launcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}
.quick-launcher-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-card);
  transform: translateY(-1px);
}
.quick-launcher-icon { font-size: 16px; }
.quick-launcher-title { font-size: 12px; font-weight: 600; color: var(--text-main); }


/* ========================================================= */
/* 추가 커스텀 비즈니스 웹 서비스 관리 스타일 */
/* ========================================================= */
.nav-section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 6px 12px;
}
.nav-section-title-wrap .nav-section-title {
  padding: 0 !important;
}
.btn-section-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.btn-section-add:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-card);
}

.custom-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}
.custom-nav-item:hover {
  background: var(--bg-hover);
}
.custom-nav-item.active {
  background: var(--bg-active);
}
.custom-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  padding: 0;
}
.custom-nav-item.active .custom-nav-link {
  color: var(--text-main);
  font-weight: 600;
}
.custom-nav-badge {
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* 설정 모달 내 커스텀 서비스 관리 섹션 */
.custom-services-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}
.custom-section-header {
  margin-bottom: 14px;
}
.custom-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.custom-tag {
  font-size: 11px;
  font-weight: 600;
  color: #8b5cf6;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  padding: 1px 6px;
  border-radius: 4px;
}
.custom-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}
.custom-section-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  display: block;
}

.add-custom-service-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
}
.custom-inputs-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.custom-inputs-row .input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.custom-inputs-row .input-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.custom-inputs-row .input-group input {
  height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: #fff;
  font-size: 12.5px;
  color: var(--text-main);
  outline: none;
}
.custom-inputs-row .input-group input:focus {
  border-color: #3b82f6;
}
.icon-input-group { width: 60px; }
.icon-input-group input { text-align: center; font-size: 16px; }
.title-input-group { width: 170px; }
.url-input-group { flex: 1; min-width: 200px; }
.btn-add-custom-action {
  height: 36px;
  padding: 0 16px;
  background: #0f172a;
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}
.btn-add-custom-action:hover {
  background: #1e293b;
}

.list-subhead {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.custom-services-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.custom-service-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}
.custom-service-item-row:hover {
  border-color: var(--border-card);
  background: var(--bg-hover);
}
.custom-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.custom-item-icon {
  font-size: 18px;
  line-height: 1;
}
.custom-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.custom-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.custom-item-url {
  font-size: 11.5px;
  color: var(--text-tertiary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.btn-delete-custom {
  background: none;
  border: 1px solid transparent;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.btn-delete-custom:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}
.empty-custom-notice {
  padding: 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-xs);
}


/* =========================================================
   12. 통장관리 x 매출 x 광고 결합 금융 위젯 스타일링
   ========================================================= */

/* 1. 자금 유동성 & 결제 방어선 위젯 (col-12) */
.liquidity-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.liquidity-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.liquidity-stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.liquidity-stat-card.operating {
  border-left: 3px solid #3b82f6;
}
.liquidity-stat-card.reserve {
  border-left: 3px solid #10b981;
}
.liquidity-stat-card.total {
  border-left: 3px solid #8b5cf6;
}
.liquidity-stat-card.outflow {
  border-left: 3px solid #ef4444;
}
.liquidity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.liquidity-card-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.liquidity-card-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.liquidity-card-badge.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.liquidity-card-badge.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.liquidity-card-badge.purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}
.liquidity-card-badge.red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.liquidity-card-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.liquidity-card-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* 방어선 프로그레스 게이지 */
.defense-gauge-section {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.defense-gauge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.defense-gauge-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}
.defense-gauge-val {
  font-size: 13px;
  font-weight: 700;
}
.defense-gauge-val.warn {
  color: #f59e0b;
}
.defense-gauge-val.safe {
  color: #10b981;
}
.defense-progress-track {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
}
.defense-progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.defense-progress-bar.warn {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}
.defense-progress-bar.safe {
  background: linear-gradient(90deg, #3b82f6, #10b981);
}
.defense-gauge-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* 방어 알림 배너 */
.defense-alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 12px;
  line-height: 1.45;
  color: #d97706;
}
.defense-alert-banner.danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #dc2626;
}
.defense-alert-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
.defense-alert-text strong {
  color: var(--text-main);
}

/* 2. 5대 계좌 포트폴리오 & 이체 가이드 */
.accounts-portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.account-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}
.account-row-item:hover {
  border-color: var(--border-card);
  background: var(--bg-card);
}
.account-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-badge-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-weight: 500;
}
.account-name-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.account-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.account-balance-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}
.account-ratio-text {
  font-size: 11px;
  color: var(--text-tertiary);
  width: 38px;
  text-align: right;
}

/* 스마트 이체 가이드 카드 */
.transfer-guide-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.transfer-guide-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  background: rgba(59, 130, 246, 0.06);
  border: 1px dashed rgba(59, 130, 246, 0.3);
  font-size: 12px;
}
.transfer-direction {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-main);
}
.transfer-amount-chip {
  font-size: 12.5px;
  font-weight: 700;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}
.transfer-reason {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* 3. 7일 자금 D-Day 타임라인 */
.cashflow-timeline-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cashflow-timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}
.cashflow-timeline-row:hover {
  border-color: var(--border-card);
  background: var(--bg-card);
}
.timeline-meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.timeline-date-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  white-space: nowrap;
}
.timeline-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}
.timeline-item-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}
.timeline-amount-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.timeline-amount-text {
  font-size: 13px;
  font-weight: 700;
}
.timeline-amount-text.outflow {
  color: #ef4444;
}
.timeline-amount-text.inflow {
  color: #10b981;
}
.timeline-badge-tag {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.timeline-badge-tag.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.timeline-badge-tag.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.timeline-badge-tag.safe {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* 4. 광고비 감당 능력 & 런웨이 분석 */
.runway-metrics-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.runway-stat-box {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.runway-label {
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.runway-val-highlight {
  font-size: 22px;
  font-weight: 800;
  color: #10b981;
  letter-spacing: -0.02em;
}
.runway-val-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==========================================================================
   DB 산출 근거 & 실측 검증기 (Audit & Trust Inspector) 스타일
   ========================================================================== */
.btn-sync-action.audit-action {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border-color: rgba(14, 165, 233, 0.3);
  font-weight: 600;
  margin-left: 6px;
}
.btn-sync-action.audit-action:hover {
  background: rgba(14, 165, 233, 0.22);
  color: #0369a1;
}

.audit-modal-dialog {
  width: 1040px !important;
  max-width: 95vw !important;
  max-height: 90vh !important;
  display: flex;
  flex-direction: column;
}

.modal-icon-badge.audit-badge {
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
}

.audit-tabs-bar {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-card);
  overflow-x: auto;
}

.audit-tab-btn {
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.audit-tab-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.audit-tab-btn.active {
  background: var(--bg-card);
  border-color: var(--border-card);
  color: #0284c7;
  box-shadow: var(--shadow-sm);
}

.audit-tab-contents {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.audit-tab-pane {
  display: none;
}
.audit-tab-pane.active {
  display: block;
}

.audit-intro-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: #166534;
}
.audit-intro-banner .intro-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* 5대 DB 그리드 */
.audit-db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
}

.audit-db-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.audit-db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.audit-db-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.audit-db-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.audit-db-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  background: #dcfce7;
  color: #15803d;
}
.audit-db-engine {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: monospace;
}

.audit-db-path-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-family: monospace;
  font-size: 11.5px;
  color: var(--text-secondary);
  word-break: break-all;
}

.audit-db-tables-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px dashed var(--border-card);
  padding-top: 10px;
}
.audit-db-table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.audit-tbl-name {
  font-family: monospace;
  color: var(--text-secondary);
  font-weight: 600;
}
.audit-tbl-count {
  color: #0284c7;
  font-weight: 700;
}

.audit-db-responsible {
  font-size: 11.5px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

/* 실측 대조 테이블 */
.audit-table-responsive {
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
}

.audit-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.audit-data-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-card);
  white-space: nowrap;
}
.audit-data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.audit-data-table tr:hover td {
  background: #f1f5f9;
}

.rule-badge {
  display: inline-block;
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 4px;
}

/* SQL 공식 그리드 */
.audit-formulas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 14px;
}
.audit-formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.audit-formula-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.audit-formula-metric {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.audit-formula-source {
  font-size: 11px;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.audit-formula-code {
  background: #1e293b;
  color: #38bdf8;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-family: monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 원시 JSON 뷰어 */
.raw-data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.btn-sm-copy {
  padding: 6px 12px;
  font-size: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 600;
}
.audit-json-viewer {
  background: #0f172a;
  color: #94a3b8;
  padding: 16px;
  border-radius: var(--radius-sm);
  max-height: 500px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  font-family: monospace;
}

