:root {
  --bg: #eef1f5;
  --panel: #fff;
  --panel-soft: #f7f9fc;
  --line: #e5e9f0;
  --line-strong: #d6dce6;
  --text: #1f2937;
  --muted: #667085;
  --subtle: #98a2b3;
  --orange: #ff8a00;
  --orange-soft: #fff4df;
  --green: #22c55e;
  --green-soft: #e9fbf0;
  --blue: #2f80ed;
  --blue-soft: #eaf3ff;
  --red: #ef4444;
  --red-soft: #fff1f1;
  --teal: #14b8a6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  color: #344054;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

a.button:hover {
  color: var(--blue);
  border-color: #b8d5ff;
}

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

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  padding: 10px 7px;
  background: #f8fafc;
  border-right: 1px solid var(--line);
}

.rail-brand {
  display: grid;
  place-items: center;
  width: 40px;
  height: 32px;
  margin-bottom: 20px;
  font-weight: 800;
  color: var(--orange);
}

.rail-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  min-height: 58px;
  padding: 4px 0;
  color: #344054;
  background: transparent;
  border: 0;
  border-radius: 8px;
  transition: color 0.42s ease, background 0.42s ease, box-shadow 0.42s ease, transform 0.42s ease;
}

.rail-btn + .rail-btn {
  margin-top: 4px;
}

.rail-btn.active {
  color: var(--orange);
  background: #fff;
  box-shadow: var(--shadow);
}

.rail-btn em {
  margin-top: 2px;
  font-size: 12px;
  font-style: normal;
}

.rail-btn b,
.top-actions b {
  position: absolute;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  background: #ff4d3d;
  border-radius: 9px;
}

.rail-btn b {
  top: 4px;
  right: 4px;
}

.rail-bottom {
  margin-top: auto;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 12px 10px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--line);
}

.tenant {
  height: 24px;
  overflow: hidden;
  color: #475467;
  font-size: 12px;
  white-space: nowrap;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  margin: 2px 0 8px;
}

.app-title strong {
  font-size: 16px;
}

.app-title button {
  flex: 1;
  min-width: 0;
  height: 28px;
  overflow: hidden;
  color: #344054;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #fff;
  border: 0;
}

.side-search {
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 8px;
  margin-bottom: 8px;
}

input,
select,
textarea {
  color: #344054;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}

input,
select {
  height: 30px;
  padding: 0 10px;
}

textarea {
  min-height: 92px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.6;
}

.side-search button,
.topbar button,
.toolbar button,
.card-title button,
.action-btn,
.icon-btn,
.modal button {
  height: 30px;
  color: #344054;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.menu-item,
.group-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  gap: 8px;
  padding: 0 8px;
  color: #243042;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 7px;
  transition: color 0.42s ease, background 0.42s ease, transform 0.42s ease;
}

.menu-item:hover,
.group-toggle:hover,
.sub-item:hover {
  background: #f4f6f9;
}

.menu-item.active,
.sub-item.active {
  font-weight: 700;
  background: var(--orange-soft);
}

.menu-item .badge {
  margin-left: auto;
  min-width: 16px;
  height: 16px;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  background: #ff4d3d;
  border-radius: 9px;
}

.group-toggle .chev {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #64748b;
  background: #edf1f7;
  border-radius: 50%;
}

.group-toggle .chev::before {
  content: "›";
  transform: rotate(90deg);
}

.group-toggle.collapsed .chev::before {
  transform: rotate(0deg);
}

.sub-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px;
}

.sub-list.collapsed {
  display: none;
}

.sub-item {
  display: flex;
  align-items: center;
  height: 30px;
  gap: 8px;
  padding: 0 8px 0 30px;
  color: #344054;
  text-decoration: none;
  border-radius: 6px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto auto;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.crumb {
  color: #344054;
  font-weight: 600;
}

.global-search {
  display: flex;
  align-items: center;
  gap: 6px;
}

.global-search input {
  width: 180px;
}

.top-actions {
  display: flex;
  gap: 6px;
  margin-left: 14px;
}

.top-actions button {
  position: relative;
  min-width: 30px;
  padding: 0 8px;
}

.top-actions b {
  top: -5px;
  right: -5px;
}

.avatar-mini {
  width: 30px;
  padding: 0 !important;
  color: #fff !important;
  background: #cbd5e1 !important;
  border-color: #cbd5e1 !important;
  border-radius: 50% !important;
}

.view {
  padding: 12px;
  animation: viewEnter 0.34s ease both;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 10px;
}

.page-head h1 {
  margin: 0;
  font-size: 18px;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar button.primary,
.primary {
  color: #fff !important;
  background: var(--orange) !important;
  border-color: var(--orange) !important;
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(600px, 1fr) 320px;
  gap: 10px;
}

.cards,
.dashboard-grid,
.stats-grid {
  display: grid;
  gap: 10px;
}

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

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: cardRise 0.42s ease both;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  border-color: #d8e6ff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid #f0f2f5;
}

.card-title h2 {
  flex: 1;
  margin: 0;
  font-size: 15px;
}

.card-body {
  padding: 12px;
}

.full-btn {
  justify-content: center;
  width: 100%;
}

.import-card .card-body {
  display: grid;
  gap: 10px;
}

.import-card .field {
  margin-bottom: 0;
}

.import-card .admin-note {
  margin-bottom: 0;
  font-size: 12px;
}

.import-card .rfm-mini {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 8px;
}

.import-card .rfm-mini div {
  min-height: 54px;
}

.import-card .rfm-mini strong {
  font-size: 18px;
}

.stat-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  min-height: 82px;
  padding: 14px;
}

.stat-card .num {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 600;
}

.stat-card em {
  display: inline-flex;
  margin-top: 4px;
  color: #16a34a;
  font-size: 12px;
  font-style: normal;
}

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

.round-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
}

.round-icon.green {
  background: var(--green);
}

.round-icon.orange {
  background: var(--orange);
}

.round-icon.teal {
  background: var(--teal);
}

.funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}

.funnel-row {
  display: grid;
  place-items: center;
  width: var(--w);
  height: 38px;
  padding: 0 18px;
  color: #fff;
  text-align: center;
  font-weight: 700;
  background: var(--c);
  clip-path: polygon(4% 0, 96% 0, 88% 100%, 12% 100%);
  animation: funnelIn 0.58s ease both;
  transition: filter 0.18s ease, transform 0.18s ease;
}

.funnel-row:hover {
  filter: saturate(1.14) brightness(1.03);
  transform: scale(1.015);
}

.chart-list,
.timeline,
.mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chart-list li,
.mini-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f5;
}

.bar {
  height: 8px;
  margin-top: 5px;
  overflow: hidden;
  background: #edf1f7;
  border-radius: 99px;
}

