/* ==========================================================================
   网点业绩管理平台 — Private Banking Executive Theme (深海墨金 · 象牙瓷白)
   ========================================================================== */

:root {
  /* Sovereign Navy & Champagne Gold Palette */
  --navy-950: #081121;
  --navy-900: #0c182d;
  --navy-800: #132340;
  --navy-700: #1d355d;
  --navy-600: #294675;

  --gold-600: #9a7426;
  --gold-500: #b88d36;
  --gold-400: #c9a452;
  --gold-200: #ead9b0;
  --gold-100: #f8f2e2;
  --gold-50:  #fcf9f2;

  /* Warm Porcelain Neutral Canvas */
  --bg-page:    #f4f2ec;
  --bg-surface: #ffffff;
  --bg-subtle:  #faf9f5;
  --bg-muted:   #efece4;

  --border:        #e5e1d8;
  --border-strong: #d3cdc0;

  /* Ink Hierarchy */
  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #787d87;

  /* Refined Banking Semantics */
  --jade:      #0e7a5f;
  --jade-soft: #ecf7f3;
  --jade-bd:   #a7dfc9;

  --bronze:      #9a6700;
  --bronze-soft: #fef7e6;
  --bronze-bd:   #f3d58d;

  --burgundy:      #9f1239;
  --burgundy-soft: #fdf2f4;
  --burgundy-bd:   #f5c2ce;

  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 15px;

  --shadow-xs: 0 1px 2px rgba(12, 24, 45, 0.04);
  --shadow-sm: 0 2px 10px rgba(12, 24, 45, 0.045);
  --shadow-md: 0 8px 26px rgba(12, 24, 45, 0.09);
  --shadow-lg: 0 20px 50px rgba(8, 17, 33, 0.22);

  --font-sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }

/* ==================== SPLIT EXECUTIVE LOGIN GATE ==================== */

.auth-gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 46%) 1fr;
}

.auth-visual {
  background: radial-gradient(circle at 18% 15%, #193058 0%, #0c182d 55%, #070f1e 100%);
  color: #f8fafc;
  padding: 52px 56px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(201, 164, 82, 0.06) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(201, 164, 82, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.auth-visual-inner { position: relative; z-index: 1; max-width: 480px; }

.auth-crest {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(201, 164, 82, 0.22), rgba(201, 164, 82, 0.06));
  border: 1px solid rgba(201, 164, 82, 0.45);
  color: var(--gold-400);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--gold-400);
  font-weight: 600;
  margin-bottom: 10px;
}

.auth-visual h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.auth-lead {
  margin: 14px 0 38px;
  font-size: 14.5px;
  line-height: 1.7;
  color: #b7c4d9;
}

.auth-highlights {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-hl-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.hl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-400);
  margin-top: 7px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(201, 164, 82, 0.18);
}

.auth-hl-item strong {
  display: block;
  font-size: 14.5px;
  color: #f8fafc;
  margin-bottom: 2px;
}

.auth-hl-item span {
  font-size: 12.5px;
  color: #93a4be;
  line-height: 1.55;
}

.auth-visual-foot {
  position: relative;
  z-index: 1;
  font-size: 11.5px;
  color: #6b7d99;
  letter-spacing: 0.05em;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 18px;
}

.auth-panel {
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 34px 30px;
  box-shadow: 0 18px 46px rgba(12, 24, 45, 0.07);
}

.auth-card-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy-900);
}

.auth-card-head p {
  margin: 6px 0 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-900);
}

.field-group input, .field-group select {
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-group input:focus, .field-group select:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(184, 141, 54, 0.15);
}

.auth-error {
  font-size: 12.5px;
  color: var(--burgundy);
  background: var(--burgundy-soft);
  border: 1px solid var(--burgundy-bd);
  padding: 9px 12px;
  border-radius: 9px;
}

.auth-guide {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.auth-guide-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.auth-guide code {
  background: var(--gold-100);
  color: var(--gold-600);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* ==================== WORKSPACE SHELL (SIDEBAR + STAGE) ==================== */

.workspace-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 242px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0b1528 0%, #101f3a 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(201, 164, 82, 0.16);
  z-index: 35;
}

.sidebar-top {
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px;
}

.brand-crest {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(201, 164, 82, 0.26), rgba(201, 164, 82, 0.08));
  border: 1px solid rgba(201, 164, 82, 0.45);
  color: var(--gold-400);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.sidebar-sync {
  font-size: 11px;
  color: #7dd3b0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.sidebar-sync::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #b4c2d8;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.side-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.side-item.active {
  background: linear-gradient(90deg, rgba(201, 164, 82, 0.2), rgba(201, 164, 82, 0.05));
  color: #ffffff;
  font-weight: 600;
}

.side-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold-400);
}

