:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6f7888;
  --line: #dfe4e9;
  --nav: #111a28;
  --nav-muted: #9da8b8;
  --gold: #b48836;
  --blue: #34658c;
  --green: #2f755a;
  --red: #a84d50;
  --orange: #b46d33;
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px 20px; background: var(--nav); color: #fff; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.65); color: #fff; font-family: Georgia, serif; font-size: 17px; }
.brand-mark.large { width: 58px; height: 58px; font-size: 21px; margin-bottom: 40px; }
.brand strong, .brand small, .sidebar-user strong, .sidebar-user small { display: block; }
.brand strong { font-size: 15px; font-weight: 600; }
.brand small { margin-top: 4px; color: var(--nav-muted); font-size: 11px; }
.main-nav { display: grid; gap: 6px; margin-top: 30px; }
.main-nav a { min-height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 14px; color: var(--nav-muted); border-left: 2px solid transparent; transition: color .15s, background .15s; }
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.main-nav a.active { color: #fff; border-left-color: var(--gold); background: rgba(255,255,255,.08); }
.nav-index { color: #718096; font-family: Georgia, serif; font-size: 11px; }
.main-nav a.active .nav-index { color: #d7b66f; }
.sidebar-links { display: grid; gap: 12px; margin-top: auto; padding: 22px 12px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-links a { color: var(--nav-muted); font-size: 12px; }
.sidebar-links a:hover { color: #fff; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 16px 8px 2px; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; background: #d7b66f; color: #111a28; font-weight: 700; border-radius: 50%; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user small { margin-top: 3px; color: var(--nav-muted); font-size: 10px; }

.main-content { min-width: 0; }
.topbar { height: 68px; padding: 0 34px; display: flex; align-items: center; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); position: sticky; top: 0; z-index: 20; }
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar form { margin-left: auto; }
.text-button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px; }
.text-button:hover { color: var(--ink); }
.icon-button { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; border-radius: 4px; }
.menu-button { display: none; margin-right: 12px; font-size: 20px; }
.page-content { max-width: 1600px; margin: 0 auto; padding: 34px; }

.message-stack { position: fixed; right: 28px; top: 82px; z-index: 60; display: grid; gap: 8px; }
.message { min-width: 280px; max-width: 440px; padding: 13px 16px; color: #fff; background: var(--blue); border-radius: 5px; box-shadow: 0 8px 28px rgba(23,32,51,.15); }
.message.success { background: var(--green); }
.message.error { background: var(--red); }

.page-heading, .detail-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.page-heading h1, .detail-heading h1 { margin: 7px 0 8px; font-size: 30px; line-height: 1.2; letter-spacing: 0; }
.page-heading p, .detail-heading p { margin: 0; color: var(--muted); line-height: 1.7; }
.compact-heading { align-items: center; }
.eyebrow { margin: 0; color: var(--gold) !important; font-family: Arial, sans-serif; font-size: 10px !important; font-weight: 700; letter-spacing: 1.4px !important; }
.heading-actions { display: flex; gap: 10px; }
.button { min-height: 40px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 5px; font-weight: 600; font-size: 13px; cursor: pointer; }
.button.primary { color: #fff; background: var(--ink); border-color: var(--ink); }
.button.primary:hover { background: #27334a; }
.button.secondary { color: var(--ink); background: #fff; border-color: #cfd6de; }
.button.secondary:hover { border-color: var(--ink); }
.button.full { width: 100%; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.metric { min-height: 128px; padding: 24px; border-right: 1px solid var(--line); position: relative; }
.metric:last-child { border-right: 0; }
.metric::before { content: ""; position: absolute; left: 24px; top: 0; width: 34px; height: 3px; background: var(--ink); }
.metric.blue::before { background: var(--blue); }.metric.gold::before { background: var(--gold); }.metric.green::before { background: var(--green); }.metric.red::before { background: var(--red); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 12px 0 8px; font-family: Georgia, serif; font-size: 31px; font-weight: 500; }
.metric small { font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); gap: 24px; margin-bottom: 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-heading { min-height: 76px; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 5px 0 0; font-size: 17px; }
.panel-heading > a, .panel-heading > span { color: var(--blue); font-size: 12px; }
.stage-table { padding: 6px 22px 16px; }
.stage-row { min-height: 50px; display: grid; grid-template-columns: 12px 1fr 80px 110px; align-items: center; gap: 12px; border-bottom: 1px solid #eef1f4; font-size: 13px; }
.stage-row:last-child { border-bottom: 0; }
.stage-row:hover strong { color: var(--blue); }
.stage-row span:nth-last-child(-n+2) { color: var(--muted); text-align: right; }
.status-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: #8791a0; }
.status-dot.status-new { background: var(--blue); }.status-dot.status-contacted { background: #6e70a7; }.status-dot.status-qualified { background: var(--gold); }.status-dot.status-proposal { background: var(--orange); }.status-dot.status-won { background: var(--green); }.status-dot.status-lost { background: var(--red); }
.compact-list { padding: 4px 22px 16px; }
.compact-item { min-height: 66px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid #eef1f4; }
.compact-item:last-child { border-bottom: 0; }
.date-box { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-content: center; text-align: center; background: #eef3f7; color: var(--blue); border-radius: 5px; }
.date-box.overdue { color: var(--red); background: #f8eeee; }
.date-box strong, .date-box small { display: block; line-height: 1.1; }.date-box strong { font-size: 15px; }.date-box small { margin-top: 2px; font-size: 9px; }
.compact-copy { min-width: 0; flex: 1; }.compact-copy strong, .compact-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }.compact-copy strong { font-size: 13px; }.compact-copy small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.recent-panel { margin-bottom: 20px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 12px; }
th { padding: 13px 18px; text-align: left; color: var(--muted); background: #f8f9fa; border-bottom: 1px solid var(--line); font-weight: 500; white-space: nowrap; }
td { padding: 15px 18px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td small, .table-primary { display: block; }
td small { margin-top: 5px; color: var(--muted); }
.table-primary { color: var(--ink); font-weight: 600; }
.table-primary:hover { color: var(--blue); }
.empty-cell { padding: 40px; text-align: center; color: var(--muted); }

.badge { min-height: 24px; padding: 4px 8px; display: inline-flex; align-items: center; border-radius: 4px; font-size: 10px; font-weight: 600; line-height: 1.2; white-space: nowrap; background: #edf0f3; color: #4e5968; }
.badge.status-new { color: #245a82; background: #e8f1f7; }.badge.status-contacted { color: #555787; background: #ededf6; }.badge.status-qualified { color: #7b5a1c; background: #f7f0df; }.badge.status-proposal { color: #874d24; background: #f7ece4; }.badge.status-won { color: #216247; background: #e6f2ec; }.badge.status-lost { color: #8c3f42; background: #f6e8e9; }
.badge.priority-low { color: #66717e; background: #eef1f3; }.badge.priority-medium { color: #295d83; background: #e8f1f7; }.badge.priority-high { color: #8a5725; background: #f6ecdf; }.badge.priority-urgent { color: #8d383d; background: #f7e7e8; }
.overdue-text { color: var(--red) !important; font-weight: 600; }.muted { color: var(--muted); }

.filter-bar { padding: 16px; display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(130px, .7fr)) auto auto; gap: 10px; align-items: end; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.filter-bar label, .form-field label, .login-form label { display: block; margin-bottom: 7px; color: #4e5968; font-size: 11px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #cfd6de; border-radius: 5px; color: var(--ink); background: #fff; outline: none; }
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(52,101,140,.1); }
.filter-submit { height: 40px; }
.clear-filter { height: 40px; padding: 0 8px; display: flex; align-items: center; color: var(--muted); font-size: 12px; }
.table-panel { overflow: hidden; }
.list-summary { padding: 16px 18px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.list-summary strong { color: var(--ink); }
.row-action { color: var(--blue); font-weight: 600; }
.pagination { min-height: 58px; padding: 10px 18px; display: flex; justify-content: flex-end; align-items: center; gap: 16px; border-top: 1px solid var(--line); font-size: 12px; }
.pagination a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; }
.pagination span { color: var(--muted); }
.empty-state { min-height: 150px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }.empty-state strong { color: var(--ink); }.empty-state.compact { min-height: 280px; }

.lead-form { display: grid; gap: 18px; }
.form-section { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 30px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.form-section-heading { display: flex; gap: 14px; }.form-section-heading > span { color: var(--gold); font-family: Georgia, serif; font-size: 12px; }.form-section-heading h2 { margin: 0 0 8px; font-size: 17px; }.form-section-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-field.wide { grid-column: 1 / -1; }
.form-field small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.required, .field-error { color: var(--red); }.required { margin-left: 3px; }.field-error { display: block; margin-top: 5px; font-size: 11px; }
.form-alert { padding: 12px 14px; margin-bottom: 16px; color: #853b3f; background: #f7e8e9; border: 1px solid #ebcbcd; border-radius: 5px; font-size: 12px; }
.form-actions { padding: 5px 0 30px 240px; display: flex; gap: 10px; }

.detail-heading { align-items: center; }.detail-title .back-link { margin-bottom: 14px; }.title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }.title-line h1 { margin-right: 5px; }
.back-link { color: var(--blue); font-size: 12px; }.back-link.inline { display: inline-block; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.detail-main { display: grid; gap: 20px; }.detail-side { display: grid; gap: 20px; position: sticky; top: 90px; }
.detail-panel { overflow: hidden; }
.info-grid { margin: 0; padding: 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 18px; }.info-grid div, .need-blocks dl div { min-width: 0; }.info-grid dt, .need-blocks dt, .lead-card dt { color: var(--muted); font-size: 10px; }.info-grid dd, .need-blocks dd, .lead-card dd { margin: 7px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.need-blocks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }.need-blocks article { padding: 22px; border-right: 1px solid var(--line); }.need-blocks article:last-child { border-right: 0; }.need-blocks h3 { margin: 0 0 10px; font-size: 14px; }.need-blocks > article > p { min-height: 20px; margin: 0 0 18px; color: var(--blue); font-size: 12px; }.need-blocks dl { margin: 0; display: grid; gap: 14px; }
.long-note { margin: 0 22px 20px; padding: 16px; background: #f5f7f9; border-left: 3px solid var(--blue); font-size: 12px; line-height: 1.7; }.long-note.internal { border-left-color: var(--gold); }.long-note p { margin: 8px 0 0; color: #4f5968; }
.timeline { padding: 8px 22px 22px; }.timeline-item { position: relative; padding: 20px 0 20px 26px; border-bottom: 1px solid #eef1f4; }.timeline-item:last-child { border-bottom: 0; }.timeline-item::before { content: ""; position: absolute; left: 4px; top: 32px; bottom: -20px; width: 1px; background: #d7dde3; }.timeline-item:last-child::before { display: none; }.timeline-dot { position: absolute; left: 0; top: 25px; width: 9px; height: 9px; background: var(--gold); border-radius: 50%; }.timeline-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; }.timeline-meta strong { font-size: 13px; }.timeline-meta span { color: var(--muted); font-size: 10px; }.timeline-item > p { margin: 13px 0; color: #414b5b; font-size: 13px; line-height: 1.7; }.result-line, .next-line { font-size: 11px; color: var(--muted); }.result-line strong { margin-right: 8px; color: var(--ink); }.next-line { margin-top: 8px; color: var(--blue); }
.action-panel { padding: 22px; }.action-panel h2 { margin: 6px 0 18px; font-size: 17px; }.status-form { display: grid; gap: 10px; }.stack-form { display: grid; gap: 14px; }.stack-form .form-field.wide { grid-column: auto; }

.pipeline-board { display: grid; grid-template-columns: repeat(6, minmax(270px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: start; }
.pipeline-column { min-height: 560px; background: #e9edf1; border: 1px solid #dce2e8; border-radius: var(--radius); overflow: hidden; }.pipeline-column > header { min-height: 62px; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-bottom: 1px solid var(--line); font-size: 12px; }.pipeline-column > header > div { display: flex; align-items: center; gap: 8px; }.pipeline-column > header small { min-width: 22px; height: 22px; display: inline-grid; place-items: center; color: var(--muted); background: #edf0f3; border-radius: 50%; }.pipeline-column > header > span { color: var(--muted); }
.pipeline-cards { padding: 10px; display: grid; gap: 10px; }.lead-card { padding: 15px; background: #fff; border: 1px solid #dce2e8; border-radius: 6px; }.lead-card:hover { border-color: #aeb8c4; }.lead-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; }.lead-card h3 { margin: 14px 0 7px; font-size: 14px; }.lead-card > p { margin: 0; color: var(--muted); font-size: 10px; }.lead-card dl { margin: 17px 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.lead-card dd { font-size: 11px; }.lead-card-date { padding-top: 11px; border-top: 1px solid #eef1f4; color: var(--muted); font-size: 10px; }.card-status-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 12px; }.card-status-form select { min-height: 32px; padding: 5px 8px; font-size: 10px; }.card-status-form button { min-height: 32px; border: 0; border-radius: 4px; color: #fff; background: var(--ink); cursor: pointer; font-size: 10px; }.column-empty { min-height: 110px; display: grid; place-items: center; color: #8b95a2; font-size: 11px; border: 1px dashed #c9d0d8; border-radius: 5px; }

.login-page { background: #fff; }.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(420px, .9fr); }.login-brand { min-height: 100vh; display: grid; place-items: center; padding: 60px; color: #fff; background: var(--nav); }.login-brand-inner { width: min(560px, 100%); }.login-brand h1 { margin: 18px 0 24px; font-family: "Microsoft YaHei", sans-serif; font-size: clamp(36px, 4.2vw, 64px); line-height: 1.28; letter-spacing: 0; }.login-brand p:last-child { color: #aeb8c5; font-size: 14px; }.login-panel { display: grid; place-items: center; padding: 42px; }.login-form { width: min(390px, 100%); }.login-form h2 { margin: 10px 0 8px; font-size: 28px; }.login-form > .muted { margin: 0 0 32px; }.login-form label { margin-top: 18px; }.login-form .button { margin-top: 24px; }.login-form .back-link { display: block; margin-top: 24px; text-align: center; }
.nav-scrim { display: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }.metric:nth-child(3) { border-right: 0; }.metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: repeat(3, 1fr); }.search-field { grid-column: span 2; }
  .detail-layout { grid-template-columns: 1fr; }.detail-side { position: static; grid-template-columns: .7fr 1.3fr; }.info-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .app-shell { display: block; }.sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; }.nav-open .sidebar { transform: translateX(0); }.nav-open { overflow: hidden; }.nav-scrim { position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(7,12,20,.5); }.nav-open .nav-scrim { display: block; }
  .menu-button { display: block; }.topbar { padding: 0 18px; }.page-content { padding: 24px 18px; }
  .page-heading, .detail-heading { align-items: flex-start; flex-direction: column; }.page-heading h1, .detail-heading h1 { font-size: 26px; }.heading-actions { width: 100%; }.heading-actions .button { flex: 1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }.metric, .metric:nth-child(3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }.metric:nth-child(even) { border-right: 0; }.metric:last-child { border-bottom: 0; }.metric { min-height: 112px; padding: 20px; }.metric strong { font-size: 27px; }
  .filter-bar { grid-template-columns: repeat(2, 1fr); }.search-field { grid-column: 1 / -1; }.filter-submit { width: 100%; }.clear-filter { justify-content: center; }
  .form-section { grid-template-columns: 1fr; gap: 22px; padding: 22px; }.form-section-heading p { max-width: 420px; }.form-actions { padding-left: 0; }
  .detail-side { grid-template-columns: 1fr; }.need-blocks { grid-template-columns: 1fr; }.need-blocks article { border-right: 0; border-bottom: 1px solid var(--line); }.need-blocks article:last-child { border-bottom: 0; }
  .login-layout { grid-template-columns: 1fr; }.login-brand { display: none; }.login-panel { min-height: 100vh; padding: 28px; }
}

@media (max-width: 560px) {
  .topbar { height: 60px; }.page-content { padding: 20px 14px; }.message-stack { left: 14px; right: 14px; top: 70px; }.message { min-width: 0; width: 100%; }
  .metric-grid { display: grid; }.metric { min-height: 104px; padding: 18px; }.metric::before { left: 18px; }.metric strong { margin: 10px 0 6px; font-size: 25px; }
  .panel-heading { min-height: 68px; padding: 15px; }.stage-table, .compact-list { padding-left: 15px; padding-right: 15px; }.stage-row { grid-template-columns: 10px 1fr 54px 80px; gap: 8px; font-size: 11px; }
  .filter-bar { grid-template-columns: 1fr; }.search-field { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }.form-field.wide { grid-column: auto; }.form-section { padding: 18px; }.form-actions { display: grid; }.form-actions .button { width: 100%; }
  .info-grid { grid-template-columns: 1fr 1fr; padding: 18px; }.timeline { padding-left: 16px; padding-right: 16px; }.timeline-meta { align-items: flex-start; flex-direction: column; gap: 5px; }
  .detail-heading .button { width: 100%; }.title-line { align-items: flex-start; }.title-line h1 { width: 100%; }
  .pagination { justify-content: center; }
}
