
/* AI 業務開發自動化系統 v5.0 — 靜態原型樣式 */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0891b2;
  --info-light: #cffafe;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-width: 240px;
  --header-height: 56px;
  --hot: #dc2626;
  --warm: #f59e0b;
  --cold: #3b82f6;
  --rejected: #374151;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
}

/* 側邊導航 */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--gray-900);
  color: #fff;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-700);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-light);
}

.sidebar-header span {
  display: block;
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

.nav-group {
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-700);
}

.nav-group-label {
  padding: 4px 16px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--gray-300);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--gray-800); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.nav-item .icon { width: 18px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}

/* 主區域 */
.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* 頂部列 */
.topbar {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
}

.topbar-title { font-size: 16px; font-weight: 600; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 內容區 */
.content { padding: 24px; }

/* 即時狀態列 */
.status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 20px;
  font-size: 13px;
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}

.status-dot.green { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red { background: var(--danger); }

.status-item { display: flex; align-items: center; gap: 6px; }
.status-item .label { color: var(--gray-500); }
.status-item .value { font-weight: 600; }

/* 卡片 */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.card-body { padding: 20px; }

/* 統計卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px 20px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
}

.stat-card .stat-change {
  font-size: 12px;
  margin-top: 4px;
}

.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

/* 格子佈局 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }

/* 表格 */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
}

tr:hover td { background: var(--gray-50); }

/* Tab 切換 */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
}

.tab {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* 篩選列 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar select, .filter-bar input {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}

/* 按鈕 */
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-100); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 標籤 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.tag-hot { background: #fee2e2; color: var(--hot); }
.tag-warm { background: #fef3c7; color: #92400e; }
.tag-cold { background: #dbeafe; color: #1e40af; }
.tag-rejected { background: var(--gray-200); color: var(--gray-600); }
.tag-new { background: var(--gray-100); color: var(--gray-500); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-info { background: var(--info-light); color: var(--info); }

/* 看板 */
.kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  min-width: 260px;
  flex: 1;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 12px;
}

.kanban-col-header {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col-header .count {
  background: var(--gray-300);
  color: var(--gray-700);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
}

.kanban-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.kanban-card .kc-title { font-weight: 600; margin-bottom: 4px; }
.kanban-card .kc-meta { color: var(--gray-500); font-size: 12px; }

/* 漏斗 */
.funnel {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  margin-bottom: 20px;
}

.funnel-step {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 10px 20px;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
}

.funnel-step .funnel-label { font-size: 11px; font-weight: 400; color: var(--gray-600); }
.funnel-arrow { color: var(--gray-400); font-size: 18px; }

/* 進度條 */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}

.progress-bar .fill.blue { background: var(--primary); }
.progress-bar .fill.green { background: var(--success); }
.progress-bar .fill.yellow { background: var(--warning); }
.progress-bar .fill.red { background: var(--danger); }

/* 活動流 */
.activity-feed { max-height: 300px; overflow-y: auto; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.activity-item .time {
  color: var(--gray-400);
  font-size: 12px;
  white-space: nowrap;
  min-width: 60px;
}

/* 倒數 */
.countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--warning);
}

/* 審核卡片 */
.review-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
}

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

.review-card .rc-title { font-weight: 600; }
.review-card .rc-actions { display: flex; gap: 8px; }
.review-card .rc-detail { color: var(--gray-600); font-size: 13px; }

/* 預覽面板 */
.preview-panel {
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 20px;
  background: var(--gray-50);
  font-size: 13px;
}

.preview-panel .preview-subject {
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

/* 五大業務線顏色 */
.biz-hdd { border-left: 3px solid #2563eb; }
.biz-doc { border-left: 3px solid #7c3aed; }
.biz-equip { border-left: 3px solid #0891b2; }
.biz-wood { border-left: 3px solid #65a30d; }
.biz-car { border-left: 3px solid #ea580c; }

/* 隱藏/顯示 page */
.page { display: none; }
.page.active { display: block; }

/* 響應式 */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}

/* Toast 通知 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s, transform .3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #16a34a; }
.toast-warning { background: #d97706; }
.toast-danger { background: #dc2626; }
.toast-info { background: #2563eb; }

/* Agent 頁面額外樣式 */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 20px; margin: 0 0 4px; }
.page-subtitle { color: #6b7280; font-size: 14px; margin: 0; }
.section-hint { color: #6b7280; font-size: 13px; margin-bottom: 16px; padding: 8px 12px; background: #f9fafb; border-radius: 6px; }
.detail-label { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.detail-row { font-size: 13px; color: #374151; margin-bottom: 4px; }
.summary-list { margin: 0; padding-left: 1.2em; font-size: 13px; color: #374151; line-height: 1.6; }
.report-options { display: flex; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }
.badge { background: #6b7280; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.badge-danger { background: #ef4444; }
.script-box { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px; font-size: 13px; line-height: 1.6; }
.script-box p { margin: 0 0 8px; }
.script-box p:last-child { margin: 0; }
.script-tip { color: #d97706; font-style: italic; }
.flow-track { display: flex; align-items: center; gap: 12px; padding: 16px 0; flex-wrap: wrap; justify-content: center; }
.flow-step { text-align: center; padding: 12px 16px; background: #f3f4f6; border-radius: 8px; min-width: 80px; }
.flow-step-active { background: #dbeafe; }
.flow-icon { font-size: 24px; margin-bottom: 4px; }
.flow-label { font-size: 12px; color: #6b7280; }
.flow-count { font-size: 18px; font-weight: 700; margin-top: 4px; }
.flow-arrow { font-size: 20px; color: #9ca3af; }
.tab-content { margin-bottom: 20px; }
  