:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --page: #ffffff;
  --green: #2563eb;
  --green-soft: #edf3ff;
  --blue: #2563eb;
  --amber: #d97706;
  --red: #b23a3a;
  --sidebar: #2563eb;
  --sidebar-dark: #2563eb;
  --sidebar-text: #ffffff;
  --sidebar-active: rgba(255,255,255,.18);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--page); font: 14px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus:not(:focus-visible), select:focus:not(:focus-visible), input:focus:not(:focus-visible) { outline: none; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 250px; min-height: 100vh; flex-direction: column; color: var(--sidebar-text); background: var(--sidebar); }
.system-brand { display: flex; min-height: 72px; padding: 18px; align-items: center; gap: 11px; background: var(--sidebar); }
.system-mark { display: grid; width: 32px; height: 32px; place-items: center; color: white; background: rgba(255,255,255,.17); border-radius: 8px; font-weight: 700; }
.system-brand strong, .system-brand small { display: block; }
.system-brand strong { color: white; font-size: 14px; }
.system-brand small { margin-top: 0; color: rgba(255,255,255,.82); font-size: 12px; }
.side-nav { flex: 1; padding: 8px 16px 14px; overflow-y: auto; }
.nav-group-title { margin: 13px 8px 5px; color: rgba(255,255,255,.62); font-size: 11px; line-height: 1.4; }
.nav-group-title:first-child { margin-top: 5px; }
.nav-item { position: relative; display: grid; width: 100%; min-height: 36px; grid-template-columns: 20px 1fr auto; align-items: center; gap: 7px; padding: 0 8px; color: var(--sidebar-text); text-align: left; background: transparent; border: 0; border-radius: 8px; }
.nav-item:hover { background: rgba(255,255,255,.09); }
.nav-item.active { color: white; background: #457aee; font-weight: 400; }
.nav-icon { display: grid; width: 18px; height: 18px; place-items: center; color: inherit; border: 1px solid currentColor; border-radius: 4px; font-size: 10px; }
.nav-tag { padding: 1px 4px; color: #e9f3ff; background: rgba(255,255,255,.14); border-radius: 3px; font-size: 10px; }
.nav-item.active .nav-tag { color: white; background: rgba(255,255,255,.14); }
.account-panel { display: flex; min-height: 58px; padding: 10px 18px; align-items: center; gap: 9px; background: var(--sidebar); }
.account-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; color: #2563eb; background: white; border-radius: 50%; font-weight: 700; }
.account-panel strong, .account-panel small { display: block; }
.account-panel strong { color: white; font-size: 12px; }
.account-panel small { margin-top: 1px; color: rgba(255,255,255,.8); font-size: 10px; }
.account-panel i, .system-status i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; background: #68c69f; border-radius: 50%; }
.sidebar-overlay { display: none; }
.workspace { min-height: 100vh; margin-left: 250px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 70px; padding: 0 18px; align-items: center; justify-content: space-between; gap: 18px; background: white; border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.location-icon { color: #111827; font-size: 12px; }
.breadcrumb-root { color: #64748b; }
.breadcrumb-separator { color: #c0c8d2; }
.route-name { color: #111827; font-size: 14px; font-weight: 500; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
h1 { margin: 0; font-size: 20px; font-weight: 650; }
.menu-button { display: none; width: 36px; height: 36px; padding: 0; color: var(--sidebar); background: white; border: 1px solid #cbd5df; border-radius: 4px; font-size: 21px; }
.header-meta { display: flex; gap: 12px; align-items: center; color: #687890; font-size: 12px; }
.mock-badge { padding: 4px 8px; color: #2563eb; border: 1px solid #cbdafa; border-radius: 4px; background: #f1f5ff; }
.system-status { color: #536780; }
.main-content { max-width: none; margin: 0; padding: 20px 24px 0; }
.module-view[hidden] { display: none; }
.home-intro { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.home-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.home-stat { min-width: 0; padding: 17px 20px; border-right: 1px solid var(--line); }
.home-stat:last-child { border-right: 0; }
.home-stat span, .home-stat small { display: block; color: var(--muted); }
.home-stat strong { display: block; margin: 7px 0 3px; font-size: 26px; line-height: 1.25; }
.home-stat .text-value { min-height: 33px; padding-top: 3px; font-size: 17px; }
.module-directory { margin-top: 16px; }
.module-table { min-width: 760px; }
.module-table td:nth-child(2) strong, .module-table td:nth-child(2) small { display: block; }
.module-table td:nth-child(2) small { margin-top: 2px; color: var(--muted); }
.module-status { display: inline-block; padding: 3px 8px; border-radius: 3px; font-size: 12px; }
.module-status.ready { color: #17624f; background: #dff0ea; }
.module-status.pending { color: #6b7280; background: #edf0f3; }
.module-action { min-width: 54px; min-height: 30px; color: #fff; background: var(--blue); border: 1px solid var(--blue); border-radius: 4px; }
.module-action:hover { background: #1d4ed8; }
.action-muted { color: #94a3b8; }
.page-intro { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; }
.page-title-block { display: flex; align-items: center; gap: 12px; }
.page-icon { display: grid; width: 44px; height: 44px; place-items: center; color: #2563eb; background: #f0f5ff; border-radius: 8px; font-size: 18px; }
.page-intro h2 { font-size: 21px; color: #05070a; }
.page-intro p { margin: 0; }
.page-intro p:last-child { margin-top: 1px; color: #536780; }
.page-meta { display: flex; align-items: center; gap: 10px; color: #6b7c92; font-size: 12px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 12px; padding: 12px 8px; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
select, input { min-height: 36px; padding: 0 34px 0 10px; color: var(--ink); background: white; border: 1px solid #cbd4cf; border-radius: 4px; outline: none; }
select:focus, input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(23,107,91,.12); }
.secondary-button { min-height: 36px; padding: 0 14px; color: white; background: #2563eb; border: 1px solid #2563eb; border-radius: 6px; }
.quick-filter { display: grid; flex-basis: 100%; gap: 5px; color: var(--muted); font-size: 12px; }
.quick-range { display: flex; width: fit-content; min-height: 36px; border: 1px solid #cbd4cf; border-radius: 4px; overflow: hidden; }
.quick-button { min-width: 54px; padding: 0 10px; color: #536780; background: white; border: 0; border-right: 1px solid #e2e8f0; }
.quick-button:last-child { border-right: 0; }
.quick-button.active { color: white; background: #2563eb; }
.filter-error { flex-basis: 100%; min-height: 0; color: #dc2626; font-size: 12px; }
.filter-error:empty { display: none; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.metric-card { min-height: 118px; padding: 17px 18px; background: white; border: 1px solid var(--line); border-radius: 4px; }
.metric-card.blue, .metric-card.amber, .metric-card.red, .metric-card.muted { border-top-color: var(--line); }
.metric-card p { margin: 0; color: var(--muted); }
.metric-title { display: flex; align-items: center; gap: 6px; }
.metric-card strong { display: block; margin: 12px 0 5px; font-size: 28px; line-height: 1; }
.metric-note { font-size: 12px; color: var(--muted); }
.metric-note.pending { display: inline-block; padding: 2px 6px; color: #67572a; background: #f7edcf; border-radius: 3px; }
.data-notice { display: flex; gap: 14px; align-items: center; margin: 12px 0 0; padding: 10px 14px; color: #536780; background: #f5f8fe; border-left: 3px solid #2563eb; }
.data-notice[hidden] { display: none; }
.data-notice strong { flex: 0 0 auto; }
.sync-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: -3px 0 12px; padding: 9px 12px; color: #64748b; background: #f8fafc; border: 1px solid #e5eaf0; font-size: 12px; }
.sync-strip span { display: flex; align-items: center; gap: 6px; }
.sync-strip strong { color: #334155; font-weight: 500; }
.sync-strip i { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }
.sync-strip i.missing { background: #d97706; }
.data-notice.warning { color: #92400e; background: #fffbeb; border-color: #d97706; }
.data-notice.waiting { color: #475569; background: #f8fafc; border-color: #94a3b8; }
.data-notice.loading { color: #1e40af; background: #eff6ff; border-color: #2563eb; }
.data-notice.empty { color: #475569; background: #f8fafc; border-color: #94a3b8; }
.data-notice.error { color: #991b1b; background: #fef2f2; border-color: #dc2626; }
.notice-retry { margin-left: auto; padding: 4px 9px; color: inherit; background: #fff; border: 1px solid currentColor; border-radius: 4px; }
.boot-state { max-width: 520px; margin: 100px auto; padding: 30px; text-align: center; border: 1px solid #e2e8f0; }
.boot-state strong { display: block; font-size: 18px; }.boot-state p { color: #64748b; }.boot-state button { padding: 8px 14px; color: #fff; background: #2563eb; border: 0; border-radius: 4px; }
.boot-loading { position: fixed; inset: 50px 0 0 250px; z-index: 40; display: flex; align-items: center; justify-content: center; gap: 10px; color: #475569; background: rgba(255,255,255,.92); }
.boot-loading span { width: 18px; height: 18px; border: 2px solid #cbd5e1; border-top-color: #2563eb; border-radius: 50%; animation: spin .7s linear infinite; }@keyframes spin { to { transform: rotate(360deg); } }
.shops-toolbar { align-items: end; }.shops-toolbar input { width: 170px; }
.customers-toolbar { align-items: end; }
.customers-search input { width: 210px; }
.shops-table { min-width: 1120px; }.shops-table td strong,.shops-table td small { display: block; }.shops-table td small { margin-top: 3px; color: #64748b; }
.customers-table { min-width: 980px; }
.customers-table td:first-child strong, .customers-table td:first-child small, .customers-table td:nth-child(3) small { display: block; }
.customers-table td:first-child small, .customers-table td:nth-child(3) small { margin-top: 3px; color: #64748b; }
.source-pill { display: inline-block; padding: 3px 7px; border-radius: 3px; font-size: 12px; }
.source-pill.cooperation { color: #1d4ed8; background: #eaf1ff; }
.source-pill.external { color: #64748b; background: #eef1f4; }
.platform-tag { display: inline-block; padding: 3px 7px; color: #1d4ed8; background: #eaf1ff; border-radius: 3px; }
.mini-trend { display: block; width: 108px; height: 30px; }.mini-trend polyline { fill: none; stroke: #2563eb; stroke-width: 2; }
.linked-shop-list { display: grid; gap: 8px; }
.linked-shop-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 12px; background: #f8fafc; border-left: 2px solid #94a3b8; }
.linked-shop-list strong { min-width: 0; overflow-wrap: anywhere; }
.linked-shop-list span, .linked-shop-list small { color: #64748b; font-size: 12px; }
.linked-shop-list small { grid-column: 1 / -1; }
.compact-empty { padding: 12px; }
.dashboard-grid { display: grid; gap: 14px; margin-top: 16px; }
.dashboard-grid > .panel { min-width: 0; }
.primary-grid { grid-template-columns: minmax(0, 1.6fr) minmax(360px, .9fr); }
.secondary-grid { grid-template-columns: minmax(0, 1.45fr) minmax(360px, .85fr); }
.panel { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-kicker { margin: 0 0 3px; color: var(--green); font-size: 11px; font-weight: 700; }
h2 { margin: 0; font-size: 17px; font-weight: 650; }
.segmented { display: flex; border: 1px solid #cbd4cf; border-radius: 4px; overflow: hidden; }
.segment { min-height: 32px; padding: 0 12px; color: var(--muted); background: white; border: 0; border-right: 1px solid #cbd4cf; }
.segment:last-child { border-right: 0; }
.segment.active { color: white; background: var(--green); }
.trend-summary { display: flex; gap: 12px; align-items: baseline; margin: 20px 0 4px; }
.trend-summary strong { font-size: 28px; }
.up { color: #16705b; } .down { color: #b23a3a; }
.chart { width: 100%; min-height: 260px; }
.chart svg { display: block; width: 100%; height: 260px; overflow: visible; }
.chart text { fill: #78827e; font-size: 11px; }
.grid-line { stroke: #dce3df; stroke-width: 1; }
.trend-line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart circle { fill: white; stroke: var(--green); stroke-width: 3; }
.source-tag, .count-label { color: var(--muted); font-size: 12px; }
.info-tip { position: relative; display: inline-grid; width: 16px; height: 16px; padding: 0; place-items: center; vertical-align: 1px; color: #2563eb; background: #f1f5ff; border: 1px solid #bfd0f8; border-radius: 50%; font-size: 11px; line-height: 1; }
.info-tip::after { position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 40; display: none; width: max-content; max-width: 280px; padding: 8px 10px; color: white; background: #1e293b; border-radius: 4px; box-shadow: 0 4px 14px rgba(15,23,42,.18); content: attr(data-tooltip); font-size: 12px; font-weight: 400; line-height: 1.5; text-align: left; transform: translateX(-50%); white-space: normal; }
.info-tip:hover::after, .info-tip:focus::after { display: block; }
.project-breakdown { margin-top: 22px; }
.project-row { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; padding: 14px 0; border-bottom: 1px solid #edf0ee; }
.project-row:last-child { border-bottom: 0; }
.project-copy { display: grid; grid-template-columns: 10px 1fr; gap: 0 8px; align-items: center; }
.project-copy small { grid-column: 2; color: var(--muted); }
.project-dot { width: 8px; height: 8px; border-radius: 50%; }
.project-value { text-align: right; }
.project-value strong, .project-value span { display: block; }
.project-value span { color: var(--muted); font-size: 12px; }
.progress { grid-column: 1 / -1; height: 5px; background: #edf0ee; border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; }
.mapping-band { display: grid; grid-template-columns: 220px 1fr; gap: 18px 28px; align-items: center; margin-top: 16px; padding: 18px 20px; background: #f7f9fc; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; }
.mapping-band .section-kicker { color: #2563eb; }
.mapping-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.mapping-stats div { padding-left: 14px; border-left: 1px solid #dbe2ec; }
.mapping-stats dt { color: #62758d; font-size: 12px; }
.mapping-stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 650; }
.mapping-note { grid-column: 1 / -1; margin: 0; padding-top: 10px; color: #62758d; border-top: 1px solid #dbe2ec; font-size: 12px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th { padding: 10px 9px; color: #536780; background: #f6f8fb; font-size: 12px; font-weight: 400; text-align: left; border-bottom: 1px solid var(--line); }
td { padding: 12px 9px; border-bottom: 1px solid #edf0ee; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.rank { display: inline-grid; width: 24px; height: 24px; place-items: center; color: var(--muted); background: #eef1ef; border-radius: 3px; }
.rank-1 { color: #6a4b00; background: #f7e7b4; } .rank-2 { color: #43504c; background: #dfe5e2; } .rank-3 { color: #6e4d32; background: #ead7c8; }
.distributor-identity { display: inline-flex; align-items: center; gap: 8px; }
.customer-name, .archive-missing { padding-left: 8px; border-left: 1px solid #dbe3ee; font-size: 12px; }
.customer-name { color: #536780; }
.archive-missing { color: #b45309; }
.text-button { padding: 0; color: var(--green); background: none; border: 0; }
.anomaly-list { margin-top: 12px; }
.anomaly-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 13px 0; border-bottom: 1px solid #edf0ee; }
.anomaly-item:last-child { border-bottom: 0; }
.severity { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 3px; font-size: 12px; }
.severity-高 { color: white; background: var(--red); } .severity-中 { color: #734700; background: #f6d79b; } .severity-低 { color: #315145; background: #dce9e4; }
.anomaly-title { display: flex; justify-content: space-between; gap: 8px; }
.anomaly-title span, .anomaly-item p { color: var(--muted); font-size: 12px; }
.anomaly-item p { margin: 4px 0 0; white-space: normal; }
.status { display: inline-block; padding: 3px 7px; color: #45504c; background: #e9edeb; border-radius: 3px; font-size: 12px; }
.status-待同步 { color: #8e2929; background: #f6dddd; } .status-延迟 { color: #81510a; background: #f8e8c8; } .status-正常 { color: #17624f; background: #dff0ea; }
.shops-panel { margin-top: 16px; }
.standalone-panel { margin-top: 16px; }
.shop-actions { display: flex; gap: 8px; align-items: end; }
.search-label { position: relative; }
.empty-state, .empty-cell { padding: 24px; color: var(--muted); text-align: center; }
.placeholder-view { min-height: calc(100vh - 150px); padding: 90px 20px; text-align: center; }
.placeholder-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 14px; place-items: center; color: var(--sidebar); background: #e9f0f7; border: 1px solid #c9d8e8; border-radius: 6px; font-size: 20px; font-weight: 700; }
.placeholder-view h2 { font-size: 22px; }
.placeholder-view > p:not(.section-kicker) { max-width: 520px; margin: 7px auto 0; color: var(--muted); }
.placeholder-boundary { display: flex; max-width: 620px; margin: 28px auto 0; padding: 13px 16px; align-items: center; gap: 15px; text-align: left; background: #edf2f7; border-left: 3px solid var(--sidebar); }
.placeholder-boundary strong { flex: 0 0 auto; }
.placeholder-boundary span { color: #5e6d79; }
footer { margin-top: 28px; padding: 18px 24px; color: #70807a; text-align: center; border-top: 1px solid var(--line); font-size: 12px; }

@media (max-width: 1050px) {
  .home-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stat:nth-child(2) { border-right: 0; }
  .home-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .primary-grid, .secondary-grid { grid-template-columns: 1fr; }
  .mapping-band { grid-template-columns: 1fr; }
  .mapping-note { grid-column: 1; }
}

@media (max-width: 900px) {
  body.sidebar-open { overflow: hidden; }
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 8px 0 28px rgba(14,34,57,.24); }
  .sidebar-overlay { position: fixed; inset: 0 0 0 250px; z-index: 25; width: calc(100% - 250px); height: 100%; padding: 0; background: rgba(10,23,36,.42); border: 0; }
  body.sidebar-open .sidebar-overlay { display: block; }
  .workspace { margin-left: 0; }
  .menu-button { display: block; }
}

@media (max-width: 720px) {
  .topbar { min-height: 62px; padding: 8px 12px; }
  .topbar h1 { font-size: 17px; }
  .header-meta { gap: 5px; align-items: flex-end; flex-direction: column; }
  .system-status { display: none; }
  .main-content { padding: 14px 12px 0; }
  .page-intro { min-height: 66px; }
  .page-intro h2 { font-size: 18px; }
  .page-intro p:last-child { font-size: 12px; }
  .page-meta { align-items: flex-end; flex-direction: column; gap: 3px; }
  .home-summary { grid-template-columns: 1fr 1fr; }
  .home-stat { padding: 14px; }
  .home-stat strong { font-size: 22px; }
  .module-directory .panel-heading { flex-direction: column; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-filter { grid-column: 1 / -1; }
  .filter-bar label:first-child { grid-column: 1 / -1; }
  .filter-bar select { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 112px; padding: 14px; }
  .metric-card strong { font-size: 24px; }
  .data-notice { align-items: flex-start; flex-direction: column; gap: 3px; }
  .panel { padding: 15px 13px; }
  .panel-heading { align-items: flex-start; }
  .trend-panel .panel-heading { flex-direction: column; }
  .mapping-stats { grid-template-columns: 1fr 1fr; }
  .mapping-stats div { padding: 8px 0; border-left: 0; border-bottom: 1px solid #dbe2ec; }
  .shop-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .shops-panel .panel-heading { flex-direction: column; }
  .shop-actions input, .shop-actions select { width: 100%; }
  .anomaly-item { grid-template-columns: 28px 1fr; }
  .anomaly-item > .status { grid-column: 2; justify-self: start; }
}

@media (max-width: 420px) {
  .mock-badge { display: none; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar label:first-child { grid-column: 1; }
  .metric-grid { grid-template-columns: 1fr; }
  .home-summary { grid-template-columns: 1fr; }
  .home-stat, .home-stat:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .home-stat:last-child { border-bottom: 0; }
  .mapping-stats { grid-template-columns: 1fr; }
}

/* V2 professional admin layout */
:root {
  --page: #f5f7f9;
  --sidebar: #f8fafc;
  --sidebar-text: #334155;
  --sidebar-active: #e8efff;
}
body { background: var(--page); }
.sidebar { width: 224px; color: #334155; background: #f8fafc; border-right: 1px solid #e2e8f0; }
.system-brand { min-height: 64px; padding: 14px 16px; background: #fff; border-bottom: 1px solid #e8edf3; }
.system-mark { color: #fff; background: #2563eb; border-radius: 6px; }
.system-brand strong { color: #0f172a; }
.system-brand small { color: #64748b; }
.side-nav { padding: 8px 12px 14px; }
.nav-group-title { margin: 14px 8px 5px; color: #94a3b8; }
.nav-item { min-height: 38px; color: #475569; border-radius: 5px; }
.nav-item:hover { color: #1e40af; background: #eef3fb; }
.nav-item.active { color: #1d4ed8; background: #e7efff; font-weight: 600; }
.nav-item:focus { outline: none; box-shadow: none; }
.nav-item:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.nav-icon { border: 0; color: #64748b; background: #e9eef4; }
.nav-item.active .nav-icon { color: #fff; background: #2563eb; }
.nav-tag, .nav-item.active .nav-tag { color: #64748b; background: #e9eef4; }
.account-panel { min-height: 62px; padding: 10px 16px; background: #fff; border-top: 1px solid #e2e8f0; }
.account-avatar { color: #fff; background: #475569; }
.account-panel strong { color: #334155; }
.account-panel small { color: #64748b; }
.workspace { margin-left: 224px; }
.topbar { min-height: 56px; padding: 0 22px; background: rgba(255,255,255,.96); }
.main-content { padding: 16px 22px 0; }
.compact-intro { min-height: 48px; }
.compact-intro .page-icon { width: 36px; height: 36px; border-radius: 5px; font-size: 15px; }
.compact-intro h2 { font-size: 19px; }
.compact-intro p:last-child { font-size: 12px; }
.filter-bar { border: 0; }
.compact-toolbar, .success-toolbar { flex-wrap: nowrap; gap: 8px; margin-top: 10px; padding: 10px 0 12px; overflow-x: auto; border-bottom: 1px solid #dfe5ec; }
.compact-toolbar label, .success-toolbar label { flex: 0 0 auto; }
.compact-toolbar select, .success-toolbar select { min-width: 132px; }
.success-toolbar { gap: 7px; }
.success-toolbar select { min-width: 108px; }
.success-toolbar label:has(#successSort) select { min-width: 162px; }
.success-search input { width: 190px; padding-right: 10px; }
.success-period-bar { display: flex; flex-wrap: wrap; min-height: 54px; margin-top: 10px; padding: 9px 0 10px; align-items: end; gap: 8px; background: #fff; border-bottom: 1px solid #dfe5ec; }
.success-period-title { display: grid; min-width: 180px; gap: 2px; align-self: center; }
.success-period-title strong { font-size: 13px; }
.success-period-title span { color: #64748b; font-size: 11px; }
.success-period-bar label { flex: 0 0 auto; }
.success-period-bar input { width: 138px; }
.success-quick-range { min-height: 34px; }
.success-period-bar .filter-error { flex: 0 0 100%; }
.compact-toolbar input { width: 138px; }
.quick-filter { display: block; flex: 0 0 auto; }
.quick-filter > span { display: none; }
.quick-range { min-height: 34px; }
.quick-button { min-width: 48px; padding: 0 9px; }
select, input, .secondary-button { min-height: 34px; }
.filter-error { flex: 0 0 100%; }

.metric-grid { display: grid; grid-template-columns: minmax(250px, .9fr) minmax(600px, 2.2fr); gap: 12px; margin-top: 14px; }
.metric-primary { min-height: 132px; padding: 20px 22px; background: #eef4ff; border-left: 3px solid #2563eb; }
.metric-primary p, .metric-primary span { margin: 0; color: #64748b; }
.metric-primary strong { display: block; margin: 13px 0 8px; color: #0f172a; font-size: 38px; line-height: 1; }
.metric-secondary { display: grid; grid-template-columns: repeat(3, 1fr); min-height: 132px; background: #fff; }
.metric-secondary-item { min-width: 0; padding: 20px; border-right: 1px solid #e5eaf0; }
.metric-secondary-item:last-child { border-right: 0; }
.metric-secondary-item p { min-height: 42px; margin: 0; color: #64748b; }
.metric-secondary-item strong { display: block; margin: 4px 0 7px; font-size: 27px; line-height: 1; }
.metric-secondary-item span { color: #64748b; font-size: 12px; }
.metric-data-status { grid-column: 1 / -1; display: flex; min-height: 34px; padding: 7px 12px; align-items: center; gap: 8px; color: #64748b; background: #eef1f4; font-size: 12px; }
.metric-data-status strong { color: #475569; }
.status-dot { width: 7px; height: 7px; background: #94a3b8; border-radius: 50%; }
.metric-data-status .info-tip { margin-left: auto; }
.info-tip { color: #64748b; background: #f8fafc; border-color: #cbd5e1; }

.dashboard-grid { gap: 12px; margin-top: 14px; }
.primary-grid { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.panel { padding: 18px; border: 0; border-radius: 3px; }
.trend-summary { margin: 12px 0 2px; color: #64748b; font-size: 12px; }
.trend-summary span + span { margin-left: 12px; }
.chart, .chart svg { min-height: 210px; height: 210px; }
.project-breakdown { margin-top: 14px; }
.project-row { padding: 16px 0; }
.insight-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 12px; margin-top: 14px; }
.ranking-section, .activity-section, .success-table-section { min-width: 0; padding: 18px; background: #fff; }
.activity-list { margin-top: 10px; }
.activity-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid #edf1f5; }
.activity-item:last-child { border-bottom: 0; }
.activity-avatar { display: grid; width: 32px; height: 32px; place-items: center; color: #475569; background: #edf1f5; border-radius: 4px; font-size: 11px; }
.activity-item strong, .activity-item small { display: block; }
.activity-item small, .activity-item time { color: #64748b; font-size: 11px; }
.activity-item.activity-detail { grid-template-columns: 34px minmax(150px, 1fr) minmax(80px, auto) minmax(100px, auto); }
.activity-metrics { text-align: right; }
.activity-metrics strong, .activity-item.activity-detail time strong { color: #263442; font-size: 13px; }
.activity-item.activity-detail time { text-align: right; }
.axis-label { fill: #64748b; font-size: 10px; }

.success-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 14px; background: #fff; }
.success-summary > div { min-width: 0; padding: 17px 20px; border-right: 1px solid #e5eaf0; }
.success-summary > div:last-child { border-right: 0; }
.success-summary span, .success-summary small { display: block; color: #64748b; }
.success-summary strong { display: inline-block; margin-top: 5px; font-size: 27px; }
.success-summary small { display: inline; margin-left: 7px; }
.success-table-section { margin-top: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.success-table { min-width: 960px; }
.success-table th small { display: block; max-width: 150px; margin-top: 2px; color: #94a3b8; font-size: 10px; font-weight: 400; white-space: normal; }
.success-table td:first-child strong, .success-table td:first-child small { display: block; }
.success-table td:first-child small { margin-top: 2px; color: #64748b; }
.joined-cell strong, .joined-cell small { display: block; }
.joined-cell small { margin-top: 2px; color: #64748b; }
.success-row { cursor: pointer; }
.success-row:hover { background: #f8fafc; }
.mode-tag { color: #475569; }
.mode-tag.unset { color: #64748b; background: #eef1f4; padding: 3px 7px; border-radius: 3px; }
.mode-editor { display: flex; align-items: end; gap: 10px; }
.mode-editor label { flex: 1; }
.mode-editor select { width: 100%; }
.mode-updated-at { margin: 9px 0 0; color: #64748b; font-size: 12px; }
.inline-status { min-height: 20px; margin: 7px 0 0; color: #1d4ed8; font-size: 12px; }
.modal-overlay { position: fixed; inset: 0; z-index: 90; display: grid; padding: 20px; place-items: center; background: rgba(15,23,42,.42); }
.modal-overlay[hidden] { display: none; }
.confirm-dialog { width: min(420px, 100%); padding: 22px; background: #fff; border-radius: 6px; box-shadow: 0 20px 50px rgba(15,23,42,.22); }
.confirm-dialog h2 { font-size: 18px; }
.confirm-dialog p { margin: 12px 0 20px; color: #475569; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.secondary-quiet { min-width: 72px; min-height: 36px; padding: 0 14px; color: #475569; white-space: nowrap; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; }
.confirm-actions .secondary-button { min-width: 112px; white-space: nowrap; }
.objective-status { display: inline-block; padding: 3px 7px; border-radius: 3px; font-size: 12px; }
.status-未出单 { color: #64748b; background: #eef1f4; }
.status-已出单 { color: #1d4ed8; background: #eaf1ff; }
.status-持续出单 { color: #047857; background: #e5f5ef; }
.status-近期下降 { color: #9a3412; background: #fff1e8; }
.row-action { padding: 0; color: #2563eb; background: transparent; border: 0; }

.drawer-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.28); border: 0; }
.detail-drawer { position: fixed; inset: 0 0 0 auto; z-index: 60; width: min(460px, 100vw); padding: 0; background: #fff; box-shadow: -12px 0 32px rgba(15,23,42,.16); overflow-y: auto; }
.detail-drawer[hidden], .drawer-overlay[hidden] { display: none; }
body.drawer-open { overflow: hidden; }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; min-height: 70px; padding: 16px 20px; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid #e2e8f0; }
.icon-button { display: grid; width: 32px; height: 32px; padding: 0; place-items: center; color: #475569; background: #f1f5f9; border: 0; border-radius: 4px; font-size: 22px; }
.drawer-content { padding: 18px 20px 30px; }
.drawer-summary { display: grid; grid-template-columns: repeat(3, 1fr); background: #f6f8fa; }
.drawer-summary div { padding: 13px; }
.drawer-summary span, .drawer-summary strong { display: block; }
.drawer-summary span { color: #64748b; font-size: 11px; }
.drawer-summary strong { margin-top: 4px; font-size: 14px; }
.drawer-period-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 10px; background: #f8fafc; }
.drawer-period-metrics div { padding: 11px 9px; text-align: center; border-right: 1px solid #e2e8f0; }
.drawer-period-metrics div:last-child { border-right: 0; }
.drawer-period-metrics span, .drawer-period-metrics strong { display: block; }
.drawer-period-metrics span { color: #64748b; font-size: 11px; }
.drawer-period-metrics strong { margin-top: 4px; font-size: 14px; }
.drawer-period-label { color: #64748b; font-size: 11px; }
.drawer-section { padding: 20px 0; border-bottom: 1px solid #e8edf2; }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 { margin: 0 0 12px; font-size: 15px; }
.drawer-section svg { width: 100%; height: 120px; }
.detail-list { margin: 0; }
.detail-list div { display: flex; padding: 9px 0; justify-content: space-between; gap: 20px; }
.detail-list dt { color: #64748b; }
.detail-list dd { margin: 0; text-align: right; }
.neutral-pending { color: #64748b; background: #eef1f4; padding: 3px 7px; border-radius: 3px; }
.drawer-project > div:first-child { display: flex; align-items: center; gap: 8px; }
.drawer-project > div:first-child span:last-child { margin-left: auto; color: #64748b; }
.drawer-project .progress { margin-top: 10px; }
.boundary-note { margin: 10px 0 0; padding: 9px 10px; color: #64748b; background: #f1f4f7; font-size: 12px; }
.timeline div { position: relative; display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; padding: 8px 0; }
.timeline i { width: 8px; height: 8px; margin-top: 6px; background: #94a3b8; border-radius: 50%; }
.timeline time { color: #64748b; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-data-status { grid-column: 1; }
  .primary-grid, .insight-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { width: 224px; }
  .workspace { margin-left: 0; }
  .sidebar-overlay { inset: 0 0 0 224px; width: calc(100% - 224px); }
  .boot-loading { left: 0; }
}

@media (max-width: 720px) {
  .activity-item.activity-detail { grid-template-columns: 34px 1fr auto; }
  .activity-item.activity-detail time { grid-column: 2 / -1; display: flex; justify-content: space-between; text-align: left; }
  .main-content { padding: 12px 10px 0; }
  .compact-intro { align-items: flex-start; }
  .compact-intro .page-title-block { align-items: flex-start; }
  .compact-toolbar, .success-toolbar, .shops-toolbar, .customers-toolbar { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .success-period-bar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .success-period-title, .success-quick-range, .success-period-bar .filter-error { grid-column: 1 / -1; }
  .success-period-bar label { min-width: 0; }
  .success-period-bar input { width: 100%; }
  .quick-filter { grid-column: 1 / -1; }
  .quick-range { width: 100%; }
  .quick-button { min-width: 0; flex: 1; }
  .compact-toolbar label, .success-toolbar label, .shops-toolbar label, .customers-toolbar label { min-width: 0; }
  .compact-toolbar input, .compact-toolbar select, .success-toolbar input, .success-toolbar select, .shops-toolbar input, .shops-toolbar select, .customers-toolbar input, .customers-toolbar select { width: 100%; min-width: 0; }
  .sync-strip { display: grid; grid-template-columns: 1fr; gap: 6px; }
  .secondary-button { width: 100%; }
  .metric-secondary { grid-template-columns: 1fr; }
  .metric-secondary-item { padding: 14px 16px; border-right: 0; border-bottom: 1px solid #e5eaf0; }
  .metric-secondary-item:last-child { border-bottom: 0; }
  .metric-secondary-item p { min-height: 0; }
  .metric-primary { min-height: 112px; padding: 17px; }
  .metric-primary strong { font-size: 32px; }
  .success-summary { grid-template-columns: 1fr 1fr; }
  .success-summary > div:nth-child(2) { border-right: 0; }
  .success-summary > div:nth-child(-n+2) { border-bottom: 1px solid #e5eaf0; }
  .success-summary small { display: block; margin: 4px 0 0; }
  .ranking-section, .activity-section, .success-table-section { padding: 15px 12px; }
  .drawer-summary { grid-template-columns: 1fr; }
  .drawer-summary div { border-bottom: 1px solid #e2e8f0; }
  .drawer-summary div:last-child { border-bottom: 0; }
  .mode-editor { align-items: stretch; flex-direction: column; }
  .mode-editor .secondary-button { width: 100%; }
}

@media (max-width: 420px) {
  .compact-intro { display: block; }
  .compact-intro .page-meta { margin-top: 8px; align-items: flex-start; }
  .success-summary { grid-template-columns: 1fr 1fr; }
  .panel-heading, .section-heading { align-items: flex-start; }
  .segmented { flex: 0 0 auto; }
}
