:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --soft: #f8fafc;
  --text: #121722;
  --muted: #647084;
  --faint: #9aa6b7;
  --line: #dce4ee;
  --line-soft: #edf2f7;
  --green: #0f8b78;
  --green-soft: #e0f4ef;
  --cyan: #1389b2;
  --cyan-soft: #e2f3f8;
  --blue: #3468d8;
  --blue-soft: #e9effc;
  --rose: #d34d6a;
  --rose-soft: #fde8ee;
  --orange: #c77214;
  --orange-soft: #fff1dc;
  --violet: #7557d8;
  --violet-soft: #f0ebff;
  --shadow: 0 18px 42px rgba(19, 34, 54, 0.08);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #fbfcff 0, var(--bg) 320px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 650;
}

h2 {
  font-size: 17px;
  font-weight: 650;
}

h3 {
  font-size: 14px;
  font-weight: 650;
}

.muted,
label,
.brand span,
.metric-label,
th {
  color: var(--muted);
}

.tiny {
  color: var(--faint);
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  gap: 4px;
  padding: 0 8px 10px;
}

.brand strong {
  font-size: 18px;
  font-weight: 650;
}

.brand-logo {
  display: block;
  width: 154px;
  max-width: 100%;
  height: auto;
}

.side-nav {
  display: grid;
  gap: 6px;
  align-content: start;
}

.side-nav .tab {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.side-nav .tab.active {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 650;
}

.side-nav small {
  color: var(--faint);
  font-size: 12px;
}

.side-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.side-card strong {
  color: var(--text);
}

.main-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: 14px;
  padding: 18px 26px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.88);
  backdrop-filter: blur(18px);
}

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

.top-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
}

.workspace {
  min-width: 0;
  display: grid;
  gap: 16px;
  padding: 20px 26px 46px;
}

.toolbar {
  display: grid;
  grid-template-columns: 150px 150px 150px 150px minmax(190px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
}

input,
select {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
}

input[type="file"] {
  height: auto;
  padding: 9px;
}

.date-field,
.date-field input {
  cursor: pointer;
}

.primary,
.ghost,
.link-button {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
}

.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 650;
}

.ghost:hover,
.link-button:hover {
  background: var(--soft);
}

.combo {
  position: relative;
  min-width: 0;
}

.combo input[type="search"] {
  width: 100%;
  padding-right: 34px;
}

