/* 放行单的紧急预警：右上角的小弹窗。工作台和后台的每一页都会用到，所以单独放一个文件。 */

#wb-alerts {
  position: fixed; top: 16px; right: 16px; z-index: 1050;
  width: 340px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; color: #1d2433;
  border: 1px solid #f1c7c2; border-radius: 14px;
  box-shadow: 0 14px 40px rgba(122, 39, 26, 0.2), 0 2px 8px rgba(22, 34, 58, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px; line-height: 1.5; text-align: left;
}
#wb-alerts:empty { display: none; }

/* 有没人处理的预警时，外面一圈红光一闪一闪 */
#wb-alerts.has-waiting { animation: wb-alert-ring 1.6s ease-out infinite; }
@keyframes wb-alert-ring {
  0% { box-shadow: 0 14px 40px rgba(122, 39, 26, 0.2), 0 0 0 0 rgba(217, 45, 32, 0.55); }
  70%, 100% { box-shadow: 0 14px 40px rgba(122, 39, 26, 0.2), 0 0 0 10px rgba(217, 45, 32, 0); }
}
/* 新预警刚到的时候晃一下 */
#wb-alerts.is-new { animation: wb-alert-shake 0.7s ease-in-out 2; }
@keyframes wb-alert-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  #wb-alerts.has-waiting, #wb-alerts.is-new { animation: none; outline: 2px solid #d92d20; }
}

.wb-alerts-head {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 9px 12px; background: #b54708; color: #fff;
}
#wb-alerts.has-waiting .wb-alerts-head { background: #d92d20; }
.wb-alerts-mark {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
  background: #fff; color: #d92d20;
}
.wb-alerts-name { font-size: 14px; font-weight: 600; }
.wb-alerts-count {
  min-width: 20px; padding: 0 6px; border-radius: 10px; text-align: center;
  font-size: 12px; font-weight: 600; line-height: 20px; background: rgba(255, 255, 255, 0.25);
}
.wb-alerts-fold {
  margin-left: auto; padding: 2px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.6); background: transparent; color: #fff;
  font-size: 12px; font-family: inherit;
}
.wb-alerts-fold:hover { background: rgba(255, 255, 255, 0.18); }

.wb-alerts-list { overflow-y: auto; }

/* 收起以后只剩一个小条 */
#wb-alerts.is-folded { width: auto; border-radius: 999px; }
#wb-alerts.is-folded .wb-alerts-list { display: none; }
#wb-alerts.is-folded .wb-alerts-head { padding: 7px 10px 7px 12px; }

.wb-alert { padding: 12px 14px; border-bottom: 1px solid #f4e6e4; border-left: 3px solid #d92d20; }
.wb-alert:last-child { border-bottom: 0; }
.wb-alert.is-handled { border-left-color: #e08a1e; }
.wb-alert.is-late { background: #fff6f5; }

.wb-alert-title { font-size: 15px; font-weight: 700; color: #1d2433; }
.wb-alert-advice { font-size: 13px; font-weight: 600; color: #b42318; }
.wb-alert.is-handled.is-fresh .wb-alert-advice { color: #b54708; }
.wb-alert-meta { margin-top: 2px; font-size: 12px; color: #5b6578; }
.wb-alert-quote {
  margin-top: 6px; padding: 3px 8px; border-radius: 6px; font-size: 12px;
  background: #f6f8fb; color: #5b6578;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-alert-note { margin-top: 6px; font-size: 12px; color: #b54708; }

.wb-alert-pick { margin: 8px 0 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.wb-alert-pick label { margin: 0; color: #5b6578; }
.wb-alert-pick select {
  padding: 3px 6px; border-radius: 6px; border: 1px solid #d5dbe5; font-size: 12px;
  color: #1d2433; background: #fff; max-width: 150px; height: auto;
}

.wb-alert-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0 0; }
.wb-alert-btn {
  padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid #d5dbe5; background: #fff; color: #1d2433;
  font-family: inherit; white-space: nowrap; line-height: 1.5; height: auto;
}
.wb-alert-btn:hover { background: #f6f8fb; }
.wb-alert-btn.is-main { background: #d92d20; border-color: #d92d20; color: #fff; font-weight: 600; }
.wb-alert-btn.is-main:hover { background: #b42318; border-color: #b42318; }
.wb-alert.is-handled .wb-alert-btn.is-main { background: #b54708; border-color: #b54708; }

.wb-alert-more { font-size: 12px; margin-left: auto; }
.wb-alert-more summary { cursor: pointer; color: #8d96a7; list-style: none; }
.wb-alert-more summary::-webkit-details-marker { display: none; }
.wb-alert-more summary::after { content: " ▾"; }
.wb-alert-more[open] summary::after { content: " ▴"; }
.wb-alert-more[open] { flex-basis: 100%; margin-left: 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wb-alert-more[open] .wb-alert-btn { font-size: 12px; padding: 3px 10px; color: #5b6578; }

/* 和系统断开、登录到期：页面顶上一条红条。画在小弹窗外面，因为没有预警时小弹窗是隐藏的 */
#wb-offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
  padding: 10px 16px; background: #d92d20; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 2px 10px rgba(122, 39, 26, 0.35);
}
#wb-offline a { color: #fff; text-decoration: underline; margin-left: 8px; }
