/* ============================================================
   页面对局 + 业务样式
   ============================================================ */

body {
  min-height: 100vh;
  background: linear-gradient(180deg, #eef3fb 0%, #f6f8fc 42%, #f5f7fa 100%);
  background-attachment: fixed;
}

#app {
  padding: 28px 20px 60px;
  max-width: 1240px;
  margin: 0 auto;
}

/* 有导航时给内容让出固定头部的高度 */
body.has-nav #app {
  padding-top: 82px;
}

/* ---------------------------------------------------------- 顶部导航条 */
.app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 64px;
  padding: 0 20px;
  pointer-events: none;
}

.app-bar:empty {
  display: none;
}

.app-bar > * {
  pointer-events: auto;
}

.page-corner__inner {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--el-border-lighter);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(64, 158, 255, 0.14);
  max-width: 100%;
}

.page-corner__divider {
  width: 1px;
  height: 20px;
  background: var(--el-border-lighter);
  margin: 0 6px;
  flex: none;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.page-nav__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--el-text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--el-transition);
}

.page-nav__item svg {
  flex: none;
  opacity: 0.72;
}

.page-nav__item:hover {
  background: rgba(64, 158, 255, 0.1);
  color: var(--el-primary);
}

.page-nav__item.is-active {
  background: linear-gradient(135deg, #409eff, #667eea);
  color: #fff;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
}

.page-nav__item.is-active svg {
  opacity: 1;
}

.page-corner__inner .el-button {
  height: 34px;
  padding: 0 16px;
  font-size: 13.5px;
  border-radius: 999px;
}

.page-corner__inner .el-button--text {
  padding: 0 12px;
  border-radius: 999px;
  color: var(--el-text-secondary);
}

/* 中等屏：导航只显示图标 */
@media (max-width: 1140px) {
  .page-corner__inner .page-nav__label {
    display: none;
  }

  .page-nav__item {
    padding: 0 10px;
  }
}

/* 窄屏：导航落到顶部并横向滚动 */
@media (max-width: 720px) {
  .app-bar {
    padding: 0 10px;
    height: 60px;
  }

  .page-corner__inner {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .page-corner__inner::-webkit-scrollbar {
    display: none;
  }

  body.has-nav #app {
    padding-top: 74px;
  }
}

/* ---------------------------------------------------------- 品牌标识 */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo .brand-mark {
  width: 34px;
  height: 40px;
}

.brand-logo .brand-en {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1f2233;
  line-height: 1;
}

.brand-logo .brand-cn {
  font-size: 26px;
  font-weight: 800;
  color: #1f2233;
  line-height: 1;
}

/* ---------------------------------------------------------- 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 34px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(64, 100, 180, 0.16);
}

.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--el-text-secondary);
  letter-spacing: 1px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-input {
  position: relative;
}

.login-input__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #b4bccc;
  display: inline-flex;
  pointer-events: none;
  transition: color var(--el-transition);
}

.login-input:focus-within .login-input__icon {
  color: var(--el-primary);
}

.login-input__inner {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 46px;
  border: 1px solid var(--el-border);
  border-radius: 999px;
  background: #fbfcfe;
  color: var(--el-text-strong);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: all var(--el-transition);
}

.login-input__inner::placeholder {
  color: #c0c4cc;
}

.login-input__inner:focus {
  border-color: var(--el-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(64, 158, 255, 0.13);
}

.login-input__inner.is-error {
  border-color: var(--el-danger);
}

.login-error {
  padding: 9px 14px;
  border-radius: 10px;
  background: #fef0f0;
  border: 1px solid rgba(245, 108, 108, 0.3);
  color: #c45656;
  font-size: 13px;
  text-align: center;
}

.login-submit {
  height: 48px;
  margin-top: 6px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #409eff, #667eea);
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  transition: all var(--el-transition);
  box-shadow: 0 10px 24px rgba(64, 158, 255, 0.32);
}

.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(64, 158, 255, 0.4);
}

.login-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.login-submit:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

/* ---------------------------------------------------------- 通用页头 */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
}

