:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --rail: #081a3a;
  --text: #1f2937;
  --muted: #7a8496;
  --faint: #a5aec0;
  --line: #e6e9f1;
  --blue: #1557e6;
  --green: #1fa36d;
  --purple: #6b5cff;
  --shadow: 0 18px 50px rgba(21, 39, 75, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.eyebrow {
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
}

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

.login-shell {
  align-items: center;
  background:
    radial-gradient(circle at 24% 12%, rgba(21, 87, 230, 0.12), transparent 28%),
    linear-gradient(135deg, #f8fbff, #eef2f8);
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 22px;
  max-width: 420px;
  padding: 34px;
  width: 100%;
}

.login-logo,
.workspace-logo {
  align-items: center;
  background: linear-gradient(145deg, #1d67ff, #153cb9);
  border-radius: 14px;
  color: white;
  display: inline-flex;
  font-size: 18px;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.login-panel h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0 0 8px;
}

form,
label {
  display: grid;
  gap: 9px;
}

input,
textarea,
select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  padding: 12px 13px;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21, 87, 230, 0.1);
}

form button,
#sendButton,
.resolve-button {
  background: var(--blue);
  border-radius: 10px;
  color: white;
  font-weight: 800;
  padding: 11px 15px;
}

.error {
  color: #c0362c;
  min-height: 20px;
}

.app-shell {
  display: grid;
  grid-template-columns: 72px 360px minmax(420px, 1fr) 360px;
  height: 100vh;
  overflow: hidden;
}

.rail {
  align-items: center;
  background: linear-gradient(180deg, #071834, #0a214b);
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  padding: 18px 10px;
}

.rail-nav {
  align-self: start;
  display: grid;
  gap: 18px;
  margin-top: 34px;
}

.rail-nav button,
.square-button,
.ghost-action {
  align-items: center;
  border-radius: 12px;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.rail-nav button {
  background: transparent;
  color: #8fa4d0;
  font-size: 18px;
  position: relative;
}

.rail-nav .rail-active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.locked-control {
  cursor: not-allowed;
  position: relative;
}

.locked-lite {
  background: rgba(241, 244, 249, 0.78) !important;
  border: 1px solid rgba(186, 195, 210, 0.72) !important;
  color: #8b95a7 !important;
  opacity: 0.72;
}

.locked-lite::after,
.locked-icon::after {
  background: rgba(176, 184, 198, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  content: "";
  height: 8px;
  padding: 0;
  position: absolute;
  right: 5px;
  top: 5px;
  width: 8px;
}

.locked-icon {
  opacity: 0.48;
}

.locked-frame {
  overflow: hidden;
}

.locked-frame::before {
  background: rgba(244, 246, 250, 0.7);
  border: 1px solid rgba(181, 190, 204, 0.62);
  border-radius: inherit;
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.locked-frame::after {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(174, 184, 199, 0.66);
  border-radius: 999px;
  color: #778195;
  content: "暂未开放";
  font-size: 11px;
  font-weight: 900;
  left: 50%;
  padding: 5px 9px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  z-index: 2;
}

.rail-user {
  align-items: center;
  background: #e9eefb;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #203461;
  display: flex;
  font-size: 12px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.conversation-list,
.message-pane,
.insight-panel {
  border-right: 1px solid var(--line);
  min-height: 0;
}

.conversation-list {
  background: #fbfcff;
  overflow: auto;
  padding: 28px 24px;
}

.inbox-title,
.message-header,
.composer-actions,
.card-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.inbox-title-actions {
  display: flex;
  gap: 8px;
}

.mobile-settings {
  display: none;
}

h2,
h3,
p {
  margin-top: 0;
}

h2 {
  font-size: 27px;
  line-height: 1.15;
  margin-bottom: 0;
}

.square-button {
  background: white;
  border: 1px solid var(--line);
  color: #657187;
  font-size: 20px;
}

.store-card {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  margin: 24px 0 14px;
  padding: 14px;
}

.merchant-link {
  align-items: center;
  background: #f6f8ff;
  border: 1px solid #dbe5ff;
  border-radius: 10px;
  color: #253454;
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  margin-top: 2px;
  padding: 10px 11px;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.merchant-link:hover {
  background: #edf3ff;
  border-color: #b9caff;
  transform: translateY(-1px);
}

.merchant-link strong,
.merchant-link small {
  display: block;
}

.merchant-link strong {
  color: #234083;
  font-size: 12px;
  font-weight: 900;
}

.merchant-link small {
  font-size: 11px;
  margin-top: 3px;
}

.merchant-link-arrow {
  color: var(--blue);
  font-size: 18px;
  font-weight: 800;
}

.store-avatar,
.avatar {
  align-items: center;
  border-radius: 14px;
  color: white;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.store-avatar {
  background: #192842;
}

.store-avatar.green {
  background: #69a737;
}

.connected {
  background: #eaf7ef;
  border-radius: 999px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.search-box {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  padding: 0 12px;
}

.search-box input {
  border: 0;
  box-shadow: none;
  padding: 12px 0;
}

.search-box:has(.locked-control) {
  background: rgba(248, 249, 252, 0.86);
  border-color: rgba(186, 195, 210, 0.7);
}

.search-box .locked-control {
  color: #8b95a7;
  cursor: not-allowed;
}

kbd {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 6px;
}

.filters {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 22px;
  margin: 18px -24px 0;
  padding: 0 24px;
}

.chip {
  background: transparent;
  border-bottom: 2px solid transparent;
  color: #596579;
  font-weight: 800;
  padding: 13px 0;
}

.chip.active {
  border-color: var(--blue);
  color: var(--text);
}

.chip span {
  color: var(--faint);
  margin-left: 5px;
}

.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 18px 0 10px;
}

.conversation-items {
  display: grid;
  gap: 6px;
}

.conversation-card {
  align-items: center;
  border-radius: 16px;
  cursor: pointer;
  display: grid;
  gap: 13px;
  grid-template-columns: auto 1fr auto;
  min-height: 84px;
  padding: 12px 10px;
  position: relative;
}

.conversation-card.active {
  background: #f1f5ff;
}

.conversation-card:hover {
  background: #f7f9ff;
}

.conversation-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.conversation-card strong,
.conversation-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-card .row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.conversation-card mark {
  background: #eaf7ef;
  border-radius: 999px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  justify-self: start;
  padding: 3px 8px;
}

.unread-dot {
  align-items: center;
  background: var(--blue);
  border-radius: 50%;
  color: white;
  display: flex;
  font-size: 11px;
  font-weight: 900;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.avatar.violet {
  background: #5947db;
}

.avatar.amber {
  background: #d68a1f;
}

.avatar.rose {
  background: #c7449c;
}

.avatar.sky {
  background: #2387cf;
}

.avatar.teal {
  background: #1d9d95;
}

.message-pane {
  background:
    linear-gradient(rgba(232, 236, 246, 0.44) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 236, 246, 0.44) 1px, transparent 1px),
    #ffffff;
  background-size: 48px 48px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
}

.message-header {
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  padding: 22px 28px;
}

.message-header h2 {
  font-size: 18px;
  margin-bottom: 7px;
}

.message-header p {
  color: var(--muted);
  margin: 0;
}

.presence {
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  margin-right: 6px;
  width: 8px;
}

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

.resolve-button {
  background: #eef2ff;
  border: 1px solid #dce3ff;
  color: #3151b7;
}

.day-divider {
  color: var(--faint);
  font-size: 12px;
  padding: 18px 28px 0;
  text-align: center;
}

.day-divider span {
  background: white;
  padding: 0 14px;
}

.messages {
  align-content: start;
  display: grid;
  gap: 18px;
  overflow: auto;
  padding: 22px 56px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(28, 41, 70, 0.04);
  line-height: 1.55;
  max-width: 78%;
  padding: 15px 17px;
}

.message.inbound {
  background: white;
  justify-self: start;
}

.message.inbound div {
  border-left: 4px solid var(--blue);
  padding-left: 14px;
}

.message.outbound {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  justify-self: end;
}

.message.internal {
  background: #f8f6ff;
  border-color: #ddd7ff;
  color: #5142b6;
  justify-self: center;
}

.message small {
  color: inherit;
  display: block;
  font-size: 11px;
  margin-top: 9px;
  opacity: 0.72;
}

.message-language {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
}

.composer {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  display: grid;
  gap: 10px;
  margin: 0 22px;
  padding: 0 14px 14px;
}

.composer-tabs {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
}

.composer-tabs button {
  background: transparent;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 12px 0;
}

.composer-tabs .tab-active {
  border-color: var(--purple);
  color: var(--text);
}

.composer-tabs select {
  margin-left: auto;
  max-width: 112px;
  padding: 7px 10px;
}

textarea {
  border: 0;
  box-shadow: none;
  min-height: 82px;
  resize: vertical;
}

.ghost-action {
  background: transparent;
  color: var(--muted);
  height: 30px;
  width: 30px;
}

.composer-actions > div {
  align-items: center;
  display: flex;
  gap: 8px;
}

#sendButton:disabled {
  opacity: 0.45;
}

.insight-panel {
  background: #fbfcff;
  overflow: auto;
  padding: 24px 18px;
}

.insight-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 28px;
}

.insight-header h2 {
  font-size: 18px;
}

.status-pill,
.tag {
  background: #eef2ff;
  border-radius: 999px;
  color: #4458bd;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.customer-summary {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr;
  margin-bottom: 18px;
}

.customer-summary small {
  display: block;
  margin-top: 3px;
}

.mini-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

.mini-cards article,
.analysis-card,
.handoff-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(30, 42, 72, 0.04);
}

.mini-cards article {
  padding: 12px;
  position: relative;
}

.mini-cards strong {
  display: block;
  font-size: 13px;
  margin-top: 8px;
}

.analysis-card {
  line-height: 1.55;
  margin-bottom: 12px;
  padding: 15px;
}

.analysis-card.soft {
  background: #f5f7ff;
  border-color: #dde4ff;
}

.card-heading span {
  background: #eaf7ef;
  border-radius: 999px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}

.tiny-button {
  background: #edf3ff;
  border-radius: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
}

dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: -6px 0 0;
}

.quick-tags {
  margin: 22px 0 14px;
}

.quick-tags h3 {
  color: #4b5568;
  font-size: 13px;
}

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

.notes {
  margin-bottom: 0;
}

.handoff-card {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr auto;
  margin-top: 14px;
  padding: 13px;
}

.toast {
  background: #15213a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  bottom: 24px;
  box-shadow: 0 18px 50px rgba(21, 39, 75, 0.24);
  color: white;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.drawer-scrim {
  background: rgba(20, 30, 50, 0.18);
  inset: 0;
  position: fixed;
  z-index: 30;
}

.merchant-drawer {
  background: #fbfcff;
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(21, 39, 75, 0.16);
  display: grid;
  gap: 18px;
  grid-template-rows: auto auto 1fr auto;
  height: 100vh;
  overflow: auto;
  padding: 24px;
  position: fixed;
  right: 0;
  top: 0;
  width: min(460px, 100vw);
  z-index: 40;
}

.merchant-drawer header,
.setup-progress,
.channel-card-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.setup-progress {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
}

.setup-progress small {
  display: block;
  margin-top: 5px;
}

#setupStatus {
  background: #eaf7ef;
  border-radius: 999px;
  color: var(--green);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
}

.simulation-pill {
  background: #eef2ff;
  color: #4458bd;
}

.channel-cards {
  display: grid;
  gap: 12px;
}

.channel-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(30, 42, 72, 0.04);
  display: grid;
  gap: 14px;
  min-height: 118px;
  padding: 16px;
  position: relative;
}

.channel-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 6px 0 0;
}

.channel-card dl {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.connect-button {
  background: var(--blue);
  border-radius: 10px;
  color: white;
  font-weight: 900;
  justify-self: start;
  padding: 10px 13px;
}

.channel-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.real-channel-gate {
  align-items: center;
  background: rgba(244, 246, 250, 0.8);
  border: 1px solid rgba(181, 190, 204, 0.7);
  border-radius: 16px;
  color: #707b8e;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 16px;
  text-align: left;
}

.real-channel-gate span {
  display: grid;
  gap: 5px;
}

.real-channel-gate small {
  line-height: 1.4;
}

.real-channel-gate em {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(174, 184, 199, 0.75);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  padding: 5px 9px;
  white-space: nowrap;
}

.page-picker {
  align-items: flex-start;
  display: grid;
  gap: 8px;
  justify-items: start;
}

.page-picker strong {
  color: var(--text);
  font-size: 13px;
}

.channel-loading,
.webhook-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.webhook-card {
  display: grid;
  gap: 8px;
}

.webhook-card code {
  background: #eef2ff;
  border-radius: 8px;
  color: #3151b7;
  padding: 8px 10px;
}

.simulation-scrim {
  align-items: center;
  background: rgba(20, 30, 50, 0.34);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 50;
}

.simulation-modal {
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(21, 39, 75, 0.28);
  max-width: 430px;
  overflow: hidden;
  width: 100%;
}

.simulation-modal header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
}

.simulation-modal h3 {
  font-size: 20px;
}

.simulation-content {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.simulation-provider {
  align-items: center;
  background: #eef2ff;
  border: 1px solid #dce4ff;
  border-radius: 12px;
  display: flex;
  gap: 10px;
  padding: 12px;
}

.simulation-provider > span {
  align-items: center;
  background: #1d4ed8;
  border-radius: 9px;
  color: white;
  display: flex;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.simulation-provider small,
.simulation-copy,
.simulation-option small {
  color: var(--muted);
}

.simulation-provider small {
  display: block;
  margin-top: 2px;
}

.simulation-copy {
  line-height: 1.5;
  margin: 0;
}

.simulation-option {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 8px;
  padding: 11px;
}

.simulation-option small {
  margin-left: auto;
}

.simulation-form {
  display: grid;
  gap: 12px;
}

.simulation-form label {
  display: grid;
  font-size: 13px;
  font-weight: 800;
  gap: 6px;
}

.simulation-form input,
.simulation-form textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.simulation-form textarea {
  min-height: 100px;
}

.workspace-logo.small {
  border-radius: 10px;
  font-size: 14px;
  height: 34px;
  width: 34px;
}

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

  .insight-panel {
    display: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .rail {
    display: none;
  }

  .mobile-settings {
    display: inline-flex;
  }

  .conversation-list,
  .message-pane {
    border-right: 0;
  }

  .conversation-list {
    max-height: 48vh;
  }

  .messages {
    padding: 18px;
  }

  .message {
    max-width: 100%;
  }

  .composer {
    margin: 0;
    border-radius: 0;
  }
}
