:root {
  --brand: #ff6900;
  --brand-dark: #e35d00;
  --bg: #f4f6f9;
  --sidebar: #1f2430;
  --sidebar-hover: #2b3140;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: #1f2933;
  -webkit-font-smoothing: antialiased;
}

.app-shell,
.app-root {
  height: 100%;
}

/* ---------- 登录 ---------- */
.login-wrap {
  height: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #2b3140 0%, #1f2430 45%, #3a2a1c 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff8a3d, #ff6900);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 1px;
}

.login-brand h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.login-brand p {
  margin: 0;
  color: #8a94a6;
  font-size: 13px;
}

.login-btn {
  width: 100%;
  margin-top: 6px;
}

/* ---------- 框架 ---------- */
.app-aside {
  background: var(--sidebar);
  color: #cfd6e4;
  display: flex;
  flex-direction: column;
}

.aside-brand {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand);
}

.app-menu {
  flex: 1;
  border-right: none !important;
  background: transparent !important;
}

.app-menu .el-menu-item {
  color: #b8c0cf;
}

.app-menu .el-menu-item:hover {
  background: var(--sidebar-hover) !important;
  color: #fff;
}

.app-menu .el-menu-item.is-active {
  background: var(--brand) !important;
  color: #fff;
}

.app-header {
  height: 58px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-user {
  color: #5b6676;
  font-size: 14px;
}

.app-main {
  background: var(--bg);
  padding: 16px;
  overflow-y: auto;
}

/* ---------- 通用 ---------- */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

.search-row .el-input {
  flex: 1;
  min-width: 200px;
}

.batch-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hint {
  color: #8a94a6;
  font-size: 13px;
}

.muted {
  color: #8a94a6;
}

.small {
  font-size: 12px;
}

.mono {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  word-break: break-all;
}

.mb12 {
  margin-bottom: 12px;
}

.mb16 {
  margin-bottom: 16px;
}

.mt8 {
  margin-top: 8px;
}

/* ---------- 结果 ---------- */
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.meta-line {
  color: #5b6676;
  font-size: 13px;
  margin-bottom: 12px;
}

.meta-line .dot {
  margin: 0 6px;
  color: #c8cfda;
}

.raw-pre {
  background: #0f1419;
  color: #a9e34b;
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  overflow: auto;
  max-height: 320px;
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  font-size: 14px;
  flex-wrap: wrap;
}

.progress-line .ok {
  color: #21ba72;
}

.progress-line .fail {
  color: #f56c6c;
}

/* ---------- 统计卡 ---------- */
.stat-row {
  margin-bottom: 8px;
}

.stat-card {
  text-align: center;
  margin-bottom: 12px;
  border-radius: 10px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand);
}

.stat-label {
  color: #8a94a6;
  font-size: 13px;
  margin-top: 4px;
}

.guide-steps {
  padding: 8px 0;
}

/* ---------- 测试弹窗 ---------- */
.test-result {
  margin-top: 14px;
}

.test-result h4 {
  margin: 14px 0 4px;
  font-size: 14px;
}

/* ---------- 登录状态 ---------- */
.login-status {
  text-align: center;
  padding: 10px 0;
}

.login-status .el-icon {
  font-size: 42px;
  color: var(--brand);
}

.login-status .ok-icon {
  color: #21ba72;
}

.login-status .fail-icon {
  color: #f56c6c;
}

.login-status .spin {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pager {
  margin-top: 14px;
  justify-content: flex-end;
}

.more-drop {
  vertical-align: middle;
  margin-left: 6px;
}

/* ---------- 键值对列表编辑器 ---------- */
.fieldmap {
  width: 100%;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  padding: 8px 10px 10px;
  background: #fafbfc;
}

.fieldmap-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.fieldmap-title {
  font-size: 13px;
  font-weight: 600;
  color: #303133;
}

.fieldmap-hint {
  flex: 1 1 160px;
  min-width: 120px;
  line-height: 1.4;
}

.fm-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.parse-dialog .el-dialog__body {
  padding-top: 10px;
}

.fieldmap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.fm-key {
  flex: 0 0 30%;
  min-width: 0;
}

.fm-eq {
  flex: 0 0 auto;
  color: #c0c4cc;
}

.fm-val {
  flex: 1 1 auto;
  min-width: 0;
}

.fm-tf {
  flex: 0 0 118px;
}

.fm-del {
  flex: 0 0 auto;
  padding: 4px;
}

.fm-add {
  padding-left: 0;
}

.fieldmap-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
  .app-main {
    padding: 10px;
  }

  .header-title {
    font-size: 15px;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-row .el-button {
    width: 100%;
  }

  .batch-actions {
    justify-content: space-between;
  }

  .batch-actions .el-button {
    flex: 1;
  }

  .stat-value {
    font-size: 22px;
  }

  .el-dialog {
    border-radius: 12px;
  }

  .el-table {
    font-size: 12px;
  }

  .raw-pre {
    max-height: 240px;
  }

  .fm-key {
    flex-basis: 40%;
  }

  .fm-tf {
    flex-basis: 96px;
  }

  .fieldmap-row {
    gap: 6px;
  }

  .pager {
    justify-content: center;
  }
}

/* ---------- 独立前台激活查询页 ---------- */
.pub-body {
  margin: 0;
  background: #f5f7fa;
}

.pub-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pub-wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.pub-header {
  background: var(--pub-theme, #ff6900);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.pub-header-inner {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pub-logo {
  display: inline-flex;
  align-items: center;
}

.pub-header .brand-dot {
  background: #fff;
}

.pub-brand {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pub-main {
  flex: 1;
  padding-top: 20px;
  padding-bottom: 8px;
}

.pub-hero {
  text-align: center;
  padding: 8px 0 18px;
}

.pub-title {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 700;
  color: #1f2329;
  line-height: 1.35;
}

.pub-sub {
  margin: 0;
  font-size: 13px;
  color: #7a8290;
  line-height: 1.6;
}

.pub-card {
  margin-bottom: 16px;
  border-radius: 12px;
  border: none;
}

.pub-card-title {
  font-weight: 600;
}

.pub-label {
  display: block;
  font-size: 13px;
  color: #606266;
  margin-bottom: 6px;
}

.pub-btn {
  width: 100%;
  margin-top: 16px;
}

.pub-scan-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pub-scan-row .el-input {
  flex: 1;
}

.pub-scan-btn {
  flex: none;
}

.pub-scanner {
  width: 100%;
  min-height: 220px;
  overflow: hidden;
  border-radius: 8px;
}

.pub-scanner video {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.pub-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pub-row .el-button {
  flex: 1 1 140px;
  margin: 0;
}

.pub-progress {
  margin-top: 16px;
}

.pub-code-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.pub-meta {
  font-size: 12px;
  color: #909399;
  margin-bottom: 10px;
}

.pub-desc .el-descriptions__content {
  word-break: break-all;
}

.pub-table {
  width: 100%;
}

.pub-footer {
  padding: 18px 0 28px;
  text-align: center;
  font-size: 12px;
  color: #a3a9b3;
  line-height: 1.6;
}

.pub-tabs .el-tabs__header {
  margin-bottom: 18px;
}

@media (min-width: 768px) {
  .pub-header-inner {
    height: 64px;
  }

  .pub-brand {
    font-size: 18px;
  }

  .pub-main {
    padding-top: 28px;
  }

  .pub-hero {
    padding: 16px 0 24px;
  }

  .pub-title {
    font-size: 28px;
  }

  .pub-sub {
    font-size: 14px;
  }
}