.bar span {
  display: block;
  width: var(--p);
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  animation: barGrow 0.72s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  height: 42px;
  padding: 0 12px;
  text-align: left;
  border-bottom: 1px solid #eef1f5;
}

th {
  color: #475467;
  font-weight: 600;
  background: #f8fafc;
}

td {
  color: #344054;
}

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

.table-actions button {
  height: 26px;
  color: #2563eb;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  color: #475467;
  background: #f2f4f7;
  border-radius: 10px;
}

.tag.green {
  color: #15803d;
  background: var(--green-soft);
}

.tag.orange {
  color: #b45309;
  background: var(--orange-soft);
}

.tag.blue {
  color: #1d4ed8;
  background: var(--blue-soft);
}

.tag.red {
  color: #b91c1c;
  background: var(--red-soft);
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.tabs button {
  height: 32px;
  padding: 0 12px;
  color: #344054;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.tabs button.active {
  color: var(--orange);
  background: var(--orange-soft);
  border-color: #ffd591;
}

.birthday-grid {
  display: grid;
  grid-template-columns: 300px minmax(420px, 1fr) 320px;
  gap: 10px;
}

.customer-card {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 8px;
}

.customer-card.active {
  background: #e9fbf6;
  border-color: #99f6e4;
}

.name-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  font-weight: 700;
  background: #0f766e;
  border-radius: 50%;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  color: #475467;
  font-size: 13px;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.modal {
  width: min(620px, calc(100vw - 40px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.34);
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
}

.modal-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 14px;
}

.modal-foot {
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.phone-modal {
  width: 370px;
}

.phone {
  width: 260px;
  min-height: 420px;
  margin: 18px auto 24px;
  padding: 18px 14px;
  background: #f2f5f9;
  border: 8px solid #263241;
  border-radius: 28px;
}

.phone-speaker {
  width: 70px;
  height: 5px;
  margin: 0 auto 24px;
  background: #667085;
  border-radius: 8px;
}

.bubble {
  padding: 12px;
  line-height: 1.6;
  background: #fff;
  border-radius: 8px;
}

.ticket {
  margin-top: 12px;
  padding: 14px;
  color: #7c2d12;
  background: #ffedd5;
  border: 1px dashed #fb923c;
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 16px;
  color: #fff;
  visibility: hidden;
  background: #1f2937;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
}

.toast.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(420px, 1fr);
  gap: 10px;
}

.admin-grid .card:first-child {
  grid-row: span 2;
}

.admin-note {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.visual-editor {
  margin: 10px 0;
}

.visual-table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.visual-table {
  min-width: 860px;
}

.visual-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.visual-table input {
  width: 100%;
  min-width: 120px;
}

.admin-imports {
  display: grid;
  gap: 10px;
}

.code-editor {
  width: 100%;
  min-height: 520px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.55;
  color: #1f2937;
  background: #fbfcfe;
}

.code-editor.small {
  min-height: 220px;
}

.loading-stage {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 360px;
  color: #475467;
}

.loader-ring {
  width: 46px;
  height: 46px;
  border: 4px solid #dbeafe;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.86s linear infinite;
}

.loading-stage span {
  width: min(420px, 80%);
  height: 10px;
  overflow: hidden;
  background: #e6eaf1;
  border-radius: 99px;
}

.loading-stage span::before {
  display: block;
  width: 40%;
  height: 100%;
  content: "";
  background: linear-gradient(90deg, transparent, #fff, transparent);
  animation: shimmer 1.1s ease infinite;
}

.dashboard-screen {
  display: grid;
  gap: 10px;
}

.dashboard-screen .page-head {
  margin-bottom: 0;
}

.screen-metrics {
  display: grid;
  grid-template-columns: repeat(8, minmax(112px, 1fr));
  gap: 8px;
}

.metric-tile {
  position: relative;
  min-height: 72px;
  padding: 10px 11px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: cardRise 0.42s ease both;
}

.metric-tile::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--blue);
}

.metric-tile.green::before {
  background: var(--green);
}

.metric-tile.orange::before {
  background: var(--orange);
}

.metric-tile.teal::before {
  background: var(--teal);
}

.metric-tile small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-tile strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: #111827;
  font-size: 20px;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.metric-tile em {
  display: block;
  margin-top: 5px;
  color: #16a34a;
  font-size: 12px;
  font-style: normal;
}

.screen-grid {
  display: grid;
  grid-template-columns: minmax(330px, 1.2fr) minmax(310px, 1fr) minmax(280px, 0.92fr);
  grid-auto-flow: dense;
  gap: 10px;
}

.screen-card {
  min-height: 0;
}

.screen-card.span-2 {
  grid-column: span 2;
}

.screen-card.span-3 {
  grid-column: span 3;
}

.screen-card .card-title {
  min-height: 36px;
  padding: 0 10px;
}

.screen-card .card-title h2 {
  font-size: 14px;
}

.screen-card .card-body {
  padding: 10px;
}

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

.trend-pair > div {
  min-width: 0;
}

.trend-pair span {
  display: block;
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.echart {
  width: 100%;
  min-width: 0;
}

.trend-chart {
  height: 152px;
}

.pie-chart {
  height: 132px;
}

.funnel-chart {
  height: 202px;
}

.china-chart {
  height: 340px;
  background: #f8fbff;
  border-radius: 6px;
}

.compact-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  gap: 10px;
  align-items: stretch;
}

.region-distribution-panel {
  min-width: 0;
  height: 340px;
  padding: 8px;
  overflow: hidden;
  background: #fbfcfe;
  border: 1px solid #edf1f7;
  border-radius: 6px;
}

.region-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid #edf1f7;
}

.region-summary strong {
  color: #1d2939;
  font-size: 12px;
}

.region-summary span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.region-chip-grid {
  display: grid;
  gap: 5px;
  max-height: 296px;
  padding: 7px 2px 2px 0;
  overflow: auto;
}

.region-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 22px;
  padding: 4px 6px;
  background: #fff;
  border: 1px solid #edf1f7;
  border-radius: 5px;
}

.region-chip span {
  min-width: 0;
  overflow: hidden;
  color: #344054;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.region-chip strong {
  color: #1d4ed8;
  font-size: 11px;
  white-space: nowrap;
}


.dashboard-screen .line-chart {
  height: 148px;
}

.dashboard-screen .donut-wrap {
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 9px;
}

.dashboard-screen .donut {
  width: 94px;
  height: 94px;
}

.dashboard-screen .mini-list {
  gap: 5px;
}

.dashboard-screen .mini-list li {
  min-height: 34px;
  padding: 6px 0;
}

.dashboard-screen .mini-list small {
  color: var(--muted);
  font-size: 11px;
}

.funnel.compact {
  padding: 4px 0;
}

.funnel.compact .funnel-row {
  height: 31px;
  font-size: 12px;
}

.ticket-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 8px 14px;
}

