:root {
  --green: #07c160;
  --green-dark: #06a552;
  --green-soft: #e8f8ef;
  --ink: #14201a;
  --text: #2c3632;
  --muted: #7b8781;
  --line: #e6ebe8;
  --bg: #f4f6f5;
  --card: #ffffff;
  --warn: #f59e0b;
  --danger: #e5484d;
  --sidebar: #0d1b14;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 34, 24, 0.04), 0 10px 30px rgba(16, 34, 24, 0.06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar);
  color: #dfe9e3;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px; }

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: cover;
  flex: 0 0 38px;
  background: #fff;
}

.brand strong { display: block; font-size: 14px; color: #fff; letter-spacing: 0.3px; }
.brand small { display: block; font-size: 11px; color: #7f9a8b; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #a9bdb1;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg { width: 18px; height: 18px; fill: currentColor; opacity: 0.9; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #eaf3ee; }
.nav-item.active { background: rgba(7, 193, 96, 0.16); color: #7ff0b1; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.account-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.account-chip strong { display: block; font-size: 12.5px; color: #f2f8f4; }
.account-chip small { display: block; font-size: 11px; color: #8aa295; margin-top: 2px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: 0 0 8px; }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.dot.ok { box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.18); }

.sidebar-note { margin: 0; font-size: 10.5px; color: #62786b; padding: 0 6px; }

/* ---------- Main ---------- */

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; max-width: 1180px; margin: 0 auto; width: 100%; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: 0.3px; color: var(--ink); }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.view.hidden { display: none; }

/* ---------- Buttons ---------- */

.btn {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover { border-color: #cfd8d3; background: #fafcfb; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f2c7c8; }
.btn.danger:hover { background: #fdf2f2; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

/* ---------- Cards & layout ---------- */

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.growth-mini table { min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; color: var(--ink); }
.card-head .hint { font-size: 12px; color: var(--muted); }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: 0.5px; line-height: 1.1; }
.stat .sub { font-size: 11.5px; color: var(--muted); }

.banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid #f6e3c2;
  background: #fff9ef;
  margin-bottom: 18px;
}

.banner strong { color: #8a5a00; display: block; margin-bottom: 4px; font-size: 13.5px; }
.banner p { margin: 0; color: #9a7635; font-size: 12.5px; line-height: 1.7; }
.banner .badge { flex: 0 0 auto; margin-top: 1px; }
.banner.ok { background: var(--green-soft); border-color: #cdeedb; }
.banner.ok strong { color: #0a7a41; }
.banner.ok p { color: #256b47; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #f2f5f3;
  color: #5f6f67;
}

.badge.green { background: var(--green-soft); color: #0a8a47; }
.badge.warn { background: #fdf1dd; color: #a86a05; }
.badge.blue { background: #e9f2fe; color: #2563c9; }
.badge.gray { background: #eff1f0; color: #6b7872; }
.badge.red { background: #fdecec; color: #c0363a; }

/* ---------- Toolbar ---------- */

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

.input, .select, .textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 8px 11px;
  outline: none;
  font-size: 13px;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.input.search { min-width: 240px; }
.input:disabled, .select:disabled, .textarea:disabled, .btn:disabled { background: #f6f8f7; color: #9aa7a0; cursor: not-allowed; opacity: 0.75; }
.textarea { width: 100%; min-height: 74px; resize: vertical; line-height: 1.7; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  color: #5f6f67;
}
.chip.active { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: #fafcfb; white-space: nowrap; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfdfc; }

.item-title { color: var(--ink); font-weight: 600; text-decoration: none; line-height: 1.5; }
.item-title:hover { color: var(--green-dark); }
.item-summary { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta-line { color: var(--muted); font-size: 12px; white-space: nowrap; }
.kw { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 6px; background: #f2f6f4; border-radius: 4px; font-size: 10.5px; color: #5f7568; }
.star { border: 0; background: none; cursor: pointer; font-size: 16px; color: #c7d2cc; padding: 0 4px; }
.star.on { color: #f2b400; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { width: 54px; height: 40px; border-radius: 6px; object-fit: cover; background: #eef2f0; display: block; }

.selection-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 10px; background: var(--green-soft); border: 1px solid #cdeedb; margin-bottom: 12px; font-size: 12.5px; color: #0a7a41; }

/* ---------- Draft cards ---------- */

.draft-list { display: flex; flex-direction: column; gap: 14px; }

.draft-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.draft-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.draft-title { margin: 0 0 8px; font-size: 16px; color: var(--ink); }
.draft-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.draft-excerpt { margin: 10px 0 0; font-size: 12.5px; color: #6b7872; line-height: 1.7; }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); font-size: 13px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 6px; font-size: 14px; }

/* ---------- Logs ---------- */

.log-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: auto; }
.log-item { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; color: #5d6b64; }
.log-time { color: #9aa7a0; font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-level { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-top: 5px; }
.log-level.warn { background: var(--warn); }
.log-level.error { background: var(--danger); }

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: #5f6f67; font-weight: 600; }
.field .hint { font-size: 11px; color: var(--muted); line-height: 1.5; }
.field.full { grid-column: 1 / -1; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); }
.switch input { width: 16px; height: 16px; accent-color: var(--green); }

.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ---------- Modal ---------- */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12, 24, 18, 0.45); backdrop-filter: blur(2px); }
.modal-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: min(1080px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; color: var(--ink); }
.modal-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr); gap: 0; overflow: hidden; flex: 1; min-height: 0; }
.preview-pane { background: #e9ecea; padding: 16px; overflow: auto; }
.preview-pane iframe { width: 100%; height: 100%; min-height: 520px; border: 0; background: #fff; border-radius: 10px; }
.edit-pane { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; border-left: 1px solid var(--line); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.kv strong { color: var(--text); font-weight: 600; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  background: #10241a;
  color: #eaf7ef;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 420px;
  line-height: 1.5;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #3a1416; color: #ffd9da; }

.hint { color: var(--muted); font-size: 12px; line-height: 1.7; }

.flow { margin: 0; padding-left: 20px; color: #5f6f67; font-size: 12.5px; line-height: 2; }
.flow li { margin-bottom: 2px; }
.flow strong { color: var(--ink); }

code { background: #f1f5f3; padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.loading { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
.btn .loading { border-color: rgba(0, 0, 0, 0.15); border-top-color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 菜单与欢迎语 ---------- */

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

.phone-mock {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
}

.phone-head {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.phone-chat {
  min-height: 220px;
  background: #ededed;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-end;
}

.chat-system { text-align: center; font-size: 11px; color: #9b9b9b; }

.chat-bubble {
  background: #fff;
  border-radius: 6px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.7;
  color: #333;
  max-width: 94%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-card {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  width: 94%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.chat-card .cc-cover { width: 100%; height: 118px; object-fit: cover; display: block; background: #dfe5e2; }
.chat-card .cc-body { padding: 10px 12px; }
.chat-card .cc-title { font-size: 13px; font-weight: 600; color: #222; line-height: 1.5; }
.chat-card .cc-digest { font-size: 11.5px; color: #888; margin-top: 4px; line-height: 1.55; }
.chat-card .cc-link { font-size: 11px; color: #999; margin-top: 8px; }

.phone-menu-sub { display: flex; flex-direction: column; background: #fff; border-top: 1px solid #e6e6e6; }
.phone-menu-sub button {
  padding: 11px 8px;
  font-size: 12.5px;
  border: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  color: #444;
  cursor: pointer;
}
.phone-menu-sub button:last-child { border-bottom: 0; }
.phone-menu-sub button.active, .phone-menu-bar button.active { color: var(--green); font-weight: 700; }

.phone-menu-bar { display: flex; background: #fafafa; border-top: 1px solid #e6e6e6; }
.phone-menu-bar button {
  flex: 1;
  padding: 13px 4px;
  border: 0;
  border-right: 1px solid #ececec;
  background: transparent;
  font-size: 12.5px;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phone-menu-bar button:last-child { border-right: 0; }
.phone-menu-bar button.active { color: var(--green); }

.menu-editor { display: flex; flex-direction: column; gap: 14px; }
.menu-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-status { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }

.sub-editor-list { display: flex; flex-direction: column; gap: 8px; }
.sub-editor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  background: #fafcfb;
}
.sub-editor-item.active { border-color: var(--green); background: var(--green-soft); }

.welcome-fields { display: flex; flex-direction: column; gap: 12px; }
.char-count { font-size: 11px; color: var(--muted); text-align: right; margin-top: -6px; }

.version-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.version-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: #5f6f67;
}
.version-item p {
  margin: 0;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.remote-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cdeedb;
  background: var(--green-soft);
  border-radius: 10px;
  font-size: 12.5px;
  color: #0a7a41;
}
.remote-box p { margin: 6px 0 10px; white-space: pre-wrap; color: #256b47; }

.hint-line { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .menu-layout, .welcome-layout { grid-template-columns: 1fr; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-body { grid-template-columns: 1fr; }
  .preview-pane { display: none; }
}

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: column; padding: 14px; gap: 14px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 18px 16px 40px; }
  .topbar { flex-direction: column; }
  .grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .input.search { min-width: 0; width: 100%; }
}

/* ---------- Auth ---------- */

.hidden { display: none !important; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(7, 193, 96, 0.18), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(14, 116, 144, 0.18), transparent 60%),
    #0b1510;
}

.auth-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 30px 28px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.auth-logo { width: 48px; height: 48px; border-radius: 13px; object-fit: cover; background: #fff; }
.auth-card h1 { margin: 16px 0 6px; font-size: 22px; color: var(--ink); letter-spacing: 0.2px; }
.auth-sub { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: #41504a; }
.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 400;
  background: #fff;
}
.auth-form input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.14); }
.auth-error { min-height: 18px; margin: 0; font-size: 12.5px; color: var(--danger); }
.auth-submit { width: 100%; padding: 11px; font-size: 14px; }
.auth-hint { margin: 16px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------- Navigation groups ---------- */

.nav { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2a3a31 transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #223129; border-radius: 3px; }
.nav-group {
  padding: 10px 12px 2px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #63796c;
  text-transform: uppercase;
}
.nav-item.hidden, .nav-group.hidden { display: none; }
.user-chip { margin-top: 2px; }
.user-chip .btn { margin-left: auto; padding: 4px 9px; font-size: 11px; color: #cfe3d6; border-color: rgba(255, 255, 255, 0.16); background: transparent; }
.user-chip .btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* ---------- New modals ---------- */

.modal-head h2 { margin: 0; font-size: 16px; color: var(--ink); }
.modal-head .hint { margin: 4px 0 0; }
.icon-btn {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}
.icon-btn:hover { background: #f2f5f3; color: var(--ink); }

#modal-form.modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  padding: 18px 20px;
  overflow-y: auto;
}
.modal-body.lead-detail { display: block; padding: 18px 20px; overflow-y: auto; }
.modal-body textarea.input { resize: vertical; min-height: 80px; font-family: inherit; line-height: 1.65; }

.lead-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
  margin-bottom: 14px;
}
.lead-message {
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.lead-message .label { font-size: 11.5px; color: var(--muted); }
.lead-message p { margin: 6px 0 0; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }

.form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.timeline { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { border-left: 2px solid #cdeedb; padding-left: 12px; font-size: 12.5px; }
.timeline p { margin: 4px 0; color: var(--text); white-space: pre-wrap; }
.card-head h3 { margin: 0; font-size: 14px; color: var(--ink); }

/* ---------- Analytics ---------- */

.trend-row {
  display: grid;
  grid-template-columns: 46px 1fr 158px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.trend-date { font-variant-numeric: tabular-nums; }
.trend-bar { height: 8px; background: #eef2f0; border-radius: 999px; overflow: hidden; }
.trend-bar i { display: block; height: 100%; background: linear-gradient(90deg, #07c160, #4ade80); border-radius: 999px; min-width: 2px; }
.trend-value { text-align: right; font-variant-numeric: tabular-nums; }
.funnel-row {
  display: grid;
  grid-template-columns: 90px 46px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  margin-bottom: 10px;
  color: var(--muted);
}
.funnel-row b { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.funnel-row i { height: 10px; background: var(--green); opacity: 0.72; border-radius: 4px; min-width: 2px; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 780px) {
  .main { padding: 20px 16px 48px; }
  .topbar { flex-direction: column; }
  .input.search { min-width: 0; width: 100%; }
  #modal-form.modal-body, .form-grid, .form-grid.compact, .lead-grid { grid-template-columns: minmax(0, 1fr); }
  .field.full { grid-column: auto; }
  .modal-card { width: 96vw; }
  .nav-group { display: none; }
  .nav { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .nav-item { white-space: nowrap; }
}
