/* Tenant admin — aligned with 后端ui.html (light SaaS shell) */
body.tenant-admin{
  --blue-600:#1677ff;
  --blue-700:#005ae0;
  --canvas:#f5f6fa;
  --text:#1a2332;
  --muted:#64748b;
  --border:#e8ecf1;
  --soft:#f8fafc;
  --surface:#fff;
  --radius:10px;
  --shadow:0 1px 3px rgba(0,0,0,.04);
  --shadow-hover:0 4px 12px rgba(0,0,0,.06);
  color:var(--text);
  background:#f5f6fa;
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Roboto,sans-serif;
}
body.tenant-admin html,
html:has(body.tenant-admin){background:#f5f6fa}
body.tenant-admin .tech-bg{
  position:fixed;inset:0;z-index:-1;pointer-events:none;opacity:.4;
  background-image:
    radial-gradient(#e0e6f0 .5px,transparent .5px),
    linear-gradient(to right,#e0e6f0 .5px,transparent .5px),
    linear-gradient(to bottom,#e0e6f0 .5px,transparent .5px);
  background-size:40px 40px,80px 80px,80px 80px;
}
body.tenant-admin .layout{grid-template-columns:240px minmax(0,1fr)}
body.tenant-admin .side{
  width:240px;background:#fff;color:#64748b;
  border-right:1px solid #e8ecf1;
  background-image:none;
  display:flex;flex-direction:column;
  overflow:hidden;
}
body.tenant-admin .brand{
  min-height:72px;padding:20px 24px;gap:12px;
  color:#1a2332;border-bottom:1px solid #f1f5f9;font-size:17px;
  flex:0 0 auto;
}
body.tenant-admin .brand small{
  color:#94a3b8;letter-spacing:.04em;font-size:11px;margin-top:3px;
}
body.tenant-admin .brand-mark{
  width:32px;height:32px;flex:0 0 32px;border-radius:8px;
  background:#1677ff;box-shadow:none;color:#fff;font-size:0;
  position:relative;
}
body.tenant-admin .brand-mark:before{
  content:"";position:absolute;inset:8px;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z'/%3E%3Cpath d='m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65'/%3E%3Cpath d='m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65'/%3E%3C/svg%3E") center/contain no-repeat;
}
body.tenant-admin .nav{padding:8px 0 24px;flex:1;overflow-y:auto;min-height:0}
body.tenant-admin .nav-group{
  padding:22px 24px 8px;color:#94a3b8;font-size:12px;font-weight:600;
  letter-spacing:.05em;text-transform:uppercase;
}
body.tenant-admin .nav a{
  margin:0;min-height:0;padding:10px 24px;border-radius:0;
  color:#64748b;font-size:14px;gap:0;align-items:center;
}
body.tenant-admin .nav a:before{display:none}
body.tenant-admin .nav a:hover{background:#f8fafc;color:#1677ff}
body.tenant-admin .nav a.active{
  background:#e8f4ff;color:#1677ff;font-weight:500;
  box-shadow:none;
}
body.tenant-admin .nav a.active:before{
  display:block;content:"";position:absolute;left:0;top:0;bottom:0;
  width:3px;height:auto;margin:0;border-radius:0;background:#1677ff;box-shadow:none;
}
body.tenant-admin .nav-icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:20px;margin-right:12px;flex:0 0 20px;font-size:18px;line-height:1;
}
body.tenant-admin .ai-tag{
  display:inline-flex;align-items:center;margin-left:6px;padding:1px 5px;
  border-radius:4px;background:#e8f4ff;color:#1677ff;font-size:10px;font-weight:700;
}
body.tenant-admin .side-footer{
  flex:0 0 auto;margin-top:auto;padding:14px 16px;
  border-top:1px solid #f1f5f9;background:#fff;
  display:flex;flex-direction:column;gap:2px;
}
body.tenant-admin .side-footer a{
  display:flex;align-items:center;gap:8px;padding:8px 10px;
  color:#64748b;text-decoration:none;font-size:13px;border-radius:8px;
}
body.tenant-admin .side-footer a:hover{color:#1677ff;background:#f8fafc}
body.tenant-admin .side-collapse-btn{
  margin-left:auto;width:28px;height:28px;border:0;border-radius:6px;padding:0;
  display:inline-grid;place-items:center;background:transparent;color:#94a3b8;cursor:pointer;flex:0 0 28px;
}
body.tenant-admin .side-collapse-btn:hover{background:#f1f5f9;color:#1677ff}
body.tenant-admin .brand{position:relative}
body.tenant-admin .brand-text{min-width:0;flex:1}
body.tenant-admin .top{
  height:64px;background:#fff;border-bottom:1px solid #e8ecf1;
  box-shadow:none;backdrop-filter:none;padding:0 32px;
}
body.tenant-admin .crumb{color:#94a3b8;font-size:13px}
body.tenant-admin .tenant-chip{
  border-color:#bfdbfe;background:#e8f4ff;color:#1677ff;border-radius:6px;
}
body.tenant-admin .main{max-width:none;padding:32px}
body.tenant-admin .page-heading{margin-bottom:28px}
body.tenant-admin .page-heading h1{
  margin:0;font-size:24px;font-weight:700;color:#1a2332;letter-spacing:-.02em;
}
body.tenant-admin .page-heading p{margin-top:6px;color:#94a3b8}
body.tenant-admin .eyebrow{display:none}
body.tenant-admin .panel,
body.tenant-admin .stat,
body.tenant-admin .card,
body.tenant-admin .test-card{
  border:1px solid #e8ecf1;border-radius:10px;box-shadow:var(--shadow);
  transition:transform .2s,box-shadow .2s;
}
body.tenant-admin .stat:before,
body.tenant-admin .card:before{display:none}
body.tenant-admin .stat:hover,
body.tenant-admin .panel:hover{transform:translateY(-2px);box-shadow:var(--shadow-hover)}
body.tenant-admin .stat{
  padding:22px;background:#fff;
}
body.tenant-admin .stat-head{
  display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;
}
body.tenant-admin .stat-icon{
  width:40px;height:40px;border-radius:8px;display:grid;place-items:center;font-size:20px;
}
body.tenant-admin .stat-icon.blue{background:#eff6ff;color:#1677ff}
body.tenant-admin .stat-icon.indigo{background:#eef2ff;color:#6366f1}
body.tenant-admin .stat-icon.orange{background:#fff7ed;color:#f97316}
body.tenant-admin .stat-icon.emerald{background:#ecfdf5;color:#10b981}
body.tenant-admin .stat-icon.rose{background:#fff1f2;color:#f43f5e}
body.tenant-admin .stat-icon.sky{background:#f0f9ff;color:#0ea5e9}
body.tenant-admin .stat span{color:#64748b;font-size:13px;font-weight:500}
body.tenant-admin .stat b{margin-top:4px;font-size:26px;color:#1a2332}
body.tenant-admin .stat em{color:#94a3b8;font-size:12px}
body.tenant-admin .panel-hd{min-height:0;padding:18px 20px}
body.tenant-admin .panel-hd h2{font-size:16px;font-weight:700;color:#1a2332}
body.tenant-admin .panel-bd{padding:8px 20px 20px}
body.tenant-admin .status-list{gap:12px;display:grid}
body.tenant-admin .status-row{
  padding:14px 16px;border:0;border-radius:8px;background:#f8fafc;
}
body.tenant-admin .status-row:first-child{padding-top:14px}
body.tenant-admin .indicator{
  width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:10px;
  background:#22c55e;box-shadow:0 0 8px rgba(34,197,94,.4);flex:0 0 8px;
}
body.tenant-admin .indicator.warn{background:#f59e0b;box-shadow:0 0 8px rgba(245,158,11,.35)}
body.tenant-admin .indicator.off{background:#94a3b8;box-shadow:none}
body.tenant-admin .status-row>div:first-child{
  display:flex;align-items:flex-start;gap:0;
}
body.tenant-admin .btn{
  min-height:36px;padding:8px 16px;border-radius:8px;font-weight:500;font-size:14px;
  background:#1677ff;color:#fff;box-shadow:none;
}
body.tenant-admin .btn:hover{background:#005ae0;color:#fff;box-shadow:none}
body.tenant-admin a.btn{color:#fff}
body.tenant-admin a.btn:hover{color:#fff}
body.tenant-admin a.btn.secondary,
body.tenant-admin .btn.secondary{
  background:#fff;border:1px solid #1677ff;color:#1677ff;
}
body.tenant-admin a.btn.secondary:hover,
body.tenant-admin .btn.secondary:hover{background:#f0f7ff;border-color:#1677ff;color:#1677ff}
body.tenant-admin .btn.secondary.active{
  background:#e8f4ff;border-color:#1677ff;color:#1677ff;
}
body.tenant-admin .danger-btn{
  border-color:#fecaca!important;color:#dc2626!important;background:#fff!important;
}
body.tenant-admin .tag{border-radius:4px;font-weight:500}
body.tenant-admin .tag.ok{background:#f0fdf4;color:#16a34a}
body.tenant-admin .tag.run{background:#e8f4ff;color:#1677ff}
body.tenant-admin .tag.fail{background:#fef2f2;color:#dc2626}
body.tenant-admin .tag.gray{background:#f1f5f9;color:#64748b}
body.tenant-admin .table th{
  background:#fbfcfd;color:#64748b;font-weight:600;font-size:13px;
  border-bottom:1px solid #f1f5f9;letter-spacing:0;
}
body.tenant-admin .table td{
  padding:16px;border-bottom:1px solid #f1f5f9;font-size:14px;
}
body.tenant-admin .table tbody tr:nth-child(even) td{background:transparent}
body.tenant-admin .table tbody tr:hover td{background:#f8fafc}
body.tenant-admin .alert.ok{background:#f0fdf4;border-color:#bbf7d0;color:#15803d}
body.tenant-admin .alert.danger{background:#fef2f2;border-color:#fecaca;color:#b91c1c}
body.tenant-admin a{color:#1677ff}
body.tenant-admin .admin-dialog{border-radius:12px}
body.tenant-admin .dialog-head{border-bottom:1px solid #e8ecf1}
body.tenant-admin .quick-links .btn.secondary{border-color:#e2e8f0;color:#334155}
body.tenant-admin .quick-links .btn.secondary:hover{border-color:#1677ff;color:#1677ff;background:#f0f7ff}

/* AI 商品图页 */
body.tenant-admin .ai-pi-steps{
  list-style:none;margin:0 0 22px;padding:16px 18px;display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;
  border:1px solid #e8ecf1;border-radius:12px;background:#fff;
}
body.tenant-admin .ai-pi-steps li{
  display:flex;align-items:flex-start;gap:10px;min-width:0;color:#94a3b8;
}
body.tenant-admin .ai-pi-steps li>span{
  flex:0 0 26px;height:26px;border-radius:50%;display:grid;place-items:center;
  background:#f1f5f9;color:#64748b;font-size:12px;font-weight:800;
}
body.tenant-admin .ai-pi-steps b{display:block;font-size:13px;color:#334155}
body.tenant-admin .ai-pi-steps em{display:block;margin-top:2px;font-size:12px;font-style:normal;color:#94a3b8}
body.tenant-admin .ai-pi-steps li.is-current>span{background:#1677ff;color:#fff}
body.tenant-admin .ai-pi-steps li.is-current b{color:#0f172a}
body.tenant-admin .ai-pi-steps li.is-done>span{background:#dcfce7;color:#15803d}
body.tenant-admin .ai-pi-stats .stat{position:relative}
body.tenant-admin .ai-pi-usage{
  margin-top:12px;height:6px;border-radius:999px;background:#eef2f7;overflow:hidden;
}
body.tenant-admin .ai-pi-usage>span{
  display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,#1677ff,#60a5fa);
}
body.tenant-admin .ai-pi-layout{
  display:grid;grid-template-columns:1fr;gap:18px;margin-bottom:18px;scroll-margin-top:88px;
}
body.tenant-admin .ai-pi-layout.has-pay{
  grid-template-columns:minmax(0,1.35fr) minmax(300px,.75fr);align-items:start;
}
body.tenant-admin .ai-pi-plans{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px;
}
body.tenant-admin .ai-pi-plan{
  position:relative;display:flex;flex-direction:column;gap:10px;
  margin:0;padding:18px 16px 16px;border:1px solid #e8ecf1;border-radius:12px;
  background:#fff;box-shadow:0 1px 2px rgba(15,23,42,.03);
  transition:border-color .18s,box-shadow .18s,transform .18s;
}
body.tenant-admin .ai-pi-plan:hover{
  border-color:#bfdbfe;box-shadow:0 8px 24px rgba(22,119,255,.08);transform:translateY(-1px);
}
body.tenant-admin .ai-pi-plan.is-featured{
  border-color:#1677ff;background:linear-gradient(180deg,#f5f9ff 0%,#fff 48%);
  box-shadow:0 8px 24px rgba(22,119,255,.1);
}
body.tenant-admin .ai-pi-plan-badge{
  position:absolute;top:12px;right:12px;padding:2px 8px;border-radius:999px;
  background:#1677ff;color:#fff;font-size:11px;font-weight:700;letter-spacing:.02em;
}
body.tenant-admin .ai-pi-plan-name{font-size:15px;font-weight:700;color:#1a2332;padding-right:48px}
body.tenant-admin .ai-pi-plan-price{
  font-size:28px;font-weight:800;letter-spacing:-.03em;color:#0f172a;line-height:1.1;
}
body.tenant-admin .ai-pi-plan-price .yen{font-size:16px;font-weight:700;margin-right:2px}
body.tenant-admin .ai-pi-plan-meta{
  display:flex;flex-wrap:wrap;gap:8px;margin-bottom:2px;color:#64748b;font-size:12px;
}
body.tenant-admin .ai-pi-plan-meta span{
  padding:3px 8px;border-radius:999px;background:#f1f5f9;color:#475569;font-weight:600;
}
body.tenant-admin .ai-pi-plan-perks{
  margin:0 0 4px;padding:0;list-style:none;display:grid;gap:4px;color:#64748b;font-size:12px;
}
body.tenant-admin .ai-pi-plan-perks li:before{content:"✓ ";color:#1677ff;font-weight:700}
body.tenant-admin .ai-pi-plan .btn{width:100%;margin-top:auto}
/* 储值 / AI商品图共用付款码弹窗 */
body.tenant-admin .pay-qr-dialog .dialog-body,
body.tenant-admin .ai-pi-pay-dialog .dialog-body{text-align:center;padding-top:8px;padding-bottom:8px}
body.tenant-admin .pay-qr-dialog .qr-shell,
body.tenant-admin .ai-pi-pay-dialog .qr-shell{margin:0 auto}
body.tenant-admin .pay-qr-dialog .recharge-total,
body.tenant-admin .ai-pi-pay-dialog .recharge-total{margin-top:14px}
body.tenant-admin .pay-qr-dialog .mobile-pay-link,
body.tenant-admin .ai-pi-pay-dialog .mobile-pay-link{display:inline-flex;margin-top:10px}
body.tenant-admin .ai-pi-pay-plan{margin:0 0 4px;color:#334155;font-weight:600}
body.tenant-admin .ai-pi-pay-expire{margin:0 0 8px;font-size:12px}
body.tenant-admin .ai-pi-generate{margin-bottom:18px;scroll-margin-top:88px}
body.tenant-admin .ai-pi-lock-banner{
  display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;
  margin-bottom:16px;padding:14px 16px;border:1px solid #fecaca;border-radius:10px;background:#fef2f2;
}
body.tenant-admin .ai-pi-lock-banner b{display:block;color:#b91c1c;font-size:14px}
body.tenant-admin .ai-pi-lock-banner p{margin:4px 0 0;color:#991b1b;font-size:13px}
body.tenant-admin .ai-pi-studio-grid{
  display:grid;grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr);gap:18px;
}
body.tenant-admin .ai-pi-upload-card,
body.tenant-admin .ai-pi-prompt-card{
  padding:16px;border:1px solid #e8ecf1;border-radius:12px;background:#fbfcfd;
}
body.tenant-admin .ai-pi-field-label{margin-bottom:12px}
body.tenant-admin .ai-pi-field-label b{display:block;font-size:14px;color:#1a2332}
body.tenant-admin .ai-pi-field-label small{display:block;margin-top:4px;color:#94a3b8;font-size:12px}
body.tenant-admin .ai-pi-upload-card .img-upload-preview img{
  width:100%;max-width:220px;height:260px;object-fit:cover;border-radius:10px;
}
body.tenant-admin .ai-pi-tip{margin:10px 0 0;color:#94a3b8;font-size:12px;line-height:1.45}
body.tenant-admin .ai-pi-presets{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
body.tenant-admin .ai-pi-preset{
  min-height:32px;padding:6px 12px;border:1px solid #dbe3ec;border-radius:999px;
  background:#fff;color:#334155;font-size:12px;font-weight:600;cursor:pointer;
  transition:border-color .15s,background .15s,color .15s;
}
body.tenant-admin .ai-pi-preset:hover,
body.tenant-admin .ai-pi-preset.is-active{
  border-color:#1677ff;background:#eff6ff;color:#1677ff;
}
body.tenant-admin .ai-pi-prompt-card textarea{
  min-height:180px;resize:vertical;background:#fff;
}
body.tenant-admin .ai-pi-prompt-meta{
  display:flex;justify-content:space-between;gap:12px;margin-top:8px;font-size:12px;
}
body.tenant-admin .ai-pi-generate.is-locked .ai-pi-studio-grid{opacity:.72}
body.tenant-admin .ai-pi-gallery-panel{margin-bottom:18px}
body.tenant-admin .ai-pi-gallery{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:14px;
}
body.tenant-admin .ai-pi-gallery-card{
  overflow:hidden;border:1px solid #e8ecf1;border-radius:12px;background:#fff;
  transition:border-color .18s,box-shadow .18s;
}
body.tenant-admin .ai-pi-gallery-card:hover,
body.tenant-admin .ai-pi-gallery-card.is-focus{
  border-color:#bfdbfe;box-shadow:0 8px 24px rgba(22,119,255,.08);
}
body.tenant-admin .ai-pi-gallery-cover{display:block;aspect-ratio:3/4;background:#f1f5f9}
body.tenant-admin .ai-pi-gallery-cover img{width:100%;height:100%;object-fit:cover;display:block}
body.tenant-admin .ai-pi-gallery-body{padding:12px}
body.tenant-admin .ai-pi-gallery-body p{
  margin:0 0 10px;min-height:40px;color:#475569;font-size:12px;line-height:1.45;
}
body.tenant-admin .ai-pi-gallery-actions{display:flex;flex-wrap:wrap;gap:6px}
body.tenant-admin .ai-pi-gallery-actions .btn{min-height:30px;padding:4px 10px;font-size:12px}
body.tenant-admin .ai-pi-prompt{max-width:240px;color:#475569;line-height:1.45}
body.tenant-admin tr.ai-pi-row-focus td{background:#f0f7ff!important}
@media(max-width:980px){
  body.tenant-admin .ai-pi-steps{grid-template-columns:1fr 1fr}
  body.tenant-admin .ai-pi-layout.has-pay,
  body.tenant-admin .ai-pi-studio-grid{grid-template-columns:1fr}
}
@media(max-width:640px){
  body.tenant-admin .ai-pi-steps{grid-template-columns:1fr}
}

/* 后台 UI 规范化补充 */
body.tenant-admin .page-heading > div > p{margin:6px 0 0;color:#64748b;font-size:13px;line-height:1.55;max-width:46rem}
body.tenant-admin .panel-hd > div > p{margin:2px 0 0;color:#94a3b8;font-size:12px}
body.tenant-admin .stat a.stat-link{color:inherit;text-decoration:none;display:block}
body.tenant-admin .input-compact{border-radius:8px}
body.tenant-admin .api-hosted-card{
  border:1px dashed #dbe3ec;border-radius:12px;background:#f8fafc;
}

body.tenant-admin.login-page{
  background:
    radial-gradient(#e0e6f0 .5px,transparent .5px),
    linear-gradient(160deg,#f8fafc,#f0f5ff);
  background-size:40px 40px,auto;
}
body.tenant-admin .login-card{
  border-radius:12px;border-color:#e8ecf1;box-shadow:0 8px 30px rgba(15,23,42,.06);
}
body.tenant-admin .login-card button{background:#1677ff;border-radius:8px}
body.tenant-admin .login-card button:hover{background:#005ae0}
@media(max-width:920px){
  body.tenant-admin .layout{display:block}
  body.tenant-admin .side{width:auto;position:static;height:auto}
  body.tenant-admin .nav{display:flex;gap:4px;overflow-x:auto;padding:8px 12px 12px}
  body.tenant-admin .nav-group,.side-footer{display:none}
  body.tenant-admin .nav a{flex:0 0 auto;border-radius:8px;padding:8px 12px}
  body.tenant-admin .nav a.active:before{display:none}
  body.tenant-admin .main{padding:18px 14px}
}
