/* app.css — 全站样式（移动优先） */

:root {
  /* 主题色 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;

  /* 状态色 */
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --ok-dark: #15803d;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --bad-dark: #b91c1c;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --muted-color: #6b7280;
  --muted-soft: #f1f5f9;

  /* 中性色 */
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);

  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* 全局兜底：`hidden` 属性必须真的隐藏。
   ⚠️ 本项目多处 class（.btn / .lightbox / .submit-bar / .staff-chip …）在作者样式里设了 display，
   作者样式优先级高于 UA 的 [hidden]{display:none}，导致这些元素的 hidden 属性完全失效
   （曾造成 .lightbox 全屏遮罩常驻、后台被盖住点不动）。故用 !important 强制。
   不要删除本条规则。 */
[hidden] {
  display: none !important;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
}

a {
  color: var(--primary);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1 1 auto;
}

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav-links a:hover {
  background: var(--muted-soft);
  color: var(--text);
}

.nav-links a.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: #bfdbfe;
  font-weight: 600;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}

.userbar-email {
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------ 布局 ------------------------------ */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px;
  padding-bottom: 40px;
}

.page-narrow {
  max-width: 720px;
}

.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-title .sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.grid-2 {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

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

.row-between {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.spacer {
  flex: 1 1 auto;
}

/* ------------------------------ 按钮 ------------------------------ */

.btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--muted-soft);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
  font-weight: 600;
}

.btn-danger:hover:not(:disabled) {
  background: var(--bad-dark);
  border-color: var(--bad-dark);
}

.btn-ok {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
  font-weight: 600;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--muted-soft);
  color: var(--text);
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-link {
  min-height: auto;
  border: 0;
  background: none;
  color: var(--primary);
  padding: 4px 6px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}

/* ------------------------------ 表单 ------------------------------ */

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

.textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field {
  margin-bottom: 12px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.required-mark {
  color: var(--bad);
  font-weight: 700;
  margin-left: 4px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 15px;
}

.checkbox-line input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

/* ------------------------------ 徽标 / 提示条 ------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}

.badge-ok { background: var(--ok-soft); color: var(--ok-dark); }
.badge-bad { background: var(--bad-soft); color: var(--bad-dark); }
.badge-warn { background: var(--warn-soft); color: #92400e; }
.badge-muted { background: var(--muted-soft); color: var(--muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-key { background: #450a0a; color: #fff; }

.banner {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid transparent;
}

.banner-bad { background: var(--bad-soft); color: var(--bad-dark); border-color: #fecaca; }
.banner-warn { background: var(--warn-soft); color: #92400e; border-color: #fde68a; }
.banner-ok { background: var(--ok-soft); color: var(--ok-dark); border-color: #bbf7d0; }
.banner-info { background: var(--primary-soft); color: var(--primary-dark); border-color: #bfdbfe; }

.empty {
  padding: 26px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.loading {
  padding: 26px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------ 员工端登记页 ------------------------------ */

.device-hero {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
}

.device-hero .hero-name {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  word-break: break-all;
}

.device-hero .hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.95;
}

.device-hero .hero-meta b {
  font-weight: 600;
}

.item-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  transition: border-color 0.15s;
}

.item-row.is-abnormal {
  border-color: #fca5a5;
  background: #fffafa;
}

.item-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.tri-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tri-btn {
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}

.tri-btn:hover {
  border-color: var(--border-strong);
  background: var(--muted-soft);
}