.combo-clear {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.combo-clear:hover {
  background: var(--soft);
  color: var(--text);
}

.combo-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.combo.open .combo-list {
  display: block;
}

.combo-option {
  width: 100%;
  min-height: 44px;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.combo-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-option small,
.combo-empty {
  color: var(--muted);
  font-size: 12px;
}

.combo-option:hover,
.combo-option.active {
  background: rgba(15, 139, 120, 0.08);
}

.combo-empty {
  padding: 14px 10px;
}

.warzone-multi {
  position: relative;
  min-width: 0;
}

.warzone-multi-trigger {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

.warzone-multi-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warzone-multi-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--muted);
}

.warzone-multi-menu {
  position: absolute;
  z-index: 35;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.warzone-multi.open .warzone-multi-menu {
  display: grid;
  gap: 2px;
}

.warzone-multi-option {
  width: 100%;
  min-height: 32px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.warzone-multi-option svg {
  width: 15px;
  height: 15px;
  visibility: hidden;
  color: #fff;
}

.warzone-multi-option.active {
  color: #fff;
  background: var(--green);
}

.warzone-multi-option.active svg {
  visibility: visible;
}

.warzone-multi-option:not(.active):hover {
  background: var(--soft);
}

.status-compact {
  position: relative;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px 0 10px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  box-shadow: 0 8px 22px rgba(19, 34, 54, 0.05);
  font-size: 11px;
  white-space: nowrap;
}

.status-compact > span {
  color: var(--muted);
}

.status-compact > strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.status-tip-trigger {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}

.status-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: min(420px, calc(100vw - 32px));
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line-soft);
  box-shadow: var(--shadow);
  white-space: normal;
}

.status-compact:hover .status-popover,
.status-compact:focus-within .status-popover {
  display: grid;
}

.status-popover div {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  background: var(--surface);
}

.status-popover .wide {
  grid-column: 1 / -1;
}

.status-popover span {
  color: var(--muted);
  font-size: 11px;
}

.status-popover strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.pill,
.badge,
.focus-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill {
  gap: 6px;
  border: 1px solid var(--line);
  padding: 0 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.pill.primary {
  border-color: rgba(15, 139, 120, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

.tab-panel {
  display: none;
  gap: 16px;
}

.tab-panel.active {
  display: grid;
}

.panel,
.metric-card,
.metric-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  min-width: 0;
  position: relative;
  display: grid;
  gap: 14px;
  padding: 15px;
}

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

.section-head.stacked {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.section-head > div:not(.switches):not(.focus-filters) {
  display: grid;
  gap: 4px;
}

.metric-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.metric-group {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 13px;
  box-shadow: 0 10px 28px rgba(19, 34, 54, 0.045);
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 10px;
}

.group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
}

.group-title strong {
  font-weight: 650;
}

.metric-card {
  min-height: 98px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-color: var(--line-soft);
  box-shadow: 0 6px 20px rgba(19, 34, 54, 0.04);
}

.metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.metric-label {
  min-width: 0;
  padding-top: 6px;
  line-height: 1.25;
}

.metric-value {
  font-size: 24px;
  font-weight: 720;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric-foot {
  color: var(--muted);
  font-size: 12px;
}

.metric-foot.has-subvalue {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.metric-subvalue {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.badge {
  padding: 0 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}

.metric-card .badge {
  min-width: 58px;
  min-height: 34px;
  justify-content: center;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 720;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.badge.good,
.metric-card .badge.good {
  background: var(--green-soft);
  color: var(--green);
}

.badge.bad,
.metric-card .badge.bad {
  background: var(--rose-soft);
  color: var(--rose);
}

.badge.warn,
.metric-card .badge.warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.violet {
  background: var(--violet-soft);
  color: var(--violet);
}

.store-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 16px;
}

.diagnosis-hero {
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(15, 139, 120, 0.08), rgba(52, 104, 216, 0.06)),
    var(--surface);
}

.store-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.store-title {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.store-title strong {
  font-size: 22px;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.score-block {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.score-ring {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 54%, transparent 55%),
    conic-gradient(var(--green) 0 var(--score), var(--line-soft) 0);
  color: var(--text);
  font-size: 22px;
  font-weight: 720;
}

.diagnosis-copy {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(15, 139, 120, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.diagnosis-copy strong {
  line-height: 1.45;
}

.action-list {
  display: grid;
  gap: 8px;
}

.action-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}

.action-item > span:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.action-item small {
  color: var(--muted);
  line-height: 1.45;
}

.num-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 720;
}

.health-grid,
.matrix-list,
.rule-list {
  display: grid;
  gap: 10px;
}

.health-row,
.matrix-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 52px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.health-row strong,
.matrix-row strong {
  color: var(--text);
  font-size: 13px;
}

.matrix-row {
  grid-template-columns: 80px minmax(0, 1fr) 72px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--soft);
}

.diagnostic-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 10px;
}

.benchmark-card {
  min-height: 136px;
}

.compare-list {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.compare-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.compact-note {
  min-width: 174px;
}

.compact-note span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.compact-note i {
  width: 16px;
  height: 3px;
  border-radius: 999px;
}

.reason-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mini-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.rule {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
}

.rule-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cause-card .badge {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switches,
.focus-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.section-head > .switches,
.section-head > .focus-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
}

.switches button,
.focus-chip {
  flex: 0 0 auto;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.switches button.active,
.focus-chip.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.chart-box {
  position: relative;
  min-height: 330px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfdff, #fff);
  overflow: hidden;
}

.chart {
  display: block;
  width: 100%;
  height: 330px;
  overflow: visible;
}

.chart text {
  fill: var(--muted);
  font-size: 12px;
}

.gridline {
  stroke: var(--line);
  stroke-width: 1;
}

.trend-path {
  fill: none;
  stroke: var(--green);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-area {
  fill: rgba(15, 139, 120, 0.11);
}

.hover-line {
  stroke: #98a2b3;
  stroke-dasharray: 4 4;
}

.chart-hit-area {
  cursor: crosshair;
}

.chart-note {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 6px;
  min-width: 188px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.chart-tooltip {
  position: absolute;
  z-index: 20;
  display: none;
  min-width: 156px;
  max-width: min(240px, calc(100% - 20px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 12px;
}

.chart-tooltip.show {
  display: grid;
  gap: 7px;
}

.chart-tooltip span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  white-space: nowrap;
}

.chart-tooltip i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 16px;
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  white-space: nowrap;
  vertical-align: top;
}

th {
  background: var(--soft);
  font-weight: 650;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

tbody tr {
  background: var(--surface);
}

tbody tr:hover {
  background: #fbfdff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  min-width: 130px;
}

.tag-list.left {
  justify-content: flex-start;
  min-width: 0;
}

.advice {
  max-width: 260px;
  min-width: 190px;
  color: var(--muted);
  line-height: 1.45;
  white-space: normal;
  text-align: left;
}

.link-button {
  min-height: 30px;
  padding: 0 10px;
}

.product-mix {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.mix-donut {
  display: grid;
  place-items: center;
}

.donut {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--a), var(--blue) 0 var(--b), var(--orange) 0 var(--c), var(--line-soft) 0);
}

.donut::after {
  content: attr(data-label);
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-weight: 720;
  text-align: center;
  white-space: pre-line;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.bar i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.bar i.good {
  background: var(--green);
}

.bar i.warn {
  background: var(--orange);
}

.bar i.bad {
  background: var(--rose);
}

.bar i.blue {
  background: var(--blue);
}

.alert {
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.alert.success {
  border-color: rgba(15, 139, 120, 0.28);
  color: var(--green);
}

.alert.dismissible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alert-dismiss {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: currentColor;
}

.alert-dismiss svg {
  width: 16px;
  height: 16px;
}

.alert.error {
  border-color: rgba(211, 77, 106, 0.28);
  color: var(--rose);
}

.upload-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.wechat-directory-panel {
  margin-top: 18px;
}

.wechat-directory-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0;
}

.wechat-directory-search {
  display: grid;
  grid-template-columns: auto minmax(240px, 360px);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.wechat-directory-search input {
  min-width: 0;
}

.wechat-directory-table table {
  min-width: 1160px;
}

.wechat-directory-table th,
.wechat-directory-table td {
  vertical-align: middle;
}

.wechat-department {
  display: block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.wechat-account-action {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.wechat-account-action select {
  min-width: 0;
  flex: 1;
}

.wechat-account-action .small {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .wechat-directory-toolbar {
    display: grid;
    align-items: stretch;
  }

  .wechat-directory-search {
    grid-template-columns: 1fr;
  }
}

.global-date-field[hidden] {
  display: none;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  background: var(--soft);
  color: var(--text);
}

.period-analysis-panel {
  gap: 18px;
}

.period-filter-panel {
  gap: 16px;
  padding: 18px;
}

.period-date-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.period-date-group {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
  align-items: end;
  padding: 11px;
  border: 1px solid rgba(52, 104, 216, 0.2);
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.period-date-group.compare {
  border-color: rgba(15, 139, 120, 0.2);
  background: var(--green-soft);
}

.period-date-group label {
  color: var(--muted);
  font-size: 11px;
}

.period-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 720;
}

.period-date-group.compare .period-mark {
  background: var(--green);
}

.period-run {
  min-width: 104px;
}

.period-coverage,
.period-range-label,
.period-table-foot {
  color: var(--muted);
  font-size: 12px;
}

.period-coverage {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-left: 3px solid var(--blue);
  background: var(--soft);
}

.period-coverage.good {
  border-left-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.period-coverage.error {
  border-left-color: var(--rose);
  background: var(--rose-soft);
  color: var(--rose);
}

.period-section-head {
  padding: 0 2px;
}

.period-range-label {
  min-width: 0;
  text-align: right;
}

.period-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.period-kpi {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(19, 34, 54, 0.045);
}

.period-kpi-top,
.period-kpi-meta,
.period-table-foot,
.period-drawer-head,
.period-drawer-actions,
.drawer-section-head,
.period-action-box header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.period-kpi-top > span,
.period-kpi-meta {
  color: var(--muted);
  font-size: 12px;
}

.period-kpi .metric-value {
  font-size: 23px;
}

.period-delta {
  font-size: 13px;
  font-weight: 720;
}

.period-delta.good {
  color: var(--green);
}

.period-delta.bad {
  color: var(--rose);
}

.period-delta.warn {
  color: var(--orange);
}

.period-table-panel {
  gap: 14px;
}

.period-table-wrap {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.period-table-wrap table {
  width: max-content;
  min-width: 1880px;
}

.period-table-wrap th,
.period-table-wrap td {
  padding: 10px 9px;
}

.period-table-wrap thead tr:first-child th {
  color: var(--text);
  text-align: center;
  background: #f2f6fb;
}

.period-table-wrap .group-performance {
  background: #edf7f4;
}

.period-table-wrap .group-traffic {
  background: #eef5fb;
}

.period-table-wrap .group-conversion {
  background: #f7effb;
}

.period-table-wrap .group-consume {
  background: #fff5e9;
}

.period-table-wrap .group-private {
  background: #eaf4fb;
}

.period-table-wrap .store-column {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 210px;
  max-width: 270px;
  text-align: left;
  background: var(--surface);
}

.period-table-wrap thead .store-column {
  z-index: 4;
  background: var(--soft);
}

.period-table-wrap .store-column strong,
.period-table-wrap .store-column small {
  display: block;
}

.period-table-wrap .store-column strong {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-table-wrap .store-column small {
  margin-top: 3px;
  color: var(--faint);
}

.period-table-wrap .detail-column {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 76px;
  text-align: center;
  background: var(--surface);
}

.period-table-wrap thead .detail-column {
  z-index: 4;
  background: var(--soft);
}

.period-table-wrap tbody tr:hover .store-column,
.period-table-wrap tbody tr:hover .detail-column {
  background: #fbfdff;
}

.period-table-wrap .period-number {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.period-table-wrap .period-change.good {
  color: var(--green);
  font-weight: 650;
}

.period-table-wrap .period-change.bad {
  color: var(--rose);
  font-weight: 650;
}

.period-table-wrap .period-change.warn {
  color: var(--orange);
  font-weight: 650;
}

.period-cause {
  min-width: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.period-cause.good {
  color: var(--green);
  background: var(--green-soft);
}

.period-cause.bad {
  color: var(--rose);
  background: var(--rose-soft);
}

.period-table-foot {
  flex-wrap: wrap;
  padding: 0 2px;
}

.period-drawer-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: none;
  background: rgba(18, 23, 34, 0.24);
}

.period-drawer-backdrop.open {
  display: block;
}

.period-drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  width: min(720px, 96vw);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -16px 0 38px rgba(19, 34, 54, 0.13);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.period-drawer.open {
  transform: translateX(0);
}

.period-drawer-head {
  align-items: flex-start;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.period-drawer-head h2 {
  max-width: 500px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.period-drawer-head p {
  margin-top: 5px;
  font-size: 12px;
}

.period-drawer-actions {
  align-items: flex-start;
}

.period-score {
  min-width: 52px;
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.period-score strong {
  color: var(--green);
  font-size: 25px;
  font-weight: 720;
}

.period-drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--soft);
}

.period-drawer-tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.period-drawer-tabs button.active {
  background: var(--surface);
  color: var(--green);
  font-weight: 650;
  box-shadow: 0 2px 6px rgba(19, 34, 54, 0.06);
}

.period-drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 34px;
}

.period-drawer-pane {
  display: none;
  gap: 16px;
}

.period-drawer-pane.active {
  display: grid;
}

.period-drawer-summary {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid rgba(15, 139, 120, 0.18);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
}

.period-drawer-summary.bad {
  border-color: rgba(211, 77, 106, 0.24);
  border-left-color: var(--rose);
  background: var(--rose-soft);
}

.period-drawer-summary strong {
  font-size: 15px;
}

.period-drawer-summary p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.drawer-section-head {
  align-items: baseline;
  margin-top: 3px;
}

.drawer-section-head span {
  color: var(--faint);
  font-size: 11px;
  text-align: right;
}

.period-metric-compare {
  display: grid;
  grid-template-columns: minmax(128px, 1.5fr) repeat(3, minmax(86px, 0.8fr));
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 12px;
}

.period-metric-compare > div {
  min-width: 0;
  padding: 10px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.period-metric-compare > div:nth-child(4n + 1) {
  text-align: left;
}

.period-metric-compare > div:nth-child(-n + 4) {
  color: var(--muted);
  background: var(--soft);
  font-weight: 650;
}

.period-metric-compare > div:nth-child(4n) {
  border-right: 0;
}

.period-metric-compare > div:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.period-evidence-list {
  display: grid;
  gap: 8px;
}

.period-evidence {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.period-evidence i {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--orange);
}

.period-evidence strong,
.period-evidence span {
  display: block;
}

.period-evidence strong {
  font-size: 13px;
}

.period-evidence span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.period-action-box {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(199, 114, 20, 0.24);
  border-radius: var(--radius);
  background: var(--orange-soft);
}

.period-action-box header {
  color: var(--orange);
  font-size: 13px;
}

.period-action-box p {
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.period-product-table {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.period-product-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) repeat(3, minmax(100px, 0.8fr));
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}

.period-product-row:last-child {
  border-bottom: 0;
}

.period-product-row.header {
  color: var(--muted);
  background: var(--soft);
  font-size: 11px;
  font-weight: 650;
}

.period-product-row > :not(:first-child) {
  text-align: right;
}

.period-product-row strong,
.period-product-row small {
  display: block;
}

.period-product-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-product-row small {
  margin-top: 3px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-product-value {
  display: grid;
  gap: 3px;
}

.period-product-value b {
  font-variant-numeric: tabular-nums;
}

.period-product-value .good {
  color: var(--green);
}

.period-product-value .bad {
  color: var(--rose);
}

.period-product-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--orange);
  background: var(--orange-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.period-customer-mix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.period-customer-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.period-customer-card > header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.period-customer-card > header strong {
  color: var(--text);
}

.period-customer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.period-customer-row b {
  color: var(--text);
  text-align: right;
}

.empty {
  color: var(--muted);
  padding: 26px 8px;
  text-align: center;
}

.mobile-card-list {
  display: none;
}

.mobile-rank-card {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.mobile-rank-card:last-child {
  border-bottom: 0;
}

.mobile-rank-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mobile-rank-title strong {
  font-weight: 650;
}

.mobile-rank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.mobile-rank-metric {
  display: grid;
  gap: 3px;
}

.mobile-rank-metric span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-rank-metric strong {
  font-weight: 650;
}

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

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

@media (max-width: 1240px) {
  .toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .diagnostic-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-date-grid {
    grid-template-columns: 1fr 1fr;
  }

  .period-run {
    grid-column: 1 / -1;
  }

  .period-kpis {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    display: flex;
    overflow-x: auto;
  }

  .side-nav .tab {
    flex: 0 0 auto;
    width: auto;
  }

  .side-card {
    display: none;
  }

  .grid-three,
  .product-mix,
  .reason-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-drawer {
    width: min(680px, 100vw);
  }
}

@media (max-width: 640px) {
  .topbar,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topline,
  .section-head,
  .store-title-row {
    display: grid;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .status-popover {
    left: 0;
    right: auto;
    grid-template-columns: 1fr;
  }

  .toolbar,
  .grid-three,
  .product-mix,
  .diagnostic-metrics,
  .reason-grid,
  .period-date-grid,
  .period-kpis,
  .period-customer-mix {
    grid-template-columns: 1fr;
  }

  .period-date-group {
    grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  }

  .period-run {
    grid-column: auto;
  }

  .period-range-label {
    text-align: left;
  }

  .period-drawer-head,
  .period-drawer-actions {
    align-items: flex-start;
  }

  .period-drawer-head {
    gap: 12px;
    padding: 16px 14px 12px;
  }

  .period-drawer-tabs {
    padding: 8px 14px;
  }

  .period-drawer-body {
    padding: 14px 14px 28px;
  }

  .period-metric-compare {
    grid-template-columns: minmax(104px, 1.3fr) repeat(3, minmax(70px, 0.8fr));
  }

  .period-metric-compare > div {
    padding: 9px 6px;
    font-size: 11px;
  }

  .period-product-row {
    grid-template-columns: minmax(122px, 1.2fr) repeat(3, minmax(74px, 0.8fr));
    gap: 5px;
    padding: 9px 7px;
    font-size: 11px;
  }

  .score-block {
    justify-items: start;
  }

  .action-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .action-item .badge {
    grid-column: 2;
    justify-self: start;
  }

  .metric-list {
    grid-template-columns: 1fr;
  }

  .chart-note {
    position: static;
    margin: 10px;
  }

  .has-mobile-cards table {
    display: none;
  }

  .has-mobile-cards .mobile-card-list {
    display: grid;
    padding: 0 12px;
  }

}

/* Member analysis is intentionally scoped so existing dashboard tabs keep their approved layout. */
.member-scope-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  border: 1px solid #c3e5da;
  border-radius: 999px;
  padding: 0 10px;
  color: #066a5b;
  background: #eefaf5;
  font-size: 10px;
  white-space: nowrap;
}

.member-scope-note svg {
  width: 13px;
  height: 13px;
}

#globalToolbar.member-toolbar {
  grid-template-columns: 118px minmax(220px, 1fr) 134px 146px 112px;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe5e0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
}

#areaFilterField[hidden],
#memberLevelFilterField[hidden],
#memberActivityFilterField[hidden] {
  display: none !important;
}

#globalToolbar.member-toolbar label {
  gap: 4px;
  color: #91a09a;
  font-size: 9px;
  font-weight: 700;
}

#globalToolbar.member-toolbar input,
#globalToolbar.member-toolbar select,
#globalToolbar.member-toolbar .warzone-multi-trigger,
#globalToolbar.member-toolbar .primary {
  height: 32px;
  border-radius: 6px;
  font-size: 11px;
}

#globalToolbar.member-toolbar .primary {
  align-self: end;
  padding: 0 13px;
}

#member.member-panel {
  gap: 25px;
}

#member .member-section {
  min-width: 0;
}

#member .member-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}

#member .member-section-head > div {
  display: grid;
  gap: 4px;
}

#member .member-section-head h2 {
  font-size: 16px;
  font-weight: 760;
}

#member .member-section-head p,
#member .member-section-note {
  color: #65716e;
  font-size: 11px;
}

#member .member-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

#member .member-kpi {
  min-width: 0;
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid #dbe5e0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
}

#member .member-kpi-top,
#member .member-kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#member .member-kpi-top {
  color: #65716e;
  font-size: 10px;
}

#member .member-kpi-top svg {
  width: 16px;
  height: 16px;
  color: #91a09a;
}

#member .member-kpi > strong {
  color: #17221f;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

#member .member-kpi-meta {
  color: #65716e;
  font-size: 10px;
}

#member .member-kpi-meta b {
  color: #17221f;
  font-weight: 720;
}

#member .member-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

#member .member-progress i,
#member .member-activity-row > div i {
  display: block;
  width: var(--member-progress);
  height: 100%;
  border-radius: inherit;
  background: var(--member-progress-color);
}

#member .member-structure-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr) minmax(290px, 0.8fr);
  gap: 12px;
}

#member .member-panel-card {
  gap: 0;
  padding: 0;
  border-color: #dbe5e0;
  box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
}

#member .member-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
}

#member .member-panel-head h3 {
  color: #17221f;
  font-size: 14px;
  font-weight: 760;
}

