:root {
  color-scheme: light;
  --background: #f5f5f6;
  --panel: #ffffff;
  --sidebar: #202022;
  --sidebar-text: #f4f4f5;
  --sidebar-muted: #b5b5bd;
  --sidebar-border: #37373a;
  --text: #242428;
  --muted: #5d5e68;
  --quiet: #646571;
  --line: #e5e5e8;
  --accent: #3853dc;
  --accent-dark: #2c42b5;
  --accent-soft: #edf0ff;
  --green: #13714c;
  --green-soft: #e8f7ee;
  --amber: #8b5011;
  --amber-soft: #fff5df;
  --danger: #a53140;
  --danger-soft: #fceff0;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 3%);
  font-family: Geist, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-150%); z-index: 10; background: var(--panel); border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.icon { width: 18px; height: 18px; stroke-width: 1.7; vertical-align: middle; flex: 0 0 auto; }
.icon-button { border: 0; border-radius: 7px; background: transparent; color: var(--muted); width: 34px; height: 34px; display: inline-grid; place-items: center; }
.icon-button:hover { background: #edf0f6; color: var(--text); }

.workspace { display: grid; min-height: 100vh; grid-template-columns: 214px minmax(0, 1fr); align-items: start; }
.sidebar { position: sticky; top: 0; height: 100dvh; min-height: 420px; display: flex; flex-direction: column; padding: 18px 12px 12px; border-right: 1px solid #28282b; background: var(--sidebar); color: var(--sidebar-text); }
.brand { display: flex; align-items: center; gap: 10px; padding: 3px 8px 14px; color: var(--sidebar-text); border-bottom: 1px solid var(--sidebar-border); }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: #f2f2f3; color: #252527; font-weight: 750; font-size: 17px; line-height: 1; }
.brand strong, .brand small, .profile strong, .profile small { display: block; }
.brand strong { font-size: 13px; font-weight: 750; letter-spacing: .13em; }
.brand small { margin-top: 3px; color: var(--sidebar-muted); font-size: 11px; }
#navigation { margin-top: 19px; overflow: auto; }
.nav-group + .nav-group { margin-top: 21px; }
.nav-label { display: block; margin: 0 0 6px 9px; color: var(--sidebar-muted); font-size: 11px; font-weight: 590; }
.nav-link { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 37px; padding: 8px 9px; margin: 2px 0; border-radius: 6px; color: var(--sidebar-text); font-size: 13px; font-weight: 540; text-decoration: none; }
.nav-link .icon { width: 16px; height: 16px; color: var(--sidebar-muted); }
.nav-link:hover { color: var(--sidebar-text); background: #303034; text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent); color: white; font-weight: 680; }
.nav-link[aria-current="page"] .icon { color: white; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--sidebar-border); padding: 11px 2px 0; }
.sidebar-footer:has(.profile[hidden]) { border: 0; }
.profile { display: flex; align-items: center; gap: 9px; padding: 5px 5px 8px; }
.profile-mark { flex: 0 0 29px; height: 29px; display: grid; place-items: center; background: #38383d; border-radius: 7px; color: var(--sidebar-text); font-size: 12px; font-weight: 700; }
.profile strong { font-size: 12px; font-weight: 670; }
.profile small { color: var(--sidebar-muted); margin-top: 2px; font-size: 11px; }
.profile button { margin-left: auto; }
.profile .icon-button { color: var(--sidebar-muted); }
.profile .icon-button:hover { color: var(--sidebar-text); background: #303034; }

.shell { min-width: 0; }
.topbar { min-height: 57px; padding: 9px clamp(18px, 2.7vw, 38px); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.breadcrumbs, .topbar-actions { display: flex; align-items: center; gap: 13px; min-width: 0; }
.breadcrumbs { color: var(--muted); font-size: 12px; }
.breadcrumbs strong { color: var(--text); font-weight: 650; white-space: nowrap; }
.breadcrumb-divider { color: #81899a; }
.tag i, .legend-dot { display: inline-block; width: 6px; height: 6px; background: currentColor; border-radius: 50%; margin-right: 6px; vertical-align: 2px; }
.menu-toggle { display: none; }

.content { max-width: 1680px; margin: 0 auto; padding: 24px clamp(18px, 2.7vw, 38px) 38px; }
.page-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
h1, h2, h3, p { margin: 0; }
.page-head h1 { font-size: clamp(22px, 2.2vw, 29px); letter-spacing: -.025em; line-height: 1.22; font-weight: 700; }
.button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; border: 1px solid transparent; border-radius: 8px; font-weight: 660; font-size: 12px; line-height: 1.4; white-space: nowrap; text-decoration: none; transition: background-color .15s, border-color .15s; }
.button .icon { width: 16px; height: 16px; }
.button:hover { text-decoration: none; }
.button.primary { color: white; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.secondary { color: var(--text); background: var(--panel); border-color: #dfe3eb; box-shadow: var(--shadow); }
.button.secondary:hover { background: #f8f8fd; border-color: #c9c7e1; }
.button.quiet { color: var(--accent-dark); border-color: transparent; background: transparent; padding-inline: 5px; }
.button.quiet:hover { text-decoration: underline; }
.button.compact { min-height: 34px; }

.filters { display: flex; align-items: center; gap: 12px; margin: 0 0 15px; padding: 9px 12px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); }
.filters label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.filters label span { color: var(--muted); font-size: 12px; white-space: nowrap; }
select, input, textarea { border: 1px solid #dbe0ea; border-radius: 8px; color: var(--text); background: var(--panel); }
select { padding: 7px 25px 7px 9px; line-height: 1.35; min-height: 34px; width: 100%; }
.filters select { min-width: 92px; max-width: min(290px, 32vw); text-overflow: ellipsis; }
.filters-note { margin: auto 0 auto auto; color: var(--quiet); font-size: 11px; text-align: right; line-height: 1.4; }
.notice { padding: 10px 13px; margin: 0 0 16px; border-radius: 8px; border: 1px solid #f2e4bd; color: var(--amber); background: var(--amber-soft); line-height: 1.5; }
.notice.error { border-color: #eed5dc; color: var(--danger); background: var(--danger-soft); }
.standalone { padding: 30px 0; color: var(--muted); }

.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 15px; }
.metric { min-width: 0; padding: 15px 16px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-icon { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 6px; background: #f2f2f4; color: #565763; }
.metric-icon .icon { width: 15px; height: 15px; }
.metric-value { margin-top: 11px; color: var(--text); font-size: clamp(22px, 2vw, 30px); font-weight: 730; letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric-value.multiple { font-size: clamp(17px, 1.45vw, 22px); line-height: 1.24; }
.metric-caption { min-height: 15px; margin-top: 6px; color: var(--quiet); font-size: 11px; line-height: 1.4; }
.number { font-variant-numeric: tabular-nums; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(230px, 1fr); gap: 14px; margin-bottom: 15px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px 13px; }
.panel-head h2 { font-size: 15px; line-height: 1.4; letter-spacing: -.015em; font-weight: 700; }
.panel-head p { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.panel-head select { width: auto; min-height: 30px; font-size: 12px; }
.chart { display: grid; align-items: center; min-height: 235px; padding: 0 12px 10px 10px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--quiet); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: #bcc8f6; }
.chart .bar:hover, .chart .bar.is-current { fill: var(--accent); }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.legend-dot { background: var(--accent); margin-right: 0; }

.connections { padding: 0 15px 14px; }
.connection { display: flex; align-items: center; gap: 8px; padding: 11px 0; min-height: 49px; }
.connection + .connection { border-top: 1px solid var(--line); }
.connection-mark { display: grid; place-items: center; flex: 0 0 27px; height: 27px; background: #edf1f7; color: #43516a; border-radius: 7px; }
.connection-mark .icon { width: 15px; height: 15px; }
.connection strong { display: block; font-size: 12px; font-weight: 665; }
.connection small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.connection .tag { margin-left: auto; flex: 0 0 auto; }
.tag { display: inline-flex; align-items: center; white-space: nowrap; max-width: 100%; gap: 3px; padding: 4px 6px; min-height: 21px; border-radius: 5px; color: #49566a; background: #edf0f4; font-size: 10px; font-weight: 670; }
.tag i { width: 5px; height: 5px; margin-right: 2px; }
.tag.good { color: var(--green); background: var(--green-soft); }
.tag.warn { color: var(--amber); background: var(--amber-soft); }
.tag.error { color: var(--danger); background: var(--danger-soft); }
.tag.info { color: var(--accent-dark); background: var(--accent-soft); }

.table-wrap { overflow: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; white-space: nowrap; }
thead { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f9fafc; color: var(--muted); }
th { font-weight: 620; }
th, td { padding: 11px 13px; min-height: 37px; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tbody tr + tr { border-top: 1px solid var(--line); }
tbody tr:hover { background: #fbfbfe; }
td .muted, .muted { color: var(--muted); }
.cell-label { display: block; font-weight: 650; }
.cell-note { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.text-link { background: transparent; border: 0; padding: 0; color: var(--accent-dark); font-weight: 650; text-align: left; }
.text-link:hover { text-decoration: underline; }
.table-foot { padding: 10px 16px 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.search-form { display: flex; align-items: center; gap: 6px; }
.search-form input { padding: 8px 9px; min-height: 37px; min-width: 0; width: min(190px, 28vw); }
.cell-label .icon { width: 13px; height: 13px; }
.right { text-align: right; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.66; }
.empty strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 3px; }
.empty .button { margin: 11px auto 0; }
.stacked { display: grid; gap: 14px; }
.button-group { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.section-note { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0 0 13px; }
.editor-inner { padding: 22px; }
dialog { border: 1px solid var(--line); padding: 0; width: min(560px, calc(100% - 28px)); max-height: calc(100dvh - 36px); border-radius: 14px; color: var(--text); background: var(--panel); box-shadow: 0 22px 78px rgb(22 24 48 / 20%); }
dialog::backdrop { background: rgb(21 29 46 / 36%); }
.editor-inner header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 13px; }
.editor-inner h2 { font-size: 19px; letter-spacing: -.025em; }
.form { display: grid; gap: 11px; }
.form label { display: grid; gap: 5px; color: var(--text); font-size: 12px; font-weight: 620; min-width: 0; }
.form input, .form textarea, .form select { width: 100%; min-width: 0; padding: 9px 10px; min-height: 38px; font-weight: 430; }
.form input::placeholder { color: #717c90; }
.form label small { font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.5; }
.form fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.form legend { font-size: 12px; color: var(--muted); padding-inline: 4px; }
.form-error { min-height: 14px; color: var(--danger); line-height: 1.45; font-size: 12px; }
#toast { position: fixed; bottom: 18px; right: 18px; z-index: 8; max-width: calc(100% - 36px); padding: 10px 13px; border-radius: 9px; color: white; background: #27272a; font-weight: 580; box-shadow: 0 7px 25px rgb(0 0 0 / 16%); }
.auth-card { width: min(420px,100%); padding: 22px; margin: 20px auto 0; }
.auth-card h2 { font-size: 18px; margin-bottom: 9px; }
.auth-card p { margin-bottom: 12px; }
.auth-card > p:last-child { margin-top: 12px; margin-bottom: 0; }
.auth-card .button { justify-self: end; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 196px minmax(0, 1fr); }
  .overview-grid { grid-template-columns: minmax(0, 1.8fr) minmax(214px, 1fr); }
  .metrics { gap: 9px; }
  .metric { padding: 12px 10px; }
}
@media (max-width: 780px) {
  .workspace { grid-template-columns: minmax(0,1fr); }
  .sidebar { display: none; position: fixed; z-index: 5; inset: 0 auto 0 0; width: 220px; box-shadow: 0 0 0 100vmax rgb(21 29 46 / 31%); min-height: 0; }
  .sidebar.is-open { display: flex; }
  .menu-toggle { display: grid; margin-left: -6px; }
  .breadcrumbs, .topbar-actions { gap: 7px; }
  .overview-grid { grid-template-columns: minmax(0,1fr); }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .metric { padding: 12px; }
  .filters { flex-wrap: wrap; align-items: start; }
  .filters label { flex: 1 1 135px; }
  .filters select { width: 100%; max-width: none; }
  .filters-note { flex: 1 0 100%; text-align: left; margin-top: 1px; }
  .chart { min-height: 170px; }
}
@media (max-width: 440px) {
  .topbar, .content { padding-inline: 13px; }
  .breadcrumb-root, .breadcrumb-divider { display: none; }
  .page-head { align-items: flex-start; }
  .page-head button .button-text { display: none; }
  .panel-head { align-items: start; }
  .editor-inner { padding: 15px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