.tri-btn[data-status="正常"].is-on {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.tri-btn[data-status="异常"].is-on {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.tri-btn[data-status="不适用"].is-on {
  background: var(--muted-color);
  border-color: var(--muted-color);
  color: #fff;
}

.item-note {
  margin-top: 10px;
}

.item-note.is-hidden {
  display: none;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.photo-thumb {
  position: relative;
  padding-top: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--muted-soft);
}

.photo-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-add {
  position: relative;
  padding-top: 100%;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  color: var(--muted);
}

.photo-add span {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
}

.photo-add span i {
  font-style: normal;
  font-size: 22px;
  line-height: 1;
}

.photo-add input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.submit-bar .inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.submit-bar .btn {
  flex: 1 1 auto;
  min-height: 50px;
  font-size: 16px;
}

.submit-bar .hint {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.has-submit-bar {
  padding-bottom: 96px;
}

/* 成功页 */
.success-hero {
  text-align: center;
  padding: 26px 16px 18px;
}

.success-hero .tick {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 38px;
  line-height: 68px;
  margin: 0 auto 12px;
  font-weight: 700;
}

.success-hero h2 {
  font-size: 21px;
}

.kv-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.kv-list li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.kv-list li:last-child {
  border-bottom: 0;
}

.kv-list .k {
  color: var(--muted);
  flex: 0 0 84px;
}

.kv-list .v {
  flex: 1 1 auto;
  word-break: break-all;
}

/* ------------------------------ 看板 ------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 13px;
  color: var(--muted);
}

.stat-card .value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 2px;
}

.stat-card .unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.stat-ok .value { color: var(--ok); }
.stat-bad .value { color: var(--bad); }
.stat-warn .value { color: var(--warn); }
.stat-primary .value { color: var(--primary); }

.rate-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.rate-big {
  font-size: 46px;
  font-weight: 800;
  color: var(--ok);
  line-height: 1;
}

.rate-big.is-low { color: var(--warn); }
.rate-big.is-bad { color: var(--bad); }

.progress {
  flex: 1 1 200px;
  height: 18px;
  border-radius: 999px;
  background: var(--muted-soft);
  overflow: hidden;
  min-width: 160px;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.35s ease;
}

.card-list {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.ab-card {
  border: 1px solid #fecaca;
  border-left: 4px solid var(--bad);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 13px;
}

.ab-card.is-key {
  border-color: #b91c1c;
  border-left: 5px solid #b91c1c;
  background: #fff5f5;
}

.ab-card .ab-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}

.ab-card .ab-name {
  font-size: 16px;
  font-weight: 700;
}

.ab-card .ab-sub {
  font-size: 13px;
  color: var(--muted);
}

.ab-items {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.ab-items li {
  font-size: 14px;
  color: var(--bad-dark);
}

.ab-items li::before {
  content: "•";
  margin-right: 6px;
}

.ab-remark {
  margin-top: 8px;
  font-size: 14px;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: #78350f;
}

.ab-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ab-photos img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.ab-foot {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* 趋势 */
.chart-box {
  overflow-x: auto;
}

.chart-box svg {
  display: block;
  min-width: 520px;
  width: 100%;
  height: auto;
}

.bar-row {
  display: grid;
  grid-template-columns: 118px 1fr 42px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
}

.bar-row .bar-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.bar-track {
  height: 16px;
  background: var(--muted-soft);
  border-radius: 999px;
  overflow: hidden;
}

.bar-track > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f87171, #dc2626);
  border-radius: 999px;
}

.bar-row .bar-val {
  text-align: right;
  color: var(--bad);
  font-weight: 700;
}

details.missed {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
}

details.missed > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  outline: none;
}

details.missed .missed-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

details.missed .missed-list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

details.missed .missed-list li:last-child {
  border-bottom: 0;
}

/* ------------------------------ 表格 ------------------------------ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}

table.data th,
table.data td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table.data th {
  background: #f8fafc;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data td.wrap {
  white-space: normal;
  min-width: 160px;
}

/* ------------------------------ 标签页 ------------------------------ */

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

.tab {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

/* ------------------------------ 模态 ------------------------------ */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-mask.is-hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-body {
  padding: 16px;
}

.modal-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* ------------------------------ 登录页 ------------------------------ */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 16px;
  background: linear-gradient(160deg, #eff6ff, #f4f6f8 60%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
}

.auth-title {
  font-size: 21px;
  font-weight: 800;
  text-align: center;
}

.auth-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 18px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--muted-soft);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.segmented button.is-active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: var(--shadow);
}

.otp-row {
  display: flex;
  gap: 10px;
}

.otp-row .input {
  flex: 1 1 auto;
}

.otp-row .btn {
  flex: 0 0 auto;
  min-width: 116px;
}

.auth-alt {
  text-align: center;
  font-size: 13px;
  margin-top: 12px;
}

.auth-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-msg {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.auth-msg.is-on {
  display: block;
}

.auth-msg.err {
  background: var(--bad-soft);
  color: var(--bad-dark);
}

.auth-msg.ok {
  background: var(--ok-soft);
  color: var(--ok-dark);
}

/* ------------------------------ 提示 / 致命错误 ------------------------------ */

.toast-container {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 460px);
}

.toast {
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  background: rgba(31, 41, 55, 0.94);
  color: #fff;
  box-shadow: var(--shadow-lg);
  max-width: 100%;
  text-align: center;
  transition: opacity 0.25s, transform 0.25s;
}

