:root {
  --bg: #f4f6f3;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --ink: #16201c;
  --muted: #718078;
  --line: #e3e8e3;
  --green: #1c7c5b;
  --green-deep: #115c42;
  --green-soft: #e5f3ec;
  --coral: #e86f51;
  --coral-soft: #fbe9e4;
  --amber: #d29728;
  --amber-soft: #fbf1d9;
  --blue: #4c78c5;
  --blue-soft: #e9eef9;
  --danger: #c94d45;
  --shadow: 0 12px 40px rgba(30, 54, 43, 0.07);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 5%, rgba(184, 222, 199, 0.42), transparent 28rem),
    radial-gradient(circle at 5% 94%, rgba(246, 212, 175, 0.28), transparent 30rem),
    var(--bg);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(28, 124, 91, 0.24);
  outline-offset: 2px;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(5px);
}

.ambient-one {
  width: 20rem;
  height: 20rem;
  top: -8rem;
  right: 20%;
  background: rgba(207, 231, 212, 0.45);
}

.ambient-two {
  width: 13rem;
  height: 13rem;
  left: 28%;
  bottom: -8rem;
  background: rgba(247, 225, 191, 0.35);
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px 22px;
  border-right: 1px solid rgba(214, 222, 216, 0.8);
  background: rgba(248, 250, 247, 0.72);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  margin: 0 10px 34px;
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: 23px;
  font-weight: 760;
  letter-spacing: -0.7px;
  text-decoration: none;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 26px;
  height: 25px;
  padding: 5px;
  border-radius: 8px 8px 8px 3px;
  background: var(--green);
  transform: rotate(-3deg);
}

.brand-mark span {
  display: block;
  width: 2.5px;
  border-radius: 3px;
  background: white;
}

.brand-mark span:nth-child(1) { height: 5px; }
.brand-mark span:nth-child(2) { height: 10px; }
.brand-mark span:nth-child(3) { height: 7px; }
.brand-mark span:nth-child(4) { height: 14px; }
.brand-mark span:nth-child(5) { height: 9px; }

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-radius: 11px;
  color: #64736a;
  background: transparent;
  font-size: 14px;
  font-weight: 560;
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.nav-item:hover {
  color: var(--green-deep);
  background: rgba(225, 237, 229, 0.54);
}

.nav-item.active {
  color: var(--green-deep);
  background: #e2f0e7;
  font-weight: 680;
}

.nav-item.active::before {
  position: absolute;
  left: -20px;
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
  content: "";
}

.nav-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 99px;
  color: var(--danger);
  background: var(--coral-soft);
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.nav-badge:empty,
.nav-badge.zero {
  display: none;
}

.sidebar-spacer {
  flex: 1;
}

