:root {
  --ink: #152522;
  --ink-soft: #40524f;
  --muted: #72817e;
  --line: #dfe6e3;
  --line-soft: #edf1ef;
  --canvas: #f3f5f3;
  --panel: #ffffff;
  --sidebar: #172825;
  --sidebar-soft: #263a36;
  --valid: #117d70;
  --valid-light: #dcefeb;
  --valid-mid: #50a99e;
  --expired: #c75b4d;
  --expired-light: #fae6e2;
  --inactive: #d08a2e;
  --inactive-light: #f8ecd8;
  --blue: #4776b8;
  --lavender: #8271a7;
  --shadow: 0 8px 28px rgba(21, 37, 34, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(17, 125, 112, 0.18);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  color: #f4faf7;
  background: var(--sidebar);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
}

.brand-mark span {
  display: block;
  background: #9ed5ca;
  border-radius: 1px 1px 0 0;
}

.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 13px; }

.brand strong {
  display: block;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: #91a39f;
  font-size: 8px;
  letter-spacing: 1.4px;
}

.primary-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  color: #9fb0ac;
  text-decoration: none;
  border-radius: 7px;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: var(--sidebar-soft);
}

.nav-item.active {
  font-weight: 600;
}

.nav-dot {
  width: 5px;
  height: 5px;
  margin-left: auto;
  background: #8ed1c5;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(142, 209, 197, 0.08);
}

.sidebar-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.section-label {
  display: block;
  padding: 0 12px 10px;
  color: #728681;
  font-size: 11px;
}

.side-view {
  width: 100%;
  min-height: 43px;
  display: grid;
  grid-template-columns: 9px 1fr 18px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: #acbbb7;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
}

