/* EBTC Router — 设计系统(深色) */
:root {
  --bg: #0a0d13;
  --bg2: #0e1219;
  --panel: #12161f;
  --panel2: #171c27;
  --border: #1f2530;
  --border2: #2a3140;
  --text: #e8edf5;
  --muted: #8b94a7;
  --muted2: #5c6577;
  --accent: #6d5cff;
  --accent2: #00c2ff;
  --grad: linear-gradient(135deg, #6d5cff 0%, #00c2ff 100%);
  --green: #2dd4a7;
  --yellow: #f5b04d;
  --red: #f0607d;
  --radius: 12px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--sans);
  font-size: 15px; line-height: 1.6; min-height: 100vh;
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(109, 92, 255, .13), transparent 60%),
                    radial-gradient(900px 500px at 10% -20%, rgba(0, 194, 255, .10), transparent 55%);
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: .92em; }

/* ---------- 布局 ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.nav {
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px);
  background: rgba(10, 13, 19, .82); border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 22px; height: 60px; }
.logo { font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo .accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-links a { color: var(--muted); padding: 7px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.nav-links a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--panel2); }
.nav-right { display: flex; gap: 10px; align-items: center; }
.footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 28px 0; color: var(--muted2); font-size: 13px; }
.footer a { color: var(--muted); margin-right: 16px; }

/* ---------- 组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border2); background: var(--panel2); color: var(--text);
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: .15s; font-family: var(--sans); line-height: 1.4; text-decoration: none;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); border: none; color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-danger { border-color: rgba(240, 96, 125, .4); color: var(--red); }
.btn-danger:hover { border-color: var(--red); background: rgba(240, 96, 125, .08); }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 12px 26px; font-size: 16px; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border2); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 14px; font-family: var(--sans); outline: none;
}
.input:focus { border-color: var(--accent); }
.input.mono { font-family: var(--mono); }
label.field { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
label.field > span { display: block; margin-bottom: 6px; font-weight: 500; }
label.field .hint { color: var(--muted2); font-weight: 400; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; border: 1px solid var(--border2); color: var(--muted); background: var(--bg2); white-space: nowrap;
}
.badge.green { color: var(--green); border-color: rgba(45, 212, 167, .35); }
.badge.yellow { color: var(--yellow); border-color: rgba(245, 176, 77, .35); }
.badge.red { color: var(--red); border-color: rgba(240, 96, 125, .35); }
.badge.accent { color: var(--accent2); border-color: rgba(0, 194, 255, .35); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--muted2); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: var(--bg2); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255, 255, 255, .015); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button {
  background: none; border: none; color: var(--muted); padding: 10px 16px; cursor: pointer;
  font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: var(--sans);
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.kpi .v { font-size: 22px; font-weight: 700; font-family: var(--mono); margin-top: 2px; }
.kpi .l { color: var(--muted); font-size: 12.5px; }

.grid-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.model-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: .15s; color: var(--text); display: block; }
.model-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.model-card h3 { font-size: 15.5px; margin-bottom: 4px; }
.model-card .slug { color: var(--muted2); font-family: var(--mono); font-size: 12px; margin-bottom: 10px; }
.model-card .desc { color: var(--muted); font-size: 13px; min-height: 38px; margin-bottom: 12px; }
.model-card .prices { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.model-card .prices b { color: var(--text); font-weight: 600; }
.model-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* 柱状图(纯 CSS) */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding: 8px 0; }
.chart .bar { flex: 1; min-width: 6px; background: linear-gradient(180deg, var(--accent2), var(--accent)); border-radius: 3px 3px 0 0; position: relative; opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .bar .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--border2); padding: 4px 8px; border-radius: 6px;
  font-size: 11.5px; white-space: nowrap; display: none; z-index: 5; font-family: var(--mono);
}
.chart .bar:hover .tip { display: block; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted2); font-size: 11px; margin-top: 6px; }