.live-status {
  margin-bottom: 20px;
  padding: 14px 13px 10px;
  border: 1px solid rgba(219, 227, 221, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.live-status-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 680;
}

.status-light {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #42ad78;
  box-shadow: 0 0 0 4px rgba(66, 173, 120, 0.12);
  animation: breathe 2s infinite;
}

@keyframes breathe {
  50% { box-shadow: 0 0 0 7px rgba(66, 173, 120, 0); }
}

.live-status p {
  margin: 7px 0 3px;
  color: #8a968f;
  font-size: 10px;
}

.live-status strong {
  color: #6a786f;
  font-weight: 600;
}

.pulse-line {
  height: 25px;
  overflow: hidden;
  opacity: 0.8;
}

.pulse-line svg {
  width: 100%;
  height: 100%;
}

.pulse-line path {
  fill: none;
  stroke: #60a881;
  stroke-width: 1.5;
  stroke-dasharray: 220;
  animation: trace 3s linear infinite;
}

@keyframes trace {
  from { stroke-dashoffset: 220; }
  to { stroke-dashoffset: 0; }
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
}

.profile-avatar {
  display: grid;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  color: #6b4b2b;
  background: #efe0c9;
  font-size: 13px;
  font-weight: 800;
  place-items: center;
}

.profile > div:nth-child(2) {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.profile strong {
  font-size: 12px;
}

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

.main-content {
  min-width: 0;
  padding: 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 108px;
  gap: 24px;
  border-bottom: 1px solid rgba(222, 228, 223, 0.78);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: 25px;
  font-weight: 730;
  letter-spacing: -0.7px;
}

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

.refresh-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 5px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

.refresh-control input {
  position: absolute;
  opacity: 0;
}

.switch {
  position: relative;
  width: 29px;
  height: 17px;
  border-radius: 99px;
  background: #cdd4cf;
  transition: 180ms ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  content: "";
  transition: 180ms ease;
}

.refresh-control input:checked + .switch {
  background: var(--green);
}

.refresh-control input:checked + .switch::after {
  transform: translateX(12px);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: 160ms ease;
}

.primary-button {
  color: white;
  background: var(--green);
  box-shadow: 0 4px 14px rgba(28, 124, 91, 0.16);
}

.primary-button:hover {
  background: var(--green-deep);
  transform: translateY(-1px);
}

.secondary-button {
  border-color: #dce3dd;
  background: rgba(255, 255, 255, 0.76);
}

.secondary-button:hover {
  border-color: #bdc9c0;
  background: white;
}

.danger-button {
  color: white;
  background: var(--danger);
}

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

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  place-items: center;
  cursor: pointer;
}

.icon-button.compact {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
}

.mobile-menu {
  display: none;
}

.view {
  animation: viewIn 280ms ease;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.hidden {
  display: none !important;
}

.welcome-row,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 0 24px;
}

.welcome-row h2,
.section-heading h2 {
  margin: 0 0 7px;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: 21px;
  letter-spacing: -0.5px;
}

.welcome-row p,
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.text-link {
  padding: 0;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: inherit;
  font-weight: 650;
  cursor: pointer;
}

.text-button {
  padding: 5px;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.text-button:hover {
  color: var(--green-deep);
}

.range-tabs,
.filter-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(219, 226, 220, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.range-tabs button,
.filter-tabs button {
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.range-tabs button.active,
.filter-tabs button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 2px 9px rgba(42, 67, 53, 0.08);
  font-weight: 650;
}

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

.kpi-card {
  position: relative;
  min-width: 0;
  padding: 19px 19px 16px;
  border: 1px solid rgba(224, 230, 225, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.kpi-card::after {
  position: absolute;
  right: -14px;
  bottom: -25px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--accent-soft);
  content: "";
  opacity: 0.55;
}

.kpi-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-label {
  color: #69776f;
  font-size: 11px;
  font-weight: 600;
}

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

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

.kpi-value {
  position: relative;
  z-index: 1;
  margin: 15px 0 12px;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: clamp(23px, 2.1vw, 31px);
  font-weight: 740;
  letter-spacing: -1px;
}

.kpi-value small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.kpi-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8a968f;
  font-size: 10px;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 680;
}

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

.delta.negative {
  color: var(--danger);
  background: var(--coral-soft);
}

.delta.neutral {
  color: var(--muted);
  background: #edf0ed;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
}

.primary-grid {
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 0.8fr);
  margin-bottom: 16px;
}

.secondary-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  margin-bottom: 28px;
}

.panel {
  min-width: 0;
  border: 1px solid rgba(224, 230, 225, 0.93);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.trend-panel,
.channel-panel,
.alerts-panel,
.goal-panel {
  min-height: 355px;
  padding: 21px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-kicker {
  margin: 0 0 5px;
  color: #95a098;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.panel h3 {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: 16px;
  letter-spacing: -0.3px;
}

.panel-actions {
  display: flex;
  gap: 7px;
}

.select {
  height: 30px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #516058;
  background: white;
  font-size: 10px;
  cursor: pointer;
}

.chart-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 18px 0 4px;
  font-size: 10px;
  color: #8a968f;
}

.chart-summary strong {
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.chart-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: 180px 25px;
  margin-top: 7px;
}

.y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 8px 0 0;
  color: #9ba49f;
  font-size: 8px;
  text-align: right;
}

.chart-canvas-wrap {
  position: relative;
  min-width: 0;
}

.trend-chart {
  display: block;
  width: 100%;
  height: 180px;
  overflow: visible;
}

.x-axis {
  grid-column: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-top: 6px;
  color: #9ba49f;
  font-size: 8px;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  display: none;
  min-width: 130px;
  padding: 9px 11px;
  border: 1px solid #dce4de;
  border-radius: 9px;
  color: #29342e;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 25px rgba(34, 54, 43, 0.14);
  font-size: 9px;
  pointer-events: none;
}

.chart-tooltip strong {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  color: #839087;
  font-size: 9px;
}

.chart-footer span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.donut-layout {
  display: flex;
  align-items: center;
  gap: 21px;
  padding: 28px 0 24px;
}

.donut {
  display: grid;
  width: 128px;
  height: 128px;
  flex: 0 0 128px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 35%, #78a879 35% 58%, #d8b25f 58% 79%, #7696cc 79% 93%, #caa88c 93% 100%);
  place-items: center;
}

.donut::before {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: white;
  content: "";
}

.donut > div {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.donut span {
  color: #8b9790;
  font-size: 8px;
}

.donut strong {
  font-size: 17px;
  letter-spacing: -0.6px;
}

.channel-legend {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: 7px 1fr auto;
  align-items: center;
  gap: 7px;
  font-size: 9px;
}

.legend-row i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-row span {
  color: #68756d;
}

.legend-row strong {
  font-size: 9px;
}

.channel-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border-radius: 10px;
  background: #f0f6f2;
}

.note-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 6px;
  color: var(--green);
  background: #dcece2;
  font-size: 10px;
  place-items: center;
}

