/* ==========================================================================
   3012 百果园现金对账 V2 Modern Retail Fintech Design System
   ========================================================================== */

:root {
  color-scheme: light dark;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-num: "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;

  /* Theme Colors - Light */
  --bg-app: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-hover: #f1f5f9;
  --surface-modal: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #edf2f7;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  /* Brand & Semantic Palette */
  --bgy-green: #008837;
  --bgy-green-dark: #006628;
  --bgy-green-light: #10b981;
  --bgy-green-bg: #ecfdf5;
  --bgy-green-border: #a7f3d0;

  --accent-blue: #2563eb;
  --accent-blue-bg: #eff6ff;
  --accent-blue-border: #bfdbfe;

  --warn-orange: #d97706;
  --warn-orange-bg: #fffbeb;
  --warn-orange-border: #fde68a;

  --danger-red: #e11d48;
  --danger-red-bg: #fff1f2;
  --danger-red-border: #fecdd3;

  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
  --purple-border: #ddd6fe;

  /* Spacing & Sizing */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 8px 20px -4px rgba(0, 136, 55, 0.25);

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-app: #090d16;
    --surface: #131b2e;
    --surface-subtle: #1a233a;
    --surface-hover: #222d48;
    --surface-modal: #172036;
    --border: #23304d;
    --border-subtle: #1c2740;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #090d16;

    --bgy-green: #10b981;
    --bgy-green-dark: #059669;
    --bgy-green-light: #34d399;
    --bgy-green-bg: rgba(16, 185, 129, 0.15);
    --bgy-green-border: rgba(16, 185, 129, 0.3);

    --accent-blue: #3b82f6;
    --accent-blue-bg: rgba(59, 130, 246, 0.15);
    --accent-blue-border: rgba(59, 130, 246, 0.3);

    --warn-orange: #f59e0b;
    --warn-orange-bg: rgba(245, 158, 11, 0.15);
    --warn-orange-border: rgba(245, 158, 11, 0.3);

    --danger-red: #f43f5e;
    --danger-red-bg: rgba(244, 63, 94, 0.15);
    --danger-red-border: rgba(244, 63, 94, 0.3);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 8px 24px -4px rgba(16, 185, 129, 0.35);
  }
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  height: auto;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  user-select: none;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s var(--ease-smooth), opacity 0.12s var(--ease-smooth), background-color 0.15s ease;
}
button:active:not(:disabled) {
  transform: scale(0.97);
  opacity: 0.85;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Financial Tabular Numbers */
.num-tabular {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   App Shell & Layout
   ========================================================================== */
.v2-app-shell {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 96px);
  position: relative;
}

/* Header */
.v2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.v2-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  object-fit: cover;
}

.v2-brand-info h1 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-brand-info .v2-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--bgy-green-bg);
  color: var(--bgy-green);
  border: 1px solid var(--bgy-green-border);
}

.v2-brand-info p {
  font-size: 12px;
  color: var(--text-tertiary);
}

.v2-role-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.v2-role-switch.boss-active {
  background: var(--bgy-green-bg);
  color: var(--bgy-green);
  border-color: var(--bgy-green-border);
}

/* ==========================================================================
   Staff Home Single-Page Shell (整屏撑满，卡片等比拉高，消灭底部空白)
   ========================================================================== */
.v2-app-shell.home-shell {
  padding: calc(var(--safe-top) + 12px) 14px calc(var(--safe-bottom) + 16px);
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-shell .v2-header {
  margin-bottom: 14px;
  flex-shrink: 0;
}

.v2-home-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

/* 宽屏桌面浏览器：4 卡片 2x2 铺满页面，不再窝在 500px 窄列里留一大片空白。
   现金卡与月结卡本身的内容/按钮完全不变，只调整外层容器的排布方式。 */
@media (min-width: 760px) {
  .v2-app-shell.home-shell {
    max-width: 1040px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .v2-home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 16px;
  }
}

/* 4 Flat Compact Cards (方案 B：4 卡片均分撑满全屏，无空白无滚动) */
.v2-compact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.v2-compact-card:active {
  background: var(--surface-hover);
}

.v2-compact-card.card-cash {
  border-left: 4px solid var(--bgy-green);
}

.v2-compact-card.card-monthly {
  border-left: 4px solid var(--warn-orange);
}

.v2-compact-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.2;
}

.v2-compact-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-compact-card-title h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.v2-compact-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  line-height: 1.2;
}

.v2-compact-badge.cash {
  background: var(--bgy-green-bg);
  color: var(--bgy-green);
  border: 1px solid var(--bgy-green-border);
}

.v2-compact-badge.monthly {
  background: var(--warn-orange-bg);
  color: var(--warn-orange);
  border: 1px solid var(--warn-orange-border);
}

