/* 招客台 — dark workbench */
:root {
  --bg: #080c14;
  --bg-wash: #0c121c;
  --elev: #101826;
  --surface: #151e2c;
  --surface-2: #1b2636;
  --surface-3: #223044;
  --line: rgba(196, 214, 236, 0.10);
  --line-strong: rgba(196, 214, 236, 0.18);
  --text: #eef3f8;
  --text-2: #b7c2d0;
  --muted: #8491a3;
  --brass: #e2b15a;
  --brass-2: #c8943e;
  --brass-ink: #2a1d08;
  --brass-soft: rgba(226, 177, 90, 0.14);
  --teal: #7eb9b1;
  --teal-soft: rgba(126, 185, 177, 0.14);
  --rose: #e08b84;
  --rose-soft: rgba(224, 139, 132, 0.14);
  --green: #86c28d;
  --green-soft: rgba(134, 194, 141, 0.14);
  --blue: #8aa7d6;
  --blue-soft: rgba(138, 167, 214, 0.14);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, sans-serif;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --space: 20px;
  --tap: 48px;
  --max: 430px;
  --wide: 920px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -80px, rgba(226, 177, 90, 0.07), transparent 55%),
    radial-gradient(800px 400px at 100% 0, rgba(126, 185, 177, 0.05), transparent 40%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--brass); }
::selection { background: var(--brass-soft); color: var(--text); }

.app {
  width: min(100%, var(--wide));
  margin: 0 auto;
  padding: 20px 16px 80px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(80px, env(safe-area-inset-bottom));
}
@media (min-width: 880px) {
  .app { padding: 36px 24px 96px; }
}

