/* ============================================================
   工程师排期 · 页面特有样式
   共享组件见 shell.css
   ============================================================ */

/* 统计卡 3 列 */
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1279px) {
  .stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .stat-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 视图切换 */
.view-switch {
  display: inline-flex;
  background: var(--color-bg-card);
  border: var(--border-card);
  border-radius: var(--radius-btn);
  padding: 2px;
}
.view-btn {
  height: 36px;
  padding: 0 var(--sp-4);
  border-radius: 6px;
  font-size: var(--fs-body);
  color: var(--color-text-secondary);
  transition: all .2s var(--ease);
}
.view-btn.active {
  background: var(--color-primary);
  color: #fff;
}

/* 日期导航 */
.date-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.nav-arrow {
  width: 36px; height: 36px;
  border: var(--border-card);
  border-radius: var(--radius-btn);
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.nav-arrow:hover { border-color: var(--color-primary); color: var(--color-primary); }
.period-label {
  font-size: var(--fs-body);
  color: var(--color-text-primary);
  font-weight: 500;
  min-width: 160px;
  text-align: center;
}

/* 图例 */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
  padding: 0 var(--sp-1);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
}
.legend-bar {
  width: 3px;
  height: 14px;
  border-radius: 2px;
}

/* ============ 周历 ============ */
.week-wrap {
  overflow: hidden;
}
.week-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  /* 右边缘渐隐提示，避免横向滚动时出现"半张卡硬切" */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.week-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  table-layout: fixed;
}
.week-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--color-table-head);
  color: var(--color-text-secondary);
  font-size: var(--fs-table-head);
  font-weight: var(--fw-table-head);
  text-align: center;
  padding: 0 var(--sp-2);
  height: 48px;
  border-bottom: var(--border-card);
  white-space: nowrap;
}
.week-table thead th.col-eng {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 160px;
  text-align: left;
  padding-left: var(--sp-4);
  background: var(--color-table-head);
  border-right: 2px solid var(--color-border);
}
.week-table thead th.today {
  color: var(--color-primary);
  background: rgba(37, 99, 235, .06);
}
.week-table thead th.weekend { color: var(--color-text-tertiary); }
.week-table thead th .wh-dow,
.week-table thead th .dow { display: block; font-size: var(--fs-aux); color: inherit; opacity: .85; }
.week-table thead th .wh-date { display: block; font-size: 13px; margin-top: 2px; color: var(--color-text-primary); }
.week-table thead th.weekend .wh-date,
.week-table thead th.today .wh-date { color: inherit; }

.week-table tbody td {
  height: 116px;
  vertical-align: top;
  padding: var(--sp-2);
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-card);
}
.week-table tbody td.col-eng {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-bg-card);
  border-right: 2px solid var(--color-border);
  padding: var(--sp-3) var(--sp-4);
  width: 160px;
}
.week-table tbody tr:last-child td { border-bottom: none; }

.eng-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.eng-name {
  font-weight: 600;
  font-size: var(--fs-body);
  color: var(--color-text-primary);
}
.eng-status-tag { align-self: flex-start; }

/* 注意：.day-cell 是 td，必须保持 table-cell；flex 布局放在内层 .day-cell-inner 上，
   否则 7 个日期格会脱离表格行、纵向堆叠（行高被撑到 800px+）。
   不设 max-height/overflow:hidden：td 的 height:116px 对表格行等价于最小高度，
   任务多于 3 张时整行自动加高，绝不裁切卡片。 */
.week-table tbody td.day-cell { padding: 4px 2px; }
.day-cell-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 周历任务卡紧凑模式：客户名 11px 单行省略（128px 列宽约可显 10 字），
   卡高 ≈31px，同格 3 张 = 97px 仍在 116px 行高内；更多则行自动加高 */
