:root {
  color-scheme: light;
  --ink: #20201f;
  --muted: #76736d;
  --soft: #9c9890;
  --paper: #f4f1eb;
  --surface: #fffdf9;
  --line: #ded9d0;
  --line-soft: #ebe7df;
  --accent: #df5b3f;
  --accent-dark: #b9432e;
  --teal: #2b6f73;
  --plum: #9b5077;
  --shadow: 0 18px 50px rgba(66, 54, 39, .08);
  font-family: Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-frame { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px 22px; display: flex; flex-direction: column; background: #222321; color: #f8f4ed; border-right: 1px solid rgba(255,255,255,.06); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: inherit; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 8px; border-radius: 11px; background: var(--accent); }
.brand-mark i { display: block; width: 4px; border-radius: 3px; background: white; }
.brand-mark i:nth-child(1) { height: 10px; }
.brand-mark i:nth-child(2) { height: 20px; }
.brand-mark i:nth-child(3) { height: 15px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; letter-spacing: .06em; }
.brand small { margin-top: 3px; color: #8f928b; font-size: 7px; letter-spacing: .16em; }

.side-nav { display: grid; gap: 6px; margin-top: 44px; }
.side-nav a, .side-nav button { position: relative; width: 100%; border: 0; display: flex; align-items: center; gap: 11px; padding: 12px 13px; border-radius: 10px; background: transparent; color: #989b95; text-decoration: none; text-align: left; cursor: pointer; font-size: 12px; font-weight: 650; }
.side-nav a:hover, .side-nav button:hover { color: #fff; background: rgba(255,255,255,.05); }
.side-nav .active { color: #fff; background: rgba(255,255,255,.09); }
.side-nav .active::before { content: ""; position: absolute; left: -20px; width: 3px; height: 25px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-nav span { width: 20px; text-align: center; font-size: 17px; }
.side-nav em { margin-left: auto; padding: 3px 5px; border-radius: 5px; background: rgba(255,255,255,.07); color: #70736e; font-style: normal; font-size: 7px; }
.side-nav .muted-link { opacity: .7; }

.sidebar-card { margin-top: auto; padding: 17px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.035); }
.sidebar-card-icon { display: grid; place-items: center; width: 31px; height: 23px; margin-bottom: 11px; border-radius: 6px; background: #fff; color: #292a28; font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.sidebar-card strong { display: block; font-size: 11px; }
.sidebar-card p { margin: 7px 0 0; color: #8b8e88; font-size: 9px; line-height: 1.6; }
.credit { padding: 18px 5px 0; text-align: center; }
.credit a { color: #696c67; font-size: 7px; text-decoration: none; }

.main-content { min-width: 0; width: min(1420px, 100%); margin: 0 auto; padding: 0 40px 48px; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.overline { margin: 0 0 6px; color: var(--accent); font-size: 8px; font-weight: 850; letter-spacing: .18em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 27px; letter-spacing: -.04em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.global-search { width: min(320px, 32vw); height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,253,249,.75); }
.global-search span { color: var(--soft); font-size: 19px; }
.global-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.global-search input::placeholder { color: #aaa69f; }
.refresh-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; font-size: 18px; transition: .2s; }
.refresh-button:hover { color: var(--accent); transform: rotate(25deg); }
.refresh-button.loading { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.source-banner { min-height: 66px; margin-top: 24px; padding: 14px 17px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid #dfd6c8; border-radius: 14px; background: #fff9ef; }
.source-banner.live { background: #eff7f3; border-color: #cbded6; }
.source-copy { display: flex; align-items: center; gap: 11px; }
.status-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #e4a13a; box-shadow: 0 0 0 5px rgba(228,161,58,.12); }
.source-banner.live .status-dot { background: #3e9a77; box-shadow: 0 0 0 5px rgba(62,154,119,.12); }
.source-copy strong, .source-copy p { display: block; margin: 0; }
.source-copy strong { font-size: 11px; }
.source-copy p { margin-top: 3px; color: var(--muted); font-size: 9px; }
.source-badge { flex: 0 0 auto; padding: 6px 9px; border-radius: 7px; background: rgba(223,91,63,.08); color: var(--accent-dark); font-size: 8px; font-weight: 800; }
.source-banner.live .source-badge { color: #247053; background: rgba(62,154,119,.1); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.metric-card { position: relative; min-height: 126px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 25px rgba(66,54,39,.025); }
.metric-card[data-metric] { cursor: pointer; transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease; }
.metric-card[data-metric]:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(32,31,28,.1); }
.metric-card[data-metric]:focus-visible { outline: 3px solid rgba(229,89,60,.35); outline-offset: 3px; }
.metric-card[data-metric].is-selected:not(.metric-primary) { border-color: #e55a3c; box-shadow: inset 0 0 0 2px rgba(229,90,60,.16); }
.metric-card > div { display: grid; gap: 8px; }
.metric-label { color: var(--muted); font-size: 9px; font-weight: 700; }
.metric-card strong { font-family: Georgia, serif; font-size: 29px; line-height: 1; }
.metric-card p { position: absolute; left: 18px; bottom: 15px; margin: 0; color: var(--soft); font-size: 8px; }
.metric-icon { position: absolute; top: 17px; right: 17px; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: #f9e6e0; font-size: 14px; }
.metric-icon.neutral { color: var(--teal); background: #e0eeec; }
.metric-icon.warm { color: #9b6b20; background: #f4ead7; font-size: 10px; }
.metric-icon.plum { color: var(--plum); background: #f2e2ea; }
.metric-primary { color: white; border-color: #292a28; background: #292a28; }
.metric-primary .metric-label, .metric-primary p { color: #aaaDA6; }
.metric-primary .metric-icon { background: var(--accent); color: white; }

.filter-panel { margin-top: 22px; padding: 17px 18px 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,253,249,.8); }
.view-tabs { display: flex; gap: 3px; width: max-content; padding: 3px; border-radius: 9px; background: #e9e5de; }
.view-tabs button { min-width: 88px; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: #77746e; cursor: pointer; font-size: 9px; font-weight: 750; }
.view-tabs button.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 9px rgba(60,50,40,.1); }
.filter-row { display: grid; grid-template-columns: .8fr .8fr .8fr minmax(190px, 1.5fr) 1fr; gap: 10px; margin-top: 15px; }
.select-field { display: grid; gap: 6px; }
.select-field > span { color: var(--muted); font-size: 8px; font-weight: 750; }
.select-field select { width: 100%; height: 39px; padding: 0 32px 0 11px; border: 1px solid var(--line); border-radius: 9px; outline: 0; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 5 3 3 3-3' fill='none' stroke='%2376736d' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right 10px center; color: var(--ink); font-size: 10px; }
.select-field select:focus { border-color: #b3aaa0; }
.select-field.is-disabled { opacity: .42; }
.filter-foot { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.filter-foot p { margin: 0; color: var(--muted); font-size: 8px; }
.saved-toggle { display: flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; font-size: 8px; }
.saved-toggle input { position: absolute; opacity: 0; }
.saved-toggle span { position: relative; width: 28px; height: 16px; border-radius: 20px; background: #d7d2c9; transition: .2s; }
.saved-toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: white; transition: .2s; }
.saved-toggle input:checked + span { background: var(--accent); }
.saved-toggle input:checked + span::after { left: 15px; }

.channel-section, .products-section { margin-top: 34px; scroll-margin-top: 24px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 15px; }
.section-head h2 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 20px; letter-spacing: -.035em; }
.section-head > p { max-width: 310px; margin: 0 0 2px; color: var(--muted); font-size: 9px; line-height: 1.5; text-align: right; }
.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.channel-card { --channel: var(--accent); position: relative; min-height: 145px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); cursor: pointer; transition: .2s; }
.channel-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--channel) 35%, var(--line)); }
.channel-card.selected { border-color: var(--channel); box-shadow: 0 0 0 2px color-mix(in srgb, var(--channel) 12%, transparent); }
.channel-card::after { content: ""; position: absolute; right: -18px; bottom: -32px; width: 105px; height: 105px; border-radius: 50%; background: color-mix(in srgb, var(--channel) 10%, transparent); }
.channel-top { display: flex; justify-content: space-between; gap: 12px; }
.channel-card .channel-number { color: var(--channel); font-family: Georgia, serif; font-size: 26px; }
.channel-card .channel-count { height: max-content; padding: 5px 7px; border-radius: 7px; background: color-mix(in srgb, var(--channel) 10%, white); color: var(--channel); font-size: 8px; font-weight: 800; }
.channel-card h3 { margin: 12px 0 5px; font-size: 12px; }
.channel-card p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.55; }
.channel-audience { display: block; margin-top: 10px; color: var(--soft); font-size: 7px; }

.result-meta { display: grid; justify-items: end; gap: 4px; }
.result-meta strong { font-size: 11px; }
.result-meta span { color: var(--soft); font-size: 8px; }
.table-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.table-head, .product-row { display: grid; grid-template-columns: 48px minmax(270px, 2.2fr) minmax(145px, 1fr) minmax(125px, .9fr) 100px 42px; align-items: center; gap: 14px; }
.table-head { min-height: 38px; padding: 0 17px; border-bottom: 1px solid var(--line); background: #f8f5ef; color: var(--soft); font-size: 7px; font-weight: 750; letter-spacing: .05em; }
.product-row { min-height: 94px; padding: 12px 17px; border-bottom: 1px solid var(--line-soft); transition: background .18s; }
.product-row:last-child { border-bottom: 0; }
.product-row:hover { background: #fdf9f3; }
.rank { font-family: Georgia, serif; font-size: 19px; text-align: center; }
.rank.top { color: var(--accent); }
.product-main { min-width: 0; display: flex; align-items: center; gap: 13px; }
.product-thumb { flex: 0 0 auto; width: 61px; height: 61px; display: grid; place-items: center; overflow: hidden; border: 1px solid #e3ddd4; border-radius: 12px; background: linear-gradient(145deg, #f1e9dc, #faf7f1); color: #6e6c68; font-family: Georgia, serif; font-size: 21px; }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; background: white; }
.product-copy { min-width: 0; }
.product-copy strong { display: -webkit-box; overflow: hidden; color: #252523; font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-copy small { display: block; overflow: hidden; margin-top: 5px; color: var(--soft); font-size: 7px; white-space: nowrap; text-overflow: ellipsis; }
.category-cell { min-width: 0; }
.channel-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 7px; font-size: 7px; font-weight: 800; }
.channel-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.channel-pill.home { color: #b74d36; background: #f8e8e2; }
.channel-pill.gear { color: #26666a; background: #e1efee; }
.channel-pill.style { color: #925071; background: #f2e4eb; }
.category-cell small { display: block; margin-top: 6px; color: var(--muted); font-size: 8px; }
.commerce-cell strong, .commerce-cell small { display: block; }
.commerce-cell strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.commerce-cell small { margin-top: 5px; color: var(--soft); font-size: 7px; }
.commerce-cell small b { color: #ca8b2c; }
.score-cell { display: flex; align-items: center; gap: 8px; }
.score-ring { --score: 0; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--score) * 1%), #ece7df 0); }
.score-ring::before { content: ""; grid-area: 1 / 1; width: 31px; height: 31px; border-radius: 50%; background: var(--surface); }
.score-ring strong { z-index: 1; grid-area: 1 / 1; font-size: 9px; }
.score-cell small { color: var(--soft); font-size: 7px; }
.row-actions { display: grid; gap: 5px; }
.favorite-button, .detail-button { width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; font-size: 13px; }
.favorite-button.active { color: white; border-color: var(--accent); background: var(--accent); }
.detail-button { display: none; }
.favorite-button:hover, .detail-button:hover { border-color: var(--accent); color: var(--accent); }
.favorite-button.active:hover { color: white; }
.product-row { cursor: pointer; }
.loading-state, .empty-state { min-height: 240px; display: grid; place-items: center; align-content: center; gap: 13px; color: var(--muted); }
.loading-state span { width: 30px; height: 30px; border: 2px solid #ddd6cc; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-state p, .empty-state p { margin: 0; font-size: 9px; }
.empty-state strong { font-size: 13px; }

.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 4px 0; color: var(--soft); font-size: 7px; }
.page-footer p { margin: 0; }
.page-footer a { color: var(--soft); }

.detail-dialog { width: min(590px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px rgba(34,31,27,.3); }
.detail-dialog::backdrop { background: rgba(31,30,28,.55); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 31px; height: 31px; border: 0; border-radius: 50%; background: rgba(255,255,255,.86); cursor: pointer; font-size: 19px; }
.detail-hero { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 19px; padding: 28px; background: #f5f0e8; }
.detail-thumb { height: 145px; display: grid; place-items: center; overflow: hidden; border-radius: 16px; background: white; color: #66625b; font-family: Georgia, serif; font-size: 42px; box-shadow: 0 10px 30px rgba(70,60,50,.08); }
.detail-thumb img { width: 100%; height: 100%; object-fit: contain; }
.detail-hero-copy { align-self: center; }
.detail-rank { color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.detail-hero h2 { margin: 9px 0 8px; font-size: 16px; line-height: 1.45; }
.detail-hero p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.detail-price { display: block; margin-top: 13px; font-family: Georgia, serif; font-size: 21px; }
.detail-body { padding: 23px 28px 27px; }
.detail-section + .detail-section { margin-top: 20px; padding-top: 19px; border-top: 1px solid var(--line-soft); }
.detail-section h3 { margin: 0 0 11px; font-size: 10px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-stat { padding: 11px; border-radius: 10px; background: #f7f4ef; }
.detail-stat span, .detail-stat strong { display: block; }
.detail-stat span { color: var(--soft); font-size: 7px; }
.detail-stat strong { margin-top: 6px; font-size: 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list span { padding: 6px 8px; border-radius: 7px; color: #5e5b55; background: #f0ece5; font-size: 8px; }
.classification-note { margin: 11px 0 0; color: var(--muted); font-size: 8px; line-height: 1.55; }
.detail-actions { display: flex; gap: 8px; margin-top: 21px; }
.detail-actions button, .detail-actions a { flex: 1; min-height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); text-decoration: none; cursor: pointer; font-size: 9px; font-weight: 800; }
.detail-actions .primary-action { color: white; border-color: var(--accent); background: var(--accent); }
.detail-actions .is-disabled { pointer-events: none; opacity: .45; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 50; transform: translate(-50%, 18px); opacity: 0; padding: 10px 14px; border-radius: 9px; background: #292a28; color: white; box-shadow: 0 12px 35px rgba(0,0,0,.2); font-size: 9px; pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { grid-template-columns: repeat(3, 1fr); }
  .select-field.grow { grid-column: span 2; }
  .table-head, .product-row { grid-template-columns: 44px minmax(250px, 2fr) minmax(135px, 1fr) 110px 38px; }
  .table-head span:nth-child(4), .commerce-cell { display: none; }
}

@media (max-width: 850px) {
  .app-frame { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 25px 12px; align-items: center; }
  .brand { padding: 0; }
  .brand > span:last-child, .side-nav a:not(.active), .side-nav button, .sidebar-card, .credit { display: none; }
  .side-nav { margin-top: 35px; }
  .side-nav .active { width: 46px; height: 46px; justify-content: center; padding: 0; }
  .side-nav .active::before { left: -13px; }
  .side-nav .active span { font-size: 19px; }
  .side-nav .active { font-size: 0; }
  .main-content { padding: 0 22px 42px; }
  .channel-grid { grid-template-columns: 1fr; }
  .channel-card { min-height: 120px; }
  .table-head { display: none; }
  .product-row { grid-template-columns: 39px minmax(0, 1fr) 95px 36px; gap: 9px; }
  .category-cell { display: none; }
  .score-cell { justify-content: center; }
  .score-cell small { display: none; }
}

@media (max-width: 620px) {
  .app-frame { display: block; }
  .sidebar { position: static; width: 100%; height: 62px; padding: 0 16px; flex-direction: row; justify-content: space-between; }
  .brand-mark { width: 33px; height: 33px; }
  .brand > span:last-child { display: block; }
  .side-nav { margin: 0; }
  .side-nav .active { display: none; }
  .main-content { padding: 0 13px 35px; }
  .topbar { min-height: auto; padding: 20px 2px 17px; display: block; }
  .topbar h1 { font-size: 23px; }
  .topbar-actions { margin-top: 15px; }
  .global-search { width: 100%; }
  .source-banner { align-items: flex-start; }
  .source-copy p { line-height: 1.5; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 113px; padding: 15px; }
  .metric-card p { left: 15px; bottom: 13px; }
  .filter-panel { padding: 13px; }
  .view-tabs { width: 100%; }
  .view-tabs button { flex: 1; min-width: 0; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .select-field.grow { grid-column: span 2; }
  .filter-foot { align-items: flex-start; }
  .filter-foot p { max-width: 60%; line-height: 1.5; }
  .section-head { align-items: flex-start; }
  .section-head > p { display: none; }
  .product-row { min-height: 98px; padding: 12px 10px; grid-template-columns: 28px minmax(0, 1fr) 34px; }
  .rank { font-size: 15px; }
  .product-thumb { width: 54px; height: 54px; }
  .score-cell { display: none; }
  .product-copy strong { font-size: 9px; }
  .detail-hero { grid-template-columns: 95px minmax(0, 1fr); padding: 22px; }
  .detail-thumb { height: 95px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}
