/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --yellow: #FFD100;
  --yellow-hover: #f0c000;
  --yellow-light: #FFF3CC;
  --dark: #1a1a1a;
  --dark-secondary: #333;
  --gray: #666;
  --gray-light: #f5f5f5;
  --border: #ddd;
  --border-light: #eee;
  --divider: #f0f0f0;
  --hover-bg: #fafafa;
  --muted: #ccc;
  --white: #fff;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --max-width: 640px;
  /* Sidebar */
  --sidebar-width: 340px;
  --panel-bg: #fff;
  --panel-radius: 10px;
  --panel-shadow: 0 1px 4px rgba(0,0,0,.06);
  --panel-gap: 10px;
  --green: #4caf50;
  --blue: #1976d2;
  --blue-light: #e3f2fd;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  color: var(--dark);
  background: var(--gray-light);
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* === Header === */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--yellow);
  flex-shrink: 0;
}
.header-icon { font-size: 28px; }
.header-text h1 { font-size: 17px; font-weight: 700; }
.header-sub { font-size: 12px; color: var(--gray); margin-top: 2px; }

/* === App Body — dual column === */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* === Chat Column (left) === */
.chat-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border-light);
}

/* === Chat Area === */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* === Welcome === */
.welcome {
  text-align: center;
  padding: 24px 16px;
  color: var(--gray);
}
.welcome-icon { font-size: 48px; margin-bottom: 12px; }
.welcome p { margin: 6px 0; }
.suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  font-size: 13px;
  color: var(--dark);
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--yellow); background: var(--yellow-light); }

/* === Message Bubbles === */
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.6;
  word-break: break-word;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg-user {
  align-self: flex-end;
  background: var(--yellow);
  color: var(--dark);
  border-bottom-right-radius: 4px;
}
.msg-agent {
  align-self: flex-start;
  background: var(--white);
  color: var(--dark);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}
.msg-agent strong { color: var(--dark-secondary); }

/* === Tool Call Indicator === */
.tool-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray);
  padding: 4px 0;
}
.tool-indicator .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* === Thinking Dots === */
.thinking {
  display: flex;
  gap: 4px;
  padding: 6px 0;
}
.thinking span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce .6s infinite;
}
.thinking span:nth-child(2) { animation-delay: .1s; }
.thinking span:nth-child(3) { animation-delay: .2s; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* === Plan Area === */
.plan-area {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  background: var(--white);
  animation: slideUp .3s ease-out;
  flex-shrink: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 24px;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.plan-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.feedback-card {
  border: 1px solid var(--blue-light);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: #f7fbff;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13px;
}
.feedback-card h3 {
  font-size: 15px;
  margin-bottom: 8px;
}
.feedback-card p {
  margin: 4px 0;
  line-height: 1.45;
}
.plan-card-header {
  background: var(--yellow-light);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 15px;
}
.plan-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  align-items: flex-start;
  transition: background .15s;
}
.plan-item:hover { background: var(--hover-bg); }
.plan-item:last-child { border-bottom: none; }
.plan-time {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray);
  min-width: 80px;
}
.plan-detail h4 { font-size: 14px; line-height: 1.4; }
.plan-detail p { font-size: 12px; color: var(--gray); margin-top: 2px; line-height: 1.4; }
.plan-footer {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--gray);
  border-top: 1px solid var(--divider);
  background: var(--hover-bg);
}