.side-item.active svg {
  color: var(--gold-400);
}

.side-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}

.side-badge.pending {
  background: rgba(201, 164, 82, 0.22);
  color: var(--gold-200);
}

.side-badge.done {
  background: rgba(52, 211, 153, 0.2);
  color: #6ee7b7;
}

/* Sidebar User Panel */
.sidebar-user {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 17, 33, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-monogram {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--navy-950);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta { min-width: 0; }
.user-meta-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta-role {
  font-size: 11.5px;
  color: var(--gold-200);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.side-mini-btn {
  height: 30px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.side-mini-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* ==================== RIGHT WORKSPACE STAGE ==================== */

.stage {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

.stage-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 13px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.stage-header-left, .stage-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-heading {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

.branch-scope-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.scope-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.branch-select {
  height: 34px;
  padding: 0 28px 0 12px;
  border: 1.5px solid var(--gold-400);
  border-radius: 9px;
  background: var(--gold-50);
  color: var(--navy-900);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.branch-select:focus {
  box-shadow: 0 0 0 3px rgba(184, 141, 54, 0.18);
}

.single-branch-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-900);
  background: var(--gold-100);
  border: 1px solid var(--gold-200);
  padding: 4px 12px;
  border-radius: 999px;
}

/* Filter Strip */
.filter-strip {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 10px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-strip-left, .filter-strip-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-main {
  flex: 1;
  padding: 18px 24px 32px;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.branch-summary-card {
  margin-bottom: 16px;
}

.branch-table-wrap {
  max-height: none;
  min-height: 0;
}

/* ==================== BUTTONS & CONTROLS ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; height: 44px; font-size: 15px; }

.btn-sovereign {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #ffffff;
  border-color: var(--navy-900);
  box-shadow: 0 2px 8px rgba(12, 24, 45, 0.22);
}

.btn-sovereign:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  border-color: var(--gold-500);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--navy-950);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(184, 141, 54, 0.28);
}

.btn-gold:hover:not(:disabled) {
  filter: brightness(1.04);
}

.btn-gold-outline {
  background: var(--gold-50);
  color: var(--gold-600);
  border-color: var(--gold-200);
}

.btn-gold-outline:hover:not(:disabled) {
  background: var(--gold-100);
  border-color: var(--gold-400);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--navy-900);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--navy-700);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-muted);
  color: var(--navy-900);
}

.btn-ghost.active {
  background: var(--gold-100);
  color: var(--gold-600);
  border-color: var(--gold-200);
}

.btn-danger {
  background: var(--burgundy);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) { background: #881337; }

.select-sm, .date-ctrl {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--navy-900);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
}

.select-sm:focus, .date-ctrl:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(184, 141, 54, 0.14);
}

.segmented {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: 9px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s;
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--navy-900);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(12, 24, 45, 0.08);
}

.range-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.range-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-600);
  background: var(--gold-100);
  padding: 3px 10px;
  border-radius: 999px;
}

.range-label-pill {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy-900);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  padding: 4px 12px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.preset-chips { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.preset-chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.preset-chip:hover { border-color: var(--gold-500); color: var(--gold-600); background: var(--gold-50); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 60;
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border: none;
  background: transparent;
  border-radius: 7px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-subtle); }
.dropdown-item.danger { color: var(--burgundy); }
.dropdown-item.danger:hover { background: var(--burgundy-soft); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }

.staff-filter-menu { width: 290px; padding: 12px 14px; }
.filter-menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12.5px; }
.filter-menu-actions { display: flex; gap: 10px; }
.link-btn { border: none; background: transparent; color: var(--gold-600); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.filter-check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
.filter-menu-foot { padding-top: 8px; }
.check-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }

/* ==================== CARDS & PANELS ==================== */

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--navy-900); }
.card-desc { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Enlarged Executive Check-in Progress Strip */
.checkin-bar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold-400);
  border-radius: var(--radius-lg);
  padding: 15px 20px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.checkin-bar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; }
.checkin-title { font-size: 15px; font-weight: 700; color: var(--navy-900); white-space: nowrap; }
.checkin-pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.staff-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  line-height: 1.3;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}

.staff-status-pill.done {
  background: var(--jade-soft);
  border-color: var(--jade-bd);
  color: var(--jade);
  font-weight: 600;
}

.staff-status-pill.pending {
  background: var(--bronze-soft);
  border-color: var(--bronze-bd);
  color: var(--bronze);
  font-weight: 600;
}

.staff-status-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(12, 24, 45, 0.08);
}

.status-all-done {
  font-size: 13.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--jade-soft);
  color: var(--jade);
  border: 1px solid var(--jade-bd);
}