.channel-note p {
  margin: 2px 0 0;
  color: #79867e;
  font-size: 9px;
  line-height: 1.6;
}

.channel-note strong {
  color: var(--green-deep);
}

.alert-list {
  display: flex;
  flex-direction: column;
  margin-top: 13px;
}

.alert-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid #edf0ed;
}

.alert-item:last-child {
  border-bottom: 0;
}

.alert-symbol {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  place-items: center;
}

.alert-symbol.critical {
  color: var(--danger);
  background: var(--coral-soft);
}

.alert-symbol.warning {
  color: #a06e14;
  background: var(--amber-soft);
}

.alert-symbol.info {
  color: var(--blue);
  background: var(--blue-soft);
}

.alert-copy {
  min-width: 0;
}

.alert-copy strong {
  display: block;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-copy p {
  margin: 4px 0 0;
  overflow: hidden;
  color: #8b978f;
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-time {
  color: #9ba59f;
  font-size: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.status-chip::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

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

.status-chip.pending {
  color: var(--danger);
  background: var(--coral-soft);
}

.status-chip.acknowledged {
  color: #a06e14;
  background: var(--amber-soft);
}

.status-chip.resolved {
  color: #75817a;
  background: #edf0ed;
}

.goal-period,
.data-note,
.live-chip {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #75817a;
  background: white;
  font-size: 9px;
}

.goal-content {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px 4px 22px;
}

.goal-ring {
  display: grid;
  width: 115px;
  height: 115px;
  flex: 0 0 115px;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--progress, 0%), #e9eee9 0);
  place-items: center;
}

.goal-ring::before {
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: white;
  content: "";
}

.goal-ring > div {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.goal-ring strong {
  font-size: 20px;
  letter-spacing: -0.7px;
}

.goal-ring span {
  margin-top: 2px;
  color: #8b9790;
  font-size: 8px;
}

.goal-stats {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
}

.goal-stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.goal-stats span {
  color: #8b9790;
  font-size: 8px;
}

.goal-stats strong {
  font-size: 14px;
}

.goal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: #89958d;
  font-size: 9px;
}

.goal-footer strong {
  color: var(--ink);
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 0 22px;
  border-top: 1px solid var(--line);
  color: #98a29c;
  font-size: 9px;
}

.app-footer strong {
  color: #728078;
  font-weight: 600;
}

.full-panel {
  padding: 22px;
  margin-bottom: 16px;
}

.compact {
  margin-bottom: 16px;
}

.dual-chart-wrap {
  position: relative;
  margin-top: 25px;
}

.dual-chart {
  display: block;
  width: 100%;
  height: 330px;
}

.dual-legend {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #78857d;
  font-size: 10px;
}

.dual-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  display: inline-block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
}

.legend-line.blue { background: var(--blue); }
.legend-line.coral { background: var(--coral); }
.legend-hint { margin-left: auto; color: #a0aaa4; }

.live-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
}

.live-chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #43a778;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.insight-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
}

.insight-card span {
  color: var(--muted);
  font-size: 10px;
}

.insight-card strong {
  display: block;
  margin: 9px 0 6px;
  font-size: 22px;
  letter-spacing: -0.7px;
}

.insight-card p {
  margin: 0;
  color: #87938b;
  font-size: 10px;
  line-height: 1.65;
}

.channel-detail-grid {
  grid-template-columns: 1fr 1fr;
}

.channel-detail-grid .panel {
  padding: 22px;
}

.channel-table {
  margin-top: 15px;
}

.channel-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) 1fr 1fr 1fr 1fr 0.8fr;
  align-items: center;
  min-width: 720px;
  padding: 15px 6px;
  border-bottom: 1px solid #edf0ed;
  font-size: 11px;
}

.channel-row.header {
  padding-top: 9px;
  padding-bottom: 9px;
  color: #94a098;
  font-size: 9px;
}

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

.channel-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
}

.channel-name i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.conversion-good {
  color: var(--green);
  font-weight: 650;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 25px;
}

.bar-row {
  display: grid;
  grid-template-columns: 68px 1fr 43px;
  align-items: center;
  gap: 10px;
  font-size: 10px;
}