#member .member-panel-head span {
  color: #65716e;
  font-size: 10px;
}

#member .member-levels {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 4px 14px 15px;
}

#member .member-level-donut {
  width: 144px;
  height: 144px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--member-donut);
}

#member .member-level-donut > div {
  width: 96px;
  height: 96px;
  display: grid;
  place-content: center;
  gap: 3px;
  border-radius: 50%;
  background: #fff;
  text-align: center;
}

#member .member-level-donut b {
  color: #17221f;
  font-size: 20px;
  line-height: 1;
}

#member .member-level-donut span {
  color: #65716e;
  font-size: 9px;
}

#member .member-level-legend {
  display: grid;
  gap: 8px;
}

#member .member-level-legend > div {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  color: #65716e;
  font-size: 10px;
}

#member .member-level-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--member-color);
}

#member .member-level-legend b,
#member .member-activity-row b {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: #17221f;
  font-size: 11px;
  white-space: nowrap;
}

#member .member-level-legend em,
#member .member-activity-row em {
  color: #65716e;
  font-size: 9px;
  font-style: normal;
  font-weight: 650;
}

#member .member-activity-list {
  display: grid;
  gap: 11px;
  padding: 3px 14px 16px;
}

#member .member-activity-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 82px;
  gap: 8px;
  align-items: center;
  color: #65716e;
  font-size: 10px;
}

