/* HALO ZERO 운영 대시보드 — 가독성 개편 (2026-09-15, 밝은 테마) */
:root {
  --bg: #f3f4f6;          /* 페이지 바탕 */
  --panel: #ffffff;       /* 카드·패널 */
  --panel-2: #f5f6f8;     /* 입력칸·호버 */
  --line: #e2e4e9;        /* 구분선 */
  --line-2: #eceef1;
  --text: #15171c;        /* 본문 */
  --text-2: #3d424c;      /* 보조 본문 */
  --muted: #646b78;       /* 설명·라벨 (흰 바탕 4.9:1) */
  --accent: #2a78d6;
  --accent-tint: #eaf2fc;
  --green: #1b7a3a;       /* 증가·흑자 텍스트 */
  --red: #c0342e;         /* 감소·적자 텍스트 */
  --amber: #946300;
  --gray: #6b7280;
  /* 차트 */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-dim: #b7d3f6;
  --neg: #d03b3b;
  --grid: #e8eaee;
  --axis: #c6cad2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  font-family: "Pretendard", "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button, input, select { font-family: inherit; }

.app { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: 224px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; }
.logo { font-size: 19px; letter-spacing: 0.5px; font-weight: 700; display: block; color: var(--text); }
.logo b { color: var(--accent); font-weight: 800; }
.subtitle { color: var(--muted); font-size: 12px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; cursor: pointer; font-weight: 500;
}
.nav-item .ico { width: 18px; text-align: center; color: var(--muted); }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-tint); color: var(--accent); font-weight: 700; }
.nav-item.active .ico { color: var(--accent); }
.nav-item.disabled { opacity: 0.4; cursor: not-allowed; }
.nav-sep { padding: 16px 12px 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.side-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 12px; }

/* ---- Main ---- */
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 700; }
.status { font-size: 12px; color: var(--muted); }
.status.ok { color: var(--green); }
.status.err { color: var(--red); }
.view { padding: 24px 28px 48px; max-width: 1360px; }

/* ---- 필터 줄 (화면 맨 위, 아래 전체에 적용) ---- */
.filterbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; margin-bottom: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow);
}
.fb-item { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.fb-item select {
  min-width: 170px; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; font-weight: 500;
}
.fb-item select:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.fb-note { margin-left: auto; align-self: center; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel); color: var(--accent); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }

