/* ============================================================
   system.css — CHAART OS Design System 전용 스타일
   소스: inspire.html Lines 240-334, 451-754, 755-3844
   생성: 2026-02-16
   ============================================================ */


/* 잔류: Layout Utilities(ch-), b44 Hero, ds-page-hero — 전 파일 공통 */

/* ══════════════════════════════════════════════════════════
   Layout Utilities — ch- 네임스페이스
   와이어프레임 → 구현 시 재사용할 레이아웃 빌딩 블록
   ══════════════════════════════════════════════════════════ */

/* ── Container ── */
.ch-container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-px);
  width: 100%;
}
.ch-container--narrow {
  max-width: var(--content-narrow);
}
.ch-container--wide {
  max-width: var(--content-wide);
}
.ch-container--full {
  max-width: none;
}

/* ── Grid ── */
.ch-grid {
  display: grid;
  gap: var(--grid-gap-md);
}
.ch-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}
.ch-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}
.ch-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}
.ch-grid--auto {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.ch-grid--gap-sm {
  gap: var(--grid-gap-sm);
}
.ch-grid--gap-lg {
  gap: var(--grid-gap-lg);
}
.ch-grid--gap-1 {
  gap: var(--grid-gap-1px);
}

/* ── Flex ── */
.ch-flex {
  display: flex;
  gap: var(--grid-gap-md);
}
.ch-flex--center {
  align-items: center;
  justify-content: center;
}
.ch-flex--between {
  justify-content: space-between;
  align-items: center;
}
.ch-flex--col {
  flex-direction: column;
}
.ch-flex--wrap {
  flex-wrap: wrap;
}
.ch-flex--gap-sm {
  gap: var(--grid-gap-sm);
}
.ch-flex--gap-0 {
  gap: 0;
}

/* ── Stack (Vertical Rhythm) ── */
.ch-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.ch-stack--sm {
  gap: var(--space-3);
}
.ch-stack--lg {
  gap: var(--space-10);
}
.ch-stack--section {
  gap: var(--section-gap);
}

/* ── Page Layouts ── */
.ch-sidebar-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}
.ch-sidebar-layout__sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface-panel);
  border-right: 1px solid var(--border);
}
.ch-sidebar-layout__main {
  overflow-y: auto;
  padding: var(--space-8);
}
.ch-hero-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--content-px);
}

/* ── Section ── */
.ch-section {
  padding: var(--section-gap) 0;
}
.ch-section--sm {
  padding: var(--space-12) 0;
}

/* ── Section Header Bar ── */
/* NOTE: .ch-section-header 는 base.css 에서 정의 (투명 배경, 프리미엄 타이포)
   다크 바 스타일은 .sys-section-hd (dealer.css) 에서 별도 처리
   아래는 Dealer/Artists 헤더 바 전용 클래스 */
.ch-section-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--section-hd-bg);
  color: var(--section-hd-color);
  font-family: var(--section-hd-font);
  font-size: var(--section-hd-size);
  font-weight: var(--section-hd-weight);
  letter-spacing: var(--section-hd-spacing);
  text-transform: uppercase;
  padding: var(--section-hd-py) var(--section-hd-px);
  min-height: var(--section-hd-height);
}
.ch-section-header-bar--sub {
  background: var(--section-hd-bg-sub);
}

/* ── Card Surface ── */
.ch-card {
  background: var(--surface-panel);
  border: 1px solid var(--border);
  padding: var(--card-py) var(--card-px);
  transition: box-shadow var(--dur-normal) var(--ease),
              border-color var(--dur-normal) var(--ease);
}
.ch-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.ch-card--flat {
  border: none;
  box-shadow: none;
}
.ch-card--flat:hover {
  box-shadow: none;
}