#member .member-activity-row > div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

#member .member-activity-row b {
  justify-content: flex-end;
}

#member .member-private-list {
  display: grid;
  gap: 9px;
  padding: 3px 14px 15px;
}

#member .member-private-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #edf2ef;
}

#member .member-private-list > div:last-child {
  border-bottom: 0;
}

#member .member-private-list span,
#member .member-private-list small {
  display: block;
}

#member .member-private-list span {
  color: #17221f;
  font-size: 11px;
}

#member .member-private-list small {
  margin-top: 3px;
  color: #65716e;
  font-size: 9px;
}

#member .member-private-list b {
  font-size: 14px;
}

#member .member-private-list b.good { color: #087c6a; }
#member .member-private-list b.warn { color: #a96b22; }
#member .member-private-list b.bad { color: #d05260; }

#member .member-attention-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#member .member-attention {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 12px;
  border: 1px solid #dbe5e0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
}

#member .member-attention-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--member-attention-color);
  background: var(--member-attention-background);
}

#member .member-attention-icon svg {
  width: 17px;
  height: 17px;
}

#member .member-attention strong {
  color: #17221f;
  font-size: 12px;
}

#member .member-attention p {
  margin-top: 4px;
  color: #65716e;
  font-size: 10px;
  line-height: 1.45;
}

#member .member-attention p b {
  margin-right: 3px;
  color: #17221f;
}

#member .member-table-panel {
  overflow: hidden;
  border: 1px solid #dbe5e0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
}

#member .member-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2ef;
}

#member .member-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#member .member-chips button {
  height: 26px;
  border: 1px solid #dbe5e0;
  border-radius: 999px;
  padding: 0 9px;
  color: #65716e;
  background: #fff;
  font-size: 10px;
}

#member .member-chips button.active {
  border-color: #a9d9cc;
  color: #066a5b;
  background: #e2f3ed;
  font-weight: 730;
}

#member .member-table-toolbar > span,
#member .member-table-foot {
  color: #65716e;
  font-size: 10px;
}

#member .member-store-table,
#member .member-store-scroll {
  overflow-x: auto;
}

#member .member-store-table table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

#member .member-store-table th,
#member .member-store-table td {
  padding: 11px 10px;
  border-right: 1px solid #e5ece9;
  border-bottom: 1px solid #edf2ef;
  background: #fff;
  text-align: right;
  white-space: nowrap;
}

#member .member-store-table th {
  color: #91a09a;
  background: #fafcfb;
  font-size: 10px;
  font-weight: 720;
}

#member .member-store-table th:first-child,
#member .member-store-table td:first-child,
#member .member-store-table th:nth-child(2),
#member .member-store-table td:nth-child(2),
#member .member-store-table th:last-child,
#member .member-store-table td:last-child {
  text-align: left;
}

#member .member-store-table th:last-child,
#member .member-store-table td:last-child {
  border-right: 0;
}

#member .member-store-table tbody tr:hover td { background: #fbfdfc; }
#member .member-store-table tbody tr:last-child td { border-bottom: 0; }

#member .member-store-table td strong,
#member .member-store-table td small { display: block; }

#member .member-store-table td strong { color: #17221f; }

#member .member-store-table td small {
  margin-top: 3px;
  color: #65716e;
  font-size: 9px;
}

#member .member-store-table .rate { color: #087c6a; font-weight: 760; }
#member .member-store-table .risk { color: #d05260; font-weight: 760; }

#member .member-tag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 0 7px;
  color: #a96b22;
  background: #fff3df;
  font-size: 9px;
  white-space: nowrap;
}

#member .member-detail-button {
  min-height: 25px;
  border: 1px solid #dbe5e0;
  border-radius: 6px;
  padding: 0 8px;
  color: #066a5b;
  background: #fff;
  font-size: 10px;
}

#member .member-table-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
}

.member-drawer-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: none;
  background: rgba(20, 35, 30, 0.26);
}

.member-drawer-backdrop.open { display: block; }

.member-drawer {
  position: fixed;
  z-index: 61;
  top: 0;
  right: 0;
  width: min(690px, 56vw);
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid #dbe5e0;
  background: #fff;
  box-shadow: -16px 0 42px rgba(20, 35, 30, 0.16);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.member-drawer.open { transform: translateX(0); }

.member-drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 22px 24px 19px;
  color: #f5fffb;
  background: #066a5b;
}

.member-drawer-head > div > span {
  color: #cdece2;
  font-size: 10px;
}

.member-drawer-head h2 {
  margin-top: 7px;
  color: #f5fffb;
  font-size: 21px;
  line-height: 1.3;
}

.member-drawer-head p {
  margin-top: 7px;
  color: #cdece2;
  font-size: 11px;
}

.member-drawer-head .icon-button {
  color: #effff9;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.09);
}

.member-drawer-body {
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px 24px 32px;
}

.member-drawer-section h3 {
  color: #17221f;
  font-size: 14px;
}

.member-drawer-section > p {
  margin-top: 4px;
  color: #65716e;
  font-size: 10px;
}

.member-drawer-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.member-drawer-kpis > div {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #edf2ef;
  border-radius: 7px;
}

.member-drawer-kpis span {
  color: #65716e;
  font-size: 9px;
}

.member-drawer-kpis b {
  color: #17221f;
  font-size: 16px;
}

.member-drawer-matrix {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(118px, 0.75fr) minmax(118px, 0.75fr);
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #edf2ef;
  border-radius: 7px;
  font-size: 11px;
}

.member-drawer-matrix > div {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 13px;
  border-right: 1px solid #edf2ef;
  border-bottom: 1px solid #edf2ef;
}

.member-drawer-matrix > div:nth-child(3n + 1) { justify-content: flex-start; }

.member-drawer-matrix > div:nth-child(-n + 3) {
  color: #65716e;
  background: #fafcfb;
  font-size: 10px;
  font-weight: 720;
}

.member-drawer-matrix > div:nth-child(3n) { border-right: 0; }
.member-drawer-matrix > div:nth-last-child(-n + 3) { border-bottom: 0; }

