/* AIForge V6 — 样式 */
:root {
  --bg: #0b1020;
  --bg2: #111831;
  --card: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf8;
  --muted: #8b93ab;
  --primary: #6366f1;
  --primary2: #a855f7;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 80% -10%, #1e1b4b 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #312e81 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
::selection { background: rgba(99, 102, 241, 0.4); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

.glass {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}
.grad { background: linear-gradient(135deg, var(--primary), var(--primary2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-80px);
  background: #1e2749; color: var(--text); padding: 10px 22px; border-radius: 10px;
  border: 1px solid var(--border); z-index: 9999; opacity: 0; transition: all 0.3s;
  font-size: 14px; box-shadow: var(--shadow); pointer-events: none; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--ok); }
.toast.error { border-color: var(--bad); }
.toast.warn { border-color: var(--warn); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; transition: all 0.2s; text-decoration: none;
  font-family: inherit; white-space: nowrap;
}
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5); }
.btn.primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn.outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn.outline:hover { background: rgba(99, 102, 241, 0.12); }
.btn.ghost { background: rgba(255, 255, 255, 0.06); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn.ghost.danger { color: var(--bad); }
.btn.sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 13px 30px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }

/* Inputs */
.input, .select, .textarea {
  width: 100%; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); padding: 11px 14px; font-size: 14px;
  font-family: inherit; outline: none; transition: border-color 0.2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93ab' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.select.sm { width: auto; padding: 7px 30px 7px 12px; font-size: 13px; }
