:root {
  color-scheme: light;
  --bg: #f4ecdf;
  --bg-soft: #fbf5eb;
  --panel: #fffaf2;
  --line: #e6d8c6;
  --line-strong: #d7c3aa;
  --text: #2d241b;
  --muted: #7b6854;
  --muted-soft: #9f8b75;
  --nav: #2a1d14;
  --nav-soft: #3b2a1d;
  --blue: #b86b33;
  --blue-deep: #925224;
  --blue-soft: #f7ead6;
  --green: #a46d2b;
  --green-soft: #f6ead8;
  --red: #c56b55;
  --red-soft: #f7e6de;
  --orange: #cf8b3e;
  --orange-soft: #fff0df;
  --gold: #d6a35c;
  --shadow: 0 20px 48px rgba(70, 44, 21, 0.1);
  --shadow-soft: 0 12px 30px rgba(70, 44, 21, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

input,
textarea,
select {
  outline: none;
}

textarea {
  resize: vertical;
}

svg {
  width: 100%;
  height: 100%;
}

svg path,
svg circle,
svg rect,
svg polyline,
svg line {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.app-root {
  min-height: 100vh;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 42vw) 1fr;
  background: var(--bg);
}

.auth-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.18), transparent 22%),
    linear-gradient(180deg, #c28a42 0%, #a5622b 44%, #6e4422 100%);
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 92%);
}

.auth-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 540px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 48px 52px 42px;
}

.auth-brand,
.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 42px;
}

