:root {
  --bg: #f5f6f9;
  --panel: #ffffff;
  --ink: #1d2330;
  --muted: #7b8497;
  --line: #e8eaf0;
  --purple: #7657e8;
  --purple-dark: #6042d1;
  --purple-soft: #f0edff;
  --green: #35a66f;
  --green-soft: #eaf8f1;
  --amber: #d79218;
  --amber-soft: #fff6df;
  --red: #d94e54;
  --red-soft: #fff0f0;
  --blue: #3c82db;
  --blue-soft: #ecf5ff;
  --shadow: 0 14px 36px rgba(30, 38, 60, .07);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 248px; padding: 24px 16px 18px; background: #171925; color: #eff0f6; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: white; font-weight: 800; font-size: 18px; background: linear-gradient(145deg, #8769f5, #5f3dd1); box-shadow: 0 8px 25px rgba(118,87,232,.35); }
.brand-mark.large { width: 52px; height: 52px; border-radius: 15px; font-size: 23px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; letter-spacing: .2px; }
.brand span { color: #81869a; margin-top: 3px; font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase; }
.nav-list { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; color: #9297a9; width: 100%; padding: 12px 13px; border-radius: 10px; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: white; background: rgba(118,87,232,.19); box-shadow: inset 3px 0 var(--purple); }
.nav-icon { width: 22px; text-align: center; font-weight: 700; font-size: 17px; }
.nav-item em { font-style: normal; margin-left: auto; min-width: 22px; text-align: center; border-radius: 10px; background: #2b2e3d; color: #aaaec0; padding: 2px 6px; font-size: 11px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.security-note { display: flex; gap: 9px; align-items: center; background: #20232f; padding: 12px; border-radius: 11px; }
.security-note > span { color: #47cf8c; font-size: 10px; text-shadow: 0 0 12px #47cf8c; }
.security-note strong, .security-note small { display: block; }
.security-note strong { font-size: 12px; }
.security-note small { margin-top: 4px; color: #777d91; font-size: 10px; }
.user-card { border: 0; color: #d8dae4; background: transparent; display: flex; gap: 10px; align-items: center; text-align: left; padding: 9px; border-radius: 10px; cursor: pointer; }
.user-card:hover { background: #20232f; }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: #303445; font-weight: 700; }
.user-card strong, .user-card small { display: block; }
.user-card strong { font-size: 12px; }
.user-card small { color: #777d91; font-size: 10px; margin-top: 3px; }

.main-content { min-height: 100vh; margin-left: 248px; }
.topbar { min-height: 88px; padding: 19px 34px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 15; }
.topbar h1 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.3px; }
.breadcrumb { margin: 0; font-size: 11px; color: #9aa1b0; }
.top-actions { display: flex; gap: 14px; align-items: center; }
.live-dot { color: #667082; font-size: 11px; display: flex; align-items: center; gap: 7px; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: #38b978; box-shadow: 0 0 0 4px #e4f7ed; }
.icon-button, .mobile-menu { width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; color: #6e7688; font-size: 18px; }
.icon-button:hover { color: var(--purple); border-color: #d7cffc; }
.mobile-menu { display: none; }
.content-wrap { padding: 28px 34px 56px; max-width: 1640px; margin: 0 auto; }
.view { display: none; animation: fade-in .2s ease; }
.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.hero-strip { min-height: 180px; overflow: hidden; position: relative; border-radius: 20px; padding: 34px 38px; color: white; background: linear-gradient(120deg, #211f39 0%, #493c83 62%, #6b50d8 100%); box-shadow: 0 20px 45px rgba(59,43,117,.19); display: flex; align-items: center; justify-content: space-between; }
.hero-strip::after { content: ""; position: absolute; width: 370px; height: 370px; border: 55px solid rgba(255,255,255,.055); border-radius: 50%; right: -85px; top: -153px; }
.hero-strip::before { content: ""; position: absolute; width: 135px; height: 135px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; right: 155px; bottom: -75px; }
.hero-strip > * { position: relative; z-index: 1; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: #c8bdf9; }
.hero-strip h2 { margin: 12px 0 9px; font-size: 28px; letter-spacing: -.6px; }
.hero-strip p { margin: 0; max-width: 600px; color: #cac5df; line-height: 1.7; font-size: 13px; }
.hero-status { width: 108px; height: 108px; border-radius: 50%; background: rgba(255,255,255,.1); display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.14); }
.hero-status strong { font-size: 31px; line-height: 1; }
.hero-status small { color: #d5d0e9; margin-top: 7px; font-size: 10px; }
.pulse-ring { position: absolute; width: 128px; height: 128px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin: 20px 0; }
.stat-card { min-height: 124px; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; align-items: center; gap: 16px; box-shadow: 0 8px 25px rgba(30,38,60,.035); }
.stat-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; font-size: 18px; font-weight: 700; }
.stat-icon.violet { background: var(--purple-soft); color: var(--purple); }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-card small, .stat-card strong, .stat-card p { display: block; }
.stat-card small { color: #8c94a4; font-size: 11px; }
.stat-card strong { font-size: 24px; margin: 5px 0 3px; letter-spacing: -.5px; }
.stat-card p { margin: 0; color: #afb4c0; font-size: 10px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 7px 26px rgba(35,42,60,.035); }
.panel.flush { overflow: hidden; }
.panel-head { min-height: 75px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head p { margin: 5px 0 0; color: #9aa1ae; font-size: 11px; }
.section-lead { display: flex; justify-content: space-between; align-items: flex-end; margin: 3px 0 22px; }
.section-lead h2 { margin: 0 0 7px; font-size: 21px; }
.section-lead p { margin: 0; color: var(--muted); font-size: 12px; }
.btn { border: 0; border-radius: 9px; padding: 9px 14px; font-size: 12px; font-weight: 600; cursor: pointer; transition: .16s ease; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { color: white; background: var(--purple); box-shadow: 0 7px 18px rgba(118,87,232,.2); }
.btn-primary:hover { background: var(--purple-dark); }
.btn-quiet { color: #687184; background: #f5f6f9; border: 1px solid #eceef3; box-shadow: none; }
.btn-danger { color: var(--red); background: var(--red-soft); }
.btn-block { width: 100%; }
.notice { margin: -5px 0 18px; border-radius: 12px; background: #f1effc; color: #615d73; padding: 12px 16px; display: flex; gap: 11px; align-items: flex-start; font-size: 11px; }
.notice > span { width: 18px; height: 18px; flex: 0 0 auto; border-radius: 50%; color: white; background: var(--purple); display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.notice p { margin: 1px 0 0; line-height: 1.6; }
.notice.danger { margin-top: 18px; background: var(--red-soft); color: #895257; }
.notice.danger > span { background: var(--red); }
.toolbar { min-height: 68px; padding: 13px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.search-box { width: min(480px, 58vw); height: 39px; display: flex; align-items: center; gap: 8px; border: 1px solid #e2e5ec; color: #a1a7b3; border-radius: 9px; padding: 0 12px; background: #fff; }
.search-box:focus-within { border-color: #b9abf8; box-shadow: 0 0 0 3px #f1eeff; }
.search-box input { border: 0; outline: 0; width: 100%; color: var(--ink); font-size: 12px; background: transparent; }
.toolbar select { border: 1px solid #e2e5ec; border-radius: 9px; padding: 9px 12px; color: #687184; background: white; font-size: 12px; }
.toolbar-tip { font-size: 10px; color: #a0a6b3; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
table.wide { min-width: 1080px; }
.token-table { min-width: 960px; }
.log-table { min-width: 1150px; }
th { color: #727b8d; font-weight: 600; text-align: left; padding: 13px 14px; background: #fafafd; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { color: #41495a; padding: 14px; border-bottom: 1px solid #eff0f4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfe; }
.muted { color: #9ca3b1; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.tag { display: inline-flex; align-items: center; min-height: 23px; border-radius: 6px; padding: 3px 8px; font-size: 10px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.tag.green { color: #23925c; border-color: #9ed9b8; background: #f5fff9; }
.tag.amber { color: #a96d00; border-color: #ead28d; background: #fffdf4; }
.tag.red { color: #c14047; border-color: #edb0b4; background: #fff8f8; }
.tag.gray { color: #747c8b; border-color: #dfe2e8; background: #fafbfc; }
.tag.purple { color: #7340cf; border-color: #bb94ef; background: #fcf9ff; }
.tag.blue { color: #3977bc; border-color: #a9cbed; background: #f5faff; }
.model-tag { color: #856541; border-color: #c5aa89; background: #fffdfb; }
.row-actions { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.action { border: 0; padding: 6px 8px; border-radius: 6px; cursor: pointer; background: #f0f1f5; color: #687184; font-size: 10px; }
.action:hover { background: #e8e9ef; }
.action.green { color: white; background: #54b765; }
.action.red { color: white; background: #d34b4e; }
.channel-name { font-weight: 700; display: block; }
.channel-sub { color: #a1a7b2; display: block; margin-top: 4px; font-size: 9px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.balance strong { display: block; font-size: 12px; }
.balance small { color: #9ba2af; }
.empty-state { display: none; padding: 62px 20px; text-align: center; }
.empty-state.show { display: block; }
.empty-state > span { display: grid; place-items: center; margin: 0 auto; width: 48px; height: 48px; border-radius: 14px; color: var(--purple); background: var(--purple-soft); font-size: 22px; }
.empty-state h3 { margin: 14px 0 7px; font-size: 15px; }
.empty-state p { color: #9ca3b0; margin: 0 0 16px; font-size: 11px; }
.pagination { padding: 14px 18px; border-top: 1px solid var(--line); color: #9299a7; display: flex; align-items: center; justify-content: space-between; font-size: 10px; }
.pagination > div { display: flex; gap: 9px; align-items: center; }
.detail-cell { line-height: 1.65; white-space: nowrap; }
.latency { display: inline-flex; border: 1px solid #e9c66e; color: #b38100; border-radius: 5px; padding: 1px 5px; margin-top: 3px; font-size: 9px; }
.latency.slow { border-color: #ec9e9e; color: #ca4545; }

.docs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.docs-card { min-height: 190px; padding: 24px; position: relative; overflow: hidden; }
.docs-card .step { position: absolute; right: 20px; top: 11px; font-size: 53px; font-weight: 800; color: #f2f0fa; }
.docs-card h3 { position: relative; margin: 3px 0 9px; font-size: 17px; }
.docs-card p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.copy-field, .secret-box { min-height: 46px; border: 1px solid #e3e5eb; background: #fafafd; border-radius: 9px; padding: 8px 10px 8px 13px; display: flex; align-items: center; gap: 10px; }
.copy-field code, .secret-box code { flex: 1; word-break: break-all; font-size: 11px; color: #5e4db1; }
.copy-field button, .secret-box button { border: 0; background: var(--purple-soft); color: var(--purple); border-radius: 7px; padding: 7px 10px; cursor: pointer; font-size: 10px; }
.code-panel pre { margin: 0; padding: 24px; overflow: auto; background: #171925; color: #d8d7e7; border-radius: 0 0 var(--radius) var(--radius); line-height: 1.8; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(18,20,29,.56); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; animation: fade-in .16s ease; }
.modal { width: min(620px, 100%); max-height: 92vh; overflow-y: auto; background: white; border-radius: 17px; box-shadow: 0 26px 70px rgba(10,12,20,.28); padding: 24px; }
.modal.compact { width: min(470px,100%); text-align: center; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 21px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head p { margin: 6px 0 0; color: #989fac; font-size: 11px; }
.modal-close { border: 0; background: #f2f3f6; color: #7d8492; width: 31px; height: 31px; border-radius: 9px; cursor: pointer; font-size: 19px; }
form { display: grid; gap: 16px; }
form label, fieldset { color: #515969; font-size: 11px; font-weight: 600; }
form label > input:not([type=checkbox]), form label > select { display: block; width: 100%; margin-top: 7px; height: 41px; border: 1px solid #dfe2e9; border-radius: 9px; padding: 0 12px; outline: 0; color: var(--ink); background: white; }
form label > input:focus, form label > select:focus { border-color: #ad9af4; box-shadow: 0 0 0 3px #f1eeff; }
form label small { display: block; margin-top: 6px; color: #9ca3af; font-weight: 400; font-size: 9px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1.25fr; }
fieldset { margin: 0; border: 1px solid #e1e4ea; border-radius: 10px; padding: 12px; }
fieldset legend { padding: 0 6px; }
.check-row { display: flex; gap: 10px; }
.check { font-weight: 500; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 8px; background: #f8f8fb; }
.toggle-label { display: flex; align-items: center; justify-content: space-between; border: 1px solid #e1e4ea; border-radius: 9px; padding: 0 12px; min-height: 41px; margin-top: 18px; }
.toggle-label input { display: none; }
.toggle { position: relative; width: 35px; height: 20px; border-radius: 12px; background: #c7cbd4; transition: .2s; }
.toggle::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; left: 2px; top: 2px; background: white; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-label input:checked + .toggle { background: var(--purple); }
.toggle-label input:checked + .toggle::after { transform: translateX(15px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.secret-success { margin: 5px auto 15px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 22px; }
.modal.compact h3 { margin: 0; }
.modal.compact > p { color: #868e9c; font-size: 11px; line-height: 1.6; margin: 9px 0 17px; }
.secret-box { text-align: left; margin-bottom: 18px; }

.toast-stack { position: fixed; right: 22px; top: 105px; z-index: 80; display: grid; gap: 9px; }
.toast { min-width: 260px; max-width: 390px; padding: 13px 15px; border-radius: 10px; color: #3f4757; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 11px; animation: toast-in .2s ease; }
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateX(15px); } }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f2f3f8; }
.login-shell { width: min(960px,100%); min-height: 570px; display: grid; grid-template-columns: 47% 53%; background: white; border-radius: 24px; overflow: hidden; box-shadow: 0 28px 80px rgba(28,33,52,.13); }
.login-panel { padding: 58px 62px; display: flex; flex-direction: column; justify-content: center; }
.login-heading { margin: 25px 0; }
.login-heading .eyebrow { color: var(--purple); }
.login-heading h1 { margin: 10px 0 7px; font-size: 28px; }
.login-heading p { margin: 0; color: #9399a7; font-size: 12px; }
.login-form { gap: 17px; }
.login-form .btn { height: 43px; margin-top: 3px; }
.login-foot { text-align: center; color: #a5abb6; margin: 22px 0 0; font-size: 9px; }
.alert { padding: 11px 13px; border-radius: 9px; margin-bottom: 14px; font-size: 11px; }
.alert-error { color: #b7464c; background: var(--red-soft); border: 1px solid #f1c9cc; }
.login-aside { position: relative; overflow: hidden; color: white; background: linear-gradient(145deg,#201d38,#503c9a); display: flex; align-items: center; padding: 55px; }
.ambient { position: absolute; border-radius: 50%; border: 65px solid rgba(255,255,255,.045); }
.ambient-one { width: 430px; height: 430px; right: -180px; top: -130px; }
.ambient-two { width: 260px; height: 260px; left: -140px; bottom: -120px; }
.login-feature { position: relative; z-index: 1; }
.feature-chip { display: inline-block; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.09); border-radius: 18px; padding: 7px 11px; font-size: 9px; letter-spacing: 1px; }
.login-feature h2 { font-size: 28px; line-height: 1.45; margin: 23px 0 14px; }
.login-feature p { color: #cbc4e4; line-height: 1.8; font-size: 12px; max-width: 400px; }
.mini-flow { display: flex; align-items: center; gap: 9px; margin-top: 34px; }
.mini-flow span { padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.1); font-size: 9px; }
.mini-flow i { width: 17px; height: 1px; background: rgba(255,255,255,.32); }

@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .login-panel { padding: 45px; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: .22s ease; box-shadow: 20px 0 50px rgba(10,12,20,.18); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .mobile-menu { display: inline-grid; place-items: center; margin-right: 12px; }
  .topbar { justify-content: flex-start; padding: 16px 20px; }
  .top-actions { margin-left: auto; }
  .content-wrap { padding: 20px; }
  .hero-strip { padding: 28px; }
  .hero-status { display: none; }
  .docs-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-panel { padding: 50px; }
}
@media (max-width: 560px) {
  .content-wrap { padding: 16px 12px 45px; }
  .topbar { min-height: 75px; padding: 13px 12px; }
  .topbar h1 { font-size: 18px; }
  .live-dot { display: none; }
  .hero-strip { min-height: 160px; padding: 24px; border-radius: 15px; }
  .hero-strip h2 { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { min-height: 100px; padding: 17px; }
  .section-lead { align-items: flex-start; gap: 15px; }
  .section-lead p { max-width: 250px; line-height: 1.55; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .toggle-label { margin-top: 0; }
  .modal { padding: 20px; }
  .login-page { padding: 0; background: white; }
  .login-shell { min-height: 100vh; border-radius: 0; box-shadow: none; }
  .login-panel { padding: 34px 25px; }
}
