:root {
  --scale: 0.9;
  --blue: #2f5bea;
  --blue-strong: #2450d7;
  --blue-soft: #eff4ff;
  --text: #28334d;
  --muted: #6b7280;
  --weak: #9aa3b2;
  --line: #e5e8ef;
  --line-dark: #d8dde8;
  --bg: #f6f8fc;
  --panel: #ffffff;
  --thead: #f4f6fa;
  --success: #18a058;
  --warning: #f59e0b;
  --danger: #e5484d;
  --cyan: #10a7b5;
  --violet: #7c3aed;
  --shadow: 0 8px 24px rgba(26, 45, 87, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

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

button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
}

svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 234px 1fr;
  grid-template-rows: 61px 1fr;
  transition: grid-template-columns 0.2s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.topbar {
  grid-column: 1 / -1;
  height: 61px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-block,
.top-actions,
.brand-text,
.side-item,
.filter-row,
.metric-delta,
.chart-title,
.table-action,
.segment-chip,
.journey-node,
.profile-line,
.status-pill,
.legend-row,
.switch-line {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
  min-width: 207px;
}

.app-switcher {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 4px;
  width: 29px;
  color: #7a8497;
}

.app-switcher span {
  width: 4px;
  height: 4px;
  background: currentColor;
}

.app-switcher:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(145deg, var(--blue), #4f7cff);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
}

.brand-text {
  gap: 14px;
  white-space: nowrap;
}

.brand-text strong {
  font-size: 22px;
  line-height: 1;
}

.brand-text span {
  font-size: 20px;
  font-weight: 700;
  color: #1f2b44;
}

.top-nav {
  display: flex;
  align-self: stretch;
  min-width: 0;
  overflow-x: auto;
}

.top-nav-item {
  padding: 0 16px;
  height: 61px;
  color: #33415f;
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.top-nav-item.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.top-actions {
  margin-left: auto;
  gap: 10px;
}

.tenant-select,
.select,
.input,
.date-input {
  height: 38px;
  border: 1px solid var(--line-dark);
  background: #fff;
  color: #4b5567;
  padding: 0 12px;
  outline: none;
  min-width: 150px;
}

.tenant-select {
  width: 256px;
}

.input {
  min-width: 198px;
}

.icon-button {
  width: 31px;
  height: 31px;
  display: inline-grid;
  place-items: center;
  color: #536179;
}

.version {
  color: #606b7e;
}

.sidebar {
  grid-row: 2;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: calc(100vh - 68px);
  position: sticky;
  top: 61px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.sidebar-collapsed .sidebar {
  opacity: 0;
  transform: translateX(-24px);
  pointer-events: none;
  border-color: transparent;
}

.side-item {
  gap: 12px;
  height: 50px;
  padding: 0 22px;
  color: #596477;
  text-align: left;
  border-left: 3px solid transparent;
}

.side-item:hover {
  background: #f8faff;
}

.side-item.active {
  color: var(--blue);
  background: var(--blue-soft);
  border-left-color: var(--blue);
}

.side-item span {
  font-weight: 600;
}

.collapse-button {
  margin-top: auto;
  height: 59px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  color: #46516a;
}

.main-content {
  min-width: 0;
  padding: 22px 31px 40px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

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

.page-title {
  margin: 0 0 7px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
}

.page-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.primary-button,
.secondary-button,
.ghost-button {
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:hover {
  background: var(--blue-strong);
}

.secondary-button {
  background: #fff;
  color: #33415f;
  border: 1px solid var(--line-dark);
}

.ghost-button {
  color: var(--blue);
  padding: 0 6px;
}

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

.filter-panel {
  padding: 14px;
  margin-bottom: 14px;
}

.filter-row {
  gap: 10px;
  flex-wrap: wrap;
}

.filter-label {
  color: #33415f;
  font-weight: 600;
}

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

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px 18px;
  min-height: 115px;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -44px;
  top: -56px;
  width: 108px;
  height: 108px;
  border: 16px solid rgba(47, 91, 234, 0.06);
  border-radius: 50%;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 11px;
}

.metric-value {
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 11px;
}

.metric-delta {
  gap: 6px;
  font-size: 13px;
  color: var(--success);
}

.metric-delta.down {
  color: var(--danger);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

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

.panel {
  min-width: 0;
}

.panel-header {
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.panel-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 16px;
}

.chart-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  background: var(--blue);
  margin-right: 6px;
}

.dot.cyan {
  background: var(--cyan);
}

.dot.warning {
  background: var(--warning);
}

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

.axis-line {
  stroke: #edf0f6;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.chart-line.secondary {
  stroke: var(--cyan);
}

.chart-area {
  fill: rgba(47, 91, 234, 0.08);
}

.chart-label {
  fill: #8b95a6;
  font-size: 12px;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 108px 1fr 58px;
  align-items: center;
  gap: 11px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  background: #eef2f8;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--blue);
}

.bar-fill.cyan {
  background: var(--cyan);
}

.bar-fill.warning {
  background: var(--warning);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 684px;
}

.data-table th,
.data-table td {
  height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.data-table th {
  background: var(--thead);
  color: #34405a;
  font-weight: 700;
}

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

.clickable-row {
  cursor: pointer;
}

.link {
  color: var(--blue);
  font-weight: 600;
}

button.link {
  padding: 0;
}

.status-pill {
  width: fit-content;
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 600;
  background: #edf8f2;
  color: var(--success);
}

.status-pill.warn {
  color: var(--warning);
  background: #fff7e6;
}

.status-pill.danger {
  color: var(--danger);
  background: #fff1f1;
}

.status-pill.info {
  color: var(--blue);
  background: var(--blue-soft);
}

.table-action {
  gap: 12px;
  color: var(--blue);
  font-weight: 600;
}

.funnel-steps {
  display: grid;
  gap: 12px;
}

.funnel-step {
  display: grid;
  grid-template-columns: 130px minmax(100px, 1fr) 78px 78px;
  align-items: center;
  gap: 12px;
}

.funnel-bar {
  height: 34px;
  background: #eaf0ff;
  position: relative;
}

.funnel-bar span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.funnel-count {
  font-weight: 700;
}

.profile-layout {
  display: grid;
  grid-template-columns: 306px 1fr;
  gap: 14px;
}

.profile-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.avatar {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.profile-line {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 11px 0;
  color: var(--muted);
}

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

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

.tag {
  height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.timeline {
  display: grid;
  gap: 14px;
  padding-left: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 110px 1fr 90px;
  gap: 12px;
  align-items: start;
}

.timeline-time {
  color: var(--muted);
  font-size: 13px;
}

.timeline-content {
  border-left: 2px solid var(--line-dark);
  padding-left: 14px;
}

.timeline-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.timeline-meta {
  color: var(--muted);
  font-size: 13px;
}

.segment-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.rule-block {
  background: #f8faff;
  border: 1px solid var(--line);
  padding: 14px;
}

.rule-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 38px;
  gap: 8px;
  margin-top: 10px;
}

.segment-chip {
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  margin-bottom: 10px;
}

.campaign-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.campaign-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.campaign-title {
  font-weight: 700;
}

.campaign-meta {
  color: var(--muted);
  font-size: 13px;
}

.journey {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  align-items: center;
  gap: 12px;
}

.journey-node {
  min-height: 74px;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  background: #f8faff;
  border: 1px solid var(--line-dark);
  color: #33415f;
  text-align: center;
  padding: 10px;
}

.journey-node strong {
  font-size: 14px;
}

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

.experiment-card {
  border: 1px solid var(--line);
  padding: 16px;
  background: #fff;
}

.experiment-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.variant {
  border: 1px solid var(--line);
  padding: 14px;
}

.variant strong {
  display: block;
  margin-bottom: 8px;
}

.lift {
  font-size: 25px;
  font-weight: 700;
  color: var(--success);
}

.donut {
  width: 155px;
  height: 155px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 44%, var(--cyan) 44% 70%, var(--warning) 70% 88%, #dfe5f1 88% 100%);
  position: relative;
}

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

.legend-list {
  display: grid;
  gap: 10px;
}

.legend-row {
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

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

.switch-line {
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.switch {
  width: 38px;
  height: 20px;
  background: var(--blue);
  position: relative;
}

.switch::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  right: 2px;
  top: 2px;
  background: #fff;
}

.switch.off {
  background: #c7cfdd;
}

.switch.off::after {
  right: 20px;
}

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

.workflow-panel {
  margin-bottom: 16px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 11px;
}

.workflow-step {
  border: 1px solid var(--line);
  background: #fff;
  padding: 13px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
}

.workflow-step .ghost-button {
  grid-column: 1 / -1;
  justify-content: flex-start;
  height: 28px;
}

.workflow-step p {
  min-height: 42px;
  margin: 6px 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

.step-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.live-badge {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  background: #edf8f2;
  color: var(--success);
  font-size: 13px;
  font-weight: 600;
}

.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  min-width: 220px;
  max-width: 360px;
  background: #1f2b44;
  color: #fff;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 80;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21, 31, 52, 0.28);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 70;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(640px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(23, 38, 76, 0.2);
}

.modal-header,
.modal-footer {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
}

.modal-body {
  padding: 16px;
}

.detail-drawer {
  position: fixed;
  right: 0;
  top: 61px;
  bottom: 0;
  width: min(414px, 92vw);
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 36px rgba(23, 38, 76, 0.12);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 65;
  display: flex;
  flex-direction: column;
}

.detail-drawer.show {
  transform: translateX(0);
}

.drawer-header {
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h2 {
  margin: 0;
  font-size: 17px;
}

.drawer-body {
  padding: 16px;
  overflow: auto;
}

.drawer-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

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

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid .input,
.form-grid .select {
  width: 100%;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.wizard-steps span {
  height: 30px;
  display: grid;
  place-items: center;
  background: #f4f6fa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.wizard-steps span.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.campaign-preview {
  border: 1px solid var(--line);
  background: #f8faff;
  padding: 14px;
}

.campaign-preview p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.ai-hero {
  background: #fff;
  border: 1px solid var(--line);
  padding: 20px;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 20px;
  margin-bottom: 14px;
}

.ai-kicker {
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 8px;
}

.ai-hero h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.ai-hero p,
.ai-card p,
.insight-item span {
  color: var(--muted);
  line-height: 1.6;
}

.ai-prompt {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 18px;
}

.ai-prompt input {
  height: 42px;
  border: 1px solid var(--line-dark);
  padding: 0 14px;
  outline: none;
}

.ai-result {
  background: #f8faff;
  border: 1px solid var(--line);
  padding: 16px;
}

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

.ai-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 13px;
  display: grid;
  gap: 10px;
}

.ai-card p {
  margin: 0;
}

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

.insight-item {
  border-left: 3px solid var(--blue);
  background: #f8faff;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

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

  .brand-block {
    min-width: 210px;
  }

  .brand-text span,
  .side-item span,
  .collapse-button span {
    display: none;
  }

  .side-item,
  .collapse-button {
    justify-content: center;
    padding: 0;
  }

  .metric-grid,
  .grid-3,
  .settings-grid,
  .ai-grid,
  .workflow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  html,
  body {
    font-size: 13px;
    overflow-x: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: relative;
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 8px 12px;
  }

  .brand-block {
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-text strong {
    font-size: 20px;
  }

  .top-nav {
    order: 3;
    width: 100%;
    height: 42px;
    align-self: auto;
    border-top: 1px solid var(--line);
  }

  .top-nav-item {
    height: 42px;
    padding: 0 14px;
    font-size: 13px;
  }

  .top-actions {
    width: auto;
    margin-left: auto;
    gap: 6px;
  }

  .tenant-select {
    display: none;
  }

  .version {
    display: none;
  }

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

  .sidebar {
    position: relative;
    top: 0;
    min-height: auto;
    grid-row: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    width: 100vw;
  }

  .sidebar-collapsed .sidebar {
    display: none;
  }

  .side-item {
    min-width: 92px;
    height: 46px;
    padding: 0 10px;
    justify-content: center;
    gap: 6px;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .side-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--blue);
  }

  .side-item span {
    display: inline;
    font-size: 12px;
    white-space: nowrap;
  }

  .collapse-button {
    display: none;
  }

  .main-content {
    padding: 12px;
    width: 100vw;
    overflow: hidden;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .page-header .primary-button {
    width: 100%;
  }

  .filter-panel {
    padding: 12px;
  }

  .filter-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .filter-label {
    display: none;
  }

  .select,
  .input,
  .date-input,
  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
    min-width: 0;
  }

  .metric-card {
    min-height: 104px;
    padding: 14px;
  }

  .metric-value {
    font-size: 24px;
  }

  .panel-header {
    min-height: auto;
    padding: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .panel-body {
    padding: 12px;
  }

  .line-chart {
    height: 210px;
  }

  .table-wrap {
    margin: 0 -12px;
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 620px;
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    height: 46px;
    padding: 0 10px;
  }

  .workflow-step {
    grid-template-columns: 28px 1fr;
  }

  .profile-line {
    gap: 12px;
    align-items: flex-start;
  }

  .profile-line strong {
    text-align: right;
  }

  .timeline-item {
    grid-template-columns: 72px 1fr;
  }

  .timeline-item > strong {
    grid-column: 2;
  }

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

  .journey-node {
    min-height: 62px;
  }

  .ai-prompt {
    grid-template-columns: 1fr;
  }

  .ai-prompt input {
    width: 100%;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100vw;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    overflow: auto;
  }

  .modal-footer {
    padding: 10px 12px;
  }

  .detail-drawer {
    top: 0;
    width: 100vw;
    max-width: 100vw;
    z-index: 90;
  }

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

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    min-width: 0;
    max-width: none;
  }

  .metric-grid,
  .grid-2,
  .grid-3,
  .profile-layout,
  .segment-builder,
  .settings-grid,
  .experiment-split,
  .ai-hero,
  .ai-grid,
  .form-grid,
  .workflow-steps,
  .wizard-steps {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 480px) {
  .side-item {
    min-width: 78px;
  }

  .side-item span {
    font-size: 11px;
  }

  .page-title {
    font-size: 18px;
  }

  .metric-grid {
    gap: 10px;
  }

  .bar-row {
    grid-template-columns: 88px 1fr 52px;
  }

  .donut {
    width: 132px;
    height: 132px;
  }

  .wizard-steps span {
    height: 28px;
    font-size: 12px;
  }
}