.member-drawer-action-matrix {
  grid-template-columns: minmax(135px, 0.7fr) minmax(165px, 0.9fr) minmax(230px, 1.35fr);
}

.member-drawer-action-matrix > div { min-height: 52px; }

.member-drawer-action-matrix > div:nth-child(3n + 2) {
  justify-content: center;
  color: #17221f;
  font-weight: 720;
  white-space: nowrap;
}

.member-drawer-action-matrix > div:nth-child(3n) {
  justify-content: flex-start;
  line-height: 1.45;
  white-space: normal;
}

@media (max-width: 1240px) {
  #globalToolbar.member-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #member .member-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #member .member-structure-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #member .member-structure-grid > :last-child { grid-column: 1 / -1; }
  #member .member-attention-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  #member .member-kpis,
  #member .member-structure-grid,
  #member .member-attention-grid { grid-template-columns: 1fr; }
  #member .member-structure-grid > :last-child { grid-column: auto; }
  #member .member-levels { grid-template-columns: 1fr; justify-items: center; }
  #member .member-level-legend { width: 100%; }
  #member .member-section-head,
  #member .member-table-toolbar,
  #member .member-table-foot { align-items: flex-start; flex-direction: column; }
  .member-drawer { width: min(680px, 100vw); }
  .member-drawer-head,
  .member-drawer-body { padding-left: 14px; padding-right: 14px; }
  .member-drawer-action-matrix { grid-template-columns: 110px 150px minmax(190px, 1fr); }
}

/* Desktop workbench shell approved from the period-analysis prototype. */
@media (min-width: 921px) {
  body {
    background: #f4f7f5;
  }

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

  .sidebar {
    gap: 22px;
    padding: 20px 13px;
    border-right-color: #dbe5e0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
  }

  .brand {
    gap: 5px;
    padding: 4px 10px;
  }

  .brand-row,
  .nav-tab-label,
  .crumb,
  .top-actions {
    display: flex;
    align-items: center;
  }

  .brand-row {
    min-height: 46px;
  }

  .brand-logo {
    width: 148px;
  }

  .brand > span,
  .sidebar-user small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
  }

  .side-nav {
    gap: 4px;
  }

  .side-nav .nav-label {
    margin: 8px 10px 5px;
    color: var(--faint);
    font-size: 10px;
    font-weight: 700;
  }

  .side-nav .tab {
    min-height: 38px;
    justify-content: space-between;
    gap: 10px;
    border-radius: 7px;
    padding: 0 10px;
    font-size: 12px;
  }

  .nav-tab-label {
    min-width: 0;
    gap: 10px;
  }

  .nav-tab-label svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
  }

  .side-nav .tab.active {
    color: #066a5b;
    background: #e2f3ed;
    font-weight: 750;
  }

  .side-nav small {
    color: var(--faint);
    font-size: 10px;
  }

  .sidebar-user {
    gap: 5px;
    padding: 11px 10px;
    border-top-color: #edf2ef;
  }

  .sidebar-user strong {
    font-size: 11px;
  }

  .topbar {
    grid-template-columns: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 28px;
    border-bottom-color: #dbe5e0;
    background: rgba(244, 247, 245, 0.94);
    backdrop-filter: blur(14px);
  }

  .crumb {
    gap: 7px;
    color: var(--muted);
    font-size: 11px;
  }

  .crumb svg {
    width: 13px;
    height: 13px;
  }

  .crumb strong {
    color: var(--text);
  }

  .top-actions {
    justify-content: flex-end;
    gap: 8px;
  }

  .top-actions .ghost {
    min-height: 30px;
    border-radius: 7px;
    padding: 0 10px;
    font-size: 11px;
  }

  .status-compact {
    min-height: 30px;
    gap: 7px;
    border-color: #dbe5e0;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--surface);
    font-size: 10px;
  }

  .status-compact::before {
    width: 7px;
    height: 7px;
    margin: 0;
    border-radius: 50%;
    background: #20a27c;
    box-shadow: 0 0 0 4px #ddf3eb;
    content: "";
  }

  .status-compact > strong {
    font-size: 11px;
  }

  .status-tip-trigger {
    width: 16px;
    height: 16px;
    font-size: 10px;
  }

  .workspace {
    width: 100%;
    max-width: 1820px;
    gap: 25px;
    margin: 0 auto;
    padding: 25px 28px 46px;
  }

  .page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
  }

  .page-heading > div {
    display: grid;
    gap: 5px;
  }

  .page-heading h1 {
    font-size: 25px;
    font-weight: 780;
  }

  .page-heading .muted {
    font-size: 12px;
  }

#globalToolbar {
    grid-template-columns: 150px 150px 132px 132px minmax(190px, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid #dbe5e0;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
  }

  #globalToolbar label {
    gap: 4px;
    color: var(--faint);
    font-size: 9px;
    font-weight: 700;
  }

  #globalToolbar input,
  #globalToolbar select {
    height: 32px;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 11px;
  }

  #globalToolbar .primary {
    min-height: 32px;
    height: 32px;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 11px;
  }

  .panel,
  .metric-card,
  .metric-group {
    box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
  }
}

#globalToolbar.period-hidden {
  display: none !important;
}

/* Keep the active desktop filters available while reviewing long analysis pages. */
@media (min-width: 921px) {
  #globalToolbar:not(.period-hidden) {
    position: sticky;
    top: 70px;
    z-index: 9;
  }

  #period .period-filter-panel {
    position: sticky;
    top: 70px;
    z-index: 9;
  }
}

/* Dynamic period-table rendering must not become the browser's scroll anchor. */
#period.period-analysis-panel {
  overflow-anchor: none;
}

.heading-status.period-coverage {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  border: 1px solid #c3e5da;
  border-radius: 999px;
  padding: 0 10px;
  color: #066a5b;
  background: #eefaf5;
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}

.heading-status.period-coverage.error {
  border-color: #f4cbd4;
  color: var(--rose);
  background: var(--rose-soft);
}

.heading-status.period-coverage[hidden] {
  display: none;
}

#period .period-kpi-bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2ef;
}

#period .period-kpi-bar i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: #9aa6b7;
}

#period .period-kpi-bar i.good {
  background: var(--green);
}

#period .period-kpi-bar i.bad {
  background: var(--rose);
}

#period .period-kpi-bar i.warn {
  background: var(--orange);
}

#period .period-kpi-bar i.blue {
  background: var(--blue);
}

.period-drawer-head {
  background: #066a5b;
}

.period-drawer-head .tiny,
.period-score,
.period-score span {
  font-size: 10px;
}

.period-product-value small {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 9px;
  justify-content: end;
}

.period-product-value small em {
  color: var(--faint);
  font-style: normal;
}

.period-product-value small span {
  color: var(--muted);
  text-align: right;
}

.period-customer-mix {
  gap: 12px;
}

.period-customer-card {
  gap: 13px;
  padding: 14px;
  border-color: var(--line);
  border-radius: 8px;
}

.period-customer-card > header {
  font-size: 10px;
}

.period-customer-card > header strong {
  font-size: 13px;
}

.period-customer-sales {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.period-donut {
  position: relative;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 var(--new-share), var(--green) var(--new-share) 100%);
}