.bar-row span {
  color: #68766d;
}

.bar-row strong {
  font-size: 10px;
  text-align: right;
}

.bar-track {
  height: 7px;
  border-radius: 99px;
  background: #edf1ed;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transform-origin: left;
  animation: barIn 500ms ease;
}

@keyframes barIn {
  from { transform: scaleX(0); }
}

.alert-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-bottom: 16px;
}

.summary-card {
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.65);
}

.summary-card span {
  color: var(--muted);
  font-size: 9px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.summary-card strong small {
  margin-left: 3px;
  color: #9aa39d;
  font-size: 9px;
  font-weight: 500;
}

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

.table-count {
  color: #8e9992;
  font-size: 10px;
}

.data-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 10px;
}

.data-table th {
  padding: 11px 12px;
  color: #94a098;
  background: #f8faf8;
  font-size: 9px;
  font-weight: 600;
  text-align: left;
}

.data-table th:first-child { border-radius: 8px 0 0 8px; }
.data-table th:last-child { border-radius: 0 8px 8px 0; }

.data-table td {
  padding: 15px 12px;
  border-bottom: 1px solid #edf0ed;
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #fbfcfb;
}

.severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 650;
}

.severity-badge::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.severity-badge.critical { color: var(--danger); }
.severity-badge.warning { color: #a06e14; }
.severity-badge.info { color: var(--blue); }

.alert-title-cell strong {
  display: block;
  font-size: 10px;
}

.alert-title-cell span {
  display: block;
  max-width: 330px;
  margin-top: 4px;
  color: #8d9991;
  font-size: 8px;
}

.table-action {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #5c6a62;
  background: white;
  font-size: 8px;
  cursor: pointer;
}

.table-action:hover {
  color: var(--green);
  border-color: #b8cfc0;
}

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

.rule-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(30, 54, 43, 0.045);
}

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

.rule-icon {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 15px;
  place-items: center;
}

.toggle {
  position: relative;
  width: 32px;
  height: 18px;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle i {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: #d5dcd7;
  cursor: pointer;
}

.toggle i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: 180ms ease;
}

.toggle input:checked + i {
  background: var(--green);
}

.toggle input:checked + i::after {
  transform: translateX(14px);
}

.rule-card h3 {
  margin: 18px 0 7px;
  font-size: 13px;
}

.rule-condition {
  margin: 0 0 18px;
  color: #7d8a82;
  font-size: 10px;
  line-height: 1.65;
}

.rule-condition strong {
  color: var(--ink);
}

.rule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 13px;
  border-top: 1px solid #edf0ed;
}

.rule-meta {
  color: #9aa39e;
  font-size: 8px;
}

.rule-actions {
  display: flex;
  gap: 3px;
}

.rule-action {
  padding: 4px 6px;
  border: 0;
  color: #6c7971;
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.rule-action.danger {
  color: var(--danger);
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 42px;
  color: #a3afa7;
}

.empty-state h3 {
  margin: 12px 0 6px;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 11px;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 41, 32, 0.22);
}

.modal::backdrop {
  background: rgba(25, 39, 31, 0.34);
  backdrop-filter: blur(3px);
}

.modal form,
.import-modal {
  padding: 23px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.modal h3 {
  margin: 0;
  font-size: 18px;
}

.field {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 15px;
}

.field > span {
  color: #5f6d65;
  font-size: 10px;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid #dbe2dc;
  border-radius: 9px;
  color: var(--ink);
  background: #fbfcfb;
  font-size: 11px;
}

.field input:focus,
.field select:focus {
  border-color: #8dbca2;
  background: white;
}

.field-row {
  display: flex;
  gap: 13px;
}

.input-suffix {
  position: relative;
}

.input-suffix span {
  position: absolute;
  top: 50%;
  right: 11px;
  color: #929e96;
  font-size: 9px;
  transform: translateY(-50%);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 6px 0 22px;
  padding: 14px;
  border-radius: 10px;
  background: #f6f8f6;
  cursor: pointer;
}

.switch-row span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.switch-row strong {
  font-size: 10px;
}

.switch-row small {
  color: #929d96;
  font-size: 8px;
}

.switch-row input {
  position: absolute;
  opacity: 0;
}

.switch-row i {
  position: relative;
  width: 34px;
  height: 19px;
  flex: 0 0 34px;
  border-radius: 99px;
  background: #cfd7d1;
}

.switch-row i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: 180ms ease;
}

.switch-row input:checked + i {
  background: var(--green);
}

.switch-row input:checked + i::after {
  transform: translateX(15px);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 5px;
}