.side-view:hover,
.side-view.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.side-view .icon {
  width: 15px;
  height: 15px;
  opacity: 0.55;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.valid { background: #74c6b8; }
.status-dot.expired { background: #e68b7d; }
.status-dot.inactive { background: #e5ae62; }
.status-dot.course-revenue { background: #79a9cf; }
.status-dot.venue-revenue { background: #d2a260; }
.status-dot.annual-revenue { background: #8198cb; }
.status-dot.annual-members { background: #aa8aba; }
.status-dot.club-revenue { background: #62a1aa; }
.status-dot.stored-value { background: #c28a5b; }
.status-dot.coupons { background: #cd7c8e; }
.status-dot.member-segments { background: #65a5a7; }
.status-dot.activity-sessions { background: #7995bd; }
.status-dot.visitor-profile { background: #a28caf; }
.status-dot.venue-utilization { background: #55a1ad; }
.status-dot.multi-venue-utilization { background: #9289b3; }
.status-dot.member-archives { background: #78998d; }

.sidebar-bottom {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.sync-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.sync-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #8ed1c5;
  background: rgba(142, 209, 197, 0.1);
  border-radius: 6px;
}

.sync-icon .icon {
  width: 15px;
  height: 15px;
}

.sync-card span,
.sync-card small {
  display: block;
}

.sync-card span {
  font-size: 12px;
}

.sync-card small {
  margin-top: 3px;
  color: #7f918d;
  font-size: 10px;
}

.main-content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px 34px 48px;
}

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

.eyebrow {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.eyebrow .icon {
  width: 12px;
  height: 12px;
}

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

h1 {
  margin-bottom: 0;
  margin-top: 6px;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 650;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: #6d5b2f;
  background: #f5edd8;
  border: 1px solid #eadcb8;
  border-radius: 6px;
  font-size: 12px;
}

.demo-badge .icon {
  width: 14px;
  height: 14px;
}

.avatar-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: white;
  background: #4e6c66;
  border: 0;
  border-radius: 50%;
  font-weight: 650;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(10, minmax(122px, 1fr));
  gap: 6px;
  padding: 5px;
  margin-bottom: 16px;
  background: #e7ece9;
  border-radius: 8px;
  overflow-x: auto;
}

.view-tab {
  min-height: 52px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.view-tab span {
  font-weight: 650;
}

.view-tab small {
  color: var(--muted);
  font-size: 11px;
}

.view-tab.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 8px rgba(31, 53, 49, 0.08);
}

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

.filter-panel {
  padding: 18px 20px 20px;
}

.filter-heading,
.panel-header,
.table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.text-button {
  gap: 6px;
  padding: 5px 0;
  font-size: 12px;
}

.text-button .icon {
  width: 14px;
  height: 14px;
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

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

.filter-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.7fr) minmax(150px, 0.65fr) minmax(150px, 0.65fr) 108px;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.field select,
.date-range,
.table-search {
  height: 40px;
  background: #fff;
  border: 1px solid #ced8d4;
  border-radius: 6px;
}

.field select {
  width: 100%;
  padding: 0 34px 0 12px;
  color: var(--ink);
}

.date-range {
  display: grid;
  grid-template-columns: 18px 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.date-range .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.date-range input {
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.date-range input:focus-visible {
  outline: 0;
}

.date-separator {
  color: #9ba7a4;
  font-size: 11px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 650;
  white-space: nowrap;
}

.primary-button {
  color: white;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.primary-button:hover {
  background: #243d38;
}

.secondary-button {
  color: var(--ink);
  background: #fff;
  border: 1px solid #cbd5d1;
}

.secondary-button:hover {
  background: #f6f8f7;
}

.primary-button .icon,
.secondary-button .icon {
  width: 16px;
  height: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.kpi-card {
  min-height: 142px;
  position: relative;
  padding: 18px 18px 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-card::after {
  content: "";
  position: absolute;
  width: 74px;
  height: 74px;
  right: -28px;
  top: -32px;
  border: 13px solid var(--accent-soft);
  border-radius: 50%;
}

.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.kpi-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
}

.kpi-icon .icon {
  width: 15px;
  height: 15px;
}

.kpi-value {
  display: block;
  margin-top: 14px;
  font-size: 28px;
  font-weight: 680;
  line-height: 1;
}

.kpi-value small {
  margin-left: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.kpi-foot strong {
  font-weight: 650;
}

.kpi-foot .positive { color: var(--valid); }
.kpi-foot .negative { color: var(--expired); }
.kpi-foot .warning { color: #a86a1f; }

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 20px;
}

.trend-panel {
  min-height: 390px;
}

.segment-control {
  display: flex;
  padding: 3px;
  background: #edf1ef;
  border-radius: 6px;
}

.segment-control button {
  min-height: 28px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 11px;
}

.segment-control button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 4px rgba(21, 37, 34, 0.08);
}

.chart-summary {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 24px 0 4px;
}

.chart-summary strong {
  font-size: 26px;
  font-weight: 680;
}

.chart-summary > span {
  color: var(--muted);
  font-size: 11px;
}

.chart-summary .change {
  margin-left: auto;
  padding: 5px 7px;
  border-radius: 4px;
}

.change.positive {
  color: var(--valid);
  background: var(--valid-light);
}

.change.negative {
  color: var(--expired);
  background: var(--expired-light);
}

.change.warning {
  color: #9b661d;
  background: var(--inactive-light);
}

.chart-wrap {
  height: 265px;
  position: relative;
}

#trend-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.grid-line {
  stroke: #e8edeb;
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.axis-label {
  fill: #8b9996;
  font-size: 10px;
}

.area-path {
  opacity: 0.14;
}

.line-path {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.comparison-line {
  stroke-dasharray: 6 5;
}

.svg-chart-legend text {
  fill: #71807d;
  font-size: 9px;
}

.chart-point {
  stroke: #fff;
  stroke-width: 2.5;
  cursor: pointer;
  transition: r 120ms ease;
}

.chart-point:hover {
  r: 6;
}

.chart-tooltip {
  position: absolute;
  display: none;
  min-width: 108px;
  padding: 9px 11px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(18, 36, 32, 0.18);
  pointer-events: none;
  transform: translate(-50%, -110%);
  z-index: 2;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip strong {
  font-size: 14px;
}

.chart-tooltip span {
  margin-top: 2px;
  color: #b8c8c4;
  font-size: 10px;
}

.mix-panel {
  min-height: 390px;
}

.donut-layout {
  display: grid;
  grid-template-columns: 148px 1fr;
  align-items: center;
  gap: 24px;
  margin-top: 26px;
}

.donut-layout.bar-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(150px, 0.75fr);
  align-items: stretch;
  gap: 22px;
}

.donut-layout.comparison-layout {
  grid-template-columns: minmax(0, 1.7fr) minmax(130px, 0.55fr);
  align-items: center;
  gap: 20px;
}

.bar-comparison {
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: 180px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 11px;
}

.bar-meta strong {
  color: var(--ink);
  font-size: 11px;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  background: #edf1ef;
  border-radius: 3px;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar-layout .legend {
  align-content: center;
  padding-left: 18px;
  border-left: 1px solid var(--line-soft);
}

.revenue-legend {
  grid-template-columns: 8px 1fr auto;
}

.comparison-bars {
  display: grid;
  gap: 13px;
  min-height: 210px;
}

.comparison-bar-row {
  display: grid;
  gap: 5px;
}

.comparison-bar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 10px;
}

.comparison-bar-heading strong {
  color: var(--valid);
  font-size: 9px;
  white-space: nowrap;
}

.comparison-track-line {
  display: grid;
  grid-template-columns: 44px minmax(80px, 1fr) 58px;
  align-items: center;
  gap: 7px;
}

.comparison-track-line small {
  color: var(--muted);
  font-size: 9px;
}

.comparison-track-line em {
  color: var(--ink-soft);
  font-size: 9px;
  font-style: normal;
  text-align: right;
  white-space: nowrap;
}

.comparison-track-line .bar-track {
  height: 6px;
}

.comparison-track-line.muted .bar-track span {
  background: #aab5b2;
}

.comparison-key {
  display: grid;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--line-soft);
}

.comparison-key span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 10px;
}

.comparison-key i {
  width: 18px;
  height: 4px;
  display: inline-block;
  background: #aab5b2;
  border-radius: 2px;
}

.comparison-key small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.donut-chart {
  width: 144px;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.donut-chart::after {
  content: "";
  position: absolute;
  width: 92px;
  height: 92px;
  background: #fff;
  border-radius: 50%;
}

.donut-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut-center strong,
.donut-center span {
  display: block;
}

.donut-center strong {
  font-size: 23px;
  font-weight: 680;
}

.donut-center span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.legend {
  display: grid;
  gap: 13px;
}

.legend-item {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 9px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-label {
  color: var(--ink-soft);
  font-size: 11px;
}

.legend-value {
  font-size: 11px;
  font-weight: 650;
}

.legend-value small {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 400;
}

.insight-box {
  min-height: 64px;
  display: flex;
  gap: 10px;
  margin-top: 28px;
  padding: 12px;
  color: var(--ink-soft);
  background: #f5f7f6;
  border-left: 3px solid var(--valid);
  border-radius: 3px 6px 6px 3px;
  font-size: 11px;
  line-height: 1.65;
}

.insight-box .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--valid);
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  align-items: flex-end;
  padding: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.table-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.table-actions {
  display: flex;
  gap: 9px;
}

.table-search {
  width: 220px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
}

.table-search .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.table-search input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.table-search input:focus-visible {
  outline: 0;
}

.table-scroll {
  overflow-x: auto;
}

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

th,
td {
  height: 57px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

th {
  height: 42px;
  color: var(--muted);
  background: #f8faf9;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

td {
  color: var(--ink-soft);
  font-size: 12px;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #fbfcfb;
}

.member-cell,
.entity-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}

.entity-icon .icon {
  width: 15px;
  height: 15px;
}

.member-avatar {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: #355c55;
  background: #e1eeeb;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 650;
}

.member-info strong,
.member-info small {
  display: block;
}

.member-info strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.member-info small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.membership-chip,
.state-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.membership-chip.diamond { color: #5d5291; background: #ece9f5; }
.membership-chip.gold { color: #976d22; background: #f5ead1; }
.membership-chip.silver { color: #5c707b; background: #e7edf0; }
.membership-chip.family { color: #3f6c91; background: #e4eef7; }
.state-chip.valid { color: var(--valid); background: var(--valid-light); }
.state-chip.expired { color: var(--expired); background: var(--expired-light); }
.state-chip.inactive { color: #9b661d; background: var(--inactive-light); }
.state-chip.revenue { color: #346584; background: #e5eff5; }

.row-action {
  min-height: 28px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid #d4ddda;
  border-radius: 5px;
  font-size: 10px;
}

.row-action:hover {
  color: var(--valid);
  border-color: #a9cfc7;
}

.table-footer {
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  color: var(--muted);
  font-size: 10px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination button {
  min-width: 27px;
  height: 27px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid #dbe2df;
  border-radius: 4px;
  font-size: 10px;
}

.pagination button.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.pagination button:disabled {
  color: #bdc6c3;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  background: rgba(12, 25, 22, 0.28);
  backdrop-filter: blur(2px);
}

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

.member-drawer {
  width: min(420px, 92vw);
  height: 100vh;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 21;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: #fff;
  box-shadow: -18px 0 50px rgba(21, 37, 34, 0.15);
  transform: translateX(105%);
  transition: transform 220ms ease;
}

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

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
}

.large-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: #315a52;
  background: #dcebe8;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 650;
}

.drawer-status {
  color: var(--valid);
  font-weight: 650;
}

.drawer-profile p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.drawer-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
}

.drawer-section h3 {
  margin-bottom: 15px;
  font-size: 12px;
}

.drawer-section dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin: 0;
}

.drawer-section dt {
  color: var(--muted);
  font-size: 10px;
}

.drawer-section dd {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 12px;
}

.recommendation {
  padding: 14px;
  color: var(--ink-soft);
  background: #f4f7f5;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.7;
}

.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.toast {
  min-width: 220px;
  min-height: 44px;
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(21, 37, 34, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .sidebar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .main-content {
    padding-left: 24px;
    padding-right: 24px;
  }

  .filter-grid {
    grid-template-columns: minmax(300px, 1.4fr) 1fr 1fr 96px;
  }

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

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

  .mix-panel {
    min-height: auto;
  }

  .donut-layout {
    grid-template-columns: 160px minmax(220px, 1fr);
    justify-content: center;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    display: block;
    padding: 16px;
  }

  .brand {
    padding-bottom: 16px;
  }

  .primary-nav,
  .sidebar-bottom,
  .section-label {
    display: none;
  }

  .sidebar-section {
    display: grid;
    grid-template-columns: repeat(16, minmax(132px, 1fr));
    gap: 6px;
    overflow-x: auto;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .side-view {
    min-height: 38px;
    grid-template-columns: 8px 1fr;
    justify-items: start;
    padding: 0 9px;
    font-size: 11px;
  }

  .side-view .icon {
    display: none;
  }

  .main-content {
    padding: 22px 16px 34px;
  }

  .topbar {
    align-items: flex-start;
  }

  .demo-badge {
    display: none;
  }

  .view-tab {
    display: block;
    min-height: 48px;
    padding: 7px 6px;
  }

  .view-tab span,
  .view-tab small {
    display: block;
  }

  .view-tab small {
    margin-top: 3px;
  }

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

  .date-field {
    grid-column: 1 / -1;
  }

  .filter-grid .primary-button {
    grid-column: 1 / -1;
  }

  .table-toolbar {
    display: block;
  }

  .table-actions {
    margin-top: 16px;
  }

  .table-search {
    flex: 1;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 21px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .view-tabs {
    grid-template-columns: repeat(10, minmax(124px, 1fr));
    gap: 3px;
    overflow-x: auto;
  }

  .view-tab {
    font-size: 12px;
  }

  .filter-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .date-range {
    grid-template-columns: 16px 1fr;
    height: auto;
    padding: 9px 10px;
  }

  .date-range .date-separator {
    display: none;
  }

  .date-range input {
    min-height: 30px;
  }

  .date-range input:last-child {
    grid-column: 2;
  }

  .field,
  .date-field,
  .filter-grid .primary-button {
    grid-column: 1;
  }

  .kpi-card {
    min-height: 128px;
  }

  .panel {
    padding: 16px;
  }

  .panel-header {
    align-items: flex-start;
  }

  .chart-summary {
    flex-wrap: wrap;
  }

  .chart-summary .change {
    width: 100%;
    margin-left: 0;
    text-align: left;
    background: transparent;
    padding-left: 0;
  }

  .donut-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .donut-layout.bar-layout {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .donut-layout.comparison-layout {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .bar-comparison,
  .bar-layout .legend,
  .comparison-bars,
  .comparison-key {
    width: 100%;
  }

  .bar-layout .legend {
    padding: 16px 0 0;
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }

  .comparison-key {
    padding: 16px 0 0;
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }

  .legend {
    width: 100%;
  }

  .table-actions {
    display: grid;
  }

  .table-search {
    width: 100%;
  }

  .table-footer {
    display: block;
    padding: 14px 16px;
  }

  .pagination {
    margin-top: 12px;
  }

  .drawer-actions {
    grid-template-columns: 1fr;
  }
}
