:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #657385;
  --line: #dde3ea;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #c2410c;
  --soft: #eef8f6;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select {
  font: inherit;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box, .panel, .stat, .table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.login-box {
  width: min(420px, 100%);
  padding: 28px;
}

.login-box h1, .page-title h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

label {
  font-size: 14px;
  color: #344054;
}

input, select {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

button:hover { background: var(--primary-dark); }
button.secondary {
  background: #e8edf2;
  color: #243140;
}
button.secondary:hover { background: #d9e1e9; }

.error {
  color: var(--danger);
  min-height: 22px;
  font-size: 14px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 22px 16px;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  text-align: left;
  background: transparent;
  color: #cbd5e1;
}

.nav button.active, .nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.content {
  padding: 24px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title p {
  margin: 0;
  color: var(--muted);
}

.filters, .grid, .form-grid {
  display: grid;
  gap: 14px;
}

.filters {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
  margin-bottom: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px;
}

.stat .value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 8px;
}

.grid.two {
  grid-template-columns: 1fr 1fr;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel h2 {
  font-size: 18px;
  margin: 0 0 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 104px 1fr 118px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  color: #475467;
  font-size: 13px;
}

.form-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  margin-bottom: 16px;
}

.full {
  grid-column: 1 / -1;
}

.hint {
  background: var(--soft);
  border: 1px solid #bfe5df;
  color: #155e57;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: #eef2f7;
  color: #344054;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .nav {
    grid-template-columns: repeat(4, minmax(72px, 1fr));
  }
  .content {
    padding: 16px;
  }
  .filters, .stats, .grid.two, .form-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Interactive daily trend charts */
.trend-panel {
  min-height: 330px !important;
}

.trend-chart {
  min-width: 0;
}

.trend-chart-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.trend-chart-head h2 {
  margin: 0 0 4px !important;
}

.trend-chart-head .muted {
  font-size: 13px;
}

.trend-metric-tabs {
  background: rgba(17, 24, 39, 0.055);
  border-radius: 10px;
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
}

.trend-metric-tabs button {
  background: transparent;
  border-radius: 8px;
  color: #586271;
  font-size: 13px;
  min-height: 32px;
  padding: 6px 11px;
}

.trend-metric-tabs button:hover {
  background: rgba(255, 255, 255, 0.76);
  color: #1d1d1f;
}

.trend-metric-tabs button.active {
  background: #ffffff !important;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.10);
  color: #0071e3 !important;
}

.trend-chart-canvas {
  margin-top: 16px;
  min-height: 238px;
}

.trend-chart-meta {
  align-items: center;
  color: #7a8390;
  display: flex;
  font-size: 13px;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 4px;
}

.trend-chart-meta strong {
  color: #1d1d1f;
  font-size: 14px;
  white-space: nowrap;
}

.trend-svg-wrap {
  min-width: 0;
  position: relative;
}

.trend-svg {
  display: block;
  height: auto;
  overflow: visible;
  width: 100%;
}

.trend-grid-line {
  stroke: rgba(17, 24, 39, 0.09);
  stroke-width: 1;
}

.trend-axis-label {
  fill: #8a93a0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
}

.trend-date-label {
  font-size: 13px;
}

.trend-area {
  fill: rgba(0, 113, 227, 0.08);
  pointer-events: none;
}

.trend-line {
  fill: none;
  pointer-events: none;
  stroke: #0071e3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.trend-point {
  fill: #ffffff;
  pointer-events: none;
  stroke: #0071e3;
  stroke-width: 2;
}

.trend-hit {
  cursor: crosshair;
  fill: transparent;
}

.trend-guide {
  pointer-events: none;
  stroke: rgba(0, 113, 227, 0.28);
  stroke-width: 1;
}

.trend-hover-point {
  fill: #ffffff;
  pointer-events: none;
  stroke: #0071e3;
  stroke-width: 3;
}

.trend-tooltip {
  background: rgba(29, 29, 31, 0.92);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.2);
  color: #ffffff;
  display: grid;
  gap: 2px;
  min-width: 126px;
  padding: 9px 11px;
  pointer-events: none;
  position: absolute;
  transform: translateX(-50%);
  z-index: 3;
}

.trend-tooltip[hidden] {
  display: none;
}

.trend-tooltip span,
.trend-tooltip small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.trend-tooltip strong {
  font-size: 16px;
}

.trend-tooltip small {
  display: none;
}

.trend-empty {
  display: grid;
  min-height: 200px;
  place-items: center;
}

.drilldown.inline .trend-chart {
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.drilldown.inline .trend-chart-head h2 {
  font-size: 16px !important;
}

.drilldown.inline .trend-chart-canvas {
  min-height: 210px;
}

@media (max-width: 640px) {
  .trend-panel {
    min-height: 300px !important;
  }

  .trend-chart-head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .trend-metric-tabs {
    align-self: flex-start;
  }

  .trend-chart-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .trend-chart-canvas {
    min-height: 210px;
  }
}

.range-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.range-buttons, .sort-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.range-buttons {
  margin-bottom: 4px;
}

button.active,
button.secondary.active {
  background: var(--primary);
  color: #fff;
}

.filters.compact {
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) minmax(120px, 160px);
  margin-bottom: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.brand-board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.brand-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.brand-card {
  display: grid;
  gap: 8px;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 16px;
  min-height: 120px;
  box-shadow: none;
}

.brand-card:hover,
.brand-card.active {
  border-color: var(--primary);
  background: var(--soft);
}

.brand-card span {
  font-weight: 700;
  font-size: 16px;
}

.brand-card strong {
  font-size: 24px;
}

.brand-card small {
  color: var(--muted);
}

.detail-title {
  margin-top: 22px;
}

@media (max-width: 900px) {
  .filters.compact {
    grid-template-columns: 1fr;
  }
  .section-head {
    flex-direction: column;
  }
  .sort-controls {
    width: 100%;
  }
  .sort-controls button {
    flex: 1;
  }
}

/* Compact dashboard date controls */
.range-panel {
  padding: 12px 14px;
}

.range-buttons {
  margin-bottom: 8px;
}

.range-buttons button,
.sort-controls button {
  padding: 8px 12px;
  min-height: 36px;
}

.filters.compact {
  grid-template-columns: minmax(150px, 190px) minmax(150px, 190px) 96px;
  gap: 10px;
  align-items: end;
}

.filters.compact .field {
  margin-top: 0;
  gap: 6px;
}

.filters.compact label {
  font-size: 13px;
}

.filters.compact input {
  min-height: 38px;
  padding: 8px 10px;
}

.filters.compact button#refresh {
  min-height: 38px;
  padding: 8px 12px;
}

@media (max-width: 720px) {
  .range-panel {
    padding: 12px;
  }
  .filters.compact {
    grid-template-columns: 1fr 1fr;
  }
  .filters.compact button#refresh {
    grid-column: 1 / -1;
  }
}

