/* =========================================================
   展信包装 · 网站管理后台 v1.6 · 扩展模块样式（F2）
   ---------------------------------------------------------------
   仅在 app.css / manage.css / ext.css 基础上补充本模块特有样式：
   - 频道模型：模型列表 / 字段管理小图标与计数胶囊
   - 主题模板：主题卡片网格 + 预览 iframe
   - 会员：头像 + 级别管理表格
   - 订单：行内状态下拉、商品明细编辑器、订单详情
   - 留言：内容摘要
   - 图片设置：表单 + 九宫格位置 + Canvas 实时预览面板
   - 伪静态：配置表单 + 规则代码块 + 路径解析结果
   公共按钮 / 卡片 / 表单 / 表格 / 徽标 / 开关 / 分页一律复用 app.css / manage.css。
   ========================================================= */

/* ---------- 1. 通用小元素 ---------- */
.ext2-toolbar { min-height: 58px; }
.ext2-toolbar-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ext2-toolbar-line .spacer { flex: 1 1 auto; }
.ext2-sub-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 18px 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.ext2-sub-title .icon { color: var(--brand); }
.ext2-select-sm {
  width: auto;
  min-width: 108px;
  height: 34px;
  padding: 0 30px 0 10px;
  font-size: 12.5px;
}
.ext2-input-xs {
  width: 76px;
  flex: none;
  padding: 8px 8px;
  font-size: 12.5px;
}
.ext2-input-sm {
  width: 90px;
  flex: none;
  padding: 7px 9px;
  font-size: 12.5px;
}
.ext2-cell-mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  word-break: break-all;
}
.ext2-money {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}
.ext2-money-lg {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.ext2-count-pill {
  min-width: 27px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--info-soft);
  color: var(--info);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ext2-count-pill.zero { background: #F1F2F4; color: var(--muted-2); }

/* 说明条（与 ext.css 的 .ext-note 保持一致） */
.ext2-note {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  margin-top: 16px;
  border-radius: 9px;
  background: var(--info-soft);
  color: #1D4ED8;
  font-size: 12.5px;
  line-height: 1.7;
}
.ext2-note .icon { flex: none; margin-top: 2px; }
.ext2-note.warn { background: var(--warn-soft); color: var(--warn); margin-top: 0; margin-bottom: 16px; }

/* ---------- 2. 频道模型 ---------- */
.ext2-model-icon {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------- 3. 主题模板 ---------- */
.ext2-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.ext2-theme-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.ext2-theme-card:hover {
  border-color: #DFE2E5;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.ext2-theme-card.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(189, 17, 43, .08); }
.ext2-theme-cover {
  position: relative;
  height: 158px;
  overflow: hidden;
  background: radial-gradient(520px 240px at 10% 0%, #343A40 0%, #23272B 60%, #1D2023 100%);
  display: grid;
  place-items: center;
}
.ext2-theme-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ext2-theme-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
}
.ext2-theme-placeholder .icon { color: #F0AEBA; }
.ext2-theme-flag {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .5);
}
.ext2-theme-body { display: flex; flex-direction: column; gap: 7px; padding: 15px 16px 16px; flex: 1 1 auto; }
.ext2-theme-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ext2-theme-name { font-size: 15px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext2-theme-dir { font-size: 11.5px; color: var(--muted-2); }
.ext2-theme-desc {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 41px;
}
.ext2-theme-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted-2);
}
.ext2-theme-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ext2-theme-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* 主题预览 iframe */
.ext2-iframe-wrap {
  width: 100%;
  height: 66vh;
  min-height: 380px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.ext2-preview-iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

/* ---------- 4. 会员管理 ---------- */
.ext2-avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.ext2-member-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.ext2-member-main { min-width: 0; }
.ext2-level-table { min-width: 560px; }
.ext2-level-table .input { height: 32px; padding: 5px 9px; font-size: 12.5px; }
.ext2-level-add {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.ext2-level-add .form-grid { margin-bottom: 4px; }

/* ---------- 5. 订单管理 ---------- */
.ext2-order-items { min-width: 520px; }
.ext2-col-num { text-align: right; font-variant-numeric: tabular-nums; }
.ext2-status-select {
  width: 106px;
  min-width: 106px;
  padding-left: 9px;
  padding-right: 26px;
}
.ext2-order-table .col-actions .btn { padding: 0 9px; }
.ext2-message-table .col-actions .btn { padding: 0 9px; }
.ext2-message-table td:first-child { min-width: 190px; }
.ext2-order-items-editor {
  margin-top: 16px;
  padding: 14px;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ext2-order-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ext2-order-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 96px 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.ext2-order-item-row:last-child { margin-bottom: 0; }
.ext2-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ext2-detail-order { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: .01em; }
.ext2-detail-amount { text-align: right; }
.ext2-address {
  margin-bottom: 16px;
  padding: 11px 13px;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  word-break: break-word;
}

/* ---------- 6. 图片设置 ---------- */
.ext2-image-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ext2-img-preview {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 16 / 7;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #FAFBFC;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: #A6ADB3;
}
.ext2-img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ext2-img-empty { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-2); }

.ext2-img-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 16px;
  align-items: start;
}
.ext2-img-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ext2-img-form .card + .card { margin-top: 0; }
.ext2-img-preview-side { min-width: 0; }
.ext2-img-preview-side .card + .card { margin-top: 0; }
.ext2-preview-card { position: sticky; top: calc(var(--topbar-h) + 16px); }
.ext2-switch-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ext2-switch-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ext2-switch-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ext2-switch-desc { font-size: 11.5px; line-height: 1.6; color: var(--muted-2); }

.ext2-pos-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-width: 320px;
}
.ext2-pos-btn {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: border-color .14s ease, color .14s ease, background .14s ease, box-shadow .14s ease;
}
.ext2-pos-btn:hover { border-color: #C6CBD0; color: var(--ink); }
.ext2-pos-btn.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(189, 17, 43, .08);
}
.ext2-size-pair { display: flex; align-items: center; gap: 8px; }
.ext2-size-pair .input { flex: 1 1 0; min-width: 0; }
.ext2-size-pair .hint { flex: none; }

.ext2-preview-main {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #F2F4F6;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ext2-preview-main img { width: 100%; height: 100%; object-fit: contain; display: block; background: #F2F4F6; }
.ext2-preview-loading {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--muted);
}
.ext2-preview-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  color: var(--brand);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.7;
}
.ext2-preview-bottom {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.ext2-preview-thumb-box { flex: none; }
.ext2-preview-thumb {
  width: 132px;
  height: 99px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-top: 5px;
  background: #F2F4F6;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  color: var(--muted-2);
  text-align: center;
}
.ext2-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ext2-preview-stats { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ext2-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted-2);
}
.ext2-stat-row strong {
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

/* ---------- 7. 伪静态规则 ---------- */
.ext2-rewrite-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 16px;
  align-items: start;
}
.ext2-rewrite-form,
.ext2-rewrite-rules { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ext2-rewrite-form .card + .card,
.ext2-rewrite-rules .card + .card { margin-top: 0; }
.ext2-rule-block { margin-bottom: 16px; }
.ext2-rule-block:last-of-type { margin-bottom: 0; }
.ext2-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ext2-rule-title { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ext2-rule-title .icon { color: var(--brand); }
.ext2-rule-code {
  max-height: 240px;
  min-height: 150px;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.65;
}
.ext2-rule-table { min-width: 560px; }
.ext2-rule-table td.mono { font-size: 11.5px; word-break: break-all; }
.ext2-path-result { margin-top: 14px; }
.ext2-preview-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ext2-url-preview {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px 15px;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ext2-url-preview-row { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.6; }
.ext2-url-preview-label { flex: none; width: 92px; color: var(--muted-2); }
.ext2-url-preview-value {
  min-width: 0;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}
.ext2-result {
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #FAFBFC;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-2);
  word-break: break-word;
}
.ext2-result.err { background: var(--brand-soft); border-color: var(--danger-line); color: var(--brand-dark); }
.ext2-json-details { margin-top: 12px; }
.ext2-json-details summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.ext2-json-details summary:hover { color: var(--brand); }
.ext2-json-details .preview-panel { margin-top: 8px; max-height: 240px; }

/* ---------- 8. 响应式 ---------- */
@media (max-width: 1280px) {
  .ext2-rewrite-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); }
}
@media (max-width: 1150px) {
  .ext2-img-layout,
  .ext2-rewrite-layout { grid-template-columns: 1fr; }
  .ext2-preview-card { position: static; }
}
@media (max-width: 900px) {
  .ext2-theme-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .ext2-pos-grid { max-width: none; }
}
@media (max-width: 768px) {
  .ext2-theme-grid { grid-template-columns: 1fr; }
  .ext2-preview-main { aspect-ratio: 4 / 3; }
  .ext2-iframe-wrap { height: 56vh; min-height: 300px; }
  .ext2-order-item-row { grid-template-columns: minmax(0, 1fr) 64px 84px 30px; gap: 6px; }
  .ext2-preview-bottom { flex-direction: column; }
  .ext2-preview-thumb { width: 100%; height: 120px; }
  .ext2-preview-stats { width: 100%; }
}
@media (max-width: 560px) {
  .ext2-select-sm { min-width: 96px; }
  .ext2-order-item-row { grid-template-columns: minmax(0, 1fr) 1fr 1fr 30px; }
  .ext2-rule-head { flex-wrap: wrap; }
  .ext2-size-pair { flex-wrap: wrap; }
  .ext2-size-pair .hint { display: none; }
  .ext2-size-pair .input { flex: 1 1 40%; }
}