.v2-compact-subtag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-compact-subtag.entered {
  color: var(--bgy-green);
}
.v2-compact-subtag.pending {
  color: var(--text-tertiary);
}
.v2-compact-subtag.supplier {
  color: var(--warn-orange);
  font-weight: 700;
}

.v2-compact-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 10px;
}

/* Hero 区：卡片被 flex 拉高后，金额在此区域垂直居中放大展示，
   并叠加一个极淡的 ¥ 水印字符填充视觉重量，替代原来中间的大片空白。 */
.v2-compact-card-hero {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.v2-compact-card-hero::before {
  content: "¥";
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(72px, 22vw, 108px);
  font-weight: 800;
  font-family: var(--font-num);
  color: var(--bgy-green);
  opacity: 0.06;
  line-height: 1;
  pointer-events: none;
  z-index: 0;
}

.card-monthly .v2-compact-card-hero::before {
  color: var(--warn-orange);
}

.v2-compact-stats {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.v2-compact-main-stat {
  display: flex;
  flex-direction: column;
}

.v2-compact-main-stat .lbl {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 4px;
}

.v2-compact-main-stat .val {
  font-size: clamp(28px, 9vw, 38px);
  font-weight: 800;
  font-family: var(--font-num);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.v2-compact-main-stat .val.green {
  color: var(--bgy-green);
}

.v2-compact-main-stat .val.orange {
  color: var(--warn-orange);
}

.v2-compact-sec-stat {
  display: flex;
  flex-direction: column;
}

.v2-compact-sec-stat .lbl {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 4px;
}

.v2-compact-sec-stat .val {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-num);
  color: var(--text-secondary);
}

.v2-compact-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.v2-compact-btn-primary {
  height: 44px;
  padding: 0 13px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.v2-compact-btn-primary.green {
  background: var(--bgy-green);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 136, 55, 0.2);
}
.v2-compact-btn-primary.green:active {
  background: var(--bgy-green-dark);
}

.v2-compact-btn-primary.orange {
  background: #ea580c;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(234, 88, 12, 0.2);
}
.v2-compact-btn-primary.orange:active {
  background: #c2410c;
}

.v2-compact-btn-secondary {
  height: 44px;
  padding: 0 11px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.v2-compact-btn-secondary:active {
  background: var(--surface-hover);
}
.v2-compact-btn-secondary:active {
  background: var(--surface-hover);
}

/* Staff & Supplier Management Components in Boss Settings */
.v2-staff-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.v2-staff-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.v2-staff-chip .chip-btn {
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 1px 3px;
  border-radius: 4px;
}
.v2-staff-chip .chip-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.v2-supplier-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  gap: 8px;
}

/* ==========================================================================
   Store Big Modules (2 大独立门店卡片)
   ========================================================================== */
.v2-store-module {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.v2-store-module-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.v2-store-module-title {
  display: flex;
  flex-direction: column;
}

.v2-store-module-title h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.v2-store-module-title span {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-top: 2px;
}

.v2-store-status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.v2-store-status-tag.entered {
  background: var(--bgy-green-bg);
  color: var(--bgy-green);
  border: 1px solid var(--bgy-green-border);
}
.v2-store-status-tag.pending {
  background: var(--surface-subtle);
  color: var(--text-tertiary);
  border: 1px solid var(--border);
}
.v2-store-status-tag.diff {
  background: var(--danger-red-bg);
  color: var(--danger-red);
  border: 1px solid var(--danger-red-border);
}

.v2-store-main-cash {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.v2-store-main-cash span {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 2px;
}
.v2-store-main-cash strong {
  display: block;
  font-size: 32px;
  font-weight: 800;
  color: var(--bgy-green);
  font-family: var(--font-num);
  line-height: 1.1;
}

.v2-store-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 10px 10px;
  margin-bottom: 14px;
}
.v2-store-meta-item span {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
}
.v2-store-meta-item strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text-primary);
  margin-top: 2px;
}

.v2-store-module-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.v2-store-btn-entry {
  height: 42px;
  background: var(--bgy-green);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 136, 55, 0.2);
}
.v2-store-btn-entry:active {
  background: var(--bgy-green-dark);
}
.v2-store-btn-verify {
  height: 42px;
  background: var(--surface-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.v2-store-btn-verify:active {
  background: var(--surface-hover);
}

/* ==========================================================================
   Cash Counting & Entry Card (Drawer Total Calculation)
   ========================================================================== */
.v2-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  animation: v2FadeIn 0.25s var(--ease-spring);
}

.v2-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.v2-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Drawer Calculator Live Formula Box */
.v2-calc-box {
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 12px 0 16px;
}

.v2-calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.v2-calc-row:last-child {
  margin-bottom: 0;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  font-weight: 700;
  color: var(--bgy-green);
}
.v2-calc-row.result strong {
  font-size: 16px;
  font-family: var(--font-num);
}

/* Big Amount Input Form */
.v2-amount-input-wrap {
  position: relative;
  margin-bottom: 16px;
}

.v2-amount-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-tertiary);
  pointer-events: none;
}