.ticket-strip li {
  border-bottom: 0;
  border-left: 3px solid #dbeafe;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 6px;
}

.dashboard-stats {
  margin-bottom: 10px;
}

.dashboard-grid.dense {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}

.dashboard-grid .wide {
  min-height: 240px;
}

.line-chart {
  width: 100%;
  height: 180px;
  overflow: visible;
}

.line-chart text {
  fill: #98a2b3;
  font-size: 9px;
  text-anchor: middle;
}

.line-path {
  fill: none;
  stroke: var(--line);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 640;
  stroke-dashoffset: 640;
  animation: drawLine 1.2s ease forwards;
}

.line-area {
  opacity: 0;
  animation: fadeIn 0.6s ease 0.5s forwards;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.donut {
  width: 118px;
  height: 118px;
  transform: rotate(-90deg);
}

.donut circle {
  fill: none;
  stroke-width: 5;
  animation: donutIn 0.9s ease both;
}

.donut-hole {
  fill: #fff !important;
  stroke: #edf1f7 !important;
  stroke-width: 1 !important;
}

.rfm-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 10px;
}

.rfm-cell {
  display: grid;
  place-items: center;
  min-height: 76px;
  padding: 10px;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc, #eef6ff);
  border: 1px solid #dbeafe;
  border-radius: 8px;
  animation: cardRise 0.42s ease both;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.rfm-cell:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
}

.rfm-cell strong {
  color: #1d4ed8;
  font-size: 24px;
}

.rfm-cell span {
  color: var(--muted);
  font-size: 12px;
}

.rfm-mini {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.rfm-mini div {
  min-height: 62px;
  padding: 8px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid #edf1f7;
  border-radius: 8px;
}

.rfm-mini strong {
  display: block;
  color: #1d4ed8;
  font-size: 22px;
}

.rfm-mini span {
  color: var(--muted);
  font-size: 12px;
}

.rfm-import-card {
  margin-bottom: 10px;
}

.rfm-model-card {
  margin-bottom: 10px;
}

.rfm-model-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.rfm-model-summary div,
.rfm-segment-rule-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e1e8f4;
  border-radius: 8px;
  background: #f8fbff;
  animation: cardRise 0.42s ease both;
}

.rfm-model-summary strong,
.rfm-segment-rule-grid strong {
  display: block;
  margin-bottom: 6px;
  color: #1d4ed8;
  font-size: 14px;
}

.rfm-model-summary span,
.rfm-segment-rule-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.rfm-quantile-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 8px;
}

.rfm-quantile-bar span {
  display: grid;
  gap: 4px;
  min-height: 56px;
  padding: 9px;
  background: linear-gradient(180deg, #eaf2ff, #f8fbff);
  border: 1px solid #dbeafe;
  text-align: center;
}

.rfm-quantile-bar span:nth-child(1) {
  background: #e8f7ef;
  border-color: #bfe8cf;
}

.rfm-quantile-bar span:nth-child(2) {
  background: #eef8ff;
}

.rfm-quantile-bar span:nth-child(4) {
  background: #fff7e8;
  border-color: #fde2ad;
}

.rfm-quantile-bar span:nth-child(5) {
  background: #fff0f0;
  border-color: #ffd0d0;
}

.rfm-quantile-bar b {
  color: #172033;
  font-size: 14px;
}

.rfm-quantile-bar em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rfm-model-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
  padding: 12px;
  border: 1px dashed #b8cef4;
  border-radius: 8px;
  background: #f3f8ff;
}

.rfm-model-editor label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.rfm-model-editor label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.rfm-model-editor input {
  width: 100%;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid #d8e0ec;
  border-radius: 6px;
  background: #fff;
  outline: none;
  transition: border-color 0.36s ease, box-shadow 0.36s ease;
}

.rfm-model-editor input:focus {
  border-color: #2f80ed;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12);
}

.rfm-segment-rule-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.rfm-model-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eefaf7;
  color: #087b6d;
  font-size: 13px;
  line-height: 1.6;
}

.rfm-import-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1.4fr);
  gap: 10px;
  align-items: center;
}

.rfm-import-row span,
.loading-inline {
  color: var(--muted);
  font-size: 12px;
}

.rfm-import-result {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.rfm-import-result .table-card {
  max-height: 420px;
  overflow: auto;
}

.rfm-center-panel {
  margin-bottom: 10px;
  overflow: hidden;
}

.rfm-center-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #edf1f7;
  background: #fff;
}

.rfm-center-panel-head h2 {
  margin: 0 0 4px;
  color: #2563eb;
  font-size: 19px;
  letter-spacing: 0;
}

.rfm-center-panel-head p,
.rfm-center-panel-head span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.rfm-center-panel-head strong {
  color: #111827;
}

.rfm-center-compact {
  display: grid;
  grid-template-columns: minmax(300px, 0.86fr) minmax(560px, 1.6fr);
  gap: 14px;
  padding: 14px;
}

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

.rfm-panel-block,
.rfm-result-card.compact,
.rfm-kpi-row.compact article {
  border: 1px solid #e0e6ef;
  border-radius: 8px;
  background: #fff;
}

.rfm-panel-block {
  padding: 14px;
}

.rfm-panel-block h3,
.rfm-result-card.compact h3 {
  position: relative;
  margin: 0 0 12px;
  padding-left: 12px;
  color: #172033;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
}

.rfm-panel-block h3::before,
.rfm-result-card.compact h3::before {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  width: 3px;
  background: #2f64df;
  content: "";
}

.rfm-threshold-control,
.rfm-panel-block .rfm-weight-control {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.rfm-threshold-control:last-child,
.rfm-panel-block .rfm-weight-control:last-of-type {
  margin-bottom: 0;
}

.rfm-threshold-control span,
.rfm-panel-block .rfm-weight-control span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #111827;
  font-size: 13px;
}

.rfm-threshold-control b,
.rfm-panel-block .rfm-weight-control b {
  color: #2563eb;
  font-weight: 800;
}

.rfm-threshold-control input[type="number"] {
  width: 100%;
  height: 34px;
  padding: 7px 10px;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  background: #fff;
  outline: none;
}