/* ==================== EXECUTIVE MATRIX TABLE ==================== */

.table-toolbar {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-title { font-size: 14.5px; font-weight: 700; color: var(--navy-900); }

.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 10px; color: var(--text-muted); pointer-events: none; }
.search-box input {
  height: 32px;
  width: 162px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-primary);
  background: var(--bg-surface);
  outline: none;
}
.search-box input:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(184, 141, 54, 0.14); }

.table-scroll-wrap {
  width: 100%;
  overflow: auto;
  max-height: calc(100vh - 240px);
  min-height: 0;
  position: relative;
}

.table-scroll-wrap.compact { max-height: 480px; min-height: 0; }

.perf-table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.perf-table th, .perf-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0;
  vertical-align: middle;
}

.perf-table thead th {
  position: sticky;
  top: 0;
  z-index: 15;
  background: #f8f6f0;
  color: var(--navy-900);
  font-weight: 700;
  text-align: center;
  padding: 9px 5px 8px;
  min-width: 64px;
  border-bottom: 2px solid var(--navy-900);
  user-select: none;
}

.perf-table thead th.sticky-col {
  left: 0;
  z-index: 25;
  min-width: 192px;
  max-width: 214px;
  text-align: left;
  padding-left: 12px;
  box-shadow: 2px 0 8px -2px rgba(12, 24, 45, 0.08);
}

.th-metric-name { display: block; font-size: 12.5px; font-weight: 700; color: var(--navy-900); white-space: nowrap; }
.th-metric-unit {
  display: inline-block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: #ece8de;
  padding: 0 6px;
  border-radius: 4px;
}

.perf-table tbody tr { background: var(--bg-surface); transition: background 0.1s; }
.perf-table tbody tr:nth-child(even) { background: #fdfcf9; }
.perf-table tbody tr:hover { background: var(--gold-50); }
.perf-table tbody tr:hover td.sticky-col { background: var(--gold-50); }

.perf-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg-surface);
  padding: 0 8px 0 12px;
  min-width: 192px;
  max-width: 214px;
  box-shadow: 2px 0 8px -2px rgba(12, 24, 45, 0.07);
}
.perf-table tbody tr:nth-child(even) td.sticky-col { background: #fdfcf9; }

.staff-cell { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 42px; }
.staff-cell-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
.row-idx { font-size: 11px; color: var(--text-muted); width: 18px; text-align: right; flex-shrink: 0; }

.staff-name-btn {
  border: none;
  background: transparent;
  padding: 2px 4px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy-900);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.staff-name-btn:hover { color: var(--gold-600); background: var(--gold-100); }

.branch-mini-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 5px;
  background: #edf1f7;
  color: var(--navy-700);
  white-space: nowrap;
  flex-shrink: 0;
}

.days-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gold-100);
  color: var(--gold-600);
  white-space: nowrap;
  flex-shrink: 0;
}
.days-chip.zero { background: var(--bg-muted); color: var(--text-muted); }