.period-donut::after {
  position: absolute;
  inset: 31px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.period-donut b,
.period-donut span {
  position: absolute;
  z-index: 1;
  left: 0;
  width: 100%;
  text-align: center;
}

.period-donut b {
  top: 43px;
  font-size: 20px;
}

.period-donut span {
  top: 70px;
  color: var(--muted);
  font-size: 9px;
}

.period-sales-list {
  display: grid;
  gap: 9px;
}

.period-sales-list div {
  display: flex;
  justify-content: space-between;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.period-sales-list b {
  color: var(--text);
  text-align: right;
}

.period-customer-arrivals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid var(--line-soft);
}

.period-customer-arrivals div {
  display: grid;
  gap: 4px;
}

.period-customer-arrivals span {
  color: var(--muted);
  font-size: 10px;
}

.period-customer-arrivals b {
  font-size: 11px;
}

.period-customer-compare {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.period-customer-compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 120px 110px;
  gap: 8px;
  align-items: center;
  min-height: 39px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.period-customer-compare-row:last-child {
  border-bottom: 0;
}

.period-customer-compare-row.header {
  min-height: 33px;
  color: var(--muted);
  background: var(--soft);
  font-size: 10px;
  font-weight: 720;
}

.period-customer-compare-row > :not(:first-child) {
  text-align: right;
}

@media (min-width: 921px) and (max-width: 1280px) {
  #globalToolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .heading-status.period-coverage {
    white-space: normal;
  }

  .period-customer-sales {
    grid-template-columns: 1fr;
  }

  .period-donut {
    justify-self: center;
  }

  .period-customer-compare-row {
    grid-template-columns: minmax(0, 1fr) 100px 100px 90px;
    gap: 5px;
    padding: 0 8px;
    font-size: 10px;
  }
}

/* Approved period-analysis layout. Keep these styles scoped to the period tab. */
#period.period-analysis-panel {
  gap: 25px;
}

#period .period-filter-panel {
  gap: 0;
  padding: 14px;
}

#period .period-date-grid {
  grid-template-columns: minmax(255px, 1.1fr) minmax(255px, 1.1fr) minmax(118px, 0.5fr) minmax(180px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
}

#period .period-date-group {
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  padding: 8px;
  border-radius: 8px;
}

#period .period-date-group label,
#period .period-scope-slot label {
  gap: 3px;
  font-size: 10px;
}

#period .period-date-group input,
#period .period-scope-slot input,
#period .period-scope-slot select {
  height: 32px;
  padding: 0 8px;
  font-size: 11px;
}

#period .period-scope-slot {
  min-width: 0;
}

#period .period-scope-slot .combo-list {
  z-index: 30;
}

#period .period-run {
  min-width: 92px;
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
  font-size: 11px;
}

.period-scope-hint {
  display: none;
}

#period .period-section-head {
  align-items: flex-end;
  gap: 16px;
  padding: 0 2px;
}

#period .period-section-head h2 {
  font-size: 16px;
  font-weight: 760;
}

/* The two title explanations intentionally use the prototype's distinct sizes. */
#period .period-section-head .muted {
  font-size: 11px;
  line-height: 1.5;
}

#period .period-section-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
}

#period .period-coverage {
  min-height: 0;
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-left-width: 1px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

#period .period-coverage.good {
  border-color: rgba(15, 139, 120, 0.2);
  background: var(--green-soft);
  color: var(--green);
}

#period .period-coverage.error {
  border-color: rgba(211, 77, 106, 0.24);
  background: var(--rose-soft);
  color: var(--rose);
}

#period .period-range-label {
  font-size: 11px;
}

#period .period-kpis {
  gap: 10px;
  margin-top: 10px;
}

#period .period-kpi {
  gap: 9px;
  padding: 13px;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(19, 34, 54, 0.045);
}

#period .period-kpi-top > span,
#period .period-kpi-meta {
  font-size: 10px;
}

#period .period-kpi .metric-value {
  font-size: 22px;
  line-height: 1;
}

#period .period-delta {
  font-size: 10px;
  font-weight: 760;
}

#period .period-table-panel {
  gap: 0;
  overflow: hidden;
  padding: 0;
  border-radius: 8px;
}

#period .period-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
}

#period .period-table-heading > div {
  display: grid;
  gap: 4px;
}

#period .period-table-heading h2 {
  font-size: 15px;
  font-weight: 760;
}

#period .period-table-heading .muted {
  font-size: 10px;
  line-height: 1.5;
}

#period .period-store-count,
#period .period-table-foot {
  color: var(--muted);
  font-size: 10px;
}

#period .period-table-panel > .focus-filters {
  min-height: 46px;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

#period .period-table-panel .focus-chip {
  min-height: 26px;
  padding: 0 9px;
  font-size: 10px;
}

#period .period-table-wrap {
  border: 0;
  border-radius: 0;
}

#period .period-table-wrap table {
  width: max-content;
  min-width: 3220px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10px;
}

#period .period-table-wrap th,
#period .period-table-wrap td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid #e5ece9;
  background: var(--surface);
}

#period .period-table-wrap th:last-child,
#period .period-table-wrap td:last-child {
  border-right: 0;
}

#period .period-table-wrap thead tr:first-child th {
  height: 34px;
  border-bottom-color: var(--line);
  color: var(--text);
  text-align: center;
  background: var(--soft);
}

#period .period-table-wrap thead tr:nth-child(2) th {
  height: 36px;
  background: #fafcff;
}

#period .period-table-wrap thead tr:first-child th.group-performance {
  color: #1d6d61;
  background: #e5f5ef;
  border-top: 3px solid #67bda7;
}

#period .period-table-wrap thead tr:first-child th.group-traffic {
  color: #506d9d;
  background: #eaf2ff;
  border-top: 3px solid #86a8df;
}

#period .period-table-wrap thead tr:first-child th.group-conversion {
  color: #8b5c19;
  background: #fff2d9;
  border-top: 3px solid #dda955;
}

#period .period-table-wrap thead tr:first-child th.group-consume {
  color: #a24c47;
  background: #fdebea;
  border-top: 3px solid #dc8b88;
}

#period .period-table-wrap thead tr:first-child th.group-private {
  color: #6e5a97;
  background: #f1edff;
  border-top: 3px solid #a89ad0;
}

#period .period-table-wrap thead tr:first-child th.group-performance,
#period .period-table-wrap thead tr:first-child th.group-traffic,
#period .period-table-wrap thead tr:first-child th.group-conversion,
#period .period-table-wrap thead tr:first-child th.group-consume,
#period .period-table-wrap thead tr:first-child th.group-private {
  font-size: 11px;
  font-weight: 760;
}

/* Stronger dividers retain the analytical groups while horizontal scrolling. */
#period .period-table-wrap thead tr:nth-child(2) th:nth-child(4),
#period .period-table-wrap thead tr:nth-child(2) th:nth-child(13),
#period .period-table-wrap thead tr:nth-child(2) th:nth-child(22),
#period .period-table-wrap thead tr:nth-child(2) th:nth-child(28),
#period .period-table-wrap thead tr:nth-child(2) th:nth-child(34),
#period .period-table-wrap tbody td:nth-child(6),
#period .period-table-wrap tbody td:nth-child(15),
#period .period-table-wrap tbody td:nth-child(24),
#period .period-table-wrap tbody td:nth-child(30),
#period .period-table-wrap tbody td:nth-child(36) {
  border-right: 2px solid #ccd9d4;
}

#period .period-table-wrap tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 42px;
  min-width: 42px;
  text-align: left;
  background: var(--surface);
}

#period .period-table-wrap .store-column {
  left: 42px;
  z-index: 3;
  width: 228px;
  min-width: 228px;
  max-width: 228px;
  box-shadow: 8px 0 15px rgba(19, 34, 54, 0.035);
}

#period .period-table-wrap thead tr:first-child > th:first-child {
  position: sticky;
  left: 0;
  z-index: 6;
  width: 42px;
  min-width: 42px;
  text-align: left;
  background: var(--soft);
}

#period .period-table-wrap thead .store-column {
  left: 42px;
  z-index: 6;
  width: 228px;
  min-width: 228px;
  max-width: 228px;
  background: var(--soft);
}

#period .period-table-wrap .detail-column {
  z-index: 3;
  min-width: 70px;
  background: var(--surface);
  box-shadow: -8px 0 15px rgba(19, 34, 54, 0.04);
}