/* ── KPI Rail ── */
.ch-kpi-rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--kpi-rail-bg);
}
.ch-kpi-rail__item {
  padding: var(--kpi-rail-py) var(--kpi-rail-px);
  border-right: 1px solid var(--kpi-rail-divider);
}
.ch-kpi-rail__item:last-child {
  border-right: none;
}
.ch-kpi-rail__value {
  font-family: var(--kpi-value-font);
  font-size: var(--kpi-value-size);
  font-weight: var(--kpi-value-weight);
  color: var(--kpi-value-color);
  letter-spacing: var(--kpi-value-spacing);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.ch-kpi-rail__label {
  font-family: var(--kpi-label-font);
  font-size: var(--kpi-label-size);
  color: var(--kpi-label-color);
  letter-spacing: var(--kpi-label-spacing);
  text-transform: uppercase;
}

/* ── DataGrid ── */
.ch-datagrid {
  width: 100%;
  border-collapse: collapse;
}
.ch-datagrid th {
  background: var(--datagrid-header-bg);
  color: var(--datagrid-header-color);
  font-family: var(--datagrid-header-font);
  font-size: var(--datagrid-header-size);
  font-weight: 600;
  letter-spacing: var(--datagrid-header-spacing);
  text-transform: uppercase;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--datagrid-divider);
}
.ch-datagrid td {
  font-family: var(--datagrid-row-font);
  font-size: var(--datagrid-row-size);
  color: var(--text);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--datagrid-divider);
  height: var(--datagrid-row-height);
  vertical-align: middle;
}
.ch-datagrid tr:hover td {
  background: var(--datagrid-hover);
}
.ch-datagrid .mono {
  font-family: var(--datagrid-mono);
}
.ch-datagrid .muted {
  color: var(--datagrid-muted);
}
.ch-datagrid .accent {
  color: var(--datagrid-accent);
  font-weight: 700;
}

/* ── Sidebar Nav ── */
.ch-sidebar-nav__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--sidebar-item-height);
  padding: 0 var(--sidebar-item-px);
  font-family: var(--sidebar-item-font);
  font-size: var(--sidebar-item-size);
  font-weight: 500;
  letter-spacing: var(--sidebar-item-spacing);
  text-transform: uppercase;
  color: var(--sidebar-item-color);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--dur-fast) var(--ease);
}
.ch-sidebar-nav__item:hover {
  background: var(--state-hover-overlay);
  color: var(--text);
}
.ch-sidebar-nav__item.is-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  border-left-color: var(--sidebar-active-border);
  font-weight: 600;
}
.ch-sidebar-nav__badge {
  margin-left: auto;
  font-family: var(--sidebar-badge-font);
  font-size: var(--sidebar-badge-size);
  color: var(--text-muted);
}