.staff-row-actions { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.row-mini-btn {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--navy-700);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  cursor: pointer;
}
.row-mini-btn:hover { background: var(--navy-900); color: #ffffff; border-color: var(--navy-900); }

/* Cells */
.grid-cell { height: 42px; }
.grid-cell.empty-highlight { background: #fef9ea !important; }

.cell-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 7px;
  text-align: right;
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.cell-input::placeholder { color: #cbd2dc; }
.cell-input:focus { background: var(--gold-50); box-shadow: inset 0 0 0 2px var(--gold-500); }
.cell-input.is-invalid { background: var(--burgundy-soft); box-shadow: inset 0 0 0 2px var(--burgundy); }

.agg-cell-val {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 42px;
  padding: 0 11px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
}
.agg-cell-val.empty { color: #cbd2dc; }

/* Summary Footer (ONLY 团队合计 & 单项最高) */
.perf-table tfoot td {
  padding: 9px 11px;
  font-size: 13px;
  text-align: right;
}

.perf-table tfoot tr.foot-sum td {
  border-top: 2px solid var(--navy-900);
  background: #f9f4e7;
  color: var(--navy-900);
  font-weight: 700;
}

.perf-table tfoot tr.foot-max td {
  background: #ffffff;
  color: var(--text-secondary);
  font-weight: 600;
}

.perf-table tfoot td.sticky-col {
  left: 0;
  z-index: 20;
  text-align: left;
  padding-left: 16px;
  box-shadow: 2px 0 8px -2px rgba(12, 24, 45, 0.08);
}

.max-leader {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
  margin-left: auto;
}

.table-footer-bar {
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==================== INTEGRATED MY DAILY FILL TAB ==================== */

.myfill-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1080px;
}

.myfill-top-card { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.myfill-top-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.my-checkin-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.my-day-chip {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  background: var(--bg-subtle);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.14s;
}
.my-day-chip:hover { border-color: var(--gold-500); }
.my-day-chip .d-md { font-size: 12.5px; font-weight: 700; color: var(--navy-900); }
.my-day-chip .d-wk { font-size: 11px; color: var(--text-muted); }
.my-day-chip .d-st { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--bg-muted); color: var(--text-muted); }
.my-day-chip.filled .d-st { background: var(--jade-soft); color: var(--jade); }
.my-day-chip.active { border-color: var(--navy-900); background: var(--gold-50); box-shadow: 0 0 0 2px rgba(12, 24, 45, 0.1); }

.receipt-banner {
  padding: 14px 18px;
  background: var(--jade-soft);
  border-color: var(--jade-bd);
  color: var(--jade);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.myfill-metric-grid {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
}

.myfill-field { display: flex; flex-direction: column; gap: 5px; }
.myfill-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-900);
  display: flex;
  justify-content: space-between;
}
.myfill-field .u-muted { font-weight: 500; color: var(--text-muted); font-size: 12px; }
.myfill-field input {
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.myfill-field input:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(184, 141, 54, 0.14); }
.myfill-field input.has-val { border-color: var(--navy-700); background: #fdfcf8; }

.myfill-note-bar {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.myfill-note-bar label { font-size: 13px; font-weight: 600; color: var(--navy-900); white-space: nowrap; }
.myfill-note-bar input {
  flex: 1;
  min-width: 220px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.myfill-note-bar input:focus { border-color: var(--gold-500); }

/* ==================== CHARTS, CHECK-IN, LOGS & REPORT ==================== */

.dashboard-stack { display: flex; flex-direction: column; gap: 16px; }
.chart-body { padding: 18px 20px; min-height: 290px; }

.chart-empty {
  height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  text-align: center;
}

.matrix-table { width: max-content; min-width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.matrix-table th, .matrix-table td { border: 1px solid var(--border); padding: 8px 7px; text-align: center; font-size: 12.5px; }
.matrix-table th { background: #f8f6f0; color: var(--navy-900); font-weight: 700; white-space: nowrap; }
.matrix-table th.sticky-name, .matrix-table td.sticky-name {
  position: sticky; left: 0; z-index: 5; background: var(--bg-surface);
  text-align: left; padding-left: 14px; min-width: 140px; font-weight: 600;
}
.matrix-cell-btn { border: none; background: transparent; min-width: 28px; height: 26px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 12px; }
.matrix-cell-btn.ok { background: var(--jade-soft); color: var(--jade); }
.matrix-cell-btn.miss { color: #cbd2dc; }
.matrix-cell-btn:hover { outline: 2px solid var(--gold-500); }

.audit-log-wrap { padding: 14px 20px 20px; max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.log-row { border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; background: var(--bg-subtle); display: flex; flex-direction: column; gap: 4px; }
.log-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.log-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.log-action-pill { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--jade-soft); color: var(--jade); }
.log-action-pill.update { background: var(--gold-100); color: var(--gold-600); }
.log-action-pill.clear { background: var(--burgundy-soft); color: var(--burgundy); }
.log-changes { font-size: 12.5px; color: var(--text-secondary); }
.badge-muted { font-size: 11.5px; color: var(--text-muted); background: var(--bg-muted); padding: 2px 9px; border-radius: 999px; }

/* Report Generator */
.report-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.form-stack { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--navy-900); }
.radio-cards { display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; flex-direction: column; gap: 2px; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.15s; }
.radio-card input { display: none; }
.radio-card strong { font-size: 13.5px; color: var(--navy-900); }
.radio-card span { font-size: 12px; color: var(--text-muted); }
.radio-card.active { border-color: var(--gold-500); background: var(--gold-50); }
.checkbox-list { display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: flex; gap: 8px; }
.report-textarea {
  width: 100%; min-height: 460px; border: none; padding: 18px 20px;
  font-family: "Microsoft YaHei", "PingFang SC", monospace;
  font-size: 13.5px; line-height: 1.75; color: var(--text-primary);
  background: #fdfcf9; resize: vertical; outline: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ==================== SUPER ADMIN: BRANCHES & PERMISSIONS ==================== */

.admin-split-layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-branch-card {
  position: sticky;
  top: 76px;
}

.admin-branch-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.branch-admin-card {
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--navy-900);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.branch-admin-card:hover {
  border-color: var(--gold-400);
  background: var(--gold-50);
}

.branch-admin-card.active {
  border-color: var(--gold-500);
  border-left-color: var(--gold-500);
  background: var(--gold-50);
  box-shadow: 0 3px 10px rgba(184, 141, 54, 0.12);
}

.branch-admin-card.all-card {
  border-left-color: var(--gold-400);
}

.branch-admin-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.branch-admin-name { font-size: 15px; font-weight: 700; color: var(--navy-900); }
.branch-admin-code { font-size: 11.5px; color: var(--gold-600); background: var(--gold-100); padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.branch-admin-meta { font-size: 12.5px; color: var(--text-muted); }
.branch-admin-actions { display: flex; gap: 6px; margin-top: 2px; }

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-staff-table {
  width: 100%;
  table-layout: fixed;
}

.admin-staff-table tbody tr:nth-child(even) {
  background: #fdfcf9;
}

.admin-staff-table td {
  padding: 13px 16px;
}

.admin-staff-table th {
  padding: 12px 16px;
}

.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th {
  position: sticky; top: 0; background: #f8f6f0; color: var(--navy-900);
  font-weight: 700; font-size: 12.5px; text-align: left; padding: 11px 14px;
  border-bottom: 1.5px solid var(--navy-900); white-space: nowrap;
}
.data-table th.num { text-align: right; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.data-table tbody tr:hover { background: var(--gold-50); }

.perm-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.perm-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-100);
  color: var(--gold-600);
  border: 1px solid var(--gold-200);
}
.perm-chip.all { background: var(--navy-900); color: var(--gold-200); border-color: var(--navy-900); }
.perm-chip.none { background: var(--bg-muted); color: var(--text-muted); border-color: transparent; font-weight: 500; }

/* ==================== DRAWER, MODAL & TOAST ==================== */

.backdrop { position: fixed; inset: 0; background: rgba(8, 17, 33, 0.48); backdrop-filter: blur(3px); z-index: 80; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 490px; max-width: 94vw;
  background: var(--bg-surface); box-shadow: var(--shadow-lg); z-index: 90;
  display: flex; flex-direction: column;
}
.drawer-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.drawer-header h3 { margin: 0; font-size: 16.5px; color: var(--navy-900); }
.drawer-sub { margin: 3px 0 0; font-size: 12px; color: var(--text-muted); }
.drawer-toolbar { padding: 12px 22px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer-hint { padding: 9px 22px; font-size: 12px; color: var(--gold-600); background: var(--gold-50); border-bottom: 1px solid var(--gold-200); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
.drawer-field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.drawer-field { display: flex; flex-direction: column; gap: 5px; }
.drawer-field label { font-size: 12.5px; font-weight: 600; color: var(--navy-900); display: flex; align-items: center; justify-content: space-between; gap: 6px; }

/* Color-coded Unit Pill Badges for crystal-clear data entry */
.unit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.unit-badge.u-wan {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #f59e0b;
}

.unit-badge.u-hu {
  background: #e8f0fe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.unit-badge.u-ge {
  background: #e6f7f1;
  color: #0e7a5f;
  border: 1px solid #86d9be;
}

.unit-badge.u-bi {
  background: #f3e8ff;
  color: #6d28d9;
  border: 1px solid #c4b5fd;
}
.drawer-field input { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; font-family: inherit; font-size: 13.5px; outline: none; }
.drawer-field input:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(184, 141, 54, 0.14); }
.drawer-footer { padding: 13px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--bg-subtle); }
.drawer-footer-right { display: flex; gap: 8px; }

.breakdown-day-card { border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; background: var(--bg-subtle); display: flex; flex-direction: column; gap: 6px; }
.breakdown-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.breakdown-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.breakdown-chip { font-size: 12px; background: var(--bg-surface); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; }

.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 540px; max-width: 92vw; max-height: 88vh;
  background: var(--bg-surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  z-index: 95; display: flex; flex-direction: column;
}
.modal-header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { margin: 0; font-size: 16px; color: var(--navy-900); }
.modal-body { padding: 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 13px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg-subtle); border-radius: 0 0 16px 16px; }

.input-text, .input-select {
  width: 100%; height: 38px; border: 1.5px solid var(--border-strong); border-radius: 9px;
  padding: 0 12px; font-family: inherit; font-size: 13.5px; color: var(--text-primary); outline: none; background: var(--bg-surface);
}
.input-text:focus, .input-select:focus { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(184, 141, 54, 0.14); }

.share-link-box { display: flex; align-items: center; gap: 8px; background: var(--bg-subtle); border: 1px solid var(--border-strong); border-radius: 9px; padding: 6px 8px; }
.share-link-box input { flex: 1; border: none; background: transparent; font-family: monospace; font-size: 13px; color: var(--navy-900); outline: none; }

.perm-check-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-subtle);
}

.toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy-900); color: #ffffff; padding: 11px 16px; border-radius: 10px;
  box-shadow: var(--shadow-md); font-size: 13px; max-width: 360px; animation: toastIn 0.2s ease;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #f43f5e; }
.toast.info { border-left: 4px solid var(--gold-400); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1200px) {
  .admin-split-layout { grid-template-columns: 1fr; }
  .admin-branch-card { position: static; }
  .admin-staff-table { table-layout: auto; }
}

@media (max-width: 1024px) {
  .auth-gate { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .workspace-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .myfill-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .report-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .myfill-metric-grid { grid-template-columns: 1fr; }
  .my-checkin-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
}

@media print {
  .sidebar, .stage-header-right, .filter-strip, .table-toolbar, .staff-row-actions, .table-footer-bar { display: none !important; }
  .table-scroll-wrap { max-height: none !important; overflow: visible !important; }
  body { background: #ffffff; }
}

/* ==========================================================================
   H5 MOBILE & WECHAT MINI-PROGRAM STYLE SYSTEM (<= 768px)
   ========================================================================== */

.mobile-appbar,
.mobile-tabbar,
.mobile-only-seg,
.mobile-summary-cards {
  display: none;
}

/* Mobile Card Components (styled globally, shown on <= 768px) */
.m-hero-total-card {
  background: linear-gradient(135deg, #0b1528 0%, #172b4d 100%);
  color: #ffffff;
  border-radius: 14px;
  padding: 15px 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(11, 21, 40, 0.16);
}

.m-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.m-hero-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--gold-200);
  letter-spacing: 0.02em;
}

.m-hero-toggle {
  border: 1px solid rgba(201, 164, 82, 0.4);
  background: rgba(201, 164, 82, 0.14);
  color: var(--gold-200);
  font-family: inherit;
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.m-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 8px;
}

.m-hero-stat {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 8px 9px;
}

.m-hero-stat .lbl {
  font-size: 11px;
  color: #aebcd2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-hero-stat .val {
  font-size: 15.5px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.m-hero-stat .val small {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--gold-200);
  margin-left: 2px;
}

.m-entity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-entity-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 14px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.m-entity-card:active {
  transform: scale(0.99);
}

.m-entity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f2efe8;
}

.m-entity-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.m-entity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: var(--gold-200);
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m-entity-avatar.branch {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--navy-950);
}

.m-entity-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-900);
}

.m-entity-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.m-entity-status {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.m-entity-status.done { background: var(--jade-soft); color: var(--jade); }
.m-entity-status.pending { background: var(--bronze-soft); color: var(--bronze); }

.m-entity-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.m-metric-box {
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 6px 8px;
}

.m-metric-box .k {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-metric-box .v {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.m-metric-box .v small {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 1px;
}

.m-entity-foot {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.m-entity-cta {
  color: var(--gold-600);
  font-weight: 600;
}

/* Action Sheet List inside Bottom-Sheet Modal */
.sheet-action-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sheet-action-btn {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-subtle);
  color: var(--navy-900);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.sheet-action-btn:active { background: var(--gold-50); }
.sheet-action-btn.active { border-color: var(--gold-500); background: var(--gold-50); color: var(--gold-600); }
.sheet-action-btn.danger { color: var(--burgundy); background: var(--burgundy-soft); border-color: var(--burgundy-bd); }

/* ==================== MOBILE BREAKPOINT (<= 768px) ==================== */

@media (max-width: 768px) {
  html, body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
  }

  /* Prevent iOS Safari / WeChat browser auto-zoom on input focus */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* ---- Mini-Program Curved Navy Login Screen ---- */
  .auth-gate {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-page);
  }

  .auth-visual {
    display: flex !important;
    padding: calc(28px + env(safe-area-inset-top, 0px)) 24px 52px;
    border-radius: 0 0 26px 26px;
    min-height: auto;
  }

  .auth-crest { width: 44px; height: 44px; margin-bottom: 12px; }
  .auth-kicker { font-size: 10px; margin-bottom: 6px; }
  .auth-visual h1 { font-size: 24px; }
  .auth-lead { margin: 6px 0 0; font-size: 13px; }
  .auth-highlights, .auth-visual-foot { display: none; }

  .auth-panel {
    padding: 0 16px 32px;
    margin-top: -32px;
    position: relative;
    z-index: 2;
    align-items: flex-start;
  }

  .auth-card {
    padding: 24px 20px 22px;
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(11, 21, 40, 0.1);
  }

  .auth-card-head h2 { font-size: 19px; }
  .auth-card-head p { margin: 4px 0 18px; font-size: 12.5px; }

  /* ---- Hide Desktop Sidebar & Desktop Top Header ---- */
  .sidebar,
  .stage-header {
    display: none !important;
  }

  /* ---- Show Mini-Program Top App Bar ---- */
  .mobile-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 45;
    background: linear-gradient(135deg, #0b1528 0%, #132442 100%);
    color: #ffffff;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    border-bottom: 1px solid rgba(201, 164, 82, 0.22);
    box-shadow: 0 2px 10px rgba(8, 17, 33, 0.18);
  }

  .mobile-appbar-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .mobile-crest {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(201, 164, 82, 0.18);
    border: 1px solid rgba(201, 164, 82, 0.45);
    color: var(--gold-400);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .mobile-title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .mobile-page-title {
    font-size: 15.5px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
  }

  .mobile-branch-trigger {
    border: none;
    background: transparent;
    padding: 0;
    margin-top: 1px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--gold-200);
    cursor: pointer;
    text-align: left;
  }

  /* Classic WeChat Mini-Program Top-Right Capsule */
  .mobile-capsule {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
  }

  .capsule-btn {
    width: 32px;
    height: 28px;
    border: none;
    background: transparent;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
  }

  .capsule-div {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.22);
    margin: 0 2px;
  }

  .capsule-avatar {
    width: 24px;
    height: 24px;
    margin: 0 4px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
    color: var(--navy-950);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  /* ---- Mobile Time & Filter Strip ---- */
  .filter-strip {
    padding: 10px 12px;
    gap: 8px;
    background: var(--bg-surface);
  }

  .filter-strip-left {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .range-mode-seg {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 3px;
  }

  .range-mode-seg .seg-btn {
    padding: 6px 2px;
    font-size: 12px;
    text-align: center;
  }

  .range-controls {
    width: 100%;
    justify-content: space-between;
  }

  .range-controls .date-ctrl {
    flex: 1;
    min-width: 118px;
    height: 36px;
    font-size: 13.5px !important;
  }

  .preset-chips {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .preset-chip { flex-shrink: 0; }

  .filter-strip-right {
    width: 100%;
    justify-content: space-between;
  }

  /* ---- Workspace Stage Padding for Bottom Tab Bar ---- */
  .stage-main {
    padding: 12px 12px calc(82px + env(safe-area-inset-bottom, 0px));
  }

  /* ---- Enlarged Check-in Strip Compact Swipe on Phone ---- */
  .stage,
  .stage-main,
  .tab-panel {
    max-width: 100vw;
    overflow-x: clip;
  }

  .checkin-bar-card {
    padding: 12px 13px;
    border-radius: 13px;
    margin-bottom: 12px;
    gap: 10px;
    max-width: 100%;
    overflow: hidden;
  }

  .checkin-bar-left {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .checkin-title {
    font-size: 13.5px;
    white-space: normal;
  }

  .checkin-pills {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .staff-status-pill {
    flex-shrink: 0;
    font-size: 13px;
    padding: 6px 12px;
  }

  /* Hide desktop branch comparison card on phone (phone uses the compact mobile switcher inside .table-card) */
  .branch-summary-card {
    display: none !important;
  }

  /* ---- Card / Table Switcher on Mobile ---- */
  .mobile-only-seg { display: inline-flex; }

  .table-toolbar {
    padding: 11px 12px;
    gap: 8px;
  }

  .toolbar-left {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar-title { font-size: 13.5px; }

  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .search-box { flex: 1; }
  .search-box input { width: 100%; height: 36px; font-size: 14px !important; }

  .mobile-summary-cards {
    display: block;
    padding: 12px;
    background: var(--bg-page);
  }

  .table-card.mobile-cards-active #tableScrollWrap,
  .table-card.mobile-cards-active .table-footer-bar {
    display: none !important;
  }

  .table-card:not(.mobile-cards-active) #mobileSummaryCards {
    display: none !important;
  }

  /* Compact Sticky Column when user flips to Table View on phone */
  .perf-table thead th.sticky-col,
  .perf-table td.sticky-col {
    min-width: 122px;
    max-width: 138px;
    padding: 0 6px 0 8px;
  }

  .perf-table thead th { min-width: 78px; padding: 8px 5px; }
  .row-idx { display: none; }
  .branch-mini-tag { display: none; }
  .table-scroll-wrap { max-height: 62vh; -webkit-overflow-scrolling: touch; }

  /* ---- Mobile Native Mini-Program Daily Self-Fill Form ---- */
  .myfill-top-card { padding: 14px; }
  .myfill-top-head { gap: 10px; }

  .myfill-form-card .card-header { padding: 13px 14px; }
  .myfill-form-card .card-actions { display: none; }

  .myfill-metric-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .myfill-field {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f1eee7;
    gap: 10px;
  }

  .myfill-field label {
    flex: 1;
    font-size: 14.5px;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
  }

  .myfill-field input {
    width: 136px;
    height: 38px;
    text-align: right;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    border-radius: 8px;
    padding: 0 10px;
    flex-shrink: 0;
  }

  .myfill-note-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 10px;
  }

  .myfill-note-bar .btn-sovereign {
    width: 100%;
    height: 46px;
    font-size: 15.5px;
    border-radius: 11px;
  }

  /* ---- Charts, Check-in & Report on Mobile ---- */
  .card-header { padding: 13px 14px; }
  .chart-body { padding: 10px 10px 14px; min-height: 220px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .report-textarea { min-height: 300px; padding: 14px; font-size: 14px !important; }
  .form-stack { padding: 14px; }

  /* ---- Admin Tab Mobile Card Stack ---- */
  .admin-branch-list { grid-template-columns: 1fr; padding: 12px; }
  #tab-admin .data-table thead { display: none; }
  #tab-admin .data-table,
  #tab-admin .data-table tbody,
  #tab-admin .data-table tr,
  #tab-admin .data-table td { display: block; width: 100%; }
  #tab-admin .data-table tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 10px 12px;
    width: calc(100% - 24px);
    padding: 10px 12px;
    background: var(--bg-surface);
  }
  #tab-admin .data-table td {
    border: none;
    padding: 4px 0;
    text-align: left !important;
    white-space: normal !important;
  }
  #tab-admin .data-table td:last-child {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1eee7;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ---- Bottom-Sheet Modals & Drawers (Native Mini-Program Feel!) ---- */
  .modal,
  .drawer {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 86vh !important;
    transform: none !important;
    border-radius: 20px 20px 0 0 !important;
    animation: sheetUp 0.22s ease;
  }

  .modal-header::before,
  .drawer-header::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #d8d3c8;
  }

  .modal-header,
  .drawer-header {
    position: relative;
    padding-top: 20px;
  }

  .modal-footer,
  .drawer-footer {
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    border-radius: 0 !important;
  }

  .drawer-field-grid { grid-template-columns: 1fr; }
  .perm-check-list { grid-template-columns: 1fr; }

  /* ---- Fixed Mini-Program Bottom Tab Bar ---- */
  .mobile-tabbar {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 18px rgba(11, 21, 40, 0.06);
  }

  .mtab-item {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 3px 0;
    cursor: pointer;
    position: relative;
  }

  .mtab-item.active {
    color: var(--navy-900);
    font-weight: 700;
  }

  .mtab-item.active svg {
    color: var(--gold-500);
    stroke-width: 2.2;
  }

  .mtab-icon-wrap {
    position: relative;
    display: inline-flex;
  }

  .mtab-dot {
    position: absolute;
    top: -2px;
    right: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d97706;
    border: 1.5px solid #ffffff;
  }

  .toast-container {
    right: 14px;
    left: 14px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }

  .toast { max-width: 100%; }
}

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