.v2-big-input {
  width: 100%;
  height: 64px;
  padding: 0 14px 0 38px;
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-num);
  color: var(--text-primary);
  background: var(--surface-subtle);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.v2-big-input:focus {
  border-color: var(--bgy-green);
  background: var(--surface);
}

.v2-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.v2-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.v2-form-group.full-width {
  grid-column: span 2;
}

.v2-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.v2-input, .v2-select, .v2-textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.v2-textarea {
  height: 72px;
  padding: 10px 12px;
  resize: none;
}
.v2-input:focus, .v2-select:focus, .v2-textarea:focus {
  border-color: var(--bgy-green);
  background: var(--surface);
}

/* ==========================================================================
   Boss Write-Off (拿整 / 整数快捷核销)
   ========================================================================== */
.v2-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 16px;
}

.v2-quick-pills .v2-pill-btn {
  flex: 1;
  min-width: 52px;
  height: 36px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-num);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.v2-quick-pills .v2-pill-btn.all-btn {
  flex: 1.4;
  min-width: 96px;
}

.v2-pill-btn.active, .v2-pill-btn:active {
  background: var(--bgy-green-bg);
  border-color: var(--bgy-green);
  color: var(--bgy-green);
}

/* Write-off Preview Impact Banner */
.v2-impact-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
}
.v2-impact-item span {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
}
.v2-impact-item strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text-primary);
}
.v2-impact-item strong.danger {
  color: var(--danger-red);
}
.v2-impact-item strong.success {
  color: var(--bgy-green);
}

/* ==========================================================================
   Dual-Track Reconciliation Card (员工实录 vs ERP系统抓取)
   ========================================================================== */
.v2-recon-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.v2-recon-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.v2-recon-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-recon-status {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}
.v2-recon-status.matched {
  background: var(--bgy-green-bg);
  color: var(--bgy-green);
  border: 1px solid var(--bgy-green-border);
}
.v2-recon-status.diff {
  background: var(--danger-red-bg);
  color: var(--danger-red);
  border: 1px solid var(--danger-red-border);
}
.v2-recon-status.pending {
  background: var(--warn-orange-bg);
  color: var(--warn-orange);
  border: 1px solid var(--warn-orange-border);
}

.v2-recon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
}

.v2-recon-col span {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
}
.v2-recon-col strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-num);
  margin-top: 2px;
}

/* ==========================================================================
   Ledger & Flow Timeline
   ========================================================================== */
.v2-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.v2-flow-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.v2-flow-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.v2-flow-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.v2-flow-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.v2-flow-badge.in {
  background: var(--bgy-green-bg);
  color: var(--bgy-green);
}
.v2-flow-badge.out {
  background: var(--accent-blue-bg);
  color: var(--accent-blue);
}

.v2-flow-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v2-flow-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
  white-space: nowrap;
}

.v2-flow-right {
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}
.v2-flow-right strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-num);
  white-space: nowrap;
}
.v2-flow-right strong.in {
  color: var(--bgy-green);
}
.v2-flow-right strong.out {
  color: var(--danger-red);
}

.v2-flow-breakdown {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-all;
}

/* ==========================================================================
   Buttons & Primary Action
   ========================================================================== */
.v2-btn-primary {
  width: 100%;
  height: 48px;
  background: var(--bgy-green);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 136, 55, 0.25);
}
.v2-btn-primary:active:not(:disabled) {
  background: var(--bgy-green-dark);
}

.v2-btn-ghost {
  width: 100%;
  height: 44px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.v2-btn-danger {
  background: var(--danger-red-bg);
  color: var(--danger-red);
  border: 1px solid var(--danger-red-border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ==========================================================================
   Bottom Navigation Dock (Mobile Thumb Zone)
   ========================================================================== */
.v2-bottom-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 990;
  padding: 6px 8px calc(var(--safe-bottom) + 6px);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
  display: flex;
  justify-content: center;
}

.v2-dock-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 2px;
}
.v2-dock-container.five-tabs,
.v2-dock-container.six-tabs {
  display: flex;
  justify-content: space-around;
}
.v2-dock-container.six-tabs .v2-dock-label {
  font-size: 10px;
}
.v2-dock-container.six-tabs .v2-dock-icon {
  font-size: 18px;
}

/* Monthly Settlement Styling */
.v2-supplier-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.v2-supplier-filter-bar::-webkit-scrollbar {
  display: none;
}
.v2-supplier-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.v2-supplier-pill:hover {
  background: var(--surface);
  color: var(--text-primary);
}
.v2-supplier-pill.active {
  background: var(--bgy-green);
  border-color: var(--bgy-green);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 136, 55, 0.25);
}

