:root {
  --bg: #0b1220;
  --card: #111b2e;
  --text: #e8eefc;
  --muted: #9fb0d0;
  --border: rgba(255, 255, 255, 0.14);
  --primary: #5b8cff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, input, button, select, textarea {
  font-family: "SimHei", "Heiti SC", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.topbar { border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.2); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { color: var(--text); text-decoration: none; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topnav { display: flex; align-items: center; gap: 14px; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--text); }

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
}
.sidebar {
  background: rgba(0,0,0,0.12);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  position: sticky;
  top: 12px;
  height: fit-content;
}
.sidebar-title { font-weight: 700; margin-bottom: 10px; }
.sidenav { display: grid; gap: 6px; }
.sidenav a {
  display: block;
  padding: 10px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
}
.sidenav a:hover { color: var(--text); border-color: rgba(255,255,255,0.10); background: rgba(255,255,255,0.02); }
.sidenav a.active { color: var(--text); border-color: rgba(91,140,255,0.35); background: rgba(91,140,255,0.10); }
.main-inner { max-width: 920px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-top: 18px; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row { margin-top: 12px; }

.form { display: grid; gap: 12px; margin-top: 12px; }
label span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
}
input:focus { border-color: rgba(91, 140, 255, 0.55); }
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
}
select:focus { border-color: rgba(91, 140, 255, 0.55); }