/* === A/B Plan Cards === */
.ab-container {
  display: flex;
  gap: 12px;
}
.plan-card-ab {
  flex: 1;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.plan-card-ab-yellow .plan-card-header { background: var(--yellow-light); }
.plan-card-ab-blue .plan-card-header { background: var(--blue-light); }
.plan-card-ab .plan-item { padding: 8px 12px; }
.plan-card-ab .plan-detail h4 { font-size: 13px; }
.plan-card-ab .plan-detail p { font-size: 11px; }
.plan-card-ab .plan-time { font-size: 12px; min-width: 68px; }
.ab-label {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 0 0 8px 0;
}
.ab-label-yellow { background: var(--yellow); color: var(--dark); }
.ab-label-blue { background: var(--blue); color: #fff; }
.btn-alt {
  background: var(--blue);
  color: #fff;
}
.btn-alt:hover { background: #1565c0; }

/* === Action Buttons === */
.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 0 0;
  background: var(--white);
}
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-primary { background: var(--yellow); color: var(--dark); }
.btn-primary:hover { background: var(--yellow-hover); }
.btn-secondary { background: var(--gray-light); color: var(--dark); }
.btn-secondary:hover { background: #e0e0e0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-compact { padding: 8px 14px; font-size: 12px; border-radius: 14px; }
.quick-revision-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.demo-chip {
  border-color: #e53935;
  background: #fff5f5;
  color: #b71c1c;
  font-weight: 700;
}

/* === Input Bar === */
.input-bar {
  flex-shrink: 0;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--white);
  border-top: 1px solid var(--border-light);
}
.input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
#msgInput {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 15px;
  resize: none;
  outline: none;
  line-height: 1.4;
  max-height: 120px;
  font-family: inherit;
}
#msgInput:focus { border-color: var(--yellow); }
#sendBtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--yellow);
  color: var(--dark);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
#sendBtn:hover { background: var(--yellow-hover); }
#sendBtn:disabled { opacity: .4; cursor: not-allowed; }

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  padding: var(--panel-gap);
  display: flex;
  flex-direction: column;
  gap: var(--panel-gap);
  background: var(--gray-light);
  transition: transform .3s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* === Sidebar Panels === */
.sidebar-panel {
  flex: 0 0 auto;
  background: var(--panel-bg);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  animation: panelFadeIn .3s ease-out;
}
.sidebar-panel:empty {
  display: none;
}
@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.panel-header {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dark-secondary);
  border-bottom: 1px solid var(--divider);
}
.panel-body {
  padding: 12px 14px;
}
#timelinePanel .panel-body,
#recoveryPanel .panel-body,
#conversionPanel .panel-body {
  max-height: 280px;
  overflow-y: auto;
}
#timelinePanel .panel-body::-webkit-scrollbar,
#recoveryPanel .panel-body::-webkit-scrollbar,
#conversionPanel .panel-body::-webkit-scrollbar {
  width: 4px;
}
#timelinePanel .panel-body::-webkit-scrollbar-thumb,
#recoveryPanel .panel-body::-webkit-scrollbar-thumb,
#conversionPanel .panel-body::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 2px;
}

/* === Weather Panel === */
.weather-main {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.weather-temp {
  font-size: 32px;
  font-weight: 700;
  color: var(--dark);
}
.weather-icon {
  font-size: 28px;
}
.weather-meta {
  font-size: 12px;
  color: var(--gray);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.weather-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--yellow-light);
  font-size: 11px;
  color: var(--dark-secondary);
  margin-top: 8px;
}

/* === Route Panel === */
.route-timeline {
  padding-left: 16px;
  position: relative;
}
.route-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.route-stop {
  position: relative;
  padding: 6px 0 6px 16px;
}
.route-stop::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1px var(--yellow);
}
.route-stop-name {
  font-size: 13px;
  font-weight: 600;
}
.route-stop-info {
  font-size: 11px;
  color: var(--gray);
  margin-top: 2px;
}
.route-transport {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 10px;
  margin-left: 4px;
}

