:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --nav:#132b28;
  --ink:#172521;
  --muted:#596c66;
  --paper:#fff;
  --canvas:#f3f6f3;
  --edge:#dce5df;
  --green:#17654e;
  --green-dark:#0f503d;
  --green-wash:#e5f3eb;
}
*,*::before,*::after { box-sizing:border-box; }
body { margin:0; min-width:320px; background:var(--canvas); color:var(--ink); font-size:14px; }
button,input,textarea,select { font:inherit; }
button,a,input,select,summary,textarea { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { opacity:.55; cursor:progress; }
a { color:inherit; text-decoration:none; }
svg:not(.leaflet-zoom-animated) { width:20px; height:20px; flex:none; }
:focus-visible { outline:2px solid #2e9070; outline-offset:3px; }
h1,h2,h3,p,dl { margin:0; }
h1 { font-size:clamp(25px,3.4vw,36px); letter-spacing:-.038em; line-height:1.3; }
h2 { font-size:16px; font-weight:750; }
h3 { font-size:14px; }
.shell { display:grid; grid-template-columns:235px minmax(0,1fr); min-height:100vh; }
.sidebar { position:sticky; top:0; height:100dvh; overflow:auto; display:flex; flex-direction:column; background:var(--nav); color:#bfd0ca; padding:23px 15px 16px; }
.brand { display:flex; align-items:center; gap:12px; margin:3px 8px 29px; color:#fff; }
.brand>span { width:40px; height:40px; display:grid; place-items:center; background:#bce7cf; color:#163c2d; border-radius:10px; font-size:22px; font-weight:850; }
.brand strong,.brand small { display:block; }
.brand strong { font-size:20px; letter-spacing:.02em; }
.brand small { color:#b9cfc5; font-size:11px; margin-top:4px; }
nav { display:grid; gap:6px; }
.side-home,summary { display:flex; align-items:center; gap:11px; border-radius:8px; padding:12px; color:#d5e5dd; font-weight:650; }
summary { list-style:none; cursor:pointer; }
summary::-webkit-details-marker { display:none; }
summary span { flex:1; }
summary svg:last-child { width:13px; transition:transform .15s ease; }
.nav-section[open]>summary svg:last-child { transform:rotate(90deg); }
.nav-section a { display:block; padding:8px 10px 8px 33px; margin:1px 0 1px 8px; border-radius:6px; color:#c7d8d1; }
.side-home:hover,summary:hover,.nav-section a:hover { background:#24423a; }
.side-home.selected,.nav-section a[aria-current] { background:#2a5043; color:#fbfffc; }
.local { margin-top:auto; padding:20px 10px 4px; color:#adc7ba; font-size:12px; }
.procurement-nav-group { display:block; padding:12px 8px 3px 20px; font-size:11px; color:#98b8ac; }
.local i { display:inline-block; width:7px; height:7px; background:#83caa4; border-radius:50%; margin-right:5px; vertical-align:1px; }
.workspace { min-width:0; }
.topbar { min-height:62px; border-bottom:1px solid var(--edge); background:#fff; display:flex; justify-content:space-between; align-items:center; gap:12px; padding:0 clamp(16px,3.2vw,48px); }
#crumb { color:#546961; font-size:13px; }
#crumb a { color:var(--green-dark); }
#crumb span { color:#859990; margin:0 5px; }
.role { display:flex; align-items:center; gap:10px; white-space:nowrap; color:var(--muted); font-size:13px; }
.role select { width:auto; min-width:98px; }
main { max-width:1450px; margin:auto; padding:31px clamp(16px,3.2vw,48px) 48px; }
.heading { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:24px; }
.heading p { color:var(--muted); margin-top:6px; line-height:1.55; overflow-wrap:anywhere; }
.heading>div:first-child { min-width:0; }
.tools { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; align-items:center; }
.date { display:block; color:var(--muted); font-variant-numeric:tabular-nums; padding:9px 12px; border:1px solid var(--edge); border-radius:8px; background:white; white-space:nowrap; }
.metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:15px; margin-bottom:24px; }
.metric { background:var(--paper); border:1px solid var(--edge); border-radius:12px; padding:15px 17px; min-width:0; }
.metric-head { display:flex; align-items:center; justify-content:space-between; font-weight:650; color:#4e625a; gap:5px; }
.metric-head span,.module-icon { display:grid; place-items:center; width:33px; height:33px; background:var(--green-wash); color:var(--green-dark); border-radius:8px; flex:none; }
.metric.purchase .metric-head span { background:#f8eedc; color:#9a631e; }
.metric.warehouse .metric-head span { background:#e7eef9; color:#365985; }
.metric.transport .metric-head span { background:#edeaf8; color:#66518d; }
.metric strong { display:block; font-size:29px; font-variant-numeric:tabular-nums; margin:7px 0 4px; overflow-wrap:anywhere; }
.metric p,.secondary { color:var(--muted); font-size:12px; }
.shortcuts { margin-bottom:24px; }
.shortcuts h2 { margin-bottom:11px; }
.modules { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.module { background:#fff; border:1px solid var(--edge); border-radius:10px; padding:13px; display:flex; align-items:center; gap:10px; min-width:0; }
.module:hover,.metric:where(a):hover { border-color:#a5c5b4; background:#fbfffc; }
.module>div { min-width:0; flex:1; }
.module strong,.module small { display:block; }
.module small { margin-top:4px; color:var(--muted); font-size:11px; line-height:1.5; }
.module>svg { width:16px; color:#5d7a6d; }
.dashboard-grid { display:grid; grid-template-columns:minmax(0,1.65fr) minmax(240px,1fr); gap:15px; align-items:start; }
.panel { border:1px solid var(--edge); border-radius:11px; background:#fff; margin-bottom:15px; min-width:0; }
.panel>header { padding:14px 17px; border-bottom:1px solid var(--edge); display:flex; align-items:center; gap:7px; justify-content:space-between; }
.watch { padding:4px 15px; }
.watch>a,.watch>div { display:flex; align-items:center; justify-content:space-between; padding:12px 1px; min-height:45px; border-bottom:1px solid #edf1ed; gap:8px; color:#4b6257; }
.watch>*:last-child { border-bottom:0; }
.watch strong { color:var(--ink); margin-left:auto; }
.watch svg { width:14px; }
.table-scroll { overflow:auto; }
table { border-collapse:collapse; width:100%; text-align:left; min-width:530px; }
th,td { padding:11px 15px; border-bottom:1px solid #e8eeea; line-height:1.45; }
th { background:#f6f9f7; color:#50665c; font-size:12px; white-space:nowrap; font-weight:650; }
td { overflow-wrap:anywhere; }
tr:last-child td { border-bottom:0; }
tbody tr:hover { background:#f7fbf8; }
.secondary { display:block; margin-top:3px; }
.record { color:#155941; font-weight:700; }
.record:hover,.back:hover { text-decoration:underline; }
.tag { display:inline-flex; white-space:nowrap; align-items:center; background:#edf1ee; color:#495951; border-radius:6px; padding:4px 7px; font-size:12px; font-weight:650; }
.tag.active,.tag.approved,.tag.posted,.tag.released,.tag.signed,.tag.closed { background:#e5f3ea; color:#275941; }
.tag.pending,.tag.exception,.tag.returned { background:#fff0da; color:#7d4c12; }
.tag.dispatched,.tag.reserved { background:#e9effa; color:#365785; }
.empty { color:var(--muted); padding:24px 15px; text-align:center; }
.table-tools { padding:12px 15px; border-bottom:1px solid var(--edge); display:flex; align-items:center; flex-wrap:wrap; gap:11px; }
.search { position:relative; width:min(100%,280px); }
.search svg { position:absolute; inset:9px auto auto 9px; width:17px; color:var(--muted); pointer-events:none; }
.search input { padding-left:32px; }
.table-tools select { width:auto; }
#result-count { margin-left:auto; color:var(--muted); font-size:12px; }
input,select,textarea { width:100%; min-width:0; padding:8px 10px; min-height:37px; border:1px solid #cddbd3; border-radius:7px; color:var(--ink); background:#fff; }
textarea { resize:vertical; }
.btn { min-height:36px; padding:7px 11px; color:var(--ink); background:#fff; border:1px solid #cddbd3; border-radius:7px; display:inline-flex; align-items:center; justify-content:center; gap:6px; white-space:nowrap; font-weight:650; }
.btn svg { width:16px; height:16px; }
.btn:hover { background:#edf5ef; }
.btn.primary { background:var(--green); border-color:var(--green); color:white; }
.btn.primary:hover { background:var(--green-dark); }
.btn.quiet { border-color:transparent; }
.back { margin-bottom:14px; display:inline-flex; align-items:center; gap:6px; color:var(--green-dark); font-weight:650; }
.back svg { width:16px; }
.facts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; padding:16px; }
.facts dt { color:var(--muted); font-size:12px; margin-bottom:4px; }
.facts dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; line-height:1.5; }
.sample-timeline { list-style:none; margin:0; padding:8px 18px 14px; }
.sample-timeline li { padding:12px 0; border-bottom:1px solid var(--edge); overflow-wrap:anywhere; }
.sample-timeline li:last-child { border-bottom:0; }
.sample-timeline p { margin:8px 0 0; }
.sample-follow-header { display:flex; flex-wrap:wrap; align-items:baseline; gap:10px; }
.sample-feedback { white-space:pre-wrap; line-height:1.5; }
.sample-file-actions:not(:empty) { margin-top:10px; }
.sample-file-actions .btn { white-space:normal; overflow-wrap:anywhere; text-align:left; }
.small-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
dialog { width:min(780px,calc(100% - 24px)); max-height:91dvh; border:1px solid var(--edge); border-radius:13px; padding:0; color:var(--ink); box-shadow:0 17px 60px #0d291d42; }
dialog::backdrop { background:#102d2280; }
dialog header,dialog footer { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; gap:7px; background:#fff; }
dialog header { position:sticky; top:0; z-index:1; border-bottom:1px solid var(--edge); }
dialog footer { position:sticky; bottom:0; justify-content:flex-end; flex-wrap:wrap; border-top:1px solid var(--edge); }
.icon-btn { background:transparent; border:0; color:var(--muted); padding:3px 5px; }
.dialog-body { padding:16px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.form-grid label { display:grid; gap:5px; align-content:start; }
.form-grid label[data-custom-option][hidden] { display:none; }
.form-grid label>span { font-weight:650; }
.form-grid .wide { grid-column:1 / -1; }
.form-grid i { color:#8c430b; font-style:normal; }
.order-intake { display:grid; gap:8px; border:1px solid var(--edge); border-radius:8px; padding:12px; margin:0 0 16px; background:#f6f9f7; }
.order-intake>label { font-weight:700; }
#order-intake-result { border-top:1px solid var(--edge); padding-top:8px; overflow-wrap:anywhere; }
#order-intake-result p { margin:0; }
#order-intake-result ul { margin:6px 0 0; padding-left:21px; }
.order-intake-issues { margin-top:9px; }
.line-head { display:flex; gap:6px; align-items:center; justify-content:space-between; margin:17px 0 7px; }
.line-head>div { display:flex; gap:5px; }
.line { min-width:0; margin:8px 0; border:1px solid var(--edge); border-radius:8px; padding:11px; }
.line legend { color:var(--muted); font-size:12px; }
.line .btn { margin-top:7px; }
.document-tools { display:flex; flex-wrap:wrap; gap:8px; padding:12px 16px; }
.dialog-facts { padding:0 0 12px; }
.snapshot { display:block; padding:2px 0; margin-top:4px; color:var(--green-dark); border:0; background:transparent; }
.asset-customer { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:15px; }
.attachment-folders { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.attachment-folders .btn[aria-pressed="true"] { background:var(--green-dark); border-color:var(--green-dark); color:white; }
.attachment-count { margin-left:5px; font-size:12px; opacity:.8; }
.customer-address-help { margin-top:-6px; line-height:1.5; }
.asset-actions { display:flex; align-items:center; flex-wrap:wrap; gap:9px; }
.location-tools { border:1px solid var(--edge); border-radius:8px; padding:12px; margin-bottom:13px; }
.location-tools h3 { margin-bottom:10px; }
.location-tools .tools { justify-content:flex-start; margin-top:9px; }
.location-tools .secondary,.location-search-results { margin-top:9px; }
.location-search-results table,.location-search-results .empty { min-width:0; }
.customer-basemap-wrap { margin:12px; min-width:0; }
.location-tools .customer-basemap-wrap { margin:10px 0; }
.customer-basemap { height:clamp(240px,38vh,360px); border:1px solid var(--edge); border-radius:8px; background:#eef2ef; isolation:isolate; }
.customer-basemap .leaflet-popup-content { overflow-wrap:anywhere; }
.customer-map-legend { display:flex; flex-wrap:wrap; gap:8px 16px; margin:8px 0; font-size:13px; }
.customer-map-legend span { display:inline-flex; align-items:center; gap:5px; }
.customer-map-legend i { width:12px; height:12px; border-radius:50%; border:1px solid #68736d; }
.customer-map-dot-four { background:#dc2626; }
.customer-map-dot-five { background:#9333ea; }
.customer-map-dot-three { background:#8b4513; }
.customer-map-dot-low { background:#facc15; }
.customer-map-dot-unrated { background:#6b7280; }
.map-check { width:auto; min-height:0; }
.map-preview,.customer-image { display:block; max-width:100%; height:auto; margin:0 auto; }
.map-preview { width:min(700px,100%); }
.customer-image { max-height:70dvh; object-fit:contain; }
.map-legend { padding:12px 16px; color:var(--muted); }
.dialog-caption { margin-bottom:13px; color:var(--muted); line-height:1.5; }
.contract-form-section { margin-top:12px; border:1px solid var(--edge); border-radius:8px; padding:10px 12px; scroll-margin-top:65px; }
.contract-form-section summary { cursor:pointer; font-weight:700; }
.contract-form-section > .form-grid { margin-top:10px; }
.contract-form-tools { display:flex; align-items:center; flex-wrap:wrap; gap:9px; margin-top:10px; }
.contract-preview-area { overflow-x:auto; padding:10px; margin-top:8px; background:#eef2ef; }
.contract-sheet { width:186mm; margin:0 auto; padding:10px 12px; background:#fff; color:#161616; font:11pt/1.36 "SimSun","Songti SC","Microsoft YaHei",serif; }
.contract-sheet p { margin:0; }
.contract-masthead { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:12px; margin:0 0 9px; }
.contract-masthead h1 { grid-column:2; margin:0; color:#111; font-size:22pt; letter-spacing:.08em; }
.contract-brand { display:flex; flex-direction:column; color:#174333; font-family:"Microsoft YaHei",sans-serif; line-height:1.18; }
.contract-brand strong { font-size:18pt; white-space:nowrap; }
.contract-brand span { font-size:7.8pt; font-weight:600; }
.contract-identities { display:grid; grid-template-columns:1.5fr 1fr; align-items:end; gap:10px; margin-bottom:5px; }
.contract-identities p,.contract-clause,.contract-parties p { overflow-wrap:anywhere; white-space:pre-wrap; }
.contract-sheet .contract-clause { margin:6px 0; orphans:2; widows:2; }
.contract-goods { width:100%; min-width:0; border:1px solid #444; border-collapse:collapse; table-layout:fixed; font:inherit; }
.contract-goods col:nth-child(1) { width:26%; }
.contract-goods col:nth-child(2) { width:10%; }
.contract-goods col:nth-child(3) { width:6%; }
.contract-goods col:nth-child(4) { width:10%; }
.contract-goods col:nth-child(5) { width:11%; }
.contract-goods col:nth-child(6) { width:13%; }
.contract-goods col:nth-child(7) { width:24%; }
.contract-goods th,.contract-goods td { padding:5px 3px; border:1px solid #444; text-align:center; color:#161616; background:#fff; min-width:0; white-space:normal; overflow-wrap:anywhere; }
.contract-goods thead { display:table-header-group; }
.contract-goods tr { break-inside:avoid; }
.contract-goods tbody tr:not(.contract-total) { height:30px; }
.contract-goods .contract-total th,.contract-goods .contract-total td { padding-block:7px; font-weight:700; }
.contract-goods .contract-total > * { border-bottom:1px solid #444; }
.contract-parties { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); border:1px solid #444; margin-top:6px; break-inside:avoid; }
.contract-parties section { min-width:0; padding:4px 7px 7px; }
.contract-parties section+section { border-left:1px solid #444; }
.contract-parties h2 { margin:0 0 5px; font:inherit; font-weight:700; text-align:center; }
.contract-parties p { margin:2px 0; }
.contract-sign-space { height:12mm; }
#contract-print-output { display:none; }
.contract-business-plan { padding:20px; }
.contract-business-plan-text { margin-top:10px; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.8; }
@page contract-a4 { size:A4 portrait; margin:12mm; }
@media print {
  body:has(> #contract-print-output) { min-width:0; background:#fff; }
  body:has(> #contract-print-output) > :not(#contract-print-output) { display:none !important; }
  body:has(> #contract-print-output) dialog::backdrop { display:none; }
  #contract-print-output { display:block; page:contract-a4; }
  #contract-print-output .contract-sheet { width:100%; margin:0; padding:0; }
}
.crm-tabs,.crm-checks,.crm-check { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.crm-tabs { margin:0 0 12px; }
.crm-checks { min-width:0; grid-column:1 / -1; border:1px solid var(--edge); border-radius:8px; padding:8px 12px 12px; }
.crm-checks label,.form-grid .crm-check { display:flex; align-items:center; flex-direction:row; gap:6px; }
.crm-checks input,.crm-check input,.table-scroll input[type=checkbox] { width:16px; min-height:16px; height:16px; margin:0; accent-color:var(--green-dark); }
.visit-stop,.visit-item { min-width:0; border:1px solid var(--edge); border-radius:8px; padding:12px; margin:8px 0; }
.visit-stop legend { padding:0 5px; font-weight:650; }
.visit-stop>.btn { margin-top:10px; }
.visit-calendar { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px; padding:0 12px 12px; }
.visit-calendar>strong { padding:9px 4px; text-align:center; }
.calendar-day,.calendar-blank { min-width:0; min-height:75px; border:1px solid var(--edge); padding:6px; overflow-wrap:anywhere; }
.calendar-day.today { background:#e6f2eb; }
.calendar-day a { display:block; font-size:12px; padding:4px 0; }
.crm-photo { display:block; max-width:100%; max-height:66dvh; margin:0 auto; }
@media(max-width:550px) {
  .visit-calendar { padding:0 3px 8px; }
  .calendar-day,.calendar-blank { padding:3px; min-height:51px; }
}
.error { padding:11px; border:1px solid #eec7bd; background:#fff0eb; color:#8f3426; border-radius:7px; margin-bottom:12px; }
.error[hidden] { display:none; }
#toast { position:fixed; z-index:5; bottom:16px; right:17px; padding:10px 14px; background:#203e32; color:white; border-radius:8px; }
#toast:empty { display:none; }
@media(max-width:1050px) {
  .shell { grid-template-columns:184px minmax(0,1fr); }
  .modules { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns:1fr; gap:0; }
}
@media(max-width:700px) {
  .shell { display:block; }
  .sidebar { position:static; height:auto; padding:12px; }
  .brand { margin:0 0 7px; }
  .brand small,.local { display:none; }
  nav { display:flex; flex-wrap:wrap; align-items:flex-start; gap:4px; }
  .side-home,summary { padding:7px; font-size:12px; gap:4px; }
  nav svg { width:14px; height:14px; }
  .nav-section a { margin:0; padding:7px 10px; font-size:12px; }
  .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .heading { align-items:flex-start; flex-wrap:wrap; }
  .facts { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .module { padding:8px; gap:5px; }
  .module>svg { display:none; }
}
@media(max-width:380px) {
  .form-grid { grid-template-columns:1fr; }
}
.rd-snapshot { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto; background: #f3f7f4; padding: 16px; border-radius: 8px; font-size: 13px; }

.sales-plan-unplanned td { background: #fff3bf; }
.sales-plan-total td { font-weight: 700; background: #edf5f0; }
.sales-plan-edit select { min-width: 200px; }
.sales-plan-edit input { min-width: 110px; }
.sales-plan-progress { min-width: 1700px; }
.sales-plan-progress th, .sales-plan-progress td:nth-child(n+3) { white-space: nowrap; }
.sales-plan-progress td:nth-child(-n+2) { min-width: 160px; }
