/* 프랜차이즈 브랜드 비교 - 공정위 상세페이지 스타일 보고서 UI */

:root {
  --compare-label-col: 130px;   /* 첫 열(항목) - 5~6글자 라벨 한 줄 유지 */
  --compare-item-col: 130px;    /* 기존 변수 호환 */
  --compare-brand-col: 160px;   /* grid 1fr로 자동 분배 */
  --compare-brand-count: 4;
  --compare-table-width: 728px; /* 모든 표 공통, 첫 열 축소 시 브랜드 열 확대 */

  /* 메인·홈 통합 시맨틱 토큰 */
  --color-primary: #1e3a8a;
  --bg-main: #ffffff;
  --bg-card: #f9fafb;
  --bg-soft: #f5f7fa;
  --text-main: #111827;
  --text-sub: #6b7280;
  --border-light: #e5e7eb;
  --border-main: #d1d5db;

  --bg: var(--bg-main);
  --text: var(--text-main);
  --text-muted: var(--text-sub);
  --home-section-heading: var(--text-main);

  --navy: #1e3a5f;
  --navy-dark: #152a45;
  --accent: #1e3a5f;
  --accent-hover: #152a45;
  --border: #ccc;
  --border-strong: #999;
  --header-bg: #f2f5f8;
  --table-top: #1e3a5f;
  --best-bg: #ecf5f0;
  --best-border: #1e7a5e;
  --radius: 0;

  /* 순위·업종 허브: 행 액션(연도 링크 / 비교·담김 버튼) 공통 모서리 — 모바일·PC 동일 shape */
  --action-btn-radius: 12px;

  /* 홈 기능 안내 카드 포인트 (파스텔 하늘) */
  --color-sky-soft: #eaf4ff;
  --color-sky-border: #cfe3ff;

  /* 상세·연도별 순위 한 줄 강조 (가맹점수 n위 등만) */
  --color-accent-rank: #3b82f6;

  /* 비교 페이지 가로 막대: 트랙(배경)만 — 막대 채움색은 .compare-bar-N 유지 */
  --bar-track-bg: #e5e7eb;
  --bar-track-bg-soft: #f1f5f9;

  /* 라이트: compare 시맨틱 (다크는 body.dark-mode 블록에서 덮어씀) */
  --compare-bg: var(--bg-main);
  --compare-card-bg: var(--bg-card);
  --compare-header-bg: var(--header-bg);
  --compare-border: var(--border-light);
  --compare-border-mid: var(--border-main);
  --compare-text-strong: var(--navy);
  --compare-table-head-bg: var(--bg-soft);
  --compare-table-head-text: var(--text-main);
  --compare-cell-border: var(--border-light);
  --compare-section-border: var(--border-main);
  --compare-on-accent: var(--bg-main);
  --compare-input-bg: var(--bg-main);
  --color-danger: #dc2626;
  --compare-warning-bg: #fef3c7;
  --compare-warning-border: #d97706;
  --compare-warning-text: #92400e;
}

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

/* print 전용 DOM: 화면에서 숨김 (인쇄 시 print.css에서 app-shell 숨기고 이것만 표시) */
.print-layout {
  display: none;
}

body {
  font-family: 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', '맑은 고딕', sans-serif;
  font-size: 13px;
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.app-shell {
  width: 100%;
  margin: 0 auto;
  padding: 12px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
}

/* ===== Site Shell: 3컬럼 (좌우 광고 슬롯 + 중앙 콘텐츠 max 1200px) ===== */
.site-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1200px) 200px;
  gap: 20px;
  justify-content: center;
  align-content: start;
  width: 100%;
  box-sizing: border-box;
  /* flex:1 제거: app-shell min-height 100vh 안에서만 늘어나면 짧은 본문 아래에
   * site-shell 빈 영역이 커져 푸터까지 대형 공백으로 이어짐. 콘텐츠·레일 높이만큼만 차지. */
  flex: 0 1 auto;
  min-height: 0;
}

.site-rail {
  display: flex;
  justify-content: center;
}

.ad-slot {
  width: 180px;
  background: transparent;
}

/* 광고 레일 폭·슬롯 시각(180×600)은 유지하되, in-flow min-height가 그리드 행 높이를
 * 올려 짧은 본문 아래 중앙 열에 대형 공백이 생기지 않게 함: 슬롯만 절대배치로
 * 레일 열의 레이아웃 높이는 0에 가깝게(본문 열 높이만 행을 결정). */
@media screen and (min-width: 1201px) {
  .site-rail {
    position: relative;
    align-self: start;
    min-height: 0;
  }

  .ad-slot {
    position: absolute;
    top: 0;
    left: 50%;
    width: 180px;
    margin-left: -90px;
    min-height: 600px;
  }
}

.site-content {
  width: 100%;
  min-width: 0;
  background: var(--bg-main);
}

/*
 * 대형 공백 재발 방지: .site-shell 그리드에서 기본 stretch로 인해
 * 레일(.ad-slot min-height)이 행 높이를 올릴 때 main#app이 같이 늘어나
 * 로딩/짧은 본문에서 #app 내부 여백(appExtra)이 커지던 문제를 차단.
 * 레일·슬롯·폭·표시는 유지하고 본문 열만 콘텐츠 높이에 맞춤(align-self: start).
 */
main#app.site-content.main-content {
  position: relative;
  z-index: 1;
  align-self: start;
  min-height: 0;
}

@media screen and (max-width: 1200px) {
  .site-shell {
    grid-template-columns: minmax(0, 1200px);
    justify-content: center;
  }

  .site-rail {
    display: none;
  }
}

/* 모바일: 1열, 콘텐츠 전체폭 (screen only - print 영향 없음) */
@media screen and (max-width: 768px) {
  .site-shell {
    display: block;
    width: 100%;
  }

  .site-content {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* 모바일 헤더: PC 헤더 숨김, 모바일 전용 2단 표시 */
  .main-header-pc {
    display: none !important;
  }
  .main-header-mobile {
    display: block !important;
    position: relative;
    width: 100%;
    flex-shrink: 0;
    background: var(--header-bg);
    z-index: 100;
    border-bottom: 1px solid var(--border-light);
  }
  .main-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex-shrink: 0; /* flex 자식으로 눌리지 않도록 */
  }

  /* 1단: 최상단 서비스명 */
  .mobile-top-title {
    text-align: center;
    padding: 18px 20px;
  }
  .mobile-top-title a {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--navy);
    text-decoration: none;
    white-space: nowrap;
  }
  .mobile-top-title a:hover {
    color: var(--navy-dark);
  }

  /* 2단: 왼쪽 메뉴 버튼 + 우측 액션 버튼 */
  .mobile-menu-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
    padding: 0 20px 12px;
    gap: 12px;
  }
  .mobile-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
  }
  .mobile-header-stack .mobile-action-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: 9999px;
    background: var(--header-bg);
    color: var(--navy);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
  }
  .mobile-header-stack .mobile-action-btn:hover {
    background: var(--border-light);
  }
  .mobile-header-stack .mobile-action-btn:focus {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
  }
  .mobile-header-stack .mobile-action-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }
  .mobile-header-stack .mobile-menu-trigger {
    display: block;
    position: relative;
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-header-stack .mobile-menu-trigger:focus,
  .mobile-header-stack .mobile-menu-trigger:active,
  .mobile-header-stack .mobile-menu-trigger:focus-visible {
    outline: none;
    box-shadow: none;
  }
  .mobile-header-stack .hamburger-btn:focus,
  .mobile-header-stack .hamburger-btn:active,
  .mobile-header-stack .hamburger-btn:focus-visible {
    outline: none;
    box-shadow: none;
  }
  .mobile-header-stack .hamburger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 40px;
    min-height: 40px;
    padding: 6px 8px;
    background: transparent;
    color: var(--navy);
    border: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-header-stack .hamburger-btn:hover {
    background: rgba(0, 0, 0, 0.04);
  }
  .mobile-header-stack .hamburger-btn:active {
    opacity: 0.75;
  }
  .hamburger-btn-text {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
  }
  .mobile-header-stack .hamburger-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  /* 모바일 메뉴: overlay와 같은 최상위 레이어, fixed로 버튼 아래 표시 (JS로 top/left 계산) */
  .mobile-nav-panel {
    position: fixed !important;
    top: 130px; /* JS getBoundingClientRect로 override */
    left: 20px;
    right: auto;
    width: min(280px, 85vw);
    height: auto;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: none !important;
    z-index: 9100 !important;
    pointer-events: auto;
    background: var(--header-bg);
  }
  .mobile-nav-panel[hidden] {
    display: none !important;
  }
  body.mobile-nav-open .mobile-nav-panel:not([hidden]) {
    display: flex !important;
    flex-direction: column;
    transform: none !important;
  }
  .mobile-nav-panel-header {
    display: none;
  }
  .mobile-nav-panel-list {
    padding: 8px 0;
  }
  .mobile-nav-panel-link {
    height: 52px;
    padding: 0 20px;
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-light);
  }
  .mobile-nav-panel-link:last-child {
    border-bottom: none;
  }

  /* 3단: 본문 히어로 영역 (헤더 아래 독립) */
  .home-hero.mobile-hero,
  .home-page .home-hero {
    padding: 24px 20px 20px;
    margin-bottom: 10px;
    margin-top: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .home-page .home-title {
    font-size: clamp(1.5rem, 6vw, 2.25rem);
    line-height: 1.4;
    margin-bottom: 16px;
  }
  .home-page .home-desc {
    font-size: 17px;
    line-height: 1.65;
  }
  .home-page .home-desc-sub {
    font-size: 16px;
    line-height: 1.7;
    margin-top: 6px;
  }

  /* 정적 페이지: 모바일 */
  .static-page {
    padding: 20px 16px;
  }

  /* 푸터: 모바일 세로 스택 */
  .main-footer {
    padding: 20px 16px;
  }
  .main-footer-item {
    margin-bottom: 10px;
  }

  /* CompareTray: 모바일 컴팩트 (768px 이하) */
  .compare-tray {
    padding: 12px 14px;
  }
  .compare-tray-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  .compare-tray-list {
    margin-bottom: 8px;
    max-height: 200px;
    overflow-y: auto;
  }
  .compare-tray-item {
    flex-wrap: nowrap;
    padding: 8px 0;
    margin-bottom: 6px;
    gap: 8px;
    line-height: 1.45;
  }
  .compare-tray-item:last-child {
    margin-bottom: 0;
  }
  .compare-tray-name {
    flex: 1 1 auto;
    flex-basis: auto;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
  }
  .compare-tray-actions {
    gap: 8px;
  }
  .compare-tray-detail,
  .compare-tray-yearly {
    font-size: 12px;
    padding: 3px 8px;
    min-height: 26px;
    line-height: 1.3;
  }
  .compare-tray-remove {
    min-width: 28px;
    min-height: 28px;
    padding: 2px 4px;
    font-size: 16px;
  }
  .compare-tray-hint {
    margin-bottom: 8px;
  }
  .compare-btn-group button {
    height: 48px;
  }

  /* KPI: 768px 이하 1열 3행, 세로 여백 축소 */
  .home-kpi-section {
    grid-template-columns: 1fr;
    margin-top: 0;
    padding: 12px 16px;
  }
  .kpi-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
  }
  .kpi-item:last-child {
    border-bottom: none;
  }
  .kpi-label {
    font-size: 19px;
    margin-bottom: 4px;
  }
  .kpi-value {
    font-size: 34px;
  }

  /* Brand search: 브랜드명 압축 (768px 이하) */
  .search-result-item {
    padding: 6px 10px;
    gap: 6px;
  }
  .search-result-info .search-result-name,
  .search-result-info .search-result-name-btn {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.45;
  }
  .search-result-corp,
  .search-result-industry {
    font-size: 11px;
    margin-top: 1px;
  }
  .search-result-actions {
    gap: 6px;
  }
  .search-result-btn-secondary,
  .search-result-btn-primary {
    font-size: 12px;
    height: 34px;
    padding: 0 10px;
  }
  .btn-add-to-compare {
    font-size: 12px;
    padding: 4px 8px;
  }
}

/* app-shell 좌우 패딩을 상쇄해 헤더 배경·보더는 뷰포트 폭까지, 내부 .nav-inner는 기본 중앙 1200px(≥1280px는 파일 말미: 전체폭+좌우 패딩만) */
.main-header {
  width: calc(100% + 40px);
  margin-left: -20px;
  margin-right: -20px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
  box-sizing: border-box;
}

.main-header .nav-inner {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 16px;
  width: 100%;
  box-sizing: border-box;
}

.main-header-inner {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  width: 100%;
  min-width: 0;
}

/* 모바일 헤더: 기본(PC)에서는 숨김 - 768px 이하에서만 표시 */
.main-header-mobile {
  display: none;
}

.logo {
  grid-column: 1;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
  text-align: left;
}
.logo-text-mobile {
  display: none;
}

/* PC 상단 메뉴 5개: 한 줄, 가용 너비 균등 분배(좌우 끝까지 자연스럽게 퍼짐) */
.main-header-nav {
  grid-column: 2 / 6;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  width: 100%;
  overflow: visible;
}
.main-header-nav .nav-link {
  flex: 1 1 0;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 4px;
  box-sizing: border-box;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 헤더 메뉴 색상 통일 - 모든 메뉴 동일 */
.header-nav-item,
.header-nav-item:link,
.header-nav-item:visited,
.header-nav-item:active,
.header-nav-item:focus {
  color: var(--navy);
}
.header-nav-item:hover {
  color: var(--navy-dark);
}
.header-nav-item:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}
/* 기본·hover: 밑줄 없음 (active만 밑줄) */
.main-header-nav .nav-link:hover {
  text-decoration: none;
}
.main-header-nav .nav-link.header-nav-item--current {
  color: var(--navy-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.main-header-right {
  grid-column: 6;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.mobile-menu-trigger {
  display: none;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
}
.mobile-menu-trigger:focus,
.mobile-menu-trigger:active,
.mobile-menu-trigger:focus-visible {
  outline: none;
  box-shadow: none;
}
.mobile-menu-trigger button:focus {
  outline: none;
}
/* PC에서만 모바일 헤더 숨김 (모바일 media query보다 뒤에 있으므로, 모바일에서는 768px 블록의 display:block이 우선되도록 min-width로 분리) */
@media screen and (min-width: 769px) {
  .main-header-mobile {
    display: none !important;
  }
}

/* PC/태블릿 가로(≥1024px): 상단 내비 sticky — 높이 고정, 스크롤 시 크기 변화 없음 */
@media screen and (min-width: 1024px) {
  .main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 12px;
    padding: 0;
    min-height: 64px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }

  .main-header .nav-inner {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
    max-width: 1200px;
  }

  .main-header-inner.main-header-pc {
    flex: 1;
    width: 100%;
    min-height: 64px;
    align-items: center;
  }

  .main-header-nav {
    align-items: center;
  }

  .main-header-nav .nav-link {
    line-height: 1.25;
  }

  body.dark-mode .main-header {
    background: var(--bg-section);
    border-bottom-color: var(--border-light);
    box-shadow: none;
  }
}

@media screen and (max-width: 1023px) {
  .main-header {
    position: static;
    z-index: auto;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid var(--border-light);
  }
}

.hamburger-btn {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: var(--header-bg);
  color: var(--navy);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.hamburger-btn:hover {
  background: var(--border-light);
}
.hamburger-btn:focus {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}
/* 모바일 메뉴 버튼: 포커스 링 제거 */
.mobile-header-stack .hamburger-btn:focus,
.mobile-header-stack .hamburger-btn:active,
.mobile-header-stack .hamburger-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

/* 모바일 슬라이드 패널 - 오버레이 (메뉴 패널보다 아래에만 표시) */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 9000;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}
.mobile-nav-overlay[hidden] {
  display: none !important;
}
body.mobile-nav-open .mobile-nav-overlay:not([hidden]) {
  display: block !important;
  opacity: 1;
}

/* 모바일 슬라이드 패널 - 769px 이상에서만 적용 (768px 이하는 .main-header-mobile .mobile-nav-panel 사용) */
@media screen and (min-width: 769px) {
  .mobile-nav-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: min(82vw, 320px);
    height: 100%;
    background: var(--header-bg);
    border-left: 1px solid var(--border-light);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    flex-direction: column;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }
  .mobile-nav-panel[hidden] {
    display: none !important;
  }
  .mobile-nav-panel:not([hidden]) {
    display: flex;
  }
  body.mobile-nav-open .mobile-nav-panel:not([hidden]) {
    transform: translateX(0);
  }
}

.mobile-nav-panel-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}
.mobile-nav-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-nav-panel-list {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}
.mobile-nav-panel-link {
  display: flex;
  align-items: center;
  height: 54px;
  padding: 0 20px;
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s, color 0.2s;
}
.mobile-nav-panel-link:hover {
  background: var(--border-light);
}
.mobile-nav-panel-link.header-nav-item--current {
  background: var(--border-light);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* PC에서 모바일 패널/오버레이 완전 비표시 */
@media screen and (min-width: 769px) {
  .mobile-nav-overlay,
  .mobile-nav-panel {
    display: none !important;
  }
}

#brand-search,
#category-top4 {
  scroll-margin-top: 100px;
}

.main-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.share-link-btn {
  margin-right: 0;
}