/* === Booking Panel === */
.booking-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
}
.booking-item:last-child { border-bottom: none; }
.booking-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.booking-status-dot.pending { background: var(--yellow); }
.booking-status-dot.success { background: var(--green); }
.booking-status-dot.failed { background: #e53935; }
.booking-status-dot.skipped { background: var(--muted); }
.booking-name { flex: 1; font-weight: 500; }
.booking-time { font-size: 11px; color: var(--gray); }
.booking-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.booking-badge.success { background: #e8f5e9; color: #2e7d32; }
.booking-badge.failed { background: #ffebee; color: #c62828; }
.booking-badge.skipped { background: #eceff1; color: #78909c; }
.booking-badge.pending { background: var(--yellow-light); color: var(--dark-secondary); }

/* === Tool Timeline Panel === */
.agent-stage-timeline {
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #fffdf2;
  margin-bottom: 10px;
}
.stage-overview-section,
.tool-trace-section {
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px;
}
.stage-overview-section {
  background: #fffdf2;
}
.tool-trace-section {
  background: #fafafa;
}
.stage-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 8px;
}
.tool-trace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.timeline-empty {
  font-size: 11px;
  color: var(--gray);
  padding: 8px;
  border: 1px dashed var(--divider);
  border-radius: var(--radius-sm);
  background: #fff;
}
.stage-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 8px;
}
.stage-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.stage-item {
  display: grid;
  grid-template-columns: 10px 64px 44px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.stage-label { font-weight: 700; color: var(--dark-secondary); }
.stage-status {
  text-align: center;
  padding: 1px 4px;
  border-radius: 6px;
  background: var(--gray-light);
  color: var(--gray);
}
.stage-summary {
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-completed .stage-dot,
.stage-success .stage-dot { background: var(--green); }
.stage-running .stage-dot { background: var(--yellow); }
.stage-recovered .stage-dot { background: #7b1fa2; }
.stage-failed .stage-dot { background: #e53935; }
.stage-completed .stage-status,
.stage-success .stage-status { background: #e8f5e9; color: #2e7d32; }
.stage-running .stage-status { background: var(--yellow-light); color: var(--dark-secondary); }
.stage-recovered .stage-status { background: #f3e5f5; color: #6a1b9a; }
.stage-failed .stage-status { background: #ffebee; color: #c62828; }
.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.timeline-item {
  border: 1px solid var(--divider);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fff;
}
.timeline-success { border-left-color: var(--green); }
.timeline-failed { border-left-color: #e53935; }
.timeline-recovered { border-left-color: #7b1fa2; }
.timeline-pending { border-left-color: var(--yellow); }
.timeline-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.timeline-tool {
  font-size: 12px;
  font-weight: 700;
}
.timeline-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gray-light);
  text-transform: uppercase;
}
.timeline-summary {
  margin-top: 4px;
  font-size: 11px;
  color: var(--dark-secondary);
  line-height: 1.4;
}
.timeline-meta,
.timeline-recovery {
  margin-top: 3px;
  font-size: 10px;
  color: var(--gray);
}
.timeline-recovery {
  color: #7b1fa2;
  font-weight: 600;
}
.timeline-revised { border-left-color: #ff9800; }

/* === Confirmation Card === */
.confirmation-card {
  margin-top: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}
.confirmation-header {
  padding: 12px 14px;
  background: #e8f5e9;
  border-bottom: 1px solid var(--divider);
}
.confirmation-header h3 {
  font-size: 15px;
  margin-bottom: 4px;
}
.confirmation-header p {
  font-size: 12px;
  color: var(--gray);
}
.confirm-section {
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
}
.confirm-section:last-child {
  border-bottom: none;
}
.confirm-section h4 {
  font-size: 13px;
  margin-bottom: 4px;
}
.confirm-section p {
  font-size: 12px;
  color: var(--dark-secondary);
  line-height: 1.5;
}
.share-section {
  background: var(--hover-bg);
}

/* === Sidebar Toggle (mobile) === */
.sidebar-toggle {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--yellow);
  color: var(--dark);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  cursor: pointer;
  z-index: 90;
  transition: transform .15s;
}
.sidebar-toggle:hover { transform: scale(1.05); }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 100;
  animation: fadeIn .2s;
}

/* === Booking Result (in plan card) === */
.booking-result {
  font-size: 12px;
  padding: 3px 8px;
  margin-top: 4px;
  display: inline-block;
  border-radius: var(--radius-sm);
}
.booking-result.success { color: #2e7d32; background: #e8f5e9; }
.booking-result.skipped { color: #78909c; background: #eceff1; }
.booking-result.failed { color: #c62828; background: #ffebee; }
.booking-result.recovered { color: #6a1b9a; background: #f3e5f5; }

/* === Constraint Explanation Panel === */
.main-display-card {
  margin-top: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeIn .3s ease-out;
}
.main-compact-card {
  padding: 10px 14px;
}
.main-compact-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}
.main-compact-card .constraint-rules,
.main-compact-card .recovery-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.main-compact-card .constraint-rule,
.main-compact-card .recovery-summary-grid > div {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--hover-bg);
  border-left: 3px solid var(--yellow);
}
.main-compact-card .conversion-gmv {
  font-size: 16px;
  margin-bottom: 4px;
}
.main-compact-card .conversion-merchants {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.main-compact-card .merchant-item {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 2px 0;
}
.recovery-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.recovery-result-badge,
.recovery-constraint-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}
.recovery-result-badge {
  background: #e8f5e9;
  color: #2e7d32;
}
.recovery-constraint-badge {
  background: var(--blue-light);
  color: var(--blue);
}
.display-card {
  padding: 12px 14px;
}
.display-card h3 {
  font-size: 14px;
  margin-bottom: 8px;
}
.muted-card {
  color: var(--gray);
  background: var(--hover-bg);
}
.muted-card p {
  font-size: 12px;
  line-height: 1.5;
}
.constraint-scenario {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--yellow-light);
  font-size: 11px;
  font-weight: 600;
  color: var(--dark-secondary);
  margin-bottom: 10px;
}
.constraint-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.constraint-rule {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--hover-bg);
  border-left: 3px solid var(--yellow);
}
.rule-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--dark);
}
.rule-filter {
  font-size: 11px;
  color: var(--gray);
  margin-top: 2px;
}
.rule-result {
  font-size: 11px;
  color: var(--green);
  margin-top: 2px;
}
.constraint-scoring {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
  font-size: 11px;
  color: var(--gray);
}

/* === Recovery Story Panel === */
.recovery-summary-grid {
  display: grid;
  gap: 8px;
}
.recovery-summary-grid div {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--hover-bg);
}
.recovery-summary-grid strong {
  display: block;
  font-size: 11px;
  color: var(--dark);
  margin-bottom: 3px;
}
.recovery-summary-grid span {
  display: block;
  font-size: 11px;
  color: var(--gray);
  line-height: 1.45;
}
.recovery-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  background: #fff3e0;
  color: #e65100;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}
.recovery-type {
  font-size: 11px;
  color: #7b1fa2;
  font-weight: 600;
  margin-bottom: 8px;
}
.recovery-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recovery-step {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  background: var(--hover-bg);
}
.recovery-step-failed { border-left: 3px solid #e53935; }
.recovery-step-recovered { border-left: 3px solid #7b1fa2; }
.recovery-step-success { border-left: 3px solid var(--green); }
.step-phase {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
}
.step-action {
  color: var(--dark-secondary);
}
.step-detail {
  display: block;
  font-size: 10px;
  color: var(--gray);
  margin-top: 2px;
}

/* === Business Conversion Panel === */
.conversion-gmv {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
}
.conversion-funnel {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
}
.funnel-step {
  text-align: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--yellow-light);
}
.funnel-label { display: block; font-size: 10px; color: var(--gray); }
.funnel-value { display: block; font-size: 14px; font-weight: 700; color: var(--dark); }
.funnel-arrow { color: var(--muted); font-size: 12px; }
.conversion-merchants {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.merchant-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--divider);
}
.merchant-item:last-child { border-bottom: none; }
.merchant-name { flex: 1; font-weight: 500; }
.merchant-category {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue-light);
  color: var(--blue);
}
.merchant-amount { font-weight: 700; color: var(--dark); }
.conversion-upsell {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: #e8f5e9;
  font-size: 11px;
  color: #2e7d32;
}
.conversion-actions {
  margin: 4px 0;
  font-size: 11px;
  color: #555;
}
.conversion-actions .action-tag {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px 3px 2px 0;
  border-radius: var(--radius-sm);
  background: #fff3e0;
  color: #e65100;
  font-size: 10px;
}
.conversion-upsells {
  margin: 4px 0;
  font-size: 11px;
  color: #555;
}
.conversion-upsells .upsell-tag {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px 3px 2px 0;
  border-radius: var(--radius-sm);
  background: #e3f2fd;
  color: #1565c0;
  font-size: 10px;
}
.conversion-saving {
  margin: 4px 0;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: #e8f5e9;
  font-size: 11px;
  color: #2e7d32;
  font-weight: 600;
}

/* === Focus Visible === */
.btn:focus-visible, .chip:focus-visible, #sendBtn:focus-visible, #msgInput:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* === Scrollbar === */
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* === Mobile === */
@media (max-width: 768px) {
  .app-body {
    flex-direction: column;
  }
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 65vh;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,.1);
    transform: translateY(100%);
    z-index: 80;
    border-left: none;
    border-top: 1px solid var(--border-light);
  }
  .sidebar.open {
    transform: translateY(0);
  }
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .chat-column {
    border-right: none;
  }
}

@media (max-width: 480px) {
  .ab-container { flex-direction: column; }
  .msg { max-width: 90%; }
  .header h1 { font-size: 15px; }
  .chip { font-size: 12px; padding: 6px 12px; }
  .plan-area { padding: 12px; }
  .plan-item { flex-direction: column; gap: 4px; padding: 10px 12px; }
  .plan-time { min-width: auto; }
  .btn { padding: 10px 16px; font-size: 13px; }
  .btn-row { flex-direction: column; gap: 6px; }
}
