/* ==========================================================================
   账号控制台样式
   - 依赖 main.css 的 tokens（颜色 / 圆角 / 阴影 / 字体）
   - 只放登录、注册、控制台三个页面用到的组件，不污染主站样式
   ========================================================================== */

[hidden] {
  display: none !important;
}

/* --------------------------------- 勾选行 -------------------------------- */
.field__check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-400);
  cursor: pointer;
}

.field__check input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--brand-600);
}

.field__check a {
  margin: 0 2px;
}

/* --------------------------------- 布局 ----------------------------------- */
.acct {
  padding: 40px 0 96px;
  background:
    radial-gradient(760px 320px at 50% -12%, rgba(74, 104, 255, 0.1), transparent 62%),
    linear-gradient(180deg, #fbfcff, #fff 320px);
  min-height: calc(100vh - var(--nav-h) - 200px);
}

.acct__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.acct__head h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.acct__head p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-400);
}

.acct__mail {
  font-family: var(--font-mono);
  color: var(--ink-600);
}

/* --------------------------------- 统计条 ---------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.stat {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.stat dt {
  font-size: 12.5px;
  color: var(--ink-400);
  margin-bottom: 8px;
}

.stat dd {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  font-family: var(--font-sans);
}

.stat dd small {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-300);
  margin-left: 4px;
}

/* --------------------------------- 区块标题 -------------------------------- */
.block {
  margin-bottom: 30px;
}

.block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.block__head h2 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.block__head span {
  font-size: 13px;
  color: var(--ink-400);
}

/* --------------------------------- 授权卡 ---------------------------------- */
.lic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.lic {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.lic:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-sm);
}

.lic--muted {
  background: var(--bg-soft);
}

.lic__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.lic__tier {
  font-size: 13px;
  font-weight: 650;
  color: var(--brand-700);
}

.lic__code {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: var(--r-xs);
  background: var(--brand-50);
  border: 1px dashed var(--brand-200);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--ink-700);
  overflow-x: auto;
  white-space: nowrap;
}

.lic__copy {
  flex-shrink: 0;
  border: 0;
  background: none;
  padding: 0 2px;
  font-size: 12.5px;
  color: var(--brand-600);
  cursor: pointer;
  font-family: var(--font-sans);
}

.lic__copy:hover {
  text-decoration: underline;
}

.lic__meta {
  margin-top: 12px;
  display: grid;
  gap: 7px;
}

.lic__meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.lic__meta dt {
  color: var(--ink-400);
  flex-shrink: 0;
}

.lic__meta dd {
  color: var(--ink-700);
  text-align: right;
}

.seat {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.seat__bar {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--line-soft);
  overflow: hidden;
}

.seat__bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-600), var(--teal-500));
}

.seat__bar.is-full i {
  background: linear-gradient(90deg, #f0913a, #e2543c);
}

.seat__text {
  font-size: 12.5px;
  color: var(--ink-400);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* --------------------------------- 徽标 ----------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge--ok {
  color: #0a7f5f;
  background: #e6f8f1;
}

.badge--pro {
  color: var(--brand-700);
  background: var(--brand-100);
}

.badge--free {
  color: var(--ink-500);
  background: var(--line-soft);
}

.badge--warn {
  color: #a8410d;
  background: #fdf0e4;
}

.badge--off {
  color: #8a2130;
  background: #fdecef;
}

/* --------------------------------- 设备表 ---------------------------------- */
.dev-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.dev-table th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-400);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.dev-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-700);
  vertical-align: middle;
}

.dev-table tr:last-child td {
  border-bottom: 0;
}

.dev-table tbody tr:hover {
  background: var(--brand-50);
}

.dev-table .mono {
  font-size: 12.5px;
  color: var(--ink-500);
}

.dev-name {
  font-weight: 600;
  color: var(--ink-900);
}

.dev-name small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-300);
  margin-top: 2px;
}

.dev-table__action {
  text-align: right;
  white-space: nowrap;
}

.link-btn {
  border: 0;
  background: none;
  padding: 4px 6px;
  font-size: 13px;
  color: var(--brand-600);
  cursor: pointer;
  border-radius: var(--r-xs);
}

.link-btn:hover {
  background: var(--brand-100);
}

.link-btn--danger {
  color: #c02b3c;
}

.link-btn--danger:hover {
  background: #fdecef;
}

.link-btn[disabled] {
  color: var(--ink-300);
  cursor: not-allowed;
  background: none;
}

/* --------------------------------- 空态 ----------------------------------- */
.empty {
  padding: 34px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--ink-400);
  font-size: 14px;
}

.empty strong {
  display: block;
  color: var(--ink-700);
  font-size: 15px;
  margin-bottom: 6px;
}

.empty a {
  color: var(--brand-600);
}

/* --------------------------------- 内联表单 -------------------------------- */
.inline-form {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.inline-form__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form__row .input {
  flex: 1;
  min-width: 200px;
}

.inline-form__hint {
  font-size: 12.5px;
  color: var(--ink-400);
  margin: 0;
}

/* --------------------------------- 提示条 ---------------------------------- */
.form-msg {
  display: none;
  padding: 10px 13px;
  border-radius: var(--r-xs);
  font-size: 13.5px;
  line-height: 1.6;
}

.form-msg.is-error {
  display: block;
  color: #a0192b;
  background: #fdecef;
  border: 1px solid #f7ccd2;
}

.form-msg.is-ok {
  display: block;
  color: #0a7f5f;
  background: #e6f8f1;
  border: 1px solid #bfe9da;
}

/* --------------------------------- 浮层提示 -------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 16px);
  padding: 11px 18px;
  border-radius: 99px;
  background: var(--ink-900);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
  z-index: 90;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --------------------------------- 加载态 ---------------------------------- */
.is-loading {
  position: relative;
  color: transparent !important;
}

.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: acct-spin 0.7s linear infinite;
}

@keyframes acct-spin {
  to {
    transform: rotate(360deg);
  }
}

.acct__skeleton {
  height: 116px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, #f3f5fb 25%, #eaeef8 37%, #f3f5fb 63%);
  background-size: 400% 100%;
  animation: acct-shimmer 1.3s ease-in-out infinite;
}

@keyframes acct-shimmer {
  from {
    background-position: 100% 50%;
  }

  to {
    background-position: 0 50%;
  }
}

/* --------------------------------- 响应式 ---------------------------------- */
@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .stat {
    padding: 14px 14px;
  }

  .stat dd {
    font-size: 20px;
  }
}

@media (max-width: 640px) {
  .acct {
    padding: 26px 0 64px;
  }

  .acct__head h1 {
    font-size: 21px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat dd {
    font-size: 19px;
  }

  .lic-grid {
    grid-template-columns: 1fr;
  }

  /* 窄屏设备表：只留设备名与操作，其余字段降级为小字说明 */
  .dev-table thead {
    display: none;
  }

  /* 主站全局 table 有 min-width:620px，这里必须覆盖，否则窄屏横向溢出 */
  .dev-table,
  .dev-table tbody,
  .dev-table tr,
  .dev-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  /* 头部两个操作按钮在窄屏均分一整行 */
  .acct__head .btn-row {
    width: 100%;
  }

  .acct__head .btn-row .btn {
    flex: 1;
  }

  .dev-table tr {
    padding: 14px;
    border-bottom: 1px solid var(--line-soft);
  }

  .dev-table tr:hover {
    background: none;
  }

  .dev-table td {
    padding: 3px 0;
    border: 0;
  }

  .dev-table__action {
    text-align: left;
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .lic {
    transition: none;
  }

  .acct__skeleton {
    animation: none;
  }
}