.rfm-threshold-control input[type="number"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rfm-threshold-control em {
  color: #98a2b3;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.rfm-panel-block .rfm-weight-control input[type="range"] {
  width: 100%;
  accent-color: #2f64df;
}

.rfm-panel-block .rfm-weight-control input[type="number"] {
  width: 100%;
  height: 34px;
  padding: 7px 10px;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  background: #fff;
  outline: none;
}

.rfm-panel-block .rfm-weight-control input[type="number"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rfm-panel-block .rfm-compute-btn {
  width: 100%;
  height: 38px;
  margin-top: 4px;
  border: 0;
  border-radius: 7px;
  background: #2f64df;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.rfm-panel-block .rfm-compute-status {
  margin-top: 8px;
  color: #8a95a6;
  font-size: 12px;
  text-align: center;
}

.rfm-result-compact {
  display: grid;
  gap: 12px;
  min-width: 0;
}

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

.rfm-kpi-row.compact article {
  min-height: 72px;
  padding: 12px 14px;
}

.rfm-kpi-row.compact span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.rfm-kpi-row.compact strong {
  color: #111827;
  font-size: 22px;
  line-height: 1;
}

.rfm-kpi-row.compact strong.green {
  color: #059669;
}

.rfm-kpi-row.compact strong.blue {
  color: #2563eb;
}

.rfm-kpi-row.compact strong.orange {
  color: #f97316;
}

.rfm-result-card.compact {
  padding: 14px;
}

.rfm-detail-card {
  margin-top: 14px;
  overflow: hidden;
}

.rfm-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #edf1f7;
  background: #fff;
}

.rfm-detail-head h2 {
  margin: 0 0 5px;
  color: #172033;
  font-size: 17px;
  letter-spacing: 0;
}

.rfm-detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.rfm-detail-head button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #d7dfec;
  border-radius: 6px;
  background: #fff;
  color: #344054;
}

.rfm-detail-table {
  max-height: 520px;
  overflow: auto;
  padding: 0;
}

.rfm-detail-table table {
  min-width: 1120px;
}

.rfm-detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}

.rfm-result-content.compact {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.rfm-donut.compact {
  width: 220px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--rfm-donut));
  position: relative;
}

.rfm-donut.compact::after {
  position: absolute;
  inset: 42px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.rfm-result-card.compact .rfm-segment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rfm-result-card.compact .rfm-segment-table th,
.rfm-result-card.compact .rfm-segment-table td {
  padding: 8px 0;
}

.rfm-result-card.compact .rfm-segment-table i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
}

.rfm-result-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #cfd8e7;
  border-radius: 8px;
  background: #f8fafc;
  color: #667085;
  font-size: 14px;
  text-align: center;
}

.rfm-center-page {
  min-height: calc(100vh - 68px);
  margin: -18px;
  padding: 0 0 28px;
  background: #f4f6f8;
  color: #101828;
}

.rfm-center-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 36px 16px;
  background: #fff;
  border-bottom: 1px solid #dfe4ea;
}