.copy-link-btn__icon {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-header-stack .mobile-action-btn .copy-link-btn__icon {
  font-size: 18px;
}

/* 인쇄 시에만 표시 (화면에서는 숨김) */
.compare-print-only {
  display: none;
}

.tray-container {
  flex-shrink: 0;
}

/* 테마 토글 버튼 - 우측 상단 */
.theme-toggle-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: var(--header-bg);
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.theme-toggle-btn:hover {
  background: var(--border-light);
}
.theme-toggle-btn:focus {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

/* 다크모드 — 페이지 surface 4단계 + compare 브리지 (라이트 :root 미변경) */
body.dark-mode {
  --navy: #8fb3ff;
  --navy-dark: #a7c4ff;
  --border: #253047;
  --border-strong: #334155;
  --header-bg: #111827;
  --table-top: #8fb3ff;
  --best-bg: #1e3d2e;
  --best-border: #2d5a45;

  /* 메인·홈 통합 시맨틱 토큰 (다크) */
  --bg-main: #0b1220;
  --bg-section: #111827;
  --bg-card: #172033;
  --bg-card-soft: #1d2940;
  --bg-soft: var(--bg-card-soft);
  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --border-light: #253047;
  --border-main: #334155;

  --bg: var(--bg-main);
  --text: var(--text-main);
  --text-muted: var(--text-sub);
  --home-section-heading: var(--text-main);
  --color-primary: #3b82f6;

  /* compare 페이지 전용 다크모드 토큰 (시맨틱 토큰에 브리지) */
  --compare-bg: var(--bg-main);
  --compare-card-bg: var(--bg-card);
  --compare-header-bg: var(--bg-card-soft);
  --compare-border: var(--border-light);

  --color-sky-soft: var(--bg-card-soft);
  --color-sky-border: var(--border-strong);
  --color-accent-rank: #60a5fa;
  --compare-border-strong: var(--border-main);
  --compare-text: var(--text-main);
  --compare-muted: var(--text-sub);
  --compare-accent: #8fb3ff;
  --compare-section-title: var(--text-main);
  --compare-input-bg: var(--bg-card);
  --compare-input-border: var(--border-light);
  --compare-input-focus: rgba(143, 179, 255, 0.4);

  --bar-track-bg: var(--bg-card-soft);
  --bar-track-bg-soft: var(--bg-card);

  /* 다크모드 텍스트 링크 — 흰색 계열 고정(visited/hover 동일 톤, 장식·명도로만 구분) */
  --dm-link: rgba(255, 255, 255, 0.96);
  --dm-link-decoration: rgba(255, 255, 255, 0.58);
  --dm-link-decoration-strong: rgba(255, 255, 255, 0.88);
  --dm-link-focus-ring: rgba(255, 255, 255, 0.5);
}

/* 다크모드: 클래스 없는 본문 앵커 등 — 낮은 특이성(:where)으로만 기본 톤 보강(구체 규칙이 우선) */
body.dark-mode :where(#app)
  :where(
    a:not(.btn):not(.cta-primary):not(.cta-secondary):not(.cta-tertiary):not(.btn-year):not(.ranking-detail-btn):not(
        .header-nav-item
      ):not(.brand-detail-peer-compare-btn):not(.compare-ranking-bridge__card):not(.btn-go-home):not(.btn-go-to-compare)
  ) {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode :where(#app)
  :where(
    a:not(.btn):not(.cta-primary):not(.cta-secondary):not(.cta-tertiary):not(.btn-year):not(.ranking-detail-btn):not(
        .header-nav-item
      ):not(.brand-detail-peer-compare-btn):not(.compare-ranking-bridge__card):not(.btn-go-home):not(.btn-go-to-compare):visited
  ) {
  color: var(--dm-link);
}
body.dark-mode :where(#app)
  :where(
    a:not(.btn):not(.cta-primary):not(.cta-secondary):not(.cta-tertiary):not(.btn-year):not(.ranking-detail-btn):not(
        .header-nav-item
      ):not(.brand-detail-peer-compare-btn):not(.compare-ranking-bridge__card):not(.btn-go-home):not(.btn-go-to-compare):hover
  ) {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode :where(#app)
  :where(
    a:not(.btn):not(.cta-primary):not(.cta-secondary):not(.cta-tertiary):not(.btn-year):not(.ranking-detail-btn):not(
        .header-nav-item
      ):not(.brand-detail-peer-compare-btn):not(.compare-ranking-bridge__card):not(.btn-go-home):not(.btn-go-to-compare):active
  ) {
  color: var(--dm-link);
  opacity: 0.92;
}
body.dark-mode :where(#app)
  :where(
    a:not(.btn):not(.cta-primary):not(.cta-secondary):not(.cta-tertiary):not(.btn-year):not(.ranking-detail-btn):not(
        .header-nav-item
      ):not(.brand-detail-peer-compare-btn):not(.compare-ranking-bridge__card):not(.btn-go-home):not(.btn-go-to-compare):focus-visible
  ) {
  color: var(--dm-link);
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
}

/* 다크 공통 surface 유틸 (필요 시 마크업에 부착) */
body.dark-mode .surface-section {
  background: var(--bg-section);
  border: 1px solid var(--border-light);
}
body.dark-mode .surface-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}
body.dark-mode .surface-card-soft {
  background: var(--bg-card-soft);
  border: 1px solid var(--border-strong);
}

body.dark-mode #app,
body.dark-mode .main-content {
  background: var(--bg-main);
  color: var(--text-main);
}
body.dark-mode .theme-toggle-btn,
body.dark-mode .hamburger-btn {
  background: var(--header-bg);
  color: var(--navy);
}
body.dark-mode .theme-toggle-btn:hover,
body.dark-mode .hamburger-btn:hover {
  background: var(--border-light);
}
body.dark-mode .mobile-header-stack .hamburger-btn {
  background: transparent;
  color: var(--navy);
}
body.dark-mode .mobile-header-stack .hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
/* header-nav-item가 색상 통일 담당, 다크모드에서도 동일 */
body.dark-mode .mobile-nav-panel {
  background: var(--header-bg);
  border-color: var(--border-light);
}
body.dark-mode .mobile-top-title a {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .mobile-top-title a:hover {
  color: var(--dm-link);
  text-decoration: underline;
  text-decoration-color: var(--dm-link-decoration-strong);
  text-underline-offset: 2px;
}
body.dark-mode .mobile-top-title a:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

/* 다크: 상단 로고·데스크톱 네비 — 본문과 동일 흰색 계열(파란 포인트 컬러 제거) */
body.dark-mode .logo {
  color: var(--dm-link);
}
body.dark-mode .header-nav-item,
body.dark-mode .header-nav-item:link,
body.dark-mode .header-nav-item:visited,
body.dark-mode .header-nav-item:active,
body.dark-mode .header-nav-item:focus {
  color: var(--dm-link);
}
body.dark-mode .header-nav-item:hover {
  color: var(--dm-link);
  opacity: 0.92;
}
body.dark-mode .header-nav-item:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}
body.dark-mode .main-header-nav .nav-link.header-nav-item--current {
  color: var(--dm-link);
  text-decoration: underline;
  text-decoration-color: var(--dm-link-decoration-strong);
  text-underline-offset: 4px;
}

/* ===== Compare 페이지 다크모드 전면 개선 ===== */

/* 페이지/앱 배경 (compare 진입 시) */
body.dark-mode .app-shell {
  background: var(--bg-main);
}

/* ---------- Compare 메인 화면 (홈 + compare 진입 전) ---------- */

/* 검색창 */
body.dark-mode .brand-search-input {
  background: var(--bg-main);
  color: var(--text-main);
  border-color: var(--border-light);
}
body.dark-mode .brand-search-input::placeholder {
  color: var(--text-sub);
}
body.dark-mode .brand-search-input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

body.dark-mode .brand-search-label {
  color: var(--text-main);
}

body.dark-mode .brand-search-results {
  background: var(--bg-card);
  border-color: var(--border-light);
}

body.dark-mode .search-result-item {
  border-bottom-color: var(--compare-border);
}
body.dark-mode .search-result-item:hover {
  background: var(--compare-header-bg);
}
body.dark-mode .search-result-btn-secondary {
  background: transparent;
  color: #94a3b8;
  border-color: #64748b;
}

body.dark-mode .search-result-btn-secondary:hover {
  background: rgba(148, 163, 184, 0.12);
}

body.dark-mode .search-result-name,
body.dark-mode .search-result-name-btn {
  color: var(--dm-link);
}
body.dark-mode .search-result-corp {
  color: var(--compare-muted);
}
body.dark-mode .search-no-result {
  color: var(--compare-muted);
}

body.dark-mode .search-loading {
  color: var(--compare-muted);
}

body.dark-mode .spinner {
  border-color: #475569;
  border-top-color: var(--compare-accent);
}

/* 비교 바구니 카드 */
body.dark-mode .compare-tray {
  background: var(--bg-card);
  border-color: var(--border-light);
}
body.dark-mode .compare-tray-header {
  color: var(--text-main);
}
body.dark-mode .compare-tray-count {
  color: var(--text-sub);
}
body.dark-mode .compare-tray-item {
  color: var(--text-main);
}
body.dark-mode .compare-tray-remove {
  color: var(--text-sub);
}
body.dark-mode .compare-tray-remove:hover {
  color: #f87171;
}
body.dark-mode .compare-tray-detail,
body.dark-mode .compare-tray-yearly {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-light);
}
body.dark-mode .compare-tray-detail:hover,
body.dark-mode .compare-tray-yearly:hover {
  background: var(--compare-accent);
  color: #fff;
  border-color: var(--compare-accent);
}
body.dark-mode .compare-tray-hint {
  color: var(--text-sub);
}
body.dark-mode .compare-reset-btn {
  background: var(--border-light);
  color: var(--text-main);
  border: 1px solid var(--border-main);
}
body.dark-mode .compare-reset-btn:hover:not(:disabled) {
  background: var(--border-main);
}
body.dark-mode .compare-reset-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
body.dark-mode .compare-start-btn {
  background: var(--bg-soft);
  color: var(--text-main);
  border: 1px solid var(--border-main);
}
body.dark-mode .compare-start-btn:hover:not(:disabled) {
  background: var(--border-main);
  color: #fff;
}
body.dark-mode .compare-start-btn:disabled {
  background: var(--border-light);
  color: var(--text-sub);
  border-color: var(--border-light);
}

/* 업종 버튼 */
body.dark-mode .btn-industry {
  background: var(--compare-card-bg);
  color: var(--compare-accent);
  border-color: var(--compare-border-strong);
}
body.dark-mode .btn-industry:hover:not(:disabled) {
  background: var(--compare-header-bg);
  color: var(--compare-text);
}

/* Featured section */
body.dark-mode .featured-compare-section {
  background: var(--bg-section);
  border-color: var(--border-light);
}
body.dark-mode .industry-category-title {
  color: var(--compare-section-title);
}
body.dark-mode .industry-empty-hint {
  color: var(--compare-muted);
}

/* Top20 / home-recent-section */
body.dark-mode .home-recent-section {
  border-color: var(--compare-border);
}
body.dark-mode .section-title {
  color: var(--compare-section-title);
}
body.dark-mode .section-hint {
  color: var(--compare-muted);
}
body.dark-mode .section-hint a,
body.dark-mode .section-hint a:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .section-hint a:hover {
  color: var(--dm-link);
  text-decoration: underline;
  text-decoration-color: var(--dm-link-decoration-strong);
  text-underline-offset: 2px;
}
body.dark-mode .section-hint a:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}
body.dark-mode .top20-card {
  background: var(--compare-card-bg);
  border-color: var(--compare-border);
}
body.dark-mode .top20-table th {
  background: var(--compare-header-bg);
  color: var(--compare-text);
  border-color: var(--compare-border);
}
body.dark-mode .top20-table td {
  border-color: var(--compare-border);
  color: var(--compare-text);
}
body.dark-mode .top20-table tbody tr:hover {
  background: var(--compare-header-bg);
}
body.dark-mode .btn-top20-add {
  background: var(--compare-card-bg);
  color: var(--compare-accent);
  border-color: var(--compare-border-strong);
}
body.dark-mode .btn-top20-add:hover:not(:disabled) {
  background: var(--compare-header-bg);
  color: var(--compare-text);
}

/* ---------- Compare 결과 화면 (CompareDetailPage) ---------- */

/* 상단 비교 브랜드 헤더 */
body.dark-mode .compare-headers-row {
  background: var(--compare-card-bg);
  border-color: var(--compare-border);
  border-top-color: var(--compare-border-strong);
}
body.dark-mode .compare-header-panel.compare-control-cell {
  background: var(--bg-section);
  color: var(--compare-text);
  border-right-color: var(--compare-border);
}
/* 첫 칸 placeholder: "비교 브랜드" / "최대 4개 선택" - 다크모드 가독성 */
body.dark-mode .compare-brand-cell .compare-brand-cell-title {
  color: var(--compare-section-title);
}
body.dark-mode .compare-brand-cell .compare-brand-cell-sub {
  color: var(--compare-muted);
}
body.dark-mode .compare-control-title {
  color: var(--compare-text);
}
body.dark-mode .compare-control-desc {
  color: var(--compare-muted);
}
body.dark-mode .compare-header-panel.brand-header-cell {
  background: var(--compare-card-bg);
  color: var(--compare-text);
  border-right-color: var(--compare-border);
}
body.dark-mode .brand-header-name,
body.dark-mode .compare-header-brand .brand-name {
  color: var(--compare-text);
  font-weight: 600;
}
/* 버전 드롭다운 */
body.dark-mode .compare-version-select,
body.dark-mode .version-select {
  background: var(--compare-input-bg);
  color: var(--compare-text);
  border-color: var(--compare-input-border);
}
body.dark-mode .compare-version-select:focus,
body.dark-mode .version-select:focus {
  outline: 2px solid var(--compare-accent);
  outline-offset: 0;
  border-color: var(--compare-accent);
}
body.dark-mode .compare-version-select option,
body.dark-mode .version-select option {
  background: var(--compare-card-bg);
  color: var(--compare-text);
}

/* 표 스타일 - 핵심 지표, 기본 정보, 재무상황 등 모든 표 */
body.dark-mode .compare-table-wrap,
body.dark-mode .compare-content-block {
  background: var(--compare-card-bg);
  border: 1px solid var(--border-light);
  box-sizing: border-box;
}
body.dark-mode .compare-core-table,
body.dark-mode .compare-table,
body.dark-mode .compare-unified-table,
body.dark-mode .compare-kpi-table,
body.dark-mode .compare-section-table,
body.dark-mode .compare-metrics-table,
body.dark-mode .compare-region-table {
  border-color: var(--compare-border);
  border-top-color: var(--compare-border-strong);
}
body.dark-mode .compare-core-table th,
body.dark-mode .compare-core-table td,
body.dark-mode .compare-table th,
body.dark-mode .compare-table td,
body.dark-mode .compare-unified-table th,
body.dark-mode .compare-unified-table td,
body.dark-mode .compare-kpi-table th,
body.dark-mode .compare-kpi-table td,
body.dark-mode .compare-section-table th,
body.dark-mode .compare-section-table td,
body.dark-mode .compare-metrics-table th,
body.dark-mode .compare-metrics-table td,
body.dark-mode .compare-region-table th,
body.dark-mode .compare-region-table td {
  border-color: var(--compare-border);
  color: var(--compare-text);
}
body.dark-mode .compare-core-table thead th,
body.dark-mode .compare-table thead th,
body.dark-mode .compare-unified-table thead th,
body.dark-mode .compare-kpi-table thead th,
body.dark-mode .compare-section-table thead th,
body.dark-mode .compare-metrics-table thead th,
body.dark-mode .compare-region-table thead th {
  background: var(--compare-header-bg);
  color: var(--compare-text);
  font-weight: 700;
}
body.dark-mode .compare-core-table tbody td,
body.dark-mode .compare-table tbody td,
body.dark-mode .compare-unified-table tbody td,
body.dark-mode .compare-kpi-table tbody td,
body.dark-mode .compare-section-table tbody td,
body.dark-mode .compare-metrics-table tbody td,
body.dark-mode .compare-region-table tbody td {
  background: var(--compare-card-bg);
}
/* 첫 번째 열(항목 열) 다크모드 - 라이트 배경 !important 오버라이드 */
body.dark-mode .compare-core-table th:first-child,
body.dark-mode .compare-core-table td:first-child,
body.dark-mode .compare-table th:first-child,
body.dark-mode .compare-table td:first-child,
body.dark-mode .compare-table th.compare-col-item,
body.dark-mode .compare-table td.compare-col-item,
body.dark-mode .compare-unified-table th:first-child,
body.dark-mode .compare-unified-table td:first-child,
body.dark-mode .compare-kpi-table th:first-child,
body.dark-mode .compare-kpi-table td:first-child,
body.dark-mode .compare-section-table th:first-child,
body.dark-mode .compare-section-table td:first-child,
body.dark-mode .compare-metrics-table th:first-child,
body.dark-mode .compare-metrics-table td:first-child,
body.dark-mode .compare-region-table th:first-child,
body.dark-mode .compare-region-table td:first-child {
  background: var(--compare-header-bg) !important;
  color: var(--compare-text) !important;
  border-color: var(--compare-border) !important;
}
body.dark-mode .compare-table tbody th.compare-col-item,
body.dark-mode .compare-detail-page .compare-col-item {
  background: var(--compare-header-bg) !important;
  color: var(--compare-text) !important;
}
/* 브랜드 구분선 강조 */
body.dark-mode .compare-table th.brand-group-end,
body.dark-mode .compare-table td.brand-group-end,
body.dark-mode .compare-core-table th.brand-group-end,
body.dark-mode .compare-core-table td.brand-group-end {
  border-right-color: var(--compare-border) !important;
}

/* 섹션 제목 / 블록 헤더 */
body.dark-mode .compare-section-title,
body.dark-mode .compare-detail-title,
body.dark-mode .section-title,
body.dark-mode .subsection-title {
  color: var(--compare-section-title);
  border-bottom-color: var(--compare-border);
}
body.dark-mode .compare-block-header,
body.dark-mode .compare-block-title {
  border-bottom-color: var(--compare-border);
}
body.dark-mode .compare-block-title-text {
  color: var(--compare-section-title);
}
body.dark-mode .compare-block-unit,
body.dark-mode .compare-section-unit,
body.dark-mode .unit-label {
  color: var(--compare-muted);
}

/* 핵심 지표 섹션 헤더 */
body.dark-mode .compare-core-section .compare-block-header {
  border-bottom-color: var(--compare-border);
}

body.dark-mode .compare-chart-block {
  background: var(--compare-card-bg);
  border: 1px solid var(--border-light);
}
body.dark-mode .compare-chart-title {
  color: var(--compare-text);
}
body.dark-mode .compare-chart-unit {
  color: var(--text-sub);
}
body.dark-mode .compare-chart-bar-wrap {
  background: var(--bar-track-bg);
}
body.dark-mode .compare-chart-value {
  color: var(--compare-text);
}
body.dark-mode .compare-chart-rank-badge--bar1 {
  background: #3b82f6;
}
body.dark-mode .compare-chart-rank-badge--bar2 {
  background: #10b981;
}
body.dark-mode .compare-chart-rank-badge--bar3 {
  background: #f59e0b;
}
body.dark-mode .compare-chart-rank-badge--bar4 {
  background: #8b5cf6;
}
body.dark-mode .compare-chart-row,
body.dark-mode .compare-chart-row--rank-1,
body.dark-mode .compare-chart-row--rank-2,
body.dark-mode .compare-chart-row--rank-3,
body.dark-mode .compare-chart-row--rank-4 {
  background: var(--compare-card-bg);
}
body.dark-mode .compare-chart-value {
  color: var(--compare-text);
}
body.dark-mode .compare-chart-rank-tag {
  color: var(--text-sub);
}

/* 자료없음 등 보조 텍스트 */
body.dark-mode .compare-table td {
  color: var(--compare-text);
}

/* compare 페이지 타이틀 */
body.dark-mode .compare-page-title,
body.dark-mode .compare-header h1 {
  color: var(--compare-text);
}
body.dark-mode .home-title {
  color: var(--text-main);
}
body.dark-mode .home-kpi-title,
body.dark-mode .home-feature-grid-title {
  color: var(--text-main);
}
body.dark-mode .home-desc,
body.dark-mode .home-desc-sub,
body.dark-mode .hero-subtext,
body.dark-mode .hero-sub {
  color: var(--text-sub);
}
body.dark-mode .home-kpi-section {
  background: var(--bg-section);
  border-color: var(--border-light);
}
body.dark-mode .kpi-value {
  color: var(--text-main);
}
body.dark-mode .kpi-label {
  color: var(--text-sub);
}
body.dark-mode .home-kpi-section .kpi-sub {
  color: var(--text-sub);
}
body.dark-mode .home-search-hint {
  color: var(--text-sub);
}
body.dark-mode .industry-card.top4-card {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-main);
}
body.dark-mode .industry-card.top4-card:hover:not(:disabled) {
  background: var(--bg-soft);
  border-color: var(--color-primary);
}
body.dark-mode .industry-card.top4-card.active {
  background: var(--bg-soft);
  border-color: var(--color-primary);
}
body.dark-mode .featured-section-title {
  color: var(--text-main);
}
body.dark-mode .featured-section-hint {
  color: var(--text-sub);
}
body.dark-mode .compare-basket-summary {
  color: var(--compare-muted);
}
body.dark-mode .compare-reset-link,
body.dark-mode .compare-reset-link:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .compare-reset-link:hover {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .compare-reset-link:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}
body.dark-mode .compare-output-date {
  color: var(--compare-muted);
}

/* compare-detail-page 하단 링크 */
body.dark-mode .compare-detail-back a,
body.dark-mode .compare-detail-back a:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .compare-detail-back a:hover {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .compare-detail-back a:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

body.dark-mode .compare-empty-back a,
body.dark-mode .compare-empty-back a:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .compare-empty-back a:hover {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .compare-empty-back a:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

/* compare-detail-document (브랜드 상세 문서형) */
body.dark-mode .compare-detail-document {
  background: transparent;
}

/* compare 로딩/빈 화면 */
body.dark-mode .compare-detail-page .compare-loading,
body.dark-mode .compare-page-empty p,
body.dark-mode .compare-page-loading p {
  color: var(--compare-muted);
}
body.dark-mode .compare-page-empty a,
body.dark-mode .compare-page-empty a:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .compare-page-empty a:hover {
  text-decoration: underline;
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .compare-page-empty a:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}
body.dark-mode .compare-detail-page .compare-loading {
  color: var(--compare-text);
}

/* ===== Brand Detail 상세페이지 다크모드 (compare 기준 통일) ===== */
body.dark-mode .brand-detail-page {
  color: var(--compare-text);
}
body.dark-mode .brand-detail-page--ftc {
  background: var(--compare-bg);
}
body.dark-mode .brand-detail-page--ftc .brand-detail-document {
  background: transparent;
}
body.dark-mode .brand-detail-page--ftc .brand-detail-doc-header,
body.dark-mode .brand-detail-page--ftc .brand-detail-doc-title,
body.dark-mode .brand-detail-page--ftc h1.brand-title {
  color: var(--compare-text);
}
body.dark-mode .brand-detail-page--ftc .brand-detail-doc-meta,
body.dark-mode .brand-detail-page .brand-meta-row .brand-detail-meta-label {
  color: var(--compare-muted);
}
body.dark-mode .brand-detail-page .brand-detail-version-select,
body.dark-mode .brand-detail-page .brand-version select {
  background: var(--compare-input-bg);
  color: var(--compare-text);
  border-color: var(--compare-input-border);
}
body.dark-mode .brand-detail-page .brand-detail-version-select:focus,
body.dark-mode .brand-detail-page .brand-version select:focus {
  outline: 2px solid var(--compare-accent);
  border-color: var(--compare-accent);
}
body.dark-mode .brand-detail-page .brand-detail-version-select option,
body.dark-mode .brand-detail-page .brand-version select option {
  background: var(--compare-card-bg);
  color: var(--compare-text);
}
body.dark-mode .brand-detail-page .brand-detail-core-section .brand-detail-section-title,
body.dark-mode .brand-detail-page .brand-detail-section-title,
body.dark-mode .brand-detail-page .brand-detail-subsection-title {
  color: var(--compare-section-title);
}
body.dark-mode .brand-detail-page .brand-detail-unit,
body.dark-mode .brand-detail-page .brand-detail-core-section .brand-detail-unit,
body.dark-mode .brand-detail-page .brand-detail-metric-note {
  color: var(--compare-muted);
}

body.dark-mode .brand-detail-page .brand-detail-rank-summary__text {
  color: var(--color-accent-rank);
}

body.dark-mode .brand-detail-page .brand-detail-rank-summary__suffix {
  color: var(--text-sub);
}
body.dark-mode .brand-detail-page .brand-detail-info-table,
body.dark-mode .brand-detail-page .brand-detail-year-table,
body.dark-mode .brand-detail-page .brand-detail-core-table,
body.dark-mode .brand-detail-page .brand-detail-region-table {
  border-color: var(--compare-border);
  border-top: 2px solid var(--compare-border-strong);
}
body.dark-mode .brand-detail-page .brand-detail-info-table th,
body.dark-mode .brand-detail-page .brand-detail-info-table td,
body.dark-mode .brand-detail-page .brand-detail-year-table th,
body.dark-mode .brand-detail-page .brand-detail-year-table td,
body.dark-mode .brand-detail-page .brand-detail-core-table th,
body.dark-mode .brand-detail-page .brand-detail-core-table td,
body.dark-mode .brand-detail-page .brand-detail-region-table th,
body.dark-mode .brand-detail-page .brand-detail-region-table td {
  border-color: var(--compare-border);
  color: var(--compare-text);
}
/* 상세 thead만 비교표(.compare-* thead th)와 동일 */
body.dark-mode .brand-detail-page .brand-detail-info-table thead th,
body.dark-mode .brand-detail-page .brand-detail-year-table thead th,
body.dark-mode .brand-detail-page .brand-detail-region-table thead th,
body.dark-mode .brand-detail-page .brand-detail-core-table thead th,
body.dark-mode .brand-detail-page .brand-detail-core-table thead th.brand-detail-th-item,
body.dark-mode .brand-detail-page .brand-detail-year-table thead th.brand-detail-th-item {
  background: var(--compare-header-bg);
  color: var(--compare-text);
  font-weight: 700;
  border-color: var(--compare-border);
}
body.dark-mode .brand-detail-page .brand-detail-info-table tbody td,
body.dark-mode .brand-detail-page .brand-detail-year-table tbody td,
body.dark-mode .brand-detail-page .brand-detail-region-table tbody td,
body.dark-mode .brand-detail-page .brand-detail-core-table tbody td {
  background: var(--compare-card-bg);
}
body.dark-mode .brand-detail-page .brand-detail-info-table tbody th,
body.dark-mode .brand-detail-page .brand-detail-year-table tbody th,
body.dark-mode .brand-detail-page .brand-detail-core-table tbody th,
body.dark-mode .brand-detail-page .brand-detail-region-table tbody th.brand-detail-col-label {
  background: var(--bg-card-soft);
  color: var(--text-main);
  border-color: var(--compare-border);
}
body.dark-mode .brand-detail-page .brand-detail-col-value {
  color: var(--compare-text);
}
body.dark-mode .brand-detail-page .brand-detail-loading {
  color: var(--compare-muted);
}
body.dark-mode .brand-detail-page .brand-detail-back {
  border-top-color: var(--compare-border);
}
body.dark-mode .brand-detail-page .brand-detail-back a,
body.dark-mode .brand-detail-page .brand-detail-back a:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .brand-detail-page .brand-detail-back a:hover {
  text-decoration: underline;
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .brand-detail-page .brand-detail-back a:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}
body.dark-mode .brand-detail-page .brand-detail-not-found-title {
  color: var(--compare-text);
}
body.dark-mode .brand-detail-page .brand-detail-not-found-desc {
  color: var(--compare-muted);
}
body.dark-mode .brand-detail-page .brand-detail-not-found-actions .btn-go-home,
body.dark-mode .brand-detail-page .brand-detail-not-found-actions .btn-go-to-compare {
  color: var(--compare-accent);
  border-color: var(--compare-accent);
}

/* 버튼 - 비교 담기 */
body.dark-mode .btn-add-to-compare {
  background: var(--compare-header-bg);
  color: var(--compare-text);
  border: 1px solid var(--compare-border-strong);
}
body.dark-mode .btn-add-to-compare:hover:not(:disabled) {
  background: var(--compare-border-strong);
}
body.dark-mode .btn-add-to-compare:disabled {
  background: var(--compare-border);
  color: var(--compare-muted);
  border-color: var(--compare-border);
}

/* 업종 평균 힌트 / avg-diff */
body.dark-mode .compare-avg-hint,
body.dark-mode .avg-diff {
  color: var(--compare-muted);
}
body.dark-mode .avg-diff-high {
  color: #34d399;
}
body.dark-mode .avg-diff-low {
  color: #f87171;
}

/* compare-header-table (CompareHeaderTable 컴포넌트) */
body.dark-mode .compare-header-table {
  border-color: var(--compare-border);
}
body.dark-mode .compare-header-table th,
body.dark-mode .compare-header-table td {
  border-color: var(--compare-border);
  color: var(--compare-text);
}
body.dark-mode .compare-header-table thead th {
  background: var(--compare-header-bg);
  color: var(--compare-text);
}

.main-content {
  flex: 1;
}

.main-footer {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  padding: 24px 20px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
  text-align: center;
}
.main-footer-inner {
  max-width: 800px;
  margin: 0 auto;
}
.main-footer-item {
  margin: 0 0 8px;
}
.main-footer-item:last-child {
  margin-bottom: 0;
}
.main-footer-links {
  margin-top: 4px;
}
.main-footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.main-footer-link:hover {
  color: var(--navy);
}
.main-footer-sep {
  margin: 0 8px;
  opacity: 0.6;
}
.main-footer-copy {
  margin-top: 12px;
  font-size: 12px;
  opacity: 0.9;
}
body.dark-mode .main-footer {
  color: var(--compare-muted);
  border-color: var(--border-light);
}
body.dark-mode .main-footer-link {
  color: var(--compare-muted);
}
body.dark-mode .main-footer-link:hover {
  color: var(--dm-link);
  text-decoration: underline;
  text-decoration-color: var(--dm-link-decoration-strong);
  text-underline-offset: 2px;
}
body.dark-mode .main-footer-link:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

/* SEO 보조 한 줄 — #app 마지막·site footer 직상, 카드/박스/강조 없음 */
.seo-mini-wrap {
  margin-top: 20px;
  margin-bottom: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  max-width: 100%;
}
.seo-mini {
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  font-weight: 400;
  text-align: left;
}
body.dark-mode .seo-mini {
  color: var(--compare-muted);
}
@media (max-width: 768px) {
  .seo-mini-wrap {
    margin-top: 16px;
  }
}

/* 순위 페이지: SEO 미니만 감싸는 빈 래퍼(추가 박스 없음) */
#rankingSeoMiniHost {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

/* SEO 블록 내부 간격 — h2·본문 밀도 정리 (순위 페이지) */
.seo-content * {
  margin-top: 0;
  margin-bottom: 0;
}

.seo-content h2 {
  margin-top: 16px;
  margin-bottom: 8px;
}

.seo-content h3 {
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: inherit;
  font-weight: 600;
}

.seo-content p {
  margin-bottom: 6px;
  line-height: 1.6;
}

.seo-content {
  margin-bottom: 0;
}

/* 상세·연도별 하단: SEO용 H1 (숨김 없이 소형·저채도) — .seo-content * 리셋보다 우선 */
.brand-detail-page .seo-content > .seo-h1-safe {
  font-size: 14px;
  font-weight: 500;
  color: #9ca3af;
  margin: 0 0 6px 0;
  line-height: 1.35;
}

body.dark-mode .brand-detail-page .seo-content > .seo-h1-safe {
  color: #9ca3af;
}

/* TOP20 한 줄: 마크업상 .seo-mini 는 #rankingSeoMiniHost 안에 있음(형제) */
.ranking-page #rankingSeoMiniHost .seo-mini-wrap {
  margin-top: 16px;
  margin-bottom: 0;
}

.ranking-page #rankingSeoMiniHost .seo-mini {
  margin-top: 0;
  margin-bottom: 0;
  color: #6b7280;
  font-size: 13px;
}

body.dark-mode .ranking-page #rankingSeoMiniHost .seo-mini {
  color: var(--compare-muted);
}

/* 이용약관/개인정보처리방침 정적 페이지 */
.static-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px;
  line-height: 1.8;
}
.static-page-back {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--navy);
  text-decoration: none;
}
.static-page-back:hover {
  text-decoration: underline;
}
.static-page h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
}
.static-page-body {
  font-size: 14px;
  color: var(--text);
}
.static-page-body section {
  margin-bottom: 20px;
}
.static-page-body h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.static-page-body p {
  margin: 0 0 12px;
}
.static-page-body ul,
.static-page-body ol {
  margin: 8px 0 12px;
  padding-left: 24px;
}
.static-page-body li {
  margin-bottom: 4px;
}
.static-page-body a {
  color: var(--navy);
  text-decoration: none;
}
.static-page-body a:hover {
  text-decoration: underline;
}

body.dark-mode .static-page-back,
body.dark-mode .static-page-back:visited,
body.dark-mode .static-page-body a,
body.dark-mode .static-page-body a:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .static-page-back:hover,
body.dark-mode .static-page-body a:hover {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .static-page-back:focus-visible,
body.dark-mode .static-page-body a:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

/* CompareTray - 메인 CTA 영역 */
.compare-tray {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 14px 16px;
  min-width: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.compare-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
}

.compare-tray-title {
  font-size: 14px;
}

.compare-tray-count {
  color: var(--text-muted);
  font-size: 12px;
}

.compare-tray-list {
  list-style: none;
  margin-bottom: 10px;
}

.compare-tray-item {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.4;
}

.compare-tray-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-tray-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}

.compare-tray-detail,
.compare-tray-yearly {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  min-height: 26px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;
  background: var(--header-bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.compare-tray-detail:hover,
.compare-tray-yearly:hover {
  background: var(--navy);
  color: var(--compare-on-accent);
  border-color: var(--navy);
}

.compare-tray-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  flex-shrink: 0;
}

.compare-tray-remove:hover {
  color: var(--color-danger);
}

.compare-tray-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.compare-btn-group {
  display: flex;
  width: 100%;
  margin-top: 2px;
}

.compare-btn-group button {
  height: 48px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-sizing: border-box;
}

.compare-reset-btn {
  width: 30%;
  background: var(--border-light);
  color: var(--text-main);
  border-radius: 8px 0 0 8px;
}

.compare-reset-btn:hover:not(:disabled) {
  background: var(--border-main);
}

.compare-reset-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.compare-start-btn {
  width: 70%;
  background: var(--navy);
  color: var(--compare-on-accent);
  border-radius: 0 8px 8px 0;
}

.compare-start-btn:hover:not(:disabled) {
  background: var(--navy-dark);
}

.compare-start-btn:disabled {
  background: var(--text-sub);
  cursor: not-allowed;
}

/* 모바일: 비교 바구니 — 리스트만 스크롤, 초기화/비교 버튼은 항상 하단 고정 */
@media (max-width: 768px) {
  .home-tray-area {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 60vh;
  }

  .compare-tray:not(.compare-tray--compact) {
    display: flex;
    flex-direction: column;
    max-height: 60vh;
    min-height: 0;
    padding-bottom: 12px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .compare-tray--compact.compare-tray {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 8px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .compare-tray-header {
    flex-shrink: 0;
  }

  .compare-tray-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
  }

  .compare-tray-hint {
    flex-shrink: 0;
    margin-bottom: 8px;
  }

  .compare-btn-group {
    flex-shrink: 0;
    margin-top: 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: inherit;
  }

  /* 연도별 비교 하단 인라인 바구니 — 본문 흐름이므로 60vh 캡 제거 */
  .yearly-compare-page .brand-detail-home-tray.home-tray-area {
    max-height: none;
  }

}

/* 모바일: 접기형 비교바구니(상세 하단 고정 + 연도별 하단) 공통 — 압축 도구 UI */
@media (max-width: 768px) {
  .compare-tray--compact.compare-tray {
    padding: 6px 8px 8px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  }

  .compare-tray--compact .compare-tray-header--toggle {
    margin: 0 0 2px;
    padding: 3px 0 5px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
    min-height: 0;
  }

  .compare-tray--compact .compare-tray-title {
    font-size: 13px;
  }

  .compare-tray--compact .compare-tray-count {
    font-size: 11px;
    font-weight: 600;
  }

  .compare-tray--compact .compare-tray-chevron {
    padding: 2px 4px;
    min-width: 24px;
    font-size: 10px;
  }

  .compare-tray--compact .compare-tray-slim-hint {
    font-size: 10px;
    margin: 0 0 2px;
    line-height: 1.25;
  }

  .compare-tray--compact .compare-tray-expandable {
    padding-top: 2px;
  }

  /* 한 줄 row · 리스트 톤(카드 배경 제거 → 구분선) */
  .compare-tray--compact .compare-tray-item {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 0;
    margin: 0;
    min-height: 44px;
    max-height: 52px;
    box-sizing: border-box;
    background: transparent;
    border-radius: 0;
    border-bottom: 1px solid var(--border-light);
  }

  .compare-tray--compact .compare-tray-item:last-child {
    border-bottom: none;
  }

  .compare-tray--compact .compare-tray-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
  }

  .compare-tray--compact .compare-tray-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .compare-tray--compact .compare-tray-detail,
  .compare-tray--compact .compare-tray-yearly {
    height: 34px;
    min-height: 34px;
    padding: 0 8px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    border-radius: 6px;
    white-space: nowrap;
    min-width: 0;
  }

  .compare-tray--compact .compare-tray-remove {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
    border-radius: 6px;
    /* 터치: 시각 36px, 탭 영역 확장 */
    position: relative;
  }

  .compare-tray--compact .compare-tray-remove::after {
    content: '';
    position: absolute;
    inset: -4px;
  }

  .compare-tray--compact .compare-tray-hint {
    font-size: 11px;
    margin-bottom: 4px;
    line-height: 1.3;
  }

  .compare-tray--compact .compare-btn-group {
    margin-top: 6px;
    gap: 0;
  }

  .compare-tray--compact .compare-btn-group button {
    height: 38px;
    min-height: 38px;
    font-size: 13px;
    font-weight: 600;
  }

  .compare-tray--compact .compare-reset-btn {
    border-radius: 6px 0 0 6px;
  }

  .compare-tray--compact .compare-start-btn {
    border-radius: 0 6px 6px 0;
  }

  /* 목록 영역: 4행 전후가 보이도록 높이 상한 + 얇은 스크롤 */
  .compare-tray--compact .compare-tray-list {
    scrollbar-width: thin;
  }

  .compare-tray--compact:not(.compare-tray--collapsed) .compare-tray-expandable .compare-tray-list {
    max-height: min(212px, 38vh);
  }

  body.dark-mode .compare-tray--compact .compare-tray-item {
    border-bottom-color: var(--compare-border, #333);
  }

  /* 연도별 하단 바구니: 상세와 동일 HTML — 펼침 시 리스트만 스크롤 */
  .brand-detail-home-tray .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .brand-detail-home-tray .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable .compare-tray-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
  }

  .brand-detail-home-tray .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable .compare-tray-hint {
    flex-shrink: 0;
  }

  .brand-detail-home-tray .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable .compare-btn-group {
    flex-shrink: 0;
    margin-top: 6px;
  }
}

/* Home - site-content 폭 따라감 */
.home-page {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-main);
}

.home-page section:not(:first-of-type) {
  border-top: 1px solid var(--border-light);
}

.home-page .home-feature-card,
.home-page .industry-card,
.home-page .compare-tray,
.home-page .brand-search-results {
  border-color: var(--border-light);
}

.home-hero {
  text-align: center;
  padding: 18px 0 10px;
  margin-bottom: 10px;
}

.home-title {
  text-align: center;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  line-height: 1.3;
}

.home-title,
.home-kpi-title,
.featured-section-title,
.home-feature-grid-title,
.home-page .home-search-area .brand-search-label {
  color: var(--text-main);
}

.hero-sub,
.home-search-hint,
.home-kpi-note,
.featured-section-hint {
  color: var(--text-sub);
}

.hero-subtext,
.hero-sub {
  font-size: 15px;
  color: var(--text-sub);
  margin-top: 6px;
  margin-bottom: 0;
  line-height: 1.6;
  text-align: center;
}

.hero-sub span {
  display: block;
}

/* Home hero: 넓은 가로형 텍스트 블록 */
.home-hero--wide .home-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .home-hero--wide .home-hero-inner {
    padding: 0 20px;
  }
}

