/* ================= Loka AI 洛卡 · 东盟带货 AI（H5 用户端） ================= */
:root{
  --brand:#4F46E5; --brand2:#0EA5E9; --brand-soft:#EEF2FF;
  --bg:#F5F7FB; --card:#FFFFFF; --text:#0F172A; --muted:#64748B; --line:#E7EAF2;
  --red:#DC2626; --red-soft:#FEF2F2; --amber:#D97706; --amber-soft:#FFFBEB;
  --green:#059669; --green-soft:#ECFDF5; --sky:#0284C7;
  --shadow:0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.12);
  --radius:14px;
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  background:var(--bg); color:var(--text); font-size:14px; line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}
button{cursor:pointer;border:none;background:none}
a{color:var(--brand);text-decoration:none}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-thumb{background:#D6DBE6;border-radius:8px}
::-webkit-scrollbar-thumb:hover{background:#BFC6D4}

/* ---------- 顶部栏 ---------- */
.topbar{
  position:sticky;top:0;z-index:50;height:62px;display:flex;align-items:center;gap:16px;
  padding:0 20px;background:rgba(255,255,255,.86);backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;letter-spacing:-.2px;white-space:nowrap}
.brand-mark{
  width:30px;height:30px;border-radius:9px;display:grid;place-items:center;color:#fff;font-size:15px;font-weight:700;letter-spacing:-.5px;
  background:linear-gradient(135deg,var(--brand),var(--brand2));box-shadow:0 4px 12px -4px var(--brand);
}
.brand small{display:block;font-size:11px;font-weight:500;color:var(--muted);letter-spacing:0}

/* 站点选择器 */
.site-picker{position:relative;margin-left:8px}
.site-btn{
  display:flex;align-items:center;gap:9px;height:38px;padding:0 13px;border-radius:11px;
  border:1px solid var(--line);background:#fff;font-weight:600;transition:.15s;white-space:nowrap;
}
.site-btn:hover{border-color:#C7CEE0;box-shadow:var(--shadow)}
.site-dot{width:8px;height:8px;border-radius:50%;box-shadow:0 0 0 3px rgba(79,70,229,.12)}
.dot-VN{background:#DA251D}.dot-TH{background:#2D6BC9}.dot-MY{background:#0E9F6E}.dot-ID{background:#E11D48}
.site-btn .flag{font-size:15px;line-height:1}
.site-btn .arrow{color:var(--muted);font-size:10px;transition:.2s}
.site-picker.open .arrow{transform:rotate(180deg)}
.site-menu{
  position:absolute;top:46px;left:0;width:290px;background:#fff;border:1px solid var(--line);
  border-radius:14px;box-shadow:0 18px 50px -12px rgba(15,23,42,.22);padding:6px;display:none;
}
.site-picker.open .site-menu{display:block;animation:pop .16s ease}
@keyframes pop{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
.site-item{display:flex;align-items:center;gap:10px;padding:10px 11px;border-radius:10px;width:100%;text-align:left;transition:.12s}
.site-item:hover{background:#F7F9FC}
.site-item.active{background:var(--brand-soft)}
.site-item .nm{font-weight:600}
.site-item .sub{font-size:11.5px;color:var(--muted)}
.site-item .chk{margin-left:auto;color:var(--brand);font-weight:700}
.site-warn{
  margin:6px 6px 2px;padding:8px 10px;border-radius:9px;background:var(--amber-soft);
  color:#92400E;font-size:11.5px;line-height:1.5;border:1px solid #FDE68A;
}
.top-right{margin-left:auto;display:flex;align-items:center;gap:10px}
.quota-pill{
  display:flex;align-items:center;gap:7px;height:34px;padding:0 13px;border-radius:999px;
  background:linear-gradient(135deg,#EEF2FF,#E0F2FE);border:1px solid #DDE4FF;font-weight:600;font-size:12.5px;
}
.quota-pill b{color:var(--brand);font-size:14px}
.avatar{
  width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,var(--brand),var(--brand2));
  color:#fff;display:grid;place-items:center;font-weight:700;font-size:13px;
}

/* ---------- 布局 ---------- */
.layout{display:flex;max-width:1240px;margin:0 auto;padding:20px 20px 60px;gap:20px;align-items:flex-start}
.sidenav{width:206px;flex:0 0 206px;position:sticky;top:82px;display:flex;flex-direction:column;gap:4px}
.nav-item{
  display:flex;align-items:center;gap:10px;padding:10px 13px;border-radius:11px;color:#475569;
  font-weight:500;transition:.14s;width:100%;text-align:left;
}
.nav-item:hover{background:#fff;color:var(--text)}
.nav-item.active{background:#fff;color:var(--brand);font-weight:650;box-shadow:var(--shadow)}
.nav-item .ico{width:18px;text-align:center;font-size:15px}
.nav-sep{height:1px;background:var(--line);margin:8px 6px}
.content{flex:1;min-width:0}

/* ---------- 卡片与通用 ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-pad{padding:20px}
.card-head{display:flex;align-items:center;gap:10px;margin-bottom:16px}
.card-title{font-size:15px;font-weight:700;letter-spacing:-.2px}
.card-sub{font-size:12.5px;color:var(--muted);font-weight:400}
.spacer{margin-left:auto}
.field{margin-bottom:16px}
.label{display:block;font-size:12.5px;font-weight:600;color:#334155;margin-bottom:7px}
.label .hint{font-weight:400;color:var(--muted);margin-left:6px;font-size:11.5px}
.input,.textarea,.select{
  width:100%;border:1px solid var(--line);border-radius:11px;padding:10px 12px;background:#fff;
  transition:.15s;outline:none;font-size:13.5px;
}
.textarea{resize:vertical;min-height:108px;line-height:1.65}
.input:focus,.textarea:focus,.select:focus{border-color:#A5B4FC;box-shadow:0 0 0 3.5px rgba(79,70,229,.1)}
.select{appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%2364748B' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");background-repeat:no-repeat;background-position:right 12px center;padding-right:32px}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;height:40px;padding:0 18px;
  border-radius:11px;font-weight:600;font-size:13.5px;transition:.15s;white-space:nowrap;
}
.btn-primary{background:linear-gradient(135deg,var(--brand),#6366F1);color:#fff;box-shadow:0 6px 18px -8px var(--brand)}
.btn-primary:hover{filter:brightness(1.05);transform:translateY(-1px)}
.btn-primary:disabled{opacity:.55;cursor:not-allowed;transform:none;box-shadow:none}
.btn-ghost{background:#fff;border:1px solid var(--line);color:#334155}
.btn-ghost:hover{border-color:#C7CEE0;background:#FAFBFD}
.btn-sm{height:32px;padding:0 12px;font-size:12.5px;border-radius:9px}
.btn-danger{background:var(--red-soft);color:var(--red);border:1px solid #FECACA}
.btn-block{width:100%}
.btn-lg{height:46px;font-size:14.5px}

/* 分段选择 */
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{
  padding:7px 13px;border-radius:999px;border:1px solid var(--line);background:#fff;
  font-size:12.5px;font-weight:500;color:#475569;transition:.14s;
}
.chip:hover{border-color:#C7CEE0}
.chip.active{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 4px 12px -6px var(--brand)}
.chip .tag{font-size:10.5px;opacity:.75;margin-left:4px}

/* ---------- 生成页 ---------- */
.gen-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;align-items:start}
.result-empty{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  min-height:380px;color:var(--muted);gap:12px;text-align:center;padding:30px;
}
.result-empty .big{font-size:34px;opacity:.35}
.result-box{
  white-space:pre-wrap;word-break:break-word;font-size:14px;line-height:1.85;
  background:#FAFBFE;border:1px solid var(--line);border-radius:12px;padding:16px;
  max-height:520px;overflow:auto;font-family:"SF Mono",ui-monospace,Menlo,Consolas,monospace;
}
.result-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.loading{display:flex;flex-direction:column;align-items:center;gap:14px;padding:60px 0;color:var(--muted)}
.spinner{
  width:30px;height:30px;border:3px solid #E2E8F0;border-top-color:var(--brand);border-radius:50%;
  animation:spin .8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.skel{height:11px;border-radius:6px;background:linear-gradient(90deg,#EEF1F6 25%,#F7F9FC 50%,#EEF1F6 75%);background-size:200% 100%;animation:sh 1.3s infinite}
@keyframes sh{to{background-position:-200% 0}}

/* 风险报告 */
.risk{border-radius:12px;border:1px solid var(--line);overflow:hidden;margin-top:16px}
.risk-head{display:flex;align-items:center;gap:9px;padding:11px 14px;font-weight:650;font-size:13px}
.risk-pass{background:var(--green-soft);color:#065F46;border-color:#A7F3D0}
.risk-low{background:#F0F9FF;color:#075985;border-color:#BAE6FD}
.risk-medium{background:var(--amber-soft);color:#92400E;border-color:#FDE68A}
.risk-high{background:var(--red-soft);color:#991B1B;border-color:#FECACA}
.risk-body{background:#fff}
.risk-item{padding:12px 14px;border-top:1px solid #F1F4F9;display:flex;gap:11px}
.risk-item:first-child{border-top:none}
.badge{
  display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:6px;
  font-size:11px;font-weight:650;white-space:nowrap;flex:0 0 auto;
}
.b-high{background:var(--red-soft);color:var(--red)}
.b-medium{background:var(--amber-soft);color:#B45309}
.b-low{background:#F1F5F9;color:#475569}
.b-pass{background:var(--green-soft);color:var(--green)}
.b-blue{background:var(--brand-soft);color:var(--brand)}
.risk-word{font-weight:700;font-size:13px}
.risk-meta{font-size:11.5px;color:var(--muted);margin-top:2px}
.risk-tip{font-size:12.5px;color:#334155;margin-top:6px;padding:8px 10px;background:#FAFBFE;border-radius:8px;border-left:2px solid #CBD5E1}
.risk-snip{font-size:11.5px;color:#64748B;margin-top:6px;font-family:ui-monospace,monospace;word-break:break-all}

/* ---------- 历史 ---------- */
.hist-item{padding:14px 16px;border-top:1px solid #F1F4F9;transition:.13s}
.hist-item:first-child{border-top:none}
.hist-item:hover{background:#FAFBFE}
.hist-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}
.hist-src{font-size:12.5px;color:#475569;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}
.hist-out{font-size:12.5px;color:#0F172A;margin-top:4px;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;word-break:break-word}
.tag{display:inline-flex;align-items:center;height:21px;padding:0 8px;border-radius:6px;font-size:11px;font-weight:600;background:#F1F5F9;color:#475569}
.tag-site{background:var(--brand-soft);color:var(--brand)}
.tag-line{background:#F8FAFC;color:#64748B;border:1px solid var(--line)}

/* ---------- 表格 ---------- */
.table{width:100%;border-collapse:collapse;font-size:13px}
.table th{
  text-align:left;padding:10px 12px;font-size:11.5px;font-weight:600;color:var(--muted);
  border-bottom:1px solid var(--line);background:#FAFBFD;white-space:nowrap;
}
.table td{padding:11px 12px;border-bottom:1px solid #F1F4F9;vertical-align:middle}
.table tr:last-child td{border-bottom:none}
.table tr:hover td{background:#FAFBFE}
.mono{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px}

/* ---------- 套餐 ---------- */
.plans{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.plan{
  border:1.5px solid var(--line);border-radius:16px;padding:22px 18px;background:#fff;
  position:relative;transition:.18s;
}
.plan:hover{transform:translateY(-3px);box-shadow:0 16px 36px -18px rgba(15,23,42,.28);border-color:#C7D2FE}
.plan.hot{border-color:var(--brand);box-shadow:0 12px 32px -16px rgba(79,70,229,.45)}
.plan-tag{
  position:absolute;top:-10px;right:14px;background:linear-gradient(135deg,var(--brand),#6366F1);color:#fff;
  font-size:11px;font-weight:600;padding:3px 10px;border-radius:999px;
}
.plan-name{font-size:13px;font-weight:650;color:var(--muted)}
.plan-price{display:flex;align-items:baseline;gap:3px;margin:8px 0 4px}
.plan-price .cur{font-size:16px;font-weight:600}
.plan-price .num{font-size:34px;font-weight:800;letter-spacing:-1.2px}
.plan-quota{font-size:13px;color:#334155;font-weight:600}
.plan-note{font-size:11.5px;color:var(--muted);margin:8px 0 16px;line-height:1.7}

/* ---------- 登录 ---------- */
.auth-wrap{min-height:100vh;display:grid;grid-template-columns:1.05fr .95fr}
.auth-left{
  background:linear-gradient(150deg,#312E81 0%,#4F46E5 45%,#0EA5E9 100%);color:#fff;
  padding:56px;display:flex;flex-direction:column;justify-content:space-between;position:relative;overflow:hidden;
}
.auth-left::after{
  content:"";position:absolute;width:520px;height:520px;border-radius:50%;
  background:radial-gradient(circle,rgba(255,255,255,.16),transparent 65%);right:-180px;bottom:-200px;
}
.auth-h1{font-size:31px;line-height:1.3;font-weight:750;letter-spacing:-.8px;margin-bottom:10px}
.auth-slogan{font-size:13px;opacity:.72;letter-spacing:.4px;margin-bottom:16px}
.auth-p{font-size:13.5px;opacity:.86;line-height:1.85;max-width:420px}
.auth-feats{display:grid;gap:12px;margin-top:28px;max-width:420px}
.auth-feat{display:flex;gap:11px;font-size:13px;opacity:.94;align-items:flex-start}
.auth-feat i{
  width:20px;height:20px;border-radius:6px;background:rgba(255,255,255,.18);display:grid;place-items:center;
  font-size:11px;font-style:normal;flex:0 0 auto;margin-top:2px;
}
.auth-right{display:grid;place-items:center;padding:40px 24px;background:#fff}
.auth-box{width:100%;max-width:352px}
.auth-title{font-size:20px;font-weight:750;letter-spacing:-.4px}
.auth-sub{font-size:13px;color:var(--muted);margin:6px 0 18px}
.auth-tabs{display:flex;gap:6px;padding:4px;background:#F1F4F9;border-radius:11px;margin-bottom:20px}
.auth-tab{flex:1;border:0;background:transparent;padding:9px 4px;border-radius:8px;font-size:13px;font-weight:600;color:#64748B;cursor:pointer;transition:.15s;font-family:inherit}
.auth-tab:hover{color:#334155}
.auth-tab.active{background:#fff;color:var(--brand);box-shadow:0 2px 8px -2px rgba(15,23,42,.14)}
.code-row{display:flex;gap:8px}
.code-row .input{flex:1}
.legal{font-size:11.5px;color:var(--muted);margin-top:18px;line-height:1.7;text-align:center}

/* ---------- 我的 ---------- */
.me-hero{
  background:linear-gradient(135deg,#312E81,#4F46E5 60%,#0EA5E9);color:#fff;border-radius:16px;
  padding:22px;display:flex;align-items:center;gap:16px;position:relative;overflow:hidden;
}
.me-hero::after{content:"";position:absolute;width:260px;height:260px;border-radius:50%;background:rgba(255,255,255,.1);right:-90px;top:-110px}
.me-avatar{width:52px;height:52px;border-radius:16px;background:rgba(255,255,255,.2);display:grid;place-items:center;font-size:19px;font-weight:700;backdrop-filter:blur(4px)}
.me-stat{margin-left:auto;text-align:right;z-index:1}
.me-stat .n{font-size:28px;font-weight:800;letter-spacing:-1px;line-height:1.1}
.me-stat .l{font-size:11.5px;opacity:.82}
.kv{display:flex;justify-content:space-between;padding:11px 0;border-bottom:1px solid #F1F4F9;font-size:13px}
.kv:last-child{border-bottom:none}
.kv .k{color:var(--muted)}
.kv .v{font-weight:600}

/* ---------- 空态 ---------- */
.empty{padding:54px 20px;text-align:center;color:var(--muted)}
.empty .big{font-size:32px;opacity:.3;margin-bottom:10px}

/* ---------- Toast / Modal ---------- */
.toast{
  position:fixed;left:50%;bottom:40px;transform:translate(-50%,20px);z-index:999;
  background:#0F172A;color:#fff;padding:11px 18px;border-radius:11px;font-size:13px;
  box-shadow:0 16px 40px -12px rgba(0,0,0,.4);opacity:0;pointer-events:none;transition:.22s;max-width:88vw;
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.warn{background:#B45309}
.toast.err{background:#B91C1C}
.toast.ok{background:#047857}
.mask{
  position:fixed;inset:0;background:rgba(15,23,42,.42);z-index:200;display:grid;place-items:center;padding:20px;
  animation:fade .15s;backdrop-filter:blur(2px);
}
@keyframes fade{from{opacity:0}to{opacity:1}}
.modal{
  background:#fff;border-radius:16px;width:100%;max-width:640px;max-height:86vh;overflow:auto;
  box-shadow:0 30px 70px -20px rgba(15,23,42,.4);animation:pop .18s;
}
.modal-head{display:flex;align-items:center;padding:16px 20px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#fff;z-index:2}
.modal-body{padding:20px}
.modal-foot{padding:14px 20px;border-top:1px solid var(--line);display:flex;gap:8px;justify-content:flex-end;position:sticky;bottom:0;background:#fff}
.x-btn{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;color:var(--muted);font-size:17px;margin-left:auto}
.x-btn:hover{background:#F1F5F9}

/* ---------- 提示条 ---------- */
.notice{
  display:flex;gap:9px;padding:11px 13px;border-radius:11px;font-size:12.5px;line-height:1.6;
  background:#F0F9FF;border:1px solid #BAE6FD;color:#075985;align-items:flex-start;
}
.notice.amber{background:var(--amber-soft);border-color:#FDE68A;color:#92400E}
.notice i{font-style:normal;flex:0 0 auto}

/* ---------- 响应式 ---------- */
@media (max-width:1080px){
  .gen-grid{grid-template-columns:1fr}
}
@media (max-width:860px){
  .topbar{padding:0 14px;height:56px;gap:10px}
  .brand small{display:none}
  .layout{padding:14px 14px 84px;gap:0}
  .sidenav{
    position:fixed;bottom:0;left:0;right:0;width:100%;flex:none;flex-direction:row;top:auto;
    background:rgba(255,255,255,.96);backdrop-filter:blur(14px);border-top:1px solid var(--line);
    padding:6px 4px calc(6px + env(safe-area-inset-bottom));z-index:60;gap:0;justify-content:space-around;
  }
  .nav-item{flex-direction:column;gap:2px;padding:6px 4px;font-size:10.5px;border-radius:9px;flex:1;align-items:center;box-shadow:none!important;background:transparent!important}
  .nav-item .ico{font-size:17px}
  .nav-item.active{color:var(--brand);font-weight:700}
  .nav-sep{display:none}
  .auth-wrap{grid-template-columns:1fr}
  .auth-left{display:none}
  .plans{grid-template-columns:1fr}
  .site-menu{width:calc(100vw - 28px)}
  .card-pad{padding:16px}
  .result-box{max-height:none}
}
@media (max-width:520px){
  .quota-pill{padding:0 10px;font-size:11.5px}
  .quota-pill b{font-size:13px}
  .site-btn{padding:0 10px;height:34px;font-size:12.5px}
  .brand span.bn{display:none}
}
