/* 车间 Pad / 手机端 MES 现场操作 */
:root {
  --pad-primary: #1890ff;
  --pad-bg: #f0f2f5;
  --pad-ok: #52c41a;
  --pad-ng: #ff4d4f;
  --pad-nav-h: 56px;
  --pad-header-h: 52px;
  --pad-safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body.mes-pad-body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  background: var(--pad-bg);
  color: #1e293b;
  height: 100%;
  overflow: hidden;
}

.mes-pad {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 900px;
  margin: 0 auto;
  background: var(--pad-bg);
}

.mes-pad-header {
  flex-shrink: 0;
  height: var(--pad-header-h);
  background: linear-gradient(135deg, #1890ff, #096dd9);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(24,144,255,.25);
  z-index: 100;
}

.mes-pad-header .title { font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mes-pad-header .meta { font-size: 11px; opacity: .9; text-align: right; line-height: 1.3; }
.mes-pad-header .btn-andon {
  width: 40px; height: 40px; border: none; border-radius: 10px;
  background: rgba(255,255,255,.2); color: #fff; font-size: 20px; cursor: pointer;
}

.mes-pad-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  padding-bottom: calc(var(--pad-nav-h) + var(--pad-safe-b) + 12px);
}

.mes-pad-scroll.no-nav { padding-bottom: 12px; }

.mes-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(15,23,42,.06);
  border: 1px solid #e8eef4;
}

.mes-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

.mes-field { margin-bottom: 12px; }
.mes-field label { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 6px; }
.mes-input, .mes-select {
  width: 100%; height: 48px; font-size: 16px;
  border: 2px solid #e2e8f0; border-radius: 10px;
  padding: 0 14px; background: #fff;
}

.mes-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.mes-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer; width: 100%;
}
.mes-btn-primary { background: var(--pad-primary); color: #fff; }
.mes-btn-outline { background: #fff; border: 2px solid var(--pad-primary); color: var(--pad-primary); margin-top: 8px; }

.mes-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mes-chip {
  padding: 8px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: #e8f4fd; color: #1890ff; border: 1px solid #91caff; cursor: pointer;
}
.mes-chip.active { background: #1890ff; color: #fff; }

.mes-check-card {
  background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px;
  border-left: 4px solid #cbd5e1;
}
.mes-check-card.done { border-left-color: var(--pad-ok); background: #f6ffed; }
.mes-check-card.fail { border-left-color: var(--pad-ng); background: #fff2f0; }
.mes-check-card .name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.mes-check-card .req { font-size: 12px; color: #64748b; margin-bottom: 10px; }
.mes-check-actions { display: flex; gap: 8px; }
.mes-check-actions button {
  flex: 1; height: 44px; border: none; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.mes-check-actions .btn-ok { background: #d9f7be; color: #389e0d; }
.mes-check-actions .btn-ng { background: #ffccc7; color: #cf1322; }
.mes-check-actions .btn-edit { background: #f0f0f0; flex: 0 0 44px; }

.mes-mat-row {
  display: flex; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px;
}

.mes-fab {
  position: fixed; right: 16px; bottom: calc(var(--pad-nav-h) + var(--pad-safe-b) + 16px);
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--pad-primary); color: #fff; font-size: 28px;
  box-shadow: 0 4px 16px rgba(24,144,255,.4); cursor: pointer; z-index: 90; display: none;
}

.mes-pad-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 900px;
  height: calc(var(--pad-nav-h) + var(--pad-safe-b));
  padding-bottom: var(--pad-safe-b);
  background: #fff;
  border-top: 1px solid #e8eef4;
  display: none;
  flex-direction: row;
  align-items: stretch;
  z-index: 200;
  box-shadow: 0 -2px 12px rgba(15,23,42,.08);
}
.mes-pad-nav.is-on {
  display: flex !important;
}
.mes-pad-nav button {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-size: 10px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 2px;
}
.mes-pad-nav button i { font-size: 20px; line-height: 1; }
.mes-pad-nav button.active { color: var(--pad-primary); font-weight: 600; }

.mes-input-picker { cursor: pointer; background: #f8fafc; }
.mes-input-picker:focus { border-color: var(--pad-primary); }
.mes-panel-bar { margin-bottom: 12px; }
.mes-panel-bar .mes-btn { min-height: 44px; }
.mes-check-card .meta-line { font-size: 11px; color: #94a3b8; margin-bottom: 6px; }
.mes-check-card .note-line { font-size: 12px; color: #475569; margin-bottom: 8px; font-style: italic; }

.mes-empty { text-align: center; padding: 32px 16px; color: #94a3b8; font-size: 14px; }
.mes-badge { background: #ff4d4f; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; }

.mes-tab-panel { display: none; }
.mes-tab-panel.active { display: block; }
