/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0d1117; color: #c9d1d9;
  font-family: -apple-system, "Microsoft YaHei", sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}

/* === Top Bar === */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: #161b22; border-bottom: 1px solid #21262d;
}
.topbar-left h1 { font-size: 18px; color: #f0f6fc; font-weight: 600; }
.powerby { font-size: 11px; color: #484f58; font-weight: 400; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.last-upload { font-size: 12px; color: #8b949e; }
.btn-upload { padding: 8px 20px; background: #238636; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-upload:hover { background: #2ea043; }
.btn-upload-hw { padding: 8px 20px; background: #da3633; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-upload-hw:hover { background: #f85149; }
.btn-upload-photo { padding: 8px 20px; background: #6f42c1; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-upload-photo:hover { background: #8957e5; }
.btn-log { padding: 8px 16px; background: #21262d; color: #c9d1d9; border: 1px solid #30363d; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-log:hover { background: #30363d; }
.btn-dynamic { padding: 8px 16px; background: #1f6feb; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-dynamic:hover { background: #388bfd; }
.btn-workload { padding: 8px 16px; background: #f0883e; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-workload:hover { background: #f59e4b; }
.btn-logout { padding: 8px 16px; background: transparent; color: #8b949e; border: 1px solid #30363d; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-logout:hover { color: #f0f6fc; border-color: #484f58; }

/* === Filter Bar === */
.filter-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: #161b22; border-bottom: 1px solid #21262d; font-size: 13px; flex-wrap: wrap;
}
.filter-bar label { color: #8b949e; }
.filter-bar select, .filter-bar input[type="date"] {
  background: #0d1117; border: 1px solid #30363d; border-radius: 6px;
  color: #c9d1d9; padding: 6px 10px; font-size: 13px; outline: none;
}
.filter-bar select:focus, .filter-bar input[type="date"]:focus { border-color: #58a6ff; }
.btn-reset { padding: 6px 14px; background: #21262d; color: #c9d1d9; border: 1px solid #30363d; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-reset:hover { background: #30363d; }
.tl-search-bar {
  padding: 6px 12px; font-size: 13px; width: 180px;
  background: #0d1117; border: 1px solid #58a6ff; border-radius: 6px;
  color: #c9d1d9; outline: none;
}
.tl-search-bar:focus { border-color: #79c0ff; box-shadow: 0 0 0 2px rgba(88,166,255,0.2); }
.tl-search-bar::placeholder { color: #8b949e; }
.view-btns { display: flex; gap: 0; margin-left: 8px; }
.btn-view { padding: 6px 14px; background: #21262d; color: #8b949e; border: 1px solid #30363d; cursor: pointer; font-size: 12px; }
.btn-view:first-child { border-radius: 6px 0 0 6px; }
.btn-view:last-child { border-radius: 0 6px 6px 0; }
.btn-view.active { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.btn-view:hover:not(.active) { background: #30363d; }
.summary { color: #8b949e; margin-left: auto; font-size: 12px; white-space: nowrap; }
.summary strong { color: #58a6ff; }

/* === Timeline === */
.timeline-wrap { flex: 1; overflow: hidden; }
.timeline-empty, .timeline-loading { display: flex; align-items: center; justify-content: center; height: 200px; color: #8b949e; font-size: 14px; }
.timeline-root { display: flex; flex-direction: column; height: 100%; }

.tl-header-row { display: flex; flex-shrink: 0; border-bottom: 1px solid #21262d; background: #161b22; }
.tl-left-header {
  width: 360px; flex-shrink: 0; padding: 10px 16px;
  font-size: 12px; color: #8b949e; font-weight: 600;
  border-right: 1px solid #21262d; display: flex; align-items: flex-end;
}
.tl-right-header { flex: 1; overflow-x: auto; }
.tl-right-header::-webkit-scrollbar { height: 8px; }
.tl-right-header::-webkit-scrollbar-track { background: #161b22; }
.tl-right-header::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
.tl-right-header::-webkit-scrollbar-thumb:hover { background: #484f58; }
.tl-date-row { display: flex; white-space: nowrap; }
.tl-date-col { flex-shrink: 0; text-align: center; padding: 4px 0; border-right: 1px solid #111820; }
.tl-date-col.tl-today { background: rgba(88,166,255,0.12); }
.tl-date-day { color: #c9d1d9; font-size: 12px; line-height: 1.3; }
.tl-date-dow { color: #8b949e; font-size: 10px; line-height: 1.3; }
.tl-date-weather { color: #58a6ff; font-size: 10px; line-height: 1.3; }
.tl-date-temp { color: #8b949e; font-size: 9px; line-height: 1.3; }

.tl-body { flex: 1; display: flex; overflow: hidden; }
.tl-left-col { width: 360px; flex-shrink: 0; border-right: 1px solid #21262d; overflow-y: auto; overflow-x: hidden; background: #0d1117; }
.tl-left-col::-webkit-scrollbar { width: 0; }
.tl-row-label {
  padding: 6px 12px; height: 36px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid #111820; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.tl-row-label:hover { background: #161b22; }
.tl-row-label.tl-danger .tl-proj-name { color: #f85149; font-weight: 600; }
.tl-row-label.tl-danger .tl-proj-admin { color: #f85149; }
.tl-type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tl-proj-name { font-size: 12px; color: #c9d1d9; overflow: hidden; text-overflow: ellipsis; }
.tl-proj-admin { font-size: 10px; color: #58a6ff; flex-shrink: 0; margin-left: auto; }

.tl-right-col { flex: 1; overflow: auto; background: #0d1117; }
.tl-day-row { display: flex; height: 36px; border-bottom: 1px solid #111820; align-items: center; }
.tl-day-row:nth-child(odd) { background: #0a1017; }
.tl-day-cell { flex-shrink: 0; height: 24px; border-right: 1px solid #161b22; }
.tl-day-cell.tl-filled { border-radius: 3px; cursor: pointer; opacity: 0.85; }
.tl-day-cell.tl-filled:hover { opacity: 1; outline: 1px solid rgba(255,255,255,0.3); }
.tl-day-cell.tl-today-cell { border-right-color: rgba(88,166,255,0.3); }
.tl-day-cell.tl-highlight { box-shadow: 0 0 6px 2px rgba(255,255,255,0.5); outline: 2px solid #fff; z-index: 1; position: relative; }

.tl-right-col::-webkit-scrollbar { width: 8px; height: 8px; }
.tl-right-col::-webkit-scrollbar-track { background: #0d1117; }
.tl-right-col::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
.tl-right-col::-webkit-scrollbar-thumb:hover { background: #484f58; }
.tl-right-col::-webkit-scrollbar-corner { background: #0d1117; }

/* === Modal === */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 100; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 28px 32px; width: 480px; }
.modal-box h2 { font-size: 17px; margin-bottom: 20px; color: #f0f6fc; }
.drop-zone { border: 2px dashed #30363d; border-radius: 8px; padding: 40px; text-align: center; cursor: pointer; transition: border-color 0.2s; }
.drop-zone:hover, .drop-zone.dragover { border-color: #58a6ff; }
.drop-zone p { color: #8b949e; margin: 4px 0; }
.modal-actions { margin-top: 20px; text-align: right; }
.btn-cancel { padding: 8px 20px; background: #21262d; color: #c9d1d9; border: 1px solid #30363d; border-radius: 6px; cursor: pointer; }
.btn-cancel:hover { background: #30363d; }
#uploadMsg { color: #58a6ff; }
#uploadMsg.error { color: #f85149; }

/* Upload log */
.log-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #21262d; font-size: 13px; }
.log-item:hover { background: #0d1117; }
.log-item-info { color: #c9d1d9; flex: 1; }
.log-item-time { color: #8b949e; font-size: 11px; }
.log-item-count { color: #58a6ff; font-size: 11px; margin-left: 8px; }
.btn-del { padding: 4px 12px; background: transparent; color: #f85149; border: 1px solid #30363d; border-radius: 4px; cursor: pointer; font-size: 11px; margin-left: 12px; }
.btn-del:hover { background: #da3633; color: #fff; border-color: #da3633; }

/* === Detail Panel === */
.detail-panel { position: fixed; right: 0; top: 0; bottom: 0; width: 420px; background: #161b22; border-left: 1px solid #21262d; z-index: 50; overflow-y: auto; box-shadow: -4px 0 16px rgba(0,0,0,0.5); }
.detail-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #21262d; position: sticky; top: 0; background: #161b22; z-index: 1; }
.detail-header h3 { color: #f0f6fc; font-size: 16px; }
.btn-close-detail { background: none; border: none; color: #8b949e; font-size: 22px; cursor: pointer; }
.btn-close-detail:hover { color: #f0f6fc; }
.detail-body { padding: 20px; }
.detail-section { margin-bottom: 24px; }
.detail-section-title { color: #58a6ff; font-size: 14px; font-weight: 600; padding-bottom: 8px; border-bottom: 1px solid #21262d; margin-bottom: 12px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #111820; }
.detail-label { color: #8b949e; font-size: 12px; }
.detail-value { color: #c9d1d9; font-size: 13px; text-align: right; max-width: 360px; }
.detail-day-card { background: #0d1117; border: 1px solid #21262d; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.detail-day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.detail-day-date { color: #58a6ff; font-size: 13px; font-weight: 600; }
.detail-day-time { background: #1f6feb; color: #fff; border-radius: 4px; padding: 2px 8px; font-size: 11px; }
.detail-day-people { color: #c9d1d9; font-size: 13px; margin-bottom: 6px; }
.detail-day-people strong { color: #f0f6fc; }
.detail-day-work { color: #8b949e; font-size: 12px; margin-top: 4px; line-height: 1.5; }
.detail-icon { margin-right: 4px; }
.btn-edit-detail { padding: 4px 14px; background: #21262d; color: #58a6ff; border: 1px solid #30363d; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-edit-detail:hover { background: #30363d; }
.btn-save-detail { padding: 4px 14px; background: #238636; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-save-detail:hover { background: #2ea043; }
.detail-input { background: #0d1117; border: 1px solid #58a6ff; border-radius: 4px; color: #c9d1d9; padding: 4px 8px; font-size: 13px; width: 180px; outline: none; text-align: right; }

/* Worker schedule grid */
.ws-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.ws-table th, .ws-table td { border: 1px solid #21262d; padding: 6px 8px; vertical-align: top; }
.ws-table thead th { background: #161b22; position: sticky; top: 0; z-index: 2; color: #8b949e; white-space: nowrap; min-width: 80px; text-align: center; }
.ws-table .ws-name { position: sticky; left: 0; background: #0d1117; z-index: 1; font-weight: 600; color: #f0f6fc; white-space: nowrap; min-width: 70px; }
.ws-table thead .ws-name { z-index: 3; background: #161b22; }
.ws-entry { margin-bottom: 3px; line-height: 1.4; }
.ws-time-tag { font-size: 10px; padding: 1px 4px; border-radius: 3px; margin-right: 3px; }
.ws-time-am { background: #1f6feb; color: #fff; }
.ws-time-pm { background: #da3633; color: #fff; }
.ws-time-full { background: #238636; color: #fff; }
.detail-day-hazard { color: #f85149; font-size: 12px; margin-top: 4px; padding: 4px 8px; background: rgba(248,81,73,0.1); border-left: 2px solid #f85149; border-radius: 0 4px 4px 0; line-height: 1.5; }

/* ========== 移动端适配 (max-width: 768px) ========== */
@media (max-width: 768px) {
  /* 顶部栏 */
  .topbar { padding: 8px 10px; flex-wrap: wrap; }
  .topbar-left h1 { font-size: 13px; }
  .powerby { font-size: 9px; margin-left: 4px; display: block; }
  .topbar-right { flex-wrap: wrap; gap: 6px; }
  .topbar-right .btn-upload, .topbar-right .btn-upload-hw,
  .topbar-right .btn-log, .topbar-right .btn-dynamic,
  .topbar-right .btn-workload, .topbar-right .btn-logout {
    padding: 6px 10px; font-size: 11px;
  }
  .last-upload { display: none; }

  /* 筛选栏 */
  .filter-bar { padding: 6px 8px; gap: 6px; font-size: 11px; }
  .filter-bar select, .filter-bar input[type="date"] { padding: 5px 6px; font-size: 11px; }
  .tl-search-bar { width: 100%; max-width: 140px; }
  .btn-reset { padding: 5px 10px; font-size: 11px; }
  .btn-view { padding: 5px 10px; font-size: 11px; }
  .summary { font-size: 10px; white-space: normal; margin-left: 4px; }

  /* 时间线 - 左侧列缩小 */
  .tl-left-header, .tl-left-col { width: 150px !important; min-width: 150px; }
  .tl-left-header { padding: 8px 8px; font-size: 11px; }
  .tl-row-label { padding: 4px 6px; height: 40px; }
  .tl-proj-name { font-size: 11px; }
  .tl-proj-admin { display: none; }
  .tl-day-row { height: 40px; }
  .tl-day-cell { height: 28px; }

  /* 详情面板全屏 */
  .detail-panel { width: 100vw; }

  /* 弹窗全宽 */
  .modal-box { width: 94vw !important; max-width: 94vw !important; padding: 16px 14px; }
  .drop-zone { padding: 24px 16px; }

  /* 统计卡片 */
  .tl-date-day { font-size: 10px; }
  .tl-date-weather { font-size: 9px; }
}


/* 全过程阶段时间标记点 */
.tl-mark { display: block; width: 7px; height: 7px; border-radius: 50%; margin: 1px auto 0; }
.tl-mark.tl-mark-done { background: #3fb950; }
.tl-mark.tl-mark-pending { background: #f0883e; border: 1px solid #0d1117; }
.tl-mark.tl-mark-overdue { background: #f85149; border: 1px solid #0d1117; }
.tl-day-cell.tl-has-mark { cursor: pointer; }