/* ── Badge ── */
.ch-badge {
  display: inline-flex;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.ch-badge--red    { background: var(--red-brand-muted);  color: var(--red-brand); }
.ch-badge--green  { background: rgba(34,197,94,0.1);  color: var(--status-online-alt); } /* NOTE: 비브랜드 green, 0.1 토큰 없음 */
.ch-badge--blue   { background: var(--color-info-bg); color: var(--color-info-alt); }
.ch-badge--orange { background: rgba(245,158,11,0.1); color: #d97706; } /* NOTE: 비브랜드 orange, 0.1 토큰 없음 */
.ch-badge--gray   { background: var(--alpha-4);       color: var(--text-caption); }
.ch-badge--fill-red   { background: var(--red-brand); color: var(--white); }
.ch-badge--fill-green { background: var(--status-online-alt); color: var(--white); }
.ch-badge--fill-blue  { background: var(--color-info-alt); color: var(--white); }

/* ── Button ── */
.ch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--size-md-height);
  padding: 0 var(--size-md-px);
  font-family: var(--sans);
  font-size: var(--size-md-font);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.ch-btn--primary {
  background: var(--red-brand);
  color: var(--white);
}
.ch-btn--primary:hover {
  background: var(--red-brand-hover);
}
.ch-btn--secondary {
  background: var(--charcoal);
  color: var(--white);
}
.ch-btn--secondary:hover {
  background: var(--charcoal-hover);
}
.ch-btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.ch-btn--ghost:hover {
  background: var(--state-hover-overlay);
  border-color: var(--charcoal);
}
.ch-btn--sm { height: var(--size-sm-height); padding: 0 var(--size-sm-px); font-size: var(--size-sm-font); }
.ch-btn--lg { height: var(--size-lg-height); padding: 0 var(--size-lg-px); font-size: var(--size-lg-font); }
.ch-btn:disabled,
.ch-btn[disabled] {
  opacity: var(--state-disabled-opacity);
  pointer-events: none;
}
.ch-btn:focus-visible {
  box-shadow: var(--state-focus-ring);
  outline: none;
}

/* ── Form Elements ── */
.ch-input {
  display: block;
  width: 100%;
  height: var(--size-md-height);
  padding: 0 var(--size-md-px);
  font-family: var(--sans);
  font-size: var(--size-md-font);
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--alpha-12);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.ch-input::placeholder {
  color: var(--text-muted);
}
.ch-input:focus {
  border-color: var(--charcoal);
  box-shadow: var(--state-focus-ring-inset);
}
.ch-input--error {
  border-color: var(--state-error-border);
  background: var(--state-error-bg);
}
.ch-input--sm { height: var(--size-sm-height); padding: 0 var(--size-sm-px); font-size: var(--size-sm-font); }
.ch-label {
  display: block;
  font-family: var(--type-label-font);
  font-size: var(--type-label-size);
  font-weight: var(--type-label-weight);
  letter-spacing: var(--type-label-spacing);
  color: var(--type-label-color);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.ch-field {
  margin-bottom: var(--space-5);
}

/* ── Text Utilities ── */
.ch-text-mono  { font-family: var(--mono); }
.ch-text-serif { font-family: var(--serif); }
.ch-text-muted { color: var(--text-muted); }
.ch-text-caption { color: var(--text-caption); }
.ch-text-accent { color: var(--red-brand); }
.ch-text-xs   { font-size: var(--text-xs); }
.ch-text-sm   { font-size: var(--text-sm); }
.ch-text-base { font-size: var(--text-base); }
.ch-text-lg   { font-size: var(--text-lg); }
.ch-text-xl   { font-size: var(--text-xl); }
.ch-text-2xl  { font-size: var(--text-2xl); }

/* ── Spacing Utilities ── */
.ch-mt-0  { margin-top: 0; }
.ch-mt-4  { margin-top: var(--space-4); }
.ch-mt-6  { margin-top: var(--space-6); }
.ch-mt-8  { margin-top: var(--space-8); }
.ch-mb-0  { margin-bottom: 0; }
.ch-mb-4  { margin-bottom: var(--space-4); }
.ch-mb-6  { margin-bottom: var(--space-6); }
.ch-mb-8  { margin-bottom: var(--space-8); }
.ch-p-4   { padding: var(--space-4); }
.ch-p-6   { padding: var(--space-6); }
.ch-p-8   { padding: var(--space-8); }
.ch-px-4  { padding-left: var(--space-4); padding-right: var(--space-4); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .ch-container {
    padding: 0 var(--content-px-mobile);
  }
  .ch-grid--2,
  .ch-grid--3,
  .ch-grid--4 {
    grid-template-columns: 1fr;
  }
  .ch-sidebar-layout {
    grid-template-columns: 1fr;
  }
  .ch-sidebar-layout__sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .ch-kpi-rail {
    grid-template-columns: repeat(2, 1fr);
  }
  .ch-hero-layout {
    min-height: 80vh;
    padding: var(--space-8) var(--content-px-mobile);
  }
  .ch-hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .ch-hide-desktop {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .ch-kpi-rail {
    grid-template-columns: 1fr;
  }
  .ch-grid--2 {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════
   b44 Hero — 통일 Hero 시스템 (모든 sub-page 공통)
══════════════════════════════════ */
.b44-hero {
  position: relative;
  z-index: 1;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: calc(104px + var(--space-8)) var(--content-px) var(--space-12);
}
.b44-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--mono);
  font-size: var(--text-11);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}
.b44-breadcrumb a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.b44-breadcrumb a:hover {
  color: var(--red-brand);
  border-color: var(--red-brand-subtle);
}
.b44-breadcrumb .current {
  color: var(--text);
  font-weight: 600;
}
.b44-hero-label {
  display: block;
  font-family: var(--mono);
  font-size: var(--text-11);
  font-weight: 500;
  letter-spacing: var(--ls-ultra);
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}
.b44-hero-title {
  font-family: var(--sans);
  font-size: clamp(2.6rem, 6.5vw, 5.2rem);
  font-weight: 700;
  letter-spacing: var(--ls-tight);
  line-height: 1.04;
  color: var(--text);
  margin: 0 0 var(--space-6);
  max-width: 14ch;
}
.b44-hero-title .accent {
  color: var(--red-brand);
}
.b44-hero-desc {
  font-size: var(--text-xl);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0 0 var(--space-8);
}
.b44-prompt-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: min(100%, 560px);
  margin-bottom: var(--space-7);
}
.b44-prompt-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--text-lg);
  padding: 14px 16px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.b44-prompt-input::placeholder { color: var(--text-muted); }
.b44-prompt-input:focus {
  border-color: var(--red-brand);
  box-shadow: var(--focus-ring-sm);
}
.b44-prompt-btn {
  border: none;
  background: var(--charcoal);
  color: var(--white);
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  padding: 16px 22px;
  cursor: pointer;
  transition: background var(--dur-normal) var(--ease), transform var(--dur-normal) var(--ease);
}
.b44-prompt-btn:hover {
  background: var(--red-brand);
  transform: translateY(-1px);
}
.ch-pill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.ch-pill-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: var(--text-11);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 8px 10px;
  text-decoration: none;
}
/* 3줄 네비 페이지 (컴포넌트 카테고리 탭) — 자동 감지 */
.sys-nav:has(.sys-sub-tabs + .sys-sub-tabs) ~ .b44-hero {
  padding-top: calc(132px + var(--space-8));
}

