/* === 装机排期看板 Timetable === */
.install-timetable-page {
  background: var(--clr-muted, #f8fafc);
  min-height: 100%;
  padding-bottom: 60px;
  box-sizing: border-box;
}

.tt-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* --- 顶栏 --- */
.tt-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.tt-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tt-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.tt-priority-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  color: #475569;
}

.tt-pri-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.tt-pri-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 10px;
  color: #fff;
}

.tt-pri-1 { color: #059669; }
.tt-pri-1 .tt-pri-num { background: #10b981; }

.tt-pri-2 { color: #d97706; }
.tt-pri-2 .tt-pri-num { background: #f59e0b; }

.tt-pri-3 { color: #2563eb; }
.tt-pri-3 .tt-pri-num { background: #3b82f6; }

.tt-pri-sep {
  color: #94a3b8;
  font-size: 10px;
}

.tt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 视图模式切换 */
.tt-view-modes {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
}

.tt-vbtn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tt-vbtn:hover {
  color: #1e293b;
}

.tt-vbtn.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tt-search {
  width: 220px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

/* --- 分局大卡片导航栏 --- */
.tt-branch-cards-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}

.tt-branch-cards-title {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.tt-branch-cards-grid {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.tt-bcard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 110px;
  white-space: nowrap;
}

.tt-bcard:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.tt-bcard.active {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}

.tt-bc-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tt-bc-total {
  font-size: 14px;
  font-weight: 700;
  color: #1d4ed8;
}

.tt-bc-sub {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
}

.tt-bc-sub .overdue { color: #dc2626; font-weight: 600; }
.tt-bc-sub .today { color: #0284c7; font-weight: 600; }

/* --- 统计概览条 --- */
.tt-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.tt-stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.tt-stat-card .tt-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.tt-stat-card .tt-stat-lbl {
  font-size: 11px;
  color: #64748b;
}

.tt-stat-card.tt-stat-overdue .tt-stat-val { color: #dc2626; }
.tt-stat-card.tt-stat-today .tt-stat-val { color: #0284c7; }
.tt-stat-card.tt-stat-tomorrow .tt-stat-val { color: #059669; }

/* --- 课表矩阵视图 Matrix --- */
.tt-matrix-wrap {
  padding: 16px 20px;
  overflow-x: auto;
}

.tt-matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12.5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tt-matrix-table th, .tt-matrix-table td {
  padding: 10px 12px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  text-align: center;
  vertical-align: middle;
}

.tt-matrix-table th {
  background: #1e3a8a;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

.tt-matrix-table th.tt-col-overdue {
  background: #dc2626;
}

.tt-matrix-table th.tt-col-today {
  background: #0284c7;
}

.tt-matrix-table th.tt-col-tomorrow {
  background: #059669;
}

.tt-matrix-table td.tt-cell-worker {
  text-align: left;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.tt-matrix-table td.tt-cell-team {
  text-align: left;
  color: #475569;
  font-size: 12px;
}

.tt-matrix-table td.tt-cell-branch {
  font-weight: 600;
  color: #1e40af;
  background: #eff6ff;
  white-space: nowrap;
}

/* 矩阵单元格微卡片 */
.tt-cell-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tt-cell-box:hover {
  background: #f1f5f9;
}

.tt-cell-box.has-orders {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.tt-cell-box.has-orders.is-overdue {
  background: #fef2f2;
  border-color: #fecaca;
}

.tt-cell-box.has-orders.is-overdue .tt-cell-badge {
  color: #dc2626;
}

.tt-cell-box.has-orders.is-today {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.tt-cell-box.has-orders.is-today .tt-cell-badge {
  color: #0284c7;
}

.tt-cell-box.has-orders:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tt-cell-badge {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
}

.tt-cell-empty {
  color: #cbd5e1;
  font-size: 13px;
}

.tt-matrix-total-row td {
  background: #fef9c3;
  font-weight: 700;
  color: #854d0e;
  border-top: 2px solid #ca8a04;
}

/* --- 个人排期视图 Timetable --- */
.tt-single-worker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.tt-worker-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tt-worker-select {
  min-width: 200px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.tt-worker-info-card {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: #475569;
}

.tt-timetable-grid-wrap {
  padding: 20px;
  overflow-x: auto;
}

.tt-worker-columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}

.tt-bucket-col {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tt-bucket-head {
  padding: 10px 14px;
  background: #1e40af;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tt-bucket-head.is-overdue { background: #dc2626; }
.tt-bucket-head.is-today { background: #0284c7; }
.tt-bucket-head.is-tomorrow { background: #059669; }

.tt-bucket-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 150px;
}

/* 工单便签卡片 */
.tt-order-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #3b82f6;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12px;
}

.tt-order-card:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.tt-order-card.pri-appoint { border-left-color: #10b981; }
.tt-order-card.pri-company { border-left-color: #f59e0b; }
.tt-order-card.pri-expect  { border-left-color: #3b82f6; }

.tt-oc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.tt-oc-time {
  font-weight: 700;
  color: #0f172a;
}

.tt-oc-source-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}

.tt-oc-source-tag.pri-appoint { background: #d1fae5; color: #065f46; }
.tt-oc-source-tag.pri-company { background: #fef3c7; color: #92400e; }
.tt-oc-source-tag.pri-expect  { background: #dbeafe; color: #1e40af; }

.tt-oc-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tt-oc-acct {
  font-weight: 600;
  color: #1e293b;
  font-family: monospace;
}

.tt-oc-cust {
  color: #475569;
}

.tt-oc-addr {
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-oc-biz {
  display: inline-block;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #f1f5f9;
  color: #475569;
  margin-top: 4px;
}

/* --- 全量明细表格视图 Table --- */
.tt-table-wrap {
  padding: 16px 20px;
  overflow-x: auto;
}

.tt-detail-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12.5px;
}

.tt-detail-table th, .tt-detail-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.tt-detail-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.tt-detail-table tr:hover td {
  background: #f8fafc;
}

/* --- 工单卡片抽屉 Drawer --- */
.tt-drawer-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.tt-drawer-mask[hidden] {
  display: none !important;
}

.tt-drawer {
  width: 480px;
  max-width: 90vw;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  animation: ttDrawerIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ttDrawerIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.tt-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.tt-drawer-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tt-drawer-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.tt-drawer-subtitle {
  font-size: 12px;
  color: #64748b;
}

.tt-drawer-close {
  border: none;
  background: transparent;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.tt-drawer-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.tt-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tt-drawer-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tt-dc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tt-dc-time {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.tt-dc-row {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
}

.tt-dc-lbl {
  color: #64748b;
  min-width: 65px;
}

.tt-dc-val {
  color: #1e293b;
  font-weight: 500;
}

.tt-dc-val.mono {
  font-family: monospace;
}

.tt-dc-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

@media (max-width: 768px) {
  .tt-header { padding: 10px 14px; }
  .tt-branch-cards-bar { padding: 10px 14px; }
  .tt-matrix-wrap, .tt-table-wrap, .tt-timetable-grid-wrap { padding: 10px 14px; }
  .tt-search { width: 100%; }
}