.btn {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn.btn-link {
  padding: 8px 10px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn.btn-link:hover { color: var(--text); border-color: rgba(255,255,255,0.10); background: rgba(255,255,255,0.02); }
.btn.primary { background: rgba(91,140,255,0.18); border-color: rgba(91,140,255,0.35); }
.btn.danger { background: rgba(255, 90, 90, 0.14); border-color: rgba(255, 90, 90, 0.35); }
.btn:hover { border-color: rgba(255,255,255,0.16); }

.result {
  margin-top: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  overflow: auto;
  position: relative;
}
.result:after{content:'';position:absolute;inset:0;border:1px solid var(--border);border-radius:10px;pointer-events:none}

.table-wrap { margin-top: 12px; overflow: auto; border-radius: 10px; position:relative; }
.table-wrap:after{content:'';position:absolute;inset:0;border:1px solid var(--border);border-radius:10px;pointer-events:none}
.table { width: 100%; border-collapse: collapse; min-width: 860px; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { text-align: left; font-size: 14px; color: var(--muted); background: rgba(0,0,0,0.20); }
.table tr:hover td { background: rgba(255,255,255,0.02); }
.table-actions { display: flex; gap: 8px; }
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
}
.badge.active { color: var(--text); border-color: rgba(91,140,255,0.35); background: rgba(91,140,255,0.10); }
.badge.disabled { color: var(--text); border-color: rgba(255, 200, 90, 0.35); background: rgba(255, 200, 90, 0.10); }
.badge.creating, .badge.failed { color: var(--text); border-color: rgba(255,255,255,0.16); background: rgba(255,255,255,0.04); }
.badge.deleted { color: rgba(255,255,255,0.55); border-color: rgba(255,255,255,0.10); background: rgba(0,0,0,0.15); }

.super-chat-grid{display:grid;grid-template-columns:420px 1fr;gap:12px;margin-top:12px;align-items:start}
.super-chat-messages-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px}
.super-chat-messages-title{font-weight:800}
.super-chat-messages{margin-top:10px;border-radius:10px;border:1px solid var(--border);background:rgba(0,0,0,0.18);padding:12px;max-height:520px;overflow:auto;display:flex;flex-direction:column;gap:10px}
.super-chat-msg{padding:10px 12px;border-radius:10px;border:1px solid rgba(255,255,255,0.08);background:rgba(255,255,255,0.02)}
.super-chat-msg.me{border-color:rgba(91,140,255,0.30);background:rgba(91,140,255,0.10)}
.super-chat-msg .meta{font-size:13px;color:var(--muted);margin-bottom:6px;display:flex;gap:10px;flex-wrap:wrap}
.super-chat-msg .text{white-space:pre-wrap;word-break:break-word}

code { color: #b6c7ff; }

@media (max-width: 900px) {
  .topbar .container { flex-wrap: wrap; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .main-inner { max-width: 100%; }
  .super-chat-grid{grid-template-columns:1fr}
}

.g-fullpage{min-height:100vh;display:flex;flex-direction:column}
.g-fullpage .topbar{flex:0 0 auto}
.g-fullpage .container{max-width:none;width:100%}
.g-fullpage .topbar .container{max-width:none}
.g-fullpage .app-shell{flex:1 1 auto;max-width:none;width:100%;margin:0;grid-template-columns:260px 1fr}
.g-fullpage .main-inner{max-width:none}
.g-fullpage .sidebar{height:calc(100vh - 80px);max-height:none;overflow:auto}
.g-fullpage .main{min-width:0}
.g-fullpage .g-footer{flex:0 0 auto;margin-top:0}

.g-footer{
  margin-top:16px;
  border-top:1px solid var(--border);
  background:rgba(0,0,0,0.20);
}
.g-footer-inner{
  padding:12px 16px;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  color:var(--muted);
  font-size:14px;
}
.g-footer-item{white-space:nowrap}
.g-footer-brand{color:#0b3d91}
.g-footer-dot{opacity:.65}

.g-modal-backdrop{position:fixed;inset:0;background:rgba(2,6,23,0.62);backdrop-filter:blur(10px) saturate(140%);-webkit-backdrop-filter:blur(10px) saturate(140%);display:flex;align-items:center;justify-content:center;z-index:9999;padding:16px}
.g-modal-backdrop[hidden]{display:none}
.g-modal{width:560px;max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);background:#fff;border-radius:18px;overflow:hidden;box-shadow:0 30px 120px rgba(0,0,0,0.45);display:flex;flex-direction:column}
#g-auth-modal .g-modal{--bg:#fff;--card:#fff;--text:#111;--muted:#777;--border:#eee;--primary:#d10000;color:var(--text)}
#g-auth-modal .g-modal{height:auto;max-height:calc(100vh - 32px);width:520px;border:1px solid rgba(255,255,255,0.45);background:linear-gradient(180deg,#ffffff,#fbfbfb)}
.g-modal-h{height:50px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 14px;border-bottom:1px solid #eee}
.g-modal-title{font-weight:900;color:#111;font-size:14px}
.g-modal-close{width:36px;height:36px;border-radius:10px;border:1px solid #eee;background:#fff;color:#333;font-size:20px;line-height:1;cursor:pointer}
.g-modal-close:hover{background:#f7f7f7}
.g-modal-bd{flex:1;min-height:0;background:#fff}
.g-modal-bd{position:relative}
.g-modal-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#fff;color:#666;font-weight:900;letter-spacing:.4px}
.g-modal-loading[hidden]{display:none}
.g-modal-bd iframe{width:100%;height:100%;border:0;display:none;background:#fff;opacity:1;transition:opacity .12s ease}
.g-modal-bd iframe.active{display:block}

.g-toast-root{position:fixed;left:0;right:0;top:16px;z-index:10000;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none}
.g-toast{pointer-events:auto;max-width:calc(100vw - 32px);background:rgba(17,24,39,.92);color:#fff;border:1px solid rgba(255,255,255,.12);border-radius:12px;padding:10px 12px;box-shadow:0 10px 30px rgba(0,0,0,.35);font-weight:800}
.g-toast.ok{background:rgba(16,185,129,.92)}
.g-toast.err{background:rgba(239,68,68,.92)}
.g-auth-view{width:100%;height:auto;display:none;overflow:hidden}
.g-auth-view.active{display:block}

#g-auth-modal .g-modal-bd{overflow:auto}
#g-auth-modal .g-auth-wrap{padding:10px}
#g-auth-modal .g-auth-card{margin-top:0;border-radius:18px;border:1px solid rgba(15,23,42,.08);box-shadow:0 20px 70px rgba(2,6,23,.10);padding:14px 14px 12px;background:radial-gradient(720px 240px at 20% 0%, rgba(209,0,0,.06), rgba(255,255,255,0) 60%),radial-gradient(520px 220px at 85% 0%, rgba(2,132,199,.06), rgba(255,255,255,0) 55%),#fff;position:relative;overflow:hidden}
#g-auth-modal .g-auth-card:before{content:"";position:absolute;inset:-1px;pointer-events:none;border-radius:18px;background:linear-gradient(135deg,rgba(209,0,0,.18),rgba(2,132,199,.16),rgba(16,185,129,.12));opacity:.35;mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);padding:1px;box-sizing:border-box}
#g-auth-modal .g-auth-head{display:flex;flex-direction:column;align-items:center;gap:6px;margin-bottom:8px}
#g-auth-modal .g-auth-avatar{width:48px;height:48px;border-radius:16px;background:radial-gradient(circle at 30% 25%,rgba(255,255,255,.65),rgba(255,255,255,0) 45%),linear-gradient(135deg,#ff5a5a,#b30000);box-shadow:0 18px 46px rgba(209,0,0,.20);display:flex;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.65);position:relative;overflow:hidden}
#g-auth-modal .g-auth-avatar:before{content:"";position:absolute;inset:0;background:linear-gradient(135deg,rgba(255,255,255,.55),rgba(255,255,255,0) 42%);mix-blend-mode:soft-light;opacity:.85}
#g-auth-modal .g-auth-avatar:after{content:"";position:absolute;left:-18px;top:-22px;width:64px;height:64px;border-radius:50%;background:radial-gradient(circle,rgba(255,255,255,.85),rgba(255,255,255,0) 60%);opacity:.55}
#g-auth-modal .g-auth-avatar svg{width:24px;height:24px;stroke:#fff;stroke-width:2;fill:none}
#g-auth-modal .g-auth-h1{margin:0;font-size:18px;font-weight:950;color:#111;letter-spacing:.2px}
#g-auth-modal .g-auth-sub{margin:0;font-size:12px;color:#6b7280;font-weight:800}
#g-auth-modal .g-auth-form{display:grid;gap:8px;margin-top:10px;align-content:start}
#g-auth-modal .g-auth-label span{display:block;font-size:13px;color:#666;margin:0 0 4px}
#g-auth-modal .g-auth-field{height:42px;display:flex;align-items:center;gap:10px;border:1px solid rgba(15,23,42,.12);background:rgba(255,255,255,.92);border-radius:12px;padding:0 10px;transform:translateY(0);transition:border-color .12s ease,box-shadow .12s ease,background .12s ease,transform .12s ease}
#g-auth-modal .g-auth-field:focus-within{border-color:rgba(209,0,0,.35);box-shadow:0 0 0 4px rgba(209,0,0,.10);background:#fff;transform:translateY(-1px)}
#g-auth-modal .g-auth-ico{width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;color:#d10000;flex:0 0 auto}
#g-auth-modal .g-auth-ico svg{width:18px;height:18px;stroke:currentColor;stroke-width:2;fill:none}
#g-auth-modal .g-auth-field input{border:0;background:transparent;color:#111;outline:none;padding:0;flex:1;min-width:0;height:100%;font-size:14px}
#g-auth-modal .g-auth-field input::placeholder{color:#b0b0b0}
#g-auth-modal{--otp-border:rgba(15,23,42,.12);--otp-bg:rgba(255,255,255,.92);--otp-focus:rgba(209,0,0,.35);--otp-ring:rgba(209,0,0,.10)}
.g-otp6{display:flex;align-items:center;gap:8px;flex:1;min-width:0}
.g-otp6 input{width:34px;height:36px;border-radius:12px;border:1px solid var(--otp-border,rgba(15,23,42,.12));background:var(--otp-bg,rgba(255,255,255,.92));color:#0f172a;font-weight:1000;font-size:14px;text-align:center;outline:none;transition:border-color .12s ease,box-shadow .12s ease,transform .12s ease,background .12s ease}
.g-otp6 input:focus{border-color:var(--otp-focus,rgba(209,0,0,.35));box-shadow:0 0 0 4px var(--otp-ring,rgba(209,0,0,.10));transform:translateY(-1px);background:#fff}
.g-otp6 input.is-filled{background:#fff}
.g-otp6 input::-webkit-outer-spin-button,.g-otp6 input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.g-otp6 input[type=number]{-moz-appearance:textfield}
#g-auth-modal .g-auth-field input:-webkit-autofill,
#g-auth-modal .g-auth-field input:-webkit-autofill:hover,
#g-auth-modal .g-auth-field input:-webkit-autofill:focus,
#g-auth-modal .g-auth-field input:-webkit-autofill:active{
  -webkit-text-fill-color:#111;
  caret-color:#111;
  box-shadow:0 0 0 1000px #fff inset;
  transition:background-color 9999s ease-in-out 0s;
}
#g-auth-modal .g-auth-eye{width:34px;height:34px;border-radius:10px;border:1px solid #f0f0f0;background:#fff;color:#999;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto}
#g-auth-modal .g-auth-eye:hover{background:#fafafa;color:#666}
#g-auth-modal .g-auth-eye svg{width:18px;height:18px;stroke:currentColor;stroke-width:2;fill:none}
#g-auth-modal .g-auth-sms-btn{height:34px;border-radius:999px;border:1px solid rgba(15,23,42,.12);background:rgba(2,6,23,.03);color:#0f172a;font-weight:950;font-size:12px;padding:0 12px;cursor:pointer;flex:0 0 auto;transition:background .12s ease,border-color .12s ease,transform .12s ease,box-shadow .12s ease}
#g-auth-modal .g-auth-sms-btn:hover{background:rgba(2,6,23,.05);border-color:rgba(209,0,0,.18)}
#g-auth-modal .g-auth-sms-btn:active{transform:translateY(0.5px)}
#g-auth-modal .g-auth-sms-btn:disabled{opacity:.55;cursor:not-allowed;transform:none;box-shadow:none}
#g-auth-modal .g-auth-sms-btn.is-countdown::after{content:"";width:4px;height:4px;border-radius:50%;background:currentColor;display:inline-block;margin-left:8px;box-shadow:8px 0 0 currentColor,16px 0 0 currentColor;opacity:.65;animation:gSmsDots 1s infinite}
#g-auth-modal .g-auth-sms-tip{font-size:11px;color:#94a3b8;font-weight:950;white-space:nowrap;letter-spacing:.1px;margin-left:2px}
#g-auth-modal .g-auth-primary{border-radius:999px;background:linear-gradient(135deg,#d10000,#ff2b2b);border-color:rgba(209,0,0,.35);color:#fff;font-weight:950;height:42px;width:100%;display:flex;align-items:center;justify-content:center;padding:0 16px;font-size:14px;letter-spacing:.3px;box-shadow:0 16px 34px rgba(209,0,0,.18)}
#g-auth-modal .g-auth-primary:hover{filter:saturate(1.02) brightness(.99)}
#g-auth-modal .g-auth-hintline{font-size:12px;font-weight:950;letter-spacing:.1px;text-align:center}
#g-auth-modal .g-auth-hintline.ok{color:#16a34a}
#g-auth-modal .g-auth-hintline.err{color:#ef4444}
#g-auth-modal .g-auth-h1{font-size:19px;letter-spacing:.35px}
#g-auth-modal .g-auth-h1:after{content:"";display:block;height:3px;width:40px;border-radius:999px;margin-top:7px;background:linear-gradient(90deg,rgba(209,0,0,1),rgba(255,43,43,1),rgba(2,132,199,.92));box-shadow:0 10px 18px rgba(209,0,0,.10)}
#g-auth-modal .g-auth-sub{letter-spacing:.15px}

@keyframes gSmsDots{0%,100%{opacity:.25}50%{opacity:.9}}
#g-auth-modal .g-auth-links{margin-top:8px;display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;font-size:13px}
#g-auth-modal .g-auth-links a{color:#d10000;text-decoration:none;font-weight:800}
#g-auth-modal .g-auth-links a:hover{text-decoration:underline}
#g-auth-modal .g-auth-switch{margin-top:-2px;display:flex;align-items:center;justify-content:center;gap:0;border:1px solid rgba(15,23,42,.10);background:rgba(2,6,23,.04);border-radius:14px;padding:3px}
#g-auth-modal .g-auth-switch a{flex:1;min-width:0;text-align:center;text-decoration:none;color:#64748b;font-weight:950;font-size:12px;padding:7px 10px;border-radius:11px;border:1px solid transparent;transition:background .12s ease,color .12s ease,border-color .12s ease,box-shadow .12s ease,transform .12s ease}
#g-auth-modal .g-auth-switch a:hover{color:#0f172a}
#g-auth-modal .g-auth-switch a.is-active{background:#fff;color:#d10000;border-color:rgba(209,0,0,.14);box-shadow:0 14px 26px rgba(2,6,23,.08);transform:translateY(-0.5px)}
#g-auth-modal .g-auth-result{margin-top:12px;background:#fafafa;border:1px solid #f0f0f0;color:#111;border-radius:12px;padding:12px;overflow:hidden}

.g-chat-fab{position:fixed;right:18px;bottom:18px;z-index:9998;height:44px;padding:0 16px;border-radius:999px;border:1px solid rgba(15,23,42,.14);background:#fff;color:#111;font-weight:900;font-size:14px;cursor:pointer;box-shadow:0 12px 30px rgba(15,23,42,.10);transition:transform .12s ease,box-shadow .12s ease,border-color .12s ease}
.g-chat-fab:hover{transform:translateY(-1px);border-color:rgba(209,0,0,.20);box-shadow:0 18px 44px rgba(15,23,42,.12)}
.g-chat-fab:active{transform:translateY(0)}
.g-chat-panel{position:fixed;right:18px;bottom:72px;z-index:9999;width:380px;max-width:calc(100vw - 32px);height:520px;max-height:calc(100vh - 100px);border-radius:16px;border:1px solid rgba(15,23,42,.12);background:#fff;box-shadow:0 24px 80px rgba(0,0,0,.22);display:flex;flex-direction:column;overflow:hidden}
.g-chat-panel[hidden]{display:none}
.g-chat-h{height:52px;padding:0 12px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #f0f0f0;background:#fff}
.g-chat-title{font-weight:950;color:#111;font-size:14px}
.g-chat-actions{display:flex;align-items:center;gap:8px}
.g-chat-iconbtn{width:36px;height:36px;border-radius:10px;border:1px solid #eee;background:#fff;color:#333;font-size:18px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.g-chat-iconbtn:hover{background:#f7f7f7}
.g-chat-status{padding:8px 12px;font-size:12px;color:#888;border-bottom:1px solid #f7f7f7;background:#fff}
.g-chat-msgs{flex:1;min-height:0;overflow:auto;padding:12px;display:flex;flex-direction:column;gap:10px;background:#fafafa}
.g-chat-bubble{max-width:78%;padding:10px 12px;border-radius:14px;font-size:13px;line-height:1.5;border:1px solid rgba(15,23,42,.08);background:#fff;color:#111;box-shadow:0 8px 18px rgba(15,23,42,.06);white-space:pre-wrap;word-break:break-word}
.g-chat-bubble.me{align-self:flex-end;background:#d10000;color:#fff;border-color:#d10000}
.g-chat-bubble.sys{align-self:center;max-width:90%;background:transparent;border:0;box-shadow:none;color:#888;font-size:12px;padding:0}
.g-chat-form{display:flex;gap:10px;padding:10px;border-top:1px solid #f0f0f0;background:#fff}
.g-chat-input{flex:1;min-height:40px;max-height:110px;resize:none;border:1px solid #e6e6e6;border-radius:12px;padding:10px 12px;font-size:14px;outline:none;color:#111;background:#fff}
.g-chat-input::placeholder{color:#b0b0b0}
.g-chat-input:focus{border-color:rgba(209,0,0,.35);box-shadow:0 0 0 3px rgba(209,0,0,.10)}
.g-chat-send{height:40px;border-radius:12px;background:#d10000;border:1px solid #d10000;color:#fff;font-weight:900;padding:0 14px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.g-chat-send:disabled{opacity:.55;cursor:not-allowed}
@media (max-width: 560px){.g-chat-panel{right:0;left:0;top:0;bottom:0;width:auto;max-width:none;height:auto;max-height:none;border-radius:0}.g-chat-fab{right:14px;bottom:14px}.g-chat-msgs{padding:14px}.g-chat-form{padding:12px}}