#period .period-table-wrap thead .detail-column {
  z-index: 6;
  min-width: 70px;
  background: var(--soft);
}

#period .period-table-wrap tbody tr:hover td:first-child,
#period .period-table-wrap tbody tr:hover .store-column,
#period .period-table-wrap tbody tr:hover .detail-column {
  background: #fbfdff;
}

#period .period-table-foot {
  padding: 10px 14px;
}

.period-drawer {
  width: min(760px, 60vw);
  border-left-color: var(--line);
  box-shadow: -16px 0 42px rgba(19, 34, 54, 0.16);
}

.period-drawer-head {
  gap: 18px;
  padding: 22px 24px 19px;
  border-bottom: 0;
  color: #f5fffb;
  background: #176b5e;
}

.period-drawer-head .tiny,
.period-drawer-head .muted,
.period-drawer-head p,
.period-score {
  color: #cdece2;
}

.period-drawer-head h2 {
  margin-top: 7px;
  color: #f5fffb;
  font-size: 21px;
  line-height: 1.3;
}

.period-drawer-head p {
  margin-top: 7px;
  font-size: 11px;
}

.period-score strong {
  color: #f5fffb;
  font-size: 34px;
  line-height: 1;
}

.period-drawer .icon-button {
  color: #effff9;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.09);
}

.period-drawer-tabs {
  gap: 0;
  padding: 0;
  background: var(--surface);
}

.period-drawer-tabs button {
  min-height: 48px;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  font-size: 12px;
  font-weight: 720;
}

.period-drawer-tabs button.active {
  border-bottom-color: var(--green);
  background: transparent;
  color: #176b5e;
  box-shadow: none;
}

.period-drawer-body {
  padding: 20px 24px 32px;
}

.period-drawer-pane {
  gap: 18px;
}

.period-drawer-summary {
  gap: 7px;
  padding: 12px;
  border-left-width: 3px;
}

.period-drawer-summary strong {
  font-size: 13px;
}

.period-drawer-summary p,
.period-evidence span,
.period-action-box p {
  font-size: 11px;
}

.drawer-section-head h3 {
  font-size: 15px;
}

.period-metric-compare {
  grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(80px, 0.7fr));
  border-radius: 8px;
  font-size: 11px;
}

.period-metric-compare > div {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
}

.period-metric-compare > div:nth-child(4n + 1) {
  justify-content: flex-start;
}

.period-metric-compare > div:nth-child(-n + 4) {
  font-size: 10px;
  font-weight: 720;
}

.period-product-row {
  grid-template-columns: minmax(190px, 1.35fr) minmax(170px, 1fr) minmax(170px, 1fr) minmax(110px, 0.7fr);
  gap: 12px;
  padding: 11px 13px;
  font-size: 11px;
}

.period-product-row.header {
  min-height: 36px;
  font-size: 10px;
}

.period-product-row strong,
.period-product-row small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.period-product-value {
  gap: 5px;
}

.period-product-value b {
  font-size: 14px;
}

.period-product-value small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

@media (max-width: 1440px) {
  #period .period-date-grid {
    grid-template-columns: minmax(250px, 1fr) minmax(250px, 1fr) 130px minmax(175px, 0.85fr) auto;
  }

  .period-drawer {
    width: min(720px, 64vw);
  }
}

@media (max-width: 1240px) {
  #period .period-date-grid {
    grid-template-columns: 1fr 1fr;
  }

  #period .period-run {
    grid-column: auto;
  }
}

@media (max-width: 920px) {
  .period-drawer {
    width: min(680px, 100vw);
  }
}

@media (max-width: 640px) {
  #period .period-date-grid,
  #period .period-kpis {
    grid-template-columns: 1fr;
  }

  #period .period-section-head {
    display: grid;
  }

  #period .period-section-meta {
    justify-items: start;
  }

  .period-drawer-head {
    padding: 16px 14px 12px;
  }

  .period-drawer-body {
    padding: 14px 14px 28px;
  }

  .period-product-row {
    grid-template-columns: minmax(122px, 1.2fr) repeat(3, minmax(74px, 0.8fr));
    gap: 5px;
    padding: 9px 7px;
  }
}

/* Approved product-analysis layout. Keep all visual changes scoped to this tab. */
#product.tab-panel {
  gap: 25px;
}

#product .product-mix-grid {
  gap: 12px;
}

#product .product-section {
  gap: 10px;
  padding: 14px;
}

#product .product-section .section-head {
  align-items: flex-start;
  margin: 0;
}

#product .product-section .section-head h2 {
  font-size: 14px;
  font-weight: 760;
}

#product .product-section .section-head .muted {
  font-size: 10px;
}

#product .product-mix {
  grid-template-columns: 125px minmax(0, 1fr);
  gap: 14px;
  min-height: 122px;
}

#product .mix-donut {
  display: grid;
  place-items: center;
}

#product .product-donut {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

#product .product-donut > div {
  width: 74px;
  height: 74px;
  display: grid;
  place-content: center;
  gap: 3px;
  border-radius: 50%;
  background: var(--surface);
  text-align: center;
}

#product .product-donut strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}

#product .product-donut span {
  color: var(--muted);
  font-size: 9px;
}

#product .product-mix-list {
  display: grid;
  gap: 8px;
}

#product .product-mix-list > div {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

#product .product-mix-list i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}

#product .product-mix-list b {
  color: var(--text);
  font-size: 10px;
  font-weight: 720;
}

#product .product-mix-list em {
  margin-left: 5px;
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

#product .product-detail-panel,
#product .product-liuke-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

#product .product-detail-heading,
#product .product-liuke-heading {
  align-items: flex-end;
  gap: 16px;
  margin: 0;
  padding: 14px 14px 10px;
}

#product .product-detail-heading h2,
#product .product-liuke-heading h2 {
  font-size: 16px;
  font-weight: 760;
}

#product .product-detail-heading .muted,
#product .product-liuke-heading .muted {
  font-size: 11px;
  line-height: 1.5;
}

#product .product-detail-count,
#product .product-detail-scope,
#product .product-data-cover {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c3e5da;
  border-radius: 999px;
  padding: 0 9px;
  color: #066a5b;
  background: #eefaf5;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

#product .product-detail-count {
  border-color: var(--line);
  color: var(--muted);
  background: var(--soft);
}

#product .product-detail-scope svg,
#product .product-data-cover svg {
  width: 13px;
  height: 13px;
}

#product .product-table-toolbar {
  min-height: 51px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

#product .product-segmented {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
  background: #f8fbf9;
}

#product .product-segmented button {
  min-height: 24px;
  border: 0;
  border-radius: 5px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  white-space: nowrap;
}

#product .product-segmented button.active {
  color: #066a5b;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 40, 32, 0.09);
  font-weight: 750;
}

#product .product-sort-switches {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

#product .product-sort-switches button {
  min-height: 27px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
  white-space: nowrap;
}

#product .product-sort-switches button.active {
  border-color: #a9d9cc;
  color: #066a5b;
  background: #e2f3ed;
  font-weight: 730;
}

#product .product-table-toolbar .product-detail-scope {
  margin-left: 2px;
}

#product .product-detail-panel .table-wrap,
#product .product-liuke-panel .table-wrap {
  border: 0;
  border-radius: 0;
}

/* Customer analysis follows the approved full-width structure layout. */
body.customer-active .workspace {
  gap: 16px;
}

#customer {
  gap: 18px;
}

#customer .customer-analysis-card {
  gap: 0;
  overflow: hidden;
  padding: 0;
}

#customer .customer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}

#customer .customer-section-title {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
}

#customer .customer-section-title h2 {
  color: #202632;
  font-size: 18px;
  font-weight: 720;
}

#customer .customer-section-title .muted {
  color: #8794a8;
  font-size: 12px;
  white-space: nowrap;
}

