/* 雨安防水智能客服 · 站点样式（浅色主题） */
:root {
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-2: #f8fbfd;
  --line: #dce7ef;
  --line-strong: #c6d8e5;
  --ink: #142430;
  --ink-2: #465c6d;
  --ink-3: #708697;
  --brand: #0d5c89;
  --brand-2: #1277a8;
  --brand-soft: #e8f3fa;
  --teal: #0b8478;
  --teal-soft: #e6f5f2;
  --danger: #b3261e;
  --danger-soft: #fdeceb;
  --warn: #9a5b00;
  --warn-soft: #fff3e0;
  --ok: #0b7a5b;
  --ok-soft: #e7f5ef;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 36, 48, .04), 0 8px 24px rgba(20, 36, 48, .05);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.4; }
h1 { font-size: 30px; letter-spacing: -.3px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }
li { margin: 4px 0; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 13px; }

/* ---------- shell ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 62px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff;
}
.brand-text { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-text small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a {
  padding: 7px 13px; border-radius: 8px; color: var(--ink-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.site-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--brand); }
.site-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.header-tag {
  font-size: 12px; color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; white-space: nowrap;
}
.nav-toggle { display: none; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.page { padding: 34px 0 72px; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 22px 24px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--ink-3); font-size: 13px;
}

/* ---------- shared atoms ---------- */
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 650; letter-spacing: 1.2px;
  color: var(--brand); text-transform: uppercase; margin-bottom: 10px;
}
.lead { font-size: 16px; color: var(--ink-2); max-width: 780px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.section { margin-top: 38px; }
.section-head { margin-bottom: 16px; }
.section-head p { color: var(--ink-2); margin: 5px 0 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2);
  background: var(--surface-2); white-space: nowrap;
}
.badge.blue { background: var(--brand-soft); border-color: #c9e3f2; color: var(--brand); }
.badge.teal { background: var(--teal-soft); border-color: #c8e9e3; color: var(--teal); }
.badge.red { background: var(--danger-soft); border-color: #f5cfcc; color: var(--danger); }
.badge.amber { background: var(--warn-soft); border-color: #f3ddb8; color: var(--warn); }
.badge.green { background: var(--ok-soft); border-color: #c6e8da; color: var(--ok); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 9px 16px; font-size: 14px; font-family: var(--font);
  font-weight: 600; cursor: pointer; transition: .15s ease; line-height: 1.5;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-danger { color: var(--danger); border-color: #eec9c6; background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input[type="text"], input[type="search"], input[type="password"], select, textarea {
  width: 100%; font-family: var(--font); font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 9px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(18, 119, 168, .1); }
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.form-row { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.notice {
  border-left: 3px solid var(--brand-2); background: var(--brand-soft);
  padding: 13px 16px; border-radius: 0 8px 8px 0; font-size: 13.5px; color: #164a68;
}
.notice.warn { border-left-color: #d18b1b; background: var(--warn-soft); color: #7a4a05; }
.notice.danger { border-left-color: var(--danger); background: var(--danger-soft); color: #8c211a; }
.notice.ok { border-left-color: var(--ok); background: var(--ok-soft); color: #0a5b45; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 11px 12px; text-align: left; vertical-align: top; }
table.data th { background: var(--surface-2); color: var(--ink-2); font-weight: 650; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }

/* ---------- home ---------- */
.hero {
  background: linear-gradient(135deg, #0d5c89 0%, #1277a8 55%, #1890a6 100%);
  color: #fff; border-radius: 16px; padding: 46px 44px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -90px; top: -110px; width: 400px; height: 400px;
  border: 1px solid rgba(255, 255, 255, .17); border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(255, 255, 255, .04), 0 0 0 130px rgba(255, 255, 255, .03);
}
.hero h1 { font-size: 34px; max-width: 700px; position: relative; }
.hero p { color: rgba(255, 255, 255, .88); max-width: 680px; font-size: 15.5px; position: relative; }
.hero .eyebrow { color: #b9e4f7; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; position: relative; }
.hero .btn-primary { background: #fff; border-color: #fff; color: var(--brand); }
.hero .btn-primary:hover { background: #eaf6fc; color: var(--brand); }
.hero .btn-outline { background: transparent; border-color: rgba(255,255,255,.55); color: #fff; }
.hero .btn-outline:hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }
.hero-note {
  margin-top: 22px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.22);
  font-size: 12.5px; color: rgba(255,255,255,.82); position: relative;
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.stat { padding: 18px 20px; }
.stat b { display: block; font-size: 24px; color: var(--brand); line-height: 1.3; }
.stat span { font-size: 12.5px; color: var(--ink-2); }
.feature-card { padding: 22px; display: flex; flex-direction: column; gap: 9px; }
.feature-icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft);
  color: var(--brand); display: grid; place-items: center; margin-bottom: 4px;
}
.feature-card h3 { font-size: 16px; }
.feature-card p { font-size: 13.5px; color: var(--ink-2); margin: 0; }
.feature-card .card-link { font-size: 13px; font-weight: 600; margin-top: 4px; }
.flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.flow-node {
  flex: 1 1 130px; min-width: 125px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 12px;
  font-size: 13px; font-weight: 600; text-align: center; color: var(--ink-2);
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
}
.flow-node small { font-size: 11px; font-weight: 400; color: var(--ink-3); }
.flow-arrow { align-self: center; color: var(--line-strong); font-size: 18px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-done { background: var(--ok); }
.dot-part { background: #d18b1b; }
.dot-none { background: var(--ink-3); }

/* ---------- consult ---------- */
.consult-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 18px; align-items: start; }
.chat-card { display: flex; flex-direction: column; height: 680px; overflow: hidden; }
.chat-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
}
.chat-head .who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.chat-head h3 { font-size: 15px; }
.chat-head .small { color: var(--ink-3); font-size: 12px; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; background: var(--surface-2); scroll-behavior: smooth; }
.msg { display: flex; gap: 9px; margin-bottom: 16px; align-items: flex-start; }
.msg .avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.msg.user { flex-direction: row-reverse; }
.msg.user .avatar { background: #5a7182; }
.bubble {
  max-width: 88%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px; padding: 11px 14px; font-size: 14px;
  white-space: pre-wrap; word-break: break-word;
}
.msg.user .bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-radius: 12px 4px 12px 12px; }
.bubble.danger { background: var(--danger-soft); border-color: #f0c8c5; color: #7d1e17; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 650; }
.bubble .kb-ref { display: block; margin-top: 8px; font-size: 12px; color: var(--ink-3); border-top: 1px dashed var(--line); padding-top: 7px; }
.option-area { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.option-label { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px; font-size: 13.5px; cursor: pointer;
  font-family: var(--font); transition: .15s ease;
}
.chip:hover { border-color: var(--brand-2); color: var(--brand); background: var(--brand-soft); }
.chip.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.danger-chip:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.option-submit { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-input {
  padding: 11px 18px; border-top: 1px solid var(--line); background: var(--surface);
  display: flex; gap: 8px;
}
.chat-input input { flex: 1; }
.side-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-card { padding: 16px 18px; }
.panel-card h3 { font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.fact-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.fact-list li {
  display: flex; justify-content: space-between; gap: 10px; padding: 6px 0;
  border-bottom: 1px dashed var(--line); color: var(--ink-2);
}
.fact-list li:last-child { border-bottom: none; }
.fact-list li b { color: var(--ink); font-weight: 600; text-align: right; }
.fact-list li.empty { color: var(--ink-3); justify-content: flex-start; }
.cand-item { border-left: 3px solid var(--line-strong); padding: 4px 0 8px 11px; margin-bottom: 8px; }
.cand-item:last-child { margin-bottom: 0; }
.cand-item b { font-size: 13px; }
.cand-item span { display: block; font-size: 12px; color: var(--ink-3); }
.safety-line { font-size: 13px; color: var(--ok); }
.safety-line.stop { color: var(--danger); font-weight: 600; }
.result-block { border: 1px solid var(--line); border-radius: 9px; padding: 12px; margin-top: 9px; background: var(--surface-2); }
.result-block h4 { font-size: 13px; margin-bottom: 5px; color: var(--brand); }
.result-block p { font-size: 13px; margin: 0; color: var(--ink-2); }
.result-block ul { font-size: 13px; color: var(--ink-2); margin: 4px 0 0; padding-left: 17px; }

/* ---------- knowledge ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar input[type="search"] { max-width: 320px; }
.toolbar select { max-width: 190px; width: auto; }
.kb-card { padding: 18px; display: flex; flex-direction: column; gap: 9px; }
.kb-card .kb-meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.kb-card h3 { font-size: 15.5px; }
.kb-card p { font-size: 13.5px; color: var(--ink-2); margin: 0; flex: 1; }
.kb-foot { border-top: 1px dashed var(--line); padding-top: 9px; font-size: 12px; color: var(--ink-3); }
.empty-state { padding: 48px 20px; text-align: center; color: var(--ink-3); }

/* ---------- admin ---------- */
.login-wrap { max-width: 430px; margin: 50px auto; }
.login-wrap .card-pad { padding: 28px; }
.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: start; }
.admin-side { padding: 10px; }
.admin-side button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0;
  background: transparent; border-radius: 8px; font-family: var(--font); font-size: 14px;
  color: var(--ink-2); cursor: pointer; margin-bottom: 3px;
}
.admin-side button:hover { background: var(--surface-2); color: var(--brand); }
.admin-side button.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.admin-main { min-height: 480px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px; }
.kpi b { display: block; font-size: 22px; color: var(--brand); }
.kpi span { font-size: 12.5px; color: var(--ink-2); }
.list-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .row-title { font-weight: 600; font-size: 14px; }
.list-row .row-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 36, 48, .42); z-index: 90;
  display: grid; place-items: center; padding: 20px;
}
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.status-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.status-row:last-child { border-bottom: none; }
.status-row .grow { flex: 1; }
.status-row small { display: block; color: var(--ink-3); font-size: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .consult-layout { grid-template-columns: 1fr; }
  .chat-card { height: 620px; }
  .stat-grid, .grid-4, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { display: flex; gap: 4px; overflow-x: auto; }
  .admin-side button { white-space: nowrap; width: auto; margin: 0; }
}
@media (max-width: 720px) {
  .header-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .site-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .header-tag { display: none; }
  .container { padding: 0 16px; }
  .page { padding: 22px 0 54px; }
  .hero { padding: 32px 24px; }
  .hero h1 { font-size: 26px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .flow-arrow { display: none; }
  .flow-node { flex: 1 1 45%; }
  .footer-inner { flex-direction: column; }
  .chat-card { height: 600px; }
  .bubble { max-width: 94%; }
}