.toast-error { background: rgba(185, 28, 28, 0.96); }
.toast-success { background: rgba(21, 128, 61, 0.96); }
.toast-warn { background: rgba(180, 83, 9, 0.96); }

.toast-hide {
  opacity: 0;
  transform: translateY(8px);
}

.fatal-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.fatal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.fatal-card h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.fatal-card p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 16px;
}

/* ------------------------------ 二维码打印页 ------------------------------ */

.qr-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 12px;
}

.qr-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  break-inside: avoid;
  page-break-inside: avoid;
}

.qr-card canvas {
  width: 152px;
  height: 152px;
}

.qr-card .code {
  font-size: 17px;
  font-weight: 800;
  margin-top: 8px;
  letter-spacing: 0.5px;
}

.qr-card .name {
  font-size: 14px;
  margin-top: 3px;
}

.qr-card .loc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.qr-card .passcode {
  display: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 4px;
  color: var(--text);
}

.qr-grid.show-pass .qr-card .passcode {
  display: block;
}

/* ------------------------------ 员工端：人员标记 / 口令门 ------------------------------ */

.staff-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  max-width: 46vw;
  overflow: hidden;
  white-space: nowrap;
}

.staff-chip:hover {
  background: #cfe4fe;
}

.staff-chip-arrow {
  font-size: 11px;
  opacity: 0.8;
}

.gate-box {
  border-color: #bfdbfe;
  background: #f8faff;
}

.gate-title {
  font-size: 17px;
  margin-bottom: 4px;
}

.gate-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.gate-row .input {
  flex: 1 1 auto;
}

.gate-row .btn {
  flex: 0 0 auto;
}

/* 口令未通过时遮住操作区（设备基础信息仍可见） */
#opArea.is-locked {
  pointer-events: none;
  opacity: 0.5;
  filter: blur(1.5px);
  user-select: none;
}

/* 人员 / 设备点选卡（去掉异常红边条） */
.ab-card-plain {
  border: 1px solid var(--border);
  border-left: 1px solid var(--border);
  cursor: pointer;
}

.ab-card-plain:hover {
  border-color: var(--primary);
  background: #f8faff;
}

/* 设备台账里的扫码 Token 单元格 */
.token-cell {
  white-space: nowrap;
}

.token-cell code {
  font-size: 12px;
  background: var(--muted-soft);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--text);
}

/* ------------------------------ 响应式 ------------------------------ */

@media (min-width: 720px) {
  body { font-size: 15px; }
  .page { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(5, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .card-list { grid-template-columns: repeat(2, 1fr); }
  .device-hero .hero-name { font-size: 30px; }
}

@media (min-width: 1024px) {
  .card-list { grid-template-columns: repeat(3, 1fr); }
  .device-hero { padding: 22px; }
}

/* ------------------------------ 打印 ------------------------------ */

@media print {
  body {
    background: #fff;
  }
  .topbar,
  .qr-toolbar,
  .toast-container,
  .no-print {
    display: none !important;
  }
  .qr-card {
    border: 1px dashed #999;
  }
  .qr-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  @page {
    size: A4;
    margin: 10mm;
  }
}

/* ------------------------------ 员工端班次选择（一日三检） ------------------------------ */

.shift-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.shift-btn {
  flex: 1 1 0;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.shift-btn:hover {
  border-color: var(--primary);
}
.shift-btn.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}

/* ------------------------------ 看板：一日三检进度卡片 ------------------------------ */

.shift-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.shift-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
.shift-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.shift-rate {
  font-size: 24px;
  font-weight: 800;
  color: var(--ok);
  margin: 4px 0 8px;
  line-height: 1;
}
.shift-rate.is-low {
  color: var(--warn);
}
.shift-rate.is-bad {
  color: var(--bad);
}
/* 进度轨道：仅在三检卡片内覆盖通用 .shift-bar（按钮容器）的 flex 行为 */
.shift-card .shift-bar {
  display: block;
  height: 6px;
  background: var(--muted-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.shift-card .shift-bar > i {
  display: block;
  height: 100%;
  background: var(--ok);
}
.shift-card .shift-bar.is-low > i {
  background: var(--warn);
}
.shift-card .shift-bar.is-bad > i {
  background: var(--bad);
}
.shift-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------ 看板：风险等级（模块四占位） ------------------------------ */

.risk-section.is-placeholder {
  opacity: .55;
}
.value.is-bad {
  color: var(--bad) !important;
}