/* Visual refresh: executive ecommerce dashboard */
:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --text: #16202d;
  --muted: #657488;
  --line: #d9e2ea;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --soft: #edf7f5;
  --amber: #b7791f;
  --blue-soft: #eef6ff;
}

body {
  background: linear-gradient(180deg, #f7fafc 0%, #edf2f5 46%, #e9eef2 100%);
}

.shell {
  grid-template-columns: 228px minmax(0, 1fr);
}

.sidebar {
  background: #101923;
  padding: 24px 16px;
  box-shadow: 10px 0 30px rgba(16, 25, 35, 0.08);
}

.brand-title {
  font-size: 22px;
  letter-spacing: 0;
  margin-bottom: 28px;
}

.nav {
  gap: 10px;
}

.nav button {
  border-radius: 8px;
  min-height: 42px;
  padding: 11px 14px;
  font-weight: 700;
}

.nav button.active {
  background: #243142;
  box-shadow: inset 3px 0 0 var(--primary);
}

.content {
  padding: 28px;
}

.topbar {
  margin-bottom: 18px;
}

.page-title h1 {
  font-size: 30px;
  line-height: 1.1;
}

.login-box, .panel, .stat, .table-wrap, .range-panel, .brand-board {
  border: 1px solid rgba(124, 139, 154, 0.22);
  box-shadow: 0 12px 30px rgba(31, 42, 55, 0.06);
}

.range-panel {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
}

.range-buttons {
  margin: 0;
  flex: 0 0 auto;
}

.range-buttons button,
.sort-controls button {
  border-radius: 8px;
  background: #e7eef5;
  color: #24364a;
  font-size: 14px;
}

.filters.compact {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(145px, 190px) minmax(145px, 190px) 88px;
  gap: 10px;
  justify-content: end;
}

.filters.compact input {
  background: #f8fafc;
}

.executive-stats {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
}

.stat::after {
  content: "";
  position: absolute;
  width: 84px;
  height: 84px;
  right: -32px;
  top: -34px;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.08);
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.stat .value {
  font-size: 30px;
  line-height: 1.1;
  margin-top: 10px;
}

.stat-foot {
  margin-top: 10px;
  color: #7b8796;
  font-size: 13px;
}

.brand-board {
  padding: 20px;
}

.section-head {
  align-items: center;
}

.section-head h2,
.panel h2 {
  color: #17202a;
  font-size: 19px;
}

.brand-cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.brand-card {
  position: relative;
  border-radius: 8px;
  border: 1px solid #dfe7ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
  padding: 16px;
  min-height: 138px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.brand-card:hover,
.brand-card.active {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #effaf8 100%);
}

.brand-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #e7f3f1;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  color: #192535;
}

.brand-card strong {
  font-size: 25px;
  color: #101923;
  margin-top: 4px;
}

.brand-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-metrics span {
  border-radius: 7px;
  background: #f0f4f7;
  color: #5d6b7a;
  padding: 6px 8px;
  font-size: 12px;
}

.brand-metrics b {
  color: #1b2838;
  margin-right: 3px;
}

.insight-grid .panel {
  min-height: 168px;
}

.bar-row {
  grid-template-columns: minmax(90px, 130px) 1fr 118px;
}

.bar {
  background: #e3e8ee;
}

.table-wrap {
  border-radius: 8px;
}

th {
  background: #f1f5f8;
}

@media (max-width: 1100px) {
  .range-panel {
    display: grid;
  }
  .filters.compact {
    justify-content: stretch;
  }
  .executive-stats {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    padding: 18px 16px;
  }
  .brand-title {
    margin-bottom: 14px;
  }
  .nav {
    grid-template-columns: repeat(4, minmax(72px, 1fr));
  }
  .content {
    padding: 20px 16px;
  }
  .topbar {
    flex-direction: row;
    align-items: center;
  }
  .grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .executive-stats {
    grid-template-columns: 1fr;
  }
  .filters.compact {
    grid-template-columns: 1fr;
  }
  .range-buttons button,
  .sort-controls button {
    flex: 1;
  }
}

/* Brand logos */
.brand-card-top {
  display: grid;
  grid-template-columns: 26px 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 54px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8ef;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.brand-logo.fallback {
  background: #e7f3f1;
  color: var(--primary-dark);
  font-weight: 900;
  font-size: 18px;
}

.brand-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-card {
  min-height: 150px;
}

@media (max-width: 640px) {
  .brand-card-top {
    grid-template-columns: 26px 48px minmax(0, 1fr);
  }
  .brand-logo {
    width: 48px;
    height: 36px;
  }
}

/* Logo centering refinement */
.brand-card-top {
  grid-template-columns: 26px 64px minmax(0, 1fr);
}

.brand-logo {
  width: 64px;
  height: 44px;
  background: #fff;
}

.brand-logo img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  padding: 0;
}

@media (max-width: 640px) {
  .brand-card-top {
    grid-template-columns: 26px 56px minmax(0, 1fr);
  }
  .brand-logo {
    width: 56px;
    height: 40px;
  }
}

/* Per-brand logo fit fixes */
.brand-logo-b3 img {
  width: 72%;
  height: 72%;
}

.brand-logo-b5 img {
  width: 62%;
  height: 88%;
}

.brand-logo-b6 img {
  width: 100%;
  height: 100%;
}

.brand-logo-b6 {
  background: #f4511e;
}

/* Fix square/vertical brand marks: VE, A22, VE服饰 */
.brand-logo-b3,
.brand-logo-b5,
.brand-logo-b6 {
  width: 58px;
  height: 58px;
  border-radius: 10px;
}

.brand-logo-b3 img {
  width: 92%;
  height: 92%;
  object-fit: contain;
}

.brand-logo-b5 img {
  width: 86%;
  height: 96%;
  object-fit: contain;
}

.brand-logo-b6 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-logo-b6 {
  border-color: #f4511e;
}

.brand-card:has(.brand-logo-b3) .brand-card-top,
.brand-card:has(.brand-logo-b5) .brand-card-top,
.brand-card:has(.brand-logo-b6) .brand-card-top {
  grid-template-columns: 26px 66px minmax(0, 1fr);
  min-height: 58px;
}

.brand-card:has(.brand-logo-b3),
.brand-card:has(.brand-logo-b5),
.brand-card:has(.brand-logo-b6) {
  min-height: 162px;
}

/* Hard center logo images inside the square mark boxes */
.brand-logo {
  position: relative;
}

.brand-logo img {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  max-width: 88%;
  max-height: 88%;
  display: block;
}

.brand-logo-b3 img {
  max-width: 82%;
  max-height: 82%;
}

.brand-logo-b5 img {
  max-width: 72%;
  max-height: 90%;
}

.brand-logo-b6 img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}

