/* =========================================================
   用户中心 + 登录页
========================================================= */

/* —— 登录页 —— */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  position: relative;
  z-index: 1;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  padding: 36px 36px 28px;
  box-shadow: 0 32px 80px -32px rgba(11,18,48,.22);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 22px;
  padding: 1px;
  background: var(--grad-electric);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .35;
  pointer-events: none;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-brand .iso-logo {
  width: 54px; height: 54px;
  border-radius: 14px;
  background: var(--grad-electric);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-brand);
}
.login-brand .meta { line-height: 1.3; }
.login-brand .meta .nm {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-strong);
}
.login-brand .meta .sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 3px;
}
.login-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 22px;
}
.login-card .btn-primary { width: 100%; padding: 11px 16px; font-size: 14px; }
.login-tip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-soft);
  letter-spacing: 0.04em;
}
.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 14px;
  display: none;
}
.login-error.show { display: block; }

/* —— 用户中心:软件卡片网格 —— */
.sw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.sw-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease);
  overflow: hidden;
}
.sw-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 200px at -10% -20%, rgba(61,90,254,.08), transparent 60%);
  opacity: 0;
  transition: opacity .28s var(--ease);
  pointer-events: none;
}
.sw-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-brand);
  border-color: rgba(61,90,254,.28);
}
.sw-card:hover::before { opacity: 1; }
.sw-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.sw-iso {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--grad-iso);
  border: 1px solid rgba(61,90,254,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 14px -6px rgba(61,90,254,.18);
  display: grid;
  place-items: center;
  color: var(--brand-600);
}
.sw-iso svg { width: 26px; height: 26px; }
.sw-meta { flex: 1; min-width: 0; }
.sw-meta .nm {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sw-meta .ver {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--brand-600);
  background: rgba(61,90,254,.08);
  border-radius: 5px;
  padding: 1px 7px;
}
.sw-card-desc {
  font-size: 12.8px;
  color: var(--text-muted);
  line-height: 1.6;
  position: relative;
  z-index: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}
.sw-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
  position: relative;
  z-index: 1;
}
.sw-stat-item { display: flex; flex-direction: column; gap: 2px; }
.sw-stat-item .lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}
.sw-stat-item .val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.sw-stat-item .val.warn { color: var(--warning); }
.sw-stat-item .val.danger { color: var(--danger); }
.sw-actions {
  display: flex;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.sw-actions .btn-primary { flex: 1; }
.sw-card.disabled { opacity: 0.65; }
.sw-card.disabled .btn-primary { background: var(--text-faint); box-shadow: none; }
.sw-card.disabled .btn-primary::after { display: none; }

/* 平台 chip */
.plat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 5px;
  padding: 1px 6px;
  letter-spacing: 0.04em;
  margin-left: 4px;
}

/* 用户中心 hero */
.user-hero {
  background: linear-gradient(135deg, rgba(61,90,254,.08), rgba(6,182,212,.05));
  border: 1px solid rgba(61,90,254,.18);
  border-radius: 18px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.user-hero-iso {
  width: 76px; height: 76px;
  border-radius: 18px;
  background: var(--grad-electric);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}
.user-hero-iso svg { width: 36px; height: 36px; }
.user-hero h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.user-hero .desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.user-hero .stats {
  display: flex;
  gap: 24px;
  margin-left: auto;
  flex-wrap: wrap;
}
.user-hero .stat-item .num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--brand-600);
  letter-spacing: -0.02em;
  line-height: 1;
}
.user-hero .stat-item .lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ============================================================
   v10 — 卡片内模型展开列表 + 按钮 + 操作区
============================================================ */

/* 折叠按钮箭头旋转 */
.btn-ghost .chevron {
  transition: transform 0.2s ease;
  width: 14px; height: 14px;
  margin-left: 2px;
}
.btn-ghost.open .chevron {
  transform: rotate(180deg);
}