/* Header */
.topbar, .tool-head { margin-bottom: 22px; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  width: 40px; height: 40px; flex: 0 0 auto;
  color: var(--brass);
  background: var(--brass-soft);
  border: 1px solid rgba(226, 177, 90, 0.28);
  border-radius: 12px;
  display: grid; place-items: center;
}
.mark svg { width: 22px; height: 22px; }
.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0.12em;
  font-weight: 600;
  margin: 0;
}
.tagline {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.icon-btn, .btn, .btn-ghost, .btn-text, .btn-gold-text {
  border: 0;
  border-radius: 12px;
  min-height: var(--tap);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.icon-btn {
  width: var(--tap); min-width: var(--tap);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  display: grid; place-items: center;
  padding: 0;
}
.icon-btn:hover, .btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible, .btn:focus-visible, .btn-ghost:focus-visible,
.btn-text:focus-visible, .btn-gold-text:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px;
  background: var(--brass);
  color: var(--brass-ink);
  font-weight: 650;
  letter-spacing: 0.04em;
  width: 100%;
}
.btn:hover { background: #e8bc6d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 550;
}
.btn-text {
  background: transparent;
  color: var(--text-2);
  min-height: 40px;
  padding: 0 8px;
  font-size: 14px;
}
.btn-text:hover { color: var(--brass); }
.btn-gold-text {
  background: transparent;
  border: 1px solid rgba(226, 177, 90, 0.45);
  color: var(--brass);
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  border-radius: 10px;
  width: auto;
}
.btn-gold-text:hover { background: var(--brass-soft); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn, .btn-row .btn-ghost { width: auto; flex: 1 1 140px; }
.btn-danger { background: transparent; border: 1px solid rgba(224, 139, 132, 0.4); color: var(--rose); }
.btn-danger:hover { background: var(--rose-soft); }
.btn.btn-danger:not(.btn-ghost) {
  background: #c45c55;
  color: #fff;
  border: 0;
}
.btn.btn-danger:not(.btn-ghost):hover { background: #d16b64; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 14px; width: auto; flex: 0 0 auto; }
.data-entry {
  width: auto;
  min-width: var(--tap);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  letter-spacing: 0.06em;
  font-weight: 550;
  color: var(--text-2);
  white-space: nowrap;
}

/* Home */
.notice {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.notice p { margin: 0; }
.notice .btn-gold-text { align-self: flex-start; }
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
}
.tool-card {
  display: block;
  text-align: left;
  width: 100%;
  background: linear-gradient(180deg, var(--surface) 0%, var(--elev) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 40px;
  color: inherit;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
  min-height: 132px;
  position: relative;
}
.tool-card:hover {
  border-color: rgba(226, 177, 90, 0.35);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}
.tool-card .idx {
  font-variant-numeric: tabular-nums;
  color: var(--brass);
  font-size: 12px;
  letter-spacing: 0.14em;
  font-weight: 650;
}
.tool-card h2 {
  margin: 8px 0 6px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.06em;
}
.tool-card p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.55;
}
.tool-enter {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: var(--brass);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.home-foot {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.home-foot p { margin: 0 0 6px; }

/* Tool pages */
.tool-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
}
.tool-head > .icon-btn:first-child { justify-self: start; }
.tool-head-text { text-align: center; min-width: 0; }
.tool-head h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.08em;
  font-weight: 650;
}
.tool-head .tool-sub {
  margin: 6px 0 0;
  text-align: center;
}
.tool-head > .data-entry,
.tool-head > .head-right { justify-self: end; }
.tool-sub {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 13.5px;
}
.tool-layout { display: grid; gap: 20px; }
@media (min-width: 880px) {
  .tool-layout { grid-template-columns: 340px 1fr; align-items: start; }
  .tool-layout.stack { grid-template-columns: 1fr; }
}
.panel {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel h3, .block-title {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 650;
  text-transform: none;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label, .lbl {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }
input[type="text"], input[type="date"], input[type="search"], textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  min-height: var(--tap);
  color: var(--text);
  caret-color: var(--brass);
}
textarea {
  min-height: 120px;
  line-height: 1.65;
  resize: vertical;
}
textarea.tall { min-height: 180px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%238491a3'><path d='M0 0l6 8 6-8z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
input::placeholder, textarea::placeholder { color: #5d6a7c; }
.seg {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.seg button {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}
.seg button[aria-pressed="true"] {
  background: var(--brass-soft);
  border-color: rgba(226, 177, 90, 0.5);
  color: var(--brass);
  font-weight: 650;
}

/* Upload */
.uploader {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: center;
}
.thumb {
  width: 88px; height: 88px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: var(--bg);
  overflow: hidden;
  display: grid; place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 6px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

/* Results */
.output { display: grid; gap: 12px; }
.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.shot {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 14px 16px;
  display: grid;
  gap: 8px;
  position: relative;
}
.shot::before {
  content: "";
  position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 3px; border-radius: 3px;
  background: var(--brass);
}
.shot-top {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.shot-name { font-weight: 650; letter-spacing: 0.04em; }
.shot-dur { color: var(--brass); font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.kv { display: grid; gap: 4px; font-size: 13.5px; }
.kv .k { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; }
.kv .v { color: var(--text); white-space: pre-wrap; }
.copy-block {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.copy-block pre, .copy-block .body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.7;
}
.copy-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; gap: 8px;
  flex-wrap: wrap;
}
.btn-row.tight .btn,
.btn-row.tight .btn-ghost,
.btn-row.tight .file-btn {
  flex: 0 0 auto;
  width: auto;
}
.field .uploader + .hint { margin-top: 8px; }
.warn, .info, .ok {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.65;
}
.warn { background: var(--rose-soft); color: #f0c4c0; border: 1px solid rgba(224,139,132,0.25); }
.info { background: var(--teal-soft); color: #c7e4e0; border: 1px solid rgba(126,185,177,0.25); }
.ok { background: var(--green-soft); color: #c8e6cc; border: 1px solid rgba(134,194,141,0.25); }
.breakdown { display: grid; gap: 10px; }
.breakdown li, .b-item {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.b-item strong { display: block; color: var(--brass); font-size: 13px; margin-bottom: 4px; letter-spacing: 0.06em; }
.b-item p { margin: 0; color: var(--text-2); font-size: 13.5px; }

/* Knowledge */
.ask-row { display: flex; gap: 8px; }
.ask-row input { flex: 1; }
.ask-row .btn { width: auto; flex: 0 0 auto; padding: 0 16px; }
.answer-box { margin-top: 12px; }
.qa-list { display: grid; gap: 8px; margin-top: 8px; }
.qa-item, .cust-item, .day-card, .follow-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.qa-item h4, .cust-item .name, .day-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 650;
}
.qa-item p, .cust-item .note { margin: 0; color: var(--text-2); font-size: 13.5px; white-space: pre-wrap; }
.meta-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 8px;
}
.chip {
  display: inline-flex; align-items: center;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
}
.chip.ex { background: var(--brass-soft); color: var(--brass); border-color: rgba(226,177,90,0.3); }
.chip.st-新客 { background: var(--blue-soft); color: var(--blue); border-color: rgba(138,167,214,0.3); }
.chip.st-意向 { background: var(--brass-soft); color: var(--brass); border-color: rgba(226,177,90,0.3); }
.chip.st-成交 { background: var(--green-soft); color: var(--green); border-color: rgba(134,194,141,0.3); }
.chip.st-沉睡 { background: var(--rose-soft); color: var(--rose); border-color: rgba(224,139,132,0.3); }
.item-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.item-actions button {
  background: transparent; border: 0; color: var(--muted);
  min-height: 36px; padding: 0 8px; font-size: 13px; border-radius: 8px;
}
.item-actions button:hover { color: var(--text); background: var(--surface-2); }
.item-actions .btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 0 10px;
  font-weight: 550;
}
.item-actions .btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Content calendar */
.week-list { display: grid; gap: 8px; }
.day-card { position: relative; padding-right: 76px; }
.day-card .day-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
}
.day-card summary.week-row {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 3.8em 1fr;
  column-gap: 8px;
  row-gap: 2px;
  align-items: baseline;
  position: relative;
  padding-right: 16px;
}
.day-card summary.week-row::-webkit-details-marker { display: none; }
.day-card summary.week-row::marker { content: ""; }
.week-row::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0.45em;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.day-card[open] .week-row::after {
  transform: rotate(-135deg);
  top: 0.6em;
}
.week-day {
  font-weight: 650;
  color: var(--brass);
  font-size: 13px;
  letter-spacing: 0.04em;
}
.week-title { font-weight: 650; font-size: 15px; }
.week-act {
  grid-column: 2;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.day-card[open] .week-act { display: none; }
.day-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}
.cta-pill {
  display: inline-block;
  margin-top: 8px;
  background: var(--brass-soft);
  color: var(--brass);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

/* CRM */
.crm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: nowrap;
}
.crm-toolbar .tabs {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.crm-toolbar .btn {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
  margin-left: auto;
}
.empty-action {
  display: flex;
  justify-content: center;
  margin: -4px 0 12px;
}
.empty-action .btn { width: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}
.tabs button[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-strong);
}
.follow-why { color: var(--teal); font-size: 13px; margin: 6px 0 8px; }
.script-draft {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.65;
}

/* Modal / toast / drawer */
.overlay {
  position: fixed; inset: 0;
  background: rgba(4, 7, 12, 0.72);
  display: grid; place-items: end center;
  z-index: 40;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
@media (min-width: 720px) {
  .overlay { place-items: center; }
}
.sheet {
  width: min(100%, 440px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 18px 0 0;
  box-shadow: var(--shadow);
  max-height: min(88vh, 720px, calc(100dvh - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet h3 {
  margin: 0 16px 12px;
  font-size: 18px;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
}
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 16px 16px;
}
.sheet-msg { margin: 0; color: var(--text-2); font-size: 13.5px; }
.sheet-foot {
  flex: 0 0 auto;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.sheet-foot .btn-row { flex-wrap: nowrap; margin: 0; }
.sheet-foot .btn-row .btn,
.sheet-foot .btn-row .btn-ghost { flex: 1 1 0; min-width: 0; width: auto; }
.toast {
  position: fixed;
  left: 50%;
  top: max(88px, calc(env(safe-area-inset-top) + 72px));
  bottom: auto;
  transform: translateX(-50%) translateY(-12px);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: var(--shadow);
  max-width: min(92vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 11px; }

hr.sep {
  border: 0; border-top: 1px solid var(--line);
  margin: 16px 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
