/* 鸣泽网关网页：首页、模型价格、接口文档、客户控制台、管理端共用。无外部依赖。 */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #171a21;
  --muted: #5d6475;
  --faint: #8a91a1;
  --line: #e3e6ee;
  --accent: #5145cd;
  --accent-soft: #eceafd;
  --accent-text: #ffffff;
  --ok: #12805c;
  --ok-soft: #e3f5ed;
  --warn: #a35a00;
  --warn-soft: #fdf0dc;
  --bad: #c2312f;
  --bad-soft: #fbe7e6;
  --info: #2563b8;
  --info-soft: #e5eefb;
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 4px 16px rgba(20, 24, 40, .05);
  --radius: 12px;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1116; --surface: #171a22; --surface-2: #1d212b; --text: #e8eaf0; --muted: #a3aaba; --faint: #747c8e;
    --line: #2a2f3b; --accent: #8b83f5; --accent-soft: #26244a; --accent-text: #0f1116;
    --ok: #4cc79a; --ok-soft: #12302a; --warn: #f0b14e; --warn-soft: #33270f; --bad: #f2716d; --bad-soft: #3a1b1c;
    --info: #79a8f0; --info-soft: #172840; --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1116; --surface: #171a22; --surface-2: #1d212b; --text: #e8eaf0; --muted: #a3aaba; --faint: #747c8e;
  --line: #2a2f3b; --accent: #8b83f5; --accent-soft: #26244a; --accent-text: #0f1116;
  --ok: #4cc79a; --ok-soft: #12302a; --warn: #f0b14e; --warn-soft: #33270f; --bad: #f2716d; --bad-soft: #3a1b1c;
  --info: #79a8f0; --info-soft: #172840; --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.wide-left { grid-template-columns: 2fr 1fr; }

/* Top bar for public pages */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #b05cf0); display: grid; place-items: center; color: #fff; font-size: 14px; }
.topbar nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); text-decoration: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 36px; padding: 0; }
label.field { display: grid; gap: 6px; font-weight: 500; }
label.field > span.hint { font-weight: 400; color: var(--faint); font-size: 12.5px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: auto; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Cards, badges, tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.01em; margin-top: 4px; }
.stat .sub { color: var(--faint); font-size: 12.5px; }
.badge { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--faint); }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; min-width: 80px; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.notice { border-radius: 10px; padding: 10px 14px; background: var(--info-soft); color: var(--info); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.secret { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; word-break: break-all; }

/* App shell (console / admin) */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { padding: 4px 8px 16px; }
.sidebar .group { font-size: 12px; color: var(--faint); padding: 14px 10px 4px; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.sidebar a.nav:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.nav.active { background: var(--accent-soft); color: var(--accent); }
.sidebar .foot { margin-top: auto; padding-top: 12px; }
.main { min-width: 0; }
.main-head { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.main-head h1 { font-size: 18px; margin: 0; white-space: nowrap; }
.main-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.main-body { padding: 24px 28px 48px; max-width: 1240px; }
.menu-toggle { display: none; }

/* Auth screen */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .card { width: min(420px, 100%); padding: 28px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tabs button { flex: 1; border: none; background: none; padding: 7px 10px; border-radius: 7px; font: inherit; color: var(--muted); cursor: pointer; font-weight: 500; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Modal and toast */
.modal-back { position: fixed; inset: 0; background: rgba(10, 12, 20, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.toast-box { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; }
.toast.bad { background: var(--bad); color: #fff; }

/* Charts and media */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.bars > div { flex: 1; background: var(--accent-soft); border-radius: 3px 3px 0 0; position: relative; min-height: 2px; }
.bars > div > i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 3px 3px 0 0; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs figure { margin: 0; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); position: relative; background: var(--surface-2); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs figure button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 20px; padding: 0; }
video.result { width: 100%; max-height: 360px; background: #000; border-radius: 8px; }
img.result { max-width: 100%; border-radius: 8px; }

/* Public pages */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: 40px; letter-spacing: -.02em; }
.hero p { font-size: 16px; color: var(--muted); max-width: 640px; }
.price { font-size: 28px; font-weight: 700; }
.price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.docs { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.docs aside { position: sticky; top: 76px; display: grid; gap: 2px; }
.docs aside a { color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.docs aside a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.docs section { margin-bottom: 36px; }
.docs h2 { padding-top: 8px; }
footer.site { border-top: 1px solid var(--line); color: var(--faint); padding: 24px 20px; text-align: center; font-size: 13px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: 248px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main-head { padding: 12px 16px; gap: 8px; }
  .main-head .right { gap: 6px; }
  .main-head .right > .muted { display: none; }
  .grid.wide-left { grid-template-columns: 1fr; }
  .main-body { padding: 16px; }
  .docs { grid-template-columns: 1fr; }
  .docs aside { position: static; }
  .topbar nav { gap: 12px; }
  .hero h1 { font-size: 30px; }
}
