:root {
  color-scheme: light;
  --bg: #eef3f7;
  --bg-strong: #dbe5ec;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #183247;
  --muted: #6e8597;
  --line: rgba(24, 50, 71, 0.09);
  --shadow: 0 24px 80px rgba(20, 48, 74, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --accent: #2aa7a1;
  --accent-soft: rgba(42, 167, 161, 0.16);
  --accent-strong: #176d78;
  --secondary: #ff7d5c;
  --secondary-soft: rgba(255, 125, 92, 0.18);
  --tertiary: #6c7ef8;
  --positive: #189b72;
  --positive-soft: rgba(24, 155, 114, 0.16);
  --negative: #d25f46;
  --negative-soft: rgba(210, 95, 70, 0.14);
  --hero-gradient: linear-gradient(135deg, rgba(42, 167, 161, 0.18), rgba(108, 126, 248, 0.12));
  --sidebar-gradient: linear-gradient(180deg, #12334a 0%, #10283a 100%);
  --font-stack: "Avenir Next", "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-stack);
  background:
    radial-gradient(circle at top left, rgba(42, 167, 161, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 125, 92, 0.18), transparent 32%),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  opacity: 0.35;
}

button,
select,
input {
  font: inherit;
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 100vh;
  padding: 18px;
  gap: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  width: 76px;
  overflow: visible;
  color: #f7fbfd;
  z-index: 12;
  transition: width 220ms ease;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 76px;
  height: 100%;
  padding: 16px 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(108, 126, 248, 0.14), transparent 28%),
    radial-gradient(circle at bottom left, rgba(42, 167, 161, 0.16), transparent 30%),
    var(--sidebar-gradient);
  border-radius: 34px;
  box-shadow: var(--shadow);
  transition: width 220ms ease, padding 220ms ease, transform 220ms ease;
}

.sidebar:hover,
.sidebar:focus-within,
.sidebar.is-near,
.sidebar.open {
  width: 248px;
  z-index: 20;
}

.sidebar:hover .sidebar-panel,
.sidebar:focus-within .sidebar-panel,
.sidebar.is-near .sidebar-panel,
.sidebar.open .sidebar-panel {
  width: 248px;
  padding: 22px 18px;
}

.sidebar-handle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-handle span {
  position: absolute;
  width: 18px;
  height: 2px;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 999px;
}

.sidebar-handle span:first-child {
  transform: translateY(-4px);
}

.sidebar-handle span:last-child {
  transform: translateY(4px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
}

.brand-mark {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.brand-mark span {
  position: absolute;
  border-radius: 999px;
}

.brand-mark span:nth-child(1) {
  width: 12px;
  height: 36px;
  left: 10px;
  top: 6px;
  background: #4cd8c7;
}

.brand-mark span:nth-child(2) {
  width: 12px;
  height: 26px;
  left: 23px;
  top: 10px;
  background: #ff9368;
}

.brand-mark span:nth-child(3) {
  width: 22px;
  height: 12px;
  right: 7px;
  bottom: 9px;
  background: #7c8bff;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar .eyebrow,
.sidebar-card-label {
  color: rgba(247, 251, 253, 0.62);
}

.brand h1,
.hero h2,
.card h3,
.sidebar-card h2 {
  margin: 0;
}

.brand h1 {
  font-size: 1.4rem;
}

.primary-action {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 0;
  border-radius: 22px;
  text-align: left;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.primary-action::before {
  content: "";
  display: none;
  width: 26px;
  height: 26px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06)),
    linear-gradient(135deg, #4cd8c7, #7c8bff);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.primary-action strong {
  font-size: 1.08rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.nav-group {
  display: grid;
  gap: 10px;
}

.nav-label {
  margin: 0 0 6px;
  color: rgba(247, 251, 253, 0.56);
  font-size: 0.88rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 18px;
  color: rgba(247, 251, 253, 0.82);
  background: transparent;
  text-align: left;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateX(2px);
}

.nav-icon-shell {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  color: rgba(247, 251, 253, 0.96);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(10, 22, 32, 0.16);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.nav-icon-svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover .nav-icon-shell,
.nav-item.active .nav-icon-shell {
  transform: scale(1.04);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 22px rgba(10, 22, 32, 0.2);
}

.nav-icon-shell.top {
  color: #d2f7ff;
  background: linear-gradient(135deg, rgba(42, 167, 161, 0.52), rgba(108, 126, 248, 0.46));
}

.nav-icon-shell.qm {
  color: #73f1dd;
}

.nav-icon-shell.dxbe {
  color: #ffbc8f;
}

.nav-icon-shell.bod {
  color: #b2bfff;
}

.nav-icon-shell.vn {
  color: #9de1ff;
}

.nav-icon-shell.royal {
  color: #ffcf95;
}

.nav-icon-shell.existing {
  color: #8fe1b3;
}

.nav-icon-shell.new {
  color: #9db0ff;
}

.sidebar-card {
  margin-top: auto;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.sidebar-card h2 {
  margin-top: 8px;
  font-size: 1.05rem;
  line-height: 1.45;
}

.sidebar-card ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: rgba(247, 251, 253, 0.78);
  line-height: 1.65;
}

.sidebar:not(:hover):not(:focus-within):not(.is-near):not(.open) .brand {
  justify-content: center;
}

.sidebar:not(:hover):not(:focus-within):not(.is-near):not(.open) .brand > div:last-child {
  display: none;
}

.sidebar:not(:hover):not(:focus-within):not(.is-near):not(.open) .nav {
  align-items: center;
}

.sidebar:not(:hover):not(:focus-within):not(.is-near):not(.open) .nav-group {
  width: 100%;
  justify-items: center;
}

.sidebar:not(:hover):not(:focus-within):not(.is-near):not(.open) .nav-label,
.sidebar:not(:hover):not(:focus-within):not(.is-near):not(.open) .nav-item > span:last-child {
  display: none;
}

.sidebar:not(:hover):not(:focus-within):not(.is-near):not(.open) .nav-item {
  width: 48px;
  min-height: 48px;
  justify-content: center;
  padding: 0;
  margin: 0 auto;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.main > * {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 6px;
}

.menu-toggle {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(20, 48, 74, 0.08);
}

.menu-toggle span {
  position: absolute;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
}

.menu-toggle span:first-child {
  transform: translateY(-4px);
}

.menu-toggle span:last-child {
  transform: translateY(4px);
}

.search-box,
.ghost-pill,
.profile,
.card,
.filters,
.kpi-card {
  backdrop-filter: blur(18px);
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: 52px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(20, 48, 74, 0.08);
  min-width: 0;
}

.search-box input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  min-width: 0;
  font-size: 0.98rem;
}

.search-icon {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(24, 50, 71, 0.4);
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  background: rgba(24, 50, 71, 0.4);
  right: -6px;
  bottom: -3px;
  transform: rotate(45deg);
  border-radius: 999px;
}

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

.unit-chip {
  display: inline-flex;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 14px 40px rgba(20, 48, 74, 0.08);
}

.ghost-pill {
  padding: 14px 18px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  font-weight: 700;
  box-shadow: 0 14px 40px rgba(20, 48, 74, 0.08);
}

.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(20, 48, 74, 0.08);
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--tertiary));
  color: #ffffff;
  font-weight: 800;
}

.profile-name,
.profile-role {
  margin: 0;
}

.profile-name {
  font-size: 0.92rem;
  font-weight: 700;
}

.profile-role {
  font-size: 0.78rem;
  color: var(--muted);
}

.card,
.filters,
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow:
    0 24px 80px rgba(20, 48, 74, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8)),
    var(--hero-gradient);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 126, 248, 0.18), transparent 68%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 100%;
  min-width: 0;
}

