:root {
  --page: #f2f5f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #17233a;
  --muted: #60708a;
  --border: #dbe3ee;
  --line: #e9eef5;
  --blue: #2563d9;
  --blue-dark: #17499f;
  --blue-soft: #eaf1ff;
  --green: #11775f;
  --red: #bb3948;
  --radius: 10px;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 980px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.shell { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px; }
.auth-panel { width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 42px; box-shadow: 0 20px 60px rgba(31, 56, 95, .10); }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--blue); color: white; font-weight: 700; letter-spacing: .04em; }
.eyebrow { font-size: 12px; color: var(--blue); font-weight: 700; letter-spacing: .08em; margin: 24px 0 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; margin-bottom: 10px; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 14px; margin: 0; }
.muted, .form-hint, .subtle { color: var(--muted); }
.form-hint { min-height: 20px; margin: 16px 0 0; font-size: 13px; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 650; color: #35435c; }
input, select, textarea { width: 100%; min-height: 38px; border: 1px solid var(--border); border-radius: 8px; background: white; padding: 8px 10px; color: var(--ink); outline: none; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 217, .12); }
button { min-height: 36px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: #2b3c58; padding: 0 13px; font-weight: 650; }
button:hover:not(:disabled) { border-color: #aebed4; background: var(--surface-soft); }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.danger { border-color: #efc7cd; color: var(--red); }
.quiet { background: transparent; }

.topbar { height: 68px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 34px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.brand-name { font-size: 16px; font-weight: 750; }
.brand-note { color: var(--muted); font-size: 12px; margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22a879; box-shadow: 0 0 0 4px #e4f6ef; }
.layout { max-width: 1440px; margin: 0 auto; padding: 28px 34px 48px; }
.overview { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 24px; }
.overview h1 { margin: 3px 0 5px; font-size: 26px; }
.overview p { margin-bottom: 0; }
.metric-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(105px, 1fr); gap: 10px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; }
.metric .value { display: block; font-size: 20px; font-weight: 750; color: var(--blue-dark); }
.metric .label { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .72fr); gap: 18px; align-items: start; }
.column { display: grid; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.panel-body { padding: 17px 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.field-hint { display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-top: -2px; }
.row { display: flex; gap: 9px; align-items: center; }
.row > * { min-width: 0; }
.row .grow { flex: 1; }
.list { display: grid; }
.list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.item-title { font-size: 14px; font-weight: 720; overflow-wrap: anywhere; }
.item-meta { color: var(--muted); font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 99px; padding: 3px 8px; font-size: 11px; font-weight: 700; background: #eef3fb; color: #4c5d78; }
.badge.gpt { background: #eaf1ff; color: #245bbd; }
.badge.claude { background: #f0edff; color: #5b48a5; }
.badge.good { background: #e7f7ef; color: var(--green); }
.badge.warning { background: #fff4dc; color: #a05a00; }
.badge.disabled { background: #f6ebed; color: var(--red); }
.route-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.route-token { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 99px; padding: 3px 8px; color: #4a5b75; background: var(--surface-soft); font-size: 11px; }
.route-token.good { border-color: #bee7d4; background: #f1fbf6; color: var(--green); }
.route-token.warning { border-color: #f1d59b; background: #fff9ec; color: #a05a00; }
.route-token.disabled { border-color: #edc9cf; background: #fff5f6; color: var(--red); }
.route-error { color: var(--red); }
.item-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 7px; }
.item-actions button { min-height: 30px; padding: 0 9px; font-size: 12px; }
.empty { padding: 24px 18px; color: var(--muted); font-size: 13px; }
.key-reveal { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; background: #f5f8fe; border: 1px solid #cddcf6; padding: 11px; border-radius: 8px; }
.key-reveal code { overflow-wrap: anywhere; color: #173e84; font-size: 12px; }
.note { padding: 10px 12px; border-radius: 8px; border: 1px solid #dbe7fb; background: #f5f8ff; color: #435470; font-size: 12px; line-height: 1.5; }
.log-list { max-height: 490px; overflow: auto; }
.log-item { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.log-item:last-child { border-bottom: 0; }
.log-at { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-main { overflow-wrap: anywhere; }
.log-type { font-weight: 700; color: #374967; }
.toast { position: fixed; top: 22px; right: 24px; z-index: 10; max-width: 460px; padding: 13px 16px; background: #1d365f; color: white; border-radius: 9px; box-shadow: 0 16px 36px rgba(22, 42, 77, .24); font-size: 13px; }
.toast.error { background: #a63141; }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(17, 31, 54, .30); display: grid; place-items: center; z-index: 20; }
.dialog { width: min(560px, calc(100vw - 48px)); background: white; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 22px 70px rgba(20, 35, 61, .25); }
.dialog .panel-body { display: grid; gap: 14px; }
.dialog-footer { display: flex; justify-content: end; gap: 8px; padding: 15px 18px; border-top: 1px solid var(--line); }
.hidden { display: none !important; }

/* Gateway console: a compact control surface, not a marketing dashboard. */
.topnav { display: flex; align-items: stretch; gap: 22px; height: 100%; margin-left: 42px; margin-right: auto; color: var(--muted); font-size: 13px; }
.topnav span { display: grid; place-items: center; border-bottom: 2px solid transparent; }
.topnav .active { color: var(--ink); font-weight: 750; border-bottom-color: var(--blue); }
.console { max-width: 1540px; margin: 0 auto; padding: 34px 36px 52px; }
.console-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; padding: 4px 0 26px; }
.console-heading .eyebrow { margin: 0 0 6px; }
.console-heading h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: 0; }
.console-heading .muted { max-width: 710px; line-height: 1.65; }
.console-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .39fr); gap: 20px; align-items: start; }
.workbench, .side-stack { display: grid; gap: 20px; min-width: 0; }
.section-heading { display: flex; align-items: flex-start; gap: 11px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.section-heading h2 { font-size: 17px; line-height: 1.3; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.section-number { display: grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; border: 1px solid #cbd7ea; border-radius: 9px; color: #45618f; background: #f5f8ff; font-size: 11px; font-weight: 800; }
.section-actions { margin-left: auto; display: flex; gap: 8px; }
.channel-toolbar { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fbfcfe; }
.filter-tabs { display: flex; gap: 6px; }
.toolbar-fields { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.group-filter { display: flex; align-items: center; gap: 7px; min-width: 158px; color: var(--muted); font-size: 12px; font-weight: 650; }
.group-filter select { min-height: 34px; padding-top: 0; padding-bottom: 0; }
.filter-tab { min-height: 32px; border-radius: 8px; padding: 0 11px; font-size: 12px; }
.filter-tab span { display: inline-grid; place-items: center; min-width: 17px; height: 17px; border-radius: 99px; margin-left: 4px; background: #e8eef9; color: #5a6f92; font-size: 10px; }
.filter-tab.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.filter-tab.active span { background: rgba(255,255,255,.18); color: #fff; }
.search-field { width: min(390px, 45%); display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.search-field input { min-height: 34px; }
.table-wrap { overflow: auto; }
.channel-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 1040px; }
.channel-table th { padding: 12px 14px; background: #fbfcfe; border-bottom: 1px solid var(--line); color: #71809a; text-align: left; font-size: 11px; font-weight: 750; white-space: nowrap; }
.channel-table td { vertical-align: top; padding: 15px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.channel-table th:nth-child(1) { width: 22%; }.channel-table th:nth-child(2) { width: 23%; }.channel-table th:nth-child(3) { width: 16%; }.channel-table th:nth-child(4) { width: 12%; }.channel-table th:nth-child(5) { width: 12%; }.channel-table th:nth-child(6) { width: 15%; }
.channel-table tbody tr:hover { background: #fafcff; }
.channel-name { display: flex; gap: 9px; min-width: 0; }
.channel-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.channel-name small, .channel-table td > small { display: block; margin-top: 5px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.group-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.group-token { display: inline-flex; align-items: center; min-height: 19px; padding: 1px 7px; border: 1px solid #d6e1f4; border-radius: 999px; background: #f4f7fd; color: #49658d; font-size: 10px; font-weight: 700; }
.kind-mark { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 auto; border-radius: 8px; font-size: 11px; font-weight: 800; }
.kind-mark.gpt { color: #1f5db9; background: #e8f0ff; }.kind-mark.claude { color: #6454a4; background: #f0edff; }
.table-routes { margin: 0; max-width: 100%; }
.table-routes .route-token { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-value { display: inline-flex; min-width: 29px; min-height: 22px; justify-content: center; align-items: center; padding: 0 6px; margin-right: 4px; border-radius: 7px; background: #f1f5fb; color: #456184; font-size: 11px; font-weight: 750; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.table-actions button { min-height: 30px; padding: 0 8px; font-size: 11px; }
.table-error { color: var(--red) !important; }
.key-panel .section-heading, .call-panel .section-heading, .activity-panel .section-heading { padding: 16px 17px; }
.key-panel .panel-body, .call-panel .panel-body, .activity-panel .panel-body { padding: 15px 17px; }
.key-create { display: flex; gap: 8px; }.key-create .grow { min-width: 0; flex: 1; }
.request-box { display: grid; gap: 7px; padding: 13px; border: 1px solid #d9e3f5; border-radius: 9px; background: #f5f8ff; color: #466083; font-size: 12px; line-height: 1.5; }
.request-box code { color: #1e4f9c; font-size: 12px; font-weight: 750; }
.activity-panel .log-list { max-height: 444px; }
.drawer-layer { position: fixed; inset: 0; z-index: 30; display: flex; justify-content: flex-end; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(21, 35, 58, .30); }
.drawer { position: relative; z-index: 1; width: min(680px, 92vw); height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #fff; box-shadow: -22px 0 70px rgba(20, 38, 70, .22); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 26px 28px 19px; border-bottom: 1px solid var(--line); }
.drawer-head .eyebrow { margin: 0 0 7px; }.drawer-head h2 { font-size: 23px; }.drawer-head p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 34px; min-height: 34px; padding: 0; border-radius: 10px; font-size: 22px; font-weight: 400; }
.drawer-body { overflow: auto; padding: 8px 28px 26px; }
.drawer-section { padding: 20px 0; border-bottom: 1px solid var(--line); }.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 { font-size: 15px; }.drawer-section > p { margin: 5px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.model-picker { display: grid; gap: 12px; }
.model-catalog { border: 1px solid #dce5f4; border-radius: 10px; overflow: hidden; background: #fbfcff; }
.catalog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 13px; border-bottom: 1px solid #e3eaf6; background: #f5f8fe; }
.catalog-heading strong, .catalog-heading small { display: block; }.catalog-heading strong { font-size: 13px; color: #243c63; }.catalog-heading small, .catalog-heading span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.model-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.model-choice, .group-choice { display: flex; gap: 8px; align-items: flex-start; min-width: 0; padding: 9px 10px; border: 1px solid #dce4f0; border-radius: 9px; background: #fff; cursor: pointer; }
.model-choice:hover, .group-choice:hover { border-color: #a9c4ef; }.model-choice.selected, .group-choice.selected { border-color: #77a3e6; background: #eef5ff; box-shadow: inset 0 0 0 1px rgba(66, 117, 203, .08); }
.model-choice input, .group-choice input { width: 16px; min-height: 16px; margin: 1px 0 0; flex: 0 0 auto; }.model-choice span { min-width: 0; }.model-choice strong, .model-choice small { display: block; overflow-wrap: anywhere; }.model-choice strong { color: #253c60; font-size: 12px; }.model-choice small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.group-choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }.group-choice { align-items: center; padding: 7px 9px; font-size: 12px; color: #314968; }.new-group-field { display: block; margin-top: 11px; }
.proxy-check-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 11px; padding: 10px 11px; border: 1px solid #d7e5f8; border-radius: 9px; background: #f7faff; color: #4b6385; font-size: 12px; }.proxy-check-card strong, .proxy-check-card span { display: block; }.proxy-check-card span { margin-top: 3px; color: var(--muted); font-size: 11px; }.proxy-check-card button { min-height: 32px; flex: 0 0 auto; font-size: 11px; }
.mapping-note { display: grid; gap: 3px; margin-top: 9px; padding: 10px 11px; border: 1px solid #d9e4f6; border-radius: 9px; background: #f6f9ff; color: #4e6488; font-size: 12px; line-height: 1.5; }
.toggle-row { display: flex; align-items: center; grid-auto-flow: column; grid-template-columns: auto 1fr; gap: 10px; padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: #fbfcfe; }
.toggle-row input { width: 18px; min-height: 18px; }.toggle-row small { display: block; margin-top: 2px; color: var(--muted); font-weight: 500; }
.drawer-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 28px; border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 1180px) { .console { padding-inline: 24px; }.console-grid { grid-template-columns: 1fr; }.side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }.activity-panel { grid-column: 1 / -1; } }
@media (max-width: 760px) { .channel-toolbar, .toolbar-fields { align-items: stretch; flex-direction: column; }.search-field, .group-filter { width: 100%; }.model-choice-grid { grid-template-columns: 1fr; }.proxy-check-card { align-items: flex-start; flex-direction: column; } }