.week-table .task-card { padding: 2px 4px; width: 100%; text-align: left; }
.week-table .task-card .tc-customer {
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.week-table .task-card .tc-time {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 任务卡：3px 左色条 + 淡底 + 深色文字，不整块铺色 */
.task-card {
  border-radius: 6px;
  padding: 4px 8px;
  font-size: var(--fs-aux);
  line-height: 1.4;
  border-left: 3px solid var(--card-color, var(--biz-other));
  background: var(--card-bg, var(--tag-bg-other));
  color: var(--color-text-primary);
  cursor: pointer;
  transition: box-shadow .15s var(--ease);
  overflow: hidden;
}
.task-card:hover { box-shadow: 0 2px 8px rgba(23, 59, 112, .1); }
.task-card .tc-customer {
  font-weight: 500;
  font-size: 11px;
  line-height: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-card .tc-time {
  color: var(--color-text-secondary);
  font-size: 10px;
  line-height: 12px;
  margin-top: 1px;
}
.task-card.pending { opacity: .75; border-left-style: dashed; }

/* ≥1024：七天全部塞进可视区，不出现裁切 */
@media (min-width: 1024px) and (max-width: 1279px) {
  .week-table thead th.col-eng { width: 118px; }
  .week-table tbody td.col-eng { width: 118px; }
  .task-card { font-size: 11px; padding: 4px 7px; }
  .week-table .task-card .tc-customer { font-size: 10.5px; letter-spacing: -0.2px; }
  .task-card .tc-time { font-size: 10px; }
}

/* ============ 手机日视图 ============ */
.day-strip {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-2) 0 var(--sp-3);
  -webkit-overflow-scrolling: touch;
}
.day-chip {
  flex: 0 0 auto;
  min-width: 56px;
  text-align: center;
  padding: var(--sp-2) var(--sp-3);
  border: var(--border-card);
  border-radius: var(--radius-btn);
  background: var(--color-bg-card);
  cursor: pointer;
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
}
.day-chip .dc-dow { display: block; font-size: 11px; }
.day-chip .dc-day { display: block; font-size: 18px; font-weight: 600; color: var(--color-text-primary); }
.day-chip.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}
.day-chip.active .dc-day { color: #fff; }
.day-chip.is-today .dc-day { font-size: 16px; }
.day-chip.is-today.active .dc-day { font-size: 16px; }

.eng-day-card {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
}
.eng-day-card:last-child { border-bottom: none; }
.eng-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.eng-day-name { font-weight: 600; }
.eng-day-head .eng-dot { margin-top: 0; }
.eng-day-tasks { display: flex; flex-direction: column; gap: var(--sp-2); }
.eng-day-empty { font-size: var(--fs-aux); color: var(--color-text-tertiary); padding: var(--sp-2) 0; }

/* ============ 月视图 ============ */
.month-wrap { padding: 0; }
.month-calendar { min-width: 0; }
.month-weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.month-weekdays {
  border-bottom: var(--border-card);
  background: var(--color-table-head);
}
.month-weekdays span {
  text-align: center;
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
  padding: var(--sp-2) 0;
}
.month-weekdays span.weekend { color: var(--color-text-tertiary); }
.month-grid { grid-auto-rows: 104px; }
.month-cell {
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
  transition: background .15s var(--ease);
}
.month-cell:nth-child(7n) { border-right: none; }
.month-cell:hover { background: var(--color-table-head); }
.month-cell.other-month { background: rgba(246, 249, 253, .6); cursor: default; }
.month-cell.other-month:hover { background: rgba(246, 249, 253, .6); }
.month-cell.weekend .mc-date { color: var(--color-text-tertiary); }
.mc-date {
  font-size: var(--fs-aux);
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.mc-today-tag {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border-radius: 4px;
  padding: 0 5px;
  line-height: 16px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.month-cell.today .mc-date { color: var(--color-primary); }
.month-cell.today { background: rgba(37, 99, 235, .05); }
.mc-count { font-size: 11px; color: var(--color-text-tertiary); line-height: 1.2; }
.mc-bars { display: flex; flex-direction: column; gap: 2px; margin-top: 1px; }
.mc-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  line-height: 16px;
  color: var(--color-text-secondary);
  background: var(--bar-bg, var(--tag-bg-other));
  border-radius: 3px;
  padding: 0 5px;
  white-space: nowrap;
  overflow: hidden;
}
.mc-bar .mb-dot {
  flex: 0 0 auto;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--bar-color, var(--biz-other));
}
.mc-bar .mb-text { overflow: hidden; text-overflow: ellipsis; }

/* ============ 手机日视图：工程师时间轴 ============ */
.day-chip.is-today .dc-dow { color: var(--color-primary); font-weight: 600; }
.day-chip.weekend { color: var(--color-text-tertiary); }
.day-chip.active.weekend { color: #fff; }
.day-chip.active.weekend .dc-dow { color: #fff; }

.tl { display: flex; }
.tl-times { flex: 0 0 46px; }
.tl-time {
  height: 40px;
  font-size: 10px;
  color: var(--color-text-tertiary);
  text-align: right;
  padding-right: 8px;
  line-height: 1;
  padding-top: 1px;
}
.tl-track {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 360px;
}
.tl-line {
  position: absolute;
  left: 0; right: 6px;
  border-top: 1px dashed var(--color-border);
}
.tl-task {
  position: absolute;
  left: 0;
  right: 6px;
  border-left: 3px solid var(--card-color, var(--biz-other));
  background: var(--card-bg, var(--tag-bg-other));
  border-radius: 6px;
  padding: 3px 7px;
  overflow: hidden;
  cursor: pointer;
}
.tl-task .tc-customer {
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-task .tc-time {
  display: block;
  font-size: 10px;
  line-height: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-task.pending { opacity: .78; border-left-style: dashed; }

/* ============ 手机周视图：七日列表 ============ */
.mw-day { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--color-border); }
.mw-day.today { background: rgba(37, 99, 235, .04); }
.mw-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.mw-date { font-size: var(--fs-body); font-weight: 600; }
.mw-date .mw-today-tag {
  font-size: 10px; font-weight: 600; color: #fff; background: var(--color-primary);
  border-radius: 4px; padding: 0 5px; margin-left: 6px;
}
.mw-count { font-size: 11px; color: var(--color-text-tertiary); }
.mw-tasks { display: flex; flex-direction: column; gap: 6px; }
.mw-empty { font-size: var(--fs-aux); color: var(--color-text-tertiary); }

/* 手机周看板任务卡第二行：工程师同色点 + 姓名 · 时间 · 类型，单行省略不撑高 */
.mw-task-card { width: 100%; text-align: left; }
.mw-task-card .tc-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
  min-width: 0;
}
.mw-task-card .mw-eng-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.mw-task-card .tc-meta-text {
  min-width: 0;
  font-size: 10px;
  line-height: 12px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 筛选弹层导出组 */
.sheet-export-group {
  border-top: 1px solid var(--color-border);
  padding-top: var(--sp-3);
}
.sheet-export-group .dropdown-item { border: var(--border-card); margin-bottom: var(--sp-2); }

/* PC 端 view-switch 保持可见；月视图按钮 */
@media (min-width: 768px) {
  .day-view-wrap.mobile-list { padding: 0; }
  .eng-day-card { background: var(--color-bg-card); border: var(--border-card); border-radius: var(--radius-card); margin-bottom: var(--sp-3); }
}

/* ============ 图例行 + 权限小字（S10 / S22） ============ */
.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.legend-row .legend { margin-bottom: 0; }
.legend-pending {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: repeating-linear-gradient(to bottom, var(--color-warning) 0 3px, rgba(233, 162, 59, .25) 3px 6px);
}
.perm-hint {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

/* ============ 周历工程师列（S23 行计数） ============ */
.eng-cell { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; }
.eng-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--color-primary);
}
.eng-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eng-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}
.day-cell { cursor: pointer; }
.day-cell:hover { background: var(--color-table-head); }

/* ============ 详情抽屉 ============ */
.detail-list { display: flex; flex-direction: column; }
.detail-row {
  display: flex;
  gap: var(--sp-4);
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--fs-body);
}
.detail-row:last-child { border-bottom: none; }
.detail-row dt {
  flex: 0 0 76px;
  color: var(--color-text-tertiary);
  font-size: var(--fs-aux);
  padding-top: 1px;
}
.detail-row dd { flex: 1; min-width: 0; color: var(--color-text-primary); word-break: break-word; }
.detail-row dd .eng-dot { display: inline-block; margin: 0 6px 1px 0; }
.cancel-reason-text { color: var(--color-danger); }

/* ============ 预约表单（S11–S19） ============ */
.form-hint { font-size: 11px; color: var(--color-text-tertiary); margin-top: 4px; }
.form-error.multiline { white-space: pre-line; }
.check-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  padding: 8px var(--sp-3);
  border: var(--border-card);
  border-radius: var(--radius-input);
  background: var(--color-bg-card);
}
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-body);
  color: var(--color-text-primary);
  cursor: pointer;
}
.check-item input { margin: 0; }
.check-item .eng-dot { margin: 0; }

