/* B store dashboard - light theme, system fonts only, no external assets. */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #ffffff;
  --ink: #16161a;
  --ink-2: #52514e;
  --muted: #7d7b75;
  --line: #e4e3dc;
  --line-2: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --coupang: #2a78d6;
  --st11: #eb6834;
  --good-bg: #e7f5e7;  --good-ink: #0b6b0b;
  --warn-bg: #fff3d6;  --warn-ink: #7a5300;
  --bad-bg: #fde8e8;   --bad-ink: #a42626;
  --info-bg: #eaf1fb;  --info-ink: #1c5cab;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
          "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 var(--font);
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 16px 0 6px; font-weight: 600; color: var(--ink-2); }
small { font-size: 0.7em; font-weight: 500; margin-left: 2px; color: var(--ink-2); }
.zh { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* header + nav */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.brand { font-weight: 700; color: var(--ink); font-size: 15px; }
.logout { margin: 0; }
.btn-link { background: none; border: 0; padding: 6px 0; color: var(--ink-2); font: inherit; cursor: pointer; }
.btn-link:hover { color: var(--ink); text-decoration: underline; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  white-space: nowrap; padding: 8px 10px 10px; color: var(--ink-2);
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

main { padding-top: 20px; padding-bottom: 24px; }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 32px; }
.page-head { margin-bottom: 16px; }
.sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.back { margin: 0 0 8px; }

/* cards + grid */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .card.flush > h2 { padding: 14px 16px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + section { margin-top: 16px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin-bottom: 16px; }
.tiles.wide .card { margin-bottom: 0; }
.tile { background: var(--page); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.tiles.wide .tile { background: var(--surface); }
.tile-label { font-size: 12px; color: var(--ink-2); }
.tile-value { font-size: 20px; font-weight: 650; line-height: 1.3; margin-top: 2px; white-space: nowrap; }
.grid2 > .card { container-type: inline-size; }
@container (max-width: 440px) {
  .tile { padding: 8px 10px; }
  .tile-value { font-size: 16px; }
}
.tile-sub { font-size: 12px; color: var(--muted); }

/* platform identity: a colored dot beside the text, never colored text */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--line-2); }
.dot.p-coupang { background: var(--coupang); }
.dot.p-11st { background: var(--st11); }

/* chart */
.chart { display: block; width: 100%; max-width: 520px; height: auto; }
.chart text { font-size: 10px; fill: var(--muted); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart text.empty { font-size: 12px; }
.chart .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .grid.base { stroke: var(--line-2); }
.chart .hit { fill: transparent; }
.chart .slot:hover .hit { fill: rgba(11, 11, 11, 0.04); }
.chart .bar { fill: var(--line-2); }
.chart.p-coupang .bar { fill: var(--coupang); }
.chart.p-11st .bar { fill: var(--st11); }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
details .table-wrap { max-height: 320px; overflow-y: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); min-width: 0; }
.lbl { white-space: nowrap; }
.filters label.grow { flex: 1 1 200px; }
.filters .actions { display: flex; gap: 8px; align-items: center; }
input, select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; min-height: 36px; max-width: 100%;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  font: inherit; font-weight: 600; background: var(--ink); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 14px; min-height: 36px; cursor: pointer;
}
.btn .zh { color: #d6d5cf; }
.btn:hover { background: #33333a; }
.btn-ghost { padding: 8px 10px; color: var(--ink-2); white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips a {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 5px 12px;
  color: var(--ink-2); font-size: 13px; white-space: nowrap;
}
.chips a b { color: var(--ink); font-weight: 650; margin-left: 2px; }
.chips a:hover { text-decoration: none; border-color: var(--ink-2); }
.chips a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips a.on .zh, .chips a.on b { color: #fff; }
.summary { margin: 0 0 10px; color: var(--ink-2); font-size: 13px; }

/* tables: scroll inside the card, never the page */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--ink-2); background: #fafaf8; white-space: nowrap; position: sticky; top: 0; }
tbody tr:hover td { background: #fbfbf9; }
tbody tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.name { min-width: 220px; max-width: 360px; }
td.msg { min-width: 160px; max-width: 360px; color: var(--ink-2); font-size: 12px; overflow-wrap: anywhere; }
td.zero { color: var(--bad-ink); font-weight: 600; }
table.compact th, table.compact td { padding: 5px 10px; }
.empty-row { text-align: center; color: var(--muted); padding: 28px 12px; }
tr.canceled td { color: var(--muted); }
tr.canceled td.r { text-decoration: line-through; }

/* products */
td.prod { display: flex; gap: 10px; align-items: flex-start; min-width: 260px; max-width: 420px; }
td.prod img, td.prod .noimg { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; background: var(--page); border: 1px solid var(--line); }
td.side { min-width: 150px; }
td.side .price { font-weight: 650; font-variant-numeric: tabular-nums; }
td.flags { min-width: 120px; }
td.flags .badge { margin: 0 4px 4px 0; }
.none { color: var(--muted); }
.ext { font-size: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 13px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv + .kv { border-top: 1px solid var(--line); padding-top: 10px; }

/* badges: status always has text (and icon), color is only a second cue */
.badge { display: inline-block; font-size: 12px; line-height: 1.4; padding: 1px 8px; border-radius: 999px; white-space: nowrap; font-weight: 500; }
.badge.good { background: var(--good-bg); color: var(--good-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.bad { background: var(--bad-bg); color: var(--bad-ink); }
.badge.info { background: var(--info-bg); color: var(--info-ink); }
.badge.t-cancel { background: #f0efec; color: var(--ink-2); }
.badge.t-return { background: var(--warn-bg); color: var(--warn-ink); }
.badge.t-exchange { background: var(--info-bg); color: var(--info-ink); }

/* login */
.login { max-width: 360px; margin: 40px auto; }
.login h1 { margin-bottom: 16px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.login .btn { margin-top: 4px; }
.alert { background: var(--bad-bg); color: var(--bad-ink); padding: 8px 12px; border-radius: 8px; font-size: 13px; margin: 0 0 12px; }

@media (max-width: 560px) {
  h1 { font-size: 18px; }
  .card { padding: 12px; }
  .tile { padding: 8px; }
  .tile-value { font-size: 15px; }
  .tile-label .zh { display: none; }
  .filters label { flex: 1 1 calc(50% - 6px); }
  .filters label.grow { flex-basis: 100%; }
  .filters .actions { flex-basis: 100%; }
  .filters .actions .btn { flex: 1; }
  th, td { padding: 7px 10px; }
  .tabs a { padding: 8px 8px 10px; }
  /* orders/claims: one small card per row instead of a wide table */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td {
    display: flex; gap: 12px; justify-content: space-between; align-items: baseline;
    border: 0; padding: 2px 12px; min-width: 0; max-width: none; text-align: right; white-space: normal;
  }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; white-space: nowrap; text-align: left; }
  table.stack td.name { display: block; order: -1; text-align: left; font-weight: 600; padding-top: 2px; padding-bottom: 4px; }
  table.stack td.name::before { display: none; }
  table.stack td:empty { display: none; }
  table.stack td.empty-row { display: block; text-align: center; }
  table.stack td.empty-row::before { display: none; }
  tbody tr:hover td { background: none; }
  /* products: product on top, the two platforms side by side, flags below */
  table.products thead { display: none; }
  table.products, table.products tbody { display: block; }
  table.products tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.products tbody tr:last-child { border-bottom: 0; }
  table.products td { border: 0; padding: 4px 12px; min-width: 0; max-width: none; }
  table.products td.prod, table.products td.flags, table.products td.empty-row { grid-column: 1 / -1; }
  table.products td.side::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; }
  table.products td.side .mono { overflow-wrap: anywhere; }
}