.auth-brand strong,
.sidebar-brand strong {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-square {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--blue);
  font-size: 1.3rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.brand-square-image {
  overflow: hidden;
  padding: 0;
  background: rgba(255, 248, 235, 0.96);
}

.brand-square-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.brand-square-small {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
}

.auth-copy {
  margin-top: 56px;
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(2.9rem, 4vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.auth-copy p {
  max-width: 450px;
  margin: 30px 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.84);
}

.auth-copyright {
  margin: auto 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.95rem;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px 56px;
}

.auth-panel-inner {
  width: min(100%, 478px);
}

.auth-panel-head h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.auth-panel-head p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.auth-form-card {
  margin-top: 34px;
  padding: 34px 36px 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 24px;
}

.field-block {
  display: grid;
  gap: 10px;
}

.field-block span {
  color: #4d5b6d;
  font-size: 0.98rem;
}

.field-block input,
.setting-input,
.setting-select,
.editor-title-input,
.editor-body,
.search-box input,
.search-box-large input,
.select-wrap select,
.chat-composer textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.field-block input,
.setting-input,
.setting-select,
.select-wrap select {
  min-height: 52px;
  padding: 0 18px;
}

.field-block input:focus,
.setting-input:focus,
.setting-select:focus,
.editor-title-input:focus,
.editor-body:focus,
.search-box input:focus,
.search-box-large input:focus,
.select-wrap select:focus,
.chat-composer textarea:focus {
  border-color: rgba(184, 107, 51, 0.55);
  box-shadow: 0 0 0 4px rgba(184, 107, 51, 0.12);
}

.form-meta-row,
.header-actions,
.aside-head,
.alert-head,
.composer-actions,
.sync-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.remember-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #5f6c80;
}

.remember-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

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

.primary-large-button,
.primary-button,
.outline-button,
.amber-button {
  min-height: 48px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 600;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.primary-large-button,
.primary-button {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(47, 107, 243, 0.25);
}

.outline-button {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #586579;
}

.amber-button {
  border: 1px solid #f0d19e;
  background: #fff6e7;
  color: #ad6b0f;
}

.primary-large-button:hover,
.primary-button:hover,
.outline-button:hover,
.amber-button:hover,
.tool-button:hover,
.tool-chip:hover,
.nav-item:hover,
.platform-chip:hover,
.helper-button:hover,
.icon-button:hover,
.logout-button:hover {
  transform: translateY(-1px);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 274px 1fr;
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, #2a1d14 0%, #23180f 100%);
  color: #fff;
}

.sidebar-brand {
  min-height: 52px;
  padding: 0 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #f4f7ff;
  background: transparent;
  text-align: left;
}

.nav-item.is-active {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 20px rgba(184, 107, 51, 0.24);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: currentColor;
}

.nav-text {
  min-width: 0;
  font-size: 0.98rem;
  white-space: nowrap;
}

.nav-badge {
  margin-left: auto;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--blue);
  font-weight: 700;
  font-size: 0.9rem;
}

.nav-badge-danger {
  background: var(--red);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 12px 16px;
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(145deg, #8f6539, #b4874f);
}

.profile-copy {
  display: grid;
  gap: 4px;
}

.profile-copy strong {
  font-size: 1rem;
}

.profile-copy span {
  color: #7890b2;
}

.logout-button {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  color: #ff7f87;
  background: rgba(255, 255, 255, 0.05);
}

.admin-main {
  min-width: 0;
  display: grid;
  grid-template-rows: 66px 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 0;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.icon-button {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #8e98a7;
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.dot-badge,
.count-badge {
  position: absolute;
  top: -2px;
  right: -2px;
}

.dot-badge {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.count-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
}

.page-content {
  min-height: 0;
  overflow: auto;
  padding: 28px;
}

.page-header,
.pricing-hero {
  margin-bottom: 24px;
}

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

.page-header h2,
.pricing-hero h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.page-meta,
.page-subnote,
.pricing-hero p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.view-panel {
  display: none;
  animation: rise 220ms ease;
}

.view-panel.is-active {
  display: block;
}

.surface-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

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

.metric-card {
  min-height: 180px;
  padding: 26px 26px 24px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.metric-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.metric-label {
  color: #667284;
  font-size: 1rem;
}

.metric-value {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric-icon-bubble {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
}

.metric-icon-bubble svg {
  width: 24px;
  height: 24px;
}

.metric-trend {
  color: var(--muted-soft);
  font-size: 0.98rem;
}

.metric-trend strong {
  margin-right: 6px;
  font-weight: 700;
}

.metric-trend.positive strong {
  color: var(--green);
}

.metric-trend.negative strong {
  color: var(--muted);
}

.metric-trend.warning strong {
  color: var(--red);
}

.dashboard-grid,
.content-grid,
.lead-layout,
.analytics-grid,
.account-grid,
.plan-grid {
  display: grid;
  gap: 24px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1.02fr) minmax(280px, 0.9fr);
  align-items: start;
}

.funnel-card,
.bars-card,
.alert-card,
.editor-card,
.aside-card,
.lead-card,
.chart-card,
.donut-card,
.tag-card,
.sync-card,
.account-card,
.plan-card {
  padding: 28px;
}

.funnel-card h3,
.bars-card h3,
.alert-card h3,
.aside-card h3,
.chart-card h3,
.donut-card h3,
.tag-card h3,
.sync-card h3,
.lead-detail-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.funnel-stack {
  margin-top: 26px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.funnel-stage {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8f5a22;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.stage-one {
  width: min(100%, 84%);
  background: #efddbc;
}

.stage-two {
  width: min(100%, 66%);
  background: #e2c18f;
}

.stage-three {
  width: min(100%, 48%);
  background: #d2a56a;
}

.stage-four {
  width: min(100%, 34%);
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
}

.platform-bars {
  margin-top: 24px;
  display: grid;
  gap: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  align-items: center;
  gap: 16px;
}

.bar-row span {
  color: #5b6779;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe5d6;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.alert-card {
  border-top: 4px solid var(--red);
}

.alert-pill {
  padding: 7px 14px;
  border-radius: 999px;
  background: #fdeaea;
  color: #d96a66;
  font-weight: 600;
}

.alert-list {
  margin-top: 24px;
  display: grid;
  gap: 14px;
}

.alert-item {
  padding: 16px 18px;
  border: 1px solid #f2d9d8;
  border-radius: 16px;
  background: #fffafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alert-copy {
  display: grid;
  gap: 6px;
}

.alert-copy strong {
  font-size: 1rem;
}

.alert-copy span {
  color: #d56f69;
}

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

.content-grid {
  grid-template-columns: minmax(0, 1.55fr) 300px;
  align-items: start;
}

.editor-card {
  display: grid;
  gap: 20px;
}

.editor-title-input {
  padding: 0 0 16px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  box-shadow: none;
}

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

.tool-button,
.tool-chip {
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: #526073;
}

.tool-button svg {
  width: 18px;
  height: 18px;
}

.text-tool {
  font-weight: 800;
  font-size: 1rem;
}

.tool-chip {
  width: auto;
  color: var(--blue);
  background: var(--blue-soft);
}

.editor-body {
  min-height: 276px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #435062;
  line-height: 1.85;
}

.editor-media-strip {
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.media-placeholder,
.media-thumb {
  width: 92px;
  height: 92px;
  border-radius: 16px;
  overflow: hidden;
}

.media-placeholder {
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px dashed var(--line-strong);
  background: #fbf5ec;
  color: #99a4b4;
}

.media-placeholder span {
  font-size: 1.6rem;
  line-height: 1;
}

.media-thumb {
  position: relative;
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 210, 188, 0.85), transparent 26%),
    linear-gradient(180deg, #f2d9b7 0%, #b98d5b 50%, #6d4725 100%);
}

.media-thumb::before {
  content: "";
  position: absolute;
  inset: auto 8px 0 auto;
  width: 86px;
  height: 48px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(154, 117, 73, 0.82));
  clip-path: polygon(0 100%, 42% 30%, 55% 52%, 78% 0, 100% 100%);
}

.media-thumb::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 236, 180, 0.92);
}

.media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(239, 83, 80, 0.25);
}

.publish-aside {
  display: grid;
  gap: 18px;
}

.aside-head span {
  color: var(--muted);
}

.platform-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.platform-chip {
  min-height: 72px;
  padding: 16px 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
}

.platform-dot {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
}

.platform-name {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.platform-check {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--blue);
  opacity: 0;
}

.platform-check svg {
  width: 12px;
  height: 12px;
}

.platform-chip.is-selected {
  border-color: rgba(184, 107, 51, 0.35);
  background: #fbf3e6;
  box-shadow: inset 0 0 0 1px rgba(184, 107, 51, 0.12);
}

.platform-chip.is-selected .platform-check {
  opacity: 1;
}

.settings-tabs {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-tab {
  padding: 9px 12px;
  border-radius: 999px;
  background: #f3ece3;
  color: #5d6a7e;
  font-weight: 600;
}

.settings-tab.is-active {
  background: var(--blue-soft);
  color: var(--blue);
}

.settings-panel {
  margin-top: 16px;
  display: grid;
  gap: 16px;
}

.setting-group {
  display: grid;
  gap: 8px;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #677487;
  font-size: 0.96rem;
}

.setting-label .platform-dot {
  width: 10px;
  height: 10px;
}

.setting-textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  line-height: 1.6;
}

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

.hash-pill {
  padding: 8px 12px;
  border-radius: 12px;
  background: #f5f8fc;
  color: #556275;
}

.inbox-shell {
  min-height: 630px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 130px 280px 1fr;
}

.inbox-pane {
  min-width: 0;
}

.inbox-channel-pane,
.inbox-thread-pane {
  border-right: 1px solid var(--line);
}

.pane-head,
.pane-search,
.chat-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.pane-head h3 {
  margin: 0;
  font-size: 1rem;
}

.source-list,
.thread-list {
  max-height: 100%;
  overflow: auto;
}

.source-item {
  width: 100%;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5e6c7f;
  text-align: left;
}

.source-item.is-active {
  background: var(--blue-soft);
  color: var(--blue);
}

.source-item-count {
  margin-left: auto;
  min-width: 28px;
  height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.search-box,
.search-box-large {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #f5eee5;
}

.search-box svg,
.search-box-large svg {
  width: 20px;
  height: 20px;
  color: #94a0b1;
}

.search-box input,
.search-box-large input {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.thread-item {
  width: 100%;
  padding: 18px 18px 16px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.thread-item.is-active {
  background: #fbf3e7;
}

.thread-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.thread-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.thread-preview {
  color: var(--muted);
  line-height: 1.6;
}

.thread-time {
  color: #98a3b3;
  font-size: 0.92rem;
}

.chat-head {
  display: grid;
  gap: 8px;
}

.chat-head h3 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
}

.chat-head p {
  margin: 0;
  color: var(--muted);
}

.chat-history {
  min-height: 280px;
  padding: 22px 18px;
  display: grid;
  align-content: start;
  gap: 16px;
  background: linear-gradient(180deg, #fffaf2 0%, #f9f1e7 100%);
}

.chat-bubble {
  max-width: min(88%, 480px);
  padding: 14px 16px;
  border-radius: 16px;
  line-height: 1.65;
}

.chat-bubble.agent {
  justify-self: start;
  display: grid;
  gap: 10px;
}

.chat-bubble.agent .agent-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.agent-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #e4d3bd;
}

.agent-text,
.customer-text {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
}

.chat-bubble.customer {
  justify-self: end;
  border: 1px solid #e4d4bd;
  background: #fbf2e4;
}

.ai-suggestion-card {
  margin: 0 18px 18px;
  padding: 16px 18px;
  border: 1px solid #f0d3ab;
  border-radius: 16px;
  background: #fff7eb;
  display: grid;
  gap: 10px;
}

.ai-suggestion-head strong {
  color: #b6650f;
}

.ai-suggestion-card p {
  margin: 0;
  line-height: 1.7;
  color: #5b677a;
}

.quick-reply-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-reply-chip {
  padding: 10px 14px;
  border: 1px solid #ead0a8;
  border-radius: 999px;
  background: #fff;
  color: #8b5c23;
  font-weight: 600;
  text-align: left;
}

.quick-reply-chip:hover {
  border-color: rgba(184, 107, 51, 0.45);
  background: #fff5e6;
}

.chat-composer {
  padding: 0 18px 18px;
  display: grid;
  gap: 12px;
}

.chat-composer textarea {
  min-height: 104px;
  padding: 14px 16px;
  border-radius: 16px;
}

.composer-actions {
  justify-content: space-between;
}

.lead-card {
  position: relative;
}

.lead-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.search-box-large {
  flex: 1;
  min-height: 56px;
}

.select-wrap {
  position: relative;
  min-width: 132px;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #7a879a;
  border-bottom: 2px solid #7a879a;
  transform: translateY(-60%) rotate(45deg);
  pointer-events: none;
}

.select-wrap select {
  appearance: none;
  padding-right: 42px;
  background: #fff;
}

.advanced-filters {
  margin-bottom: 20px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: #fbf5ed;
}

.filter-chip {
  padding: 9px 12px;
  border-radius: 999px;
  background: #efe7dc;
  color: #657285;
  font-weight: 600;
}

.filter-chip.is-active {
  background: var(--blue-soft);
  color: var(--blue);
}

.lead-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.lead-table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
}

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

.lead-table th,
.lead-table td {
  padding: 18px 20px;
  text-align: left;
}

.lead-table th {
  color: #98a2b3;
  font-weight: 600;
  background: #fbfcfd;
}

.lead-table tbody tr {
  border-top: 1px solid var(--line);
  transition: background-color 180ms ease;
}

.lead-table tbody tr:hover,
.lead-table tbody tr.is-selected {
  background: #fbf3e8;
}

.lead-person {
  display: grid;
  gap: 6px;
}

.lead-person strong {
  font-size: 1rem;
}

.lead-person span {
  color: var(--muted);
}

.platform-badge {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
}

.intent-chip,
.status-chip {
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}

.intent-chip.high {
  background: #fae7d0;
  color: #b86d18;
}

.intent-chip.medium {
  background: #f5ecdc;
  color: #9c6d2a;
}

.intent-chip.low {
  background: #f1f3f6;
  color: #8b95a5;
}

.intent-chip.critical {
  background: #fdeaea;
  color: #d26d67;
}

.status-chip.following {
  background: #f1e7d8;
  color: #8a6334;
}

.status-chip.pending {
  background: #fff6e9;
  color: #b77a1b;
}

.status-chip.fresh {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-chip.closed {
  background: #f2f4f7;
  color: #7b8797;
}

.time-warning {
  color: #d46c65;
}

.lead-detail-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 18px;
}

.detail-head {
  display: grid;
  gap: 10px;
}

.detail-head h3 {
  margin: 0;
  font-size: 1.34rem;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.detail-block {
  display: grid;
  gap: 12px;
}

.detail-block strong {
  font-size: 0.98rem;
}

.detail-summary {
  margin: 0;
  line-height: 1.7;
  color: #566376;
}

.timeline-list {
  display: grid;
  gap: 14px;
}

.timeline-item {
  position: relative;
  padding-left: 18px;
  color: #5f6c80;
  line-height: 1.6;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.detail-actions {
  display: flex;
  gap: 12px;
}

.metric-grid-analytics {
  margin-bottom: 24px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.metric-grid-analytics .metric-card {
  min-height: 120px;
}

.analytics-grid {
  grid-template-columns: minmax(0, 1.4fr) 330px 260px;
  align-items: start;
}

.chart-card {
  min-height: 470px;
}

.line-chart-shell {
  margin-top: 24px;
  height: 340px;
  border-radius: 20px;
  background:
    linear-gradient(rgba(239, 229, 214, 0.94) 1px, transparent 1px),
    linear-gradient(90deg, rgba(239, 229, 214, 0.94) 1px, transparent 1px),
    #fff9f0;
  background-size: 100% 84px, 106px 100%, auto;
  overflow: hidden;
}

#trendChart {
  width: 100%;
  height: 100%;
}

#trendChart .chart-area {
  fill: rgba(184, 107, 51, 0.14);
  stroke: none;
}

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

#trendChart .chart-dot {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 3;
}

.chart-axis-labels {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  color: #97a2b2;
}

.donut-card {
  min-height: 470px;
}

.donut-visual {
  position: relative;
  width: 204px;
  height: 204px;
  margin: 28px auto;
  border-radius: 50%;
  background: conic-gradient(#c56b55 0 35%, #b77e34 35% 60%, #6e4a2b 60% 85%, #d29245 85% 100%);
}

.donut-hole {
  position: absolute;
  inset: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px #efe3d0;
}

.donut-hole strong {
  font-size: 2.2rem;
  line-height: 1;
}

.donut-hole span {
  color: var(--muted);
}

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

.legend-item {
  display: grid;
  gap: 6px;
}

.legend-topline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-item span {
  color: #5a6678;
}

.tag-cloud {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tag-pill {
  padding: 10px 14px;
  border-radius: 14px;
  background: #f1e8dc;
  color: #606c7e;
  font-weight: 600;
}

.tag-pill.hot {
  background: #fff0d9;
  color: #b56f17;
}

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

.account-card {
  display: grid;
  gap: 18px;
}

.account-card-head,
.account-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.account-title {
  justify-content: flex-start;
}

.account-title h3 {
  margin: 0;
  font-size: 1.12rem;
}

.connection-badge {
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
}

.connection-badge.connected {
  background: #f4e8d8;
  color: #97682b;
}

.connection-badge.pending {
  background: #fff5e7;
  color: #b86d18;
}

.connection-badge.offline {
  background: #f2f4f7;
  color: #7c8797;
}

.account-meta {
  color: var(--muted);
  line-height: 1.7;
}

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

.mini-stat {
  padding: 14px;
  border-radius: 16px;
  background: #f7efe6;
  display: grid;
  gap: 8px;
}

.mini-stat strong {
  font-size: 1.2rem;
}

.mini-stat span {
  color: var(--muted);
}

.sync-card {
  display: grid;
  gap: 18px;
}

.sync-list {
  display: grid;
}

.sync-row {
  padding: 16px 0;
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.8fr auto;
  gap: 14px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.sync-row:first-child {
  border-top: 0;
}

.sync-row span {
  color: #607082;
}

.pricing-hero {
  text-align: center;
}

.billing-toggle {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  background: #f3e7d6;
}

.billing-option {
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  color: #607084;
  font-weight: 700;
}

.billing-option.is-active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 10px 20px rgba(184, 107, 51, 0.12);
}

.save-badge {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(184, 107, 51, 0.12);
  font-size: 0.8rem;
}

.plan-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.plan-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 18px;
}

.plan-card.featured {
  border: 2px solid rgba(184, 107, 51, 0.5);
  box-shadow: 0 18px 38px rgba(184, 107, 51, 0.14);
}

.popular-badge {
  position: absolute;
  top: 0;
  right: 22px;
  transform: translateY(-50%);
  padding: 7px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #d29a49 0%, #b86b33 100%);
  color: #fff;
  font-weight: 700;
}

.plan-card h3 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.plan-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.price-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  color: #253246;
}

.price-row span {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.price-row strong {
  font-size: 3.4rem;
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.price-row em {
  margin-bottom: 6px;
  color: #677386;
  font-style: normal;
  font-size: 1rem;
}

.plan-action {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #f2e8dc;
  color: #324055;
  font-weight: 700;
}

.plan-card.featured .plan-action {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
  color: #fff;
}

.feature-list {
  display: grid;
  gap: 14px;
}

.feature-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #5c687b;
  line-height: 1.5;
}

.check-badge {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  color: var(--blue);
}

.check-badge svg {
  width: 14px;
  height: 14px;
}

.toast-stack {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 60;
  transform: translateX(-50%);
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 220px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(51, 34, 20, 0.94);
  color: #fff;
  box-shadow: 0 18px 32px rgba(15, 32, 68, 0.24);
  animation: toast-in 180ms ease, toast-out 220ms ease 2.8s forwards;
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@media (max-width: 1280px) {
  .metric-grid,
  .account-grid,
  .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .content-grid,
  .lead-layout {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
  }

  .auth-hero-inner {
    max-width: none;
  }

  .auth-copy {
    margin-top: 34px;
  }

  .auth-feature-grid {
    margin-top: 34px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar {
    padding: 0 20px;
  }

  .page-content {
    padding: 20px;
  }

  .inbox-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .inbox-channel-pane,
  .inbox-thread-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sync-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 720px) {
  .auth-hero-inner,
  .auth-panel {
    padding: 24px;
  }

  .auth-feature-grid,
  .metric-grid,
  .metric-grid-analytics,
  .platform-grid,
  .account-grid,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .page-header,
  .header-actions,
  .lead-toolbar,
  .detail-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    min-height: 66px;
  }

  .funnel-stage {
    width: 100%;
  }
}