.rfm-center-header h1 {
  margin: 0 0 6px;
  color: #2563eb;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.rfm-center-header p,
.rfm-center-header div:last-child {
  margin: 0;
  color: #586579;
  font-size: 14px;
}

.rfm-center-header strong {
  color: #101828;
  font-size: 15px;
}

.rfm-center-layout {
  display: grid;
  grid-template-columns: 395px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 36px 0;
}

.rfm-config-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

.rfm-config-card,
.rfm-result-card,
.rfm-kpi-row article {
  border: 1px solid #d9dee7;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

.rfm-config-card {
  padding: 20px;
}

.rfm-config-card h2,
.rfm-result-card h2 {
  position: relative;
  margin: 0 0 18px;
  padding-left: 16px;
  color: #101828;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.rfm-config-card h2::before,
.rfm-result-card h2::before {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  width: 4px;
  background: #2f64df;
  content: "";
}

.rfm-config-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.rfm-config-card label:last-child {
  margin-bottom: 0;
}

.rfm-config-card label span,
.rfm-weight-control span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #101828;
  font-size: 14px;
}

.rfm-config-card label b,
.rfm-weight-control b {
  color: #2563eb;
  font-weight: 800;
}

.rfm-config-card input[type="number"] {
  width: 100%;
  height: 38px;
  padding: 8px 12px;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  background: #fff;
  color: #101828;
  font-size: 14px;
  outline: none;
}

.rfm-config-card input[type="number"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rfm-config-card em {
  color: #98a2b3;
  font-size: 12px;
  font-style: normal;
}

.rfm-weight-control {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.rfm-weight-control input[type="range"] {
  width: 100%;
  accent-color: #2f64df;
}

.rfm-compute-btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 7px;
  background: #2f64df;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.rfm-compute-status {
  color: #8a95a6;
  font-size: 13px;
  text-align: center;
}

.rfm-result-area {
  display: grid;
  gap: 16px;
  align-content: start;
}

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

.rfm-kpi-row article {
  min-height: 90px;
  padding: 18px;
}

.rfm-kpi-row span {
  display: block;
  margin-bottom: 8px;
  color: #586579;
  font-size: 14px;
}

.rfm-kpi-row strong {
  color: #101828;
  font-size: 26px;
  line-height: 1;
}

.rfm-kpi-row strong.green {
  color: #059669;
}

.rfm-kpi-row strong.blue {
  color: #2563eb;
}

.rfm-kpi-row strong.orange {
  color: #f97316;
}

.rfm-result-card {
  padding: 20px;
}

.rfm-result-content {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 36px;
  align-items: center;
}

.rfm-donut {
  width: 300px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--rfm-donut));
  position: relative;
}

.rfm-donut::after {
  position: absolute;
  inset: 53px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.rfm-segment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rfm-segment-table th,
.rfm-segment-table td {
  padding: 12px 0;
  border-bottom: 1px solid #e7ebf0;
  text-align: right;
}

.rfm-segment-table th:first-child,
.rfm-segment-table td:first-child {
  text-align: left;
}

.rfm-segment-table th {
  color: #344054;
  font-weight: 500;
}

.rfm-segment-table td {
  color: #101828;
}

.rfm-segment-table td:nth-child(3),
.rfm-segment-table td:nth-child(4) {
  color: #586579;
}

.rfm-segment-table i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

@media (max-width: 1180px) {
  .rfm-center-compact,
  .rfm-threshold-grid,
  .rfm-center-layout,
  .rfm-result-content {
    grid-template-columns: 1fr;
  }

  .rfm-result-content.compact {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

@media (max-width: 720px) {
  .rfm-center-page {
    margin: -12px;
  }

  .rfm-center-header {
    flex-direction: column;
    padding: 16px;
  }

  .rfm-center-layout {
    padding: 16px;
  }

  .rfm-kpi-row {
    grid-template-columns: 1fr;
  }

  .rfm-center-panel-head {
    flex-direction: column;
  }

  .rfm-center-compact {
    padding: 10px;
  }

  .rfm-kpi-row.compact,
  .rfm-result-content.compact {
    grid-template-columns: 1fr;
  }

  .rfm-donut {
    width: min(300px, 100%);
  }

  .rfm-donut.compact {
    width: min(220px, 100%);
    justify-self: center;
  }
}

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

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

@keyframes barGrow {
  from {
    width: 0;
  }
  to {
    width: var(--p);
  }
}

@keyframes funnelIn {
  from {
    opacity: 0;
    transform: scaleX(0.8);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes donutIn {
  from {
    stroke-dasharray: 0 100;
  }
}

@keyframes mapIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes mapPointIn {
  from {
    opacity: 0;
    transform: scale(0.45);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes mapPulse {
  0%,
  100% {
    fill: rgba(255, 138, 0, 0.16);
    stroke-width: 2;
  }
  50% {
    fill: rgba(47, 128, 237, 0.18);
    stroke-width: 3;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(260%);
  }
}

.i {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  transition: color 0.48s ease, opacity 0.48s ease, transform 0.48s ease;
}

button:hover .i,
.menu-item:hover .i,
.sub-item:hover .i,
.rail-btn:hover .i {
  transform: scale(1.08);
}

.i::before,
.i::after {
  position: absolute;
  content: "";
}

.i-home::before {
  inset: 5px 3px 2px;
  border: 2px solid var(--orange);
  border-top: 0;
}

.i-home::after {
  left: 3px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-left: 2px solid var(--orange);
  border-top: 2px solid var(--orange);
  transform: rotate(45deg);
}

.i-bell::before {
  left: 4px;
  top: 2px;
  width: 10px;
  height: 12px;
  border: 2px solid var(--orange);
  border-radius: 10px 10px 4px 4px;
}

.i-bell::after {
  left: 7px;
  bottom: 1px;
  width: 4px;
  height: 4px;
  background: var(--orange);
  border-radius: 50%;
}

.i-check::before {
  left: 3px;
  top: 3px;
  width: 12px;
  height: 12px;
  border: 2px solid #22c55e;
  border-radius: 50%;
}

.i-check::after {
  left: 6px;
  top: 8px;
  width: 7px;
  height: 3px;
  border-left: 2px solid #22c55e;
  border-bottom: 2px solid #22c55e;
  transform: rotate(-45deg);
}

.i-chart::before,
.i-report::before,
.i-theme::before,
.i-log::before,
.i-order::before,
.i-product::before,
.i-grid::before {
  inset: 2px;
  border: 2px solid #2f80ed;
  border-radius: 2px;
}

.i-chart::after {
  left: 5px;
  bottom: 4px;
  width: 2px;
  height: 7px;
  background: #2f80ed;
  box-shadow: 4px -3px 0 #2f80ed, 8px -6px 0 #2f80ed;
}

.i-report::after {
  left: 5px;
  top: 6px;
  width: 8px;
  height: 2px;
  background: #2f80ed;
  box-shadow: 0 4px 0 #2f80ed;
}

.i-lock::before {
  left: 4px;
  top: 8px;
  width: 10px;
  height: 7px;
  border: 2px solid #2f80ed;
}

.i-lock::after {
  left: 6px;
  top: 2px;
  width: 6px;
  height: 8px;
  border: 2px solid #2f80ed;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.i-subscribe::before {
  left: 3px;
  top: 3px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--orange);
  border-radius: 2px;
}

.i-subscribe::after {
  left: 7px;
  top: 2px;
  width: 4px;
  height: 14px;
  background: var(--orange);
}

.i-market::before {
  left: 2px;
  top: 5px;
  width: 12px;
  height: 8px;
  border-left: 2px solid var(--orange);
  border-top: 2px solid var(--orange);
  border-bottom: 2px solid var(--orange);
}

.i-market::after {
  right: 1px;
  top: 2px;
  border-left: 8px solid var(--orange);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.i-user::before,
.i-customer::before {
  left: 6px;
  top: 2px;
  width: 6px;
  height: 6px;
  border: 2px solid #ef4444;
  border-radius: 50%;
}

.i-user::after,
.i-customer::after {
  left: 3px;
  top: 10px;
  width: 12px;
  height: 6px;
  border: 2px solid #ef4444;
  border-radius: 10px 10px 0 0;
}

.i-lead::before {
  left: 2px;
  top: 5px;
  width: 14px;
  height: 8px;
  border-top: 2px solid #22c55e;
  border-bottom: 2px solid #22c55e;
}

.i-lead::after {
  left: 3px;
  top: 3px;
  width: 4px;
  height: 4px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 6px 4px 0 #22c55e, 12px 8px 0 #22c55e;
}

.i-money::before {
  inset: 3px;
  border: 2px solid #22c55e;
  border-radius: 50%;
}

.i-money::after {
  left: 8px;
  top: 4px;
  width: 2px;
  height: 10px;
  background: #22c55e;
}

.i-crm::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.i-crm::after {
  left: 6px;
  top: 6px;
  width: 2px;
  height: 2px;
  background: currentColor;
  box-shadow: 4px 0 0 currentColor, 0 4px 0 currentColor, 4px 4px 0 currentColor;
}

.i-task::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.i-task::after {
  left: 5px;
  top: 8px;
  width: 7px;
  height: 3px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.i-calendar::before {
  inset: 3px 2px 2px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.i-calendar::after {
  left: 4px;
  top: 7px;
  width: 10px;
  height: 2px;
  background: currentColor;
}

.i-chat::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.i-chat::after {
  left: 5px;
  bottom: 1px;
  border-top: 6px solid currentColor;
  border-right: 6px solid transparent;
}

.i-gear::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.i-gear::after {
  left: 8px;
  top: 0;
  width: 2px;
  height: 18px;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
}

.i-search::before {
  left: 2px;
  top: 2px;
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.i-search::after {
  left: 11px;
  top: 12px;
  width: 7px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.i-refresh::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.i-refresh::after {
  right: 1px;
  top: 3px;
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 56px 190px minmax(0, 1fr);
  }

  .layout-2,
  .birthday-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .dashboard-grid.dense {
    grid-template-columns: 1fr;
  }

  .screen-metrics {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .screen-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .compact-map {
    grid-template-columns: 1fr;
  }

  .region-distribution-panel {
    height: 220px;
  }

  .region-chip-grid {
    max-height: 176px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .screen-card.span-3 {
    grid-column: span 2;
  }

  .ticket-strip {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

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

  .rail {
    display: none;
  }

  .sidebar {
    padding: 10px 8px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    height: auto;
    padding: 8px;
  }

  .global-search,
  .top-actions {
    margin-left: 0;
  }

  .global-search input {
    width: 100%;
  }

  .view {
    padding: 8px;
  }

  .stats-grid,
  .dashboard-grid,
  .form-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid .card:first-child {
    grid-row: auto;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .rfm-mini {
    grid-template-columns: repeat(2, minmax(80px, 1fr));
  }

  .rfm-model-summary,
  .rfm-quantile-bar,
  .rfm-model-editor,
  .rfm-segment-rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .trend-pair {
    grid-template-columns: 1fr;
  }

  .screen-card.span-2,
  .screen-card.span-3 {
    grid-column: span 2;
  }

  .region-chip-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-screen .donut-wrap {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 7px;
  }

  .dashboard-screen .donut {
    width: 70px;
    height: 70px;
  }

  .trend-chart {
    height: 130px;
  }

  .pie-chart {
    height: 120px;
  }

  .funnel-chart {
    height: 176px;
  }

  .china-chart {
    height: 300px;
  }

  .screen-card .card-title {
    padding: 0 8px;
  }

  .screen-card .card-title h2 {
    font-size: 13px;
  }

  .rfm-import-row {
    grid-template-columns: 1fr;
  }

  .dashboard-screen .mini-list li {
    gap: 6px;
  }

}

@media (max-width: 520px) {
  .screen-metrics,
  .screen-grid,
  .ticket-strip {
    grid-template-columns: 1fr;
  }

  .screen-card.span-2,
  .screen-card.span-3 {
    grid-column: auto;
  }
}

.automation-workflow-page {
  display: grid;
  gap: 16px;
  color: #172033;
}

.automation-workflow-page * {
  box-sizing: border-box;
}

.automation-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.automation-steps,
.automation-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.automation-steps {
  padding: 12px;
  animation: automation-rise 0.58s ease both;
}

.automation-panel-title {
  margin-bottom: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.automation-step {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  width: 100%;
  gap: 2px 10px;
  min-height: 82px;
  margin: 0 0 8px;
  padding: 12px;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  text-align: left;
  cursor: pointer;
  transition: transform 0.42s ease, border-color 0.42s ease, background 0.42s ease, box-shadow 0.42s ease;
}

.automation-step:hover {
  transform: translateY(-2px);
  border-color: #b9cdf7;
  background: #fff;
  box-shadow: 0 12px 24px rgba(31, 103, 224, 0.11);
}

.automation-step.active {
  border-color: #1f67e0;
  background: #eef5ff;
}

.automation-step span {
  display: grid;
  grid-row: span 3;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e4eaf4;
  color: #667085;
  font-weight: 800;
}

.automation-step.active span {
  background: #1f67e0;
  color: #fff;
}

.automation-step strong {
  overflow: hidden;
  color: #172033;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-step em {
  color: #667085;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.automation-step b {
  justify-self: start;
  color: #12a594;
  font-size: 12px;
}

.automation-builder {
  min-width: 0;
  animation: automation-rise 0.64s ease both;
}

.automation-form-card {
  padding: 20px;
}

.automation-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #edf1f7;
}

.automation-card-head span {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.automation-card-head h3 {
  margin: 6px 0 6px;
  font-size: 22px;
  letter-spacing: 0;
}

.automation-card-head p {
  margin: 0;
  color: #667085;
}

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

.automation-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.automation-field span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.automation-field input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #d8e0ec;
  border-radius: 6px;
  background: #fbfcff;
  color: #172033;
  outline: none;
  transition: border-color 0.42s ease, box-shadow 0.42s ease, background 0.42s ease;
}

.automation-field input:focus {
  border-color: #1f67e0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 103, 224, 0.12);
}

.automation-rule-box {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #d9ecff;
  border-radius: 8px;
  background: #f5faff;
}

.automation-rule-box strong {
  display: block;
  margin-bottom: 6px;
  color: #1f67e0;
}

.automation-rule-box p {
  margin: 0;
  color: #475467;
  line-height: 1.7;
}

.automation-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.automation-summary {
  display: grid;
  gap: 16px;
  animation: automation-rise 0.7s ease both;
}

.automation-summary .automation-card {
  padding: 16px;
}

.automation-summary dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.automation-summary dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f6;
}

.automation-summary dt {
  color: #667085;
  font-size: 12px;
}

.automation-summary dd {
  margin: 0;
  color: #172033;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.automation-roi-card p {
  margin: 12px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.6;
}

.automation-gauge {
  position: relative;
  display: grid;
  place-items: center;
  width: 154px;
  height: 154px;
  margin: 4px auto 0;
  border-radius: 50%;
  background: conic-gradient(#1f67e0 0 var(--p), #e8edf5 var(--p) 100%);
}

.automation-gauge::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #fff;
}

.automation-gauge strong {
  position: relative;
  z-index: 1;
  color: #172033;
  font-size: 18px;
}

.automation-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
  animation: automation-rise 0.54s ease both;
}

.automation-flow {
  display: grid;
  justify-items: center;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background:
    linear-gradient(#f8fafc 1px, transparent 1px),
    linear-gradient(90deg, #f8fafc 1px, transparent 1px),
    #fff;
  background-size: 28px 28px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.flow-node {
  display: grid;
  gap: 5px;
  width: min(520px, 100%);
  min-height: 70px;
  padding: 14px 18px;
  border: 1px solid #cfd9ea;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.flow-node b {
  color: #172033;
  font-size: 15px;
}

.flow-node span {
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.flow-node.start,
.flow-node.end {
  border-color: #1f67e0;
  background: #eef5ff;
}

.flow-node.data {
  border-color: #12a594;
  background: #edfbf8;
}

.flow-node.branch-blue {
  border-color: #1f67e0;
  background: #f2f7ff;
}

.flow-node.branch-green {
  border-color: #12a594;
  background: #f0fbf8;
}

.flow-line {
  width: 2px;
  height: 24px;
  background: #b8c4d6;
}

.flow-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 18px;
  width: 100%;
}

.flow-branch {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px dashed #c8d3e4;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.88);
}

.flow-mini {
  width: 72%;
  padding: 9px 12px;
  border: 1px solid #e3e8f2;
  border-radius: 6px;
  background: #fff;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.automation-preview-side {
  display: grid;
  gap: 16px;
}

.automation-preview-side .automation-card {
  padding: 16px;
}

.automation-preview-side p {
  margin: 0;
  color: #667085;
  line-height: 1.7;
}

.automation-check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.automation-check-list li {
  padding: 10px 12px;
  border-radius: 6px;
  background: #f7f9fc;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.automation-config-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.automation-steps-aside {
  padding: 20px 0;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.automation-steps-aside .automation-step {
  display: flex;
  align-items: center;
  grid-template-columns: none;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 16px 20px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: #4e5969;
}

.automation-steps-aside .automation-step:hover {
  transform: none;
  border-color: transparent;
  background: #f2f3f5;
  box-shadow: none;
}

.automation-steps-aside .automation-step.active {
  border-left-color: #165dff;
  background: #e8f3ff;
  color: #165dff;
}

.automation-steps-aside .automation-step.done span {
  background: #00b42a;
}

.automation-steps-aside .automation-step span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #d9d9d9;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 24px;
}

.automation-steps-aside .automation-step.active span {
  background: #165dff;
}

.automation-steps-aside .automation-step strong {
  color: inherit;
  font-size: 14px;
  font-weight: 600;
}

.automation-config-panel {
  min-height: 540px;
  padding: 28px 32px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.automation-panel-heading {
  margin: 0 0 8px;
  color: #1d2129;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.automation-panel-desc {
  margin: 0 0 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
  color: #667085;
  font-size: 14px;
}

.automation-form-group {
  margin-bottom: 24px;
}

.automation-form-label {
  display: block;
  margin-bottom: 10px;
  color: #1d2129;
  font-size: 14px;
  font-weight: 600;
}

.automation-form-label span {
  margin-right: 4px;
  color: #f53f3f;
}

.automation-form-select {
  width: min(480px, 100%);
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  color: #1d2129;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.automation-form-select:focus {
  border-color: #165dff;
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
}

.automation-switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 28px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #4e5969;
  text-align: left;
}

.automation-switch-row em {
  color: #4e5969;
  font-size: 14px;
  font-style: normal;
}

.automation-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #d9d9d9;
  flex: 0 0 40px;
  transition: background 0.2s ease;
}

.automation-switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: left 0.2s ease;
}

.automation-switch.on {
  background: #165dff;
}

.automation-switch.on::after {
  left: 20px;
}

.automation-branch-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.automation-branch-card {
  padding: 20px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
}

.automation-branch-card.high {
  border-color: #722ed1;
  background: #faf5ff;
}

.automation-branch-card.potential {
  border-color: #0fb8ad;
  background: #f0fffc;
}

.automation-branch-title {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
}

.automation-branch-card.high .automation-branch-title {
  color: #531dab;
}

.automation-branch-card.potential .automation-branch-title {
  color: #08979c;
}

.automation-branch-item {
  position: relative;
  margin-bottom: 8px;
  padding-left: 16px;
  color: #4e5969;
  font-size: 14px;
}

.automation-branch-item::before {
  position: absolute;
  top: 7px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #165dff;
  content: "";
}

.automation-panel-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.automation-panel-footer button {
  min-width: 86px;
}

.wordcloud-workbench {
  display: grid;
  min-height: calc(100vh - 68px);
  margin: -18px;
  background: #f2f3f5;
  color: #1d2129;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.wordcloud-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid #e5e6eb;
  background: #fff;
}

.wordcloud-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.wordcloud-title strong {
  font-size: 15px;
}

.wordcloud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wordcloud-actions button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  background: #fff;
  color: #1d2129;
  font-size: 13px;
}

.wordcloud-actions .primary {
  border-color: #165dff;
  background: #165dff;
  color: #fff;
}

.wordcloud-hint {
  margin: 0;
  padding: 8px 24px 9px;
  border-bottom: 1px solid #e5e6eb;
  background: #fff;
  color: #8a94a6;
  font-size: 12px;
  line-height: 1.65;
}

.wordcloud-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 0;
}

.wordcloud-canvas {
  display: grid;
  gap: 18px;
  padding: 18px 24px 28px;
  overflow: auto;
}

.wordcloud-widget {
  position: relative;
  min-height: 400px;
  padding: 18px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
}

.wordcloud-widget.compact-widget {
  min-height: 0;
}

.wordcloud-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordcloud-widget-head h2 {
  margin: 0;
  color: #1d2129;
  font-size: 16px;
  letter-spacing: 0;
}

.wordcloud-widget-head button {
  width: 26px;
  height: 26px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  background: #fff;
}

.wordcloud-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  height: 330px;
  color: #4e5969;
  font-size: 13px;
}

.wordcloud-empty-art {
  width: 110px;
  height: 86px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 74% 78%, #18d3be 0 14px, transparent 15px),
    radial-gradient(circle at 66% 70%, #165dff 0 18px, transparent 19px),
    linear-gradient(32deg, transparent 0 37%, #dfe5ee 38% 70%, transparent 71%),
    linear-gradient(150deg, transparent 0 22%, #f2f5f9 23% 64%, transparent 65%);
}

.wordcloud-stage {
  position: relative;
  height: 360px;
  max-width: 760px;
  margin: 6px auto 0;
  background: #fff;
  overflow: hidden;
}

.wordcloud-primary-table {
  min-height: 330px;
  display: grid;
  align-items: center;
}

.wordcloud-pending {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  height: 100%;
  min-height: 320px;
  color: #667085;
  text-align: center;
}

.wordcloud-pending strong {
  color: #1d2129;
  font-size: 15px;
}

.wordcloud-pending span {
  font-size: 13px;
}

.feishu-wordcloud-svg {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.feishu-wordcloud-svg.rect-shape {
  outline: 1px dashed #d7dee9;
  outline-offset: -10px;
}

.feishu-wordcloud-svg text {
  opacity: 0;
  letter-spacing: 0;
  animation: wordcloud-pop 0.48s ease forwards;
}

.wordcloud-data-table {
  width: min(520px, 92%);
  margin: 26px auto;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}

.wordcloud-data-table th,
.wordcloud-data-table td {
  padding: 12px 14px;
  border: 1px solid #e5e6eb;
  text-align: left;
}

.wordcloud-data-table th {
  background: #f7f8fa;
  color: #1d2129;
  font-weight: 700;
}

.wordcloud-data-table td:nth-child(2),
.wordcloud-data-table td:nth-child(3) {
  color: #165dff;
  font-weight: 700;
}

@keyframes wordcloud-pop {
  from {
    opacity: 0;
    transform: scale(0.86);
    transform-origin: center;
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.wordcloud-config {
  min-width: 0;
  border-left: 1px solid #e5e6eb;
  background: #fff;
  overflow: auto;
}

.wordcloud-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}

.wordcloud-config-head strong {
  font-size: 16px;
}

.wordcloud-config-head button {
  border: 0;
  background: transparent;
  color: #667085;
  font-size: 24px;
}

.wordcloud-config-field {
  display: grid;
  gap: 9px;
  padding: 16px 20px 0;
}

.wordcloud-config-field label {
  color: #1d2129;
  font-size: 14px;
}

.wordcloud-config-field input[type="text"],
.wordcloud-config-field input:not([type]) {
  width: 100%;
  height: 34px;
  padding: 7px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
}

.wordcloud-config-field label:has(input) {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4e5969;
  font-size: 13px;
}

.wordcloud-config-field em {
  padding: 1px 4px;
  border-radius: 4px;
  background: #fff1e8;
  color: #ff7a18;
  font-style: normal;
  font-size: 11px;
}

.wordcloud-select,
.wordcloud-palette {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  color: #1d2129;
  text-align: left;
}

.wordcloud-select b {
  color: #165dff;
  font-size: 12px;
}

select.wordcloud-select {
  display: block;
  appearance: auto;
  cursor: pointer;
}

.wordcloud-apply {
  width: calc(100% - 40px);
  min-height: 36px;
  margin: 18px 20px 22px;
  border: 1px solid #165dff;
  border-radius: 6px;
  background: #165dff;
  color: #fff;
  font-weight: 700;
}

.wordcloud-palette {
  justify-content: flex-start;
  gap: 0;
}

.wordcloud-palette i {
  width: 16px;
  height: 16px;
}

.wordcloud-palette i:nth-child(1) { background: #3f7cf7; }
.wordcloud-palette i:nth-child(2) { background: #20c7b5; }
.wordcloud-palette i:nth-child(3) { background: #ffcf22; }
.wordcloud-palette i:nth-child(4) { background: #ff8a18; }
.wordcloud-palette i:nth-child(5) { background: #a875e8; }

.wordcloud-palette span {
  margin-left: 10px;
  color: #667085;
  font-size: 12px;
}

.wordcloud-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 3px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
}

.wordcloud-segment button {
  min-height: 26px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
}

.wordcloud-segment .active {
  background: #e8f0ff;
  color: #165dff;
  font-weight: 700;
}

.wordcloud-check {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  color: #4e5969;
  font-size: 13px;
}

.crm-flow-page {
  display: grid;
  gap: 16px;
}

.crm-flow-value-card {
  position: relative;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 24px;
  overflow: hidden;
  border: 1px solid #dbe6f5;
  border-radius: 10px;
  background:
    radial-gradient(circle at 92% 0%, rgba(47, 109, 246, 0.09), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #eef6ff 54%, #f8fbff 100%);
  box-shadow: 0 1px 10px rgba(30, 45, 70, 0.08);
}

.crm-flow-value-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #2f6df6;
  content: "";
}

.crm-flow-value-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.crm-flow-value-title span {
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: #ff8a18;
}

.crm-flow-value-title h2 {
  margin: 0;
  color: #1d2129;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.crm-flow-value-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
}

.crm-flow-value-panel {
  min-height: 150px;
  padding: 20px;
  border: 1px solid rgba(37, 111, 216, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.crm-flow-value-panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: #1d2129;
  font-size: 14px;
}

.crm-flow-value-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
}

.crm-flow-value-panel.pain .crm-flow-value-icon {
  color: #8a5a00;
  background: #fff3c4;
}

.crm-flow-value-panel.value .crm-flow-value-icon {
  color: #165ca8;
  background: #dcecff;
}

.crm-flow-value-panel ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
  color: #344054;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.75;
}

.crm-flow-value-panel li::marker {
  color: #2f6df6;
}

.crm-flow-value-panel p {
  margin: 0;
  color: #344054;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.85;
}

.crm-flow-value-arrow {
  display: grid;
  place-items: center;
  color: #2f6df6;
  font-size: 28px;
  font-weight: 800;
}

.crm-flow-card {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid #e1e7f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 10px rgba(30, 45, 70, 0.1);
}

.crm-flow-source {
  display: flex;
  justify-content: center;
}

.crm-flow-node {
  display: grid;
  place-items: center;
  min-height: 72px;
  padding: 12px 16px;
  border: 1.5px solid #165ca8;
  border-radius: 8px;
  background: #b8e1ff;
  color: #16324f;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.crm-flow-node span {
  color: #475467;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}

.crm-flow-node.source {
  min-width: 280px;
  border-color: #256fd8;
  background: #f0f6ff;
}

.crm-flow-node.wide {
  max-width: 380px;
  margin: 0 auto;
}

.crm-flow-node.result {
  border-color: #279937;
  background: #e6f7e8;
}

.crm-flow-arrows {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 760px;
  height: 50px;
  margin: 0 auto;
}

.crm-flow-arrows::before {
  position: absolute;
  top: 26px;
  left: 16.5%;
  right: 16.5%;
  height: 2px;
  background: #256fd8;
  content: "";
}

.crm-flow-arrows i {
  position: relative;
}

.crm-flow-arrows i::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 28px;
  background: #256fd8;
  content: "";
}

.crm-flow-arrows i::after {
  position: absolute;
  top: 24px;
  left: calc(50% - 5px);
  border: 5px solid transparent;
  border-top-color: #256fd8;
  content: "";
}

.crm-flow-modules {
  display: grid;
  gap: 18px;
}

.crm-flow-module {
  padding: 18px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #fbfdff;
}

.crm-flow-module h2 {
  margin: 0 0 14px;
  color: #1d2129;
  font-size: 16px;
  text-align: center;
  letter-spacing: 0;
}

.crm-flow-module.blue .crm-flow-node {
  border-color: #165ca8;
  background: #b8e1ff;
}

.crm-flow-module.pink .crm-flow-node {
  border-color: #c84270;
  background: #ffd6e0;
}

.crm-flow-module.orange .crm-flow-node {
  border-color: #e08330;
  background: #ffe8cc;
}

.crm-flow-module .crm-flow-node.result {
  border-color: #279937;
  background: #e6f7e8;
}

.crm-flow-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.crm-flow-down {
  width: 2px;
  height: 28px;
  margin: 8px auto;
  background: #256fd8;
  position: relative;
}

.crm-flow-down::after,
.crm-flow-arrow-down::after {
  position: absolute;
  left: -4px;
  bottom: -8px;
  border: 5px solid transparent;
  border-top-color: #256fd8;
  content: "";
}

.crm-flow-branch-lines {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 36px;
}

.crm-flow-branch-lines::before {
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: #256fd8;
  content: "";
}

.crm-flow-branch-lines span {
  position: relative;
}

.crm-flow-branch-lines span::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 28px;
  background: #256fd8;
  content: "";
}

.crm-flow-branch-lines span::after {
  position: absolute;
  top: 24px;
  left: calc(50% - 5px);
  border: 5px solid transparent;
  border-top-color: #256fd8;
  content: "";
}

.crm-flow-two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.crm-flow-stack {
  display: grid;
  justify-items: center;
  gap: 0;
}

.crm-flow-stack .crm-flow-node {
  width: min(100%, 360px);
}

.crm-flow-arrow-down {
  position: relative;
  width: 2px;
  height: 28px;
  background: #256fd8;
}

@media (max-width: 900px) {
  .crm-flow-value-card {
    padding: 18px;
  }

  .crm-flow-value-grid {
    grid-template-columns: 1fr;
  }

  .crm-flow-value-arrow {
    transform: rotate(90deg);
  }

  .crm-flow-card {
    padding: 18px;
  }

  .crm-flow-row,
  .crm-flow-two-cols {
    grid-template-columns: 1fr;
  }

  .crm-flow-arrows,
  .crm-flow-branch-lines {
    display: none;
  }
}

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

  .wordcloud-config {
    border-left: 0;
    border-top: 1px solid #e5e6eb;
  }
}

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

@media (max-width: 1280px) {
  .automation-config-layout,
  .automation-layout,
  .automation-preview {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .automation-form-grid,
  .automation-summary,
  .flow-split {
    grid-template-columns: 1fr;
  }

  .automation-card-head,
  .automation-panel-footer,
  .automation-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .automation-branch-cards {
    grid-template-columns: 1fr;
  }
}