.home-desc {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.8;
}

.home-desc-sub {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 4px;
  line-height: 1.8;
}

/* 데이터 규모 KPI 영역 */
.home-kpi-title {
  margin: 6px 0 10px;
  font-size: 20px;
  font-weight: 700;
}

/* 메인 전용: 브랜드 검색 라벨을 KPI 섹션 타이틀(.home-kpi-title)과 동일 계층 — 연도별 등 다른 페이지 .brand-search-label(13px)는 비대상 */
.home-page .home-search-area .brand-search-label {
  margin: 6px 0 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.home-kpi-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 0;
  margin-bottom: 14px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.kpi-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
}

.kpi-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 8px;
  line-height: 1.3;
}

.kpi-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.home-kpi-section .kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  line-height: 1.35;
  min-height: 1.35em;
}

.kpi-item--primary .kpi-label {
  font-weight: 700;
  color: var(--text-sub);
}

.kpi-item--primary .kpi-value {
  font-weight: 800;
  color: var(--text-main);
}

.home-kpi-note {
  margin: -4px 0 14px;
  font-size: 13px;
  line-height: 1.5;
}

.home-search-hint {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
}

/* 메인 하단 — 기능 소개 6카드 그리드 (2행×3열, 업종 TOP4 박스 톤과 정렬) */
.home-feature-grid-section {
  position: relative;
  z-index: 100;
  margin-top: 24px;
  margin-bottom: 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-card);
}

.home-feature-grid-container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* 홈 6카드 그리드와 동일 가로 기준(.home-feature-grid-section 패딩) — 별도 container/max-width 없음 */
.home-feature-grid-container .home-seo-inline {
  width: 100%;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  color: #444;
  font-size: 15px;
  line-height: 1.7;
}

.home-feature-grid-container .home-seo-inline h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.home-feature-grid-container .home-seo-inline p {
  margin-bottom: 14px;
}

.home-feature-grid-container .home-seo-inline p:last-child {
  margin-bottom: 0;
}

body.dark-mode .home-feature-grid-container .home-seo-inline {
  color: var(--compare-muted);
  border-top-color: var(--border-light);
}

.home-feature-grid-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 14px;
  line-height: 1.35;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

@media (min-width: 900px) {
  .home-feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

@media (max-width: 359px) {
  .home-feature-grid {
    grid-template-columns: 1fr;
  }
}

.home-feature-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 100%;
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-main);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}

.home-feature-card:hover {
  border-color: var(--color-primary);
  background: var(--bg-soft);
  box-shadow: none;
}

.home-page .home-feature-grid .home-feature-card.highlight-sky {
  background: var(--color-sky-soft);
  border-color: var(--color-sky-border);
}

.home-page .home-feature-grid .home-feature-card.highlight-sky:hover {
  background: var(--color-sky-soft);
  border-color: var(--color-primary);
}

.home-feature-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin: 0 0 6px;
}

.home-feature-card-desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-sub);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

body.dark-mode .home-feature-grid-section {
  background: var(--bg-section);
  border-color: var(--border-light);
}

body.dark-mode .home-feature-card {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-main);
}

body.dark-mode .home-feature-card:hover {
  border-color: var(--color-primary);
  background: var(--bg-soft);
  box-shadow: none;
}

body.dark-mode .home-page .home-feature-grid .home-feature-card.highlight-sky {
  background: var(--bg-card-soft);
  border-color: var(--border-strong);
}

body.dark-mode .home-page .home-feature-grid .home-feature-card.highlight-sky:hover {
  background: var(--bg-card-soft);
  border-color: var(--color-primary);
}

body.dark-mode .home-feature-card-title {
  color: var(--text-main);
}

body.dark-mode .home-feature-card-desc {
  color: var(--text-sub);
}

@media (max-width: 768px) {
  .home-feature-grid-section {
    padding: 14px 14px 16px;
  }

  .home-feature-grid-title {
    font-size: 1rem;
    margin-bottom: 14px;
  }

  .home-feature-grid {
    gap: 10px;
  }

  .home-feature-card {
    padding: 11px 12px;
  }

  .home-feature-card-title {
    font-size: 13px;
    margin-bottom: 5px;
  }

  .home-feature-card-desc {
    font-size: 12px;
    line-height: 1.42;
  }
}

/* 검색 + 비교바구니 결합 섹션 */
.home-search-tray-section {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
  overflow: visible;
}

.home-search-area {
  min-width: 0;
  position: relative;
  z-index: 110;
  overflow: visible;
}

.home-tray-area {
  min-width: 0;
}

.brand-search-box {
  position: static;
}

.brand-search-dropdown-wrap {
  position: relative;
  width: 100%;
}

.brand-search-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
}

.brand-search-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border-light);
  font-size: 16px;
  color: var(--text-main);
  background: var(--bg-main);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.brand-search-input::placeholder {
  font-size: 15px;
}

.brand-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.brand-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 0 0 12px 12px;
  margin-top: 0;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.search-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #888;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #ddd;
  border-top: 2px solid #555;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  min-height: 0;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
}

.search-result-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.search-result-info .search-result-name,
.search-result-info .search-result-name-btn {
  text-align: left;
  width: 100%;
}

.search-result-info .search-result-corp {
  margin-left: 0;
  margin-top: 0;
  text-align: left;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-name {
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  line-height: 1.25;
}

.search-result-name:hover {
  text-decoration: underline;
}

/* 연도별 비교 페이지 (초안) */
.yearly-compare-page-header {
  margin-bottom: 16px;
  padding: 0 4px;
}

.yearly-compare-search-section {
  margin-bottom: 20px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 4px;
}

.yearly-compare-page-title {
  font-size: 1.35rem;
  margin: 0 0 6px;
  color: var(--navy);
}

.yearly-compare-page-desc {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.yearly-compare-brand-title {
  font-size: 1.15rem;
  margin: 0 0 8px;
  color: var(--text);
}

.yearly-compare-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.yearly-compare-meta-line {
  display: inline-block;
}

/* 연도별 비교: 브랜드 헤더 + 안내문 공통 콘텐츠 폭(브랜드 비교/상세와 동일 --compare-table-width) */
.yearly-compare-top-wrap {
  width: 100%;
  max-width: var(--compare-table-width);
  margin-left: auto;
  margin-right: auto;
  padding: 0 4px;
  box-sizing: border-box;
}

.yearly-compare-brand-header-shell {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding: 0;
  box-sizing: border-box;
}

.yearly-compare-top-wrap .yearly-compare-brand-header-shell.brand-detail-page--ftc {
  max-width: none;
  width: 100%;
}

.yearly-compare-notice-area {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding: 0 0 12px;
  box-sizing: border-box;
}

.yearly-compare-notice-area .compare-notice {
  max-width: 100%;
  box-sizing: border-box;
}

.yearly-compare-notice-area:empty {
  display: none;
  padding: 0;
  margin: 0;
}

.yearly-compare-scroll-wrap {
  margin-top: 0;
}

/* 연도별 비교 하단: 상세와 동일하게 brand-detail-page--ftc 하나 안에 (크롬 → SEO 미니) — 폭·footer 직전 여백 통일 */
.yearly-compare-page.compare-detail-page {
  padding-bottom: 0;
}

.yearly-compare-page > .brand-detail-bottom-stack.brand-detail-page--ftc {
  margin-top: 16px;
  padding-top: 0;
  padding-bottom: 40px;
  padding-left: 0;
  padding-right: 0;
}

.yearly-compare-page--empty > .brand-detail-bottom-stack {
  margin-top: 24px;
}

/* 연도별 비교 헤더 셸: 상세 문서 루트용 .brand-detail-page--ftc(padding 20px 0 40px)가 붙어 있어 세로 패딩이 중복됨 → 셸만 0으로 정리 */
.yearly-compare-brand-header-shell.brand-detail-page--ftc {
  padding-top: 0;
  padding-bottom: 0;
}

.yearly-compare-empty-box {
  padding: 24px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  max-width: 520px;
  margin: 16px 4px 0;
}

.yearly-compare-empty-title {
  font-weight: 600;
  margin: 0 0 8px;
}

.yearly-compare-empty-hint {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.yearly-compare-empty-link {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}
.yearly-compare-empty-link:hover {
  text-decoration: underline;
}

body.dark-mode .yearly-compare-empty-link,
body.dark-mode .yearly-compare-empty-link:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .yearly-compare-empty-link:hover {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .yearly-compare-empty-link:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

.search-result-name-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.search-result-corp {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.2;
}

.search-result-reg {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.search-result-industry {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0;
  line-height: 1.2;
}

.search-result-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.search-result-actions--three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  max-width: 420px;
}

.search-result-actions--two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  max-width: 300px;
}

.search-result-actions--two .search-result-btn-secondary,
.search-result-actions--two .search-result-btn-primary {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 12px;
}

.search-result-actions--three .search-result-btn-secondary,
.search-result-actions--three .search-result-btn-primary {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 12px;
}

@media (max-width: 520px) {
  .search-result-item:has(.search-result-actions--three) {
    flex-direction: column;
    align-items: stretch;
  }
  .search-result-actions--three {
    max-width: none;
    width: 100%;
  }
  .search-result-item:has(.search-result-actions--two) {
    flex-direction: column;
    align-items: stretch;
  }
  .search-result-actions--two {
    max-width: none;
    width: 100%;
  }
}

.search-result-btn-secondary,
.search-result-btn-primary {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-result-btn-secondary {
  background: #fff;
  color: var(--navy);
  border-color: var(--navy);
}

.search-result-btn-secondary:hover {
  background: rgba(30, 58, 95, 0.06);
}

.search-result-btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.search-result-btn-primary:hover:not(:disabled) {
  background: var(--navy-dark);
}

.search-result-btn-primary:disabled,
.btn-add-to-compare:disabled {
  background: #9ca3af;
  border-color: #9ca3af;
  cursor: default;
}

.btn-add-to-compare {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--navy);
  color: #fff;
  border: none;
  cursor: pointer;
}

.btn-add-to-compare:disabled {
  background: #9ca3af;
  cursor: default;
}

.search-no-result {
  padding: 16px;
  color: var(--text-muted);
}

.home-recent-section {
  text-align: center;
  padding: 20px;
  border: 1px solid var(--border);
}

.section-title {
  font-size: 1rem;
  margin-bottom: 8px;
}

.section-hint {
  color: var(--text-muted);
  font-size: 13px;
}

/* Compare Page - 공정위 보고서 스타일, 타이트한 폭 */
.compare-page {
  padding-bottom: 24px;
}

.compare-page-inner {
  width: 100%;
}

.compare-page-empty {
  text-align: center;
  padding: 32px;
}

.compare-page-empty a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}

.compare-page-empty a:hover {
  text-decoration: underline;
}

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

.compare-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.compare-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.02em;
}

.compare-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compare-output-date {
  font-size: 11px;
  color: var(--text-muted);
}

.compare-reset-link {
  color: var(--navy);
  text-decoration: none;
  font-size: 12px;
}

.compare-reset-link:hover {
  text-decoration: underline;
}

.btn-share-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--navy);
  color: var(--compare-on-accent);
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
}

.btn-share-link:hover {
  background: var(--navy-dark);
}

.btn-share-link-icon {
  display: inline-flex;
  line-height: 0;
}

.btn-share-link-text {
  white-space: nowrap;
}

.compare-basket-summary {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

/* 단일 비교 테이블 공통 - 공정위 스타일 (compare-table 규칙 적용) */
.compare-unified-table {
  width: var(--compare-table-width);
  border-collapse: collapse;
  table-layout: fixed;
  max-width: 100%;
}

.compare-unified-table th,
.compare-unified-table td {
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: normal;
}

.compare-col-brand {
  text-align: center;
}

/* 핵심지표 표 값 가운데 정렬 (다른 규칙 override 방지) */
.compare-kpi-table td,
.compare-kpi-section .compare-kpi-table td,
.compare-core-section .compare-core-table td {
  text-align: center !important;
}

.brand-divider {
  border-right: 1px solid var(--compare-cell-border) !important;
}

/* 공통 가로폭 블록 - 헤더/제목/표 모두 동일 기준 (728px) */
.compare-content-block,
.compare-header-table-wrap,
.compare-kpi-section,
.compare-detail-section,
.compare-block,
.compare-core-section,
.compare-detail,
.doc-section {
  width: var(--compare-table-width);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.compare-table-wrap,
.compare-kpi-wrap,
.compare-section-wrap,
.doc-table-wrap,
.compare-detail-table-wrap,
.compare-region-wrap {
  width: 100%;
  max-width: 100%;
  margin-bottom: 10px;
  overflow-x: visible;
  box-sizing: border-box;
}

.compare-section-title {
  color: var(--compare-text-strong);
  font-weight: 700;
  font-size: 16px;
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--compare-border-mid);
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
}

/* 대제목: 핵심 지표, 가맹본부의 일반 현황 등 섹션 제목 */
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--compare-text-strong);
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
}

.section-title:first-child {
  margin-top: 0;
}

/* 중제목: 기본 정보, 재무상황, 임직원 등 블록 제목 */
.subsection-title {
  font-size: 15px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--compare-text-strong);
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
}

.compare-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--compare-text-strong);
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--compare-border-mid);
  width: 100%;
  box-sizing: border-box;
}

.compare-detail-section,
.compare-kpi-section {
  margin-bottom: 10px;
}

.compare-year-select {
  width: 100%;
  max-width: 70px;
  padding: 3px 4px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--compare-input-bg);
  line-height: 1.3;
}

/* 얇은 표형 헤더 - 가운데 정렬 */
.compare-header-table .brand-header-cell,
.compare-header-table .brand-header-cell *,
.brand-header-cell,
.brand-header-cell * {
  text-align: center;
}

