:root {
  color-scheme: light;
  --bg: #f3f7fc;
  --surface: #fff;
  --soft: #f6f9fd;
  --ink: #10213d;
  --muted: #73839a;
  --line: #e1e9f3;
  --blue: #1169f5;
  --cyan: #13b9e8;
  --green: #07845e;
  --red: #c73a50;
  --orange: #c87819;
  --shadow: 0 18px 55px rgba(23, 64, 119, .11);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
body[data-role="salesperson"] .management-only,
body:not([data-role="owner"]) .owner-only { display: none !important; }
body.drawer-open, body.modal-open { overflow: hidden; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 22px 16px; background: radial-gradient(circle at 85% 10%, rgba(19, 185, 232, .16), transparent 35%), linear-gradient(145deg, #edf5ff, #f8fbff 55%, #edf3fb); }
.login-card { width: min(100%, 440px); position: relative; overflow: hidden; padding: 27px 22px; border: 1px solid rgba(188, 208, 232, .7); border-radius: 25px; background: rgba(255, 255, 255, .94); box-shadow: 0 26px 80px rgba(23, 64, 119, .14); }
.login-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.login-brand, .sidebar-brand { display: flex; align-items: center; gap: 11px; }
.login-brand img, .sidebar-brand img { width: 43px; height: 43px; object-fit: contain; border-radius: 11px; }
.login-brand div, .sidebar-brand div { display: grid; gap: 2px; }
.login-brand strong { font-size: 15px; }
.login-brand span, .sidebar-brand span { color: #7b8fa9; font-size: 9px; font-weight: 800; letter-spacing: .17em; }
.login-copy { margin: 34px 0 26px; }
.login-copy small { color: var(--blue); font-size: 9px; font-weight: 900; letter-spacing: .2em; }
.login-copy h1 { margin: 8px 0 8px; font-size: 29px; line-height: 1.2; letter-spacing: -.04em; }
.login-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.login-card form { display: grid; gap: 15px; }
.login-card label { display: grid; gap: 7px; color: #42546c; font-size: 11px; font-weight: 750; }
.login-card input { height: 50px; border: 1px solid var(--line); border-radius: 12px; outline: none; padding: 0 13px; color: var(--ink); background: var(--soft); }
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(17, 105, 245, .08); }
.form-error { min-height: 16px; margin: -5px 0 0; color: var(--red); font-size: 11px; }
.primary-button, .ghost-button, .ai-button, .icon-button, .text-button { border: 0; border-radius: 11px; font-weight: 800; }
.primary-button { min-height: 44px; padding: 0 17px; color: #fff; background: linear-gradient(105deg, var(--blue), var(--cyan)); box-shadow: 0 9px 24px rgba(17, 105, 245, .2); }
.primary-button:disabled, .ghost-button:disabled, .ai-button:disabled { opacity: .55; cursor: wait; }
.ghost-button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); color: #4b607a; background: #fff; }
.ai-button { min-height: 40px; padding: 0 14px; color: #fff; background: linear-gradient(105deg, #673cdb, #217de9); }
.icon-button { width: 40px; height: 40px; color: #58708e; background: #fff; border: 1px solid var(--line); font-size: 20px; }
.text-button { padding: 5px; color: var(--blue); background: transparent; font-size: 11px; }
.back-link { display: block; margin-top: 21px; text-align: center; color: #8292a7; font-size: 10px; text-decoration: none; }

.crm-app { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(66px + env(safe-area-inset-bottom)); display: flex; align-items: center; padding: 7px 9px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(18px); box-shadow: 0 -8px 30px rgba(23, 64, 119, .09); }
.sidebar-brand, .sidebar-user { display: none; }
.main-nav { width: 100%; display: flex; justify-content: space-around; gap: 3px; }
.main-nav button { flex: 1; min-width: 0; height: 50px; display: grid; place-items: center; align-content: center; gap: 2px; border: 0; border-radius: 11px; color: #71849c; background: transparent; }
.main-nav button i { display: grid; place-items: center; width: 24px; height: 22px; border-radius: 7px; font-size: 11px; font-style: normal; font-weight: 900; }
.main-nav button span { font-size: 9px; font-weight: 750; white-space: nowrap; }
.main-nav button.active { color: var(--blue); background: #edf5ff; }
.main-nav button.active i { color: #fff; background: var(--blue); }

.workspace { min-width: 0; padding: 0 14px calc(86px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 1px 13px; background: rgba(243, 247, 252, .94); backdrop-filter: blur(15px); }
.topbar > div:first-child { display: grid; gap: 2px; }
.topbar small { color: var(--blue); font-size: 8px; font-weight: 900; letter-spacing: .17em; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
#syncState { display: none; align-items: center; gap: 6px; color: #72849b; font-size: 9px; }
#syncState i { width: 7px; height: 7px; border-radius: 50%; background: #20b683; box-shadow: 0 0 0 4px rgba(32, 182, 131, .1); }
#syncState.loading i { background: var(--orange); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.loading-bar { position: fixed; z-index: 80; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; background: #d9e7f8; }
.loading-bar i { display: block; width: 35%; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); animation: loading 1s infinite ease-in-out; }
@keyframes loading { from { transform: translateX(-120%); } to { transform: translateX(400%); } }
.app-view { display: none; }
.app-view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.greeting-card { display: grid; gap: 15px; padding: 20px; overflow: hidden; border-radius: 20px; color: #fff; background: radial-gradient(circle at 95% 0, rgba(35, 221, 237, .28), transparent 38%), linear-gradient(120deg, #0b57c8, #123b86); box-shadow: 0 16px 38px rgba(17, 73, 157, .22); }
.greeting-card small { color: #9bdcf5; font-size: 9px; font-weight: 800; }
.greeting-card h2 { margin: 6px 0; font-size: 20px; }
.greeting-card p { margin: 0; color: #b7cae5; font-size: 11px; line-height: 1.6; }
.greeting-card .ghost-button { justify-self: start; border-color: rgba(255, 255, 255, .2); color: #fff; background: rgba(255, 255, 255, .1); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 13px 0; }
.metric-card { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 8px 22px rgba(33, 67, 112, .05); }
.metric-card div { display: grid; gap: 3px; }
.metric-card small { color: var(--muted); font-size: 9px; }
.metric-card strong { font-size: 27px; line-height: 1.1; }
.metric-card span { color: #8a9aaf; font-size: 9px; }
.metric-card > b { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; color: #fff; background: var(--blue); font-size: 10px; }
.metric-card > b[data-color="green"] { background: var(--green); }
.metric-card > b[data-color="red"] { background: var(--red); }
.metric-card > b[data-color="cyan"] { background: var(--cyan); }
.overview-grid { display: grid; gap: 13px; }
.panel { margin-bottom: 13px; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 9px 26px rgba(33, 67, 112, .05); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.panel-heading > div { display: grid; gap: 3px; }
.panel-heading small { color: var(--blue); font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading > span { color: var(--muted); font-size: 9px; }
.bar-chart { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 58px 1fr 25px; align-items: center; gap: 8px; }
.bar-row > span { overflow: hidden; color: #62758d; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.bar-row > i, .portrait-grid article div > i { height: 7px; overflow: hidden; border-radius: 20px; background: #edf2f8; }
.bar-row > i b, .portrait-grid article div > i b { display: block; height: 100%; min-width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.bar-row > strong { text-align: right; font-size: 10px; }
.compact-list { display: grid; gap: 3px; }
.compact-task { width: 100%; display: grid; grid-template-columns: 7px 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border: 0; border-bottom: 1px solid #edf1f6; text-align: left; background: transparent; }
.compact-task > i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.compact-task > i.overdue { background: var(--red); }
.compact-task div { min-width: 0; display: grid; gap: 2px; }
.compact-task strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.compact-task span, .compact-task time { color: var(--muted); font-size: 9px; }
.portrait-grid { display: grid; gap: 11px; }
.portrait-grid article { padding: 13px; border-radius: 13px; background: var(--soft); }
.portrait-grid h3 { margin: 0 0 11px; font-size: 11px; }
.portrait-grid article > div { display: grid; grid-template-columns: 70px 1fr 20px; align-items: center; gap: 7px; margin-top: 7px; }
.portrait-grid article div span, .portrait-grid article div strong { overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.portrait-grid article div strong { text-align: right; }
.portrait-grid article > p { color: var(--muted); font-size: 9px; }
.performance-list { display: grid; gap: 7px; }
.performance-row { display: grid; grid-template-columns: 36px 1fr repeat(4, 48px); align-items: center; gap: 7px; padding: 10px; border: 1px solid #edf1f6; border-radius: 12px; }
.person-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); font-size: 12px; font-weight: 900; }
.performance-row > div { min-width: 0; display: grid; gap: 2px; }
.performance-row > div strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.performance-row > div small { color: var(--muted); font-size: 8px; }
.performance-row p { display: grid; gap: 2px; margin: 0; text-align: center; }
.performance-row p b { font-size: 11px; }
.performance-row p small { color: var(--muted); font-size: 7px; white-space: nowrap; }
.danger-text { color: var(--red) !important; }

.filter-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.search-field { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; height: 43px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.search-field span { color: #7890ad; font-size: 18px; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.filter-panel select { min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 10px; outline: 0; padding: 0 8px; color: #536780; background: #fff; font-size: 10px; }
.filter-panel .ghost-button { min-height: 40px; }
.list-summary { display: flex; justify-content: space-between; align-items: center; padding: 10px 3px; color: var(--muted); font-size: 10px; }
.list-summary button { border: 0; color: var(--blue); background: transparent; font-size: 9px; }
.customer-card-grid { display: grid; gap: 10px; }
.customer-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 7px 20px rgba(31, 66, 112, .05); cursor: pointer; transition: .18s ease; }
.customer-card:active { transform: scale(.99); }
.customer-card header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.customer-card header div { min-width: 0; display: grid; gap: 3px; }
.customer-card header small { color: #8a9cb2; font-size: 8px; }
.customer-card h3 { overflow: hidden; margin: 0; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { flex: 0 0 auto; padding: 5px 7px; border-radius: 7px; color: #1769c9; background: #e9f3ff; font-size: 8px; font-weight: 800; }
.status-badge[data-status="已成交"] { color: var(--green); background: #e9f8f2; }
.status-badge[data-status="已流失"], .status-badge[data-status="无效客户"] { color: #7a8797; background: #eef1f5; }
.need-preview { height: 34px; overflow: hidden; margin: 11px 0; color: #677990; font-size: 10px; line-height: 1.6; }
.customer-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.customer-tags span, .detail-quick-stats span { padding: 4px 7px; border-radius: 6px; color: #5d7189; background: var(--soft); font-size: 8px; }
[data-intent="高"] { color: #087454 !important; background-color: #e5f7ef !important; }
[data-intent="中"] { color: #a8610b !important; background-color: #fff3df !important; }
[data-intent="低"] { color: #6e7c91 !important; background-color: #eef1f5 !important; }
.customer-card footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #edf1f6; color: #8999ad; font-size: 8px; }
.customer-card footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-card footer time { flex: 0 0 auto; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 16px; }
.pagination button { min-height: 36px; border: 1px solid var(--line); border-radius: 9px; color: #536780; background: #fff; font-size: 9px; }
.pagination button:disabled { opacity: .35; }
.pagination span { color: var(--muted); font-size: 9px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state b { color: #52657d; font-size: 13px; }
.empty-state p { margin: 7px 0; font-size: 10px; }
.empty-inline { padding: 25px 10px; text-align: center; color: var(--muted); font-size: 10px; }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.section-toolbar h2 { margin: 0 0 4px; font-size: 17px; }
.section-toolbar p { margin: 0; color: var(--muted); font-size: 9px; }
.segmented { display: flex; padding: 3px; border-radius: 10px; background: #e7eef7; }
.segmented button { border: 0; border-radius: 8px; padding: 7px 9px; color: #76869a; background: transparent; font-size: 9px; font-weight: 750; }
.segmented button.active { color: var(--blue); background: #fff; box-shadow: 0 2px 8px rgba(24, 60, 107, .08); }
.task-list, .detail-task-list { display: grid; gap: 8px; }
.task-card, .detail-task-list article { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.task-check { display: grid; place-items: center; width: 27px; height: 27px; border: 2px solid #bad0e9; border-radius: 9px; color: #fff; background: #fff; font-size: 12px; }
.completed .task-check { border-color: var(--green); background: var(--green); }
.task-card > div, .detail-task-list article > div { min-width: 0; cursor: pointer; }
.task-card small, .detail-task-list small { color: var(--muted); font-size: 8px; }
.task-card h3, .detail-task-list h3 { margin: 4px 0 6px; font-size: 12px; }
.task-card span, .detail-task-list time { color: #6e8097; font-size: 9px; }
.task-card.completed h3, .detail-task-list .completed h3 { color: #8c99a9; text-decoration: line-through; }

.team-grid { display: grid; gap: 10px; }
.team-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.team-card.inactive { opacity: .62; }
.team-card header { display: flex; align-items: center; gap: 10px; }
.team-card header div { min-width: 0; display: grid; gap: 2px; }
.team-card h3 { margin: 0; font-size: 13px; }
.team-card header p { margin: 0; color: var(--muted); font-size: 8px; }
.team-card header > i { margin-left: auto; padding: 4px 7px; border-radius: 6px; color: var(--green); background: #e8f7f1; font-size: 8px; font-style: normal; }
.team-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0; padding: 10px; border-radius: 11px; background: var(--soft); }
.team-metrics p { display: grid; gap: 2px; margin: 0; text-align: center; }
.team-metrics b { font-size: 14px; }
.team-metrics small { color: var(--muted); font-size: 7px; }
.referral-link { display: flex; align-items: center; gap: 7px; padding: 8px; border: 1px dashed #c7d6e9; border-radius: 10px; }
.referral-link code { min-width: 0; flex: 1; overflow: hidden; color: #667d99; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.referral-link button, .team-card footer button { border: 0; color: var(--blue); background: transparent; font-size: 8px; }
.team-card footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.audit-list { display: grid; gap: 7px; }
.audit-list article { display: grid; grid-template-columns: 33px 1fr auto; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.audit-list article > span { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; color: var(--blue); background: #edf5ff; font-size: 10px; font-weight: 900; }
.audit-list div { min-width: 0; }
.audit-list strong { font-size: 9px; }
.audit-list p { margin: 3px 0 0; color: var(--muted); font-size: 7px; }
.audit-list time { color: var(--muted); font-size: 7px; }

.customer-drawer { position: fixed; z-index: 60; inset: 0; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(11, 27, 49, .42); backdrop-filter: blur(3px); }
.drawer-panel { position: absolute; inset: 0; display: grid; grid-template-rows: auto auto auto 1fr auto; overflow: hidden; background: #f7f9fc; animation: drawerUp .25s ease; }
@keyframes drawerUp { from { transform: translateY(5%); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-header { display: flex; justify-content: space-between; gap: 10px; padding: calc(17px + env(safe-area-inset-top)) 15px 13px; border-bottom: 1px solid var(--line); background: #fff; }
.drawer-header > div { min-width: 0; display: grid; gap: 3px; }
.drawer-header small { color: var(--blue); font-size: 8px; font-weight: 800; }
.drawer-header h2 { overflow: hidden; margin: 0; font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }
.drawer-header p { margin: 0; color: var(--muted); font-size: 9px; }
.drawer-header button, .modal-card header button { width: 36px; height: 36px; border: 0; border-radius: 10px; color: #6e8198; background: var(--soft); font-size: 23px; }
.detail-quick-stats { display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; scrollbar-width: none; }
.detail-quick-stats span { flex: 0 0 auto; }
.detail-tabs { display: flex; overflow-x: auto; padding: 0 11px; border-bottom: 1px solid var(--line); background: #fff; scrollbar-width: none; }
.detail-tabs button { position: relative; flex: 1; min-width: 59px; height: 43px; border: 0; color: #75879d; background: transparent; font-size: 9px; font-weight: 750; }
.detail-tabs button.active { color: var(--blue); }
.detail-tabs button.active::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: 0; height: 3px; border-radius: 5px 5px 0 0; background: var(--blue); }
.detail-body { min-height: 0; overflow-y: auto; padding: 12px 12px 105px; }
.detail-loading { padding: 60px 15px; text-align: center; color: var(--muted); font-size: 11px; }
.drawer-actions { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 7px; padding: 10px 11px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .97); backdrop-filter: blur(15px); }
.drawer-actions > button { min-width: 0; min-height: 42px; padding: 0 8px; font-size: 9px; }
.drawer-actions .management-only { grid-column: 1 / -1; }
.detail-section { margin-bottom: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.detail-section > h3 { margin: 0 0 13px; font-size: 12px; }
.value-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.value-block { min-width: 0; padding: 10px; border-radius: 10px; background: var(--soft); }
.value-block span { display: block; margin-bottom: 4px; color: #8a9aaf; font-size: 8px; }
.value-block p { margin: 0; color: #43566e; font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.value-block p i { color: #a1acb9; font-style: normal; }
.edit-card { display: grid; gap: 11px; }
.edit-card label, .modal-field { display: grid; gap: 6px; color: #60738b; font-size: 9px; font-weight: 700; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.edit-card input, .edit-card select, .edit-card textarea, .modal-field input, .modal-field select, .modal-field textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; outline: 0; padding: 9px 10px; color: var(--ink); background: #fff; font-size: 10px; }
.edit-card textarea, .modal-field textarea { resize: vertical; line-height: 1.5; }
.edit-card input:focus, .edit-card select:focus, .edit-card textarea:focus, .modal-field input:focus, .modal-field select:focus, .modal-field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(17, 105, 245, .07); }
.mini-timeline { display: grid; gap: 9px; }
.mini-timeline p { display: grid; grid-template-columns: 7px auto 1fr; gap: 7px; margin: 0; align-items: center; }
.mini-timeline i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.mini-timeline span, .mini-timeline small { color: var(--muted); font-size: 7px; }
.mini-timeline b { font-size: 9px; }
.mini-timeline small { grid-column: 2 / -1; }
.timeline { position: relative; display: grid; gap: 10px; }
.timeline::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 8px; width: 2px; background: #dce7f3; }
.timeline > article { position: relative; margin-left: 20px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.timeline > article > i { position: absolute; left: -17px; top: 18px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px #bed6f4; }
.timeline article header { display: flex; justify-content: space-between; gap: 8px; }
.timeline article header span { color: var(--blue); font-size: 8px; font-weight: 800; }
.timeline article header time { color: var(--muted); font-size: 7px; }
.timeline article h3 { margin: 8px 0 6px; font-size: 12px; }
.timeline article > p { margin: 0 0 11px; color: #5d7189; font-size: 10px; line-height: 1.7; white-space: pre-wrap; }
.timeline dl { display: grid; gap: 5px; margin: 10px 0 0; }
.timeline dl div { padding: 8px; border-radius: 8px; background: var(--soft); }
.timeline dt { color: var(--muted); font-size: 7px; }
.timeline dd { margin: 3px 0 0; color: #4d6179; font-size: 9px; }
.timeline blockquote { margin: 10px 0; padding: 10px; border-left: 3px solid var(--cyan); border-radius: 0 8px 8px 0; color: #4e627a; background: #edf9fc; font-size: 9px; line-height: 1.6; }
.timeline blockquote b { display: block; margin-bottom: 3px; color: #1688a8; font-size: 8px; }
.support-badge { display: inline-block; margin-top: 10px; padding: 5px 8px; border-radius: 7px; color: #a05d0e; background: #fff2dd; font-size: 8px; font-weight: 800; }
.ai-empty { padding: 55px 20px; text-align: center; color: var(--muted); }
.ai-empty b { color: #4c6078; font-size: 13px; }
.ai-empty p { margin: 9px auto 17px; max-width: 400px; font-size: 9px; line-height: 1.7; }
.ai-analysis { margin-bottom: 12px; overflow: hidden; border: 1px solid #d9d8f1; border-radius: 16px; background: #fff; box-shadow: 0 9px 25px rgba(67, 55, 150, .07); }
.ai-analysis > header { padding: 16px; color: #fff; background: linear-gradient(115deg, #44289e, #176ddc); }
.ai-analysis > header div { display: grid; gap: 5px; }
.ai-analysis > header span, .ai-analysis > header time { color: #c6c5f3; font-size: 7px; }
.ai-analysis > header h3 { margin: 0; font-size: 12px; line-height: 1.55; }
.ai-score { display: grid; grid-template-columns: repeat(3, 1fr); padding: 11px; border-bottom: 1px solid #ececf6; }
.ai-score p { display: grid; gap: 4px; margin: 0; text-align: center; }
.ai-score small { color: var(--muted); font-size: 7px; }
.ai-score b { font-size: 9px; }
.ai-highlight { margin: 12px; padding: 12px; border: 1px solid #d9e2fa; border-radius: 11px; background: #f2f5ff; }
.ai-highlight small { color: #594eb5; font-size: 8px; font-weight: 800; }
.ai-highlight p { margin: 5px 0 0; color: #3f4e67; font-size: 10px; line-height: 1.65; }
.ai-grid { display: grid; gap: 8px; padding: 0 12px 12px; }
.ai-grid section { padding: 11px; border-radius: 10px; background: var(--soft); }
.ai-grid h4 { margin: 0 0 7px; color: #53677f; font-size: 9px; }
.ai-grid ul { display: grid; gap: 5px; margin: 0; padding-left: 15px; }
.ai-grid li, .ai-grid .empty-value { color: #63758b; font-size: 8px; line-height: 1.5; }
.ai-analysis > footer { padding: 9px 12px; color: #8a98a8; background: #fafbfc; font-size: 7px; }
.ai-analysis.history { opacity: .82; }

.modal { position: fixed; z-index: 100; inset: 0; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(11, 27, 49, .52); backdrop-filter: blur(4px); }
.modal-card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 94vh; overflow: hidden; display: grid; grid-template-rows: auto 1fr; border-radius: 22px 22px 0 0; background: #fff; animation: modalUp .22s ease; }
@keyframes modalUp { from { transform: translateY(12%); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-card > header { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--line); }
.modal-card header > div { display: grid; gap: 2px; }
.modal-card header small { color: var(--blue); font-size: 7px; font-weight: 900; letter-spacing: .15em; }
.modal-card header h2 { margin: 0; font-size: 17px; }
#modalForm { min-height: 0; overflow-y: auto; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.modal-body { display: grid; gap: 12px; }
.modal-check { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; background: var(--soft); color: #556a82; font-size: 9px; }
.modal-check input { width: 17px; height: 17px; accent-color: var(--blue); }
.modal-warning { padding: 11px; border-radius: 10px; color: #975b18; background: #fff4e5; font-size: 9px; line-height: 1.6; }
.modal-actions { position: sticky; bottom: -14px; display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; margin: 14px -14px -14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .97); }
.toast { position: fixed; z-index: 150; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 30px); padding: 11px 14px; border-radius: 10px; opacity: 0; pointer-events: none; color: #fff; background: #18304e; box-shadow: var(--shadow); font-size: 10px; transform: translate(-50%, 10px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  #syncState { display: inline-flex; }
  .workspace { padding-left: 24px; padding-right: 24px; }
  .greeting-card { grid-template-columns: 1fr auto; align-items: center; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .overview-grid { grid-template-columns: 1.25fr 1fr; }
  .portrait-grid { grid-template-columns: repeat(2, 1fr); }
  .customer-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-panel { grid-template-columns: minmax(240px, 1fr) repeat(4, auto); }
  .search-field { grid-column: auto; }
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .crm-app { display: grid; grid-template-columns: 225px minmax(0, 1fr); }
  .sidebar { position: sticky; inset: 0 auto auto 0; width: 225px; height: 100vh; display: grid; grid-template-rows: auto 1fr auto; align-items: stretch; padding: 25px 15px 17px; border: 0; border-right: 1px solid #dce6f1; box-shadow: none; background: #fff; }
  .sidebar-brand, .sidebar-user { display: flex; }
  .sidebar-brand { padding: 0 7px 23px; border-bottom: 1px solid var(--line); }
  .sidebar-brand strong { font-size: 13px; }
  .main-nav { width: auto; display: grid; align-content: start; gap: 5px; padding-top: 20px; }
  .main-nav button { width: 100%; height: 44px; display: flex; justify-content: flex-start; gap: 10px; padding: 0 11px; }
  .main-nav button i { width: 25px; }
  .main-nav button span { font-size: 10px; }
  .sidebar-user { align-items: center; gap: 8px; padding: 12px 7px 0; border-top: 1px solid var(--line); }
  .sidebar-user > span { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 10px; color: #fff; background: var(--blue); font-size: 10px; font-weight: 900; }
  .sidebar-user div { min-width: 0; display: grid; gap: 2px; }
  .sidebar-user strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user small { color: var(--muted); font-size: 7px; }
  .sidebar-user button { margin-left: auto; border: 0; color: #788ba2; background: transparent; }
  .workspace { max-width: 1500px; padding: 0 32px 38px; }
  .topbar { padding-top: 25px; }
  .topbar h1 { font-size: 25px; }
  .portrait-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .customer-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .customer-card-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .team-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .customer-drawer { z-index: 60; }
  .drawer-panel { inset: 0 0 0 auto; width: min(720px, 72vw); box-shadow: -20px 0 60px rgba(23, 46, 79, .18); animation: drawerSide .25s ease; }
  @keyframes drawerSide { from { transform: translateX(6%); opacity: .5; } to { transform: none; opacity: 1; } }
  .drawer-header { padding: 20px; }
  .detail-body { padding: 16px 17px 95px; }
  .drawer-actions { grid-template-columns: 1.4fr 1fr 1fr auto; padding: 11px 17px; }
  .drawer-actions .management-only { grid-column: auto; }
  .modal-card { left: 50%; right: auto; bottom: 50%; width: min(680px, calc(100% - 40px)); max-height: 88vh; border-radius: 20px; transform: translate(-50%, 50%); animation: modalCenter .2s ease; }
  @keyframes modalCenter { from { transform: translate(-50%, 54%) scale(.98); opacity: .5; } to { transform: translate(-50%, 50%); opacity: 1; } }
  .toast { bottom: 25px; }
}

@media (min-width: 1300px) {
  .portrait-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .customer-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   方案 1：曜石蓝数据指挥舱
   保留原有响应式结构和交互，仅统一视觉令牌与组件语言。
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --bg: #050d1b;
  --surface: #0a192d;
  --surface-2: #0d2038;
  --soft: rgba(15, 38, 66, .78);
  --ink: #edf5ff;
  --muted: #8ea5c3;
  --line: rgba(111, 157, 218, .19);
  --blue: #287dff;
  --cyan: #1fd2e8;
  --green: #27c996;
  --red: #ff667b;
  --orange: #ffb14a;
  --shadow: 0 20px 55px rgba(0, 4, 15, .34);
}

html,
body {
  background: #050d1b;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 84% -8%, rgba(31, 210, 232, .1), transparent 29%),
    radial-gradient(circle at 48% 0, rgba(40, 125, 255, .1), transparent 38%),
    linear-gradient(180deg, #06101f 0%, #050d1b 60%, #071326 100%);
}

body,
button,
input,
select,
textarea {
  font-feature-settings: "tnum" 1, "ss01" 1;
}

input::placeholder,
textarea::placeholder {
  color: #58708f;
}

select option {
  color: var(--ink);
  background: #0b1c32;
}

.login-screen {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(90, 145, 215, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 145, 215, .035) 1px, transparent 1px),
    radial-gradient(circle at 76% 18%, rgba(31, 210, 232, .17), transparent 30%),
    radial-gradient(circle at 20% 85%, rgba(40, 125, 255, .17), transparent 36%),
    linear-gradient(145deg, #040b17, #07162a 58%, #071326);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
}

.login-card {
  width: min(100%, 460px);
  padding: 32px 28px;
  border: 1px solid rgba(96, 156, 226, .25);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(13, 33, 58, .97), rgba(6, 19, 36, .97));
  box-shadow: 0 32px 90px rgba(0, 5, 18, .55), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(24px);
}

.login-card::before {
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan), transparent 92%);
  box-shadow: 0 0 24px rgba(31, 210, 232, .5);
}

.login-brand img,
.sidebar-brand img {
  padding: 2px;
  border: 1px solid rgba(83, 151, 231, .22);
  background: rgba(255, 255, 255, .04);
  box-shadow: 0 10px 24px rgba(0, 9, 28, .26);
}

.login-brand span,
.sidebar-brand span,
.login-copy p,
.back-link {
  color: var(--muted);
}

.login-copy small,
.topbar small,
.panel-heading small {
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(31, 210, 232, .24);
}

.login-copy h1 {
  font-size: 32px;
}

.login-card label {
  color: #c2d1e5;
}

.login-card input,
.edit-card input,
.edit-card select,
.edit-card textarea,
.modal-field input,
.modal-field select,
.modal-field textarea {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(7, 24, 44, .86);
}

.login-card input:focus,
.edit-card input:focus,
.edit-card select:focus,
.edit-card textarea:focus,
.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(31, 210, 232, .08), 0 0 28px rgba(40, 125, 255, .08);
}

.primary-button {
  border: 1px solid rgba(80, 172, 255, .2);
  background: linear-gradient(105deg, #1f69eb, #168df5 58%, #19bed9);
  box-shadow: 0 12px 28px rgba(18, 105, 235, .3), inset 0 1px rgba(255, 255, 255, .18);
}

.ghost-button,
.icon-button {
  border-color: var(--line);
  color: #b7cae4;
  background: rgba(12, 31, 55, .9);
}

.ai-button {
  border: 1px solid rgba(94, 143, 255, .28);
  background: linear-gradient(105deg, #3f4dcc, #2379ec 58%, #15a9d0);
  box-shadow: 0 10px 25px rgba(34, 93, 208, .24);
}

.primary-button,
.ghost-button,
.ai-button,
.icon-button {
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease, background .18s ease;
}

@media (hover: hover) {
  .primary-button:hover,
  .ghost-button:hover,
  .ai-button:hover,
  .icon-button:hover {
    transform: translateY(-1px);
    border-color: rgba(75, 182, 255, .45);
  }
}

.crm-app {
  background: transparent;
}

.sidebar {
  border-color: var(--line);
  background: rgba(5, 15, 29, .96);
  box-shadow: 0 -14px 40px rgba(0, 5, 15, .35);
}

.sidebar-brand {
  border-color: var(--line);
}

.sidebar-brand strong {
  color: #f4f8ff;
}

.main-nav button {
  color: #7891b0;
}

.main-nav button i {
  border: 1px solid transparent;
  background: rgba(19, 46, 78, .42);
}

.main-nav button.active {
  color: #f4f9ff;
  background: linear-gradient(90deg, rgba(36, 112, 244, .31), rgba(20, 124, 213, .11));
  box-shadow: inset 3px 0 var(--cyan), inset 0 0 0 1px rgba(73, 153, 245, .15);
}

.main-nav button.active i {
  border-color: rgba(90, 190, 255, .3);
  background: linear-gradient(135deg, #286ff1, #16b6d3);
  box-shadow: 0 7px 18px rgba(24, 112, 226, .3);
}

.sidebar-user {
  border-color: var(--line);
}

.sidebar-user > span {
  background: linear-gradient(135deg, #235fe0, #1fc7dd);
  box-shadow: 0 8px 20px rgba(29, 112, 222, .27);
}

.sidebar-user small,
.sidebar-user button {
  color: var(--muted);
}

.workspace {
  position: relative;
}

.topbar {
  background: rgba(5, 13, 27, .86);
  border-bottom: 1px solid rgba(111, 157, 218, .08);
  backdrop-filter: blur(22px);
}

.topbar h1 {
  color: #f4f8ff;
}

#syncState {
  color: var(--muted);
}

#syncState i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(39, 201, 150, .08), 0 0 15px rgba(39, 201, 150, .35);
}

.loading-bar {
  background: #0d2038;
}

.greeting-card {
  position: relative;
  border: 1px solid rgba(70, 155, 255, .29);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 15%, rgba(31, 210, 232, .24), transparent 34%),
    linear-gradient(120deg, #103c93, #0d2c67 60%, #0a284f);
  box-shadow: 0 20px 50px rgba(0, 24, 79, .35), inset 0 1px rgba(255, 255, 255, .06);
}

.greeting-card::after {
  content: "";
  position: absolute;
  right: -35px;
  bottom: -75px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(104, 206, 255, .13);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(71, 155, 255, .035), 0 0 0 58px rgba(71, 155, 255, .025);
  pointer-events: none;
}

.greeting-card > * {
  position: relative;
  z-index: 1;
}

.greeting-card p {
  color: #adc5e5;
}

.metric-card,
.panel,
.filter-panel,
.customer-card,
.task-card,
.detail-task-list article,
.team-card,
.audit-list article,
.detail-section,
.timeline > article,
.ai-analysis {
  border-color: var(--line);
  color: var(--ink);
  background: linear-gradient(155deg, rgba(13, 32, 56, .96), rgba(8, 24, 43, .96));
  box-shadow: 0 13px 32px rgba(0, 5, 18, .18), inset 0 1px rgba(255, 255, 255, .025);
}

.metric-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(var(--blue), var(--cyan));
  opacity: .75;
}

.metric-card small,
.metric-card span,
.panel-heading > span,
.compact-task span,
.compact-task time,
.section-toolbar p,
.list-summary,
.customer-card footer,
.task-card small,
.detail-task-list small,
.task-card span,
.detail-task-list time,
.team-card header p,
.team-metrics small,
.audit-list p,
.audit-list time,
.drawer-header p,
.value-block span,
.timeline article header time,
.ai-score small,
.ai-analysis > footer {
  color: var(--muted);
}

.metric-card > b {
  box-shadow: 0 8px 20px rgba(23, 112, 224, .25);
}

.panel {
  border-radius: 16px;
}

.bar-row > span,
.need-preview,
.value-block p,
.timeline article > p,
.ai-highlight p,
.ai-grid li,
.ai-grid .empty-value {
  color: #aabdd5;
}

.bar-row > i,
.portrait-grid article div > i {
  background: #102640;
}

.bar-row > i b,
.portrait-grid article div > i b {
  box-shadow: 0 0 14px rgba(31, 210, 232, .22);
}

.compact-task {
  border-color: rgba(111, 157, 218, .12);
}

.portrait-grid article,
.team-metrics,
.value-block,
.ai-grid section,
.modal-check,
.privacy-note {
  color: var(--ink);
  background: rgba(14, 37, 64, .78);
}

.performance-row {
  border-color: rgba(111, 157, 218, .14);
  background: rgba(9, 26, 47, .42);
}

.filter-panel select,
.search-field {
  border-color: var(--line);
  color: #b9cae0;
  background: rgba(7, 24, 44, .9);
}

.search-field input {
  color: var(--ink);
}

.search-field span {
  color: var(--cyan);
}

.customer-card,
.task-card,
.team-card,
.audit-list article {
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

@media (hover: hover) {
  .customer-card:hover,
  .task-card:hover,
  .team-card:hover,
  .audit-list article:hover {
    transform: translateY(-2px);
    border-color: rgba(74, 171, 255, .4);
    box-shadow: 0 18px 42px rgba(0, 7, 22, .3), 0 0 30px rgba(40, 125, 255, .06);
  }
}

.status-badge {
  color: #73b9ff;
  background: rgba(39, 125, 255, .14);
}

.status-badge[data-status="已成交"] {
  color: #64dfb4;
  background: rgba(39, 201, 150, .13);
}

.status-badge[data-status="已流失"],
.status-badge[data-status="无效客户"] {
  color: #8fa0b4;
  background: rgba(117, 137, 163, .12);
}

.customer-tags span,
.detail-quick-stats span {
  color: #a8bed9;
  background: rgba(16, 42, 72, .82);
}

[data-intent="高"] {
  color: #61dfb2 !important;
  background-color: rgba(39, 201, 150, .13) !important;
}

[data-intent="中"] {
  color: #ffc66f !important;
  background-color: rgba(255, 177, 74, .13) !important;
}

[data-intent="低"] {
  color: #9dafc5 !important;
  background-color: rgba(126, 148, 178, .12) !important;
}

.pagination button,
.segmented {
  border-color: var(--line);
  color: #abc0dc;
  background: rgba(13, 32, 56, .85);
}

.segmented button {
  color: var(--muted);
}

.segmented button.active {
  color: #fff;
  background: linear-gradient(120deg, #205ed9, #148daa);
  box-shadow: 0 7px 18px rgba(22, 105, 203, .22);
}

.task-check {
  border-color: #335b86;
  background: #0a1d34;
}

.team-card header > i {
  color: #61dfb2;
  background: rgba(39, 201, 150, .13);
}

.referral-link {
  border-color: rgba(88, 147, 214, .34);
  background: rgba(7, 24, 44, .62);
}

.referral-link code {
  color: #92afd0;
}

.audit-list article > span {
  color: #80c9ff;
  background: rgba(40, 125, 255, .15);
}

.drawer-backdrop,
.modal-backdrop {
  background: rgba(0, 5, 15, .73);
  backdrop-filter: blur(7px);
}

.drawer-panel {
  border-left: 1px solid rgba(93, 154, 224, .2);
  background: #071326;
  box-shadow: -30px 0 90px rgba(0, 4, 15, .52);
}

.drawer-header,
.detail-quick-stats,
.detail-tabs,
.drawer-actions {
  border-color: var(--line);
  background: rgba(7, 20, 38, .96);
}

.drawer-header button,
.modal-card header button {
  color: #9bb1cc;
  background: rgba(17, 43, 73, .86);
}

.detail-tabs button {
  color: #7f96b4;
}

.detail-tabs button.active {
  color: #f0f7ff;
}

.detail-tabs button.active::after {
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 14px rgba(31, 210, 232, .38);
}

.detail-body {
  background:
    radial-gradient(circle at 100% 0, rgba(40, 125, 255, .08), transparent 27%),
    #071326;
}

.edit-card label,
.modal-field {
  color: #9fb4cf;
}

.mini-timeline span,
.mini-timeline small {
  color: var(--muted);
}

.timeline::before {
  background: #153554;
}

.timeline > article > i {
  border-color: #0a1b30;
  box-shadow: 0 0 0 2px #235e99, 0 0 15px rgba(31, 210, 232, .28);
}

.timeline dl div,
.timeline blockquote {
  border-color: var(--line);
  color: #b2c4da;
  background: rgba(13, 35, 60, .75);
}

.ai-empty b,
.empty-state b {
  color: #c1d1e4;
}

.ai-analysis {
  border-color: rgba(66, 139, 255, .28);
}

.ai-analysis > header {
  background:
    radial-gradient(circle at 90% 0, rgba(31, 210, 232, .2), transparent 40%),
    linear-gradient(115deg, #193d8f, #123170 58%, #0d315d);
}

.ai-analysis > header span,
.ai-analysis > header time {
  color: #a8cef2;
}

.ai-score {
  border-color: var(--line);
}

.ai-highlight {
  border-color: rgba(55, 151, 255, .28);
  background: rgba(27, 79, 155, .16);
}

.ai-highlight small {
  color: #6fd8ff;
}

.ai-grid h4 {
  color: #b9cae0;
}

.ai-analysis > footer {
  background: rgba(6, 20, 37, .72);
}

.modal-card {
  border: 1px solid rgba(93, 154, 224, .22);
  background: #0a192d;
  box-shadow: 0 30px 90px rgba(0, 3, 12, .62);
}

.modal-card > header,
.modal-actions {
  border-color: var(--line);
  background: rgba(8, 24, 43, .98);
}

.modal-warning {
  color: #ffd090;
  background: rgba(156, 91, 18, .2);
  border: 1px solid rgba(255, 177, 74, .2);
}

.toast {
  border: 1px solid rgba(78, 156, 245, .33);
  background: #0d2746;
  box-shadow: 0 18px 45px rgba(0, 5, 18, .44), 0 0 30px rgba(40, 125, 255, .1);
}

* {
  scrollbar-color: #24496f #08172a;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-track {
  background: #08172a;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid #08172a;
  border-radius: 999px;
  background: #24496f;
}

@media (min-width: 900px) {
  .crm-app {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .sidebar {
    width: 244px;
    padding: 26px 17px 18px;
    border-right: 1px solid var(--line);
    background:
      radial-gradient(circle at 30% 0, rgba(40, 125, 255, .11), transparent 26%),
      linear-gradient(180deg, #07172b, #050e1c 70%);
    box-shadow: 12px 0 40px rgba(0, 4, 15, .16);
  }

  .main-nav button {
    border-radius: 9px;
  }

  .workspace {
    width: 100%;
    max-width: 1680px;
    padding: 0 34px 46px;
  }

  .topbar {
    margin: 0 -4px 3px;
    padding: 25px 4px 17px;
  }

  .drawer-panel {
    width: min(820px, 76vw);
  }
}

@media (min-width: 1300px) {
  .overview-grid {
    grid-template-columns: 1.18fr .82fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------------------------------------------------------------
   方案 2：暖白极简高奢销售助手
   以大字号、清晰层级和克制的珊瑚色操作为核心。
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --bg: #f4f0e9;
  --surface: #fffdf9;
  --surface-2: #ffffff;
  --soft: #f7f3ed;
  --ink: #243044;
  --muted: #697589;
  --line: rgba(47, 57, 72, .12);
  --blue: #ef6a5b;
  --cyan: #de8c71;
  --green: #2d9488;
  --red: #d95050;
  --orange: #c68a44;
  --shadow: 0 18px 46px rgba(56, 46, 35, .08);
}

html,
body {
  background: var(--bg);
}

body {
  min-width: 320px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 92% 0, rgba(239, 106, 91, .08), transparent 28%),
    radial-gradient(circle at 0 42%, rgba(45, 148, 136, .055), transparent 27%),
    #f4f0e9;
}

input::placeholder,
textarea::placeholder {
  color: #9aa2ae;
}

select option {
  color: var(--ink);
  background: #fff;
}

.login-screen {
  padding: 28px 18px;
  background:
    radial-gradient(circle at 78% 14%, rgba(239, 106, 91, .12), transparent 27%),
    radial-gradient(circle at 12% 88%, rgba(45, 148, 136, .09), transparent 29%),
    #f4f0e9;
}

.login-card {
  width: min(100%, 500px);
  padding: 38px 36px;
  border: 1px solid rgba(55, 54, 51, .1);
  border-radius: 24px;
  background: rgba(255, 253, 249, .97);
  box-shadow: 0 30px 90px rgba(58, 47, 34, .13), inset 0 1px rgba(255, 255, 255, .8);
  backdrop-filter: blur(20px);
}

.login-card::before {
  width: 84px;
  height: 4px;
  right: auto;
  background: #ef6a5b;
  box-shadow: none;
}

.login-brand img,
.sidebar-brand img {
  padding: 2px;
  border: 1px solid rgba(50, 64, 82, .1);
  background: #fff;
  box-shadow: 0 8px 22px rgba(47, 54, 65, .08);
}

.login-brand strong,
.sidebar-brand strong,
.topbar h1,
.login-copy h1 {
  color: var(--ink);
}

.login-brand span,
.sidebar-brand span,
.login-copy p,
.back-link {
  color: var(--muted);
}

.login-brand strong {
  font-size: 17px;
}

.login-brand span,
.sidebar-brand span {
  font-size: 12px;
  letter-spacing: .12em;
}

.login-copy {
  margin: 40px 0 30px;
}

.login-copy small,
.topbar small,
.panel-heading small {
  color: #d85e50;
  font-size: 12px;
  letter-spacing: .13em;
  text-shadow: none;
}

.login-copy h1 {
  margin-top: 10px;
  font-size: 34px;
  letter-spacing: -.035em;
}

.login-copy p {
  font-size: 15px;
}

.login-card form {
  gap: 18px;
}

.login-card label {
  gap: 9px;
  color: #465164;
  font-size: 14px;
}

.login-card input,
.edit-card input,
.edit-card select,
.edit-card textarea,
.modal-field input,
.modal-field select,
.modal-field textarea {
  border-color: #ded9d1;
  color: var(--ink);
  background: #faf7f2;
}

.login-card input {
  height: 54px;
  border-radius: 12px;
  font-size: 15px;
}

.login-card input:focus,
.edit-card input:focus,
.edit-card select:focus,
.edit-card textarea:focus,
.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  border-color: #ef8b7f;
  box-shadow: 0 0 0 4px rgba(239, 106, 91, .1);
}

.form-error {
  font-size: 13px;
}

.primary-button,
.ghost-button,
.ai-button,
.icon-button,
.text-button {
  border-radius: 11px;
  font-size: 14px;
  letter-spacing: .01em;
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 3px solid rgba(239, 106, 91, .22);
  outline-offset: 2px;
}

button:active {
  transform: translateY(0) scale(.98);
}

.primary-button {
  min-height: 46px;
  border: 1px solid #e86254;
  color: #fff;
  background: #ef6a5b;
  box-shadow: 0 10px 24px rgba(207, 81, 68, .2), inset 0 1px rgba(255, 255, 255, .22);
}

.ghost-button,
.icon-button {
  border-color: #ddd7ce;
  color: #526074;
  background: #fffdf9;
  box-shadow: 0 5px 15px rgba(52, 48, 42, .045);
}

.ai-button {
  border: 1px solid #287f76;
  color: #fff;
  background: #2d9488;
  box-shadow: 0 10px 22px rgba(34, 126, 116, .18);
}

.text-button,
.list-summary button,
.referral-link button,
.team-card footer button {
  color: #d85e50;
}

@media (hover: hover) {
  .primary-button:hover,
  .ghost-button:hover,
  .ai-button:hover,
  .icon-button:hover {
    transform: translateY(-1px);
  }

  .primary-button:hover {
    border-color: #d95547;
    background: #e75f51;
    box-shadow: 0 13px 28px rgba(207, 81, 68, .25);
  }

  .ghost-button:hover,
  .icon-button:hover {
    border-color: #cfc6bb;
    background: #fff;
  }

  .ai-button:hover {
    border-color: #1f7169;
    background: #27887e;
  }
}

.back-link {
  margin-top: 25px;
  font-size: 13px;
}

.crm-app {
  background: transparent;
}

.sidebar {
  border-color: #ddd8d0;
  background: rgba(255, 253, 249, .96);
  box-shadow: 0 -12px 34px rgba(51, 44, 37, .08);
}

.sidebar-brand,
.sidebar-user {
  border-color: #e8e2da;
}

.main-nav button {
  color: #778296;
}

.main-nav button i {
  border: 0;
  color: #7c8797;
  background: #f3eee7;
  font-size: 12px;
}

.main-nav button span {
  font-size: 12px;
}

.main-nav button.active {
  color: #d65649;
  background: #fff0ec;
  box-shadow: none;
}

.main-nav button.active i {
  border: 0;
  color: #fff;
  background: #ef6a5b;
  box-shadow: 0 7px 17px rgba(207, 81, 68, .18);
}

.sidebar-user > span {
  color: #fff;
  background: #2d9488;
  box-shadow: 0 8px 18px rgba(34, 126, 116, .16);
  font-size: 13px;
}

.sidebar-user strong {
  color: var(--ink);
  font-size: 13px;
}

.sidebar-user small,
.sidebar-user button {
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  border-bottom-color: rgba(56, 57, 60, .06);
  background: rgba(244, 240, 233, .91);
  backdrop-filter: blur(20px);
}

.topbar h1 {
  font-size: 28px;
}

#syncState {
  color: var(--muted);
  font-size: 12px;
}

#syncState i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(45, 148, 136, .09);
}

.loading-bar {
  background: #eadfd7;
}

.loading-bar i {
  background: linear-gradient(90deg, #ef6a5b, #e9a46e);
}

.greeting-card {
  padding: 26px 28px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 0, rgba(239, 106, 91, .28), transparent 35%),
    linear-gradient(125deg, #273447, #35455c);
  box-shadow: 0 18px 38px rgba(37, 46, 60, .17);
}

.greeting-card::after {
  display: none;
}

.greeting-card small {
  color: #f3c4ba;
  font-size: 12px;
}

.greeting-card h2 {
  margin: 7px 0 8px;
  font-size: 24px;
}

.greeting-card p {
  color: #d7dee8;
  font-size: 14px;
}

.greeting-card .ghost-button {
  min-height: 44px;
  border-color: rgba(255, 255, 255, .25);
  color: #fff;
  background: rgba(255, 255, 255, .1);
  box-shadow: none;
}

.metric-grid {
  gap: 14px;
  margin: 16px 0;
}

.metric-card,
.panel,
.filter-panel,
.customer-card,
.task-card,
.detail-task-list article,
.team-card,
.audit-list article,
.detail-section,
.timeline > article,
.ai-analysis {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 253, 249, .98);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 124px;
  padding: 20px;
  border-radius: 16px;
}

.metric-card::before {
  display: none;
}

.metric-card small,
.metric-card span,
.panel-heading > span,
.compact-task span,
.compact-task time,
.section-toolbar p,
.list-summary,
.customer-card footer,
.task-card small,
.detail-task-list small,
.task-card span,
.detail-task-list time,
.team-card header p,
.team-metrics small,
.audit-list p,
.audit-list time,
.drawer-header p,
.value-block span,
.timeline article header time,
.ai-score small,
.ai-analysis > footer {
  color: var(--muted);
}

.metric-card small {
  font-size: 13px;
}

.metric-card strong {
  font-size: 32px;
}

.metric-card span {
  font-size: 12px;
}

.metric-card > b {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #ef6a5b;
  box-shadow: 0 8px 18px rgba(207, 81, 68, .17);
  font-size: 13px;
}

.metric-card > b[data-color="green"] {
  background: #2d9488;
}

.metric-card > b[data-color="red"] {
  background: #d95050;
}

.metric-card > b[data-color="cyan"] {
  background: #c68a44;
}

.overview-grid {
  gap: 16px;
}

.panel {
  margin-bottom: 16px;
  padding: 22px;
  border-radius: 17px;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-heading h2 {
  font-size: 19px;
}

.panel-heading > span {
  font-size: 12px;
}

.bar-chart {
  gap: 13px;
}

.bar-row {
  grid-template-columns: 86px 1fr 34px;
  gap: 11px;
}

.bar-row > span,
.bar-row > strong {
  color: #59677a;
  font-size: 13px;
}

.bar-row > i,
.portrait-grid article div > i {
  height: 8px;
  background: #eee8e1;
}

.bar-row > i b,
.portrait-grid article div > i b {
  background: linear-gradient(90deg, #ef6a5b, #e9a46e);
  box-shadow: none;
}

.compact-task {
  grid-template-columns: 9px 1fr auto;
  padding: 14px 0;
  border-color: #eee8e1;
}

.compact-task strong {
  font-size: 14px;
}

.compact-task span,
.compact-task time {
  font-size: 12px;
}

.portrait-grid {
  gap: 14px;
}

.portrait-grid article,
.team-metrics,
.value-block,
.ai-grid section,
.modal-check {
  color: var(--ink);
  background: #f7f3ed;
}

.portrait-grid article {
  padding: 17px;
  border: 1px solid rgba(47, 57, 72, .07);
}

.portrait-grid h3 {
  font-size: 15px;
}

.portrait-grid article > div {
  grid-template-columns: 84px 1fr 28px;
  gap: 9px;
  margin-top: 10px;
}

.portrait-grid article div span,
.portrait-grid article div strong,
.portrait-grid article > p {
  font-size: 12px;
}

.performance-list {
  gap: 10px;
}

.performance-row {
  grid-template-columns: 42px minmax(120px, 1fr) repeat(4, 66px);
  gap: 10px;
  padding: 14px;
  border-color: #ebe5dd;
  background: #fff;
}

.person-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #2d9488;
  font-size: 15px;
}

.performance-row > div strong,
.performance-row p b {
  font-size: 14px;
}

.performance-row > div small,
.performance-row p small {
  font-size: 12px;
}

.filter-panel {
  gap: 10px;
  margin-bottom: 10px;
  padding: 14px;
  border-radius: 16px;
}

.search-field,
.filter-panel select {
  height: 46px;
  border-color: #ded9d1;
  color: #4e5b6d;
  background: #faf7f2;
  font-size: 13px;
}

.search-field span {
  color: #d85e50;
}

.search-field input {
  color: var(--ink);
  font-size: 14px;
}

.filter-panel .ghost-button {
  min-height: 46px;
}

.list-summary {
  padding: 13px 4px;
  font-size: 13px;
}

.list-summary button {
  font-size: 12px;
}

.customer-card-grid {
  gap: 14px;
}

.customer-card {
  padding: 19px;
  border-radius: 17px;
}

@media (hover: hover) {
  .customer-card:hover,
  .task-card:hover,
  .team-card:hover,
  .audit-list article:hover {
    transform: translateY(-2px);
    border-color: rgba(239, 106, 91, .28);
    box-shadow: 0 22px 48px rgba(56, 46, 35, .12);
  }
}

.customer-card header small {
  color: #8a94a4;
  font-size: 12px;
}

.customer-card h3 {
  font-size: 17px;
}

.status-badge {
  padding: 6px 9px;
  color: #ce5c50;
  background: #fff0ec;
  font-size: 12px;
}

.status-badge[data-status="已成交"] {
  color: #267c72;
  background: #eaf6f3;
}

.status-badge[data-status="已流失"],
.status-badge[data-status="无效客户"] {
  color: #737d8a;
  background: #f0f1f2;
}

.need-preview {
  height: 44px;
  color: #667386;
  font-size: 13px;
}

.customer-tags span,
.detail-quick-stats span {
  padding: 5px 8px;
  color: #5d6878;
  background: #f5f1eb;
  font-size: 12px;
}

[data-intent="高"] {
  color: #267c72 !important;
  background-color: #eaf6f3 !important;
}

[data-intent="中"] {
  color: #a26728 !important;
  background-color: #fbf1df !important;
}

[data-intent="低"] {
  color: #737d8a !important;
  background-color: #f0f1f2 !important;
}

.customer-card footer {
  margin-top: 14px;
  padding-top: 13px;
  border-color: #eee8e1;
  font-size: 12px;
}

.pagination {
  margin-top: 20px;
}

.pagination button {
  min-height: 40px;
  padding: 0 14px;
  border-color: #ddd7ce;
  color: #536074;
  background: #fffdf9;
  font-size: 12px;
}

.pagination span,
.empty-state p,
.empty-inline {
  color: var(--muted);
  font-size: 13px;
}

.empty-state b,
.ai-empty b {
  color: #536074;
  font-size: 16px;
}

.section-toolbar {
  margin-bottom: 17px;
}

.section-toolbar h2 {
  font-size: 21px;
}

.section-toolbar p {
  font-size: 13px;
}

.segmented {
  padding: 4px;
  background: #eae4dc;
}

.segmented button {
  padding: 9px 13px;
  color: #737f91;
  font-size: 12px;
}

.segmented button.active {
  color: #d65649;
  background: #fff;
  box-shadow: 0 3px 10px rgba(52, 47, 41, .08);
}

.task-list,
.detail-task-list {
  gap: 11px;
}

.task-card,
.detail-task-list article {
  grid-template-columns: 34px 1fr;
  gap: 13px;
  padding: 18px;
  border-radius: 15px;
}

.task-check {
  width: 31px;
  height: 31px;
  border-color: #d9cfc4;
  background: #fff;
}

.task-card small,
.detail-task-list small,
.task-card span,
.detail-task-list time {
  font-size: 12px;
}

.task-card h3,
.detail-task-list h3 {
  margin: 6px 0 8px;
  font-size: 15px;
}

.team-grid {
  gap: 14px;
}

.team-card {
  padding: 19px;
  border-radius: 17px;
}

.team-card h3 {
  font-size: 16px;
}

.team-card header p,
.team-card header > i {
  font-size: 12px;
}

.team-card header > i {
  color: #267c72;
  background: #eaf6f3;
}

.team-metrics {
  margin: 17px 0;
  padding: 13px;
}

.team-metrics b {
  font-size: 17px;
}

.team-metrics small {
  font-size: 12px;
}

.referral-link {
  padding: 10px;
  border-color: #d4cabe;
  background: #faf7f2;
}

.referral-link code,
.referral-link button,
.team-card footer button {
  color: #667386;
  font-size: 12px;
}

.audit-list {
  gap: 10px;
}

.audit-list article {
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  padding: 15px;
}

.audit-list article > span {
  width: 40px;
  height: 40px;
  color: #d85e50;
  background: #fff0ec;
  font-size: 14px;
}

.audit-list strong {
  font-size: 13px;
}

.audit-list p,
.audit-list time {
  font-size: 12px;
}

.drawer-backdrop,
.modal-backdrop {
  background: rgba(33, 38, 45, .44);
  backdrop-filter: blur(6px);
}

.drawer-panel {
  border-left-color: rgba(47, 57, 72, .11);
  background: #f5f1eb;
  box-shadow: -24px 0 70px rgba(45, 38, 31, .18);
}

.drawer-header,
.detail-quick-stats,
.detail-tabs,
.drawer-actions {
  border-color: #e7e0d7;
  background: rgba(255, 253, 249, .98);
}

.drawer-header small {
  color: #d85e50;
  font-size: 12px;
}

.drawer-header h2 {
  font-size: 22px;
}

.drawer-header p {
  font-size: 13px;
}

.drawer-header button,
.modal-card header button {
  color: #6e7888;
  background: #f3eee7;
}

.detail-tabs button {
  min-width: 72px;
  height: 48px;
  color: #707c8f;
  font-size: 13px;
}

.detail-tabs button.active {
  color: #d65649;
}

.detail-tabs button.active::after {
  height: 2px;
  background: #ef6a5b;
  box-shadow: none;
}

.detail-body {
  background: #f5f1eb;
}

.detail-loading {
  font-size: 14px;
}

.drawer-actions > button {
  min-height: 44px;
  font-size: 13px;
}

.detail-section {
  margin-bottom: 13px;
  padding: 19px;
  border-radius: 16px;
}

.detail-section > h3 {
  font-size: 16px;
}

.value-grid {
  gap: 11px;
}

.value-block {
  padding: 13px;
}

.value-block span {
  font-size: 12px;
}

.value-block p {
  color: #485569;
  font-size: 14px;
}

.edit-card label,
.modal-field {
  color: #59667a;
  font-size: 13px;
}

.edit-card input,
.edit-card select,
.edit-card textarea,
.modal-field input,
.modal-field select,
.modal-field textarea {
  min-height: 46px;
  font-size: 14px;
}

.mini-timeline span,
.mini-timeline small,
.mini-timeline b {
  font-size: 12px;
}

.timeline::before {
  background: #ddd4c9;
}

.timeline > article > i {
  border-color: #fffdf9;
  background: #ef6a5b;
  box-shadow: 0 0 0 2px #efc2ba;
}

.timeline article header span,
.timeline article header time,
.timeline dt,
.timeline dd {
  font-size: 12px;
}

.timeline article header span {
  color: #d85e50;
}

.timeline article h3 {
  font-size: 16px;
}

.timeline article > p {
  color: #59667a;
  font-size: 14px;
}

.timeline dl div,
.timeline blockquote {
  border-color: #e6ded5;
  color: #526074;
  background: #f7f3ed;
}

.ai-empty p {
  font-size: 13px;
}

.ai-analysis {
  border-color: rgba(45, 148, 136, .22);
}

.ai-analysis > header {
  padding: 20px;
  background: #2d9488;
}

.ai-analysis > header span,
.ai-analysis > header time {
  color: #d9f1ed;
  font-size: 12px;
}

.ai-analysis > header h3 {
  font-size: 16px;
}

.ai-score {
  padding: 14px;
  border-color: #ebe5dd;
}

.ai-score small,
.ai-score b {
  font-size: 12px;
}

.ai-highlight {
  margin: 15px;
  padding: 15px;
  border-color: #cce3df;
  background: #eef7f5;
}

.ai-highlight small {
  color: #267c72;
  font-size: 12px;
}

.ai-highlight p {
  color: #485b61;
  font-size: 14px;
}

.ai-grid {
  gap: 10px;
  padding: 0 15px 15px;
}

.ai-grid section {
  padding: 14px;
}

.ai-grid h4 {
  color: #526074;
  font-size: 13px;
}

.ai-grid li,
.ai-grid .empty-value {
  color: #5e6b7d;
  font-size: 13px;
}

.ai-analysis > footer {
  padding: 12px 15px;
  background: #faf7f2;
  font-size: 12px;
}

.modal-card {
  border-color: rgba(47, 57, 72, .12);
  background: #fffdf9;
  box-shadow: 0 30px 90px rgba(49, 40, 31, .22);
}

.modal-card > header,
.modal-actions {
  border-color: #e7e0d7;
  background: rgba(255, 253, 249, .98);
}

.modal-card header small {
  color: #d85e50;
  font-size: 12px;
}

.modal-card header h2 {
  font-size: 21px;
}

.modal-check {
  font-size: 13px;
}

.modal-warning {
  border: 1px solid #edd8ba;
  color: #8a5b28;
  background: #fbf2e5;
  font-size: 13px;
}

.toast {
  border: 0;
  color: #fff;
  background: #273447;
  box-shadow: 0 18px 45px rgba(37, 46, 60, .24);
  font-size: 13px;
}

body.drawer-open .toast {
  bottom: calc(126px + env(safe-area-inset-bottom));
}

* {
  scrollbar-color: #c8bfb4 #f3eee7;
}

*::-webkit-scrollbar-track {
  background: #f3eee7;
}

*::-webkit-scrollbar-thumb {
  border-color: #f3eee7;
  background: #c8bfb4;
}

@media (max-width: 699px) {
  .workspace {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    padding-top: 18px;
  }

  .greeting-card {
    padding: 22px;
  }

  .metric-card {
    min-height: 116px;
    padding: 17px;
  }

  .performance-row {
    grid-template-columns: 42px 1fr repeat(2, 54px);
    grid-template-rows: repeat(2, auto);
  }

  .performance-row .person-avatar,
  .performance-row > div { grid-row: 1 / 3; }
  .performance-row p:nth-of-type(1) { grid-column: 3; grid-row: 1; }
  .performance-row p:nth-of-type(2) { grid-column: 4; grid-row: 1; }
  .performance-row p:nth-of-type(3) { grid-column: 3; grid-row: 2; }
  .performance-row p:nth-of-type(4) { grid-column: 4; grid-row: 2; }

  .filter-panel {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .crm-app {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .sidebar {
    width: 250px;
    padding: 28px 18px 20px;
    border-right: 1px solid #e1dbd3;
    background: rgba(255, 253, 249, .98);
    box-shadow: 10px 0 36px rgba(58, 50, 42, .045);
  }

  .sidebar-brand strong {
    font-size: 16px;
  }

  .main-nav {
    gap: 8px;
  }

  .main-nav button {
    height: 48px;
    border-radius: 11px;
  }

  .main-nav button i {
    width: 29px;
    height: 29px;
    font-size: 13px;
  }

  .main-nav button span {
    font-size: 14px;
  }

  .workspace {
    width: 100%;
    max-width: 1640px;
    padding: 0 38px 50px;
  }

  .topbar {
    margin: 0 -4px 5px;
    padding: 27px 4px 19px;
  }

  .drawer-panel {
    width: min(840px, 76vw);
  }

  body.drawer-open .toast {
    bottom: 84px;
  }
}

@media (min-width: 1300px) {
  .overview-grid {
    grid-template-columns: 1.15fr .85fr;
  }

  .customer-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

/* CRM v3：统一字号、商机、画像与商业闭环组件。 */
body { font-size: 16px; }
.main-nav button span,
.sidebar-user strong,
.topbar small,
#syncState,
.metric-card small,
.metric-card span,
.panel-heading small,
.panel-heading > span,
.bar-row > span,
.bar-row > strong,
.compact-task span,
.compact-task time,
.portrait-grid article div span,
.portrait-grid article div strong,
.performance-row small,
.customer-card small,
.customer-card footer,
.team-card small,
.detail-tabs button,
.value-block > span,
.mini-timeline span,
.mini-timeline small,
.timeline article header span,
.timeline article header time,
.audit-list p,
.audit-list time { font-size: 14px; }

.main-nav button span,
.customer-card h3,
.opportunity-card h3,
.detail-opportunity h3 { font-weight: 750; }

.main-nav button i {
  font-size: 13px;
  font-family: inherit;
}

.filter-panel {
  grid-template-columns: minmax(260px, 1.7fr) repeat(5, minmax(110px, auto));
  align-items: center;
}

.filter-panel select,
.search-field input,
.list-summary,
.list-summary button { font-size: 14px; }

.customer-opportunity {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  color: #59667a;
  background: #f7f3ed;
  font-size: 14px;
}

.customer-opportunity b { color: #d85e50; }

.opportunity-filters {
  display: flex;
  width: 100%;
  margin-bottom: 18px;
  overflow-x: auto;
}

.opportunity-list { display: grid; gap: 14px; }
.opportunity-card,
.detail-opportunity {
  padding: 20px;
  border: 1px solid rgba(47, 57, 72, .1);
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 12px 30px rgba(56, 46, 35, .06);
}

.opportunity-card > header,
.detail-opportunity > header,
.opportunity-card > footer,
.detail-opportunity > footer,
.detail-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.opportunity-card h3,
.detail-opportunity h3 { margin: 5px 0 0; font-size: 18px; }
.opportunity-card header > span,
.detail-opportunity header > span { padding: 6px 10px; border-radius: 999px; color: #d85e50; background: #fff0ed; font-size: 13px; font-weight: 750; }
.opportunity-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.opportunity-values p { margin: 0; padding: 12px; border-radius: 11px; background: #f7f3ed; }
.opportunity-values small { display: block; color: var(--muted); font-size: 13px; }
.opportunity-values b { display: block; margin-top: 4px; color: var(--ink); font-size: 17px; }
.opportunity-next { margin: 12px 0; color: #59667a; font-size: 14px; }
.opportunity-card footer { border-top: 1px solid #eee8e1; padding-top: 13px; color: var(--muted); }
.opportunity-card footer button,
.detail-opportunity footer button,
.detail-section-title button,
.contact-card > button { border: 0; color: #d85e50; background: transparent; font-size: 14px; }

.priority-list { display: grid; gap: 8px; }
.priority-customer { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid #eee8e1; border-radius: 12px; text-align: left; color: var(--ink); background: #fff; }
.portrait-score { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #ef6a5b, #de8c71); font-size: 17px; font-weight: 850; }
.priority-customer strong { display: block; font-size: 15px; }
.priority-customer small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.priority-customer i { color: #2d9488; font-size: 13px; font-style: normal; }

.source-performance { display: grid; gap: 9px; }
.source-performance article { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 13px 0; border-bottom: 1px solid #eee8e1; }
.source-performance strong { font-size: 15px; }
.source-performance small,
.source-performance span { color: var(--muted); font-size: 13px; }
.source-performance b { grid-row: 1 / 3; grid-column: 2; align-self: center; color: #2d9488; font-size: 20px; }

.portrait-score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.portrait-score-grid article { padding: 16px; border-radius: 13px; background: #f7f3ed; }
.portrait-score-grid small,
.portrait-score-grid span { display: block; color: var(--muted); font-size: 13px; }
.portrait-score-grid strong { display: block; margin: 5px 0; color: #d85e50; font-size: 28px; }
.portrait-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.portrait-tags span { padding: 7px 10px; border-radius: 999px; color: #536074; background: #f1ece5; font-size: 14px; }
.risk-list { display: grid; gap: 9px; margin: 0; padding-left: 20px; color: #b14f47; }
.next-action-card { border-left: 4px solid #2d9488; }
.next-action-card small { color: #2d9488; font-size: 13px; }
.next-action-card strong { display: block; margin: 7px 0; font-size: 17px; }
.next-action-card p { margin: 0; color: var(--muted); font-size: 13px; }

.contact-list,
.detail-opportunity-list { display: grid; gap: 10px; }
.contact-card { display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid #eee8e1; border-radius: 12px; background: #fff; }
.contact-card strong { font-size: 15px; }
.contact-card small,
.contact-card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.contact-flags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.contact-flags i { padding: 4px 7px; border-radius: 999px; color: #267c72; background: #eaf6f3; font-size: 12px; font-style: normal; }
.inline-hint { padding: 11px 12px; border-radius: 10px; color: #59667a; background: #f7f3ed; font-size: 13px; }
.commercial-summary { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0; }
.commercial-summary span { padding: 5px 8px; border-radius: 8px; color: #59667a; background: #f1ece5; font-size: 12px; }

.modal-details { margin-top: 14px; border: 1px solid #ded8cf; border-radius: 12px; background: #f8f4ee; }
.modal-details summary { padding: 14px; cursor: pointer; color: #536074; font-size: 14px; font-weight: 700; }
.modal-details > div { padding: 0 14px 4px; }
.modal-field { font-size: 14px; }
.modal-field input,
.modal-field select,
.modal-field textarea,
.edit-card input,
.edit-card select,
.edit-card textarea { font-size: 15px; }

.drawer-more { position: relative; }
.drawer-more > button { width: 100%; height: 100%; }
.drawer-more-menu { position: absolute; right: 0; bottom: calc(100% + 8px); width: 170px; padding: 7px; border: 1px solid #ded8cf; border-radius: 12px; background: #fff; box-shadow: 0 16px 42px rgba(56, 46, 35, .16); }
.drawer-more-menu button { width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; text-align: left; color: #536074; background: transparent; font-size: 14px; }
.drawer-more-menu button:hover { background: #f7f3ed; }
.drawer-actions { grid-template-columns: 1.4fr 1fr 1fr auto; }

.detail-tabs { overflow-x: auto; }
.detail-tabs button { min-width: 88px; }

@media (max-width: 899px) {
  .main-nav { justify-content: flex-start; overflow-x: auto; }
  .main-nav button { flex: 0 0 66px; }
  .main-nav button span { font-size: 12px; }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .filter-panel .search-field { grid-column: 1 / -1; }
  .opportunity-values,
  .portrait-score-grid { grid-template-columns: 1fr; }
  .contact-card { grid-template-columns: 42px 1fr auto; }
  .contact-flags { grid-column: 2 / -1; justify-content: flex-start; }
}

.commercial-records {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.commercial-records button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: left;
}

.commercial-records button:hover {
  border-color: rgba(231, 83, 77, 0.35);
  background: #fff;
}

.commercial-records button span {
  display: grid;
  gap: 3px;
}

.commercial-records button span:last-child {
  justify-items: end;
  text-align: right;
}

.commercial-records b,
.commercial-records strong { font-size: 14px; }

.commercial-records small {
  color: var(--muted);
  font-size: 13px;
}

/* CRM v3.1：精致图标、多主题与系统设置中心。 */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.main-nav svg,
.sidebar-settings svg,
.settings-card svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-nav button i {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.main-nav button i svg {
  width: 18px;
  height: 18px;
}

.main-nav button.active i svg { stroke-width: 2; }

.sidebar-settings {
  display: none;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.sidebar-settings:hover {
  border-color: var(--line);
  background: var(--soft);
}

.sidebar-settings > i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 9px 20px color-mix(in srgb, var(--green) 24%, transparent);
}

.sidebar-settings > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sidebar-settings strong { font-size: 14px; }
.sidebar-settings small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.mobile-settings-only { display: flex; }

body.settings-open { overflow: hidden; }
.settings-panel { position: fixed; z-index: 120; inset: 0; }
.settings-backdrop { position: absolute; inset: 0; background: rgba(18, 23, 31, .55); backdrop-filter: blur(7px); }
.settings-card {
  position: absolute;
  inset: 18px;
  max-width: 960px;
  max-height: calc(100vh - 36px);
  margin: auto;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 30px 100px rgba(26, 28, 33, .24);
  animation: settingsIn .2s ease;
}

@keyframes settingsIn {
  from { opacity: .4; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
}

.settings-header > div { display: grid; gap: 4px; }
.settings-header small { color: var(--blue); font-size: 12px; font-weight: 850; letter-spacing: .14em; }
.settings-header h2 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.settings-header p { margin: 0; color: var(--muted); font-size: 14px; }
.settings-header > button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: var(--soft);
  font-size: 24px;
}

.settings-body {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 16px;
  padding: 20px 26px 28px;
}

.settings-section {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 78%, var(--soft));
}

.settings-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-section-title > i {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  color: var(--blue);
  background: var(--active-soft);
}

.settings-section-title h3 { margin: 0; font-size: 17px; }
.settings-section-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.theme-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.theme-choice {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  transition: .18s ease;
}

.theme-choice:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--blue) 55%, var(--line)); }
.theme-choice.active { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 13%, transparent); }
.theme-choice b { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.theme-choice small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.theme-preview { height: 66px; overflow: hidden; display: grid; grid-template-columns: 28% 1fr 20%; gap: 5px; padding: 7px; border-radius: 10px; }
.theme-preview i { border-radius: 5px; }
.theme-preview i:first-child { grid-row: 1 / 3; }
.theme-preview i:nth-child(2) { height: 17px; }
.theme-preview.warm { background: linear-gradient(145deg, #eef2f8, #f8f8fa); }.theme-preview.warm i { background: rgba(255, 255, 255, .94); box-shadow: 0 2px 8px rgba(50, 60, 75, .1); }.theme-preview.warm i:nth-child(2) { background: #007aff; }
.theme-preview.ocean { background: #eaf2fb; }.theme-preview.ocean i { background: #fbfdff; }.theme-preview.ocean i:nth-child(2) { background: #2d6cdf; }
.theme-preview.jade { background: #e8f1ec; }.theme-preview.jade i { background: #fbfdfb; }.theme-preview.jade i:nth-child(2) { background: #1f8a70; }
.theme-preview.violet { background: #eee8f7; }.theme-preview.violet i { background: #fdfcff; }.theme-preview.violet i:nth-child(2) { background: #7357b6; }
.theme-preview.midnight { background: linear-gradient(145deg, #111a28, #17395a); }.theme-preview.midnight i { background: rgba(35, 51, 70, .96); box-shadow: inset 0 0 0 1px rgba(176, 215, 255, .09); }.theme-preview.midnight i:nth-child(2) { background: #0f6cbd; }

.preference-list { display: grid; gap: 9px; }
.preference-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 13px;
  border-radius: 12px;
  background: var(--soft);
}

.preference-row > div:first-child { display: grid; gap: 3px; }
.preference-row strong { font-size: 14px; }
.preference-row small { color: var(--muted); font-size: 12px; }
.density-choice { display: flex; padding: 3px; border-radius: 9px; background: var(--surface); }
.density-choice button { padding: 7px 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 13px; }
.density-choice button.active { color: #fff; background: var(--blue); }
.switch-input {
  width: 46px;
  height: 26px;
  flex: 0 0 46px;
  appearance: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 30%, var(--surface));
  cursor: pointer;
  transition: .2s ease;
}

.switch-input::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transition: .2s ease;
}

.switch-input:checked { background: var(--blue); }
.switch-input:checked::before { transform: translateX(20px); }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.feature-grid span { padding: 11px 12px; border-radius: 11px; color: var(--ink); background: var(--soft); font-size: 13px; }
.feature-grid span::before { content: "✓"; margin-right: 7px; color: var(--green); font-weight: 900; }
.about-list { display: grid; gap: 0; margin: 0; }
.about-list > div { display: grid; grid-template-columns: 130px 1fr; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.about-list dt { color: var(--muted); font-size: 13px; }
.about-list dd { margin: 0; color: var(--ink); font-size: 13px; }
.about-list code { padding: 4px 7px; border-radius: 6px; color: var(--blue); background: var(--active-soft); font-family: inherit; font-weight: 800; }
.about-list button { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 4px 7px; border: 0; border-radius: 7px; color: var(--blue); background: var(--active-soft); font-size: 12px; }
.about-list button svg { width: 14px; height: 14px; }
.settings-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.settings-footer a,
.settings-footer button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  text-decoration: none;
}

.settings-footer svg { width: 17px; height: 17px; }
.settings-footer .logout-setting { margin-left: auto; color: var(--red); }

/* 主题令牌 */
html[data-theme="warm"] {
  color-scheme: light;
  --bg: #f5f5f7; --surface: #fff; --surface-2: #fff; --soft: #f2f2f7; --ink: #1d1d1f; --muted: #6e6e73;
  --line: rgba(60, 60, 67, .15); --blue: #007aff; --cyan: #64d2ff; --green: #34c759; --red: #ff453a; --orange: #ff9f0a;
  --active-soft: rgba(0, 122, 255, .1); --theme-glow: rgba(0, 122, 255, .1); --hero-start: #1d1d1f; --hero-end: #3a3a3c;
}

html[data-theme="ocean"] {
  color-scheme: light;
  --bg: #eef4fb; --surface: #fbfdff; --surface-2: #fff; --soft: #eef4fa; --ink: #17314d; --muted: #667b92;
  --line: rgba(39, 79, 120, .14); --blue: #2d6cdf; --cyan: #45a1d8; --green: #238b78; --red: #d5525e; --orange: #c08436;
  --active-soft: #e8f0ff; --theme-glow: rgba(45, 108, 223, .1); --hero-start: #183d6d; --hero-end: #285d92;
}

html[data-theme="jade"] {
  color-scheme: light;
  --bg: #edf4f0; --surface: #fbfdfb; --surface-2: #fff; --soft: #eef5f0; --ink: #21362f; --muted: #6c7f77;
  --line: rgba(38, 91, 71, .14); --blue: #1f8a70; --cyan: #67ad8e; --green: #1f8a70; --red: #d35b58; --orange: #bd8338;
  --active-soft: #e3f2eb; --theme-glow: rgba(31, 138, 112, .09); --hero-start: #24483f; --hero-end: #38685b;
}

html[data-theme="violet"] {
  color-scheme: light;
  --bg: #f3eff9; --surface: #fdfcff; --surface-2: #fff; --soft: #f4eff9; --ink: #302942; --muted: #776f89;
  --line: rgba(76, 55, 111, .14); --blue: #7357b6; --cyan: #a079cf; --green: #318d7d; --red: #cf5263; --orange: #bc803b;
  --active-soft: #eee7fa; --theme-glow: rgba(115, 87, 182, .1); --hero-start: #372e54; --hero-end: #5b477a;
}

html[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #111827; --surface: #1b2636; --surface-2: #223044; --soft: #26364b; --ink: #f4f8fd; --muted: #a8b5c7;
  --line: rgba(174, 205, 238, .17); --blue: #0f6cbd; --cyan: #60cdff; --green: #6ccb5f; --red: #ff99a4; --orange: #fce100;
  --active-soft: rgba(96, 205, 255, .13); --theme-glow: rgba(96, 205, 255, .14); --hero-start: #17243a; --hero-end: #0f6cbd;
}

html[data-theme] body {
  color: var(--ink);
  background: radial-gradient(circle at 92% 0, var(--theme-glow), transparent 29%), var(--bg);
}

html[data-theme] .login-screen { background: radial-gradient(circle at 78% 14%, var(--theme-glow), transparent 30%), var(--bg); }
html[data-theme] .sidebar,
html[data-theme] .panel,
html[data-theme] .metric-card,
html[data-theme] .filter-panel,
html[data-theme] .customer-card,
html[data-theme] .opportunity-card,
html[data-theme] .detail-opportunity,
html[data-theme] .contact-card,
html[data-theme] .priority-customer,
html[data-theme] .team-card,
html[data-theme] .task-card,
html[data-theme] .audit-list article,
html[data-theme] .drawer-panel,
html[data-theme] .modal-card,
html[data-theme] .login-card { color: var(--ink); border-color: var(--line); background: var(--surface); }
html[data-theme] .topbar { background: color-mix(in srgb, var(--bg) 91%, transparent); }
html[data-theme] .greeting-card { background: radial-gradient(circle at 88% 0, var(--theme-glow), transparent 36%), linear-gradient(125deg, var(--hero-start), var(--hero-end)); }
html[data-theme] .main-nav button { color: var(--muted); }
html[data-theme] .main-nav button i { color: var(--muted); background: var(--soft); }
html[data-theme] .main-nav button.active { color: var(--blue); background: var(--active-soft); }
html[data-theme] .main-nav button.active i { color: #fff; background: var(--blue); box-shadow: 0 7px 17px color-mix(in srgb, var(--blue) 24%, transparent); }
html[data-theme] .text-button,
html[data-theme] .list-summary button,
html[data-theme] .opportunity-card footer button,
html[data-theme] .detail-opportunity footer button,
html[data-theme] .detail-section-title button,
html[data-theme] .contact-card > button { color: var(--blue); }
html[data-theme] .customer-opportunity,
html[data-theme] .opportunity-values p,
html[data-theme] .portrait-score-grid article,
html[data-theme] .portrait-tags span,
html[data-theme] .inline-hint,
html[data-theme] .modal-details,
html[data-theme] .preference-row,
html[data-theme] .feature-grid span { color: var(--ink); background: var(--soft); }
html[data-theme] .customer-opportunity b,
html[data-theme] .portrait-score-grid strong,
html[data-theme] .panel-heading small,
html[data-theme] .topbar small { color: var(--blue); }
html[data-theme] .edit-card input,
html[data-theme] .edit-card select,
html[data-theme] .edit-card textarea,
html[data-theme] .modal-field input,
html[data-theme] .modal-field select,
html[data-theme] .modal-field textarea,
html[data-theme] .login-card input,
html[data-theme] .search-field,
html[data-theme] .filter-panel select { color: var(--ink); border-color: var(--line); background: var(--soft); }
html[data-theme] select option { color: var(--ink); background: var(--surface); }
html[data-theme] .modal-actions { border-color: var(--line); background: color-mix(in srgb, var(--surface) 95%, transparent); }
html[data-theme] .drawer-more-menu { border-color: var(--line); background: var(--surface); }
html[data-theme] .drawer-more-menu button { color: var(--ink); }
html[data-theme] .commercial-records button { color: var(--ink); border-color: var(--line); background: var(--surface-2); }

html.ui-compact .panel,
html.ui-compact .metric-card,
html.ui-compact .customer-card,
html.ui-compact .opportunity-card,
html.ui-compact .detail-opportunity { padding: 13px; }
html.ui-compact .workspace { padding-bottom: 24px; }
html.ui-compact .customer-card-grid,
html.ui-compact .opportunity-list { gap: 8px; }

html.ui-reduce-motion *,
html.ui-reduce-motion *::before,
html.ui-reduce-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}

@media (min-width: 900px) {
  .sidebar-settings { display: flex; }
  .mobile-settings-only { display: none !important; }
  .sidebar { grid-template-rows: auto 1fr auto; }
}

@media (max-width: 899px) {
  .settings-card { inset: 0; max-height: 100vh; border: 0; border-radius: 0; }
  .settings-header { padding: 18px 17px 15px; }
  .settings-header h2 { font-size: 22px; }
  .settings-body { padding: 14px 14px 22px; }
  .settings-section { padding: 15px; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .settings-footer { flex-wrap: wrap; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .settings-footer .logout-setting { margin-left: 0; }
}

@media (max-width: 520px) {
  .theme-grid { grid-template-columns: 1fr 1fr; }
  .theme-preview { height: 54px; }
  .preference-row { align-items: flex-start; }
  .about-list > div { grid-template-columns: 1fr; gap: 4px; }
  .settings-footer a,
  .settings-footer button { flex: 1 1 calc(50% - 4px); }
  .settings-footer .logout-setting { flex-basis: 100%; }
}

/* CRM v3.1.2：微信 WebView 与窄屏后台专项适配。 */
html {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a,
input,
select,
textarea { touch-action: manipulation; }

.main-nav .mobile-more-button,
.mobile-more-menu { display: none; }

.mobile-more-menu svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 899px) {
  .sidebar {
    height: calc(70px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    overflow: visible;
  }

  .main-nav > .management-only,
  .main-nav > .owner-only { display: none !important; }

  .main-nav button {
    width: 100%;
    min-width: 0;
    height: 55px;
    padding: 3px 2px;
    flex: initial;
  }

  .main-nav button i {
    width: 29px;
    height: 29px;
  }

  .main-nav button i svg {
    width: 17px;
    height: 17px;
  }

  .main-nav button span { font-size: 11px; }
  .main-nav .mobile-more-button { display: grid; }
  .mobile-more-menu {
    position: fixed;
    z-index: 45;
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: min(330px, calc(100vw - 20px));
    max-height: min(480px, calc(100dvh - 110px));
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 17px;
    color: var(--ink);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 22px 70px rgba(26, 28, 33, .25);
    backdrop-filter: blur(22px);
  }

  .mobile-more-menu:not(.hidden) { display: grid; gap: 4px; }
  .mobile-more-menu > button {
    width: 100%;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 0;
    border-radius: 11px;
    color: var(--ink);
    background: transparent;
    text-align: left;
  }

  .mobile-more-menu > button:active { background: var(--soft); }
  .mobile-more-menu > button > i {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: var(--blue);
    background: var(--active-soft);
  }

  .mobile-more-menu > button > span { min-width: 0; display: grid; gap: 2px; }
  .mobile-more-menu b { font-size: 14px; }
  .mobile-more-menu small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

  .workspace {
    width: 100%;
    padding: 0 12px calc(92px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: calc(14px + env(safe-area-inset-top)) 1px 11px;
  }

  .topbar h1 { font-size: 23px; }
  .greeting-card { padding: 18px; border-radius: 16px; }
  .greeting-card h2 { font-size: 20px; }
  .greeting-card p { font-size: 13px; }
  .metric-grid { gap: 8px; margin: 10px 0; }
  .metric-card { min-height: 98px; padding: 13px; border-radius: 14px; }
  .metric-card strong { font-size: 24px; }
  .panel { padding: 14px; border-radius: 15px; }
  .panel-heading { margin-bottom: 13px; }
  .section-toolbar { align-items: flex-start; gap: 10px; }

  .filter-panel { padding: 9px; gap: 7px; }
  .filter-panel input,
  .filter-panel select,
  .edit-card input,
  .edit-card select,
  .edit-card textarea,
  .modal-field input,
  .modal-field select,
  .modal-field textarea,
  .login-card input,
  .settings-card input,
  .settings-card select,
  .settings-card textarea {
    font-size: 16px !important;
  }

  .customer-card,
  .opportunity-card,
  .detail-opportunity { padding: 15px; border-radius: 14px; }
  .customer-drawer,
  .drawer-panel { width: 100%; max-width: 100vw; }
  .drawer-panel { min-height: 100vh; min-height: 100dvh; }
  .detail-tabs button { min-width: 74px; }
  .drawer-actions {
    grid-template-columns: 1.25fr 1fr;
    gap: 7px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  }

  .drawer-actions > button,
  .drawer-actions .drawer-more > button { min-height: 42px; font-size: 13px; }
  .drawer-more { min-height: 42px; }
  .drawer-more-menu { right: 0; width: min(220px, calc(100vw - 20px)); }
  .detail-body { padding-bottom: calc(126px + env(safe-area-inset-bottom)); }

  .settings-card {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
  }

  .settings-header { padding-top: calc(16px + env(safe-area-inset-top)); }
}

@media (max-width: 520px) {
  .workspace { padding-left: 10px; padding-right: 10px; }
  .topbar h1 { font-size: 21px; }
  .topbar small { font-size: 11px; }
  .topbar-actions { gap: 5px; }
  .icon-button { width: 38px; height: 38px; }
  .greeting-card { padding: 16px; }
  .greeting-card h2 { font-size: 18px; }
  .metric-card { min-height: 92px; padding: 12px; }
  .metric-card strong { font-size: 22px; }
  .metric-card > b { width: 29px; height: 29px; }
  .panel { margin-bottom: 10px; padding: 12px; }
  .panel-heading h2 { font-size: 16px; }

  .performance-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 8px 4px;
  }

  .performance-row .person-avatar { grid-column: 1; grid-row: 1; }
  .performance-row > div { grid-column: 2 / 5; grid-row: 1; }
  .performance-row p:nth-of-type(1) { grid-column: 1; grid-row: 2; }
  .performance-row p:nth-of-type(2) { grid-column: 2; grid-row: 2; }
  .performance-row p:nth-of-type(3) { grid-column: 3; grid-row: 2; }
  .performance-row p:nth-of-type(4) { grid-column: 4; grid-row: 2; }

  .commercial-records button { align-items: flex-start; gap: 8px; }
  .settings-body { padding-left: 10px; padding-right: 10px; }
  .settings-section { padding: 13px; }
  .settings-section-title { align-items: flex-start; }
  .theme-choice { padding: 8px; }
  .theme-choice small { font-size: 11px; }
}

@media (max-width: 380px) {
  .filter-panel { grid-template-columns: 1fr; }
  .filter-panel .search-field { grid-column: 1; }
  .theme-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .feature-grid { grid-template-columns: 1fr; }
  .settings-header p { display: none; }
}

html.wechat-webview body { line-height: 1.48; }
html.wechat-webview .workspace { padding-left: 9px; padding-right: 9px; }
html.wechat-webview .topbar { padding-top: calc(11px + env(safe-area-inset-top)); }
html.wechat-webview .greeting-card,
html.wechat-webview .panel,
html.wechat-webview .metric-card { box-shadow: 0 7px 22px rgba(33, 38, 45, .06); }

/* Keep the viewport edge continuous across every selectable theme. */
html[data-theme],
html[data-theme] * {
  scrollbar-color: color-mix(in srgb, var(--muted) 52%, transparent) transparent;
}

html[data-theme]::-webkit-scrollbar-track,
html[data-theme] *::-webkit-scrollbar-track {
  background: transparent;
}

html[data-theme]::-webkit-scrollbar-thumb,
html[data-theme] *::-webkit-scrollbar-thumb {
  border-color: transparent;
  background: color-mix(in srgb, var(--muted) 52%, transparent);
  background-clip: padding-box;
}

@media (min-width: 900px) {
  .workspace {
    max-width: none;
  }

  .topbar {
    margin: 0 -38px 5px;
    padding: 27px 38px 19px;
  }

  .app-view {
    max-width: 1564px;
  }
}

/* CRM v3.1.2 scrolling contract: one vertical scroller per visible layer. */
body.scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.detail-body,
#modalForm,
.settings-content,
.mobile-more-menu {
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* macOS-inspired default: bright materials, restrained contrast and soft depth. */
html[data-theme="warm"] body {
  background:
    radial-gradient(circle at 88% -8%, rgba(10, 132, 255, .12), transparent 31%),
    radial-gradient(circle at 8% 92%, rgba(100, 210, 255, .08), transparent 28%),
    #f5f5f7;
}

html[data-theme="warm"] .login-screen {
  background:
    radial-gradient(circle at 78% 12%, rgba(10, 132, 255, .14), transparent 30%),
    radial-gradient(circle at 18% 88%, rgba(100, 210, 255, .1), transparent 31%),
    #f5f5f7;
}

html[data-theme="warm"] .sidebar {
  border-color: rgba(60, 60, 67, .12);
  background: rgba(255, 255, 255, .82);
  box-shadow: 12px 0 38px rgba(35, 45, 60, .055);
  backdrop-filter: saturate(180%) blur(28px);
}

html[data-theme="warm"] .topbar {
  border-bottom-color: rgba(60, 60, 67, .09);
  background: rgba(245, 245, 247, .78);
  backdrop-filter: saturate(180%) blur(26px);
}

html[data-theme="warm"] .panel,
html[data-theme="warm"] .metric-card,
html[data-theme="warm"] .filter-panel,
html[data-theme="warm"] .customer-card,
html[data-theme="warm"] .opportunity-card,
html[data-theme="warm"] .detail-opportunity,
html[data-theme="warm"] .contact-card,
html[data-theme="warm"] .priority-customer,
html[data-theme="warm"] .team-card,
html[data-theme="warm"] .task-card,
html[data-theme="warm"] .audit-list article,
html[data-theme="warm"] .drawer-panel,
html[data-theme="warm"] .modal-card,
html[data-theme="warm"] .login-card,
html[data-theme="warm"] .settings-card,
html[data-theme="warm"] .theme-choice {
  border-color: rgba(60, 60, 67, .12);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 2px rgba(20, 25, 35, .035), 0 15px 42px rgba(35, 45, 60, .065);
}

html[data-theme="warm"] .drawer-panel,
html[data-theme="warm"] .modal-card,
html[data-theme="warm"] .login-card,
html[data-theme="warm"] .settings-card {
  backdrop-filter: saturate(170%) blur(30px);
}

html[data-theme="warm"] .greeting-card {
  border-color: rgba(255, 255, 255, .15);
  background:
    radial-gradient(circle at 88% 0, rgba(100, 210, 255, .34), transparent 35%),
    linear-gradient(128deg, #1d1d1f 0%, #343438 62%, #0a6ecb 118%);
  box-shadow: 0 18px 45px rgba(25, 32, 45, .18);
}

html[data-theme="warm"] .primary-button {
  border-color: #0071e3;
  background: linear-gradient(180deg, #0a84ff, #0071e3);
  box-shadow: 0 10px 24px rgba(0, 113, 227, .22), inset 0 1px rgba(255, 255, 255, .24);
}

html[data-theme="warm"] .primary-button:hover {
  border-color: #0068d1;
  background: linear-gradient(180deg, #168bff, #006edc);
  box-shadow: 0 13px 28px rgba(0, 113, 227, .27);
}

html[data-theme="warm"] .ai-button {
  border-color: #4e4ac7;
  background: linear-gradient(135deg, #5856d6, #0a84ff);
  box-shadow: 0 10px 24px rgba(74, 79, 196, .22);
}

html[data-theme="warm"] .ghost-button,
html[data-theme="warm"] .icon-button {
  border-color: rgba(60, 60, 67, .14);
  color: #3a3a3c;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 4px 14px rgba(35, 45, 60, .06);
}

/* Microsoft Fluent dark: Mica-like layers, Azure accents and clearer depth. */
html[data-theme="midnight"] body {
  background:
    radial-gradient(circle at 86% -6%, rgba(96, 205, 255, .15), transparent 31%),
    radial-gradient(circle at 10% 100%, rgba(76, 126, 240, .1), transparent 34%),
    #111827;
}

html[data-theme="midnight"] .login-screen {
  background:
    radial-gradient(circle at 78% 10%, rgba(96, 205, 255, .16), transparent 31%),
    radial-gradient(circle at 15% 90%, rgba(72, 126, 231, .13), transparent 34%),
    #111827;
}

html[data-theme="midnight"] .sidebar {
  border-color: rgba(174, 205, 238, .16);
  background: rgba(24, 34, 48, .86);
  box-shadow: 14px 0 44px rgba(0, 0, 0, .2);
  backdrop-filter: saturate(145%) blur(28px);
}

html[data-theme="midnight"] .topbar {
  border-bottom-color: rgba(174, 205, 238, .12);
  background: rgba(17, 24, 39, .8);
  backdrop-filter: saturate(145%) blur(26px);
}

html[data-theme="midnight"] .panel,
html[data-theme="midnight"] .metric-card,
html[data-theme="midnight"] .filter-panel,
html[data-theme="midnight"] .customer-card,
html[data-theme="midnight"] .opportunity-card,
html[data-theme="midnight"] .detail-opportunity,
html[data-theme="midnight"] .contact-card,
html[data-theme="midnight"] .priority-customer,
html[data-theme="midnight"] .team-card,
html[data-theme="midnight"] .task-card,
html[data-theme="midnight"] .audit-list article,
html[data-theme="midnight"] .drawer-panel,
html[data-theme="midnight"] .modal-card,
html[data-theme="midnight"] .login-card,
html[data-theme="midnight"] .settings-card,
html[data-theme="midnight"] .theme-choice {
  border-color: rgba(174, 205, 238, .16);
  background: rgba(27, 38, 54, .88);
  box-shadow: 0 1px rgba(255, 255, 255, .035) inset, 0 16px 44px rgba(0, 0, 0, .2);
}

html[data-theme="midnight"] .drawer-panel,
html[data-theme="midnight"] .modal-card,
html[data-theme="midnight"] .login-card,
html[data-theme="midnight"] .settings-card {
  backdrop-filter: saturate(140%) blur(30px);
}

html[data-theme="midnight"] .greeting-card {
  border-color: rgba(96, 205, 255, .24);
  background:
    radial-gradient(circle at 88% 0, rgba(96, 205, 255, .28), transparent 37%),
    linear-gradient(128deg, #17243a 0%, #173a62 58%, #0f6cbd 100%);
  box-shadow: 0 18px 48px rgba(0, 41, 82, .35);
}

html[data-theme="midnight"] .primary-button {
  border-color: #1786ce;
  background: linear-gradient(180deg, #1686cf, #0f6cbd);
  box-shadow: 0 10px 25px rgba(0, 120, 212, .28), inset 0 1px rgba(255, 255, 255, .16);
}

html[data-theme="midnight"] .primary-button:hover {
  border-color: #2b98dc;
  background: linear-gradient(180deg, #2594dc, #1174c7);
  box-shadow: 0 13px 30px rgba(0, 120, 212, .34);
}

html[data-theme="midnight"] .ai-button {
  border-color: #7657a8;
  background: linear-gradient(135deg, #5c2d91, #0f6cbd);
  box-shadow: 0 10px 26px rgba(36, 89, 151, .3);
}

html[data-theme="midnight"] .ghost-button,
html[data-theme="midnight"] .icon-button {
  border-color: rgba(174, 205, 238, .18);
  color: #d9e7f6;
  background: rgba(35, 50, 69, .9);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .16);
}

html[data-theme="midnight"] .main-nav button.active,
html[data-theme="midnight"] .topbar small,
html[data-theme="midnight"] .panel-heading small,
html[data-theme="midnight"] .text-button,
html[data-theme="midnight"] .list-summary button {
  color: var(--cyan);
}

html[data-theme="midnight"] .main-nav button.active i {
  color: #fff;
  background: linear-gradient(145deg, #198bd0, #0f6cbd);
  box-shadow: 0 8px 20px rgba(0, 120, 212, .3);
}

/* Theme-aware interaction details prevent legacy coral/beige colors from leaking through. */
html[data-theme] button:focus-visible {
  outline-color: color-mix(in srgb, var(--blue) 30%, transparent);
}

html[data-theme] .loading-bar { background: var(--soft); }
html[data-theme] .loading-bar i { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
html[data-theme] .metric-card > b {
  background: var(--blue);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--blue) 22%, transparent);
}
html[data-theme] .metric-card > b[data-color="green"] { background: var(--green); }
html[data-theme] .metric-card > b[data-color="red"] { background: var(--red); }
html[data-theme] .metric-card > b[data-color="orange"] { background: var(--orange); }
html[data-theme] .bar-row > i,
html[data-theme] .portrait-grid article div > i { background: var(--soft); }
html[data-theme] .bar-row > i b,
html[data-theme] .portrait-grid article div > i b { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
html[data-theme] .search-field span { color: var(--blue); }

@media (hover: hover) {
  html[data-theme] .customer-card:hover,
  html[data-theme] .task-card:hover,
  html[data-theme] .team-card:hover,
  html[data-theme] .audit-list article:hover {
    border-color: color-mix(in srgb, var(--blue) 32%, var(--line));
    box-shadow: 0 22px 48px color-mix(in srgb, var(--ink) 10%, transparent);
  }
}

html[data-theme] .audit-list article > span {
  color: var(--blue);
  background: var(--active-soft);
}
html[data-theme] .drawer-header,
html[data-theme] .detail-quick-stats,
html[data-theme] .detail-tabs,
html[data-theme] .drawer-actions,
html[data-theme] .modal-card > header,
html[data-theme] .modal-actions {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}
html[data-theme] .drawer-header small,
html[data-theme] .modal-card header small,
html[data-theme] .timeline article header span { color: var(--blue); }
html[data-theme] .drawer-header button,
html[data-theme] .modal-card header button { color: var(--muted); background: var(--soft); }
html[data-theme] .detail-tabs button { color: var(--muted); }
html[data-theme] .detail-tabs button.active { color: var(--blue); }
html[data-theme] .detail-tabs button.active::after { background: var(--blue); }
html[data-theme] .detail-body { background: color-mix(in srgb, var(--bg) 94%, var(--surface)); }
html[data-theme] .timeline::before { background: var(--line); }
html[data-theme] .timeline > article > i {
  border-color: var(--surface);
  background: var(--blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 28%, transparent);
}
html[data-theme] .opportunity-card header > span,
html[data-theme] .detail-opportunity header > span { color: var(--blue); background: var(--active-soft); }
html[data-theme] .opportunity-card footer { border-color: var(--line); }
html[data-theme] .opportunity-next { color: var(--muted); }
html[data-theme] .portrait-score { background: linear-gradient(135deg, var(--blue), var(--cyan)); }
html[data-theme] .priority-customer,
html[data-theme] .source-performance article { border-color: var(--line); }
html[data-theme] .risk-list { color: var(--red); }
html[data-theme] .next-action-card { border-left-color: var(--green); }
html[data-theme] .next-action-card small { color: var(--green); }

html[data-theme="warm"] .sidebar-settings > i {
  background: linear-gradient(145deg, #a1a1a6, #636366);
  box-shadow: 0 9px 20px rgba(60, 60, 67, .2);
}

html[data-theme="midnight"] .sidebar-settings > i {
  background: linear-gradient(145deg, #198bd0, #0f6cbd);
  box-shadow: 0 9px 22px rgba(0, 120, 212, .3);
}

html[data-theme="warm"] .login-card input:focus,
html[data-theme="warm"] .edit-card input:focus,
html[data-theme="warm"] .edit-card select:focus,
html[data-theme="warm"] .edit-card textarea:focus,
html[data-theme="warm"] .modal-field input:focus,
html[data-theme="warm"] .modal-field select:focus,
html[data-theme="warm"] .modal-field textarea:focus {
  border-color: #0a84ff;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, .12);
}

html[data-theme="midnight"] .login-card input:focus,
html[data-theme="midnight"] .edit-card input:focus,
html[data-theme="midnight"] .edit-card select:focus,
html[data-theme="midnight"] .edit-card textarea:focus,
html[data-theme="midnight"] .modal-field input:focus,
html[data-theme="midnight"] .modal-field select:focus,
html[data-theme="midnight"] .modal-field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(96, 205, 255, .12);
}

/* Desktop fixed navigation contract: the page content scrolls below persistent chrome. */
@media (min-width: 900px) {
  :root {
    --desktop-sidebar-width: 250px;
    --desktop-topbar-offset: 119px;
  }

  .crm-app {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: var(--desktop-sidebar-width);
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  .workspace {
    width: calc(100% - var(--desktop-sidebar-width));
    min-height: 100vh;
    margin-left: var(--desktop-sidebar-width);
    padding: var(--desktop-topbar-offset) 38px 50px;
  }

  .topbar {
    position: fixed;
    z-index: 35;
    top: 0;
    right: 0;
    left: var(--desktop-sidebar-width);
    margin: 0;
    padding: 27px 38px 19px;
  }
}

/* 单公司白标：组织品牌设置与长名称适配。 */
.login-brand div,
.sidebar-brand div { min-width: 0; }
.login-brand strong,
.sidebar-brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-card::before { background: linear-gradient(90deg, var(--brand-primary, var(--blue)), var(--brand-accent, var(--cyan))); }
.organization-settings { border-top: 3px solid var(--brand-primary, var(--blue)); }
.brand-settings-form { display: grid; gap: 18px; }
.brand-logo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brand-logo-editor { min-width: 0; display: grid; grid-template-columns: 94px 1fr; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.brand-logo-preview { width: 94px; height: 94px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.brand-logo-preview.dark { background: #121a27; }
.brand-logo-preview img { width: 76px; height: 76px; object-fit: contain; }
.brand-logo-editor > div:last-child { min-width: 0; display: grid; gap: 7px; }
.brand-logo-editor strong { font-size: 14px; }
.brand-logo-editor small { color: var(--muted); font-size: 13px; line-height: 1.6; }
.brand-logo-editor input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.brand-asset-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.brand-asset-actions label,
.brand-asset-actions button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--blue); background: var(--soft); font-size: 13px; font-weight: 800; cursor: pointer; }
.brand-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.brand-form-grid > label { min-width: 0; display: grid; align-content: start; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.brand-form-grid > label.full-row { grid-column: 1 / -1; }
.brand-form-grid input,
.brand-form-grid textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: var(--surface); }
.brand-form-grid input[type="color"] { height: 43px; padding: 5px; cursor: pointer; }
.brand-form-grid textarea { min-height: 86px; resize: vertical; line-height: 1.55; }
.brand-form-grid input:focus,
.brand-form-grid textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent); }
.brand-save-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 2px; }
.brand-save-row span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.brand-save-row button { min-width: 150px; }

@media (max-width: 760px) {
  .brand-logo-grid,
  .brand-form-grid { grid-template-columns: 1fr; }
  .brand-form-grid > label.full-row { grid-column: auto; }
  .brand-logo-editor { grid-template-columns: 76px 1fr; padding: 11px; }
  .brand-logo-preview { width: 76px; height: 76px; border-radius: 15px; }
  .brand-logo-preview img { width: 62px; height: 62px; }
  .brand-save-row { align-items: stretch; flex-direction: column; }
  .brand-save-row button { width: 100%; }
}

/* 设置中心：左侧分类导航，右侧内容管理。 */
.settings-body {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 0;
  padding: 0;
}
.settings-nav {
  min-width: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px 13px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 82%, var(--surface));
  overscroll-behavior: contain;
}
.settings-nav button {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.settings-nav button > svg { width: 20px; height: 20px; padding: 6px; box-sizing: content-box; border-radius: 9px; stroke: currentColor; fill: none; stroke-width: 1.8; background: color-mix(in srgb, var(--surface) 75%, transparent); }
.settings-nav button > span { min-width: 0; display: grid; gap: 2px; }
.settings-nav button b { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.settings-nav button small { overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.settings-nav button:hover { border-color: color-mix(in srgb, var(--blue) 20%, var(--line)); background: color-mix(in srgb, var(--surface) 72%, var(--soft)); }
.settings-nav button.active { border-color: color-mix(in srgb, var(--blue) 30%, var(--line)); color: #fff; background: var(--active-soft); box-shadow: 0 8px 20px color-mix(in srgb, var(--blue) 9%, transparent); }
.settings-nav button.active > svg { color: #fff; background: var(--blue); box-shadow: 0 7px 16px color-mix(in srgb, var(--blue) 22%, transparent); }
.settings-content { min-width: 0; min-height: 0; overflow-y: auto; padding: 20px 24px 28px; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.settings-view { display: none; }
.settings-view.active { display: block; }
.settings-content .settings-section { min-height: 100%; }

@media (max-width: 700px) {
  .settings-body { grid-template-columns: 108px minmax(0, 1fr); }
  .settings-nav { gap: 5px; padding: 10px 7px; }
  .settings-nav button { grid-template-columns: 1fr; justify-items: center; gap: 5px; padding: 9px 5px; text-align: center; }
  .settings-nav button > span { width: 100%; }
  .settings-nav button b { font-size: 12px; }
  .settings-nav button small { display: none; }
  .settings-content { padding: 12px 10px 20px; }
  .settings-content .settings-section { padding: 13px; }
  .settings-section-title > i { width: 34px; height: 34px; }
  .settings-section-title h3 { font-size: 15px; }
  .settings-section-title p { font-size: 13px; line-height: 1.5; }
}

@media (max-width: 390px) {
  .settings-body { grid-template-columns: 92px minmax(0, 1fr); }
  .settings-nav button b { font-size: 12px; }
  .settings-content { padding-left: 8px; padding-right: 8px; }
  .brand-logo-editor { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .brand-asset-actions { justify-content: center; }
}

/* 日志与 AI 洞察：可信追溯、风险复核和可解释报告。 */
.audit-workspace { --audit-critical: #b42318; --audit-high: #d92d20; --audit-medium: #f79009; }
.audit-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  border-radius: 22px;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 10%, color-mix(in srgb, var(--cyan) 18%, transparent), transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 96%, var(--blue)), color-mix(in srgb, var(--soft) 92%, var(--cyan)));
  box-shadow: var(--shadow);
}
.audit-hero::after { content: ""; position: absolute; top: -54px; right: 70px; width: 150px; height: 150px; border: 1px solid color-mix(in srgb, var(--blue) 18%, transparent); border-radius: 50%; pointer-events: none; }
.audit-hero > div { position: relative; z-index: 1; min-width: 0; }
.audit-hero small { display: block; margin-bottom: 8px; color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .14em; }
.audit-hero h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; }
.audit-hero p { max-width: 680px; margin: 9px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.audit-hero-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.audit-hero-actions button { min-height: 42px; white-space: nowrap; }
.audit-hero-actions svg { width: 17px; height: 17px; margin-right: 7px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.audit-tabs { display: flex; gap: 4px; margin: 18px 0; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 4%, transparent); }
.audit-tabs button { min-height: 43px; display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 850; line-height: 1.35; cursor: pointer; }
.audit-tabs button:hover { color: var(--ink); background: var(--soft); }
.audit-tabs button.active { color: #fff; background: linear-gradient(135deg, var(--blue), color-mix(in srgb, var(--blue) 72%, var(--cyan))); box-shadow: 0 8px 18px color-mix(in srgb, var(--blue) 25%, transparent); }
.audit-tabs button i { min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; color: var(--red); background: color-mix(in srgb, var(--red) 11%, var(--surface)); font-size: 12px; font-style: normal; }
.audit-tabs button.active i { color: #fff; background: rgba(255, 255, 255, .22); }
.audit-panel { display: none; }
.audit-panel.active { display: block; animation: auditPanelIn .2s ease; }
@keyframes auditPanelIn { from { opacity: 0; transform: translateY(4px); } }

.audit-metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.audit-metric-grid article { position: relative; overflow: hidden; min-width: 0; display: grid; gap: 4px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 9px 26px color-mix(in srgb, var(--ink) 4%, transparent); }
.audit-metric-grid article::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 3px; background: var(--blue); }
.audit-metric-grid article[data-tone="green"]::before { background: var(--green); }
.audit-metric-grid article[data-tone="cyan"]::before { background: var(--cyan); }
.audit-metric-grid article[data-tone="orange"]::before { background: #f79009; }
.audit-metric-grid article[data-tone="red"]::before { background: var(--red); }
.audit-metric-grid article[data-tone="violet"]::before { background: #7f56d9; }
.audit-metric-grid span { overflow: hidden; color: var(--muted); font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.audit-metric-grid strong { margin-top: 3px; font-size: 27px; line-height: 1; letter-spacing: -.04em; }
.audit-metric-grid small { overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }

.audit-overview-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 14px; margin-top: 14px; }
.audit-surface { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 4%, transparent); }
.audit-surface > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.audit-surface > header small { color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.audit-surface > header h3 { margin: 4px 0 0; font-size: 17px; }
.audit-surface > header button { min-height: 34px; border: 0; color: var(--blue); background: transparent; font-size: 13px; font-weight: 800; cursor: pointer; }
.audit-risk-preview { display: grid; gap: 8px; }
.audit-risk-preview > button { width: 100%; min-width: 0; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-align: left; background: var(--soft); cursor: pointer; }
.audit-risk-preview > button:hover { border-color: color-mix(in srgb, var(--blue) 32%, var(--line)); transform: translateY(-1px); }
.audit-risk-preview > button > i { width: 7px; height: 34px; border-radius: 999px; background: var(--audit-medium); }
.audit-risk-preview > button > i[data-severity="high"], .audit-risk-preview > button > i[data-severity="critical"] { background: var(--audit-high); }
.audit-risk-preview span { min-width: 0; display: grid; gap: 3px; }
.audit-risk-preview strong, .audit-risk-preview small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-risk-preview strong { font-size: 14px; line-height: 1.45; }
.audit-risk-preview small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.audit-risk-preview b { color: var(--red); font-size: 12px; }
.audit-report-summary { display: grid; gap: 8px; }
.audit-report-summary > span { width: fit-content; padding: 5px 9px; border-radius: 999px; color: var(--blue); background: var(--active-soft); font-size: 12px; font-weight: 850; }
.audit-report-summary h4 { margin: 0; font-size: 17px; line-height: 1.45; }
.audit-report-summary p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.audit-report-summary > div { display: grid; gap: 6px; }
.audit-report-summary > div i { padding-left: 13px; color: var(--ink); font-size: 13px; font-style: normal; line-height: 1.6; }
.audit-report-summary > div i::before { content: ""; width: 5px; height: 5px; display: inline-block; margin: 0 7px 1px -12px; border-radius: 50%; background: var(--green); }
.audit-report-summary > small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.audit-integrity { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, var(--green)); }
.audit-integrity > i { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--green); font-style: normal; font-weight: 900; }
.audit-integrity > i.warning { background: var(--red); }
.audit-integrity > div { min-width: 0; display: grid; gap: 3px; }
.audit-integrity strong { font-size: 14px; }
.audit-integrity span { color: var(--muted); font-size: 12px; line-height: 1.55; }

.audit-filter-panel { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)) minmax(190px, 1.5fr) auto; gap: 10px; align-items: end; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.audit-filter-panel label { min-width: 0; display: grid; gap: 7px; }
.audit-filter-panel label > span { color: var(--muted); font-size: 12px; line-height: 1.25; font-weight: 800; }
.audit-filter-panel input, .audit-filter-panel select { width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: var(--soft); font-size: 14px; font-weight: 600; }
.audit-filter-panel input:focus, .audit-filter-panel select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 10%, transparent); }
.audit-filter-panel > button { height: 44px; padding: 0 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--blue); background: var(--soft); font-size: 13px; font-weight: 850; white-space: nowrap; cursor: pointer; }
.audit-list-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 3px 9px; }
.audit-list-summary span { font-size: 14px; font-weight: 850; }
.audit-list-summary small { color: var(--muted); font-size: 12px; }
.audit-list { display: grid; gap: 8px; }
.audit-event { overflow: hidden; border: 1px solid var(--line); border-left: 3px solid color-mix(in srgb, var(--blue) 45%, var(--line)); border-radius: 14px; background: var(--surface); box-shadow: 0 7px 22px color-mix(in srgb, var(--ink) 3%, transparent); }
.audit-event[data-severity="high"], .audit-event[data-severity="critical"] { border-left-color: var(--audit-high); }
.audit-event[data-severity="medium"] { border-left-color: var(--audit-medium); }
.audit-event > summary { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 22px; align-items: center; gap: 11px; padding: 13px 14px; list-style: none; cursor: pointer; }
.audit-event > summary::-webkit-details-marker { display: none; }
.audit-event[open] > summary { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--soft) 72%, var(--surface)); }
.audit-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--blue); background: var(--active-soft); font-size: 12px; font-weight: 900; }
.audit-event-main { min-width: 0; display: grid; gap: 3px; }
.audit-event-main > div { min-width: 0; display: flex; align-items: center; gap: 6px; }
.audit-event-main strong { overflow: hidden; font-size: 14px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.audit-event-main i { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: var(--soft); font-size: 12px; font-style: normal; font-weight: 800; }
.audit-event-main i[data-outcome="failed"], .audit-event-main i[data-outcome="denied"] { color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--surface)); }
.audit-event-main i[data-outcome="success"] { color: var(--green); background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.audit-event-main i[data-severity="high"], .audit-event-main i[data-severity="critical"] { color: var(--red); }
.audit-event-main i[data-severity="medium"] { color: #b54708; }
.audit-event-main p, .audit-event-main small { overflow: hidden; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.audit-event > summary time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.audit-expand { color: var(--muted); font-size: 14px; transition: transform .2s ease; }
.audit-event[open] .audit-expand { transform: rotate(180deg); }
.audit-event-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .55fr); gap: 13px; padding: 14px; }
.audit-event-detail section { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.audit-event-detail h4 { margin: 0 0 9px; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.audit-change { grid-column: 1 / -1; }
.audit-change-table { display: grid; grid-template-columns: minmax(100px, .6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.audit-change-table > * { min-width: 0; padding: 9px; overflow-wrap: anywhere; background: var(--surface); font-size: 12px; line-height: 1.5; }
.audit-change-table b { color: var(--muted); }
.audit-extra dl { display: grid; gap: 7px; margin: 0; }
.audit-extra dl div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 9px; }
.audit-extra dt { color: var(--muted); font-size: 12px; }
.audit-extra dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.audit-trace > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.audit-trace span { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.audit-trace code { color: var(--ink); font-family: inherit; }
.audit-trace button { min-height: 34px; margin-top: 10px; padding: 7px 10px; border: 0; border-radius: 7px; color: var(--blue); background: var(--active-soft); font-size: 12px; font-weight: 800; cursor: pointer; }

.audit-risk-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.audit-risk-toolbar h3 { margin: 0; font-size: 18px; }
.audit-risk-toolbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.audit-risk-toolbar > div:last-child { display: flex; gap: 8px; }
.audit-risk-toolbar select { min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--soft); font-size: 14px; }
.audit-risk-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.audit-risk-card { min-width: 0; display: grid; align-content: start; gap: 10px; padding: 17px; border: 1px solid var(--line); border-top: 3px solid var(--audit-medium); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 25px color-mix(in srgb, var(--ink) 4%, transparent); }
.audit-risk-card[data-severity="high"], .audit-risk-card[data-severity="critical"] { border-top-color: var(--audit-high); }
.audit-risk-card[data-status="resolved"], .audit-risk-card[data-status="false_positive"] { opacity: .72; border-top-color: var(--green); }
.audit-risk-card > header { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.audit-risk-card > header > div { display: flex; flex-wrap: wrap; gap: 5px; }
.audit-risk-card > header span, .audit-risk-card > header i { padding: 4px 8px; border-radius: 999px; color: var(--blue); background: var(--active-soft); font-size: 12px; font-style: normal; font-weight: 800; }
.audit-risk-card > header i { color: #b54708; background: color-mix(in srgb, var(--audit-medium) 11%, var(--surface)); }
.audit-risk-card > header i[data-status="resolved"], .audit-risk-card > header i[data-status="false_positive"] { color: var(--green); background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.audit-risk-card time { color: var(--muted); font-size: 12px; }
.audit-risk-card h3 { margin: 0; font-size: 15px; }
.audit-risk-card > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.audit-risk-card > section { display: grid; gap: 4px; padding: 10px 11px; border-radius: 10px; background: var(--soft); }
.audit-risk-card > section strong { color: var(--green); font-size: 13px; }
.audit-risk-card > section span { font-size: 13px; line-height: 1.6; }
.audit-risk-card details { border-top: 1px solid var(--line); padding-top: 9px; }
.audit-risk-card details summary { color: var(--blue); font-size: 12px; font-weight: 800; cursor: pointer; }
.audit-risk-card ul { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.audit-risk-card li { display: grid; grid-template-columns: minmax(120px, .6fr) minmax(0, 1fr); gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.audit-risk-card li code { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.audit-risk-card > footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-top: 4px; }
.audit-risk-card > footer > div { min-width: 0; display: grid; gap: 3px; }
.audit-risk-card > footer span, .audit-risk-card > footer small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.audit-risk-card > footer small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-risk-card > footer button { flex: 0 0 auto; min-height: 36px; padding: 0 11px; border: 1px solid color-mix(in srgb, var(--blue) 26%, var(--line)); border-radius: 8px; color: var(--blue); background: var(--active-soft); font-size: 13px; font-weight: 850; cursor: pointer; }

.audit-ai-boundary { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--blue) 20%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--active-soft) 58%, var(--surface)); }
.audit-ai-boundary svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--blue); stroke: currentColor; fill: none; stroke-width: 1.8; }
.audit-ai-boundary strong { font-size: 14px; }
.audit-ai-boundary p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.audit-report-list { display: grid; gap: 10px; }
.audit-report-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 26px color-mix(in srgb, var(--ink) 4%, transparent); }
.audit-report-card > summary { display: grid; grid-template-columns: 42px minmax(0, 1fr) 22px; align-items: center; gap: 12px; padding: 15px 17px; list-style: none; cursor: pointer; }
.audit-report-card > summary::-webkit-details-marker { display: none; }
.audit-report-card[open] > summary { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--soft) 70%, var(--surface)); }
.audit-report-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--blue), #7f56d9); box-shadow: 0 8px 18px color-mix(in srgb, var(--blue) 24%, transparent); }
.audit-report-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.audit-report-card > summary div { min-width: 0; }
.audit-report-card > summary small { color: var(--blue); font-size: 12px; font-weight: 850; }
.audit-report-card > summary h3 { margin: 4px 0; overflow: hidden; font-size: 15px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.audit-report-card > summary p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.audit-report-card > summary > b { color: var(--muted); transition: transform .2s ease; }
.audit-report-card[open] > summary > b { transform: rotate(180deg); }
.audit-report-body { display: grid; gap: 14px; padding: 18px; }
.audit-executive { margin: 0; color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1.75; }
.audit-report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.audit-report-metrics span { display: flex; align-items: baseline; gap: 5px; padding: 11px; border-radius: 10px; color: var(--muted); background: var(--soft); font-size: 12px; }
.audit-report-metrics b { color: var(--ink); font-size: 18px; }
.audit-report-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.audit-report-columns section { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.audit-report-columns h4 { margin: 0 0 8px; font-size: 14px; }
.audit-report-columns ul { display: grid; gap: 6px; margin: 0; padding-left: 16px; }
.audit-report-columns li, .audit-report-columns p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.audit-report-body > footer { display: flex; flex-wrap: wrap; gap: 8px 15px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }

html.ui-compact .audit-metric-grid article { padding: 13px; }
html.ui-compact .audit-event > summary { padding-top: 9px; padding-bottom: 9px; }
html.ui-reduce-motion .audit-panel.active { animation: none; }

@media (max-width: 1450px) and (min-width: 900px) {
  .audit-filter-panel { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .audit-filter-panel .audit-keyword { grid-column: span 2; }
}

@media (max-width: 1240px) {
  .audit-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-filter-panel { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .audit-filter-panel .audit-keyword { grid-column: span 2; }
}

@media (max-width: 899px) {
  .audit-workspace { padding-bottom: 20px; }
  .audit-hero { align-items: stretch; flex-direction: column; padding: 19px; border-radius: 18px; }
  .audit-hero p { font-size: 14px; }
  .audit-hero-actions { width: 100%; }
  .audit-hero-actions button { flex: 1 1 0; min-width: 0; padding-right: 10px; padding-left: 10px; }
  .audit-tabs { position: sticky; z-index: 18; top: calc(58px + env(safe-area-inset-top)); overflow-x: auto; margin: 12px 0; padding: 4px; scrollbar-width: none; }
  .audit-tabs::-webkit-scrollbar { display: none; }
  .audit-tabs button { min-width: 0; min-height: 48px; flex: 1 1 0; padding-right: 4px; padding-left: 4px; font-size: 12px; line-height: 1.3; white-space: normal; }
  .audit-overview-grid { grid-template-columns: 1fr; }
  .audit-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 11px; }
  .audit-filter-panel .audit-keyword { grid-column: 1 / -1; }
  .audit-filter-panel > button { grid-column: 1 / -1; }
  .audit-filter-panel input, .audit-filter-panel select, .audit-risk-toolbar select { font-size: 16px !important; }
  .audit-event-detail { grid-template-columns: 1fr; }
  .audit-risk-list { grid-template-columns: 1fr; }
  .audit-report-columns { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .audit-hero { padding: 16px; }
  .audit-hero h2 { font-size: 23px; }
  .audit-hero-actions { display: grid; grid-template-columns: 1fr 1.2fr; }
  .audit-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .audit-metric-grid article { padding: 14px; }
  .audit-surface { padding: 15px; }
  .audit-event > summary { grid-template-columns: 34px minmax(0, 1fr) 18px; gap: 8px; padding: 11px; }
  .audit-avatar { width: 34px; height: 34px; }
  .audit-event > summary time { grid-column: 2; }
  .audit-event > summary .audit-expand { grid-column: 3; grid-row: 1 / span 2; }
  .audit-event-main > div { flex-wrap: wrap; }
  .audit-event-main strong { flex: 1 1 100%; }
  .audit-change-table { grid-template-columns: minmax(72px, .55fr) minmax(0, 1fr) minmax(0, 1fr); }
  .audit-change-table > * { padding: 7px; font-size: 12px; }
  .audit-extra dl div { grid-template-columns: 78px minmax(0, 1fr); }
  .audit-trace > div { grid-template-columns: 1fr; }
  .audit-risk-toolbar { align-items: stretch; flex-direction: column; padding: 14px; }
  .audit-risk-toolbar > div:last-child { display: grid; grid-template-columns: 1fr 1fr; }
  .audit-risk-card { padding: 14px; }
  .audit-risk-card > footer { align-items: stretch; flex-direction: column; }
  .audit-risk-card > footer button { width: 100%; }
  .audit-report-card > summary { grid-template-columns: 38px minmax(0, 1fr) 18px; padding: 13px; }
  .audit-report-icon { width: 38px; height: 38px; }
  .audit-report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-report-body { padding: 14px; }
}

@media (max-width: 360px) {
  body { min-width: 0; }
  .audit-hero-actions { grid-template-columns: 1fr 1.15fr; }
  .audit-tabs button { padding-right: 2px; padding-left: 2px; font-size: 12px; }
}

html.wechat-webview .audit-hero { padding-top: 14px; }
html.wechat-webview .audit-tabs { top: calc(52px + env(safe-area-inset-top)); }
html.wechat-webview .audit-metric-grid strong { font-size: 24px; }
