:root {
  color-scheme: light;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --sidebar: #111827;
  --sidebar-muted: #9ca3af;
  --text: #172033;
  --muted: #667085;
  --line: #e2e7ee;
  --line-strong: #cbd3df;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --success: #087f5b;
  --success-soft: #eaf8f2;
  --warning: #9a6700;
  --warning-soft: #fff7df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 14px 36px rgba(23, 32, 51, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100svh; color: var(--text); background: var(--bg); font-size: 16px; line-height: 1.5; }
button, input, select { font: inherit; }
button { min-height: 44px; border: 0; cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(37, 99, 235, .24); outline-offset: 2px; }
button:active:not(:disabled) { transform: translateY(1px); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
small { color: var(--muted); font-weight: 500; }
.page-root { min-height: 100svh; padding: 16px; }
.eyebrow { margin-bottom: 6px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.login-shell { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(360px, 1.1fr); width: min(920px, 100%); min-height: 540px; margin: max(40px, 8vh) auto; overflow: hidden; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 56px; color: #fff; background: var(--sidebar); }
.login-brand h1 { max-width: 320px; margin-bottom: 18px; font-size: clamp(34px, 4vw, 48px); letter-spacing: -.04em; }
.login-brand p { max-width: 340px; margin-bottom: 36px; color: #c8d0dc; }
.brand-code { margin-bottom: 28px; color: #93c5fd; font-size: 13px; font-weight: 800; letter-spacing: .16em; }
.login-status, .service-status { display: inline-flex; align-items: center; gap: 9px; width: max-content; font-size: 14px; font-weight: 700; }
.login-status span, .service-status span { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .14); }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 56px clamp(32px, 6vw, 72px); }
.login-heading { margin-bottom: 30px; }
.login-heading h2 { margin-bottom: 10px; font-size: 30px; letter-spacing: -.025em; }
.login-heading > p:last-child { margin-bottom: 0; color: var(--muted); }

form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; color: #344054; font-size: 14px; font-weight: 700; }
.field small { margin-top: -3px; font-size: 12px; }
input, select { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); transition: border-color .16s ease, box-shadow .16s ease; }
input:hover, select:hover { border-color: #98a2b3; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); outline: none; }
input::placeholder { color: #98a2b3; }
.primary-action, .check-submit, .form-actions > button:first-child { padding: 11px 18px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; transition: background-color .16s ease, transform .08s ease; }
.primary-action:hover, .check-submit:hover, .form-actions > button:first-child:hover { background: var(--accent-dark); }
.secondary { padding: 9px 15px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: #344054; font-weight: 700; }
.secondary:hover { border-color: #98a2b3; background: var(--surface-muted); }
.api-doc-link { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; white-space: nowrap; }
.danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.error { min-height: 24px; margin: 12px 0 0; color: var(--danger); font-size: 14px; font-weight: 650; }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); width: min(1440px, 100%); min-height: calc(100svh - 32px); margin: 0 auto; overflow: hidden; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.sidebar { display: flex; flex-direction: column; min-width: 0; padding: 28px 20px 20px; background: var(--sidebar); color: #fff; }
.product-lockup { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.product-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--accent); font-size: 20px; font-weight: 900; }
.product-lockup strong, .product-lockup small { display: block; }
.product-lockup strong { font-size: 17px; letter-spacing: -.01em; }
.product-lockup small { margin-top: 1px; color: var(--sidebar-muted); font-size: 12px; }
.side-nav { display: grid; gap: 6px; }
.nav-item { display: grid; grid-template-columns: 28px 1fr; gap: 6px; width: 100%; padding: 11px 12px; border-radius: 9px; background: transparent; color: #d1d5db; text-align: left; transition: background-color .16s ease, color .16s ease; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: #fff; color: var(--text); }
.nav-item > span:last-child { font-weight: 750; }
.nav-item small { display: block; margin-top: 2px; color: inherit; font-size: 11px; font-weight: 500; opacity: .65; }
.nav-index { padding-top: 1px; color: #60a5fa; font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.user-panel { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; margin-top: auto; padding: 18px 8px 2px; border-top: 1px solid rgba(255, 255, 255, .11); }
.user-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #293548; color: #bfdbfe; font-weight: 800; }
.user-panel strong, .user-panel small { display: block; }
.user-panel small { color: var(--sidebar-muted); font-size: 11px; }
.text-button { min-height: 36px; padding: 6px 8px; background: transparent; color: #aeb8c7; font-size: 13px; }
.text-button:hover { color: #fff; }

.workspace { min-width: 0; background: var(--bg); }
.workspace-header { display: flex; align-items: center; justify-content: space-between; min-height: 94px; padding: 22px 34px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .88); }
.workspace-header h1 { margin-bottom: 0; font-size: 27px; letter-spacing: -.03em; }
.workspace-header .eyebrow { margin-bottom: 3px; }
.service-status { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: #344054; }
.workspace-content { padding: 30px 34px 40px; }
.surface { min-height: 430px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin-bottom: 6px; font-size: 23px; letter-spacing: -.025em; }
.section-heading > div > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 15px; }
.count-label { flex: 0 0 auto; padding: 7px 11px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 13px; font-weight: 750; }

.check-form { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(130px, .7fr) minmax(180px, 1fr) auto; align-items: end; gap: 14px; padding: 28px; }
.check-submit { min-width: 126px; }
.empty-state { display: grid; place-items: center; align-content: center; min-height: 230px; margin: 0 28px 28px; padding: 34px; border: 1px dashed var(--line-strong); border-radius: 11px; background: var(--surface-muted); text-align: center; }
.empty-state strong { margin-bottom: 4px; font-size: 17px; }
.empty-state span { max-width: 460px; color: var(--muted); font-size: 14px; }
.result-panel { margin: 0 28px 28px; border: 1px solid var(--line); border-radius: 11px; }
.result-summary { display: flex; align-items: center; gap: 14px; padding: 20px; border-bottom: 1px solid var(--line); }
.result-summary strong { display: block; font-size: 18px; }
.result-summary p { margin: 3px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.status-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; padding: 5px 9px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.status-badge.success { background: var(--success-soft); color: var(--success); }
.status-badge.warning { background: var(--warning-soft); color: var(--warning); }
.status-badge.danger { background: var(--danger-soft); color: var(--danger); }
.status-badge.neutral { background: #eef2f6; color: #596579; }
.result-agents { display: grid; }
.result-agent { display: grid; grid-template-columns: minmax(140px, 1fr) auto minmax(92px, auto); align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.result-agent:last-child { border-bottom: 0; }
.result-agent strong { overflow-wrap: anywhere; }
.result-latency { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
details { border-top: 1px solid var(--line); }
summary { padding: 13px 20px; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 700; }
pre { margin: 0; padding: 18px 20px; overflow-wrap: anywhere; white-space: pre-wrap; background: #111827; color: #d9e2ef; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; line-height: 1.65; }

.agent-layout { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(440px, 1.45fr); }
.form-section { padding: 26px 28px; border-right: 1px solid var(--line); background: var(--surface-muted); }
.form-section h3, .list-heading h3 { margin-bottom: 0; font-size: 17px; }
.stacked-form { margin-top: 20px; }
.switch-row { display: flex; align-items: center; gap: 10px; width: max-content; color: #344054; font-size: 14px; font-weight: 700; cursor: pointer; }
.switch-row input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 9px; }
.form-actions button { flex: 1; }
.list-section { min-width: 0; padding: 26px 28px; }
.list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.list-heading > span { color: var(--muted); font-size: 13px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: var(--surface-muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
td { color: #344054; font-size: 15px; }
tbody tr:hover { background: #fafbfc; }
td.url-cell { max-width: 250px; overflow-wrap: anywhere; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.actions-column { text-align: right; }
.action-group { display: flex; justify-content: flex-end; gap: 6px; }
.table-action { min-height: 38px; padding: 7px 10px; border-radius: 7px; background: var(--surface-muted); color: #344054; font-size: 13px; font-weight: 750; }
.table-action:hover { background: #e9edf3; }
.empty-row { padding: 38px 12px; color: var(--muted); text-align: center; }
.history-table { padding: 0 28px; margin-top: 24px; }
.history-table td { font-variant-numeric: tabular-nums; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 20px 28px 26px; }
.pagination span { color: var(--muted); font-size: 14px; }
.detail-panel { margin: 0 28px 28px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.detail-panel .list-heading { margin: 0; padding: 16px 18px; border-bottom: 1px solid var(--line); }

@media (max-width: 1080px) {
  .check-form { grid-template-columns: 1fr 140px; }
  .check-ip-field { grid-column: 1 / -1; }
  .check-submit { min-width: 0; }
  .agent-layout { grid-template-columns: 1fr; }
  .form-section { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 860px) {
  .page-root { padding: 0; }
  .login-shell { min-height: 100svh; margin: 0; border-radius: 0; box-shadow: none; }
  .app-shell { grid-template-columns: 1fr; min-height: 100svh; border-radius: 0; box-shadow: none; }
  .sidebar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 14px 18px; }
  .product-lockup { padding: 0; }
  .product-lockup small { display: none; }
  .side-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-item { display: block; padding: 9px 10px; text-align: center; }
  .nav-index, .nav-item small { display: none; }
  .user-panel { grid-template-columns: auto auto; gap: 8px; margin: 0; padding: 0; border: 0; }
  .user-avatar, .user-panel > div { display: none; }
  .workspace-header { min-height: 84px; padding: 18px 22px; }
  .workspace-content { padding: 22px; }
}

@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 32px 28px; }
  .login-brand h1 { margin-bottom: 10px; font-size: 34px; }
  .login-brand p { margin-bottom: 18px; }
  .brand-code { margin-bottom: 16px; }
  .login-card { padding: 34px 28px; }
  .section-heading { align-items: flex-start; padding: 22px; }
  .section-heading > div > p:last-child { font-size: 14px; }
  .check-form { grid-template-columns: 1fr; padding: 22px; }
  .check-ip-field { grid-column: auto; }
  .empty-state, .result-panel, .detail-panel { margin-right: 22px; margin-left: 22px; }
  .form-section, .list-section { padding: 22px; }
  .history-table { padding: 0 22px; }
  .pagination { justify-content: space-between; padding: 18px 22px 22px; }
}

@media (max-width: 560px) {
  .sidebar { grid-template-columns: 1fr auto; gap: 10px; padding: 12px; }
  .product-lockup { display: none; }
  .side-nav { min-width: 0; gap: 4px; }
  .nav-item { min-width: 0; min-height: 42px; padding: 8px 4px; font-size: 13px; white-space: nowrap; }
  .workspace-header { min-height: 76px; padding: 16px; }
  .workspace-header h1 { font-size: 23px; }
  .service-status { padding: 6px 9px; font-size: 12px; }
  .workspace-content { padding: 14px; }
  .surface { border-radius: 10px; }
  .section-heading { display: block; padding: 18px; }
  .api-doc-link { margin-top: 14px; }
  .count-label { display: inline-block; margin-top: 12px; }
  .check-form, .form-section, .list-section { padding: 18px; }
  .empty-state, .result-panel, .detail-panel { margin-right: 18px; margin-left: 18px; }
  .result-agent { grid-template-columns: 1fr auto; }
  .result-latency { grid-column: 1 / -1; text-align: left; }
  .list-heading { display: block; }
  .list-heading > span { display: block; margin-top: 4px; }
  .history-table { padding: 0 18px; }
  .pagination { padding: 16px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