.textarea { resize: vertical; min-height: 60px; }
.select option { background: #1e2749; }

/* Auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 400px; max-width: 100%; padding: 40px 36px; }
.auth-logo { font-size: 28px; font-weight: 800; text-align: center; }
.auth-logo span { color: var(--primary); }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 28px; }
.auth-card .input { margin-bottom: 14px; }
.auth-hint { margin-top: 22px; padding: 12px; background: rgba(99, 102, 241, 0.08); border-radius: 10px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.8; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; background: rgba(255, 255, 255, 0.05); padding: 4px; border-radius: 10px; }
.tab { flex: 1; padding: 8px; border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; font-size: 14px; transition: all 0.2s; }
.tab.active { background: var(--primary); color: #fff; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; padding: 20px 14px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; border-radius: 0; border: none;
  border-right: 1px solid var(--border); background: rgba(10, 14, 30, 0.7);
}
.logo { font-size: 20px; font-weight: 800; padding: 4px 10px 20px; }
.logo b { color: var(--primary); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.15)); color: #fff; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--border); }
.side-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.side-info { flex: 1; min-width: 0; }
.side-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-balance { font-size: 11px; color: var(--muted); }
.main { flex: 1; padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* Home */
.hero-section { text-align: center; padding: 48px 20px 32px; }
.hero-title { font-size: 42px; font-weight: 800; letter-spacing: -0.5px; }
.hero-sub { color: var(--muted); margin: 12px 0 28px; font-size: 16px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 44px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat b { display: block; font-size: 28px; font-weight: 800; }
.stat span { color: var(--muted); font-size: 13px; }
.section-title { font-size: 18px; font-weight: 700; margin: 36px 0 16px; display: flex; justify-content: space-between; align-items: center; }
.link { color: var(--primary); text-decoration: none; font-size: 13px; }
.industry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.industry-card { padding: 20px; cursor: pointer; transition: all 0.25s; }
.industry-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.ind-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 12px; }
.ind-name { font-weight: 700; margin-bottom: 4px; }
.ind-desc { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Chat */
.chat-layout { display: flex; gap: 16px; height: calc(100vh - 48px); min-height: 480px; }
.chat-side { width: 260px; display: flex; flex-direction: column; overflow: hidden; }
.chat-side-head { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-bottom: 1px solid var(--border); }
.conv-list { flex: 1; overflow-y: auto; padding: 8px; }
.conv-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background 0.2s; }
.conv-item:hover { background: rgba(255, 255, 255, 0.07); }
.conv-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-config { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-config .select { flex: 1; min-width: 140px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { text-align: center; color: var(--muted); margin: auto; padding: 40px; }
.empty-icon { font-size: 52px; margin-bottom: 12px; }
.chat-empty p { margin: 4px 0; }
.muted { color: var(--muted); font-size: 12px; }
.p-2 { padding: 10px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.ai { justify-content: flex-start; }
.bubble { max-width: 85%; padding: 12px 16px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.user .bubble { background: linear-gradient(135deg, var(--primary), #4f46e5); border-bottom-right-radius: 4px; }
.msg.ai .bubble { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border); border-bottom-left-radius: 4px; width: 100%; }
.ai-step { color: var(--primary); font-size: 13px; padding: 6px 0; display: flex; align-items: center; gap: 8px; }
.ai-step::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--primary); border-top-color: transparent; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.chat-status { text-align: center; color: var(--muted); font-size: 12px; min-height: 20px; padding: 2px 0; }
.chat-input-row { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.chat-input-row .textarea { flex: 1; }

/* Result card */
.result-card { padding: 6px 2px; }
.r-title { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.r-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.r-summary { font-size: 14px; color: #cbd5e1; margin-bottom: 12px; }
.r-palette { display: flex; gap: 6px; margin-bottom: 14px; }
.chip-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); }
.r-section { background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid rgba(255, 255, 255, 0.05); }
.r-heading { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.r-section ul { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.r-section li { font-size: 13px; color: #cbd5e1; padding-left: 16px; position: relative; }
.r-section li::before { content: '•'; position: absolute; left: 2px; color: var(--primary); }
.r-metrics { display: flex; gap: 18px; margin: 14px 0; flex-wrap: wrap; }
.rm { text-align: center; }
.rm b { display: block; font-size: 17px; color: var(--primary); }
.rm span { font-size: 11px; color: var(--muted); }
.r-slogan { font-size: 15px; font-weight: 700; text-align: center; padding: 12px; background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1)); border-radius: 10px; margin: 10px 0; }
.r-cta { font-size: 13px; text-align: center; color: var(--primary2); margin-bottom: 10px; }
.r-channels { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.channel { font-size: 11px; padding: 4px 10px; background: rgba(255, 255, 255, 0.06); border-radius: 20px; color: var(--muted); }
.r-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tag { font-size: 11px; padding: 3px 9px; background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border-radius: 6px; }
.r-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fallback-note { font-size: 12px; color: var(--warn); padding: 8px 12px; background: rgba(245, 158, 11, 0.1); border-radius: 8px; margin-bottom: 10px; }

/* Cases */
.page { padding: 8px 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { font-size: 22px; }
.filters { display: flex; gap: 10px; align-items: center; }
.cases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.case-card { padding: 16px; cursor: pointer; transition: all 0.2s; }
.case-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.case-top { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 3px 10px; background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border-radius: 20px; }
.badge.alt { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; }
.badge.hot { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.status { font-size: 13px; margin-left: auto; }
.status.ok { color: var(--ok); }
.status.run { color: var(--warn); }
.status.bad { color: var(--bad); }
.case-model { font-size: 12px; color: var(--muted); }
.case-time { font-size: 11px; color: var(--muted); margin: 4px 0 10px; }
.case-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.progress { height: 5px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress .bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary2)); border-radius: 3px; transition: width 0.4s; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 14px; align-items: center; }

/* Templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tpl-card { padding: 18px; transition: all 0.2s; }
.tpl-card:hover { border-color: var(--primary2); transform: translateY(-2px); }
.tpl-top { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tpl-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.tpl-desc { font-size: 12px; color: var(--muted); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tpl-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tpl-foot { display: flex; justify-content: space-between; align-items: center; }

/* Analytics */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 18px; text-align: center; }
.sc-icon { font-size: 26px; margin-bottom: 6px; }
.sc-val { font-size: 22px; font-weight: 800; }
.sc-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .row-2 { grid-template-columns: 1fr; } }
.panel { padding: 18px; margin-bottom: 20px; }
.panel-title { font-weight: 700; margin-bottom: 14px; font-size: 15px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 90px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 10px; background: rgba(255, 255, 255, 0.07); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s; }
.bar-val { width: 30px; text-align: right; font-size: 12px; font-weight: 600; }
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.act-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.act-text { flex: 1; }
.trend-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; overflow-x: auto; }
.trend-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 26px; flex: 1; height: 100%; }
.trend-bar { width: 70%; background: linear-gradient(180deg, var(--primary), var(--primary2)); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.4s; }
.trend-label { font-size: 10px; color: var(--muted); margin-top: 4px; transform: rotate(-30deg); white-space: nowrap; }

/* Shop */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.pkg-card { padding: 22px; text-align: center; position: relative; transition: all 0.2s; }
.pkg-card.hot { border-color: var(--primary2); box-shadow: 0 0 30px rgba(168, 85, 247, 0.15); }
.pkg-card:hover { transform: translateY(-3px); }
.pkg-tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--primary), var(--primary2)); font-size: 11px; padding: 3px 12px; border-radius: 20px; }
.pkg-amount { font-size: 28px; font-weight: 800; }
.pkg-label { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.pkg-price { font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 14px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.prod-card { padding: 18px; transition: all 0.2s; }
.prod-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.prod-icon { font-size: 34px; margin-bottom: 10px; }
.prod-name { font-weight: 700; margin-bottom: 4px; }
.prod-desc { font-size: 12px; color: var(--muted); margin-bottom: 10px; min-height: 32px; }
.prod-price { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 10px; }
.unit { font-size: 12px; color: var(--muted); font-weight: 400; }
.prod-specs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.spec { font-size: 10px; padding: 3px 8px; background: rgba(255, 255, 255, 0.06); border-radius: 6px; color: var(--muted); }

/* Profile */
.profile-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.profile-row:last-child { border-bottom: none; }
.profile-row span { color: var(--muted); }
.asset-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.asset-row:last-child { border-bottom: none; }
.asset-icon { font-size: 26px; }
.order-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.order-name { flex: 1; min-width: 120px; }

/* Admin */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px);
}
.modal { width: 760px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; background: #141a35; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-close { background: transparent; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 20px; overflow-y: auto; }

/* Responsive */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 8px; }
  .nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; }
  .side-user { border-top: none; padding: 0; }
  .main { padding: 14px; }
  .hero-title { font-size: 30px; }
  .chat-layout { flex-direction: column; height: auto; }
  .chat-side { width: 100%; max-height: 200px; }
  .chat-main { height: 70vh; }
}