.brand-header-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-header-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--compare-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-header-version-text {
  font-size: 10px;
  line-height: 1.2;
  color: var(--text-main);
}

.version-select {
  width: 100%;
  max-width: 100%;
  padding: 2px 4px;
  font-size: 10px;
  border: 1px solid var(--border);
  background: var(--compare-input-bg);
}

.version-select.compare-year-select {
  width: 100%;
  height: 22px;
  margin-top: 0;
  font-size: 10px;
}

/* 제어 칸 - 왼쪽 첫 칸 (항목열과 동일 폭) - 세로/가로 모두 가운데 정렬 */
.compare-control-cell {
  width: var(--compare-label-col);
  min-width: var(--compare-label-col);
  max-width: var(--compare-label-col);
  padding: 4px 6px;
  text-align: center;
  background: var(--header-bg);
  font-weight: 600;
  vertical-align: middle;
}

/* compare-brand-cell: 단일 wrapper 구조 (하단 빈 영역 방지) */
.compare-brand-cell .compare-brand-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* Legacy: compare-control-title/desc (CompareHeaderTable 등 구 구조 호환) */
.compare-control-cell .compare-control-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--compare-text-strong);
}
.compare-control-cell .compare-control-desc {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.2;
  color: var(--compare-muted-text);
}

.compare-row-label {
  width: var(--compare-label-col);
  min-width: var(--compare-label-col);
  background: var(--header-bg);
  font-weight: 600;
  vertical-align: middle;
}

.compare-col-label {
  width: var(--compare-label-col);
}

.compare-col-brand {
  /* compare-core-table, compare-region-table: colgroup style로 width 지정 */
}

/* 공정위 스타일 표 - 브랜드 비교용 모든 표 통일 (768px = 96 + 4×168) */
.compare-header-table,
.compare-table,
.compare-unified-table,
.compare-kpi-table,
.compare-section-table,
.compare-metrics-table,
.compare-table-unified,
.doc-table,
.compare-core-table,
.compare-region-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-top: 2px solid var(--compare-text-strong);
  margin: 0;
  box-sizing: border-box;
}

.compare-table th,
.compare-table td,
.compare-unified-table th,
.compare-unified-table td,
.compare-kpi-table th,
.compare-kpi-table td,
.compare-section-table th,
.compare-section-table td,
.compare-metrics-table th,
.compare-metrics-table td,
.compare-table-unified th,
.compare-table-unified td,
.doc-table th,
.doc-table td,
.compare-core-table th,
.compare-core-table td,
.compare-region-table th,
.compare-region-table td {
  border: 1px solid var(--compare-cell-border);
  text-align: center;
  vertical-align: middle;
  padding: 4px 5px;
  font-size: 11px;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 브랜드 데이터 셀: 주소·긴 숫자·문자열 줄바꿈, 칸 밖 넘침·겹침 방지 */
.compare-table tbody td:not(:first-child),
.compare-unified-table tbody td:not(:first-child),
.compare-kpi-table tbody td:not(:first-child),
.compare-section-table tbody td:not(:first-child),
.compare-metrics-table tbody td:not(:first-child),
.compare-core-table tbody td:not(:first-child),
.compare-region-table tbody td:not(:first-child),
.doc-table tbody td:not(:first-child) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}

.compare-table thead th,
.compare-unified-table thead th,
.compare-kpi-table thead th,
.compare-section-table thead th,
.compare-metrics-table thead th,
.compare-table-unified thead th,
.doc-table thead th,
.compare-core-table thead th,
.compare-region-table thead th {
  background: var(--compare-table-head-bg);
  color: var(--compare-table-head-text);
  font-weight: 600;
}

/* 핵심지표 표 브랜드 헤더 셀 (브랜드명/기준연도/버전 3단) */
.compare-core-table th.brand-header-cell {
  text-align: center;
  vertical-align: middle;
  line-height: 1.3;
  padding: 6px 4px;
}

.compare-core-table th.brand-header-cell .brand-header-name {
  font-size: 12px;
  font-weight: 600;
}

.compare-core-table th.brand-header-cell .brand-header-year {
  font-size: 10px;
  color: var(--compare-muted-text);
}

.compare-core-table th.brand-header-cell .brand-header-version {
  font-size: 10px;
  color: var(--compare-muted-text);
}

/* 첫 열(항목 열) - colgroup 비율 사용 시 미적용 (.compare-table-cols, .compare-core-table) */
.compare-table:not(.compare-core-table):not(.compare-table-cols) th:first-child,
.compare-table:not(.compare-core-table):not(.compare-table-cols) td:first-child,
.compare-unified-table th:first-child,
.compare-unified-table td:first-child,
.compare-kpi-table th:first-child,
.compare-kpi-table td:first-child,
.compare-section-table th:first-child,
.compare-section-table td:first-child,
.compare-metrics-table th:first-child,
.compare-metrics-table td:first-child,
.doc-table th:first-child,
.doc-table td:first-child {
  width: var(--compare-item-col);
  min-width: var(--compare-item-col);
  max-width: var(--compare-item-col);
}

.compare-table:not(.compare-core-table):not(.compare-table-cols) th:not(:first-child),
.compare-table:not(.compare-core-table):not(.compare-table-cols) td:not(:first-child),
.compare-unified-table th:not(:first-child),
.compare-unified-table td:not(:first-child),
.compare-kpi-table th:not(:first-child),
.compare-kpi-table td:not(:first-child),
.compare-section-table th:not(:first-child),
.compare-section-table td:not(:first-child),
.compare-metrics-table th:not(:first-child),
.compare-metrics-table td:not(:first-child),
.doc-table th:not(:first-child),
.doc-table td:not(:first-child) {
  width: var(--compare-brand-col);
  min-width: var(--compare-brand-col);
  max-width: var(--compare-brand-col);
}

/* compare-core-table, compare-region-table: colgroup으로 폭 제어 (200px + 균등 분배) */

/* 첫 열(항목) 셀 - 긴 항목명 한 줄 유지, 패딩 소폭 축소 */
.compare-table th:first-child,
.compare-table td:first-child,
.compare-unified-table th:first-child,
.compare-unified-table td:first-child,
.compare-kpi-table th:first-child,
.compare-kpi-table td:first-child,
.compare-section-table th:first-child,
.compare-section-table td:first-child,
.compare-metrics-table th:first-child,
.compare-metrics-table td:first-child,
.compare-core-table th:first-child,
.compare-core-table td:first-child,
.compare-region-table th:first-child,
.compare-region-table td:first-child,
.doc-table th:first-child,
.doc-table td:first-child {
  white-space: nowrap;
  word-break: keep-all;
  padding-left: 4px;
  padding-right: 4px;
}

/* 헤더 테이블 - 본문과 동일 폭 체계 (88/160) */
.compare-header-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: var(--compare-table-width);
  border-top: 2px solid var(--compare-text-strong);
  margin: 0;
  max-width: 100%;
}

.compare-header-table th,
.compare-header-table td {
  border: 1px solid var(--compare-cell-border);
}

.compare-header-table .brand-header-cell {
  width: var(--compare-brand-col);
  min-width: var(--compare-brand-col);
  max-width: var(--compare-brand-col);
  text-align: center;
  vertical-align: middle;
  padding: 4px 6px;
  word-break: keep-all;
  overflow-wrap: normal;
}

.brand-header-cell {
  padding: 4px 6px;
}

/* CompareDetailPage 헤더 패널 - 본문과 동일 160px */
.compare-header-panel.brand-header-cell {
  width: var(--compare-brand-col);
  min-width: var(--compare-brand-col);
  max-width: var(--compare-brand-col);
}

/* CompareDetailPage 제어 칸 패널 */
.compare-header-panel.compare-control-cell {
  width: var(--compare-item-col);
  min-width: var(--compare-item-col);
  max-width: var(--compare-item-col);
}

/* colgroup 폭 - 헤더/본문 통일 (88/160) */
col.col-item,
col.compare-col-label {
  width: var(--compare-item-col);
}
col.col-brand,
col.compare-col-brand {
  width: var(--compare-brand-col);
}

.compare-brand-disclosure {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.compare-brand-year-meta {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.compare-brand-status {
  margin-top: 6px;
  padding: 5px 8px;
  font-size: 12px;
}

.compare-brand-status-empty {
  background: var(--bg-soft);
  border: 1px solid var(--border-main);
  color: var(--text-sub);
}

.compare-brand-status-warning {
  background: var(--compare-warning-bg);
  border: 1px solid var(--compare-warning-border);
  color: var(--compare-warning-text);
}

.compare-brand-status p {
  margin: 0;
}

.compare-warnings-block {
  margin-bottom: 16px;
}

.compare-warnings-block .compare-brand-warning {
  margin-bottom: 8px;
}

.compare-warnings-block .compare-brand-warning:last-child {
  margin-bottom: 0;
}

.compare-brand-warning {
  padding: 8px 12px;
  background: #fef3c7;
  border: 1px solid #d97706;
  font-size: 13px;
  color: #92400e;
}

.compare-brand-warning p {
  margin: 0;
}

.compare-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* 메타 정보 바 - 공정위 문서형 */
.compare-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--header-bg);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.compare-meta-bar .meta-item {
  white-space: nowrap;
}

.compare-meta-bar strong {
  color: var(--text);
  margin-right: 4px;
}

.compare-brands-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.compare-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--compare-input-bg);
  border: 1px solid var(--border);
}

.btn-remove-chip {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
}

.btn-pdf {
  padding: 6px 14px;
  background: var(--accent);
  color: var(--compare-on-accent);
  border: none;
  cursor: pointer;
}

/* 상단 핵심지표 - 상세비교와 스타일 통일 (네이비 톤) */
.compare-summary {
  margin-bottom: 20px;
}

.compare-summary h2,
.compare-detail-title {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--compare-section-border);
}

/* compare-metrics-table, doc-table: 공통 블록에서 규칙 적용 (폭/패딩 위에 정의됨) */
.compare-metrics-table .col-item,
.doc-table .col-item,
.doc-table .doc-col-item {
  background: var(--compare-table-head-bg);
  color: var(--compare-table-head-text);
  font-weight: 700;
  text-align: center;
}

.compare-metrics-table th.brand-group-end,
.compare-metrics-table td.brand-group-end {
  border-right: 1px solid var(--compare-cell-border) !important;
}

/* 단일 브랜드: 표 폭 안정화 (label | value 2열) */
.compare-summary--single .compare-metrics-table .col-brand,
.doc-table--single .col-brand {
  max-width: 280px;
}

.doc-table-wrap--single {
  overflow-x: visible;
}

.cell-best {
  background: var(--best-bg);
  font-weight: 600;
}

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 11px;
  background: var(--best-border);
  color: var(--compare-on-accent);
}

/* 하단 상세 - 공정위 문서형 스타일 */
.compare-detail-document {
  background: var(--compare-bg);
  margin: 0;
  padding: 0 0 24px;
}

.compare-detail-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 20px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--compare-section-border);
}

.doc-section {
  margin-bottom: 20px;
  break-inside: avoid;
}

/* 공정위 스타일: 단순 제목 + 얇은 구분선 */
.doc-section-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 0;
  margin-top: 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--compare-section-border);
}

.doc-section-status {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 8px;
}

.doc-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
  margin: 0 0 8px 0;
}

/* doc-table: 공통 비교표 블록에서 폭/패딩/테두리 적용 */

.doc-table th.brand-group-end,
.doc-table td.brand-group-end {
  border-right: 1px solid var(--compare-cell-border) !important;
}

/* 모바일: 표 가로스크롤 */
.doc-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 가로 스크롤 시각 단서 */
.scroll-hint-mobile {
  display: none;
}
@media screen and (max-width: 768px) {
  .scroll-hint-mobile {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin: -8px 0 12px 0;
  }
  .compare-summary-outer {
    position: relative;
  }
  .compare-summary-outer::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 24px;
    background: linear-gradient(to right, transparent, color-mix(in srgb, var(--bg-main) 92%, transparent));
    pointer-events: none;
  }
}