.confirm-modal {
  width: min(380px, calc(100vw - 32px));
  text-align: center;
}

.confirm-modal form {
  padding: 28px;
}

.confirm-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: var(--danger);
  background: var(--coral-soft);
  font-weight: 800;
  place-items: center;
}

.confirm-modal p {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.confirm-modal .modal-footer {
  justify-content: center;
}

.drop-zone {
  padding: 28px 20px;
  border: 1.5px dashed #cbd6cf;
  border-radius: 13px;
  background: #f8faf8;
  text-align: center;
  transition: 160ms ease;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: var(--green-soft);
}

.drop-icon {
  display: grid;
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 18px;
  place-items: center;
}

.drop-zone strong {
  display: block;
  font-size: 12px;
}

.drop-zone p {
  margin: 7px 0 9px;
  color: var(--muted);
  font-size: 10px;
}

.drop-zone > span {
  color: #a0aaa3;
  font-size: 8px;
}

.csv-guide {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 9px;
  margin-top: 12px;
}

.csv-guide > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 9px;
  background: #f7f9f7;
}

.csv-guide strong {
  color: #6f7c74;
  font-size: 8px;
}

.csv-guide code {
  color: var(--green-deep);
  font-family: Consolas, monospace;
  font-size: 9px;
}

.import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 250px;
  padding: 12px 14px;
  border: 1px solid #dce4de;
  border-radius: 10px;
  color: #35433b;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 35px rgba(32, 50, 40, 0.16);
  font-size: 10px;
  animation: toastIn 200ms ease;
}

.toast::before {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  content: "✓";
  font-size: 9px;
  place-items: center;
}

.toast.error::before {
  content: "!";
  background: var(--danger);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .main-content { padding: 0 24px; }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .nav-item.active::before { left: -14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .primary-grid, .secondary-grid { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: repeat(2, 1fr); }
  .trend-panel, .channel-panel, .alerts-panel, .goal-panel { min-height: auto; }
  .donut-layout { justify-content: center; }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 50;
    width: 230px;
    transform: translateX(-105%);
    transition: 230ms ease;
    box-shadow: 20px 0 60px rgba(24, 39, 30, 0.15);
  }
  .sidebar.open { transform: none; }
  .main-content { padding: 0 18px; }
  .topbar { min-height: 92px; gap: 12px; }
  .mobile-menu {
    display: flex;
    width: 34px;
    height: 34px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: white;
  }
  .mobile-menu span { height: 1.5px; background: #526058; }
  .topbar > div:nth-child(2) { flex: 1; }
  .topbar h1 { font-size: 20px; }
  .refresh-control, .top-actions .secondary-button { display: none; }
  .welcome-row, .section-heading { align-items: flex-start; flex-direction: column; }
  .channel-detail-grid { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .alert-summary { grid-template-columns: repeat(2, 1fr); }
  .rules-grid { grid-template-columns: 1fr; }
  .dual-chart { height: 260px; }
  .legend-hint { display: none !important; }
}

@media (max-width: 520px) {
  .main-content { padding: 0 13px; }
  .topbar { min-height: 82px; }
  .topbar .eyebrow { display: none; }
  .top-actions { gap: 6px; }
  .primary-button, .secondary-button { padding: 0 11px; font-size: 10px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi-card { padding: 14px; border-radius: 13px; }
  .kpi-value { font-size: 21px; }
  .kpi-label { font-size: 9px; }
  .kpi-icon { width: 25px; height: 25px; }
  .kpi-bottom { flex-wrap: wrap; }
  .welcome-row { padding-top: 22px; }
  .trend-panel, .channel-panel, .alerts-panel, .goal-panel, .full-panel { padding: 16px; }
  .chart-wrap { grid-template-columns: 35px minmax(0, 1fr); }
  .donut-layout { flex-direction: column; }
  .donut { width: 118px; height: 118px; flex-basis: 118px; }
  .donut::before { width: 76px; height: 76px; }
  .channel-legend { width: 100%; }
  .goal-content { gap: 15px; }
  .goal-ring { width: 98px; height: 98px; flex-basis: 98px; }
  .goal-ring::before { width: 72px; height: 72px; }
  .goal-ring strong { font-size: 17px; }
  .goal-footer { align-items: flex-start; flex-direction: column; }
  .alert-summary { gap: 8px; }
  .summary-card { padding: 13px; }
  .data-table-wrap { margin: 0 -16px; }
  .field-row { flex-direction: column; gap: 0; }
  .app-footer { flex-direction: column; gap: 5px; }
  .toast-region { right: 12px; bottom: 12px; left: 12px; }
  .toast { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
