/* ===== Base Layout & Common Components (#1) ===== */
:root {
      --bg: #f4f6f9;
      --card: #ffffff;
      --text: #1f2937;
      --muted: #6b7280;
      --border: #e5e7eb;
      --primary: #1f4e78;
      --primary-hover: #163a59;
      --accent: #2563eb;
      --green-bg: #dcfce7;
      --green-fg: #166534;
      --amber-bg: #fef3c7;
      --amber-fg: #92400e;
      --red-bg: #fee2e2;
      --red-fg: #991b1b;
      --blue-bg: #dbeafe;
      --blue-fg: #1e40af;
      --gray-bg: #f3f4f6;
      --gray-fg: #374151;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.5;
    }
    a { color: var(--accent); text-decoration: none; }
    a:hover { text-decoration: underline; }
    .topbar {
      background: var(--primary);
      color: #fff;
      padding: 12px 20px;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .topbar-brand { font-size: 17px; font-weight: 700; color: #fff; text-decoration: none; }
    .topbar-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 14px; }
    .topbar-nav a { color: #e5e7eb; text-decoration: none; padding: 4px 8px; border-radius: 6px; }
    .topbar-nav a:hover, .topbar-nav a.active { background: rgba(255,255,255,0.16); color: #fff; }
    .topbar-nav a.topbar-nav-link { position: relative; display: inline-flex; align-items: center; }
    .nav-notify-badge {
      position: absolute;
      top: -6px;
      right: -9px;
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border-radius: 999px;
      background: #ef4444;
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      line-height: 18px;
      text-align: center;
      box-shadow: 0 0 0 1.5px var(--primary);
      font-variant-numeric: tabular-nums;
      pointer-events: none;
    }
    .topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #dbeafe; }
    .container { max-width: 1260px; margin: 20px auto; padding: 0 16px 40px; }
    .container-wide { max-width: 1040px; margin: 20px auto; padding: 0 16px 40px; }
    .container-mid { max-width: 740px; margin: 26px auto; padding: 0 16px 40px; }
    .container-narrow { max-width: 520px; margin: 32px auto; padding: 0 16px; }
    .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 20px;
      margin-bottom: 18px;
      box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    }
    .card-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; color: var(--primary); }
    .alert {
      padding: 12px 16px;
      border-radius: 8px;
      margin-bottom: 16px;
      font-size: 14px;
      white-space: normal;
      line-height: 1.5;
    }
    .alert-pre { white-space: pre-wrap; }
    .alert-compact {
      display: block;
      width: fit-content;
      max-width: 100%;
      padding: 9px 14px;
      font-size: 13px;
    }
    .alert-ok { background: var(--green-bg); color: var(--green-fg); border: 1px solid #bbf7d0; }
    .alert-err { background: var(--red-bg); color: var(--red-fg); border: 1px solid #fecaca; }
    .alert-warn { background: var(--amber-bg); color: var(--amber-fg); border: 1px solid #fde68a; }
    .form-group { margin-bottom: 14px; }
    .form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
    .form-control, select.form-control, textarea.form-control {
      width: 100%;
      padding: 9px 12px;
      border: 1px solid #d1d5db;
      border-radius: 7px;
      font-size: 14px;
      background: #fff;
      color: var(--text);
    }
    .form-control[readonly] { background: #f9fafb; color: #4b5563; }
    .form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 9px 16px;
      border-radius: 7px;
      border: 1px solid transparent;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      text-decoration: none;
      background: var(--primary);
      color: #fff;
    }
    .btn:hover { background: var(--primary-hover); text-decoration: none; }
    .btn-sm { padding: 5px 10px; font-size: 12px; }
    .btn-outline { background: #fff; color: var(--primary); border-color: #cbd5e1; }
    .btn-outline:hover { background: #f8fafc; }
    .btn-success { background: #15803d; color: #fff; }
    .btn-success:hover { background: #166534; }
    .btn-danger { background: #b91c1c; color: #fff; }
    .btn-danger:hover { background: #991b1b; }
    .btn-amber { background: #d97706; color: #fff; }
    .btn-amber:hover { background: #b45309; }
    .btn-audit-only { background: #4f46e5; color: #fff; }
    .btn-audit-only:hover { background: #4338ca; }
    .btn:disabled { opacity: 0.45; cursor: not-allowed; }
    .badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 600;
      white-space: nowrap;
    }
    .badge-green { background: var(--green-bg); color: var(--green-fg); }
    .badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
    .badge-red { background: var(--red-bg); color: var(--red-fg); }
    .badge-blue { background: var(--blue-bg); color: var(--blue-fg); }
    .badge-gray { background: var(--gray-bg); color: var(--gray-fg); }
    .badge-slate { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
    .card-no-boss-pay { border-left: 4px solid #6366f1; background: #fafbff; }
    .boss-split-grid { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
    .boss-split-item { display: flex; flex-direction: column; gap: 2px; }
    .boss-split-divider { padding-left: 16px; border-left: 1px solid #cbd5e1; }
    @media (max-width: 640px) {
      .boss-split-grid { flex-direction: column; align-items: stretch; gap: 10px; }
      .boss-split-divider { padding-left: 0; border-left: none; padding-top: 10px; border-top: 1px solid #cbd5e1; }
    }
    .boss-kpi-grid { display: grid; grid-template-columns: 1.45fr 1fr 1fr; gap: 12px; }
    @media (max-width: 760px) {
      .boss-kpi-grid { grid-template-columns: 1fr; }
    }
    .boss-kpi-card {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 12px 14px;
      border-radius: 9px;
      border: 1px solid var(--border);
      background: #f8fafc;
      color: var(--text);
      text-decoration: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    }
    .boss-kpi-card:hover {
      text-decoration: none;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
      transform: translateY(-1px);
    }
    .boss-kpi-card.is-boss { background: #f0fdf4; border-color: #bbf7d0; }
    .boss-kpi-card.is-boss:hover { border-color: #86efac; }
    .boss-kpi-card.is-unpaid { background: #fffbeb; border: 1.5px solid #f59e0b; box-shadow: 0 2px 8px rgba(217, 119, 6, 0.10); }
    .boss-kpi-card.is-unpaid:hover { border-color: #d97706; }
    .boss-kpi-card.is-unpaid .boss-kpi-title { color: #92400e; }
    .boss-kpi-card.is-unpaid .boss-kpi-val { font-size: 26px; color: #b45309; }
    .boss-kpi-card.is-settled { background: #f0fdf4; border: 1.5px solid #86efac; }
    .boss-kpi-card.is-settled:hover { border-color: #4ade80; }
    .boss-kpi-card.is-settled .boss-kpi-title { color: #166534; }
    .boss-kpi-card.is-settled .boss-kpi-val { font-size: 24px; color: #15803d; }
    .boss-kpi-card.is-other { background: #eef2ff; border-color: #c7d2fe; }
    .boss-kpi-card.is-other:hover { border-color: #a5b4fc; }
    .boss-kpi-card.is-all { background: #f8fafc; border-color: #cbd5e1; }
    .boss-kpi-card.is-other .boss-kpi-val, .boss-kpi-card.is-all .boss-kpi-val { font-size: 18px; }
    .boss-kpi-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
    .boss-kpi-hint { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: rgba(180, 83, 9, 0.12); color: #92400e; white-space: nowrap; }
    .boss-kpi-title { font-size: 12.5px; font-weight: 600; color: var(--muted); }
    .boss-kpi-card.is-other .boss-kpi-title { color: #4338ca; }
    .boss-kpi-val { font-size: 21px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
    .boss-kpi-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }
    .boss-nav-amt { display: inline-block; margin-left: 5px; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; background: #fef3c7; color: #b45309; }
    .btn:not(.btn-outline) .boss-nav-amt { background: rgba(255, 255, 255, 0.22); color: #fff; }
    .boss-nav-ok { display: inline-block; margin-left: 5px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--green-bg); color: var(--green-fg); }
    .btn:not(.btn-outline) .boss-nav-ok { background: rgba(255, 255, 255, 0.22); color: #fff; }
    .boss-pay-hero {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 16px 18px;
      border-radius: 10px;
      border: 1.5px solid var(--border);
      background: #f8fafc;
    }
    .boss-pay-hero.is-unpaid { background: #fffbeb; border-color: #f59e0b; box-shadow: 0 2px 8px rgba(217, 119, 6, 0.10); }
    .boss-pay-hero.is-unpaid .boss-kpi-title { color: #92400e; font-size: 13.5px; }
    .boss-pay-hero.is-unpaid .boss-kpi-val { font-size: 28px; color: #b45309; }
    .boss-pay-hero.is-settled { background: #f0fdf4; border-color: #86efac; }
    .boss-pay-hero.is-settled .boss-kpi-title { color: #166534; font-size: 13.5px; }
    .boss-pay-hero.is-settled .boss-kpi-val { font-size: 26px; color: #15803d; }
    .boss-pay-pending-tip {
      margin-top: 4px;
      padding-top: 8px;
      border-top: 1px dashed rgba(148, 163, 184, 0.45);
      font-size: 12.5px;
      color: var(--text);
    }
    .boss-scope-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
    @media (max-width: 760px) {
      .boss-scope-grid { grid-template-columns: 1fr; }
    }
    .boss-scope-card {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 12px 14px;
      border-radius: 9px;
      border: 1.5px solid var(--border);
      background: #f8fafc;
      color: var(--text);
      text-decoration: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    }
    .boss-scope-card:hover {
      text-decoration: none;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
      transform: translateY(-1px);
    }
    .boss-scope-card.is-all { background: #f8fafc; border-color: #cbd5e1; }
    .boss-scope-card.is-all.is-active { background: #eff6ff; border-color: var(--primary); box-shadow: 0 2px 8px rgba(31, 78, 120, 0.12); }
    .boss-scope-card.is-boss { background: #fffbeb; border-color: #fde68a; }
    .boss-scope-card.is-boss.is-active { background: #fef3c7; border-color: #d97706; box-shadow: 0 2px 8px rgba(217, 119, 6, 0.14); }
    .boss-scope-card.is-other { background: #eef2ff; border-color: #c7d2fe; }
    .boss-scope-card.is-other.is-active { background: #e0e7ff; border-color: #4f46e5; box-shadow: 0 2px 8px rgba(79, 70, 229, 0.14); }
    .boss-scope-sub { font-size: 12px; color: var(--muted); line-height: 1.4; font-variant-numeric: tabular-nums; }
    .table-wrap { overflow-x: auto; }
    table { width: 100%; border-collapse: collapse; font-size: 13px; }
    th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
    th { background: #f8fafc; font-weight: 700; color: #374151; white-space: nowrap; }
    .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    @media (max-width: 820px) {
      .grid-2, .grid-4 { grid-template-columns: 1fr; }
    }
    .kpi { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
    .kpi-label { font-size: 12px; color: var(--muted); }
    .kpi-val { font-size: 20px; font-weight: 700; color: var(--primary); margin-top: 2px; }
    /* 通用高清看图弹窗（电脑滚轮/拖拽/双击 + 手机双指捏合/单指拖动/左右切图） */
    .iv-modal {
      display: none;
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100vh;
      height: 100dvh;
      z-index: 9999;
      background: rgba(15, 23, 42, 0.94);
      flex-direction: column;
      overscroll-behavior: contain;
      -webkit-tap-highlight-color: transparent;
    }
    .iv-modal.open { display: flex; }
    .iv-topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 14px;
      color: #f8fafc;
      font-size: 13px;
      background: rgba(15, 23, 42, 0.72);
      flex-shrink: 0;
      z-index: 2;
    }
    .iv-caption {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      flex: 1;
      min-width: 0;
      font-weight: 600;
    }
    .iv-zoom-pill {
      background: rgba(255, 255, 255, 0.16);
      color: #fff;
      padding: 3px 9px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 700;
      flex-shrink: 0;
      min-width: 48px;
      text-align: center;
    }
    .iv-close-x {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: 1px solid rgba(255, 255, 255, 0.3);
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      padding: 0;
    }
    .iv-close-x:hover { background: rgba(255, 255, 255, 0.24); }
    .iv-stage {
      flex: 1;
      min-width: 0;
      min-height: 0;
      position: relative;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
      touch-action: none;
      user-select: none;
      -webkit-user-select: none;
      cursor: zoom-in;
    }
    .iv-stage.zoomed { cursor: grab; }
    .iv-stage.dragging { cursor: grabbing; }
    .iv-img {
      display: block;
      flex-shrink: 0;
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      background: #fff;
      border-radius: 6px;
      box-shadow: 0 12px 36px rgba(0, 0, 0, 0.48);
      transform-origin: center center;
      will-change: transform;
      pointer-events: none;
      -webkit-user-drag: none;
    }
    .iv-img.smooth { transition: transform 0.16s ease-out; }
    .iv-footer {
      flex-shrink: 0;
      padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      background: rgba(15, 23, 42, 0.78);
      z-index: 2;
    }
    .iv-toolbar {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      gap: 6px;
    }
    .iv-btn {
      min-height: 36px;
      min-width: 38px;
      padding: 6px 11px;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.26);
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
    }
    .iv-btn:hover { background: rgba(255, 255, 255, 0.24); }
    .iv-btn-close { background: #b91c1c; border-color: #dc2626; }
    .iv-btn-close:hover { background: #991b1b; }
    .iv-hint {
      font-size: 11px;
      color: rgba(226, 232, 240, 0.74);
      text-align: center;
    }
    @media (max-width: 600px) {
      .iv-btn { padding: 6px 9px; font-size: 12px; min-height: 38px; }
    }

/* ===== Staff Upload Page (#1) ===== */
.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 9px;
    background: #f8fafc;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
  }
  .upload-dropzone:hover,
  .upload-dropzone.dragover {
    border-color: var(--accent);
    background: #eff6ff;
  }
  .upload-dropzone.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
  }
  .upload-dropzone-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
  }
  .upload-dropzone-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
  }
  .preview-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 13px;
  }
  .thumb-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
  @media (max-width: 480px) {
    .thumb-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
  .thumb-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #f3f4f6;
  }
  .thumb-item.is-similar {
    border: 2px solid #d97706;
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.35);
  }
  .thumb-item.is-hist-dup {
    border: 2px solid #dc2626;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35);
  }
  .thumb-item.has-dup-tag .thumb-seq {
    top: 4px;
    left: 4px;
    bottom: auto;
  }
  .thumb-dup-tag {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px 4px;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: #fff;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .thumb-dup-tag.is-similar {
    background: rgba(217, 119, 6, 0.92);
  }
  .thumb-dup-tag.is-hist-dup {
    background: rgba(220, 38, 38, 0.92);
  }
  .thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
  }
  .thumb-heic {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    text-align: center;
    background: #eff6ff;
    color: var(--primary);
    font-size: 11px;
    line-height: 1.35;
    font-weight: 600;
  }
  .xlsx-file-card {
    grid-column: 1 / -1;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 38px 12px 14px;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
  }
  .xlsx-file-badge {
    flex-shrink: 0;
    padding: 5px 9px;
    border-radius: 6px;
    background: #15803d;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
  }
  .thumb-seq {
    position: absolute;
    left: 5px;
    bottom: 5px;
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    pointer-events: none;
  }
  .thumb-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  .thumb-del:hover {
    background: #dc2626;
  }
  .upload-progress-box {
    margin: 8px 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
  }
  .upload-progress-box.saving {
    border-color: #93c5fd;
    background: #eff6ff;
  }
  .upload-progress-box.done {
    border-color: #bbf7d0;
    background: #f0fdf4;
  }
  .upload-progress-box.err {
    border-color: #fecaca;
    background: #fef2f2;
  }
  .upload-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
  }
  .upload-progress-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    min-width: 0;
  }
  .upload-progress-box.done .upload-progress-text {
    color: #15803d;
  }
  .upload-progress-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
  }
  .upload-progress-box.done .upload-progress-pct {
    color: #15803d;
  }
  .upload-progress-cancel {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    padding: 2px 8px;
    cursor: pointer;
  }
  .upload-progress-cancel:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
  }
  .upload-progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.28);
    overflow: hidden;
  }
  .upload-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transition: width 0.14s linear;
  }
  .upload-progress-box.saving .upload-progress-fill {
    background-image: linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.28) 25%,
      transparent 25%,
      transparent 50%,
      rgba(255, 255, 255, 0.28) 50%,
      rgba(255, 255, 255, 0.28) 75%,
      transparent 75%,
      transparent
    );
    background-size: 20px 20px;
    background-color: #2563eb;
    animation: upStripe 0.8s linear infinite;
  }
  .upload-progress-box.done .upload-progress-fill {
    background: #16a34a;
    animation: none;
  }
  @keyframes upStripe {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
  }
  .upload-progress-sub {
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .thumb-grid.is-uploading .thumb-del {
    display: none;
  }
  .thumb-up-mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
  }
  .thumb-grid.is-uploading .thumb-up-mask {
    display: flex;
  }
  .thumb-up-mask.state-wait {
    background: rgba(15, 23, 42, 0.42);
  }
  .thumb-up-mask.state-uploading {
    background: rgba(15, 23, 42, 0.28);
  }
  .thumb-up-mask.state-done,
  .thumb-up-mask.state-existing {
    background: transparent;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 4px;
  }
  .thumb-up-tag {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(15, 23, 42, 0.78);
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
  }
  .thumb-up-mask.state-done .thumb-up-tag {
    background: #16a34a;
  }
  .thumb-up-mask.state-existing .thumb-up-tag {
    background: rgba(30, 64, 175, 0.86);
  }
  .thumb-up-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.35);
  }
  .thumb-up-mask.state-existing .thumb-up-bar {
    display: none;
  }
  .thumb-up-bar-fill {
    height: 100%;
    width: 0%;
    background: #3b82f6;
    transition: width 0.12s linear;
  }
  .thumb-up-mask.state-done .thumb-up-bar-fill {
    background: #16a34a;
  }

/* ===== Staff My Batches Page (#1) ===== */
.rb-card { padding: 16px 18px; margin-bottom: 12px; }
  .rb-row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  .rb-store { font-size: 16px; font-weight: 700; color: var(--text); }
  .rb-date { font-size: 13px; color: var(--muted); margin-left: 6px; font-weight: 400; }
  .rb-amt { font-size: 19px; font-weight: 700; white-space: nowrap; }
  .rb-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
  .rb-state { margin-top: 10px; font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 7px; }
  .rb-ok { background: var(--green-bg); color: var(--green-fg); }
  .rb-wait { background: var(--amber-bg); color: var(--amber-fg); }
  .rb-run { background: var(--blue-bg); color: var(--blue-fg); }
  .rb-bad { background: var(--red-bg); color: var(--red-fg); }
  .rb-gray { background: var(--gray-bg); color: var(--gray-fg); }
  .rb-actions { display: flex; gap: 8px; margin-top: 12px; }
  .rb-actions .btn, .rb-actions form { flex: 1; margin: 0; }
  .rb-actions form .btn { width: 100%; }
  .sum-card { padding: 15px 18px; margin-bottom: 14px; background: #f8fafc; border-color: #dbeafe; }
  .sum-nums { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; margin-top: 8px; }
  .sum-chip { display: inline-block; font-size: 12.5px; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; margin: 4px 6px 0 0; }
  .sum-chip strong { color: var(--text); font-variant-numeric: tabular-nums; }
  .src-tag { font-size: 11px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }

/* ===== Admin Dashboard & Calendar (#1) ===== */
.ltbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  .ltbl th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    text-align: left;
  }
  .ltbl td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
  }
  .ltbl tbody tr.ltbl-main:hover { background: #f8fafc; }
  .ltbl tr.is-paid td { color: #64748b; }
  .ltbl .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .ltbl .ctr { text-align: center; white-space: nowrap; }
  .ltbl tfoot td {
    background: #f1f5f9;
    font-weight: 700;
    border-top: 2px solid #cbd5e1;
    border-bottom: none;
    color: var(--text);
  }
  .ltbl-sub-cell {
    background: #f8fafc;
    padding: 10px 16px 12px 32px !important;
    border-bottom: 1px solid #e2e8f0;
  }
  .ltbl-sub { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; }
  .ltbl-sub th { background: #f1f5f9; padding: 6px 10px; font-weight: 600; color: #475569; border-bottom: 1px solid #e2e8f0; }
  .ltbl-sub td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; }
  .ltbl-sub tr:last-child td { border-bottom: none; }
  .vtab-bar { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
  .vtab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 6px 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
  }
  .vtab:hover { color: var(--text); }
  .vtab.active { color: var(--primary); border-bottom-color: var(--primary); }
  .l-link-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--accent);
  }
  .l-link-btn:hover { text-decoration: underline; }

/* ===== Admin Dashboard & Calendar (#2) ===== */
.wx-cal-wrap { position: relative; display: inline-flex; align-items: center; }
.wx-cal-trigger {
  width: auto; min-width: 132px; padding: 6px 10px; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; background: #fff; color: var(--text); text-align: left;
  font-variant-numeric: tabular-nums;
}
.wx-cal-trigger.is-active { border-color: var(--primary); background: #eff6ff; font-weight: 600; color: var(--primary); }
.wx-cal-ico { font-size: 13px; opacity: 0.72; line-height: 1; }
.wx-cal-pop {
  display: none; position: fixed; z-index: 9998; width: 286px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16); padding: 14px 14px 10px;
  user-select: none;
}
.wx-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 12px; }
.wx-cal-sel-group { display: flex; align-items: center; gap: 6px; flex: 1; }
.wx-cal-sel {
  border: 1px solid #e2e8f0; border-radius: 7px; padding: 4px 8px; font-size: 13px;
  font-weight: 600; color: #111827; background: #f8fafc; cursor: pointer;
}
.wx-cal-nav {
  width: 28px; height: 28px; border: 1px solid #e2e8f0; border-radius: 7px;
  background: #fff; color: #475569; cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.wx-cal-nav:hover { background: #f1f5f9; color: #111827; }
.wx-cal-wk {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: 12px; color: #94a3b8; margin-bottom: 6px;
}
.wx-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.wx-cal-day {
  height: 36px; border: none; border-radius: 8px; background: transparent;
  font-size: 14px; font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 0; position: relative;
}
.wx-cal-day.is-enabled { color: #111827; font-weight: 600; cursor: pointer; }
.wx-cal-day.is-enabled:hover { background: #eff6ff; color: #1d4ed8; }
.wx-cal-day.is-enabled::after {
  content: ''; width: 4px; height: 4px; border-radius: 50%; background: #10b981; display: block;
}
.wx-cal-day.is-selected { background: #2563eb !important; color: #fff !important; font-weight: 700; }
.wx-cal-day.is-selected::after { background: #fff; }
.wx-cal-day.is-disabled { color: #cbd5e1; font-weight: 400; cursor: default; }
.wx-cal-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 8px; border-top: 1px solid #f1f5f9; font-size: 12.5px;
}
.wx-cal-foot-btn {
  border: none; background: transparent; color: #2563eb; cursor: pointer; padding: 3px 6px; border-radius: 5px; font-size: 12.5px;
}
.wx-cal-foot-btn:hover:not(:disabled) { background: #eff6ff; }
.wx-cal-foot-btn:disabled { color: #cbd5e1; cursor: default; }

/* ===== Admin Batch Detail Page (#1) ===== */
.photo-thumb-lg {
    width: 96px;
    height: 122px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    cursor: zoom-in;
    background: #f8fafc;
    flex-shrink: 0;
  }
  .photo-thumb-sm {
    width: 48px;
    height: 60px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: zoom-in;
    background: #f8fafc;
    flex-shrink: 0;
  }
  .edit-grid-3 {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 1.2fr;
    gap: 8px;
    margin-top: 10px;
  }
  @media (max-width: 600px) {
    .edit-grid-3 { grid-template-columns: 1fr; }
  }
  .mini-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 3px;
  }
  .mini-ctrl {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
  }
  .mini-ctrl:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
  }
  .voucher-row-err {
    background: #fef2f2;
    box-shadow: inset 3px 0 0 #dc2626;
    border-radius: 8px;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .voucher-err-msg {
    display: none;
    margin-top: 6px;
    font-size: 12px;
    color: #b91c1c;
    font-weight: 600;
  }
  .voucher-hint-msg {
    display: none;
    margin-top: 5px;
    font-size: 12px;
    color: #15803d;
  }
  .chip-btn {
    padding: 4px 9px;
    font-size: 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: var(--text);
    cursor: pointer;
  }
  .chip-btn:hover {
    background: #e2e8f0;
  }

  /* ===== Admin Stores Clean Table ===== */
  .store-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
  }
  .store-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .store-filter-pill {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
  }
  .store-filter-pill:hover {
    background: #f8fafc;
    border-color: #94a3b8;
  }
  .store-filter-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }
  .store-pay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }
  .store-pay-btn.is-boss {
    background: #fff;
    color: #166534;
    border: 1px solid #bbf7d0;
  }
  .store-pay-btn.is-boss:hover {
    background: #f0fdf4;
    border-color: #86efac;
  }
  .store-pay-btn.is-other {
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
  }
  .store-pay-btn.is-other:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
  }
  .store-row-inactive {
    opacity: 0.62;
    background: #f8fafc;
  }
  .store-add-drawer {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  /* ===== Admin View-As Bar, Tab Amount Pill & Copy Feedback ===== */
  .viewas-bar {
    position: sticky;
    top: 0;
    z-index: 950;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 9px 18px;
    font-size: 13px;
    border-bottom: 1px solid transparent;
  }
  .viewas-bar.is-ro {
    background: #eff6ff;
    color: #1e3a8a;
    border-bottom-color: #93c5fd;
  }
  .viewas-bar.is-rw {
    background: #fff1f2;
    color: #9f1239;
    border-bottom-color: #fda4af;
  }
  .viewas-info {
    line-height: 1.4;
  }
  .viewas-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .viewas-select,
  .topbar-viewas-select {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12.5px;
    max-width: 210px;
    cursor: pointer;
  }
  .viewas-select {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--text);
  }
  .topbar-viewas-select {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(15, 23, 42, 0.25);
    color: #fff;
  }
  .topbar-viewas-select option,
  .topbar-viewas-select optgroup {
    color: var(--text);
    background: #fff;
  }
  .viewas-unlock-btn {
    background: #d97706;
    color: #fff;
    border-color: #d97706;
  }
  .viewas-unlock-btn:hover {
    background: #b45309;
  }
  .viewas-lock-btn {
    background: #1f4e78;
    color: #fff;
    border-color: #1f4e78;
  }
  .viewas-exit-btn {
    background: #fff;
    color: var(--text);
    border-color: #cbd5e1;
  }
  .viewas-exit-btn:hover {
    background: #f1f5f9;
  }
  .admin-tab-amt {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: rgba(31, 78, 120, 0.10);
    color: var(--primary);
  }
  .btn:not(.btn-outline) .admin-tab-amt {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
  }
  .admin-summary-box {
    margin-bottom: 14px;
    padding: 11px 15px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.7;
  }
  .copy-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translate(-50%, -14px);
    z-index: 10050;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-width: 90vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .copy-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  .copy-fallback-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(15, 23, 42, 0.65);
    align-items: center;
    justify-content: center;
    padding: 16px;
  }
  .copy-fallback-box {
    background: #fff;
    border-radius: 10px;
    padding: 18px 20px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  }

  .site-beian-footer {
    text-align: center;
    padding: 8px 16px 26px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.7;
  }
  .site-beian-footer a {
    color: var(--muted);
    text-decoration: none;
  }
  .site-beian-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
  }
  .site-beian-footer .beian-sep {
    margin: 0 8px;
    color: #cbd5e1;
  }
