/* V2.2 employee performance: compact finance workspace with the existing ERP palette. */
.epv2 {
  --ep-ink: #172b2a;
  --ep-muted: #6b7a77;
  --ep-line: #e5eae8;
  --ep-green: #087f65;
  --ep-soft: #f2f7f5;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 0 14px 18px;
  color: var(--ep-ink);
  font-family: inherit;
}
.epv2 *, .epv2 *::before, .epv2 *::after { box-sizing: border-box; }
.epv2 button, .epv2 input, .epv2 select { font: inherit; }
.epv2 button { cursor: pointer; }
.epv2 button:focus-visible, .epv2 input:focus-visible, .epv2 select:focus-visible, .epv2 a:focus-visible { outline: 3px solid #83bbaa; outline-offset: 2px; }
body:not(.auth-mode):has(#erpModuleView:not([hidden]) .epv2) .content { padding: 10px clamp(10px, 1.2vw, 22px) 14px !important; }
body:not(.auth-mode) #erpModuleView:not([hidden]):has(.epv2) { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: transparent !important; }
body:not(.auth-mode):has(#erpModuleView:not([hidden]) .epv2) #erpContext { display: none !important; }

.epv2-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 12px; }
.epv2-heading h2 { margin: 0; color: #123e35; font-size: 26px; line-height: 1.25; font-weight: 750; letter-spacing: -.025em; }
.epv2-heading p { margin: 4px 0 0; color: var(--ep-muted); font-size: 13px; }
.epv2-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.epv2-updated, .epv2-source-note { color: var(--ep-muted); font-size: 12px; white-space: nowrap; }
.epv2-source-note { display: inline-flex; align-items: center; gap: 7px; }
.epv2-state-dot { width: 7px; height: 7px; border-radius: 50%; background: #4c9179; }
.epv2-filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 0 0 13px; }
.epv2-filters label, .epv2-order-filters label { display: grid; gap: 5px; min-width: 0; color: #586965; font-size: 12px; }
.epv2-filters input, .epv2-filters select, .epv2-order-filters input, .epv2-order-filters select { width: 100%; min-width: 140px; height: 40px; padding: 0 10px; border: 1px solid #d9e3df; border-radius: 8px; background: #fff; color: var(--ep-ink); font-size: 13px; }
.epv2-filters label:first-child input { min-width: 152px; }
.epv2-filter-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.epv2-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid #cbdcd5; border-radius: 8px; background: #fff; color: #176d58; font-size: 13px; font-weight: 650; white-space: nowrap; }
.epv2-button:hover { border-color: #9cc7b8; background: #f5faf7; }
.epv2-button:disabled { opacity: .55; cursor: wait; }
.epv2-reset { min-height: 38px; color: #62736d; }
.epv2-loading-inline { margin: -5px 0 10px; color: var(--ep-muted); font-size: 12px; }

.epv2-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; margin: 0 0 8px; border: 1px solid var(--ep-line); border-radius: 12px; background: #fff; }
.epv2-kpis > div { display: flex; min-width: 0; min-height: 105px; flex-direction: column; justify-content: center; padding: 13px 18px; border-right: 1px solid var(--ep-line); }
.epv2-kpis > div:last-child { border-right: 0; }
.epv2-kpis span { color: #62716d; font-size: 12px; }
.epv2-kpis strong { margin-top: 5px; color: #263936; font-size: 25px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.epv2-kpis small { margin-top: 4px; color: var(--ep-muted); font-size: 11px; line-height: 1.4; }
.epv2-kpis .is-profit { position: relative; background: #fbfdfc; }
.epv2-kpis .is-profit::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; background: var(--ep-green); content: ''; }
.epv2-kpis .is-profit strong { color: var(--ep-green); font-size: 28px; }
.epv2-secondary { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin: 0 0 13px; padding: 8px 0; border-bottom: 1px solid var(--ep-line); color: var(--ep-muted); font-size: 12px; }
.epv2-secondary span { padding: 0 16px; border-right: 1px solid var(--ep-line); }
.epv2-secondary span:first-child { padding-left: 0; }
.epv2-secondary span:last-child { border-right: 0; }
.epv2-secondary b { margin-left: 5px; color: #354b45; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }

.epv2-panel { min-width: 0; overflow: hidden; border: 1px solid var(--ep-line); border-radius: 12px; background: #fff; }
.epv2-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--ep-line); }
.epv2-panel-head h3 { margin: 0; color: #203a34; font-size: 16px; font-weight: 700; }
.epv2-panel-head p { margin: 4px 0 0; color: var(--ep-muted); font-size: 12px; }
.epv2-count { padding: 5px 8px; border-radius: 6px; background: #f2f6f4; color: #60716b; font-size: 12px; white-space: nowrap; }
.epv2-table-wrap { overflow: auto; overscroll-behavior-x: contain; }
.epv2-table { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: 13px; }
.epv2-table th { padding: 12px 11px; border-bottom: 1px solid var(--ep-line); background: #f7f9f8; color: #5b6d67; text-align: left; font-size: 12px; font-weight: 650; white-space: nowrap; }
.epv2-table td { height: 56px; padding: 10px 11px; border-bottom: 1px solid #edf1ef; color: #293c37; white-space: nowrap; vertical-align: middle; }
.epv2-table tbody tr:last-child td { border-bottom: 0; }
.epv2-table tbody tr:hover { background: #f8fbf9; }
.epv2-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.epv2-profit { color: var(--ep-green) !important; font-weight: 700; }
.epv2-person { display: flex; align-items: center; gap: 9px; }
.epv2-person i { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 8px; background: #edf5f1; color: #286653; font-size: 12px; font-style: normal; font-weight: 700; }
.epv2-person strong { color: #203a34; font-size: 14px; }
.epv2-link { padding: 5px 0; border: 0; background: none; color: #087f65; font-size: 13px; font-weight: 650; white-space: nowrap; }
.epv2-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.epv2-sort { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.epv2-sort:hover { color: var(--ep-green); }
.epv2-table small, .epv2-subid { display: block; margin-top: 3px; color: var(--ep-muted); font-size: 11px; }
.epv2-unassigned td { background: #fcfcfb; }
.epv2-panel-foot { display: flex; justify-content: space-between; gap: 12px; padding: 9px 13px; border-top: 1px solid var(--ep-line); color: var(--ep-muted); font-size: 11px; }
.epv2-empty, .epv2-muted { padding: 28px 12px !important; color: var(--ep-muted) !important; text-align: center; }
.epv2-status { display: inline-flex; padding: 4px 7px; border-radius: 5px; font-size: 11px; white-space: nowrap; }
.epv2-status.is-ok { background: #edf5f1; color: #34705f; }
.epv2-status.is-muted { background: #f0f2f1; color: #596a64; }
.epv2-status.is-pending { background: #f7f2e9; color: #8a6a31; }
.epv2-order-filters { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--ep-line); }
.epv2-order-filters input { min-width: 210px; }
.epv2-order-filters select { min-width: 150px; }
.epv2-cancel-tag { display: inline-block; margin-left: 6px; padding: 2px 5px; border-radius: 4px; background: #f1f2f1; color: #596a64; font-size: 10px; }
.epv2-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px; border-top: 1px solid var(--ep-line); color: var(--ep-muted); font-size: 12px; }
.epv2-pagination > div { display: flex; align-items: center; gap: 9px; }
.epv2-pagination button { min-height: 34px; padding: 5px 10px; border: 1px solid var(--ep-line); border-radius: 6px; background: #fff; color: #566860; font-size: 12px; }
.epv2-pagination button:disabled { opacity: .45; cursor: not-allowed; }
.epv2-diagnostic-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid #edf1ef; }
.epv2-diagnostic-row:last-child { border-bottom: 0; }
.epv2-diagnostic-row strong { color: #374a44; font-size: 13px; }
.epv2-diagnostic-row small { display: block; margin-top: 4px; color: var(--ep-muted); font-size: 12px; }
.epv2-diagnostic-source { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 6px; }
.epv2-diagnostic-source small { color: var(--ep-muted); }
.epv2-availability-row { padding: 10px 0; border-bottom: 1px solid #edf1ef; }
.epv2-availability-row:last-child { border-bottom: 0; }
.epv2-availability-row strong { display: block; color: #465851; font-size: 12px; }
.epv2-availability-row span { display: block; margin-top: 4px; color: var(--ep-muted); font-size: 11px; line-height: 1.5; }
.epv2-inline-error { padding: 14px; border: 1px solid #e4d9cb; border-radius: 8px; background: #faf7f1; color: #795d35; font-size: 13px; }
.epv2-error { margin: 0 0 13px; padding: 10px 13px; border: 1px solid #e4d9cb; border-radius: 8px; background: #faf7f1; color: #795d35; font-size: 13px; }
.epv2-footnote { margin: 10px 0 0; color: var(--ep-muted); font-size: 11px; }
.epv2-skeleton { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--ep-line); border-radius: 12px; background: var(--ep-line); }
.epv2-skeleton i { height: 100px; background: linear-gradient(90deg, #fff 20%, #f5f8f6 45%, #fff 70%); background-size: 220% 100%; animation: epv2-shimmer 1.1s ease-in-out infinite; }
.epv2-loading-copy { color: var(--ep-muted); font-size: 12px; }
@keyframes epv2-shimmer { to { background-position-x: -220%; } }

.epv2-breadcrumb { display: flex; align-items: center; gap: 9px; min-height: 30px; margin: 0 0 10px; color: var(--ep-muted); font-size: 12px; }
.epv2-breadcrumb strong { color: #25483d; font-weight: 700; }
.epv2-breadcrumb button { padding: 0; border: 0; background: transparent; color: #087f65; font: inherit; }
.epv2-breadcrumb button:hover { text-decoration: underline; }
.epv2-selected-store { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--ep-line); color: var(--ep-muted); font-size: 12px; }
.epv2-selected-store strong { margin-left: 4px; color: var(--ep-ink); }
.epv2-employee-context, .epv2-order-context { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 12px; padding: 12px 15px; border: 1px solid var(--ep-line); border-radius: 10px; background: #fff; }
.epv2-employee-context > div:first-child { display: flex; align-items: center; gap: 12px; }
.epv2-employee-context > div:first-child small { color: var(--ep-muted); font-size: 12px; }
.epv2-compact-metrics { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.epv2-compact-metrics span { color: var(--ep-muted); font-size: 11px; }
.epv2-compact-metrics b { display: block; margin-top: 3px; color: var(--ep-ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.epv2-compact-metrics span:nth-child(3) b { color: var(--ep-green); }
.epv2-order-context > div { display: flex; align-items: baseline; gap: 12px; }
.epv2-order-context strong { color: #1d3a32; font-size: 17px; }
.epv2-order-context span { color: var(--ep-muted); font-size: 12px; }
.epv2-order-scope { white-space: nowrap; }
.epv2-table tbody tr[data-epv2-row-employee], .epv2-table tbody tr[data-epv2-row-store] { cursor: pointer; }
.epv2-table tbody tr:focus-visible { outline: 2px solid #087f65; outline-offset: -2px; }
.epv2-employee-table tbody td:first-child > button { padding: 0; border: 0; background: transparent; text-align: left; }
.epv2-drawer-backdrop { position: fixed; z-index: 10030; inset: 0; background: rgb(19 42 36 / .34); }
.epv2-drawer { position: fixed; z-index: 10031; top: 0; right: 0; bottom: 0; display: flex; width: min(520px, 94vw); flex-direction: column; overflow: auto; padding: 20px 22px; background: #fff; box-shadow: -12px 0 32px rgb(17 50 41 / .14); }
.epv2-drawer > header { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 0 14px; border-bottom: 1px solid var(--ep-line); }
.epv2-drawer h3 { margin: 0; color: #1d3a32; font-size: 20px; }
.epv2-drawer header p { margin: 4px 0 0; color: var(--ep-muted); font-size: 12px; }
.epv2-drawer section { padding: 16px 0; border-bottom: 1px solid var(--ep-line); }
.epv2-drawer h4 { display: flex; justify-content: space-between; margin: 0; color: #29463d; font-size: 14px; }
.epv2-drawer h4 span { color: var(--ep-muted); font-size: 12px; font-weight: 500; }
.epv2-icon-button { width: 34px; height: 34px; border: 1px solid var(--ep-line); border-radius: 7px; background: #fff; color: #50645d; font-size: 22px; }
.epv2-diagnostic-ok { margin: 12px 0 0; color: #476359; font-size: 13px; }
.epv2-drawer-note { margin: auto 0 0; padding-top: 16px; color: var(--ep-muted); font-size: 11px; line-height: 1.6; }

@media (min-width: 1600px) {
  .epv2-table { table-layout: auto; }
}
@media (max-width: 1100px) {
  .epv2-heading { align-items: flex-start; }
  .epv2-heading-actions { flex-wrap: wrap; }
  .epv2-kpis strong { font-size: 21px; }
  .epv2-kpis .is-profit strong { font-size: 24px; }
}
@media (max-width: 900px) {
  .epv2 { padding: 0 8px 14px; }
  body:not(.auth-mode):has(#erpModuleView:not([hidden]) .epv2) .content { padding: 9px 8px 12px !important; }
  .epv2-heading { flex-direction: column; gap: 9px; }
  .epv2-heading h2 { font-size: 23px; }
  .epv2-heading-actions { justify-content: flex-start; gap: 10px; }
  .epv2-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .epv2-filters label, .epv2-filters input, .epv2-filters select { width: 100%; min-width: 0; }
  .epv2-filter-actions { grid-column: 1 / -1; margin-left: 0; }
  .epv2-reset { justify-self: start; }
  .epv2-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .epv2-kpis > div { min-height: 92px; padding: 11px 12px; }
  .epv2-kpis > div:nth-child(2) { border-right: 0; }
  .epv2-kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--ep-line); }
  .epv2-kpis strong, .epv2-kpis .is-profit strong { font-size: clamp(18px, 5vw, 23px); }
  .epv2-secondary { gap: 6px 0; line-height: 1.6; }
  .epv2-secondary span { padding: 0 9px; }
  .epv2-panel-head { padding: 12px; }
  .epv2-panel-foot { flex-direction: column; gap: 4px; }
  .epv2-employee-context, .epv2-order-context { align-items: flex-start; flex-direction: column; gap: 10px; }
  .epv2-compact-metrics { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .epv2-order-context > div { align-items: flex-start; flex-direction: column; gap: 4px; }
  .epv2-order-scope { white-space: normal; }
  .epv2-selected-store { align-items: flex-start; flex-direction: column; }
  .epv2-drawer { padding: 16px; }
  .epv2-order-filters { align-items: stretch; }
  .epv2-order-filters label, .epv2-order-filters input, .epv2-order-filters select { width: 100%; min-width: 0; }
  .epv2-pagination { align-items: flex-start; flex-direction: column; }
  .epv2-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .epv2-employee-table { min-width: 0; }
  .epv2-employee-table thead { display: none; }
  .epv2-employee-table, .epv2-employee-table tbody { display: block; width: 100%; }
  .epv2-employee-table tbody { padding: 8px; }
  .epv2-employee-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; overflow: hidden; border: 1px solid var(--ep-line); border-radius: 9px; }
  .epv2-employee-table tbody tr:last-child { margin-bottom: 0; }
  .epv2-employee-table tbody td { display: flex; height: auto; min-height: 42px; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 9px; border-right: 0; background: #fff; text-align: right; white-space: normal; font-size: 12px; }
  .epv2-employee-table tbody td::before { flex: 0 0 auto; color: var(--ep-muted); font-size: 11px; text-align: left; }
  .epv2-employee-table tbody td:nth-child(1) { grid-column: 1 / -1; justify-content: flex-start; border-bottom: 1px solid var(--ep-line); }
  .epv2-employee-table tbody td:nth-child(1)::before { content: '员工'; }
  .epv2-employee-table tbody td:nth-child(2)::before { content: '负责店铺'; }
  .epv2-employee-table tbody td:nth-child(3)::before { content: '原始销售额'; }
  .epv2-employee-table tbody td:nth-child(4)::before { content: '订单数'; }
  .epv2-employee-table tbody td:nth-child(5)::before { content: '已核实利润'; }
  .epv2-employee-table tbody td:nth-child(6)::before { content: '待核实利润'; }
  .epv2-employee-table tbody td:nth-child(7)::before { content: '取消'; }
  .epv2-employee-table tbody td:nth-child(8)::before { content: '退货'; }
  .epv2-employee-table tbody td:nth-child(9) { grid-column: 1 / -1; }
  .epv2-employee-table tbody td:nth-child(9)::before { content: '对账进度'; }
  .epv2-employee-table tbody td:nth-child(10) { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--ep-line); }
  .epv2-employee-table tbody td:nth-child(10)::before { content: ''; }
  .epv2-employee-table .epv2-person strong { font-size: 14px; }
  .epv2-employee-table .is-num { font-size: 12px; }
  .epv2-employee-table .epv2-empty { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .epv2-skeleton i { animation: none; }
}