/* 聊天(操场) */
.chat-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 18px; min-height: 560px; }
@media (max-width: 900px) { .chat-wrap { grid-template-columns: 1fr; } }
.chat-main { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px; min-height: 360px; max-height: 62vh; }
.msg { margin-bottom: 16px; max-width: 92%; }
.msg .who { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; letter-spacing: .3px; }
.msg .body { padding: 10px 14px; border-radius: 10px; font-size: 14px; word-break: break-word; }
.msg.user .body { background: var(--panel2); border: 1px solid var(--border2); }
.msg.assistant .body { background: rgba(109, 92, 255, .08); border: 1px solid rgba(109, 92, 255, .25); }
.msg .meta { font-size: 11.5px; color: var(--muted2); margin-top: 5px; font-family: var(--mono); }
.msg pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; margin: 8px 0; }
.msg code:not(pre code) { background: var(--bg2); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
.chat-input { border-top: 1px solid var(--border); padding: 14px; display: flex; gap: 10px; }
.chat-input textarea { flex: 1; resize: none; height: 52px; max-height: 140px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* 对话框 / 提示 */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--border2);
  border-radius: 14px; padding: 0; max-width: 560px; width: 92vw;
}
dialog::backdrop { background: rgba(4, 6, 10, .72); backdrop-filter: blur(3px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-head button { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--border2); border-left: 3px solid var(--accent); padding: 11px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: 380px; animation: slideIn .2s; }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* 首页 hero */
.hero { padding: 76px 0 40px; text-align: center; }
.hero h1 { font-size: 42px; line-height: 1.25; letter-spacing: -.5px; max-width: 760px; margin: 0 auto 16px; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 17px; max-width: 640px; margin: 0 auto 28px; }
.hero-stats { display: flex; justify-content: center; gap: 40px; margin: 36px 0 0; flex-wrap: wrap; }
.hero-stats .v { font-size: 26px; font-weight: 700; font-family: var(--mono); }
.hero-stats .l { color: var(--muted2); font-size: 12.5px; }

.section { margin: 52px 0; }
.section > h2 { font-size: 24px; margin-bottom: 6px; }
.section > .sub { color: var(--muted); margin-bottom: 22px; }

pre.code {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; overflow-x: auto; font-size: 13px; line-height: 1.7; position: relative;
}
pre.code .cmt { color: var(--muted2); }
.code-tabs { display: flex; gap: 6px; margin-bottom: -1px; position: relative; z-index: 1; }
.code-tabs button { background: var(--panel); border: 1px solid var(--border); border-bottom: none; color: var(--muted); padding: 6px 14px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 13px; font-family: var(--mono); }
.code-tabs button.active { color: var(--text); background: var(--bg2); }
.copy-btn { position: absolute; top: 8px; right: 8px; }

/* 文档 */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
@media (max-width: 800px) { .docs-layout { grid-template-columns: 1fr; } .docs-toc { position: static !important; } }
.docs-toc { position: sticky; top: 84px; font-size: 14px; }
.docs-toc a { display: block; color: var(--muted); padding: 5px 10px; border-left: 2px solid var(--border); }
.docs-toc a:hover, .docs-toc a.active { color: var(--text); border-left-color: var(--accent); text-decoration: none; }
.docs-body h2 { margin: 40px 0 14px; font-size: 22px; scroll-margin-top: 80px; }
.docs-body h3 { margin: 26px 0 10px; font-size: 17px; }
.docs-body p, .docs-body li { color: #c3cad8; }
.docs-body ul { padding-left: 22px; margin: 10px 0; }
.docs-body table { margin: 12px 0; }

/* 控制台布局 */
.dash-layout { display: grid; grid-template-columns: 210px 1fr; gap: 24px; align-items: start; padding: 30px 0; }
@media (max-width: 800px) { .dash-layout { grid-template-columns: 1fr; } }
.dash-side { position: sticky; top: 84px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.dash-side a { display: flex; align-items: center; justify-content: space-between; color: var(--muted); padding: 10px 14px; border-radius: 9px; font-size: 14px; font-weight: 500; }
.dash-side a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
.dash-side a.active { color: var(--text); background: var(--panel2); }
.dash-side .bal { padding: 12px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.dash-side .bal .v { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--green); }
.dash-side .bal .l { font-size: 12px; color: var(--muted2); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted2); padding: 44px 0; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -3px; }
@keyframes rot { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt22 { margin-top: 22px; } .mb14 { margin-bottom: 14px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .green { color: var(--green); } .red { color: var(--red); } .yellow { color: var(--yellow); }
.right { text-align: right; }

@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
  .nav-inner { gap: 12px; }
  .nav-links { gap: 0; }
}
