:root {
  --ink: #17231f;
  --ink-soft: #42524c;
  --mist: #eef4f2;
  --paper: #fbfdfc;
  --jade: #14785f;
  --jade-dark: #0d5a48;
  --jade-pale: #d9eee7;
  --amber: #c6792a;
  --rose: #b54c5d;
  --line: #d7e1dd;
  --shadow: 0 18px 50px rgba(23, 35, 31, .08);
  --display: "Songti SC", "STSong", Georgia, serif;
  --body: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --utility: "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--mist); }
body { margin: 0; color: var(--ink); background: var(--mist); font-family: var(--body); line-height: 1.55; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(20, 120, 95, .35); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.muted { color: var(--ink-soft); }
.eyebrow { margin: 0 0 8px; color: var(--jade); font: 700 11px/1.2 var(--utility); letter-spacing: .14em; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.side-rail { position: sticky; top: 0; height: 100vh; padding: 28px 22px; display: flex; flex-direction: column; background: var(--ink); color: #eff8f4; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-mark { font: 700 25px/1 var(--display); letter-spacing: .08em; }
.brand-text { color: #8fb4a7; font: 600 9px/1 var(--utility); letter-spacing: .12em; text-transform: uppercase; }
.primary-nav { margin-top: 58px; display: grid; gap: 6px; }
.primary-nav a { padding: 13px 12px; display: flex; align-items: center; justify-content: space-between; color: #b9cec7; text-decoration: none; border-left: 2px solid transparent; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: white; background: rgba(255,255,255,.06); border-left-color: #5fcea7; }
.primary-nav small { font: 600 9px var(--utility); color: #65847a; }
.identity-card { margin-top: auto; padding-top: 20px; display: flex; gap: 11px; align-items: center; border-top: 1px solid rgba(255,255,255,.12); }
.identity-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: none; border-radius: 50%; color: var(--jade-dark); background: #c8ebdf; font-weight: 800; }
.identity-card strong, .identity-card span { display: block; }
.identity-card span { color: #8fb4a7; font-size: 12px; }
.logout-form { margin-top: 10px; }
.text-button { padding: 2px 0; border: 0; background: none; color: #9bb9af; cursor: pointer; }
.text-button:hover { color: white; }
.text-button.danger { color: var(--rose); }
.workspace { min-width: 0; padding: 48px clamp(24px, 5vw, 72px) 80px; }
.page-header { max-width: 980px; margin-bottom: 34px; }
.page-header h1, .customer-hero h1 { margin: 0; font: 700 clamp(36px, 5vw, 64px)/1.05 var(--display); letter-spacing: -.03em; }
.page-header > p:last-child, .page-header > div > p:last-child, .customer-hero p { color: var(--ink-soft); }
.page-header.compact h1 { font-size: clamp(34px, 4vw, 52px); }
.split-header { max-width: none; display: flex; justify-content: space-between; gap: 30px; align-items: end; }
.primary-button, .secondary-button { border: 0; border-radius: 8px; padding: 11px 16px; display: inline-flex; justify-content: center; align-items: center; text-decoration: none; cursor: pointer; font-weight: 700; }
.primary-button { color: white; background: var(--jade); box-shadow: 0 8px 18px rgba(20,120,95,.18); }
.primary-button:hover { background: var(--jade-dark); }
.secondary-button { color: var(--jade-dark); background: var(--jade-pale); }
.secondary-button.small { padding: 7px 10px; font-size: 12px; }
.full { width: 100%; }
.text-link, .back-link { color: var(--jade-dark); font-weight: 700; text-decoration: none; }

.pulse-strip { margin-bottom: 26px; display: grid; grid-template-columns: 1.15fr 1fr 1fr; border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.pulse { min-height: 112px; padding: 22px 26px; display: flex; gap: 18px; align-items: center; border-right: 1px solid var(--line); }
.pulse:last-child { border-right: 0; }
.pulse-number { font: 700 50px/1 var(--display); }
.pulse strong, .pulse small { display: block; }
.pulse small { margin-top: 4px; color: var(--ink-soft); }
.pulse.critical .pulse-number { color: var(--rose); }
.pulse.due .pulse-number { color: var(--amber); }
.pulse.total .pulse-number { color: var(--jade); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(260px, .65fr); gap: 24px; }
.panel { border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.panel-heading { padding: 22px 24px; display: flex; justify-content: space-between; gap: 20px; align-items: center; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font: 700 24px/1.2 var(--display); }
.panel-heading > a { color: var(--jade-dark); font-size: 13px; font-weight: 700; text-decoration: none; }
.follow-list { margin: 0; padding: 0; list-style: none; }
.follow-list li { min-height: 92px; padding: 17px 22px; display: grid; grid-template-columns: 118px minmax(0,1fr) auto; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); }
.follow-list li:last-child { border-bottom: 0; }
.follow-list time { color: var(--ink-soft); font: 600 11px var(--utility); }
.follow-list a { min-width: 0; text-decoration: none; }
.follow-list a strong, .follow-list a span { display: block; }
.follow-list a span { overflow: hidden; color: var(--ink-soft); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.distribution-list { padding: 12px 22px 22px; }
.distribution-list > div { padding: 12px 0; display: grid; grid-template-columns: 10px 1fr auto; gap: 11px; align-items: center; border-bottom: 1px solid var(--line); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #899690; }
.status-dot[data-status="重点跟进"] { background: var(--rose); }
.status-dot[data-status="待跟进"] { background: var(--amber); }
.status-dot[data-status="已成交"] { background: var(--jade); }
.empty-state { padding: 44px 24px; text-align: center; color: var(--ink-soft); }
.empty-state strong { color: var(--ink); }

.filter-bar { margin-bottom: 18px; padding: 14px; display: grid; grid-template-columns: minmax(240px, 1fr) 180px 210px auto; gap: 10px; background: rgba(255,255,255,.58); border: 1px solid var(--line); }
.filter-bar.with-owner { grid-template-columns: minmax(220px, 1fr) 150px 190px 160px auto; }
input, select, textarea { width: 100%; border: 1px solid #cbd8d3; border-radius: 6px; padding: 10px 11px; color: var(--ink); background: white; }
textarea { resize: vertical; }
label > span { margin-bottom: 6px; display: block; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.customer-ledger { border-top: 2px solid var(--ink); }
.ledger-head, .ledger-row { display: grid; grid-template-columns: minmax(190px, 1.05fr) minmax(180px, .8fr) minmax(240px, 1.5fr) 150px; gap: 20px; align-items: center; }
.ledger-head { padding: 10px 16px; color: var(--ink-soft); font: 700 10px var(--utility); letter-spacing: .08em; }
.ledger-row { min-height: 92px; padding: 16px; background: var(--paper); border-bottom: 1px solid var(--line); text-decoration: none; transition: transform .18s ease, background .18s ease; }
.ledger-row:hover { position: relative; z-index: 1; background: white; transform: translateX(4px); box-shadow: var(--shadow); }
.ledger-row span > small, .customer-cell small { margin-top: 5px; display: block; color: var(--ink-soft); }
.action-cell { color: var(--ink-soft); font-size: 13px; }
.ledger-row time { color: var(--ink-soft); font: 600 11px var(--utility); }
.status-badge { width: max-content; padding: 4px 8px; display: inline-flex; border-radius: 999px; color: #495650; background: #e6ece9; font-size: 11px; font-weight: 800; }
.status-badge[data-status="重点跟进"] { color: #8c2e3e; background: #f5dce1; }
.status-badge[data-status="待跟进"] { color: #855016; background: #f7e7d2; }
.status-badge[data-status="已成交"] { color: #0d604b; background: #d9eee7; }
.status-badge.large { padding: 7px 12px; font-size: 12px; }

.editor-grid { max-width: 980px; display: grid; gap: 22px; }
.form-panel { padding-bottom: 24px; }
.form-grid { padding: 22px 24px; display: grid; gap: 18px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid.tight { padding: 0; gap: 10px; }
.span-two { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 18px; }
.stacked-form { display: grid; gap: 15px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.compact-form { padding: 18px; }
.check-label { display: flex; gap: 9px; align-items: center; }
.check-label input { width: auto; }
.check-label span { margin: 0; }
.notice { margin: 16px 0; padding: 12px 14px; border-radius: 6px; }
.notice.error { color: #8d2638; background: #f8dfe4; }
.notice.warning { color: #6e471e; background: #f7ead9; }
.notice.success { color: var(--jade-dark); background: var(--jade-pale); }
.account-panel { max-width: 640px; }
.account-panel .notice { margin-right: 18px; margin-left: 18px; }

.customer-hero { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: end; gap: 30px; }
.back-link { margin-bottom: 24px; display: inline-block; }
.hero-status { display: grid; justify-items: end; gap: 7px; }
.hero-status small { color: var(--ink-soft); }
.truth-strip { margin-bottom: 24px; display: grid; grid-template-columns: .8fr .8fr 1.6fr; background: var(--ink); color: white; }
.truth-strip > div { min-height: 100px; padding: 20px 22px; border-right: 1px solid rgba(255,255,255,.12); }
.truth-strip span, .truth-strip strong { display: block; }
.truth-strip span { color: #8fb4a7; font-size: 11px; }
.truth-strip strong { margin-top: 8px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); gap: 24px; align-items: start; }
.detail-main, .detail-side { display: grid; gap: 24px; }
.judgement-grid { padding: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.judgement-grid article { min-height: 130px; padding: 17px; background: var(--mist); }
.judgement-grid span { color: var(--jade); font-size: 11px; font-weight: 800; }
.judgement-grid p { margin-bottom: 0; }
.temperature { color: var(--jade-dark); font-size: 12px; font-weight: 800; }
.profile-json { margin: 0 24px 24px; }
.profile-json summary, .edit-drawer summary { cursor: pointer; color: var(--jade-dark); font-weight: 800; }
.profile-json pre { max-height: 360px; padding: 16px; overflow: auto; color: #d9eee7; background: var(--ink); font: 12px/1.6 var(--utility); white-space: pre-wrap; }
.timeline { margin: 0; padding: 4px 24px 24px; list-style: none; }
.timeline > li { padding: 22px 0; display: grid; grid-template-columns: 135px 1fr; gap: 22px; border-bottom: 1px solid var(--line); }
.timeline-stamp time, .timeline-stamp span { display: block; }
.timeline-stamp time { font: 600 11px var(--utility); }
.timeline-stamp span { color: var(--ink-soft); font-size: 12px; }
.timeline-body p { margin: 8px 0; }
.timeline-body blockquote { margin: 10px 0; padding-left: 14px; color: var(--ink-soft); border-left: 3px solid var(--jade-pale); }
.timeline-body small { color: var(--jade-dark); }
.evidence, .touch-only { padding: 3px 6px; color: var(--jade-dark); background: var(--jade-pale); font: 700 10px var(--utility); }
.touch-only { margin-left: 6px; color: #6d4d29; background: #f4e4cf; }
.edit-drawer { padding: 18px; }
.edit-drawer[open] > summary { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.side-panel { padding: 20px; }
.side-panel h3 { margin-top: 0; font: 700 20px var(--display); }
.asset-list { margin: 0 0 18px; padding: 0; list-style: none; }
.asset-list li { padding: 8px 0; display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.asset-list a { color: var(--jade-dark); overflow-wrap: anywhere; }
.asset-list small { color: var(--ink-soft); }
.access-list, .audit-list { margin: 0 0 16px; padding: 0; list-style: none; }
.access-list li { padding: 9px 0; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.access-list strong, .access-list small { display: block; }
.access-list small, .audit-list small { color: var(--ink-soft); }
.permission-chip { padding: 3px 7px; border-radius: 999px; color: #495650; background: #e6ece9; font-size: 10px; font-weight: 800; }
.permission-chip.edit { color: var(--jade-dark); background: var(--jade-pale); }
.access-form { padding: 10px 0 0; border-top: 1px solid var(--line); }
.audit-list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.audit-list span, .audit-list small { display: block; }
.audit-list span { font-size: 13px; font-weight: 700; }
.audit-list small { margin-top: 2px; font-size: 10px; }

.admin-grid { display: grid; grid-template-columns: minmax(280px, .65fr) minmax(0, 1.35fr); gap: 24px; align-items: start; }
.admin-grid .form-panel > form, .admin-grid .form-panel > hr { margin-left: 24px; margin-right: 24px; }
.admin-grid hr { margin-top: 24px; margin-bottom: 24px; border: 0; border-top: 1px solid var(--line); }
.member-list { padding: 6px 22px 22px; }
.member-card { padding: 16px 0; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 14px; align-items: center; border-bottom: 1px solid var(--line); }
.member-card.inactive { opacity: .52; }
.member-info strong, .member-info span, .member-info small { display: block; }
.member-info span { color: var(--ink-soft); font-size: 13px; }
.member-info small { color: var(--jade-dark); }
.member-actions { display: grid; gap: 5px; justify-items: end; }
.token-row { display: flex; gap: 8px; align-items: center; color: var(--ink-soft); font: 10px var(--utility); }
.secret-panel { max-width: 760px; padding: 28px; }
.secret-panel textarea { margin-top: 8px; font: 13px/1.6 var(--utility); }

.login-body { min-height: 100vh; background: var(--ink); }
.login-stage { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-manifesto { position: relative; padding: clamp(44px, 8vw, 120px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; color: white; }
.login-manifesto h1 { max-width: 720px; margin: 0; font: 700 clamp(50px, 7vw, 96px)/1.04 var(--display); letter-spacing: -.05em; }
.login-manifesto > p:last-of-type { max-width: 480px; color: #a9c2b9; }
.signal-lines { position: absolute; right: 5%; bottom: 8%; left: 8%; height: 90px; display: flex; gap: 12px; align-items: end; opacity: .34; }
.signal-lines i { width: 2px; height: 18%; background: #66d7ae; animation: signal 2.8s ease-in-out infinite; }
.signal-lines i:nth-child(2) { height: 42%; animation-delay: -.5s; }.signal-lines i:nth-child(3) { height: 88%; animation-delay: -1s; }.signal-lines i:nth-child(4) { height: 58%; animation-delay: -1.5s; }.signal-lines i:nth-child(5) { height: 30%; animation-delay: -2s; }
@keyframes signal { 50% { transform: scaleY(.45); opacity: .5; } }
.login-panel { padding: clamp(36px, 8vw, 110px); display: flex; flex-direction: column; justify-content: center; background: var(--paper); }
.login-panel h2 { margin: 0; font: 700 clamp(30px, 4vw, 48px)/1.15 var(--display); }
.login-panel .stacked-form { margin-top: 32px; max-width: 450px; }

@media (max-width: 1050px) {
  .dashboard-grid, .detail-grid, .admin-grid { grid-template-columns: 1fr; }
  .detail-side { grid-row: 1; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ledger-head, .ledger-row { grid-template-columns: 1fr 1fr 1.2fr; }
  .ledger-head span:last-child, .ledger-row time { display: none; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .side-rail { position: static; width: auto; height: auto; padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 14px; }
  .primary-nav { grid-column: 1 / -1; margin-top: 8px; display: flex; overflow-x: auto; }
  .primary-nav a { flex: 1; min-width: 120px; }
  .identity-card { margin: 0; padding: 0; border: 0; }
  .logout-form { display: none; }
  .workspace { padding: 30px 16px 60px; }
  .split-header, .customer-hero { display: grid; align-items: start; }
  .split-header .primary-button { width: max-content; }
  .hero-status { justify-items: start; }
  .pulse-strip { grid-template-columns: 1fr; }
  .pulse { min-height: 82px; border-right: 0; border-bottom: 1px solid var(--line); }
  .pulse:last-child { border-bottom: 0; }
  .filter-bar, .filter-bar.with-owner { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .ledger-head { display: none; }
  .ledger-row { grid-template-columns: 1fr; gap: 10px; }
  .action-cell { padding-top: 8px; border-top: 1px dashed var(--line); }
  .form-grid.two, .judgement-grid, .detail-side { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .truth-strip { grid-template-columns: 1fr; }
  .truth-strip > div { min-height: auto; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.12); }
  .timeline > li { grid-template-columns: 1fr; gap: 8px; }
  .login-stage { grid-template-columns: 1fr; }
  .login-manifesto { min-height: 45vh; padding: 48px 28px; }
  .login-panel { min-height: 55vh; padding: 42px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