.hero h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.8rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.hero p:last-child {
  margin-bottom: 0;
}

.hero-copy p {
  color: var(--muted);
  line-height: 1.65;
}

.hero-highlight {
  position: relative;
  z-index: 1;
  min-width: 176px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(24, 50, 71, 0.94), rgba(24, 50, 71, 0.82));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.hero-highlight p,
.hero-highlight span {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.hero-highlight strong {
  display: block;
  margin: 14px 0 10px;
  font-size: 2.1rem;
}

.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 6;
  overflow: visible;
}

.filters-title {
  min-width: 150px;
}

.filters-title h3,
.card h3 {
  font-size: 1.28rem;
}

.filter-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.filter-grid > label {
  display: grid;
  gap: 8px;
  position: relative;
}

.filter-grid > label > span {
  font-size: 0.82rem;
  color: var(--muted);
}

.filter-grid select {
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  outline: none;
}

.phase-multiselect {
  position: relative;
}

.phase-trigger {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 0 42px 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-trigger::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 18px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #73889a;
  border-bottom: 2px solid #73889a;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.phase-multiselect.open .phase-trigger {
  border-color: rgba(42, 167, 161, 0.28);
  box-shadow: 0 12px 30px rgba(20, 48, 74, 0.08);
}

.phase-multiselect.open .phase-trigger::after {
  transform: translateY(-35%) rotate(225deg);
}

