/* ==========================================================================
   FollowLoop V4.1 專案主檔 CRM CRUD 與卡片動作按鈕 & Sticky 樣式
   ========================================================================== */

/* 卡片右上角動作按鈕 */
.kpi-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.minimalist-kpi-card:hover .kpi-card-actions {
  opacity: 1;
}

.btn-card-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 3px 6px;
  line-height: 1;
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-card-action:hover {
  background: var(--bg-glass-hover);
  transform: scale(1.12);
}

.btn-card-edit:hover {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.25);
}

.btn-card-delete:hover {
  border-color: #f87171;
  background: rgba(239, 68, 68, 0.25);
}

/* 專案管理 CRUD Modal 樣式 */
.project-modal-card {
  width: 820px;
  max-width: 94vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark-surface);
  border: 1px solid var(--border-glass-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
}

.pm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.pm-form-grid .full-width {
  grid-column: 1 / -1;
}

.pm-section-divider {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-light);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-card-light);
  margin-top: 10px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-glass);
  background: var(--bg-panel-deep);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 頂部導航與過濾列 Sticky 凍結 */
.app-header.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--bg-card-glass);
}

.liveview-toolbar.sticky-toolbar {
  position: sticky;
  top: 80px;
  z-index: 90;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--bg-card-glass);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
}

/* ☁️ 頂部雲端同步微型指示燈 (Cloud Status Pill) */
.cloud-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
  transition: all 0.3s ease;
  white-space: nowrap;
  user-select: none;
}

.cloud-status-pill.syncing {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.35);
}

.cloud-status-pill.offline {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}

.cloud-status-pill .spin-icon {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   🪪 HITL 模組子頁籤切換器 (Business Logs vs Business Cards)
   ========================================================================== */
.hitl-sub-nav {
  display: inline-flex;
  background: var(--bg-panel-deep);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  gap: 4px;
}

.hitl-sub-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hitl-sub-btn:hover {
  color: var(--text-heading);
}

.hitl-sub-btn.active {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.hitl-sub-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  font-weight: 800;
  border: 1px solid rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease;
}

.hitl-sub-btn.active .hitl-sub-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* 🪪 名片審核卡片 (Business Card HITL Staging Card) */
.card-hitl-box {
  background: var(--gradient-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-normal);
  max-width: 540px;
}

.card-hitl-box:hover {
  border-color: var(--border-glass-glow);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.card-preview-container {
  display: flex;
  gap: 14px;
  background: var(--bg-panel-deep);
  border: 1px solid var(--border-card-light);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.card-thumb-wrap {
  position: relative;
  width: 130px;
  min-width: 130px;
  height: 95px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-glass);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.card-thumb-wrap:hover .card-thumb-img {
  transform: scale(1.05);
}

.card-thumb-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.68rem;
  padding: 1px 4px;
  border-radius: 4px;
}

.card-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.card-person-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
}

.card-person-title {
  font-size: 0.84rem;
  color: var(--primary-light);
  font-weight: 600;
}

.card-person-company {
  font-size: 0.88rem;
  color: var(--text-body);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-detail-table {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.84rem;
  background: var(--bg-panel-medium);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card-light);
}

.card-detail-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.card-detail-label {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 55px;
}

.card-detail-value {
  color: var(--text-main);
  word-break: break-all;
}

.card-foxlink-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 0.84rem;
}

/* ==========================================================================
   📱 現代商務單行專案選擇抽屜 (Project Bottom Sheet Picker)
   徹底告別 Android 原生 select 巨大字體與反人類折行
   ========================================================================== */
.project-picker-btn {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  background: var(--bg-panel-deep, #151c2e);
  border: 1px solid var(--border-card-light, rgba(255, 255, 255, 0.15));
  border-radius: var(--radius-sm, 8px);
  color: var(--text-heading, #f1f5f9);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
}

.project-picker-btn:hover {
  border-color: var(--primary-light, #818cf8);
}

.project-picker-btn .picker-selected-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  padding-right: 8px;
}

.project-picker-btn .picker-arrow {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
}

/* 抽屜遮罩層 */
.project-sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 3000 !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* 抽屜主體卡片 (從底部滑出) */
.project-sheet-panel {
  background: var(--bg-dark-surface, #0f172a);
  border-top: 1px solid var(--border-glass-glow, rgba(99, 102, 241, 0.35));
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
}

.project-sheet-backdrop.active .project-sheet-panel {
  transform: translateY(0);
}

.project-sheet-header {
  padding: 14px 16px 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-card-light, rgba(255, 255, 255, 0.08));
}

.project-sheet-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading, #f1f5f9);
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-sheet-close {
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
}

/* 搜尋列 */
.project-sheet-search {
  padding: 10px 16px 6px 16px;
}

.project-sheet-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-panel-deep, #1e293b);
  border: 1px solid var(--border-card-light, rgba(255, 255, 255, 0.15));
  border-radius: var(--radius-sm, 8px);
  color: var(--text-heading, #f1f5f9);
  font-size: 0.85rem;
  box-sizing: border-box;
}

.project-sheet-search input:focus {
  outline: none;
  border-color: var(--primary-light, #818cf8);
}

/* 列表容器 */
.project-sheet-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 列表單項 (強制極限單行截斷) */
.project-sheet-item {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-main, #cbd5e1);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-sizing: border-box;
  text-align: left;
  transition: background 0.15s ease;
}

.project-sheet-item:hover,
.project-sheet-item:active {
  background: var(--bg-btn-ghost, rgba(255, 255, 255, 0.08));
}

.project-sheet-item.selected {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  font-weight: 700;
}

.project-sheet-item.is-new-opt {
  color: #34d399;
  font-weight: 700;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  margin-bottom: 4px;
}

.project-sheet-item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.project-sheet-item-check {
  margin-left: 8px;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ==========================================================================
   ⏳ 全屏科技感阻斷進度遮罩 (Full-Screen Progress Overlay)
   ========================================================================== */
.global-progress-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 29, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-progress-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.global-progress-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  padding: 32px 36px;
  width: 440px;
  max-width: 90vw;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-progress-overlay.active .global-progress-card {
  transform: scale(1);
}

.progress-spinner-ring {
  position: relative;
  width: 68px;
  height: 68px;
  margin-bottom: 16px;
}

.progress-spinner-ring .spin-outer {
  position: absolute;
  inset: 0;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: #6366f1;
  border-right-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.progress-spinner-ring .status-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  transition: all 0.2s ease;
}

.progress-overlay-title {
  margin: 0 0 8px 0;
  font-size: 1.22rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.3px;
}

.progress-overlay-desc {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.5;
  min-height: 22px;
  margin-bottom: 14px;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  width: 20%;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #38bdf8, #10b981);
  border-radius: 3px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}