/* A22 is a narrow vertical logo; enlarge its visual footprint in cards */
.brand-logo-b5 img {
  max-height: 96%;
  max-width: 86%;
  transform: translate(-50%, -50%) scaleX(1.28);
}

.brand-logo-b3 img {
  max-height: 92%;
  max-width: 90%;
}

/* Sortable detail table columns */
.table-sort {
  appearance: none;
  border: 0;
  background: transparent;
  color: #24364a;
  padding: 0;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-sort:hover {
  color: var(--primary-dark);
  background: transparent;
}

.table-sort::after {
  content: "↕";
  font-size: 12px;
  color: #8a98a8;
}

.table-sort.active[data-dir="desc"]::after {
  content: "↓";
  color: var(--primary);
}

.table-sort.active[data-dir="asc"]::after {
  content: "↑";
  color: var(--primary);
}

.detail-table th:nth-child(5),
.detail-table th:nth-child(6),
.detail-table td:nth-child(5),
.detail-table td:nth-child(6) {
  text-align: right;
}

/* Compact brand overview so detail data is visible sooner */
.brand-board {
  padding: 14px;
}

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

.brand-board .section-head h2 {
  font-size: 18px;
  margin-bottom: 2px;
}

.brand-board .section-head .muted {
  font-size: 13px;
}

.brand-cards {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px;
}

.brand-card {
  min-height: 112px;
  padding: 12px;
  gap: 7px;
}

.brand-card:has(.brand-logo-b3),
.brand-card:has(.brand-logo-b5),
.brand-card:has(.brand-logo-b6) {
  min-height: 118px;
}

.brand-card-top {
  grid-template-columns: 24px 52px minmax(0, 1fr);
  gap: 8px;
}

.brand-card:has(.brand-logo-b3) .brand-card-top,
.brand-card:has(.brand-logo-b5) .brand-card-top,
.brand-card:has(.brand-logo-b6) .brand-card-top {
  grid-template-columns: 24px 54px minmax(0, 1fr);
  min-height: 46px;
}

.rank {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 12px;
}

.brand-logo {
  width: 52px;
  height: 34px;
  border-radius: 7px;
}

.brand-logo-b3,
.brand-logo-b5,
.brand-logo-b6 {
  width: 48px;
  height: 48px;
}

.brand-name {
  font-size: 15px;
}

.brand-card strong {
  font-size: 22px;
}

.brand-metrics span {
  padding: 5px 7px;
  font-size: 12px;
}

.sort-controls button {
  min-height: 34px;
  padding: 7px 11px;
}

@media (max-width: 640px) {
  .brand-board {
    padding: 12px;
  }
  .brand-board .section-head {
    gap: 8px;
    margin-bottom: 8px;
  }
  .brand-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .brand-card,
  .brand-card:has(.brand-logo-b3),
  .brand-card:has(.brand-logo-b5),
  .brand-card:has(.brand-logo-b6) {
    min-height: 104px;
    padding: 10px;
  }
  .brand-card-top,
  .brand-card:has(.brand-logo-b3) .brand-card-top,
  .brand-card:has(.brand-logo-b5) .brand-card-top,
  .brand-card:has(.brand-logo-b6) .brand-card-top {
    grid-template-columns: 22px 42px minmax(0, 1fr);
    gap: 6px;
    min-height: 38px;
  }
  .rank {
    width: 22px;
    height: 22px;
  }
  .brand-logo,
  .brand-logo-b3,
  .brand-logo-b5,
  .brand-logo-b6 {
    width: 42px;
    height: 36px;
  }
  .brand-name {
    font-size: 14px;
  }
  .brand-card strong {
    font-size: 20px;
  }
  .brand-metrics {
    gap: 5px;
  }
  .brand-metrics span {
    padding: 4px 6px;
  }
}

/* Batch daily entry */
.batch-entry-panel {
  padding: 16px;
}

.batch-controls {
  grid-template-columns: 180px minmax(180px, 1fr) minmax(160px, 220px);
  align-items: end;
  margin-bottom: 10px;
}

.batch-controls .field {
  margin-top: 0;
}

.batch-table-wrap {
  box-shadow: none;
  margin-top: 8px;
}

.batch-entry-table {
  min-width: 520px;
}

.batch-entry-table th:first-child,
.batch-entry-table td:first-child {
  width: 42%;
}

.batch-entry-table input {
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #fbfcfd;
}

.batch-entry-table td {
  padding: 8px 12px;
}

.batch-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.batch-actions button {
  min-height: 38px;
}

@media (max-width: 760px) {
  .batch-controls {
    grid-template-columns: 1fr;
  }
  .batch-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Entry save/delete feedback */
.entry-feedback {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  font-weight: 700;
}

.entry-feedback.success {
  color: #0b5f45;
  background: #e7f8ef;
  border: 1px solid #b8e8cb;
}

.entry-feedback.warning {
  color: #8a5a00;
  background: #fff7df;
  border: 1px solid #f1d58c;
}

.entry-feedback.error {
  color: #9f1f17;
  background: #fff0ef;
  border: 1px solid #f2b8b5;
}

.row-delete {
  padding: 7px 10px;
  min-height: 34px;
  color: #9f1f17;
}

.row-delete:disabled {
  color: #9aa7b6;
  cursor: not-allowed;
  opacity: 0.55;
}

.batch-entry-table th:last-child,
.batch-entry-table td:last-child {
  width: 88px;
  text-align: center;
}

.product-cell {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  min-width: 0;
}

.product-thumb,
.product-preview-img {
  align-items: center;
  background: #eef5f5;
  border: 1px solid #d7e2ea;
  border-radius: 8px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  width: 42px;
}

.product-thumb img,
.product-preview-img img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.product-thumb.fallback,
.product-preview-img.fallback {
  color: #0f7f77;
  font-weight: 800;
}

.product-thumb.mini {
  border-radius: 6px;
  height: 28px;
  width: 28px;
}

.product-thumb.table-img {
  height: 48px;
  width: 48px;
}

.bar-label {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.bar-label span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-manager .product-preview {
  align-items: end;
  display: flex;
  min-height: 74px;
}

.product-preview-img {
  height: 64px;
  width: 64px;
}

.product-toolbar {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px;
}

@media (max-width: 760px) {
  .product-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}


/* Dashboard drilldowns */
.bar-row.clickable {
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 6px;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.bar-row.clickable:hover,
.bar-row.clickable.active {
  background: #edf7f5;
  box-shadow: inset 3px 0 0 var(--primary);
}

.drilldown {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.drill-title {
  color: #314157;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.drill-row {
  align-items: center;
  border-radius: 6px;
  display: grid;
  gap: 10px;
  grid-template-columns: 32px minmax(120px, 1fr) 120px;
  min-height: 38px;
  padding: 6px 8px;
}

.drill-row:nth-child(odd) {
  background: #f7fafc;
}

.drill-name {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-width: 0;
}

.drill-name b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank.small {
  height: 24px;
  min-width: 24px;
  padding: 0;
}

@media (max-width: 720px) {
  .drill-row {
    grid-template-columns: 28px minmax(88px, 1fr) 98px;
    gap: 6px;
    padding: 6px 4px;
  }
}

.drilldown.inline {
  margin: 6px 0 10px;
  padding: 10px 8px 8px;
  background: #fbfdfe;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
}

.drill-row strong {
  text-align: right;
}


/* Compare badges */
.compare-badge {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  margin-top: 8px;
  max-width: 100%;
  width: fit-content;
}

.compare-badge em {
  color: #7b8796;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.compare-badge b {
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 5px 7px;
}

.compare-badge.up b {
  background: #fff1f0;
  color: #d92d20;
}

.compare-badge.down b {
  background: #ecfdf3;
  color: #039855;
}

.compare-badge.flat b {
  background: #eef3f7;
  color: #667085;
}

.brand-card > .compare-badge {
  margin-top: -2px;
}

.brand-card > .compare-badge em {
  font-size: 11px;
}

.brand-card > .compare-badge b {
  font-size: 11px;
  padding: 4px 6px;
}

@media (max-width: 640px) {
  .compare-badge {
    gap: 4px;
  }
  .compare-badge em,
  .compare-badge b {
    font-size: 11px;
  }
}


/* Platform logos */
.platform-logo {
  align-items: center;
  background: #fff;
  border: 1px solid #dbe5ee;
  border-radius: 7px;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  overflow: hidden;
  width: 30px;
  flex: 0 0 auto;
}

.platform-logo img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.platform-logo.fallback {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.platform-cell {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-width: 0;
}

.bar-value {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  white-space: nowrap;
}

.bar-value .compare-badge {
  margin-top: 0;
}

.bar-value .compare-badge em {
  display: none;
}

.bar-value .compare-badge b {
  font-size: 11px;
  padding: 4px 6px;
}


/* Version label */
.brand-title {
  display: grid;
  gap: 4px;
}

.brand-title small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}


/* Apple minimal V1.2 visual refresh */
:root {
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.82);
  --text: #111827;
  --muted: #6e7480;
  --line: rgba(17, 24, 39, 0.10);
  --primary: #0071e3;
  --primary-dark: #005bb8;
  --soft: rgba(0, 113, 227, 0.08);
  --success: #34c759;
  --danger: #ff3b30;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  background: #f5f5f7;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.shell {
  background: #f5f5f7;
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, 0.76) !important;
  border-right: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 12px 0 40px rgba(15, 23, 42, 0.04) !important;
  color: #1d1d1f !important;
  padding: 26px 16px !important;
}

.brand-title {
  color: #1d1d1f;
  font-size: 23px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  margin-bottom: 28px !important;
}

.brand-title small {
  color: #8b929c !important;
  font-size: 11px !important;
  font-weight: 700;
}

.nav {
  gap: 8px;
}

.nav button {
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 14px !important;
  color: #5f6672 !important;
  font-size: 15px;
  font-weight: 700;
  min-height: 44px;
  padding: 0 14px !important;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.nav button:hover {
  background: rgba(0, 113, 227, 0.06) !important;
  color: #1d1d1f !important;
}

.nav button.active {
  background: #ffffff !important;
  border-color: rgba(17, 24, 39, 0.08) !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  color: #0071e3 !important;
  transform: translateX(2px);
}

.nav button.active::before {
  background: #0071e3 !important;
}

.content {
  background: #f5f5f7;
  padding: 28px 30px 40px !important;
}

.topbar {
  align-items: center;
  margin-bottom: 22px;
}

.page-title h1 {
  color: #1d1d1f;
  font-size: 32px !important;
  font-weight: 800;
  letter-spacing: 0;
}

.page-title p,
.muted {
  color: #747b86 !important;
}

.login-box,
.panel,
.stat,
.table-wrap,
.range-panel,
.brand-board {
  background: rgba(255, 255, 255, 0.82) !important;
  border: 1px solid rgba(17, 24, 39, 0.08) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-card) !important;
}

.range-panel {
  align-items: center !important;
  padding: 14px !important;
}

.range-buttons {
  background: rgba(17, 24, 39, 0.05);
  border-radius: 14px;
  gap: 4px !important;
  padding: 4px;
}

.range-buttons .secondary,
.sort-controls .secondary,
.secondary {
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  color: #596171 !important;
  font-weight: 750;
}

.range-buttons .secondary.active,
.sort-controls .secondary.active,
button.active.secondary {
  background: #ffffff !important;
  border-color: rgba(17, 24, 39, 0.08) !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  color: #0071e3 !important;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button:not(.secondary):not(.nav button):not(.brand-card):not(.table-sort),
.login-box button[type="submit"] {
  background: #0071e3 !important;
  border: 0 !important;
  border-radius: 13px !important;
  box-shadow: 0 10px 24px rgba(0, 113, 227, 0.18);
  color: #ffffff !important;
  font-weight: 750;
}

button:not(.secondary):not(.nav button):not(.brand-card):not(.table-sort):hover,
.login-box button[type="submit"]:hover {
  background: #0064c8 !important;
}

input,
select,
textarea {
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(17, 24, 39, 0.13) !important;
  border-radius: 13px !important;
  color: #1d1d1f;
  min-height: 42px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 113, 227, 0.65) !important;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12) !important;
  outline: none;
}

.stats {
  gap: 14px !important;
}

.stat {
  min-height: 126px;
  padding: 20px 22px !important;
}

.stat::after {
  background: rgba(0, 113, 227, 0.06) !important;
  height: 96px !important;
  width: 96px !important;
}

.stat-label,
.stat .muted {
  color: #77808c !important;
  font-size: 13px !important;
  font-weight: 650;
}

.stat .value {
  color: #111827;
  font-size: 31px !important;
  font-weight: 850 !important;
  letter-spacing: 0;
}

.stat-foot {
  color: #8a929d !important;
}

.compare-badge em {
  color: #8a929d !important;
}

.compare-badge b {
  border-radius: 999px !important;
}

.compare-badge.up b {
  background: rgba(255, 59, 48, 0.10) !important;
  color: #ff3b30 !important;
}

.compare-badge.down b {
  background: rgba(52, 199, 89, 0.12) !important;
  color: #159947 !important;
}

.brand-board {
  padding: 20px !important;
}

.section-head h2,
.panel h2 {
  color: #1d1d1f !important;
  font-size: 20px !important;
  font-weight: 850;
}

.brand-cards {
  gap: 12px !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
}

.brand-card {
  background: rgba(255, 255, 255, 0.78) !important;
  border: 1px solid rgba(17, 24, 39, 0.09) !important;
  border-radius: 18px !important;
  box-shadow: none !important;
  min-height: 126px !important;
  padding: 14px !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.brand-card:hover,
.brand-card.active {
  background: #ffffff !important;
  border-color: rgba(0, 113, 227, 0.48) !important;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08) !important;
  transform: translateY(-2px) !important;
}

.brand-card strong {
  color: #111827 !important;
  font-size: 24px !important;
  font-weight: 850;
}

.brand-metrics span {
  background: rgba(17, 24, 39, 0.045) !important;
  border-radius: 999px !important;
  color: #69717f !important;
}

.rank {
  background: rgba(0, 113, 227, 0.10) !important;
  color: #0071e3 !important;
}

.brand-logo,
.product-thumb,
.platform-logo {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(17, 24, 39, 0.09) !important;
  border-radius: 11px !important;
}

.panel {
  padding: 20px !important;
}

.bar-row {
  border-radius: 12px !important;
  gap: 12px !important;
  min-height: 36px;
}

.bar-row.clickable {
  padding: 6px 8px !important;
}

.bar-row.clickable:hover,
.bar-row.clickable.active {
  background: rgba(0, 113, 227, 0.07) !important;
  box-shadow: inset 3px 0 0 #0071e3 !important;
}

.bar {
  background: rgba(17, 24, 39, 0.09) !important;
  border-radius: 999px !important;
  height: 9px !important;
}

.bar span {
  background: #0071e3 !important;
  border-radius: 999px !important;
}

.drilldown.inline {
  background: rgba(255, 255, 255, 0.82) !important;
  border-color: rgba(0, 113, 227, 0.14) !important;
  border-radius: 16px !important;
  margin: 8px 0 12px !important;
}

.drill-row {
  border-radius: 12px !important;
}

.drill-metrics {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  min-width: 0;
}

.drill-visitors {
  color: #6e7781;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.drill-row:nth-child(odd) {
  background: rgba(17, 24, 39, 0.035) !important;
}

table {
  border-collapse: separate !important;
  border-spacing: 0;
}

th {
  background: rgba(17, 24, 39, 0.045) !important;
  color: #4b5563 !important;
  font-size: 13px;
  font-weight: 800;
}

td {
  border-color: rgba(17, 24, 39, 0.075) !important;
}

tr:hover td {
  background: rgba(0, 113, 227, 0.035);
}

.login {
  background: #f5f5f7 !important;
}

.login-box {
  max-width: 430px;
  padding: 30px !important;
}

.login-box h1 {
  color: #1d1d1f;
  font-size: 28px;
  font-weight: 850;
}

.hint,
.entry-feedback {
  border-radius: 16px !important;
}

@media (max-width: 900px) {
  .content {
    padding: 20px 16px 32px !important;
  }
  .sidebar {
    background: rgba(255, 255, 255, 0.9) !important;
  }
  .nav button.active {
    transform: none;
  }
}