.phase-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  max-height: 292px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid rgba(24, 50, 71, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(20, 48, 74, 0.14);
  z-index: 30;
}

.phase-multiselect.open .phase-menu {
  display: grid;
  gap: 6px;
}

.phase-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.phase-option:hover {
  background: rgba(24, 50, 71, 0.04);
}

.phase-option input {
  margin: 0;
  accent-color: var(--accent);
}

.phase-option span {
  font-size: 0.9rem;
  color: var(--text);
}

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

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -36px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(42, 167, 161, 0.12), transparent 70%);
}

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

.kpi-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.kpi-value {
  margin: 14px 0 10px;
  font-size: clamp(1.2rem, 1.6vw, 1.8rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill.positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.pill.negative {
  background: var(--negative-soft);
  color: var(--negative);
}

.pill.neutral {
  background: rgba(108, 126, 248, 0.12);
  color: var(--tertiary);
}

.kpi-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.kpi-rail {
  margin-top: 18px;
  height: 10px;
  border-radius: 999px;
  background: rgba(24, 50, 71, 0.07);
  overflow: hidden;
}

.kpi-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.1fr;
  gap: 18px;
}

.trend-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

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

.detail-grid > *,
.trend-section > *,
.viz-grid > * {
  min-width: 0;
}

.card {
  position: relative;
  padding: 22px;
}

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

.chart-legend,
.legend-list,
.signal-list,
.mini-stats,
.segment-bars,
.account-table {
  display: grid;
  gap: 14px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.legend::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend.revenue::before {
  background: var(--accent);
}

.legend.gross::before {
  background: var(--secondary);
}

.legend.profit::before {
  background: var(--tertiary);
}

.trend-wrap {
  min-width: 0;
  padding: 10px 0 0;
  overflow: hidden;
}

#trendChart {
  width: 100%;
  height: auto;
}

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

.trend-metric-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(24, 50, 71, 0.045);
}

.trend-metric-card.positive {
  background: rgba(24, 155, 114, 0.1);
}

.trend-metric-card.negative {
  background: rgba(210, 95, 70, 0.1);
}

.trend-metric-card p,
.trend-metric-card span {
  margin: 0;
  color: var(--muted);
}

.trend-metric-card strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 1rem;
}

.monthly-axis-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.axis-toggle {
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(24, 50, 71, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.axis-toggle.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.axis-toggle:hover {
  transform: translateY(-1px);
}

.monthly-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border-radius: 20px;
  border: 1px solid rgba(24, 50, 71, 0.08);
  background: rgba(255, 255, 255, 0.68);
}

.monthly-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.monthly-table th,
.monthly-table td {
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(24, 50, 71, 0.08);
  white-space: nowrap;
  font-size: 0.74rem;
}

.monthly-table th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(24, 50, 71, 0.04);
}

.monthly-table thead th:first-child,
.monthly-table thead th:nth-child(2),
.monthly-table tbody th {
  position: sticky;
  z-index: 1;
  background: rgba(245, 249, 252, 0.98);
}

.monthly-table thead th:first-child,
.monthly-table tbody .axis-name {
  text-align: left;
  left: 0;
}

.monthly-table thead th:nth-child(2),
.monthly-table tbody .axis-metric {
  left: 110px;
  text-align: left;
}

.monthly-table tbody th {
  color: var(--text);
  width: 110px;
  font-size: 0.78rem;
  font-weight: 800;
}

.monthly-table .axis-metric {
  min-width: 76px;
  font-size: 0.74rem;
  color: var(--muted);
}

.monthly-table .axis-group-start th,
.monthly-table .axis-group-start td {
  border-top: 1px solid rgba(24, 50, 71, 0.12);
}

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

.monthly-table tbody tr:last-child th {
  border-bottom: 0;
}

.monthly-table .positive-cell {
  color: var(--positive);
  font-weight: 700;
}

.monthly-table .negative-cell {
  color: var(--negative);
  font-weight: 700;
}

.trend-card.wide {
  padding-bottom: 28px;
}

.viz-card {
  min-height: 420px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.donut-panel {
  display: grid;
  gap: 18px;
  justify-items: center;
  padding-top: 6px;
}

.donut {
  --donut-fill: conic-gradient(var(--accent) 0 40%, var(--secondary) 40% 68%, var(--tertiary) 68% 100%);
  position: relative;
  width: 176px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--donut-fill);
}