/* ============ 取消预约块（S21） ============ */
.cancel-block {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--color-border);
}
.cancel-title {
  font-size: var(--fs-aux);
  color: var(--color-text-secondary);
  margin-bottom: var(--sp-3);
}
.cancel-title.danger { color: var(--color-danger); line-height: 1.5; margin-bottom: var(--sp-3); }
.cancel-actions { display: flex; gap: var(--sp-3); }
.cancel-actions .btn { flex: 1; }
.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border: 1px solid var(--color-danger);
}
.btn-danger:hover { background: #D03A3F; border-color: #D03A3F; }
.btn-danger-outline {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}
.btn-danger-outline:hover { background: rgba(229, 72, 77, .06); }

/* 手机日视图：今天且选中时，「今天」字样保持白色可见 */
.day-chip.active .dc-dow,
.day-chip.active.is-today .dc-dow { color: #fff; }

/* 响应式：手机隐藏周历/图例行，保留视图切换 */
@media (max-width: 767px) {
  .week-wrap { display: none; }
  .legend,
  .legend-row { display: none; }
  .desk-filter-items { display: none !important; }
  .period-label { min-width: 0; flex: 1 1 auto; text-align: left; }
  .month-grid { grid-auto-rows: 88px; }
  .month-cell { padding: 4px 5px; }
  .mc-bar { font-size: 0; padding: 0 4px; height: 13px; }
  .mc-bar .mb-text { display: none; }
  .mc-count { font-size: 10px; }
  .view-switch { order: 0; }
  .date-nav { order: 1; width: 100%; }
  .filter-bar { gap: var(--sp-2); }
  .page-header-right { gap: 8px; }
}