/* 详情图标按钮 */
.btn-icon {
  padding: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 模型展开面板 */
.sw-models {
  margin-top: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg,
              rgba(99, 102, 241, .04) 0%,
              rgba(99, 102, 241, .02) 100%);
  border: 1px solid rgba(99, 102, 241, .12);
  border-radius: 10px;
}
.sw-models-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(99,102,241,.18);
  margin-bottom: 6px;
}
.sw-models-head i { width: 13px; height: 13px; color: #6366f1; }
.model-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px dashed rgba(99,102,241,.10);
}
.model-row:last-child { border-bottom: 0; }
.model-info { flex: 1; min-width: 0; }
.model-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-name .model-ver {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: normal;
  color: var(--text-faint);
  margin-left: 4px;
}
.model-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-faint);
  align-items: center;
}
.model-fmt {
  background: rgba(99, 102, 241, .12);
  color: #4f46e5;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.model-remain {
  font-family: var(--font-mono);
  padding: 1px 8px;
  border-radius: 4px;
  background: rgba(16,185,129,.10);
  color: #047857;
  font-weight: 600;
}
.model-remain.warn { background: rgba(245,158,11,.10); color: #b45309; }
.model-remain.danger { background: rgba(239,68,68,.10); color: #b91c1c; }
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  height: 28px;
}
.model-row .btn-sm i { width: 13px; height: 13px; }


/* ============================================================
   使用说明 — 下载前确认 modal
============================================================ */
.usage-confirm-modal {
  max-width: 600px;
  width: calc(100% - 24px);
}
.usage-confirm-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.usage-confirm-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -4px rgba(99,102,241,.45);
}
.usage-confirm-icon i { width: 18px; height: 18px; color: #fff; }
.usage-confirm-title h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
  word-break: break-all;
}
.usage-confirm-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  word-break: break-all;
}
.usage-confirm-body {
  padding: 0 24px 4px;
  /* 旧的 max-height: 50vh 移除 — 改用父级 .modal 的 flex 结构 */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  font-size: 14px;
  color: var(--text-body);
  line-height: 1.75;
}
.usage-confirm-body h1,
.usage-confirm-body h2,
.usage-confirm-body h3 {
  font-family: var(--font-display);
  color: var(--text-strong);
  margin: 16px 0 8px;
  font-weight: 700;
}
.usage-confirm-body h1 { font-size: 17px; }
.usage-confirm-body h2 { font-size: 15.5px; }
.usage-confirm-body h3 { font-size: 14px; }
.usage-confirm-body h2:first-child,
.usage-confirm-body h3:first-child,
.usage-confirm-body h1:first-child { margin-top: 4px; }
.usage-confirm-body p { margin: 6px 0; }
.usage-confirm-body ul,
.usage-confirm-body ol { margin: 6px 0 8px; padding-left: 22px; }
.usage-confirm-body li { margin: 3px 0; }
.usage-confirm-body code {
  background: rgba(0,0,0,.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #be123c;
}
.usage-confirm-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin: 10px 0;
}
.usage-confirm-body strong { color: var(--text-strong); }
.usage-confirm-empty {
  padding: 30px 24px;
  text-align: center;
}
.usage-confirm-empty i {
  width: 32px; height: 32px;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.usage-confirm-empty p {
  margin: 4px 0;
  font-size: 14px;
  color: var(--text-muted);
}
.usage-confirm-empty p.hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 8px;
}
.usage-confirm-hint {
  margin: 8px 24px 0;
  padding: 10px 12px;
  background: rgba(245,158,11,.06);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #92400e;
  flex-shrink: 0;       /* flex 布局下不被压缩 */
}
.usage-confirm-empty {
  flex-shrink: 0;       /* "暂无说明"提示不被压缩 */
}
.usage-confirm-hint i { width: 14px; height: 14px; flex-shrink: 0; }

/* ============================================================
   v11 — 卡片操作区:辅助按钮一排 + 主下载按钮独占下排
   + 大模型清单 Modal
============================================================ */

/* 卡片操作区分两排 */
.sw-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.sw-actions-secondary .btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}
.sw-actions-secondary .btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sw-actions-primary {
  margin-top: 8px;
}
.btn-block {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
}
.btn-block i { width: 16px; height: 16px; }


/* —— 大模型清单 Modal —— */
.models-modal {
  max-width: 620px;
  width: calc(100% - 24px);
}
.models-modal-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.models-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -4px rgba(99,102,241,.45);
}
.models-modal-icon i { width: 18px; height: 18px; color: #fff; }
.models-modal-title h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
}
.models-modal-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.models-modal-body {
  padding: 4px 24px 8px;
  /* 旧的 max-height: 60vh 移除 — 改用父级 .modal 的 flex 结构 */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.model-modal-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg,
              rgba(99, 102, 241, .04) 0%,
              rgba(99, 102, 241, .02) 100%);
  border: 1px solid rgba(99, 102, 241, .15);
  border-radius: 10px;
  transition: all 0.15s ease;
}
.model-modal-row:hover {
  border-color: rgba(99, 102, 241, .35);
  box-shadow: 0 4px 12px -4px rgba(99,102,241,.20);
}
.model-modal-row.exhausted {
  opacity: 0.7;
  filter: grayscale(0.4);
}
.model-modal-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(99, 102, 241, .12);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.model-modal-icon i { width: 16px; height: 16px; color: #6366f1; }
.model-modal-info { flex: 1; min-width: 0; }
.model-modal-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.model-modal-name .model-ver {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: normal;
  color: var(--text-faint);
  background: rgba(0,0,0,.05);
  padding: 1px 6px;
  border-radius: 4px;
}
.model-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  align-items: center;
}
.model-modal-meta .model-fmt {
  background: rgba(99, 102, 241, .15);
  color: #4f46e5;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.model-modal-meta .model-remain {
  font-family: var(--font-mono);
  padding: 1px 8px;
  border-radius: 4px;
  background: rgba(16,185,129,.10);
  color: #047857;
  font-weight: 600;
}
.model-modal-meta .model-remain.warn { background: rgba(245,158,11,.10); color: #b45309; }
.model-modal-meta .model-remain.danger { background: rgba(239,68,68,.10); color: #b91c1c; }
.model-modal-meta .model-remain.info { background: rgba(59,130,246,.10); color: #1d4ed8; }
.model-modal-meta .model-used {
  color: var(--text-faint);
}
.model-modal-row .btn-sm {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 12.5px;
  height: 32px;
}

/* ============================================================
   v12 — 软件详情页 card 间距
============================================================ */
#detail-container > .card,
#detail-container > .detail-hero {
  margin-bottom: 22px;
}
#detail-container > .card:last-child,
#detail-container > .detail-hero:last-child {
  margin-bottom: 0;
}
