/* --------------------------------------------------------------------------
   模組三：Live Sheet View 檢視看板組件
   -------------------------------------------------------------------------- */
.liveview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--bg-card-glass);
  padding: 18px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin-bottom: 24px;
}

.search-input-box {
  position: relative;
  flex: 1;
  max-width: 450px;
}

.search-input-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 16px 10px 40px;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}

.search-input-box input:focus {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.kpi-card {
  background: var(--gradient-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition-normal);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kpi-code {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.15);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}

.kpi-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.kpi-timeline-preview {
  font-size: 0.83rem;
  color: var(--text-muted);
  background: var(--bg-panel-medium);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  max-height: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Modal 彈窗 (用於 HITL 修改與 Live View 卡片明細)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: var(--bg-modal-backdrop);
  backdrop-filter: blur(8px);
  z-index: 2500 !important;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: var(--bg-dark-surface);
  border: 1px solid var(--border-glass-glow);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 600px;
  padding: 28px;
  box-shadow: var(--shadow-card);
  animation: modalPop 0.25s ease-out;
}

/* --------------------------------------------------------------------------
   V1.9 寬螢幕 21 欄 CRM 詳情 Modal (CRM Modal Wide & Grid)
   -------------------------------------------------------------------------- */
.modal-card.crm-modal-wide {
  width: 95vw;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
}

/* 手機版專屬 3 分頁導航列 (電腦版強制隱藏，100% 凍結保護電腦版) */
.crm-mobile-segmented-tabs {
  display: none !important;
}

.crm-modal-body {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  overflow: hidden;
  flex: 1;
  margin-top: 12px;
  min-height: 0;
}

@media (max-width: 860px) {
  .crm-modal-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

.crm-col-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow-y: auto;
  padding-right: 6px;
  max-height: calc(92vh - 120px);
}

.crm-col-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-panel-light);
  border: 1px solid var(--border-card-light);
  border-radius: var(--radius-md);
  padding: 16px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

/* CRM Hero Banner */
.crm-hero-banner {
  background: var(--bg-hero-banner);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.crm-hero-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.crm-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.crm-badge-tag {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.crm-badge-stage {
  background: rgba(192, 132, 252, 0.18);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.priority-badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.priority-badge.prio-high {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.priority-badge.prio-low {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.priority-badge.prio-paused {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

.crm-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: var(--bg-panel-medium);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card-light);
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.74rem;
  color: var(--text-subtle);
  margin-bottom: 3px;
}

.metric-value {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-heading);
}

.metric-value.highlight-gold {
  color: #fbbf24;
}

.metric-value.highlight-green {
  color: #34d399;
}

/* CRM Info Cards */
.crm-info-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.crm-info-card.leverage-card {
  border-left: 3px solid #fbbf24;
  background: rgba(251, 191, 36, 0.05);
}

.crm-info-card.advantage-card {
  border-left: 3px solid #34d399;
  background: rgba(52, 211, 153, 0.05);
}

.crm-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.crm-card-content {
  font-size: 0.9rem;
  color: var(--text-card-content);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* CRM Attribute Grid (V2.5 Single-Column Row Layout) */
.crm-attr-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-panel-deep);
  border: 1px solid var(--border-card-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.attr-item {
  font-size: 0.83rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.attr-label {
  color: var(--text-subtle);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.attr-val {
  color: var(--text-attr);
  word-break: break-word;
  text-align: right;
  font-weight: 600;
}

/* Timeline & Compact Icon Actions */
.btn-timeline-action-icon {
  background: var(--bg-btn-ghost);
  border: 1px solid var(--border-card-strong);
  color: var(--text-main);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-timeline-action-icon:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: #818cf8;
  transform: scale(1.08);
}

.btn-timeline-action-icon.delete:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #f87171;
}

/* Inline Edit Box Inside Timeline Item Card */
.timeline-inline-edit-box {
  width: 100%;
  margin-top: 6px;
}

.timeline-inline-textarea {
  width: 100%;
  background: var(--bg-input-deep);
  border: 1px solid #60a5fa;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  resize: vertical;
  min-height: 60px;
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.timeline-inline-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

.btn-inline-save {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-inline-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
}

.crm-modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 24px;
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-light);
}