#customer .customer-section-total {
  flex: 0 0 auto;
  color: #63738a;
  font-size: 13px;
  white-space: nowrap;
}

#customer .customer-section-total b {
  margin-left: 6px;
  color: var(--text);
  font-size: 15px;
}

#customer .customer-structure-content {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  padding: 20px;
}

#customer .customer-bar-panel {
  min-width: 0;
  padding: 5px 8px 4px 0;
}

#customer .customer-bars {
  display: grid;
  gap: 21px;
}

#customer .customer-bar-row {
  display: grid;
  gap: 8px;
}

#customer .customer-bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#customer .customer-bar-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: #526279;
  font-size: 14px;
  font-weight: 650;
}

#customer .customer-bar-label i,
#customer .customer-frequency-label i {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green);
}

#customer .customer-bar-number {
  flex: 0 0 auto;
  color: #495b73;
  font-size: 13px;
  font-weight: 650;
}

#customer .customer-bar-number b {
  margin-right: 5px;
  color: var(--text);
  font-size: 16px;
}

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

#customer .customer-bar-track i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

#customer .customer-tone-2 {
  background: #55bda2 !important;
}

#customer .customer-tone-3 {
  background: #9eafbf !important;
}

#customer .customer-tone-4 {
  background: #c5d0d8 !important;
}

#customer .customer-table-wrap {
  min-width: 0;
}

#customer .customer-table-scroll {
  min-width: 0;
  overflow-x: auto;
}

#customer .customer-table-wrap table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

#customer .customer-table-wrap th,
#customer .customer-table-wrap td {
  height: 46px;
  padding: 0 12px;
  border-right: 0;
  border-bottom: 1px solid #eef1f4;
  color: #283445;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

#customer .customer-table-wrap th {
  height: 39px;
  color: #66778f;
  background: #f7f9fa;
  font-size: 11px;
  font-weight: 720;
}

#customer .customer-table-wrap th:first-child,
#customer .customer-table-wrap td:first-child {
  color: #34445b;
  font-weight: 650;
  text-align: left;
}

#customer .customer-table-wrap th:first-child {
  border-top-left-radius: 6px;
}

#customer .customer-table-wrap th:last-child {
  border-top-right-radius: 6px;
}

#customer .customer-table-wrap td:nth-child(2) {
  font-weight: 700;
}

#customer .customer-table-wrap tbody tr:nth-child(even) td {
  background: #fbfcfd;
}

#customer .customer-table-wrap tfoot td {
  border-bottom: 0;
  color: #55667e;
  background: #f7faf9;
  font-weight: 650;
}

#customer .customer-average {
  color: #087c6a !important;
  font-weight: 720;
}

#customer .customer-empty-value {
  color: #a3afbf;
  font-weight: 400;
}

#customer .customer-frequency-card > .customer-table-wrap {
  padding: 0 20px 20px;
}

#customer .customer-frequency-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#customer .customer-frequency-card tbody tr:first-child td:first-child {
  color: var(--green);
}

@media (min-width: 921px) and (max-width: 1280px) {
  #customer .customer-structure-content {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 920px) {
  body.customer-active .workspace {
    gap: 16px;
  }

  #customer .customer-section-head,
  #customer .customer-section-title {
    align-items: flex-start;
  }

  #customer .customer-section-head {
    display: grid;
  }

  #customer .customer-section-title {
    display: grid;
    gap: 5px;
  }

  #customer .customer-structure-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  #customer .customer-bar-panel {
    padding-right: 0;
  }
}

#product .product-detail-panel table,
#product .product-liuke-panel table {
  min-width: 1060px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

#product .product-detail-panel th,
#product .product-detail-panel td,
#product .product-liuke-panel th,
#product .product-liuke-panel td {
  padding: 10px 11px;
  border-right: 1px solid #e5ece9;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  text-align: right;
  vertical-align: middle;
}

#product .product-detail-panel th,
#product .product-liuke-panel th {
  color: var(--faint);
  background: #fafcfb;
  font-size: 10px;
  font-weight: 720;
}

#product .product-detail-panel th:nth-child(-n + 4),
#product .product-detail-panel td:nth-child(-n + 4),
#product .product-liuke-panel th:nth-child(-n + 4),
#product .product-liuke-panel td:nth-child(-n + 4) {
  text-align: left;
}

#product .product-detail-panel th:last-child,
#product .product-detail-panel td:last-child,
#product .product-liuke-panel th:last-child,
#product .product-liuke-panel td:last-child {
  border-right: 0;
}

#product .product-detail-panel tbody tr:hover td,
#product .product-liuke-panel tbody tr:hover td {
  background: #fbfdfc;
}

#product .product-detail-panel tbody tr:last-child td,
#product .product-liuke-panel tbody tr:last-child td {
  border-bottom: 0;
}

#product .product-rank {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  background: #f1f5f3;
  font-size: 10px;
  font-weight: 750;
}

#product .product-rank.top {
  color: #066a5b;
  background: #e2f3ed;
}

#product .product-project-name {
  min-width: 172px;
  display: grid;
  gap: 3px;
  white-space: normal;
}

#product .product-project-name strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 730;
}

#product .product-project-name small {
  color: var(--muted);
  font-size: 9px;
}

#product .product-table-value {
  display: grid;
  gap: 3px;
  justify-items: end;
}

#product .product-table-value strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 760;
}

#product .product-table-value small {
  color: #066a5b;
  font-size: 9px;
}

#product .product-type-pill {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 9px;
}

#product .product-type-pill.consume {
  border-color: #ced9f5;
  color: var(--blue);
  background: #f4f7ff;
}

#product .product-type-pill.liuke {
  border-color: #cbdfd8;
  color: #066a5b;
  background: #f4fbf8;
}

#product .product-table-foot {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10px;
}

#product .product-liuke-section {
  display: grid;
  gap: 11px;
}

#product .product-liuke-heading {
  padding: 0;
}

#product .product-liuke-title {
  display: flex;
  align-items: center;
  gap: 4px;
}

#product .product-rule-tip {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  color: var(--muted);
  background: transparent;
}

#product .product-rule-tip svg {
  width: 15px;
  height: 15px;
}

#product .product-liuke-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

#product .product-liuke-kpi {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(19, 38, 31, 0.06);
}

#product .product-liuke-kpi > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

#product .product-liuke-kpi > div svg {
  width: 15px;
  height: 15px;
}

#product .product-liuke-kpi > strong {
  color: var(--text);
  font-size: 21px;
  line-height: 1;
}

#product .product-liuke-kpi > small {
  color: var(--muted);
  font-size: 9px;
}

#product .product-liuke-kpi > em {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

#product .product-liuke-kpi > em i {
  width: var(--w);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--green);
}

#product .product-liuke-kpi.blue > div svg { color: var(--blue); }
#product .product-liuke-kpi.blue > em i { background: var(--blue); }
#product .product-liuke-kpi.violet > div svg { color: var(--violet); }
#product .product-liuke-kpi.violet > em i { background: var(--violet); }
#product .product-liuke-kpi.orange > div svg { color: var(--orange); }
#product .product-liuke-kpi.orange > em i { background: var(--orange); }
#product .product-liuke-kpi.green > div svg { color: var(--green); }
#product .product-liuke-kpi.green > em i { background: var(--green); }

#product .product-detail-missing {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #f1d3a9;
  border-radius: 7px;
  color: #865519;
  background: #fff9ee;
}

#product .product-detail-missing strong,
#product .product-detail-missing span {
  display: block;
}

#product .product-detail-missing strong {
  color: #6a4210;
  font-size: 11px;
}

#product .product-detail-missing span {
  margin-top: 3px;
  color: #986d37;
  font-size: 10px;
}

@media (max-width: 1240px) {
  #product .product-liuke-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #product .product-table-toolbar {
    flex-wrap: wrap;
  }

  #product .product-sort-switches {
    margin-left: 0;
  }
}