.v2-monthly-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.v2-monthly-thumb:active {
  transform: scale(0.95);
}

.v2-monthly-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.v2-monthly-badge.pending {
  background: #fff1f0;
  color: #cf1322;
  border: 1px solid #ffa39e;
}
.v2-monthly-badge.verified {
  background: #f6ffed;
  color: #389e0d;
  border: 1px solid #b7eb8f;
}


.v2-dock-item {
  flex: 1;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 4px 0;
  color: #8c8c8c;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.v2-dock-item:active {
  transform: scale(0.92);
}
.v2-dock-item.active {
  color: #008837 !important;
}
.v2-dock-icon {
  font-size: 20px;
  line-height: 1.1;
  margin-bottom: 2px;
  display: block;
  transition: transform 0.15s ease;
}
.v2-dock-item.active .v2-dock-icon {
  transform: scale(1.12);
}
.v2-dock-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.2px;
  white-space: nowrap;
  display: block;
}
.v2-dock-item.active .v2-dock-label {
  font-weight: 700;
  color: #008837;
}

/* ==========================================================================
   Modals & Toast
   ========================================================================== */
.v2-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: v2FadeIn 0.2s ease;
}

.v2-modal-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--surface-modal);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid var(--border);
  padding: 20px 20px calc(var(--safe-bottom) + 20px);
  box-shadow: var(--shadow-lg);
  animation: v2SlideUp 0.28s var(--ease-spring);
  max-height: 85vh;
  overflow-y: auto;
}

/* 小票原图全屏查看器：此前完全没有样式定义，弹出来是未定位的裸元素，图片按原始
   像素尺寸顶出屏幕；补齐全屏深色背景 + 居中约束图片。 */
.v2-photo-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 12, 20, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 14px);
  animation: v2FadeIn 0.2s ease;
}

.v2-photo-viewer-img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: #0f172a;
}

.v2-photo-viewer-bar {
  width: 100%;
  max-width: 500px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

/* 生成的对账单截图是固定像素宽度的 canvas 图片，此前没有任何 CSS 约束，
   会按原始像素宽度整张顶出屏幕右侧；改成跟随弹窗宽度等比缩放。 */
.v2-bill-preview-box {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.v2-bill-preview-box img {
  display: block;
  width: 100%;
  height: auto;
  -webkit-touch-callout: default !important;
  user-select: auto !important;
  pointer-events: auto !important;
}

.v2-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.v2-modal-head h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.v2-toast {
  position: fixed;
  top: calc(var(--safe-top) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 9999;
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s var(--ease-spring), opacity 0.25s ease;
}
.v2-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.v2-toast.err {
  background: var(--danger-red);
  color: #ffffff;
}

/* Animations */
@keyframes v2FadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes v2SlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ==========================================================================
   Boss Control Center (老板管理端专属样式)
   ========================================================================== */
.v2-boss-badge {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-boss-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.v2-boss-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.v2-boss-stat-card span {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
}
.v2-boss-stat-card strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-num);
  margin-top: 4px;
}

/* Daily Report Card for Boss */
.v2-daily-report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.v2-daily-report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.v2-daily-report-head h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.v2-report-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.v2-report-data-item span {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
}
.v2-report-data-item strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-num);
}

.v2-copy-report-btn {
  width: 100%;
  height: 36px;
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.v2-copy-report-btn:active {
  background: var(--bgy-green-bg);
  border-color: var(--bgy-green);
  color: var(--bgy-green);
}

/* Accordion for Monthly Ledgers */
.v2-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-bottom: 10px;
  overflow: hidden;
}
.v2-accordion summary {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--surface-subtle);
}
.v2-accordion summary::-webkit-details-marker {
  display: none;
}
.v2-accordion-content {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* Edit Tag Badge */
.v2-edit-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--warn-orange);
  background: var(--warn-orange-bg);
  border: 1px solid var(--warn-orange-border);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

/* 4-column Month Grid (No horizontal scrolling) */
.v2-month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.v2-month-pill {
  width: 100%;
  height: 32px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.v2-month-pill.active {
  background: var(--bgy-green-bg);
  border-color: var(--bgy-green);
  color: var(--bgy-green);
  font-weight: 700;
}