/* ---- KPIs ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.kpi .value { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; line-height: 1.25; }
.kpi .value.neg, .kpi.red .value { color: var(--red); }
.kpi .sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.45; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line); }
.kpi.accent::before { background: var(--accent); }
.kpi.green::before { background: #0ca30c; }
.kpi.red::before { background: var(--neg); }
.kpi.amber::before { background: #eda100; }

/* ---- Panel ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-2); gap: 12px 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.panel-body { padding: 16px 18px; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.controls select, .controls input {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 14px;
}
.controls input { min-width: 240px; }
.controls select:focus, .controls input:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; }
.grid-2 > .panel { margin-bottom: 18px; }
.link-btn { background: none; border: 1px solid var(--line); color: var(--text-2); border-radius: 8px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.link-btn:hover { border-color: var(--accent); color: var(--accent); }
.link-btn.on { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }

/* ---- 가로 막대 (분포·요일) ---- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-label { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.bar-track { background: var(--panel-2); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-count { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row.clickable { cursor: pointer; border-radius: 6px; padding: 3px 6px; margin: 0 -6px; }
.bar-row.clickable:hover { background: var(--panel-2); }
.bar-row.sel { background: var(--accent-tint); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 640px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: #fafbfc; z-index: 1;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; color: var(--text); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f9fc; }
.num { text-align: right; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; cursor: default; }
.table-foot { padding: 11px 18px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line-2); background: #fafbfc; }
td.pname { white-space: normal; min-width: 220px; max-width: 360px; }
td.pname .nm { font-weight: 600; color: var(--text); }
td .sub, .cell-sub { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
table.no-cost > thead > tr > th:nth-child(9), table.no-cost > tbody > tr.sales-prow > td:nth-child(9) { display: none; }
tr.sel-row td { background: var(--accent-tint); font-weight: 600; }
td.sel-col { background: var(--accent-tint); }
td.neg { color: var(--red); }
.cat-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
.badge.state-green { color: var(--green); border-color: #bfe3c9; background: #eef8f1; }
.badge.state-amber { color: var(--amber); border-color: #f0d9a0; background: #fdf6e6; }
.badge.state-red { color: var(--red); border-color: #f1c4c1; background: #fdf0ef; }
.badge.state-gray { color: var(--gray); border-color: var(--line); background: var(--panel-2); }
.action-chip { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; color: #10141a; font-weight: 600; white-space: nowrap; }

/* ---- Detail ---- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.back-btn { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; font-weight: 600; }
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
.detail-title { font-size: 19px; font-weight: 700; }
.detail-sub { color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--accent); }
.field { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.field:last-child { border-bottom: none; }
.field .k { color: var(--muted); white-space: nowrap; }
.field .v { text-align: right; font-variant-numeric: tabular-nums; word-break: break-all; }

/* ---- Topbar user ---- */
.topbar-right { display: flex; align-items: center; gap: 16px; }
.userbox { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 13px; color: var(--text); font-weight: 600; }
.user-role { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.user-role.admin { color: var(--accent); border-color: #bcd6f5; background: var(--accent-tint); }
.logout-btn { background: var(--panel); border: 1px solid var(--line); color: var(--text-2); border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.logout-btn:hover { border-color: var(--red); color: var(--red); }

/* ---- Login overlay ---- */
#login-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px; width: 340px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 8px 30px rgba(16, 24, 40, 0.08); }
.login-logo { font-size: 26px; letter-spacing: 0.5px; font-weight: 700; text-align: center; }
.login-logo b { color: var(--accent); font-weight: 800; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.login-card input { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 11px 13px; font-size: 14px; }
.login-card input:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.login-card button { background: var(--accent); border: none; color: #fff; border-radius: 9px; padding: 11px; font-size: 14px; font-weight: 700; cursor: pointer; margin-top: 4px; }
.login-card button:disabled { opacity: 0.6; cursor: default; }
.login-msg { min-height: 18px; color: var(--red); font-size: 12px; text-align: center; }

/* ---- Mobile menu ---- */
.menu-btn { display: none; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 40px; height: 36px; font-size: 18px; cursor: pointer; align-items: center; justify-content: center; }
.backdrop { display: none; }

/* ---- Write panel ---- */
.muted { color: var(--muted); font-size: 12.5px; }
.panel-head h2 .muted { font-size: 13px; font-weight: 500; margin-left: 4px; }
.write-grid { display: grid; grid-template-columns: 160px 1fr; gap: 10px 14px; align-items: center; max-width: 520px; }
.write-grid label { color: var(--muted); font-size: 13px; }
.write-grid .cur { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.write-grid input, .write-grid select { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 11px; font-size: 14px; }
.write-grid input:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.write-actions { display: flex; gap: 10px; margin-top: 14px; }
.commit-btn { background: var(--accent); border: none; color: #fff; border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer; }
.commit-btn:hover { filter: brightness(1.06); }
.commit-btn:disabled { opacity: 0.6; cursor: default; }
.write-result { margin-top: 14px; font-size: 13px; min-height: 18px; }
.write-result .wp-ok { color: var(--green); font-weight: 600; }

/* ---- 정렬 헤더 ---- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sort-asc, th.sort-desc { color: var(--accent); }
th.sort-asc::after { content: " ▲"; font-size: 9px; }
th.sort-desc::after { content: " ▼"; font-size: 9px; }

.pay-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); background: var(--panel-2); font-variant-numeric: tabular-nums; }
.pay-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); align-items: center; }

/* ---- 제품 월별 상세 (펼침) ---- */
.exp { display: inline-block; transition: transform 0.15s; color: var(--muted); font-size: 10px; margin-right: 4px; }
.exp.open { transform: rotate(90deg); }
.sales-mrow > td { border-bottom: 1px solid var(--line); background: #fafbfc; }
.submonthly { width: auto; min-width: 560px; border-collapse: collapse; font-size: 12.5px; margin: 6px 0 10px; }
.submonthly th { color: var(--muted); font-weight: 600; padding: 6px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; background: transparent; position: static; }
.submonthly td { padding: 6px 14px; border-bottom: 1px solid var(--line-2); color: var(--text); }
.submonthly .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- 차트 (SVG) ---- */
.chart { width: 100%; min-height: 240px; position: relative; }
svg.viz { display: block; overflow: visible; }
.viz-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.viz-tick { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.viz-xlab { fill: var(--muted); font-size: 12px; }
.viz-xlab.sel { fill: var(--text); font-weight: 700; }
.viz-val { fill: var(--text-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.viz-bar { fill: var(--series-1); transition: opacity 0.12s; }
.viz-bar.dim { fill: var(--series-dim); }
.viz-bar.neg { fill: var(--neg); }
.viz-bar.hot { opacity: 0.78; }
.viz-hit { fill: transparent; outline: none; }
.viz-hit:focus-visible { stroke: var(--accent); stroke-width: 1.5; }
.viz-tip {
  position: fixed; z-index: 500; pointer-events: none; display: none; min-width: 150px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  box-shadow: 0 6px 22px rgba(16, 24, 40, 0.14); font-size: 12.5px;
}
.viz-tip-title { color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.viz-tip-row { display: flex; align-items: baseline; gap: 8px; line-height: 1.6; white-space: nowrap; }
.viz-tip-row b { color: var(--text); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.viz-tip-row .viz-tip-label { color: var(--muted); }
.viz-tip-row.lead b { font-size: 15px; }
.viz-key { width: 10px; height: 3px; border-radius: 2px; display: inline-block; align-self: center; }

/* ---- 카테고리별 판매 추이 (작은 차트 묶음) ---- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.cat-card {
  text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 8px;
  cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 2px; transition: border-color 0.12s, box-shadow 0.12s;
}
.cat-card:hover { border-color: #b9c9e0; box-shadow: 0 2px 10px rgba(16, 24, 40, 0.06); }
.cat-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.cat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cat-name { font-weight: 700; font-size: 14px; color: var(--text); }
.cat-share { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cat-val { font-size: 20px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.cat-delta { font-size: 12.5px; color: var(--muted); min-height: 19px; }
.cat-delta .up, .cat-delta .down { white-space: nowrap; }
.cat-delta .up { color: var(--green); font-weight: 700; }
.cat-delta .down { color: var(--red); font-weight: 700; }
.cat-chart { width: 100%; height: 66px; margin-top: 4px; }
.cat-card.ghost { cursor: default; opacity: 0.8; }

/* 접이식 패널 */
details.panel > summary { list-style: none; cursor: pointer; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2::before { content: "▸ "; color: var(--muted); font-size: 12px; }
details.panel[open] > summary h2::before { content: "▾ "; }

/* ---- 로얄티 체크 ---- */
.ry-rate { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ry-rate input { width: 84px; min-width: 0; }
.ry-chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ry-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.ry-memo { width: 100%; min-width: 140px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 12.5px; }
.ry-memo:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
tr.ry-sub td { background: #f6f7f9; font-weight: 700; border-top: 1px solid var(--line); border-bottom: 2px solid var(--line); }
tr.ry-done td { opacity: 0.62; }
tr.ry-done td:nth-child(7) { opacity: 1; }

/* ---- 매장 손익 ---- */
.pos { color: var(--green); } .neg { color: var(--red); }
tr.sp-na td { opacity: .6; }
.sp-store { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fafbfc; }
.sp-store-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sp-store-head .sp-name { font-size: 14px; min-width: 110px; }
.sp-store-head select, .sp-store-head input { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 12.5px; }
.sp-store-head .sp-memo { flex: 1; min-width: 160px; }
.sp-lab { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.sp-sum { font-size: 12.5px; color: var(--muted); white-space: nowrap; } .sp-sum b { color: var(--text); }
.sp-add, .sp-add-rate, .sp-del { border: 1px solid var(--line); background: var(--panel); color: var(--text-2); border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 12.5px; }
.sp-add:hover, .sp-add-rate:hover { color: var(--accent); border-color: var(--accent); } .sp-del:hover { color: var(--red); border-color: var(--red); }
.sp-items { display: flex; flex-direction: column; gap: 4px; }
.sp-item { display: grid; grid-template-columns: 1.2fr 130px 1.6fr 30px; gap: 6px; align-items: center; }
.sp-item.sp-hd { font-size: 12px; color: var(--muted); padding: 0 2px; }
.sp-item input { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 12.5px; min-width: 0; }
.sp-item input.num { text-align: right; }

/* ---- 반응형 ---- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 820px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 200;
    transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: 2px 0 18px rgba(0, 0, 0, 0.18);
  }
  .sidebar.open { transform: translateX(0); }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15, 17, 21, 0.35); z-index: 150; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 11px 14px; gap: 10px; }
  .topbar h1 { font-size: 16px; flex: 1; }
  .status { display: none; }
  .user-name { display: none; }
  .view { padding: 14px 12px 40px; }
  .filterbar { padding: 12px; gap: 10px; }
  .fb-item { flex: 1 1 140px; }
  .fb-item select { min-width: 0; width: 100%; }
  .fb-item.fb-seg { flex-basis: 100%; }
  .fb-item.fb-seg .seg { width: 100%; }
  .fb-item.fb-seg .seg button { flex: 1; }
  .fb-note { margin-left: 0; }
  .panel-head { padding: 12px 14px; }
  .controls { width: 100%; }
  .controls input, .controls select { width: 100%; min-width: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 20px; }
  .bar-row { grid-template-columns: 70px 1fr auto; gap: 8px; font-size: 12.5px; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .cat-val { font-size: 17px; }
  .write-grid { grid-template-columns: 1fr; gap: 8px; }
  .detail-title { font-size: 16px; }
  .login-card { width: 86vw; max-width: 340px; }
}
@media (max-width: 640px) { .sp-item { grid-template-columns: 1fr 100px; } .sp-item.sp-hd { display: none; } }

/* 미판매(판매 기록 없는 시트 제품) 행 — 2026-09-16 */
tr.sales-prow.unsold td { color: var(--muted); }
tr.sales-prow.unsold td .nm { color: var(--muted); }
.chip-unsold { display:inline-block; font-size:11px; line-height:16px; padding:0 6px; border-radius:8px; background:#eef0f3; color:#646b78; vertical-align:1px; }

/* 판매통계 소비기한 배지 (2026-09-18) */
.expchip{display:inline-block;font-size:12px;white-space:nowrap;padding:1px 6px;border-radius:6px;background:rgba(127,127,127,.12)}
.expchip b{font-weight:600;margin-left:4px}
.expchip.exp-90{background:rgba(250,204,21,.22)}
.expchip.exp-60{background:rgba(249,115,22,.22)}
.expchip.exp-30{background:rgba(239,68,68,.25)}
.expchip.exp-over{background:rgba(239,68,68,.4);text-decoration:line-through}

/* ===== 방문·히트맵 (에스원 CCTV) ===== */
.heatgrid {
  display: grid;
  gap: 1px;
  background: #0f1115;
  border: 1px solid var(--line, #2a2f3a);
  border-radius: 8px;
  padding: 6px;
  max-width: 720px;
  margin: 4px auto 10px;
  aspect-ratio: 30 / 24;
}
.heatgrid i { display: block; border-radius: 1px; }

.visbars { display: flex; align-items: flex-end; gap: 4px; padding: 10px 4px 2px; }
.visbars .vb { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.visbars .vb-bar {
  width: 100%; height: 120px; display: flex; align-items: flex-end;
  background: rgba(255,255,255,.04); border-radius: 3px;
}
.visbars .vb-bar > span {
  display: block; width: 100%; border-radius: 3px;
  background: linear-gradient(180deg, #4aa3df, #2e6f9e); min-height: 1px;
}
.visbars .vb-lab { font-size: 10px; color: var(--muted, #8b93a7); }

/* 히트맵: 실제 어안 스냅샷 위에 격자 오버레이 */
.heatwrap {
  position: relative;
  max-width: 720px;
  margin: 4px auto 6px;
  aspect-ratio: 640 / 512;
  background: #000 center/100% 100% no-repeat;
  border: 1px solid var(--line, #2a2f3a);
  border-radius: 8px;
  overflow: hidden;
}
.heatwrap .heatgrid {
  position: absolute; inset: 0;
  margin: 0; max-width: none; aspect-ratio: auto;
  background: transparent; border: 0; border-radius: 0; padding: 0; gap: 0;
  /* 격자를 번지게 해 iRAS 의 부드러운 등고선처럼 보이게 한다 */
  filter: blur(7px);
}
.heatop { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 2px 0 8px; }
.heatop input[type=range] { width: 180px; }
.sa-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .sa-row { grid-template-columns: 1fr; } }
.paybar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 10px 0 8px; background: rgba(255,255,255,.05); }
.paybar > span { display: block; }
.paylegend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; padding-bottom: 6px; }
.paylegend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

/* 요일 × 시간대 방문 격자 */
.wdgrid { padding: 8px 4px 10px; }
.wdgrid .wdg-head, .wdgrid .wdg-row {
  display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; align-items: center;
}
.wdgrid .wdg-head { margin-bottom: 4px; }
.wdgrid .wdg-head b { font-size: 10px; font-weight: 400; color: var(--muted, #8b93a7); text-align: center; }
.wdgrid .wdg-row { margin-bottom: 2px; }
.wdgrid .wdg-row span { font-size: 11px; color: var(--muted, #8b93a7); }
.wdgrid .wdg-row i { display: block; height: 20px; border-radius: 2px; background: rgba(255,255,255,.04); }

/* 점주몰 등록 상태 배지 */
.mall-chip { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
.mall-chip.green { background: rgba(88,192,139,.18); color: #3f9e6e; }
.mall-chip.gray  { background: rgba(139,147,167,.18); color: #8b93a7; }
.mall-chip.red   { background: rgba(214,80,72,.16); color: #c44; }