.header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  color: #303133;
  letter-spacing: 0.5px;
}

/* ---------------------------------------------------------- 看板 */
.ecpm-dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.filter-card .el-card__body {
  padding: 22px 24px;
}

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

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-item > label {
  font-size: 14px;
  color: var(--el-text);
  white-space: nowrap;
}

.filter-item .el-input,
.filter-item .el-select {
  width: 190px;
}

.filter-item .el-input__inner {
  height: 38px;
  border-radius: 8px;
}

.filter-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
}

.filter-actions .el-button {
  min-width: 96px;
}

/* 统计卡 */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card .el-card__body {
  padding: 22px 20px;
  text-align: center;
}

.stat-label {
  font-size: 13.5px;
  color: var(--el-text-secondary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 27px;
  font-weight: 700;
  color: #1f2233;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-unit {
  font-size: 15px;
  font-weight: 500;
  color: var(--el-text-secondary);
  margin-left: 2px;
}

/* 最终数据渐变卡 */
.final-cards {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.final-card {
  border: none;
  background: linear-gradient(135deg, #5b6ef5 0%, #7c5cf0 52%, #8f5ae8 100%);
  box-shadow: 0 14px 32px rgba(91, 110, 245, 0.28);
}

.final-card .el-card__body {
  padding: 24px 20px;
  text-align: center;
}

.final-label {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 10px;
}

.final-value {
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.final-unit {
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin-left: 2px;
}

.refresh-fab {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translate(50%, -50%);
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #f6f8fc;
  border-radius: 50%;
  background: #fff;
  color: var(--el-primary);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(64, 158, 255, 0.28);
  transition: all var(--el-transition);
}

.refresh-fab:hover {
  color: #fff;
  background: linear-gradient(135deg, #409eff, #667eea);
  transform: translate(50%, -50%) rotate(180deg);
}

/* 实时指标条 */
.realtime-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  border: 1px solid var(--el-border-lighter);
  border-radius: var(--el-radius-lg);
  background: #fff;
  box-shadow: var(--el-shadow);
  overflow: hidden;
}

.realtime-strip .chip {
  padding: 15px 12px;
  text-align: center;
  border-right: 1px solid var(--el-border-lighter);
  min-width: 0;
}

.realtime-strip .chip:last-child {
  border-right: none;
}

.chip-label {
  font-size: 12px;
  color: var(--el-text-secondary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-value {
  font-size: 17px;
  font-weight: 700;
  color: #1f2233;
  white-space: nowrap;
}

.chip-value.is-accent {
  background: linear-gradient(135deg, #409eff, #7c5cf0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 趋势图 */
.spark-card .el-card__body {
  padding: 18px 22px 14px;
}

.spark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.spark-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--el-text-secondary);
}

.spark-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0c4cc;
  flex: none;
}

.spark-title.is-on .spark-dot {
  background: var(--el-success);
  box-shadow: 0 0 0 4px rgba(103, 194, 58, 0.16);
  animation: pulse 2s ease-in-out infinite;
}

.spark-range {
  font-size: 12.5px;
  color: var(--el-text-secondary);
}

.spark-wrap {
  height: 170px;
}

.sparkline {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

/* 明细表 */
.data-table .el-card__body {
  padding: 8px 4px 4px;
}

.data-table .el-table td {
  font-size: 12.5px;
  white-space: nowrap;
}

.sort-caret {
  display: inline-flex;
  vertical-align: middle;
  color: #c0c4cc;
  margin-left: 2px;
}

.cost-red {
  color: #f56c6c;
  font-weight: 700;
}

.cost-blue {
  color: #409eff;
  font-weight: 700;
}

.cost-green {
  color: #67c23a;
  font-weight: 700;
}

.cost-gray {
  color: var(--el-text);
}

/* ---------------------------------------------------------- 账号管理 / 游戏信息 */
.account-manage .content,
.game-info .content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.operation-bar .search-input {
  width: 240px;
  height: 40px;
}

.operation-bar .el-button {
  height: 40px;
}

.role-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.role-tag--user {
  background: #f0f9eb;
  color: #529b2e;
  border: 1px solid rgba(103, 194, 58, 0.3);
}

.role-tag--admin {
  background: #ecf5ff;
  color: #337ecc;
  border: 1px solid rgba(64, 158, 255, 0.3);
}

/* 启用开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--el-text-secondary);
  font-family: inherit;
}

.switch__dot {
  position: relative;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: #dcdfe6;
  transition: background-color var(--el-transition);
  flex: none;
}

.switch__dot::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--el-transition);
}

.switch.is-on .switch__dot {
  background: var(--el-success);
}

.switch.is-on .switch__dot::after {
  transform: translateX(20px);
}

.switch.is-on .switch__text {
  color: #529b2e;
}

/* 触点标签 */
.touch-tag {
  display: inline-block;
  padding: 3px 10px;
  margin: 2px 4px 2px 0;
  border-radius: 6px;
  background: linear-gradient(135deg, #ecf5ff, #eef0ff);
  border: 1px solid rgba(64, 158, 255, 0.24);
  color: #337ecc;
  font-size: 12px;
  font-weight: 500;
}

/* ---------------------------------------------------------- 有效触点面板 */
.touch-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rule-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--el-border-lighter);
  border-radius: 12px;
  background: #fbfcfe;
}

.rule-index {
  flex: none;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #409eff, #667eea);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}

.rule-body {
  flex: 1;
  min-width: 0;
}

.rule-text {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--el-text);
}

.rule-tags {
  display: flex;
  flex-wrap: wrap;
}

.url-section h4 {
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--el-text-strong);
}

.url-hint {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.7;
}

.url-hint--warn {
  background: #fdf6ec;
  border: 1px solid rgba(230, 162, 60, 0.35);
  color: #b88230;
}

.url-hint--ok {
  background: #f0f9eb;
  border: 1px solid rgba(103, 194, 58, 0.3);
  color: #529b2e;
}

.url-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.url-input-row .el-input__inner {
  flex: 1;
  min-width: 0;
  height: 40px;
}

.url-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--el-border-lighter);
  border-radius: 10px;
  background: #f7f9fc;
}

.url-box code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  color: #475569;
  word-break: break-all;
}

.url-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* ---------------------------------------------------------- 响应式 */
@media (max-width: 1024px) {
  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .realtime-strip {
    grid-template-columns: repeat(4, 1fr);
  }

  .realtime-strip .chip:nth-child(4n) {
    border-right: none;
  }

  .realtime-strip .chip:nth-child(-n + 4) {
    border-bottom: 1px solid var(--el-border-lighter);
  }

  .refresh-fab {
    right: 12px;
    top: -8px;
    transform: none;
  }

  .refresh-fab:hover {
    transform: rotate(180deg);
  }
}

@media (max-width: 860px) {
  .final-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #app {
    padding: 20px 12px 48px;
  }

  .filter-item .el-input,
  .filter-item .el-select {
    width: 100%;
  }

  .filter-item {
    width: 100%;
  }

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

  .stats-cards {
    grid-template-columns: 1fr;
  }

  .realtime-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .realtime-strip .chip {
    border-right: 1px solid var(--el-border-lighter);
    border-bottom: 1px solid var(--el-border-lighter);
  }

  .realtime-strip .chip:nth-child(2n) {
    border-right: none;
  }

  .operation-bar .search-input {
    width: 100%;
  }

  .login-card {
    padding: 30px 22px 26px;
  }

  .brand-logo .brand-en {
    font-size: 24px;
  }

  .brand-logo .brand-cn {
    font-size: 21px;
  }
}