.donut::before {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 252, 254, 0.96));
  box-shadow: inset 0 0 0 1px rgba(24, 50, 71, 0.05);
}

.donut::after {
  content: attr(data-center);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  white-space: pre-line;
}

.legend-row,
.signal,
.mini-stat,
.segment-bar,
.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.legend-row {
  width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(24, 50, 71, 0.04);
}

.legend-row strong,
.signal strong,
.mini-stat strong,
.segment-bar strong,
.account-row strong {
  font-size: 0.96rem;
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.signal {
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(24, 50, 71, 0.04);
}

.signal p,
.mini-stat p,
.account-row p,
.legend-row span {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.signal .signal-tone {
  min-width: 80px;
  text-align: center;
}

.mini-stats {
  grid-template-columns: 1fr;
}

.mini-stat {
  align-items: center;
  justify-content: flex-start;
  padding: 18px;
  border-radius: 18px;
  background: rgba(24, 50, 71, 0.04);
}

.mini-stat .mini-copy {
  display: grid;
  gap: 6px;
  flex: 1;
}

.mini-stat .metric {
  font-size: 1.45rem;
}

.segment-bar {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
}

.stack-block {
  display: grid;
  gap: 16px;
}

.stack-block + .stack-block {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.subheading {
  margin-top: 8px;
  font-size: 1rem;
}

.segment-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(24, 50, 71, 0.08);
  overflow: hidden;
}

.segment-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
}

.account-table {
  gap: 12px;
}

.account-row {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(24, 50, 71, 0.04);
}

.account-row .account-meta {
  display: grid;
  gap: 4px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-chip.good {
  background: var(--positive-soft);
  color: var(--positive);
}

.status-chip.watch {
  background: rgba(247, 167, 37, 0.16);
  color: #c88014;
}

.status-chip.risk {
  background: var(--negative-soft);
  color: var(--negative);
}

.axis-label,
.tick-label {
  fill: #8ca0b0;
  font-size: 12px;
  font-family: var(--font-stack);
}

.grid-line {
  stroke: rgba(24, 50, 71, 0.08);
  stroke-dasharray: 4 8;
}

.series-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.series-area {
  opacity: 0.12;
}

.point {
  stroke: #ffffff;
  stroke-width: 3;
}

.value-label {
  font-size: 12px;
  font-weight: 800;
  text-anchor: middle;
  font-family: var(--font-stack);
}

.value-label.revenue-label {
  fill: var(--accent-strong);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero,
.filters,
.kpi-card,
.card {
  animation: rise 520ms ease both;
}

@media (max-width: 1280px) {
  .viz-grid,
  .detail-grid,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .trend-wrap,
  .monthly-table-wrap {
    overflow-x: auto;
  }

  #trendChart {
    min-width: 980px;
  }

  .monthly-table {
    min-width: 1120px;
  }

  .detail-grid > :last-child {
    grid-column: 1 / -1;
  }

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

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

  .sidebar {
    position: fixed;
    left: 18px;
    z-index: 20;
    top: 18px;
    bottom: 18px;
    width: min(320px, calc(100vw - 36px));
    height: auto;
    transform: translateX(calc(-100% - 26px));
  }

  .sidebar-panel,
  .sidebar:hover .sidebar-panel,
  .sidebar:focus-within .sidebar-panel,
  .sidebar.is-near .sidebar-panel,
  .sidebar.open .sidebar-panel {
    width: 100%;
    padding: 28px 22px;
  }

  .sidebar:hover,
  .sidebar:focus-within,
  .sidebar.is-near,
  .sidebar.open {
    width: min(320px, calc(100vw - 36px));
  }

  .sidebar.is-near,
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-handle {
    display: none;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding-top: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar-meta {
    display: contents;
  }

  .unit-chip {
    grid-column: 2;
    justify-self: start;
  }

  .ghost-pill {
    grid-column: 3;
    justify-self: end;
  }

  .profile {
    display: none;
  }

  .search-box {
    grid-column: 1 / -1;
    width: 100%;
  }

  .hero,
  .filters {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
    gap: 12px;
  }

  .topbar {
    grid-template-columns: auto 1fr;
  }

  .search-box {
    min-width: 0;
  }

  .ghost-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .kpi-grid,
  .viz-grid,
  .detail-grid,
  .mini-stats,
  .filter-grid,
  .trend-metrics {
    grid-template-columns: 1fr;
  }

  .segment-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .donut {
    width: 180px;
  }

  .hero,
  .filters,
  .card,
  .kpi-card {
    padding: 20px;
  }
}