@media (max-width: 768px) {
  .b44-hero {
    padding: calc(92px + var(--space-6)) var(--content-px-mobile) var(--space-10);
  }
  .sys-nav:has(.sys-sub-tabs + .sys-sub-tabs) ~ .b44-hero {
    padding-top: calc(118px + var(--space-6));
  }
  .b44-hero-title { max-width: none; }
  .b44-hero-desc { font-size: var(--text-md); }
  .b44-prompt-bar { width: 100%; }
  .b44-prompt-input { font-size: var(--text-base); padding: 12px 14px; }
  .b44-prompt-btn { padding: 14px 16px; }
}

/* ══════════════════════════════════
   ds-page-hero — 통일 Hero 구조 (Overview 기준)
   b44-hero 위에 올라타는 시맨틱 래퍼
══════════════════════════════════ */
.ds-page-hero {
  display: flex;
  flex-direction: column;
}
.ds-page-hero .ch-section-label {
  margin-bottom: var(--space-4);
}
.ds-page-title {
  font-family: var(--sans);
  font-size: clamp(2.6rem, 6.5vw, 5.2rem);
  font-weight: 700;
  letter-spacing: var(--ls-tight);
  line-height: 1.04;
  color: var(--text);
  margin: 0 0 var(--space-6);
  max-width: 14ch;
}
.ds-page-title .accent {
  color: var(--red-brand);
}
.ds-page-desc {
  font-size: var(--text-xl);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0;
}

@media (max-width: 768px) {
  .ds-page-title { max-width: none; }
  .ds-page-desc { font-size: var(--text-md); }
}

/* ── Update History ── */
.ds-update-history {
  margin: 24px 0 40px;
  padding: 16px 20px;
  border-left: 2px solid var(--alpha-12);
  background: var(--alpha-4);
}
.ds-update-history__label {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.ds-update-history__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ds-update-history__item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}
.ds-update-history__date {
  font-family: var(--mono);
  font-size: var(--text-2xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Update Badge */
.ds-update-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--white);
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ds-update-badge--new     { background: var(--green-60); }   /* #22c55e */
.ds-update-badge--updated { background: var(--blue-50); }    /* #2563eb */
.ds-update-badge--removed { background: var(--red-70); }     /* #EF4444 */