@media screen and (max-width: 768px) {
  .compare-detail-document {
    margin: 0 -16px;
  }
  .doc-table {
    min-width: 480px;
  }

  /* Top20 모바일: 카드형 */
  .top20-desktop {
    display: none !important;
  }
  .top20-mobile {
    display: block !important;
  }

  /* Compare 핵심지표 표 가로 스크롤 */
  .compare-summary {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .compare-summary .compare-metrics-table {
    min-width: 480px;
  }

  /* 평균 대비: 모바일 짧은 문구 */
  .avg-diff-full {
    display: none;
  }
  .avg-diff-short {
    display: inline;
  }

  /* 브랜드칩/긴 텍스트 줄바꿈 */
  .compare-brand-chip span {
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 120px;
  }

  /* ===== Compare 페이지 모바일 전면 최적화 ===== */
  /* 헤더: 데스크톱 표 숨김, 모바일 카드형 표시 */
  .compare-header-desktop {
    display: none !important;
  }
  .compare-header-mobile.compare-mobile-header-wrap {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    margin: 0 auto 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .compare-mobile-header-card {
    background: var(--compare-card-bg);
    border: 1px solid var(--compare-cell-border);
    border-radius: 6px;
    padding: 16px 16px;
    box-sizing: border-box;
    width: 100%;
  }
  body.dark-mode .compare-mobile-header-card {
    background: var(--compare-header-bg);
    border-color: var(--compare-border);
  }
  .compare-mobile-header-card-label {
    font-size: 11px;
    color: var(--text-sub);
    margin-bottom: 4px;
  }
  body.dark-mode .compare-mobile-header-card-label {
    color: var(--text-sub);
  }
  .compare-mobile-header-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--compare-text-strong);
    line-height: 1.3;
    word-break: keep-all;
    overflow-wrap: break-word;
    margin-bottom: 2px;
  }
  body.dark-mode .compare-mobile-header-card-name {
    color: var(--compare-text);
  }
  .compare-mobile-header-card .brand-meta-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--compare-muted-text);
    margin-top: 2px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .compare-mobile-header-card .brand-meta-inline .brand-base-year,
  .compare-mobile-header-card .brand-meta-inline .brand-version-label {
    flex-shrink: 0;
    font-size: 13px;
  }
  .compare-mobile-header-card .brand-meta-inline .compare-version-select {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    width: auto;
    min-width: 115px;
    max-width: 130px;
  }
  body.dark-mode .compare-mobile-header-card .brand-meta-inline {
    color: var(--text-sub);
  }

  /* Compare 모바일: 항목명/헤더 줄바꿈 허용 (공정거래위원회 시정조치, 민사소송 패소, 브랜드 평균매출액 등) */
  .compare-table th:first-child,
  .compare-table td:first-child,
  .compare-unified-table th:first-child,
  .compare-unified-table td:first-child,
  .compare-core-table th:first-child,
  .compare-core-table td:first-child,
  .compare-region-table th:first-child,
  .compare-region-table td:first-child,
  .compare-section-table th:first-child,
  .compare-section-table td:first-child,
  .compare-table th.compare-col-item,
  .compare-table td.compare-col-item {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
  .compare-region-table thead th,
  .compare-core-table thead th.brand-header-cell {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
  /* 모바일 헤더 카드: 브랜드 1, 브랜드명만 줄바꿈 허용 (메타 줄은 한 줄 유지) */
  .compare-mobile-header-card-label,
  .compare-mobile-header-card-name {
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* ===== Compare 페이지 모바일: 상세페이지와 동일 원칙 (오른쪽 잘림 방지) ===== */
  /* 루트: 폭 100%, overflow-x hidden으로 페이지 가로 스크롤 차단 */
  .compare-detail-page,
  .compare-print-area,
  .compare-scroll-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  /* 상세페이지와 동일: padding 0 4px */
  .compare-detail-page {
    padding: 0 4px;
  }
  /* print-content/report-container: 상세페이지 brand-detail-page와 동일 */
  .compare-detail-page .print-content.report-container,
  .compare-detail-page .print-sheet {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }

  /* content-block: width 100%, min-width 0으로 flex/grid 자식 수축 허용 */
  .compare-detail-page .compare-content-block,
  .compare-detail-page .compare-header-table-wrap,
  .compare-detail-page .compare-core-section,
  .compare-detail-page .compare-detail-section,
  .compare-detail-page .compare-block,
  .compare-detail-page .compare-chart-block,
  .compare-detail-page .compare-print-brand-summary,
  .compare-detail-page .compare-section-blocks {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }

  /* 표 wrapper: 상세페이지 brand-detail-table-wrap과 동일 - overflow-x auto, wrapper 내부 스크롤 */
  .compare-detail-page .compare-table-wrap,
  .compare-detail-page .compare-region-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }
  /* 표: wrapper 폭에 맞추되 4열은 최소폭 유지. wrapper에서 스크롤 */
  .compare-detail-page .compare-core-table,
  .compare-detail-page .compare-table,
  .compare-detail-page .compare-region-table {
    min-width: 320px;
    width: 100%;
    table-layout: fixed;
  }

  /* 핵심지표 섹션: 모바일 우선 최적화 */
  .compare-detail-page .compare-core-section {
    padding: 0;
  }
  .compare-detail-page .compare-core-section .compare-section-header {
    flex-wrap: wrap;
    gap: 4px;
  }
  .compare-detail-page .compare-table-wrap .compare-section-header {
    align-items: flex-start;
  }
  .compare-detail-page .compare-core-section .compare-metric-note {
    font-size: 10px;
    padding: 6px 0;
  }

  /* compare-col-item: 모바일에서 min-width 완화 (표가 wrapper 안에서 스크롤되도록) */
  .compare-detail-page .compare-col-item {
    min-width: 0 !important;
  }

  /* flex/grid 자식 min-width 0: shrink 허용 */
  .compare-detail-page,
  .compare-print-area,
  .compare-scroll-wrap,
  .compare-detail-page .print-sheet,
  .compare-detail-page .print-content.report-container {
    min-width: 0;
  }

  /* print-page: 모바일에서 패딩 축소 (상세페이지와 동일) */
  .compare-detail-page .print-page {
    padding-left: 0;
    padding-right: 0;
  }

  /* compare-unified-table (KpiTable, SectionTable): 모바일 폭 처리 */
  .compare-detail-page .compare-unified-table {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 차트 블록: min-width 0으로 수축 허용 */
  .compare-detail-page .compare-charts-wrap,
  .compare-detail-page .compare-chart-block {
    min-width: 0;
  }

  /* 안내/공지: 긴 텍스트 줄바꿈 */
  .compare-detail-page .compare-notice {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* 480px 이하: 모바일 헤더 카드 약간 축소 */
@media screen and (max-width: 480px) {
  .compare-mobile-header-card {
    padding: 12px 14px;
  }
  .compare-mobile-header-card-name {
    font-size: 15px;
  }
  /* 표 최소폭 유지 (작은 화면에서도 가로 스크롤로 전체 표시) */
  .compare-detail-page .compare-core-table,
  .compare-detail-page .compare-table,
  .compare-detail-page .compare-region-table {
    min-width: 300px;
  }
}

/* 480px 이하 초소형 모바일 (screen only) */
@media screen and (max-width: 480px) {
  .app-shell {
    padding: 12px;
  }

  .main-header {
    width: calc(100% + 24px);
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }
  .mobile-top-title {
    padding: 16px 16px;
  }
  .mobile-menu-row {
    padding: 0 16px 10px;
  }
  .tray-container {
    width: 100%;
  }

  /* Home hero */
  .home-hero {
    padding: 12px 0 10px;
    margin-bottom: 10px;
  }
  .home-title {
    font-size: 1.5rem;
    margin-bottom: 16px;
    line-height: 1.35;
  }
  .home-desc,
  .home-desc-sub {
    font-size: 15px;
    line-height: 1.7;
  }
  .hero-subtext,
  .hero-sub {
    font-size: 14px;
    margin-top: 10px;
  }

  /* KPI: 세로 스택, 세로 여백 축소 */
  .home-kpi-section {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 0;
    margin-bottom: 20px;
    padding: 16px;
  }
  .kpi-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
  }
  .kpi-item:last-child {
    border-bottom: none;
  }
  .kpi-label {
    font-size: 19px;
    margin-bottom: 4px;
  }
  .kpi-value {
    font-size: 34px;
  }
  .home-kpi-title {
    font-size: 18px;
    margin: 2px 0 8px;
  }
  .home-page .home-search-area .brand-search-label {
    font-size: 18px;
    margin: 2px 0 8px;
  }
  .home-kpi-note {
    margin-top: -8px;
    margin-bottom: 14px;
    font-size: 12px;
  }

  /* 검색+바구니: 세로 스택 */
  .home-search-tray-section {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* CompareTray: 768px 이하 — 메인/순위 등 비접기형. 접기형(.compare-tray--compact)은 별도 블록 */
  .compare-tray:not(.compare-tray--compact) {
    min-width: 0;
    width: 100%;
    padding: 10px 12px;
  }
  .compare-tray:not(.compare-tray--compact) .compare-tray-item {
    padding: 6px 0;
    margin-bottom: 4px;
    gap: 6px;
  }
  .compare-tray:not(.compare-tray--compact) .compare-tray-name {
    font-size: 15px;
  }
  .compare-tray:not(.compare-tray--compact) .compare-tray-detail,
  .compare-tray:not(.compare-tray--compact) .compare-tray-yearly {
    font-size: 12px;
    padding: 3px 8px;
    min-height: 26px;
  }
  .compare-tray:not(.compare-tray--compact) .compare-tray-remove {
    min-width: 28px;
    min-height: 28px;
    font-size: 16px;
  }
  .compare-tray:not(.compare-tray--compact) .compare-btn-group button {
    height: 48px;
  }

  /* Featured Compare - 업종 카드 그리드 */
  .industry-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .industry-card.top4-card {
    min-height: 44px;
    padding: 14px 18px;
    font-size: 13px;
  }
  .featured-compare-section {
    padding: 16px;
  }

  /* Top20 카드 */
  .home-top20-section {
    padding: 14px 12px;
  }
  .top20-card {
    padding: 12px 14px;
  }
  .top20-card-rank {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
  .top20-card-name {
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .top20-card-body {
    gap: 8px 16px;
    margin-bottom: 10px;
  }
  .top20-card-stat-sub {
    opacity: 0.8;
  }

  /* Compare meta bar */
  .compare-meta-bar {
    padding: 8px 10px;
    gap: 8px 12px;
    font-size: 11px;
  }
  .compare-meta-bar .meta-item {
    white-space: normal;
    word-break: break-word;
  }

  /* Brand search: 480px 압축 (768px 스타일 유지) */
  .brand-search-input {
    padding: 10px 14px;
    font-size: 16px;
  }
  .search-result-item {
    padding: 6px 12px;
  }

  /* Brand detail: 본문 가로 — 앱 셸 안에서 좌우 16px 기준(연도별 하단 스택은 아래에서 별도 유지) */
  .brand-detail-page {
    padding: 0 16px;
    box-sizing: border-box;
  }
  /* 문서 루트에만 적용 (연도별 비교 헤더 셸은 .brand-detail-page 없음) */
  .brand-detail-page.brand-detail-page--ftc {
    padding-top: 8px;
  }
  /* 연도별 비교 하단만: 좌우 4px 유지(연도별 전용, 상세 루트와 분리) */
  .yearly-compare-page > .brand-detail-bottom-stack.brand-detail-page--ftc {
    padding-top: 0;
    padding-left: 4px;
    padding-right: 4px;
    padding-bottom: 40px;
  }
  /* 상세 본문: 전역 .print-page 좌우 24px 제거 — 바깥 .brand-detail-page 패딩만으로 여백 (표·SEO 폭 정렬) */
  .brand-detail-page.brand-detail-page--ftc .print-page {
    padding: 12px 0 24px;
    box-sizing: border-box;
  }
  .brand-detail-page .brand-detail-doc-header {
    margin-top: 0;
    padding-top: 0;
  }
  .brand-detail-page .brand-detail-doc-title,
  .brand-detail-page h1.brand-title {
    margin-top: 0;
  }
  .brand-detail-page .brand-detail-version-select {
    max-width: 100%;
    min-width: 0;
  }

  /* 상세페이지 모바일: 항목명 셀 줄바꿈 허용, 라벨/값 행 높이 자연스럽게 맞추기 */
  .brand-detail-page .brand-detail-info-table th,
  .brand-detail-page .brand-detail-info-table td,
  .brand-detail-page .brand-detail-year-table th,
  .brand-detail-page .brand-detail-year-table td,
  .brand-detail-page .brand-detail-core-table th,
  .brand-detail-page .brand-detail-core-table td,
  .brand-detail-page .brand-detail-region-table th,
  .brand-detail-page .brand-detail-region-table td {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: keep-all;
    overflow-wrap: break-word;
    vertical-align: top;
    height: auto;
    line-height: 1.4;
  }
  .brand-detail-page .brand-detail-col-label,
  .brand-detail-page .brand-detail-th-item,
  .brand-detail-page .brand-detail-info-table th:first-child,
  .brand-detail-page .brand-detail-year-table th:first-child,
  .brand-detail-page .brand-detail-core-table th:first-child,
  .brand-detail-page .brand-detail-region-table th:first-child {
    white-space: normal !important;
    word-break: keep-all;
    overflow-wrap: break-word;
  }
  .brand-detail-page .brand-detail-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
  }
  .brand-detail-page .brand-detail-table-wrap .brand-detail-section-header {
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: flex-start;
  }

  /* 상세 모바일: 내부 래퍼·표 영역·하단 SEO/CTA 가로만 정리 (폰트·표 테두리·셀 패딩 변경 없음) */
  .brand-detail-page.brand-detail-page--ftc .print-content.report-container,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-document,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-content,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-sections,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-body,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-section-body,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-section,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-core-section,
  .brand-detail-page.brand-detail-page--ftc .brand-detail-table-wrap {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .brand-detail-page .seo-content,
  .brand-detail-page .detail-intro,
  .brand-detail-page .detail-link-row,
  .brand-detail-page .related-brands,
  .brand-detail-page .seo-mini-wrap,
  .brand-detail-page .brand-detail-compare-cta {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }

  /* 모바일: 항목 열 폭 확대 (33% → 40%) - 긴 항목명 가독성 */
  .brand-detail-page .brand-detail-info-table col.brand-detail-col-item,
  .brand-detail-page .brand-detail-year-table col.brand-detail-col-item,
  .brand-detail-page .brand-detail-core-table col.brand-detail-col-item,
  .brand-detail-page .brand-detail-region-table col.brand-detail-col-item {
    width: 40% !important;
  }
  .brand-detail-page .brand-detail-core-table col.brand-detail-col-brand,
  .brand-detail-page .brand-detail-core-table col.brand-detail-col-industry-avg {
    width: 30% !important;
  }
  .brand-hero h1 {
    font-size: 1.25rem;
  }
  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Compare page */
  .compare-header h1 {
    font-size: 1.25rem;
  }
  .compare-brands-row {
    margin-bottom: 10px;
  }
  .btn-pdf {
    display: block;
    width: 100%;
    padding: 12px 16px;
  }
  .compare-metrics-table th,
  .compare-metrics-table td {
    padding: 10px 12px;
  }
  .doc-table th,
  .doc-table td {
    padding: 6px 10px;
    font-size: 12px;
  }
  .doc-col-item {
    min-width: 110px;
  }
}

/* 360px 이하 */
@media screen and (max-width: 360px) {
  .app-shell {
    padding: 10px;
  }

  .main-header {
    width: calc(100% + 20px);
    margin-left: -10px;
    margin-right: -10px;
  }

  .home-title {
    font-size: 1.2rem;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Brand Detail */
.brand-detail-page {
  max-width: 800px;
}

.brand-hero {
  margin-bottom: 24px;
}

.brand-hero h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.brand-corp {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.brand-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* 상세페이지 헤더: 화면에서 반드시 표시 (compare-print-only 미사용) */
.brand-detail-header-visible {
  display: block;
}

.brand-detail-header-row {
  margin-bottom: 20px;
}

.brand-detail-header-panel {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.brand-detail-header-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px 24px;
  margin: 12px 0;
}

.brand-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-detail-meta-item .brand-detail-meta-label {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-pdf-placeholder {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: default;
  display: inline-block;
}

.brand-detail-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.brand-detail-version-select {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  margin-right: 16px;
}

.btn-add-to-compare-detail {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 500;
  cursor: pointer;
}

.btn-add-to-compare-detail:disabled {
  background: #9ca3af;
  cursor: default;
}

.btn-go-to-compare {
  padding: 8px 16px;
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--navy);
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
}

.btn-go-to-compare:hover {
  background: rgba(30, 58, 95, 0.06);
}

.brand-detail-not-found {
  padding: 48px 24px;
  text-align: center;
}

.brand-detail-not-found-inner {
  max-width: 400px;
  margin: 0 auto;
}

.brand-detail-not-found-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.brand-detail-not-found-desc {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.brand-detail-not-found-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.brand-detail-not-found-actions .btn-go-home,
.brand-detail-not-found-actions .btn-go-to-compare {
  padding: 10px 20px;
}

.brand-summary-cards {
  margin-bottom: 24px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.summary-card {
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
}

.card-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.detail-dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 24px;
}

.detail-dl dt {
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Brand Detail (compare와 동일 디자인 시스템) ===== */
.brand-detail-page--ftc {
  max-width: var(--compare-table-width);
  width: 100%;
  margin: 0 auto;
  background: var(--bg-main);
  padding: 20px 0 40px;
}

/* 상세 FTC 본문: 첫 제목까지 세로 스택을 연도별 비교 상단 리듬에 맞춤(화면만). 전역 .print-page 규칙은 유지하고 이 페이지 트리에서만 상단 패딩 정리 */
@media screen {
  .brand-detail-page.brand-detail-page--align-title-start.brand-detail-page--ftc {
    padding-top: 0;
  }
  .brand-detail-page.brand-detail-page--align-title-start.brand-detail-page--ftc .brand-detail-print-area > .print-page {
    padding-top: 8px;
  }
}

/* 데스크톱: 본문 유효 폭을 연도별 비교와 동일하게
 * - 연도별: .yearly-compare-top-wrap / 스크롤 본문은 좌우 4px 수준, .print-page 없음
 * - 상세: 전역 .print-page padding 24px가 728px 루트 안에서 표 가로를 추가로 압축 → 좌우만 4px로 통일 (표·셀 스타일 변경 없음) */
@media screen and (min-width: 769px) {
  .brand-detail-page.brand-detail-page--ftc .print-page {
    padding-left: 4px;
    padding-right: 4px;
  }
}

/* 문서형 헤더 - compare 브랜드 요약과 같은 본문 크기 */
.brand-detail-page--ftc .brand-detail-doc-header {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

/* 상세페이지 루트만: 상단 상호·업종·기준연도·버전 영역 세로 여백 축소 (연도별 헤더 셸은 .brand-detail-page 미사용 → 비대상) */
.brand-detail-page.brand-detail-page--ftc {
  padding-top: 8px;
}
.brand-detail-page.brand-detail-page--ftc .brand-detail-doc-header {
  margin-bottom: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand-detail-page.brand-detail-page--ftc .brand-detail-doc-title,
.brand-detail-page.brand-detail-page--ftc h1.brand-title {
  margin-bottom: 8px;
}
.brand-detail-page.brand-detail-page--ftc .brand-detail-doc-meta,
.brand-detail-page.brand-detail-page--ftc .brand-detail-doc-meta .brand-meta-row {
  line-height: 1.4;
}
.brand-detail-page.brand-detail-page--ftc .brand-detail-doc-meta > * {
  margin-top: 0;
  margin-bottom: 0;
}

/* 동일 업종 상위 브랜드 — 인라인 칩 (SEO 푸터 내: 순위 링크 아래 · 홈으로 위) */
.brand-detail-inline-peers {
  margin: 0;
  padding: 0;
}

.related-brands .brand-detail-inline-peers {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.brand-detail-inline-peers__lead {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  line-height: 1.35;
}

/* 카드 1행 = 링크(이동) + 버튼(비교 토글) — 형제만, 중첩 없음 */
.brand-detail-peer-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.brand-detail-peer-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-card);
  max-width: 100%;
  box-sizing: border-box;
}

.brand-detail-peer-link {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.brand-detail-peer-link:hover {
  text-decoration: underline;
}

/* 같이 많이 보는 브랜드 — 비교하기: 상세 ‘비교 담기’ secondary와 동일 파란 CTA (회색 중립 톤 금지) */
.brand-detail-compare-add-btn--peer,
a.brand-detail-peer-compare-btn,
button.brand-detail-peer-compare-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  cursor: pointer;
  font-family: inherit;
}

.brand-detail-compare-add-btn--peer:hover,
a.brand-detail-peer-compare-btn:hover,
button.brand-detail-peer-compare-btn:hover {
  background: #1d4ed8;
}

.brand-detail-compare-add-btn--peer.is-added {
  cursor: pointer;
  opacity: 1;
}

@media (max-width: 480px) {
  .brand-detail-peer-card {
    padding: 9px 10px;
    gap: 10px;
  }
}

/* 준비중 안내 배너 - compare-notice 스타일 공유, 상세페이지 적용 */
.brand-detail-page--ftc .compare-notice {
  margin-top: 0;
  margin-bottom: 12px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.brand-detail-page--ftc .brand-detail-doc-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 12px;
  line-height: 1.4;
}

/* 상세 H1: 브랜드명(메인) + SEO 보조 문구 분리 */
.brand-detail-page--ftc h1.brand-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
  line-height: 1.4;
  white-space: nowrap;
}

.brand-detail-page--ftc h1.brand-title .brand-name {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.brand-detail-page--ftc h1.brand-title .seo-text {
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
}

body.dark-mode .brand-detail-page--ftc h1.brand-title .seo-text {
  color: var(--compare-muted);
}

.brand-detail-page--ftc .brand-detail-doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 28px;
  font-size: 11px;
  color: var(--text-sub);
}

.brand-meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-meta-row .brand-detail-meta-label {
  color: var(--text-sub);
  flex-shrink: 0;
}

.brand-version {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-version select,
.brand-detail-page--ftc .brand-version select {
  height: 28px;
  padding: 2px 10px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

/* 대표 후보 버전 (API candidatesDisplayUnique / 디버그 슬롯) */
.brand-detail-candidate-panel {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
}
.brand-detail-candidate-heading {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1e3a5f;
}
.brand-detail-candidate-list {
  margin: 0;
  padding-left: 18px;
}
.brand-detail-candidate-item {
  margin: 4px 0;
}
.brand-detail-candidate-roles {
  color: #6b7280;
  font-size: 11px;
}
.brand-detail-candidate-slots-debug {
  margin-top: 8px;
  font-size: 11px;
}
.brand-detail-candidate-pre {
  margin: 8px 0 0;
  padding: 8px;
  overflow: auto;
  max-height: 200px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.35;
}

.compare-candidate-unique {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.45;
  color: #374151;
}
.compare-candidate-roles {
  color: #6b7280;
  font-size: 10px;
}
.compare-candidate-slots-debug {
  margin-top: 6px;
  font-size: 10px;
}
.compare-candidate-pre {
  margin: 4px 0 0;
  padding: 6px;
  overflow: auto;
  max-height: 120px;
  background: #f9fafb;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1.3;
}

/* 버전 선택: 화면에서는 드롭다운, 인쇄 시에는 텍스트만 */
.brand-detail-version-print-only {
  display: none;
}

/* 상세 인쇄 전용 제목: 화면에서는 숨김 */
.brand-detail-print-only {
  display: none;
}

.brand-detail-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

.brand-detail-name {
  font-size: 20px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 12px;
}


.brand-meta-label {
  color: #6b7280;
  margin-right: 2px;
}

/* 섹션 헤더 - compare-section-header와 동일 */
.brand-detail-page--ftc .brand-detail-core-section {
  margin-bottom: 14px;
}

.brand-detail-page--ftc .brand-detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0;
  margin: 0;
}

.brand-detail-page--ftc .brand-detail-core-section .brand-detail-section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-main);
  line-height: 1.4;
}

/* 핵심지표 단위 - compare unit-label과 동일 (12px) */
.brand-detail-page--ftc .brand-detail-core-section .brand-detail-unit {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 400;
  flex-shrink: 0;
  margin-left: 12px;
}

/* 표 - colgroup 비율 기준, 100% 폭 */
.brand-detail-page--ftc .brand-detail-core-table,
.brand-detail-page--ftc .brand-detail-year-table,
.brand-detail-page--ftc .brand-detail-info-table,
.brand-detail-page--ftc .brand-detail-region-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  box-sizing: border-box;
  border-top: 2px solid var(--navy);
}

/* 표 - compare-core-table과 동일 (padding 4px 5px, font-size 11px) */
.brand-detail-page--ftc .brand-detail-core-table {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  line-height: 1.35;
}

.brand-detail-page--ftc .brand-detail-core-table th,
.brand-detail-page--ftc .brand-detail-core-table td {
  border: 1px solid var(--border-light);
  padding: 4px 5px;
  text-align: center;
  vertical-align: middle;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* colgroup이 폭 지정 */

.brand-detail-page--ftc .brand-detail-core-table .brand-detail-th-item {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.brand-detail-page--ftc .brand-detail-core-table tbody td {
  text-align: center;
}

/* 상세 표 thead만 .compare-table thead th 와 동일 (배경·글자색·테두리 #d9dde3) */
.brand-detail-page--ftc .brand-detail-core-table thead th,
.brand-detail-page--ftc .brand-detail-core-table thead th.brand-detail-th-item,
.brand-detail-page--ftc .brand-detail-year-table thead th,
.brand-detail-page--ftc .brand-detail-year-table thead th.brand-detail-th-item,
.brand-detail-page--ftc .brand-detail-info-table thead th,
.brand-detail-page--ftc .brand-detail-region-table thead th,
.brand-detail-page .brand-detail-info-table thead th,
.brand-detail-page .brand-detail-region-table thead th {
  background: #f5f7fa;
  color: #2c3e50;
  font-weight: 600;
  border: 1px solid #d9dde3;
  padding: 4px 5px;
}

.brand-detail-page--ftc .brand-detail-metric-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-sub);
}

/* 핵심 지표 — 업종 평균 KPI (허브 동일 평균값, 클릭 시 /industry/{slug}) */
.brand-detail-page--ftc .brand-detail-core-avg-cell {
  min-width: 0;
}
.brand-detail-page--ftc .brand-detail-core-avg-cell--na {
  color: var(--text-sub);
}
.brand-detail-page--ftc .brand-detail-core-avg-dash {
  color: var(--text-sub);
}
/* 톤 색은 span(.brand-detail-core-avg-static)에만 둠 — <a>에 톤 클래스를 붙이면 :link UA색과 겹칠 수 있음 */
.brand-detail-page--ftc .brand-detail-core-avg-cell a.brand-detail-core-avg-link:any-link,
.brand-detail-page--ftc .brand-detail-core-avg-cell a.brand-detail-core-avg-link:visited {
  color: inherit;
}
.brand-detail-page--ftc .brand-detail-core-avg-link {
  display: inline;
  text-decoration: none;
  color: inherit;
  border-radius: 2px;
}
.brand-detail-page--ftc .brand-detail-core-avg-link .brand-detail-core-avg-static {
  transition: text-decoration-color 0.15s ease;
}
.brand-detail-page--ftc .brand-detail-core-avg-link:hover .brand-detail-core-avg-static,
.brand-detail-page--ftc .brand-detail-core-avg-link:focus-visible .brand-detail-core-avg-static {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
.brand-detail-page--ftc .brand-detail-core-avg-link:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 2px;
}
/* 좋은 성과(빨강) / 나쁜 성과(파랑) — 화살표 방향과 독립 */
.brand-detail-page--ftc .brand-detail-core-avg-static,
.brand-detail-page--ftc .brand-detail-core-avg-print {
  display: inline;
}
.brand-detail-page--ftc .brand-detail-core-avg-static.brand-detail-core-avg-link--better,
.brand-detail-page--ftc .brand-detail-core-avg-print.brand-detail-core-avg-link--better {
  color: #c62828;
}
.brand-detail-page--ftc .brand-detail-core-avg-static.brand-detail-core-avg-link--worse,
.brand-detail-page--ftc .brand-detail-core-avg-print.brand-detail-core-avg-link--worse {
  color: #1565c0;
}
.brand-detail-page--ftc .brand-detail-core-avg-static.brand-detail-core-avg-link--neutral,
.brand-detail-page--ftc .brand-detail-core-avg-print.brand-detail-core-avg-link--neutral {
  color: var(--text-main);
}

body.dark-mode .brand-detail-page .brand-detail-core-avg-static.brand-detail-core-avg-link--better,
body.dark-mode .brand-detail-page .brand-detail-core-avg-print.brand-detail-core-avg-link--better {
  color: #ff8a80;
}
body.dark-mode .brand-detail-page .brand-detail-core-avg-static.brand-detail-core-avg-link--worse,
body.dark-mode .brand-detail-page .brand-detail-core-avg-print.brand-detail-core-avg-link--worse {
  color: #90caf9;
}
body.dark-mode .brand-detail-page .brand-detail-core-avg-static.brand-detail-core-avg-link--neutral,
body.dark-mode .brand-detail-page .brand-detail-core-avg-print.brand-detail-core-avg-link--neutral {
  color: var(--compare-text);
}

body.dark-mode .brand-detail-page--ftc .brand-detail-core-avg-link:focus-visible {
  outline-color: var(--dm-link-focus-ring);
}

/* 상세 상단: 브랜드 순위 스냅샷 요약 (API brand-detail-ranks, 표시할 순위 0개면 블록 미렌더) */
.brand-detail-page--ftc .brand-detail-rank-summary {
  margin: 0 0 14px;
  padding: 0;
}

.brand-detail-page--ftc .brand-detail-rank-summary__text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-accent-rank);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.brand-detail-page--ftc .brand-detail-rank-summary__main {
  display: inline;
}

.brand-detail-page--ftc .brand-detail-rank-summary__seg {
  display: inline;
}

.brand-detail-page--ftc .brand-detail-rank-summary__num {
  font-weight: 700;
}

.brand-detail-page--ftc .brand-detail-rank-summary__suffix {
  display: inline;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-sub);
  vertical-align: baseline;
}

@media (max-width: 480px) {
  .brand-detail-page--ftc .brand-detail-rank-summary {
    margin-bottom: 12px;
  }

  .brand-detail-page--ftc .brand-detail-rank-summary__text {
    font-size: 14px;
  }

  .brand-detail-page--ftc .brand-detail-rank-summary__suffix {
    font-size: 11px;
  }
}

/* 가로형 연도표 - 연도 칸 균등 분할 */
.brand-detail-page--ftc .brand-detail-year-table {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  line-height: 1.35;
}

/* colgroup이 폭 지정 */

.brand-detail-page--ftc .brand-detail-year-table th,
.brand-detail-page--ftc .brand-detail-year-table td {
  border: 1px solid var(--border-light);
  padding: 4px 5px;
  text-align: center;
  vertical-align: middle;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.brand-detail-page--ftc .brand-detail-year-table .brand-detail-th-item {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.brand-detail-page--ftc .brand-detail-year-table tbody td {
  text-align: center;
}

/* 핵심 지표 */
.brand-core-indicators {
  margin-bottom: 28px;
  border: 1px solid #d9d9d9;
}

.brand-core-title {
  font-size: 13px;
  font-weight: 600;
  background: #f0f0f0;
  padding: 12px 16px;
  margin: 0;
  border-bottom: 1px solid #d9d9d9;
}

.brand-core-list {
  margin: 0;
  padding: 0;
}

.brand-core-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  text-align: center;
}

.brand-core-row:last-child {
  border-bottom: none;
}

.brand-core-row dt {
  font-size: 13px;
  font-weight: 500;
  color: #444;
  margin: 0;
  padding-right: 16px;
  border-right: 1px solid #c5c5c5;
}

.brand-core-row dd {
  font-size: 13px;
  color: #1a1a1a;
  margin: 0;
  padding-left: 16px;
}

.brand-detail-body {
  margin-bottom: 24px;
}

.brand-detail-section {
  margin-bottom: 10px;
}

/* 섹션 제목 - compare-section-title과 동일 (20px, 700, #1e3a5f) */
.brand-detail-page .brand-detail-section-title {
  font-size: 20px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-main);
  line-height: 1.4;
  padding-bottom: 0;
  border-bottom: none;
}

.brand-detail-page .brand-detail-section-title:first-child {
  margin-top: 0;
}

.brand-detail-page .brand-detail-section-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 블록 - 회색 외곽 테두리 제거, 표 중심 */
.brand-detail-page .brand-detail-block {
  border: none;
  background: transparent;
}

.brand-detail-page .brand-detail-block-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin: 0;
  border-bottom: none;
}

/* 블록 제목 - subsection-title과 동일 (15px, 600) */
.brand-detail-page .brand-detail-subsection-title {
  font-size: 15px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--text-main);
  line-height: 1.4;
}

/* 블록 단위 - compare unit-label과 동일 (12px) */
.brand-detail-page .brand-detail-unit {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 400;
  flex-shrink: 0;
  margin-left: 12px;
}

.brand-detail-page .brand-detail-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* 핵심 지표 동일 wrapper: rank-summary ↔ 헤더 ↔ 표 — spacing만 (정렬용 margin-left/calc 금지) */
.brand-detail-table-wrap .brand-detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
}

.brand-detail-table-wrap .brand-detail-section-header .brand-detail-section-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.brand-detail-table-wrap .brand-detail-section-header .brand-detail-unit {
  margin-left: 0;
  margin-top: 0;
  line-height: 1.35;
}

.brand-detail-table-wrap .rank-summary[data-brand-detail-rank-summary] {
  margin-bottom: 17px;
}

/* info-table - colgroup 33.3333% / 66.6667% 규칙 */
.brand-detail-page .brand-detail-info-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border-top: 2px solid var(--navy);
  font-size: 11px;
  line-height: 1.35;
  box-sizing: border-box;
}

/* colgroup이 폭 지정, th/td는 colgroup 따름 */

.brand-detail-page .brand-detail-info-table th,
.brand-detail-page .brand-detail-info-table td {
  padding: 4px 5px;
  border: 1px solid var(--border-light);
  text-align: center;
  vertical-align: middle;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.brand-detail-page .brand-detail-col-label {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.brand-detail-page .brand-detail-col-value {
  color: var(--text-main);
}

.brand-detail-page .brand-detail-info-table .brand-detail-th-item {
  background: var(--bg-soft);
  color: var(--text-main);
  font-weight: 600;
}

/* Brand Detail: colgroup 비율 적용, px 오버라이드 없음 */
.brand-detail-page .brand-detail-table-wrap--region {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.brand-detail-page .brand-detail-table-wrap--region table {
  min-width: 0;
}

.brand-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

.brand-section-desc {
  font-size: 13px;
  color: #555;
  margin-bottom: 16px;
  line-height: 1.5;
}

.brand-section-blocks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 세로 정보 블록 */
.brand-vertical-block {
  border: 1px solid #d9d9d9;
  background: #fff;
}

.brand-block-header {
  padding: 10px 14px;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-block-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.brand-block-year {
  font-size: 12px;
  font-weight: 400;
  color: #555;
}

.brand-vertical-list {
  margin: 0;
}

.brand-vertical-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  margin: 0;
  text-align: center;
}

.brand-vertical-row:last-child {
  border-bottom: none;
}

.brand-vertical-label {
  font-size: 13px;
  color: #444;
  font-weight: 500;
  margin: 0;
  padding-right: 16px;
  border-right: 1px solid #c5c5c5;
}

.brand-vertical-value {
  font-size: 13px;
  color: #1a1a1a;
  margin: 0;
  padding-left: 16px;
  font-variant-numeric: tabular-nums;
}

/* simple-data-table (가맹점 매출 등) */
.brand-simple-table-block {
  border: 1px solid #d9d9d9;
  background: #fff;
}

.brand-simple-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.brand-simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.brand-simple-table thead th {
  background: var(--header-bg);
  color: var(--text);
  font-weight: 600;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid #cfcfcf;
}

.brand-simple-table tbody td {
  padding: 6px 4px;
  text-align: center;
  border: 1px solid var(--border);
  color: #1a1a1a;
  font-variant-numeric: tabular-nums;
}

.brand-simple-table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.brand-block-empty {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 13px;
  border: 1px dashed #ddd;
  background: #fafafa;
}

.brand-detail-back {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 11px;
}

.brand-detail-back a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}

.brand-detail-back a:hover {
  text-decoration: underline;
}

/* 본문형 SEO 소개 블록 (상세·연도별 하단 스택) — 카드 래퍼 없음 */
.detail-intro {
  margin: 0 0 24px 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-main);
}

/* 예전 .brand-detail-seo-footer margin-top — 본문·하단 스택 사이 간격 유지 */
.brand-detail-page.brand-detail-page--ftc > .seo-content {
  margin-top: 28px;
}

.detail-intro h1,
.detail-intro .detail-intro-title {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

.detail-intro p {
  margin: 0 0 12px 0;
  line-height: 1.6;
  color: var(--text-sub);
}

.detail-intro p:last-of-type {
  margin-bottom: 0;
}

.detail-divider {
  border: 0;
  height: 0;
  margin: 0;
  border-top: 1px solid var(--border-light);
}

.detail-link-row {
  margin: 0;
  padding: 0;
}

.detail-link-row .brand-detail-seo-footer__nav {
  margin: 0;
  padding: 14px 0;
  border: 0;
  font-size: 13px;
}

.related-brands {
  margin: 0;
  padding: 12px 0 0 0;
}

.brand-detail-seo-footer__nav {
  font-size: 13px;
}

.brand-detail-bottom-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-detail-bottom-link {
  white-space: nowrap;
}

.brand-detail-bottom-links-separator {
  flex: 0 0 auto;
  color: var(--text-sub);
}

.brand-detail-seo-footer__nav a,
.brand-detail-seo-footer__nav .brand-detail-bottom-link {
  color: var(--color-primary);
  text-decoration: none;
}

.brand-detail-seo-footer__nav a:hover,
.brand-detail-seo-footer__nav .brand-detail-bottom-link:hover {
  text-decoration: underline;
}

body.dark-mode .detail-divider {
  border-top-color: var(--border-light);
}

body.dark-mode .detail-intro h1,
body.dark-mode .detail-intro .detail-intro-title {
  color: var(--text-main);
}

body.dark-mode .detail-intro p {
  color: var(--text-sub);
}

body.dark-mode .brand-detail-seo-footer__nav a,
body.dark-mode .brand-detail-seo-footer__nav a:visited,
body.dark-mode .brand-detail-seo-footer__nav .brand-detail-bottom-link,
body.dark-mode .brand-detail-seo-footer__nav .brand-detail-bottom-link:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}
body.dark-mode .brand-detail-seo-footer__nav a:hover,
body.dark-mode .brand-detail-seo-footer__nav .brand-detail-bottom-link:hover {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}
body.dark-mode .brand-detail-seo-footer__nav a:focus-visible,
body.dark-mode .brand-detail-seo-footer__nav .brand-detail-bottom-link:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

@media (max-width: 768px) {
  .brand-detail-bottom-links {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .brand-detail-bottom-link {
    font-size: 14px;
    white-space: nowrap;
  }

  .brand-detail-bottom-links-separator {
    margin: 0 2px;
    font-size: 13px;
  }
}

/* 브랜드 상세 — 비교 버튼(하단·추천 카드) · 추천 · 하단 트레이 */
.brand-detail-compare-add-btn {
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  border: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}

.brand-detail-compare-add-btn--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  min-height: 48px;
  padding: 12px 18px;
  background: #1e3a5f;
  color: #fff;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.25);
}

.brand-detail-compare-add-btn--primary:hover {
  background: var(--navy-dark, #152a45);
}

.brand-detail-compare-add-btn--primary:active {
  transform: translateY(1px);
}

.brand-detail-compare-add-btn--primary.is-added,
.brand-detail-compare-add-btn--primary:disabled {
  background: #9ca3af;
  color: #f9fafb;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.brand-detail-compare-add-btn--primary.is-added:hover,
.brand-detail-compare-add-btn--primary:disabled:hover {
  background: #9ca3af;
}

.brand-detail-compare-add-btn--secondary.is-added,
.brand-detail-compare-add-btn--secondary:disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}

.brand-detail-compare-add-btn--secondary.is-added:hover,
.brand-detail-compare-add-btn--secondary:disabled:hover {
  background: #e5e7eb;
}

.brand-detail-compare-add-btn--card.is-added,
.brand-detail-compare-add-btn--card:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

body.dark-mode .brand-detail-compare-add-btn--primary.is-added,
body.dark-mode .brand-detail-compare-add-btn--primary:disabled {
  background: #4b5563;
  color: #d1d5db;
}

body.dark-mode .brand-detail-compare-add-btn--secondary.is-added,
body.dark-mode .brand-detail-compare-add-btn--secondary:disabled {
  background: #374151;
  color: #9ca3af;
  border-color: #4b5563;
}

.brand-detail-compare-add-btn--card {
  align-self: flex-start;
  padding: 8px 12px;
  font-size: 13px;
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}

.brand-detail-compare-add-btn--card:hover {
  background: #e5e7eb;
}

.brand-detail-compare-cta {
  margin: 16px 0 18px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.brand-detail-compare-cta__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-main);
}

.brand-detail-compare-add-btn--secondary {
  min-height: 44px;
  padding: 10px 20px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
}

.brand-detail-compare-add-btn--secondary:hover {
  background: #1d4ed8;
}

.brand-detail-page-tray {
  margin-top: 8px;
}

/* ready: 구조/라벨용 클래스만 유지. 색상은 .compare-start-btn + .cta-primary 및 cta-primary-override.css가 담당(둔한 #2f4a6d·다크 회색 덮어쓰기 제거). */

/* 공통 shell(상세·연도별·순위): CompareTray 접기형 — 상세와 동일 DOM/CSS 체계 */
.mobile-compare-tray-shell .compare-tray--collapsible {
  padding: 10px 12px 12px;
}

.mobile-compare-tray-shell .compare-tray-header--toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding: 8px 2px 10px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  border-radius: 0;
}

.mobile-compare-tray-shell .compare-tray-header--toggle:focus-visible {
  outline: 2px solid var(--navy, #1e3a5f);
  outline-offset: 2px;
}

.mobile-compare-tray-shell .compare-tray-chevron {
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
  padding: 6px 4px;
  min-width: 28px;
  text-align: center;
  transition: transform 0.2s ease;
}

.mobile-compare-tray-shell .compare-tray-expandable .compare-tray-slim-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 6px;
  padding: 0 2px;
  line-height: 1.35;
}

.mobile-compare-tray-shell .compare-tray-expandable {
  padding-top: 0;
}

/* 상세·연도별·순위 공통: 접힘 시 리스트/CTA 패널 제거(모바일 shell 동일 규칙) */
.mobile-compare-tray-shell .compare-tray--collapsed .compare-tray-expandable {
  display: none;
}

body.dark-mode .mobile-compare-tray-shell .compare-tray-header--toggle {
  color: var(--compare-text, #e5e7eb);
  border-bottom-color: var(--compare-border, #333);
}

body.dark-mode .mobile-compare-tray-shell .compare-tray-expandable .compare-tray-slim-hint {
  color: var(--compare-muted, #94a3b8);
}

/* PC(≥769): 공통 shell — 비교 바구니 카드·헤더·리스트·CTA (모바일 ≤768 제외) */
@media (min-width: 769px) {
  .mobile-compare-tray-shell .compare-tray--collapsible {
    padding: 8px 10px 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  }

  .mobile-compare-tray-shell .compare-tray-header--toggle {
    margin: 0 0 4px;
    padding: 4px 0 6px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
    gap: 6px;
  }

  .mobile-compare-tray-shell .compare-tray-title {
    font-size: 13px;
    letter-spacing: -0.01em;
  }

  .mobile-compare-tray-shell .compare-tray-count {
    font-size: 12px;
    font-weight: 700;
    color: #1e3a5f;
  }

  .mobile-compare-tray-shell .compare-tray-chevron {
    padding: 3px 2px;
    min-width: 22px;
    font-size: 10px;
  }

  .mobile-compare-tray-shell .compare-tray-expandable {
    padding-top: 2px;
  }

  .mobile-compare-tray-shell .compare-tray-list {
    margin-bottom: 6px;
  }

  .mobile-compare-tray-shell .compare-tray-item {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 5px 0;
    font-size: 13px;
    line-height: 1.35;
    border-bottom: none;
  }

  .mobile-compare-tray-shell .compare-tray-item + .compare-tray-item {
    border-top: 1px solid var(--border-light);
    padding-top: 5px;
    margin-top: 1px;
  }

  .mobile-compare-tray-shell .compare-tray-name {
    flex: 1 1 auto;
    min-width: 0;
    margin-right: 6px;
    font-weight: 600;
  }

  .mobile-compare-tray-shell .compare-tray-actions {
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
  }

  /* 상세/연도: 홈 비교바구니와 동일 계열(중립 필 + 호버 네이비) */
  .mobile-compare-tray-shell .compare-tray-detail,
  .mobile-compare-tray-shell .compare-tray-yearly {
    min-height: 26px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    background: var(--header-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-compare-tray-shell .compare-tray-detail:hover,
  .mobile-compare-tray-shell .compare-tray-yearly:hover {
    background: var(--navy, #1e3a5f);
    color: var(--compare-on-accent, #fff);
    border-color: var(--navy, #1e3a5f);
  }

  .mobile-compare-tray-shell .compare-tray-remove {
    font-size: 15px;
    padding: 1px 4px;
    margin-left: 2px;
    line-height: 1;
    min-width: 26px;
  }

  .mobile-compare-tray-shell .compare-tray-hint {
    margin-bottom: 6px;
    font-size: 11px;
  }

  .mobile-compare-tray-shell .compare-btn-group {
    margin-top: 6px;
  }

  .mobile-compare-tray-shell .compare-btn-group button {
    height: 48px;
    min-height: 48px;
  }

  body.dark-mode .mobile-compare-tray-shell .compare-tray-count {
    color: var(--dm-link);
  }

  body.dark-mode .mobile-compare-tray-shell .compare-tray-item + .compare-tray-item {
    border-top-color: var(--compare-border, #333);
  }

  body.dark-mode .mobile-compare-tray-shell .compare-tray-detail,
  body.dark-mode .mobile-compare-tray-shell .compare-tray-yearly {
    background: var(--bg-card, #1e293b);
    border-color: var(--border-light, #334155);
    color: var(--text-main, #e5e7eb);
  }

  body.dark-mode .mobile-compare-tray-shell .compare-tray-detail:hover,
  body.dark-mode .mobile-compare-tray-shell .compare-tray-yearly:hover {
    background: var(--compare-accent, #3b82f6);
    border-color: var(--compare-accent, #3b82f6);
    color: #fff;
  }
}

/* PC 대화면(≥1024): 비교 바구니 CTA·하단 여백 컴팩트 — 리스트 비중↑ (≤768 모바일·769~1023 태블릿 미적용) */
@media (min-width: 1024px) {
  .mobile-compare-tray-shell .compare-tray--collapsible {
    padding: 8px 10px 4px;
  }

  .mobile-compare-tray-shell .compare-tray-expandable .compare-tray-slim-hint {
    margin: 0 0 4px;
  }

  .mobile-compare-tray-shell .compare-tray-list {
    margin-bottom: 4px;
  }

  .mobile-compare-tray-shell .compare-tray-item {
    padding: 4px 0;
  }

  .mobile-compare-tray-shell .compare-tray-item + .compare-tray-item {
    padding-top: 4px;
    margin-top: 0;
  }

  .mobile-compare-tray-shell .compare-tray-hint {
    margin-bottom: 4px;
  }

  .mobile-compare-tray-shell .compare-btn-group {
    margin-top: 6px;
    padding-top: 0;
    padding-bottom: 0;
  }

  .mobile-compare-tray-shell .compare-btn-group button {
    height: 32px;
    min-height: 32px;
    padding: 4px 12px;
    font-size: 13px;
    line-height: 1.18;
  }

  /* 보조: 초기화 — 메인 CTA보다 시각적 무게 낮춤 */
  .mobile-compare-tray-shell .compare-reset-btn {
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 6px 0 0 6px;
  }

  .mobile-compare-tray-shell .compare-reset-btn:hover:not(:disabled) {
    background: #e2e8f0;
    color: #475569;
  }

  /* 메인: 비교보기 — 색으로만 구분, 두께·굵기로 과강조하지 않음 */
  .mobile-compare-tray-shell .compare-start-btn {
    font-weight: 600;
    border-radius: 0 6px 6px 0;
  }

  body.dark-mode .mobile-compare-tray-shell .compare-reset-btn {
    background: var(--bg-card-soft);
    color: var(--text-sub);
  }

  body.dark-mode .mobile-compare-tray-shell .compare-reset-btn:hover:not(:disabled) {
    background: var(--bg-card);
    color: var(--text-main);
  }

  body.dark-mode .mobile-compare-tray-shell .compare-start-btn {
    font-weight: 600;
  }
}

.app-compare-toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%) translateY(12px);
  z-index: 200;
  max-width: min(92vw, 360px);
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.45;
  color: #fff;
  background: rgba(17, 24, 39, 0.92);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.app-compare-toast.app-compare-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

@media (max-width: 768px) {
  /* 모바일 공통: 상세·연도별·순위 하단 fixed shell(페이지명 선택자 없음) */
  .mobile-compare-tray-shell {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    margin-top: 0;
    padding: 0 10px 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(255, 255, 255, 0.97) 65%, rgba(255, 255, 255, 0));
    pointer-events: none;
  }

  /* 리스트만 스크롤 — compact 행 높이 축소에 맞춰 뷰포트 상한 완화 */
  .mobile-compare-tray-shell .home-tray-area {
    pointer-events: auto;
    max-height: 44vh;
  }

  .mobile-compare-tray-shell .compare-tray--compact.compare-tray {
    max-height: 44vh;
    overflow: hidden;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }

  /* 접힌 슬림 바구니: 카드 높이·본문 하단 여백 축소 */
  .mobile-compare-tray-shell .compare-tray--collapsible.compare-tray--collapsed {
    max-height: none;
  }

  .mobile-compare-tray-shell .home-tray-area:has(.compare-tray--collapsed) {
    max-height: none;
  }

  .mobile-compare-tray-shell .compare-tray--collapsible .compare-tray-header--toggle {
    flex-shrink: 0;
  }

  .mobile-compare-tray-shell .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable .compare-tray-slim-hint {
    flex-shrink: 0;
  }

  /* collapsible: 패널(hint+리스트+CTA) — 리스트만 스크롤 체인 복구 */
  .mobile-compare-tray-shell .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-compare-tray-shell .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable .compare-tray-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
  }

  .mobile-compare-tray-shell .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable .compare-tray-hint {
    flex-shrink: 0;
  }

  .mobile-compare-tray-shell .compare-tray--collapsible:not(.compare-tray--collapsed) .compare-tray-expandable .compare-btn-group {
    flex-shrink: 0;
    margin-top: 6px;
  }

  /* 접힘 = 헤더만: 패널 전체(display:none) + 루트 패딩 축소 · 터치 타깃 */
  .mobile-compare-tray-shell .compare-tray--collapsed.compare-tray--compact {
    padding: 4px 8px 6px;
  }

  .mobile-compare-tray-shell .compare-tray--collapsed .compare-tray-header--toggle {
    min-height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* 하단 고정 비교 트레이 여유 — 브랜드 상세 루트에만 적용 (연도별 비교 헤더 셸은 .brand-detail-page 없음) */
  /* 트레이 max-height 축소에 맞춰 본문 하단 여백·토스트 오프셋 소폭 조정 */
  .brand-detail-page.brand-detail-page--ftc {
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  }

  .brand-detail-page.brand-detail-page--ftc:has(.compare-tray--collapsed) {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .app-compare-toast {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }

  /* 상세·순위 모바일(fixed 트레이): 토스트 하단 오프셋 */
  body:has(.brand-detail-page) .app-compare-toast,
  body:has(.ranking-page) .app-compare-toast {
    bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  }

  body:has(.brand-detail-page .compare-tray--collapsed) .app-compare-toast,
  body:has(.ranking-page .compare-tray--collapsed) .app-compare-toast {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }

  /*
   * 순위 모바일: 하단 fixed 도킹은 공통 .mobile-compare-tray-shell 유지.
   * footer가 뷰포트에 들어오면 RankingPage.js가 --ranking-tray-footer-lift(px)를 올려 겹침 방지.
   */
  .ranking-page .mobile-compare-tray-shell {
    bottom: var(--ranking-tray-footer-lift, 0px);
  }
}

body.dark-mode .brand-detail-inline-peers__lead {
  color: var(--compare-muted);
}

body.dark-mode .brand-detail-peer-card {
  background: var(--bg-card);
  border-color: var(--border-light);
}

body.dark-mode .brand-detail-peer-link,
body.dark-mode .brand-detail-peer-link:visited {
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration);
}

body.dark-mode .brand-detail-peer-link:hover {
  text-decoration: underline;
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}

body.dark-mode .brand-detail-peer-link:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

body.dark-mode .brand-detail-compare-add-btn--peer {
  background: var(--compare-header-bg);
  color: var(--compare-text);
  border-color: var(--compare-border);
}

body.dark-mode .brand-detail-compare-add-btn--peer:hover {
  background: var(--compare-border);
}

body.dark-mode .brand-detail-compare-add-btn--card {
  background: var(--bg-card-soft);
  color: var(--text-main);
  border-color: var(--border-strong);
}

body.dark-mode .brand-detail-compare-cta {
  background: var(--bg-soft);
  border-color: var(--border-light);
}

body.dark-mode .brand-detail-compare-cta__text {
  color: var(--text-main);
}

body.dark-mode .mobile-compare-tray-shell {
  background: var(--bg-section);
}

@media screen and (max-width: 640px) {
  .brand-vertical-row {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .brand-vertical-row .brand-vertical-label {
    border-right: none;
    padding-right: 0;
  }
  .brand-vertical-row .brand-vertical-value {
    padding-left: 0;
  }
  .brand-core-row {
    grid-template-columns: 1fr;
  }
  .brand-core-row dt {
    border-right: none;
    padding-right: 0;
    text-align: left;
  }
  .brand-core-row dd {
    padding-left: 0;
    text-align: left;
  }
}

/* ===== Compare Detail (4열 비교) ===== */
.compare-detail-page {
  padding-bottom: 40px;
}

/* 비교 상세(slug): 첫 compare-page-title까지 — 연도별 대비 과한 .print-page 상단 패딩만 화면에서 축소 (허브/연도별/로딩 제외는 마크업에 클래스 미부여로 처리) */
@media screen {
  .compare-detail-page.compare-detail-page--align-title-start:not(.yearly-compare-page):not(.compare-detail-empty)
    .compare-print-area
    > .print-page {
    padding-top: 8px;
  }
}

/* 브랜드 비교 상세(slug)만: 본문·하단 스택을 동일 1200px 열에 두어 H1/헤더/핵심지표/표 시작선 일치 (허브·연도별 비교 제외) */
@media screen and (min-width: 769px) {
  .compare-detail-page:not(.compare-detail-empty):not(.yearly-compare-page) > .compare-print-area {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
  }
  .compare-detail-page:not(.compare-detail-empty):not(.yearly-compare-page) > .compare-page-bottom-stack.brand-detail-page--ftc {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
  }
  /* 전역 .print-page 좌우 패딩과 중복되지 않도록 — 열 패딩은 위 .compare-print-area에서만 */
  .compare-detail-page:not(.compare-detail-empty):not(.yearly-compare-page) .print-page {
    padding-left: 0;
    padding-right: 0;
  }
  /* 전역 .print-content max-width:1080px 중앙 분리 제거 → 부모 열 폭에 맞춤 */
  .compare-detail-page:not(.compare-detail-empty):not(.yearly-compare-page) .print-content.report-container,
  .compare-detail-page:not(.compare-detail-empty):not(.yearly-compare-page) .print-content {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  /* H1은 전체 print-content 폭을 쓰지 않고, 헤더·핵심지표와 동일 --compare-table-width 열에 맞춤 (기존 .compare-content-block과 동일 시작선) */
  .compare-detail-page:not(.compare-detail-empty):not(.yearly-compare-page) .compare-content-wrap > h1.compare-page-title {
    width: var(--compare-table-width);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }
}

.compare-scroll-wrap {
  overflow-x: visible;
  min-width: 0;
}

/* CompareDetailPage 헤더: table+colgroup (label 28%, brand 72/n) - 인쇄/화면 동일 */
.compare-print-header-table,
.compare-headers-table.compare-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid #d9dde3;
  border-top: 2px solid #1e3a5f;
  margin-bottom: 8px;
}
.compare-print-header-table th,
.compare-headers-table.compare-table th {
  padding: 3px 5px;
  border-right: 1px solid #d9dde3;
  min-width: 0;
  box-sizing: border-box;
}
.compare-print-header-table th:last-child,
.compare-headers-table.compare-table th:last-child {
  border-right: none;
}
.compare-print-header-table .brand-header-cell,
.compare-headers-table .brand-header-cell {
  width: auto;
  min-width: 0;
  text-align: center;
  vertical-align: middle;
}
.compare-print-header-table .brand-header-stack,
.compare-headers-table .brand-header-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  width: 100%;
}
.compare-print-header-table .compare-control-cell,
.compare-headers-table .compare-control-cell,
.compare-header-table .compare-control-cell {
  text-align: center;
  vertical-align: middle;
}

/* 첫 칸("비교 브랜드"): 단일 셀, 세로/가로 중앙 정렬 */
.compare-brand-cell {
  vertical-align: middle !important;
  text-align: center !important;
}
.compare-brand-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  line-height: 1.2;
  gap: 2px;
}
.compare-brand-cell-title {
  font-size: 11px;
  font-weight: 700;
  color: #1e3a5f;
}
.compare-brand-cell-sub {
  font-size: 9px;
  color: #637286;
}

/* Legacy grid 헤더 (미사용 시 제거 가능) */
.compare-headers-row {
  display: grid;
  width: var(--compare-table-width);
  max-width: 100%;
  box-sizing: border-box;
  gap: 0;
  border: 1px solid #d9dde3;
  border-top: 2px solid #1e3a5f;
  margin-bottom: 8px;
}

.compare-header-panel {
  min-width: 0;
  padding: 3px 5px;
  border-right: 1px solid #d9dde3;
  box-sizing: border-box;
}

.compare-header-panel:last-child {
  border-right: none;
}

/* 헤더 내 브랜드 셀: grid가 너비 제어 (고정 160px 해제), 내용 가운데 정렬 */
.compare-headers-row .compare-header-panel.brand-header-cell {
  width: auto;
  min-width: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.compare-headers-row .brand-header-stack {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

/* 헤더 내 버전 드롭다운: 칸 중앙에 배치 */
.compare-headers-row .compare-version-select {
  max-width: 95%;
  margin-left: auto;
  margin-right: auto;
}
.compare-version-select--empty {
  opacity: 0.8;
  cursor: not-allowed;
}

/* 브랜드 헤더 3단 구조: 브랜드명 | 기준연도 YYYY | 버전 드롭다운 */
.compare-header-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.compare-header-brand .brand-name {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  word-break: keep-all;
  max-width: 140px;
}

.compare-header-brand .brand-year-label {
  font-size: 11px;
  font-weight: 400;
  color: #6b7280;
  text-align: center;
  margin-top: 4px;
}

.compare-header-brand .brand-version-select {
  width: 120px;
  min-width: 120px;
  font-size: 11px;
}

body.dark-mode .compare-header-brand .brand-year-label {
  color: #9ca3af;
}

.compare-header-sep {
  color: var(--text-muted);
  padding: 0 4px !important;
}

.compare-header-meta-cell {
  color: var(--text-muted);
  font-size: 11px;
}

.compare-header-version-cell {
  padding-left: 8px !important;
}

.compare-version-select {
  width: 100%;
  height: 22px;
  margin-top: 0;
  padding: 2px 4px;
  font-size: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

/* 모바일 전용 헤더: 데스크톱에서는 숨김 */
.compare-header-mobile.compare-mobile-header-wrap {
  display: none;
}

/* 데스크톱 헤더: 모바일에서 숨김 처리는 @media에서 */
.compare-brand-summary-wrap {
  margin-bottom: 8px;
}

.compare-detail-body {
  margin-top: 0;
}

/* 비교 상세 SEO: 본문 섹션(가맹계약기간표 등)과 동일 compare-detail-section 체인 안에서 폭 100% */
.compare-detail-page .compare-detail-section[data-section='compare-seo'] .seo-content {
  width: 100%;
  box-sizing: border-box;
}

/* 공통 안내 박스 — 상세·비교·연도별 (베이지 배경 금지, CSS 변수만) */
.notice-box {
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.notice-message {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.3;
  margin: 0;
}
.notice-info {
  border-left: 3px solid var(--color-primary);
}
.notice-warning {
  border-left: 3px solid #f59e0b;
}
.notice-error {
  border-left: 3px solid #ef4444;
}
@media print {
  .notice-box {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.compare-notice {
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.compare-notice strong {
  margin-right: 6px;
}
.compare-notice-warning {
  background: #faf8e8;
  border: 1px solid #e8e0c0;
  color: #5d4037;
}
@media print {
  .compare-notice,
  .compare-notice-warning {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
.compare-pending-notice {
  background: #faf8e8;
  border: 1px solid #e8e0c0;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #5d4037;
}
.compare-pending-notice strong {
  margin-right: 6px;
}

.compare-core-section {
  margin-bottom: 14px;
}

/* 월매출/창업비용 비교 바 차트 - 직선형 4각 UI, compact, 중앙 정렬 */
.compare-metric-note {
  font-size: 11px;
  color: #666;
  margin-top: 8px;
  margin-bottom: 8px;
}

/* 핵심 지표: 표와 동일 colgroup 비율로 표·주석·그래프 세로 정렬 */
.compare-core-table-chart-stack {
  width: 100%;
  max-width: var(--compare-table-width);
  margin-left: auto;
  margin-right: auto;
}

/* 연도별 비교 — 막대 2(월매출·가맹점수) + 폐점률 선 1, X축 연도 오름차순 */
.yearly-compare-kpi-charts-wrap {
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
}

.yearly-chart-empty {
  margin: 8px 0;
  font-size: 13px;
  color: #6b7280;
}

.yearly-combined-chart-wrap {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 12px 12px 8px;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--compare-table-width);
  margin-left: auto;
  margin-right: auto;
}

.yearly-combined-chart-inner {
  min-width: 0;
}

.yearly-combined-chart-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
  margin: 0 0 10px;
  line-height: 1.3;
}

/* 표와 동일: 항목 열 % + 연도 열 n개 (colgroup과 동일 비율) */
.yearly-combined-chart-grid {
  display: grid;
  gap: 0 2px;
  width: 100%;
  align-items: stretch;
}

.yearly-combined-chart-aside {
  font-size: 11px;
  color: #374151;
  line-height: 1.45;
  padding: 2px 4px 6px 0;
  border-right: 1px solid #e5e7eb;
  min-width: 0;
  max-width: 11rem;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.yearly-combined-chart-aside .yearly-combined-legend {
  display: flex;
  padding: 0;
  margin: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.yearly-combined-legend--kpi {
  flex-wrap: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  gap: 8px;
}

.yearly-combined-legend--kpi .yearly-combined-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.yearly-combined-chart-plot {
  grid-column: 2 / -1;
  min-width: 0;
}

.yearly-combined-chart-plot-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-width: 0;
}

.yearly-combined-chart-svg-wrap--mobile {
  display: none;
}

.yearly-combined-chart-svg-wrap--desktop {
  display: block;
  width: 100%;
}

.yearly-combined-chart-unified {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.yearly-combined-chart-unified .yearly-chart-label-bar {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.yearly-combined-chart-unified .yearly-chart-label-line {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.yearly-combined-chart-bars-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--yearly-plot-cols, 3), minmax(0, 1fr));
  align-items: flex-end;
}

.yearly-combined-chart-year-row {
  padding-top: 0;
  margin-top: 0;
}

.yearly-compare-chart-year-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  padding: 0 0 2px;
}

.yearly-compare-chart-year-label {
  font-size: 12px;
  font-weight: 600;
  color: #1e3a5f;
  text-align: center;
  margin-top: 1px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.25;
  width: 100%;
}

.yearly-combined-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11px;
  color: #374151;
}

.yearly-combined-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.yearly-combined-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

body.dark-mode .yearly-combined-chart-wrap {
  background: var(--bg-card);
  border-color: var(--border-light);
}

body.dark-mode .yearly-combined-chart-title {
  color: var(--text-main);
}

body.dark-mode .yearly-combined-chart-aside {
  color: var(--text-sub);
  border-right-color: var(--border-light);
}

body.dark-mode .yearly-combined-legend {
  color: var(--text-sub);
}

body.dark-mode .yearly-combined-legend--kpi {
  color: var(--text-main);
}

body.dark-mode .yearly-combined-chart-unified .yearly-chart-label-line {
  fill: #fde68a !important;
}

body.dark-mode .yearly-compare-chart-year-label {
  color: var(--text-sub);
}

/* 연도별 비교 — 검색·헤더 패널(빈 상태 등): 큰 묶음 = section */
body.dark-mode .yearly-compare-page-header,
body.dark-mode .yearly-compare-search-section {
  background: var(--bg-section);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-sizing: border-box;
}

body.dark-mode .yearly-compare-page-header {
  padding: 16px 16px 12px;
}

body.dark-mode .yearly-compare-search-section {
  padding: 16px;
}

/* 연도별 핵심 지표 — 모바일 전용(≤768px): 범례 상단·그래프 전폭·큰 글자·두꺼운 막대 */
@media (max-width: 768px) {
  .yearly-chart-mobile .yearly-combined-chart-grid {
    grid-template-columns: 1fr !important;
    gap: 10px 0;
    align-items: start;
  }

  .yearly-chart-mobile .yearly-combined-chart-aside.yearly-chart-legend-top {
    grid-column: 1;
    max-width: none;
    width: 100%;
    padding: 0 0 4px;
    border-right: none;
    border-bottom: none;
    justify-content: center;
  }

  .yearly-chart-mobile .yearly-combined-chart-aside .yearly-combined-legend--kpi {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px 16px;
    width: 100%;
    font-size: 13px;
    font-weight: 600;
  }

  .yearly-chart-mobile .yearly-combined-chart-aside .yearly-combined-legend-swatch {
    width: 14px;
    height: 14px;
  }

  .yearly-chart-mobile .yearly-combined-chart-plot {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }

  .yearly-chart-mobile .yearly-combined-chart-plot-inner {
    gap: 0;
  }

  .yearly-chart-mobile .yearly-chart-body {
    width: 100%;
    min-height: 0;
  }

  .yearly-chart-mobile .yearly-combined-chart-svg-wrap--desktop {
    display: none !important;
  }

  .yearly-chart-mobile .yearly-combined-chart-svg-wrap--mobile {
    display: block !important;
    width: 100%;
    overflow: visible;
    overflow-x: visible;
  }

  /* meet 균등 스케일 + viewBox 비율(1000×340)로 높이 자연 산출 — 과도한 min-height 제거 */
  .yearly-chart-mobile .yearly-combined-chart-unified--mobile {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    min-height: 0;
    aspect-ratio: 1000 / 340;
    overflow: visible;
  }

  .yearly-chart-mobile .yearly-combined-chart-unified--mobile text {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .yearly-chart-mobile .yearly-combined-chart-unified--mobile .yearly-chart-label-bar--mobile {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
  }

  .yearly-chart-mobile .yearly-combined-chart-unified--mobile .yearly-chart-label-line--mobile {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
  }

  .yearly-chart-mobile .yearly-compare-chart-year-label {
    font-size: 15px;
    font-weight: 600;
    margin-top: 2px;
    padding-top: 0;
    padding-bottom: 4px;
    line-height: 1.3;
  }

  .yearly-chart-mobile .yearly-combined-chart-year-row {
    padding-top: 0;
  }

  .yearly-chart-mobile .yearly-combined-chart-wrap {
    padding: 10px 8px 6px;
  }

  .yearly-chart-mobile .yearly-combined-chart-title {
    font-size: 15px;
    margin-bottom: 8px;
  }
}

@media print {
  .yearly-combined-chart-svg-wrap--mobile {
    display: none !important;
  }

  .yearly-combined-chart-svg-wrap--desktop {
    display: block !important;
  }
}

.compare-charts-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.compare-chart-block {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0;
  padding: 4px 10px;
}
.compare-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding-left: 12px;
  padding-right: 12px;
}
.compare-chart-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
  margin: 0;
  line-height: 1.3;
}
.compare-chart-unit {
  font-size: 12px;
  font-weight: 400;
  color: rgba(31, 41, 55, 0.65);
  white-space: nowrap;
}
.compare-chart-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* [순위] [브랜드명] [그래프] [값] - 4구역 정렬, 모든 행 동일 배경(bar 색상만 브랜드별) */
.compare-chart-row {
  display: grid;
  grid-template-columns: 32px 100px 1fr 105px;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1.3;
  min-height: 28px;
  background: #ffffff;
}
.compare-chart-rank-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* 순위 배지: 브랜드명 보조 요소 크기, 해당 행 막대색과 일치 */
.compare-chart-rank-badge {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  box-sizing: border-box;
}
.compare-chart-rank-badge--bar1 {
  background: #3b82f6;
}
.compare-chart-rank-badge--bar2 {
  background: #10b981;
}
.compare-chart-rank-badge--bar3 {
  background: #f59e0b;
}
.compare-chart-rank-badge--bar4 {
  background: #8b5cf6;
}
.compare-chart-rank-badge--empty {
  min-width: 0;
  width: 0;
  padding: 0;
  border: none;
  background: transparent;
}
/* 행 배경 통일: 브랜드별 row 배경 제거, bar 색상만 브랜드별 유지 */
.compare-chart-row--rank-1,
.compare-chart-row--rank-2,
.compare-chart-row--rank-3,
.compare-chart-row--rank-4 {
  background: #ffffff;
}
.compare-chart-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.compare-chart-bar-wrap {
  min-width: 0;
  height: 12px;
  background: var(--bar-track-bg);
  border-radius: 6px;
  overflow: hidden;
}
.compare-chart-bar-wrap .compare-bar {
  height: 100%;
  min-width: 2px;
  border-radius: 6px;
  transition: width 0.3s ease;
}
.compare-bar-1 { background: #3b82f6; }
.compare-bar-2 { background: #10b981; }
.compare-bar-3 { background: #f59e0b; }
.compare-bar-4 { background: #8b5cf6; }
.compare-chart-value-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  flex-shrink: 0;
  white-space: nowrap;
}
.compare-chart-value {
  font-weight: 600;
  color: #1F2937;
}
.compare-chart-rank-tag {
  margin-left: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #6B7280;
}
@media screen and (max-width: 768px) {
  .compare-chart-rank-badge {
    width: 22px;
    height: 22px;
    min-width: 22px;
    font-size: 13px;
  }
}
@media screen and (max-width: 480px) {
  .compare-chart-block {
    padding: 4px 10px;
  }
  .compare-chart-title {
    margin-bottom: 4px;
  }
  .compare-chart-row {
    grid-template-columns: 28px 80px 1fr 68px;
    gap: 4px;
    font-size: 12px;
    min-height: 24px;
  }
  .compare-chart-rank-badge {
    width: 22px;
    height: 22px;
    min-width: 22px;
    font-size: 13px;
  }
  .compare-chart-rank-tag {
    display: none;
  }
  .compare-chart-bar-wrap {
    height: 10px;
  }
}

.compare-section-blocks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-block {
  margin-bottom: 8px;
}

.compare-block-title {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 0;
  margin: 0 0 6px 0;
  border-bottom: 1px solid #cfd6dd;
  width: 100%;
  box-sizing: border-box;
}

.compare-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0;
  margin: 0;
  border-bottom: none;
}

.compare-section-header .section-title {
  margin-top: 24px;
  margin-bottom: 12px;
}

.compare-section-header .section-title:first-child {
  margin-top: 0;
}

/* 첫 페이지 핵심 지표: 상단 여백 축소 */
.compare-core-section .compare-section-header .section-title {
  margin-top: 0;
}

.compare-section-unit {
  font-size: 14px;
  color: #6b7280;
  flex-shrink: 0;
  margin-left: 12px;
}

.compare-block-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin: 0;
  border-bottom: none;
}

.compare-block-header .subsection-title {
  margin-top: 16px;
  margin-bottom: 8px;
}

.compare-detail-section > .section-title {
  padding-bottom: 0;
  border-bottom: none;
}

/* 그래프 아래 첫 상세 섹션: 적당한 간격 (과도한 공백 방지) */
.compare-print-detail-pages .compare-detail-section:first-child > .section-title {
  margin-top: 12px;
}

.compare-block-title-text {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
}

.compare-block-unit {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
  flex-shrink: 0;
  margin-left: 12px;
  margin-top: 0;
}

.unit-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}

/* 연도별·상세와 동일: 핵심 지표가 table-wrap 안에 있을 때 헤더/요약 간격만 정리 */
.compare-table-wrap .compare-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
}

.compare-table-wrap .compare-section-header h2.section-title,
.compare-table-wrap .compare-section-header .section-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.compare-table-wrap .compare-section-unit {
  margin-left: 0;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
  color: #6b7280;
}

.compare-table-wrap .rank-summary[data-yearly-rank-summary] {
  margin-bottom: 17px;
}

.brand-block-year {
  font-size: 11px;
  font-weight: 400;
  color: #555;
}

.compare-table-wrap {
  overflow-x: visible;
  margin-bottom: 0;
}

.compare-col-item {
  background: #f5f7fa !important;
  text-align: center !important;
  font-weight: 600;
  color: #2c3e50;
  width: var(--compare-item-col) !important;
  min-width: var(--compare-item-col) !important;
  max-width: var(--compare-item-col) !important;
}

/* 브랜드 컬럼 구분선 - 얇고 연하게 통일 */
.compare-table th.brand-group-end,
.compare-table td.brand-group-end,
.compare-unified-table th.brand-group-end,
.compare-unified-table td.brand-group-end,
.compare-kpi-table th.brand-group-end,
.compare-kpi-table td.brand-group-end,
.compare-section-table th.brand-group-end,
.compare-section-table td.brand-group-end,
.compare-metrics-table th.brand-group-end,
.compare-metrics-table td.brand-group-end,
.compare-core-table th.brand-group-end,
.compare-core-table td.brand-group-end,
.compare-region-table th.brand-group-end,
.compare-region-table td.brand-group-end,
.doc-table th.brand-group-end,
.doc-table td.brand-group-end,
.brand-divider {
  border-right: 1px solid var(--compare-cell-border) !important;
}

/* 첫 열(항목) 왼쪽 세로선 제거 */
.compare-table th:first-child,
.compare-table td:first-child,
.compare-unified-table th:first-child,
.compare-unified-table td:first-child,
.compare-kpi-table th:first-child,
.compare-kpi-table td:first-child,
.compare-section-table th:first-child,
.compare-section-table td:first-child,
.compare-metrics-table th:first-child,
.compare-metrics-table td:first-child,
.compare-core-table th:first-child,
.compare-core-table td:first-child,
.compare-region-table th:first-child,
.compare-region-table td:first-child,
.doc-table th:first-child,
.doc-table td:first-child {
  border-left: none !important;
}

.compare-table tbody th.compare-col-item {
  background: #f8f9fa;
}

.compare-table tbody td {
  min-width: 0;
}

.compare-region-block .compare-table-wrap {
  overflow-x: visible;
}

/* 가맹점 매출 테이블: thead 내부 브랜드명↔평균/평당 행 사이 얇은 구분선 */
.compare-region-table {
  border-collapse: collapse;
}

.compare-region-table thead tr:first-child th {
  border-bottom: 1px solid rgba(120, 130, 150, 0.35);
}

.compare-region-table thead tr:nth-child(2) th {
  border-top: none;
}

/* 다크모드: 흰줄처럼 튀지 않도록 색상 보정 */
body.dark-mode .compare-region-table th,
body.dark-mode .compare-region-table td {
  border-color: rgba(120, 130, 150, 0.25);
}

body.dark-mode .compare-region-table thead tr:first-child th {
  border-bottom-color: rgba(120, 130, 150, 0.35);
}

/* 비교 페이지 하단 스택(상세와 동일 .brand-detail-page--ftc): 순위 카드 → ← 홈 → SEO — DOM 한 컨테이너 */
.compare-detail-page > .compare-page-bottom-stack.brand-detail-page--ftc {
  margin-top: 8px;
  padding-top: 0;
  padding-bottom: 40px;
  padding-left: 0;
  padding-right: 0;
}

.compare-detail-page:has(.compare-page-bottom-stack) {
  padding-bottom: 0;
}

/* 마지막 비교표 ~ 순위 바로가기: 전역 .print-page padding-bottom(24px) + 스택 margin-top 이 겹쳐 간격 과다 → 화면에서만 본문 하단 패딩 축소(@media print 에서는 .print-page padding 0 유지) */
@media screen {
  .compare-detail-page:has(> .compare-page-bottom-stack) > .compare-print-area > .print-page {
    padding-bottom: 12px;
  }
  .compare-detail-page:has(> .compare-page-bottom-stack) .compare-print-detail-pages .compare-detail-section:last-child {
    margin-bottom: 6px;
  }
}

.compare-detail-empty .compare-empty-layout--search-only {
  display: block;
  width: 100%;
  max-width: var(--compare-table-width);
  margin-left: auto;
  margin-right: auto;
  padding: 0 4px;
  box-sizing: border-box;
}

.compare-detail-empty > .compare-page-bottom-stack {
  margin-top: 24px;
}

/* 순위 바로가기: 스택 폭에 맞춤(별도 12px 패딩 없음) */
.compare-page-bottom-stack .compare-ranking-bridge {
  margin: 0;
  padding: 0;
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

/* 레거시: 스택 밖에 두는 경우만(현재 비교는 스택 안만 사용) */
.compare-ranking-bridge {
  max-width: var(--compare-table-width, 1080px);
  margin: 28px auto 0;
  padding: 0 12px;
  box-sizing: border-box;
}

.compare-ranking-bridge__title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a5f;
  letter-spacing: -0.02em;
}

.compare-ranking-bridge__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .compare-ranking-bridge__grid {
    grid-template-columns: 1fr;
  }
}

.compare-ranking-bridge__item {
  margin: 0;
}

.compare-ranking-bridge__card {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  text-decoration: none;
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.compare-ranking-bridge__card:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.compare-ranking-bridge__card:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.compare-ranking-bridge__card-title {
  word-break: keep-all;
}

body.dark-mode .compare-ranking-bridge__title {
  color: #e5e7eb;
}

body.dark-mode .compare-ranking-bridge__card {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-main);
}

body.dark-mode .compare-ranking-bridge__card:hover {
  background: var(--bg-card-soft);
  border-color: var(--border-strong);
}

body.dark-mode .compare-ranking-bridge__card:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
}

.compare-detail-back,
.compare-empty-back {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
  font-size: 13px;
}

.compare-detail-back a,
.compare-empty-back a {
  color: #374151;
  text-decoration: none;
}

.compare-detail-back a:hover,
.compare-empty-back a:hover {
  text-decoration: underline;
}

/* Print Page */
.print-mode .main-header,
.print-mode .main-footer,
.print-mode .print-no-print {
  display: none !important;
}

.print-page {
  padding: 24px;
}

/* 단일 브랜드 PDF: 중앙 정렬, 좌측 쏠림 방지 */
.print-page--single .print-content {
  max-width: 760px;
  margin: 0 auto;
}

.print-no-print {
  margin-bottom: 16px;
}

.print-no-print button,
.print-no-print a:not(.rank-summary__item) {
  margin-right: 12px;
  padding: 8px 16px;
}

.print-content {
  max-width: 1080px;
  margin: 0 auto;
}

.print-header {
  text-align: left;
  margin-bottom: 16px;
}

.print-header h1 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.print-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.print-section {
  margin-bottom: 24px;
  break-inside: avoid;
}

.print-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #1e3a5f;
  padding: 8px 12px;
  margin: 0 0 -1px 0;
  border: 1px solid #1e3a5f;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.print-table th,
.print-table td {
  padding: 6px 8px;
  border: 1px solid var(--border);
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.print-table th:first-child,
.print-table td:first-child {
  width: 22%;
  min-width: 90px;
}

.print-table thead th {
  font-size: 11px;
  line-height: 1.3;
}

.print-section-title + .doc-table-wrap {
  break-inside: avoid;
}

.print-section-status {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.9;
  margin-left: 6px;
}

.print-footer {
  margin-top: 48px;
  padding-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
  break-inside: avoid;
}

.print-disclaimer {
  font-size: 11px;
  color: #666;
  margin-top: 8px;
}

.print-footer p {
  margin-bottom: 4px;
}

/* ===== Featured Compare Section - 업종 카드 그리드 ===== */
/* 검색 드롭다운은 .home-search-area(z-index:110) + .brand-search-results(z-index:200)로 카드 위에 표시 */
.featured-compare-section {
  position: relative;
  z-index: 100;
  margin-top: 24px;
  padding: 20px 24px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-card);
}

.featured-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.featured-section-hint {
  font-size: 13px;
  margin-bottom: 16px;
}

.industry-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.industry-card.top4-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--bg-main);
  border: 1px solid var(--border-light);
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
}

.industry-card.top4-card:hover:not(:disabled) {
  background: var(--bg-soft);
  border-color: var(--color-primary);
  cursor: pointer;
}

.industry-card.top4-card.active {
  background: var(--bg-soft);
  border: 2px solid var(--color-primary);
}

/* 메인 — 대표 브랜드 placeholder: 공란·비클릭, 카드 톤만 유지 */
.industry-card.top4-card.representative-brand-placeholder,
.industry-card.top4-card.representative-brand-placeholder:hover:not(:disabled),
.industry-card.top4-card.representative-brand-placeholder:disabled {
  cursor: default;
  pointer-events: none;
  opacity: 1;
  background: var(--bg-main);
  border-color: var(--border-light);
  box-shadow: none;
}

body.dark-mode .industry-card.top4-card.representative-brand-placeholder,
body.dark-mode .industry-card.top4-card.representative-brand-placeholder:hover:not(:disabled),
body.dark-mode .industry-card.top4-card.representative-brand-placeholder:disabled {
  background: var(--bg-card);
  border-color: var(--border-light);
}

/* 대표 브랜드 링크 카드 — .industry-card.top4-card 톤·호버 공유 */
a.industry-card.top4-card.representative-brand-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

a.industry-card.top4-card.representative-brand-card:visited {
  color: inherit;
}

/* 메인 대표 브랜드 · 업종 TOP4 공통 라벨 타이포 (카드는 .industry-card.top4-card가 font-size 상속 원천) */
.industry-card-label.representative-brand-name {
  font-size: inherit;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: inherit;
  color: var(--text-main);
  text-align: center;
}

.industry-card:disabled {
  opacity: 0.7;
  cursor: wait;
}

.industry-card-label {
  text-align: center;
}

/* 레거시 btn-industry (다른 페이지용) */
.btn-industry {
  padding: 7px 12px;
  font-size: 13px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
}

.btn-industry:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.btn-industry:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* ===== Top20 Section (legacy, FeaturedCompare로 대체됨) ===== */
.home-top20-section {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--border);
}

.top20-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.top20-mobile {
  display: none;
}

.top20-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.top20-table .brand-name-cell {
  word-break: keep-all;
  overflow-wrap: break-word;
  max-width: 140px;
}

.top20-table th,
.top20-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.top20-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: #f9fafb;
}

.top20-table tbody tr:hover {
  background: #f3f4f6;
}

.btn-top20-add {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.btn-top20-add:hover:not(:disabled) {
  background: var(--accent);
  color: white;
}

.btn-top20-add:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-muted);
}

/* Top20 모바일 카드 */
.top20-cards {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top20-card {
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
}

.top20-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.top20-card-rank {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.top20-card-name {
  font-size: 14px;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.top20-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.top20-card-stat {
  white-space: nowrap;
}

.top20-card-stat-sub {
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0.9;
}

.top20-card-footer .btn-top20-add {
  width: 100%;
}

/* 업종 평균 대비 */
.compare-avg-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.avg-diff {
  font-size: 11px;
  color: var(--text-muted);
}

.avg-diff-short {
  display: none;
}

.avg-diff-high {
  color: #059669;
}

.avg-diff-low {
  color: #dc2626;
}

/* Print-specific: print.css와 연동, 상세/비교 공통 라이트 인쇄 */
@media print {
  .print-no-print { display: none !important; }
  .print-page { padding: 0; }
  .print-content { max-width: 100%; }
  .print-table { font-size: 10px; }
  .print-table th, .print-table td { padding: 4px 6px; word-break: break-word; }
  .print-section { break-inside: avoid; page-break-inside: avoid; }
  .print-section-title { page-break-after: avoid; }
  .print-footer { page-break-inside: avoid; }

  /* 상세페이지: print.css와 동일 폭 규칙, 라이트 강제 */
  .brand-detail-page .brand-detail-section,
  .brand-detail-page .brand-detail-core-section,
  .brand-detail-page .brand-detail-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .brand-detail-page .brand-detail-section-title,
  .brand-detail-page .brand-detail-subsection-title {
    page-break-after: avoid;
  }
  .brand-detail-page .brand-detail-table-wrap {
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .brand-detail-page table {
    font-size: 11px;
    width: 100% !important;
    max-width: 100% !important;
  }
  .brand-detail-version-print-only {
    display: inline !important;
  }
  .brand-detail-print-only {
    display: block !important;
  }
}

/* —— 랭킹 페이지 / 메인 미리보기 —— */
.page-container,
.ranking-container {
  max-width: 1000px;
  margin: 0 auto;
}

.ranking-page {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}


/* 업종 허브: 운영 배포 CSS 스냅샷 — src/styles/industry-hub-prod-snapshot.css (index.html에서 style-new.css 직후 로드) */

/* 업종 허브 SEO 본문 하단 CTA (비교 · 순위) */
.seo-cta-block {
  margin-top: 20px;
  font-size: 14px;
  color: #666;
}

.seo-cta-link {
  color: #2a5bd7;
  text-decoration: none;
}

.seo-dot {
  margin: 0 8px;
  color: #aaa;
}

/* PC: 순위 비교바구니는 기존 aside 그대로 — shell 래퍼는 레이아웃 박스 생성 안 함 */
@media (min-width: 769px) {
  .ranking-compare-tray-shell {
    display: contents;
  }
}

.ranking-results-section.ranking-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 랭킹 상단: 그리드 — 메인 + 우측 비교바구니(260px) */
.ranking-top-layout.ranking-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: start;
  width: 100%;
}

.ranking-top-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ranking-tray-aside {
  flex-shrink: 0;
  width: 260px;
  max-width: 260px;
  align-self: start;
}

.ranking-tray-aside .ranking-tray-area {
  min-width: 0;
}

/* 랭킹 상단: 구형 비접기형 바구니만 — 접기형(.compare-tray--compact)은 상세·연도별과 동일 공통 스타일 */
@media (min-width: 901px) {
  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) {
    width: 260px;
    max-width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
    box-sizing: border-box;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-header {
    margin-bottom: 4px;
    padding-bottom: 4px;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-title {
    font-size: 13px;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-count {
    font-size: 11px;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-list {
    margin: 0 0 4px;
    padding: 0;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-item {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 0;
    min-height: 30px;
    box-sizing: border-box;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-name {
    font-size: 12px;
    line-height: 1.25;
    align-self: center;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-actions {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-hint {
    margin: 0 0 4px;
    font-size: 11px;
    line-height: 1.35;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-btn-group {
    margin-top: 4px;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-btn-group button {
    height: 32px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-detail,
  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-yearly {
    height: auto;
    min-height: 26px;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-remove {
    width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  /* 업종 허브: 본문 열과 시각 균형 (PC) */
  .industry-hub-page .ranking-tray-aside .compare-tray:not(.compare-tray--compact) {
    padding: 6px 8px 8px;
  }

  .industry-hub-page .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-header {
    margin-bottom: 2px;
    padding-bottom: 3px;
  }

  .industry-hub-page .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-item {
    padding: 2px 0;
    min-height: 28px;
  }

  .industry-hub-page .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-btn-group button {
    height: 30px;
    padding: 5px 9px;
  }
}

/* 랭킹: 구형 비접기형만 — 모바일 접기형은 .compare-tray--compact 공통 블록과 동일 */
@media (max-width: 900px) {
  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    font-size: 13px;
    border-radius: 8px;
    box-sizing: border-box;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-item {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-tray-actions {
    align-items: center;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-btn-group {
    margin-top: 8px;
  }

  .ranking-tray-aside .compare-tray:not(.compare-tray--compact) .compare-btn-group button {
    height: 36px;
  }
}

.ranking-filter.ranking-filter-bar--grid,
.ranking-filter-bar.ranking-filter-bar--grid {
  max-width: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  padding: 12px 14px;
}

@media (max-width: 899px) {
  .ranking-filter.ranking-filter-bar--grid,
  .ranking-filter-bar.ranking-filter-bar--grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 479px) {
  .ranking-filter.ranking-filter-bar--grid,
  .ranking-filter-bar.ranking-filter-bar--grid {
    grid-template-columns: 1fr;
  }
}

.ranking-header-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-intro-line.rank-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted, #6b7280);
}

body.dark-mode .ranking-intro-line.rank-description {
  color: var(--text-muted, #9ca3af);
}

.ranking-page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
  color: var(--text, #111827);
}

.ranking-seo-block {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted, #6b7280);
  padding: 14px 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-muted, #f9fafb);
}

.ranking-description.ranking-seo-block {
  padding: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.ranking-seo-block p {
  margin: 0 0 8px;
}
.ranking-seo-block p:last-child {
  margin-bottom: 0;
}

.ranking-seo-block p + p {
  margin-top: 6px;
}

.ranking-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
}

.ranking-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ranking-filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}

.ranking-select {
  min-width: 0;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface, #fff);
  color: var(--text, #111827);
}

.ranking-filter-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}

.ranking-year-badge strong {
  color: var(--text, #111827);
}

/* 랭킹 테이블·모바일 카드: 상세 보기 버튼형 링크 */
.ranking-page .ranking-detail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  min-height: 26px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  background: var(--header-bg, var(--surface-muted, #f3f4f6));
  color: var(--text, #374151);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  box-sizing: border-box;
  vertical-align: middle;
}

.ranking-page .ranking-detail-btn:hover {
  background: var(--navy, #1e3a5f);
  border-color: var(--navy, #1e3a5f);
  color: var(--compare-on-accent, #fff);
}

.ranking-page .ranking-detail-btn:focus-visible {
  outline: 2px solid var(--navy, #1e3a5f);
  outline-offset: 2px;
}

.ranking-table .ranking-compare-btn,
.ranking-mobile-cards .ranking-compare-btn,
.ranking-mobile-flex .ranking-compare-btn {
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: var(--action-btn-radius);
}

.ranking-table-wrapper {
  width: 100%;
  display: block;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
}

.ranking-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  box-sizing: border-box;
}

.ranking-table th,
.ranking-table td {
  text-align: center;
  vertical-align: middle;
  padding: 4px 3px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
}

.ranking-table .ranking-ui-rank {
  font-weight: 700;
  font-size: 11px;
  color: var(--navy, #1e3a5f);
}

.ranking-table th {
  font-weight: 600;
}

.ranking-brand-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  padding-left: 6px;
}

/* 순위·업종 허브 공통: 브랜드명 → 상세 링크 인지성(밑줄·굵기·포커스·모바일 터치 여유) */
.ranking-page a.ranking-brand-name-link.brand-link {
  color: var(--navy, #1e3a5f);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(30, 58, 95, 0.55);
  display: inline-block;
  max-width: 100%;
  line-height: 1.45;
  padding: 2px 0;
  vertical-align: baseline;
}

.ranking-page a.ranking-brand-name-link.brand-link:visited {
  color: var(--navy, #1e3a5f);
}

.ranking-page a.ranking-brand-name-link.brand-link:hover {
  color: var(--navy-dark, #152a45);
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(21, 42, 69, 0.85);
}

.ranking-page a.ranking-brand-name-link.brand-link:active {
  opacity: 0.88;
}

.ranking-page a.ranking-brand-name-link.brand-link:focus-visible {
  outline: 2px solid var(--navy, #1e3a5f);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (max-width: 768px) {
  .ranking-page .ranking-mobile-flex a.ranking-brand-name-link.brand-link {
    padding: 6px 2px;
    min-height: 40px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.35;
  }
}

.ranking-kpi-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.ranking-kpi-col--sort {
  background: rgba(30, 58, 95, 0.06);
}

.ranking-table-empty-row .ranking-empty-cell {
  text-align: center;
  padding: 28px 20px;
  font-size: 14px;
  color: var(--text-muted, #6b7280);
  background: var(--surface-muted, #f9fafb);
  border-bottom: 1px solid var(--border-light, #f3f4f6);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.ranking-mobile-empty-box {
  padding: 28px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted, #6b7280);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-muted, #f9fafb);
}

.ranking-loading,
.ranking-empty,
.ranking-error {
  padding: 24px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted, #6b7280);
}

.ranking-error {
  color: #dc2626;
}

.ranking-more-wrap {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.ranking-more-btn {
  min-width: 200px;
  padding: 10px 14px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.ranking-more-btn:hover {
  background: var(--navy-dark);
}

.ranking-subheading {
  font-size: 1rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text, #111827);
}

.ranking-table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-light, #f3f4f6);
  border-radius: 8px;
  background: var(--surface-muted, #f9fafb);
}

.ranking-table-note {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

.ranking-table-unit {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  font-weight: 600;
}

.ranking-related-links {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
}

.ranking-related-links__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
}

.ranking-related-links__group {
  margin-top: 10px;
}

.ranking-related-links__group-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

.ranking-related-links__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ranking-related-links__chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text, #111827);
  background: var(--surface-muted, #f9fafb);
}

.ranking-related-links__chip:hover {
  border-color: var(--navy, #1e3a5f);
  color: var(--navy, #1e3a5f);
}

.ranking-mobile-cards {
  display: none;
}

/* 모바일: flex 행 테이블 (768px 이하에서만 표시, JS에서 PC 테이블과 동시 출력) */
.ranking-mobile-flex {
  display: none;
  width: 100%;
  box-sizing: border-box;
}

.ranking-mobile-flex__head,
.ranking-mobile-flex__row {
  display: flex;
  flex-direction: row;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
}

.ranking-mobile-flex__head {
  min-height: 48px;
  font-weight: 600;
  font-size: 11px;
  background: var(--surface-muted, #f9fafb);
}

.ranking-mobile-flex__row {
  min-height: 64px;
}

.ranking-mobile-flex__cell {
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 6px;
  font-size: 11px;
}

.ranking-mobile-flex__cell--rank {
  flex: 0 0 12%;
  max-width: 12%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-mobile-flex__cell--brand {
  flex: 0 0 40%;
  max-width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-mobile-flex__brand-text {
  display: block;
  width: 100%;
  min-width: 0;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-mobile-flex__cell--kpi {
  flex: 0 0 20%;
  max-width: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.ranking-mobile-flex__cell--actions {
  flex: 0 0 28%;
  max-width: 28%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-mobile-flex__head-sep {
  margin: 0 2px;
  color: var(--text-muted, #9ca3af);
  font-weight: 400;
}

.ranking-mobile-flex__actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.ranking-mobile-flex--empty {
  min-height: 64px;
}

.ranking-mobile-flex__empty-msg {
  padding: 28px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted, #6b7280);
  background: var(--surface-muted, #f9fafb);
}

.ranking-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface, #fff);
}

.ranking-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ranking-card-name {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
  min-width: 0;
}

.ranking-card-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.ranking-card-kpi-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ranking-card-kpi-row .muted {
  color: var(--text-muted, #6b7280);
  font-size: 12px;
}

.ranking-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ranking-card-more {
  margin-top: 10px;
  font-size: 12px;
}

.ranking-card-more summary {
  cursor: pointer;
  color: var(--text-muted, #6b7280);
}

.ranking-card-extra {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

@media (max-width: 900px) {
  .ranking-top-layout.ranking-layout {
    grid-template-columns: 1fr;
  }

  .ranking-tray-aside {
    max-width: none;
    width: 100%;
  }

  .ranking-tray-aside .compare-tray {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .ranking-table-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .ranking-table-unit {
    align-self: flex-end;
  }

  .ranking-table-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
  }

  /* 모바일: 축약 테이블은 flex 행으로만 표시 (PC용 table 숨김) */
  .ranking-table-wrapper .ranking-table {
    display: none !important;
  }

  .ranking-mobile-flex {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: var(--surface, #fff);
    box-sizing: border-box;
  }

  .ranking-mobile-flex--empty .ranking-mobile-flex__empty-msg {
    border: none;
    border-radius: 0;
  }

  .ranking-page .ranking-detail-btn,
  .ranking-mobile-flex .ranking-compare-btn {
    height: auto;
    min-height: 26px;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1.3;
    min-width: 40px;
  }

  .ranking-page {
    padding: 12px 16px calc(118px + env(safe-area-inset-bottom, 0px));
  }

  .ranking-page:has(.compare-tray--collapsed) {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .ranking-results-inner,
  .ranking-results-root {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }
}

/* 메인 랭킹 미리보기 */
.ranking-preview-section {
  margin: 20px 0 8px;
  padding: 16px 18px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface, #fff);
}

.ranking-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ranking-preview-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.ranking-preview-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  color: var(--text, #111827);
  background: var(--surface-muted, #f9fafb);
}

.ranking-preview-all:hover {
  border-color: var(--navy, #1e3a5f);
  color: var(--navy, #1e3a5f);
}

.ranking-preview-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ranking-preview-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light, #f3f4f6);
  font-size: 14px;
}

.ranking-preview-item:last-child {
  border-bottom: none;
}

.ranking-preview-rank {
  font-weight: 700;
  color: var(--navy, #1e3a5f);
}

.ranking-preview-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-preview-kpi {
  font-size: 12px;
  white-space: nowrap;
}

.ranking-preview-skeleton,
.ranking-preview-empty,
.ranking-preview-error {
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}

.ranking-preview-error {
  color: #dc2626;
}

body.dark-mode .ranking-page-title,
body.dark-mode .ranking-subheading {
  color: var(--text, #f3f4f6);
}

body.dark-mode .ranking-page .ranking-detail-btn {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-main);
}

body.dark-mode .ranking-page .ranking-detail-btn:hover {
  background: var(--compare-accent, #3b82f6);
  border-color: var(--compare-accent, #3b82f6);
  color: #fff;
}

/* 순위: 필터·SEO·바구니 = section / 데이터 블록 = card */
body.dark-mode .ranking-seo-block,
body.dark-mode .ranking-filter-bar,
body.dark-mode .ranking-tray-aside .compare-tray,
body.dark-mode .ranking-related-links {
  border-color: var(--border-light);
  background: var(--bg-section);
}

body.dark-mode .ranking-table-wrapper,
body.dark-mode .ranking-mobile-flex,
body.dark-mode .ranking-table-meta,
body.dark-mode .ranking-card,
body.dark-mode .ranking-preview-section {
  border-color: var(--border-light);
  background: var(--bg-card);
}

body.dark-mode .ranking-related-links__chip {
  border-color: var(--border-light);
  color: var(--text-main);
  background: var(--bg-card-soft);
}

body.dark-mode .ranking-related-links__chip:hover {
  border-color: var(--border-strong);
  color: var(--dm-link);
  text-decoration-color: var(--dm-link-decoration-strong);
}

body.dark-mode .ranking-related-links__chip:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  color: var(--dm-link);
}

body.dark-mode .ranking-table-empty-row .ranking-empty-cell,
body.dark-mode .ranking-mobile-empty-box,
body.dark-mode .ranking-mobile-flex__empty-msg {
  color: var(--text-sub);
  background: var(--bg-card-soft);
  border-color: var(--border-light);
}

body.dark-mode .ranking-mobile-flex__head {
  background: var(--bg-card-soft);
}

body.dark-mode .ranking-select {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-main);
}

body.dark-mode .ranking-preview-all {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-main);
}

body.dark-mode .ranking-kpi-col--sort {
  background: var(--bg-card-soft);
}

body.dark-mode .ranking-table thead th {
  background: var(--bg-card-soft);
}

body.dark-mode .ranking-table tbody tr:hover td {
  background: var(--bg-card-soft);
}

/* 순위표·업종 허브 브랜드명 링크 — 다크모드: 흰색 계열 + 밑줄·포커스 링(색상 hue 변화 없음) */
body.dark-mode .ranking-page a.ranking-brand-name-link.brand-link,
body.dark-mode .ranking-page a.ranking-brand-name-link.brand-link:visited {
  color: var(--dm-link);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: var(--dm-link-decoration);
}

body.dark-mode .ranking-page a.ranking-brand-name-link.brand-link:hover {
  color: var(--dm-link);
  text-decoration-thickness: 2px;
  text-decoration-color: var(--dm-link-decoration-strong);
}

body.dark-mode .ranking-page a.ranking-brand-name-link.brand-link:active {
  opacity: 0.9;
  color: var(--dm-link);
}

body.dark-mode .ranking-page a.ranking-brand-name-link.brand-link:focus-visible {
  outline: 2px solid var(--dm-link-focus-ring);
  outline-offset: 2px;
  border-radius: 3px;
  color: var(--dm-link);
}

body.dark-mode .ranking-mobile-flex__row:hover {
  background: var(--bg-card-soft);
}

/* 링크 복사 토스트 */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 10000;
  max-width: min(90vw, 320px);
  padding: 10px 16px;
  background: rgba(30, 58, 95, 0.95);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-align: center;
}

.copy-toast.copy-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.copy-toast[data-error='1'] {
  background: rgba(127, 29, 29, 0.95);
}

body.dark-mode .copy-toast {
  background: rgba(30, 58, 95, 0.98);
}

body.dark-mode .copy-toast[data-error='1'] {
  background: rgba(127, 29, 29, 0.95);
}

/* ========================================================================
   브랜드 비교 / 연도별 비교 — section·표 래퍼 + 본문 블록(div.compare-block) 카드 제거
   - table / td / th 미포함
   ======================================================================== */

@media screen {
  .compare-detail-page section,
  .yearly-compare-page section {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .compare-detail-page section .compare-table-wrap,
  .yearly-compare-page section .compare-table-wrap {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* 본문 중간 표: CompareTableRenderer — div.compare-block.compare-content-block (실제 카드 노드) */
  .compare-detail-page .compare-block.compare-content-block,
  .yearly-compare-page .compare-block.compare-content-block {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .compare-detail-page .compare-block.compare-region-block.compare-content-block,
  .yearly-compare-page .compare-block.compare-region-block.compare-content-block {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .compare-detail-page .compare-block .compare-table-wrap,
  .yearly-compare-page .compare-block .compare-table-wrap {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* ========================================================================
   연도별·브랜드 비교 KPI 제목 줄: 카드/박스 없음 — spacing만 (상세 핵심지표와 동일 체감 목표)
   - table / thead / tbody / note / chart 미포함
   ======================================================================== */

  /* —— 연도별: .yearly-kpi-header-wrap (구조만 유지, 배경·박스 제거) —— */
  .yearly-compare-page .yearly-kpi-header-wrap {
    background: transparent;
    border: none;
    padding: 0 0 4px 0;
    margin-bottom: 4px;
    box-sizing: border-box;
  }

  .yearly-compare-page .yearly-kpi-header-wrap .compare-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
  }

  .yearly-compare-page .yearly-kpi-header-wrap .compare-section-header .section-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
  }

  .yearly-compare-page .yearly-kpi-header-wrap .compare-section-unit {
    margin-left: 0;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 400;
    color: var(--text-sub);
  }

  /* —— 브랜드 비교: KPI 제목 행만, 박스 없음 —— */
  .compare-detail-page:not(.yearly-compare-page) section.compare-core-section.compare-print-section > .compare-section-header {
    background: transparent;
    border: none;
    padding: 0 0 4px 0;
    margin-bottom: 4px;
    box-sizing: border-box;
  }
}

@media screen and (max-width: 768px) {
  .yearly-compare-page .yearly-kpi-header-wrap .compare-section-header {
    align-items: flex-start;
  }
}

/* /compare 랜딩·리다이렉트 오류 배너 */
.compare-landing-alert {
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.45);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.compare-landing-alert p {
  margin: 0;
  line-height: 1.5;
}
.brand-detail-peer-compare-link {
  display: block;
  margin: 6px 0 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* =============================================================================
   데스크톱(≥1280px): 상단 네비 줄 — 중앙 고정폭(max-width+auto margin) 제거, 헤더 전체폭에서 좌우 안전 패딩만
   ============================================================================= */
@media screen and (min-width: 1280px) {
  .main-header .nav-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
  }
}

/* =============================================================================
   compare-action-pill — 소형 필 외형 통일 (기준: .compare-tray-detail / .compare-tray-yearly)
   기존 역할 클래스(btn-detail, ranking-detail-btn 등)는 유지, shape만 공통화
   ============================================================================= */

.compare-action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;
  white-space: nowrap;
  border-style: solid;
  border-width: 1px;
  cursor: pointer;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: none;
  vertical-align: middle;
  font-family: inherit;
}

.compare-action-pill:focus-visible {
  outline: 2px solid var(--navy, #1e3a5f);
  outline-offset: 2px;
}

.compare-action-pill--neutral {
  border-color: var(--border);
  background: var(--header-bg);
  color: var(--text);
}

.compare-action-pill--neutral:hover {
  background: var(--navy);
  color: var(--compare-on-accent);
  border-color: var(--navy);
}

body.dark-mode .compare-action-pill--neutral {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-light);
}

body.dark-mode .compare-action-pill--neutral:hover {
  background: var(--compare-accent);
  color: #fff;
  border-color: var(--compare-accent);
}

/* state: 형태만 통일 — 배경색은 cta-primary-override 의 cta-secondary 계열이 우선 */
.compare-action-pill--state {
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;
}

/* 검색 결과: .search-result-btn-* 가 height/padding 을 크게 잡음 */
button.compare-action-pill.search-result-btn-secondary,
button.compare-action-pill.search-result-btn-primary {
  height: auto !important;
  min-height: 26px;
  padding: 3px 8px !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
  border-radius: 6px !important;
}

button.compare-action-pill--neutral.search-result-btn-secondary {
  background: var(--header-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

button.compare-action-pill--neutral.search-result-btn-secondary:hover:not(:disabled) {
  background: var(--navy) !important;
  color: var(--compare-on-accent) !important;
  border-color: var(--navy) !important;
}

body.dark-mode button.compare-action-pill--neutral.search-result-btn-secondary {
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-color: var(--border-light) !important;
}

body.dark-mode button.compare-action-pill--neutral.search-result-btn-secondary:hover:not(:disabled) {
  background: var(--compare-accent) !important;
  color: #fff !important;
  border-color: var(--compare-accent) !important;
}
