:root {
  font: 15px/1.55 Inter, "PingFang SC", "Microsoft Yahei", system-ui, sans-serif;
  color: #16273b;
  background: #f3f6fa;
  --muted: #516477;
  --line: #dbe3ec;
  --blue: #2059c5;
  --nav: #111e32;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 34px); font-weight: 760; letter-spacing: -.035em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; margin: 15px 0 8px; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea {
  border: 1px solid #bdcad8;
  border-radius: 8px;
  color: inherit;
  background: #fff;
  padding: 8px 12px;
  min-height: 38px;
}
input[type=date] { min-width: 138px; }
label { font-size: 13px; font-weight: 650; color: var(--muted); display: grid; gap: 5px; }
button { cursor: pointer; font-weight: 650; white-space: nowrap; }
button:hover { background: #edf3ff; }
:focus-visible { outline: 3px solid #5085ee; outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.primary:hover { color: #fff; background: #1648a8; }
.quiet { border-color: transparent; background: transparent; color: inherit; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #111e32; }
.login-card { width: min(420px,100%); padding: 35px; display: grid; gap: 14px; }
.login-card h1 { margin-bottom: 15px; }
#login-error { color: #9d2c29; }
.logo { color: #fff; background: #2673f1; border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 19px; font-weight: 800; }
.workspace { display: grid; grid-template-columns: 210px minmax(0,1fr); min-height: 100vh; }
.sidebar {
  background: var(--nav); color: #e2e9f5; display: flex; flex-direction: column; padding: 22px 14px 16px;
  height: 100vh; position: sticky; top: 0; overflow: auto;
}
.brand, .identity { padding: 0 10px; display: flex; align-items: center; gap: 10px; }
.brand { font-size: 17px; margin-bottom: 28px; }
nav { display: grid; gap: 5px; }
nav button { color: #c1cee2; text-align: left; background: transparent; border: 0; }
nav button:hover, nav button[aria-current=page] { color: #fff; background: #243b5c; }
.identity { margin-top: auto; padding-top: 16px; color: #bfcde4; justify-content: space-between; font-size: 12px; }
.identity span { overflow-wrap: anywhere; }
.identity button:hover { background: #243b5c; }
main { padding: 24px clamp(16px,3vw,42px) 44px; min-width: 0; }
.toolbar, .filters, .pagination, .heading, .dialog-title { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.toolbar { background: #fff; border: 1px solid var(--line); padding: 12px 16px; border-radius: 11px; }
.toolbar label:first-child { flex: 1 1 170px; min-width: 120px; }
.toolbar select { min-width: 0; }
.heading { justify-content: space-between; margin: 26px 0 17px; align-items: center; }
#scope { color: var(--muted); overflow-wrap: anywhere; }
#notice { border-radius: 8px; background: #e5eefc; padding: 10px 14px; margin: 10px 0; }
#notice[data-error=true] { color: #912c2b; background: #fdebea; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 15px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 15px 17px; text-align: left; color: var(--muted); white-space: normal; }
.metric strong { display: block; color: #152a45; font-size: clamp(20px,3vw,30px); line-height: 1.2; margin-top: 7px; font-variant-numeric: tabular-nums; }
.charts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 15px; }
.chart { padding: 16px; }
.chart canvas { display: block; width: 100%; height: 180px; margin-top: 12px; }
.legend { display: flex; gap: 15px; margin-top: 6px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.legend b { font-size: 16px; margin-right: 4px; }
.legend span:nth-child(1) b { color: #245bd0; }
.legend span:nth-child(2) b { color: #168673; }
.legend span:nth-child(3) b { color: #995e16; }
.panel { padding: 16px; margin-bottom: 13px; }
.filters { padding: 14px; align-items: center; }
.filters #query { min-width: 100px; flex: 1 1 210px; }
.filters #version { width: 110px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; color: #263a51; font-size: 13px; }
th, td { border-bottom: 1px solid #e5ebf3; padding: 11px 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { background: #edf2f8; color: #3f556e; }
td button { font-size: inherit; min-height: 0; padding: 0 1px; border: 0; color: var(--blue); background: transparent; }
td button:hover { text-decoration: underline; }
.pagination { justify-content: end; padding: 13px; align-items: center; }
.empty { padding: 24px 16px; color: var(--muted); }
dialog { width: min(92vw,880px); max-height: 88vh; border: 1px solid var(--line); border-radius: 14px; color: inherit; padding: 20px; }
dialog::backdrop { background: #142238a0; }
.dialog-title { justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dialog-form { display: grid; gap: 11px; max-width: 550px; }
.dialog-form textarea { min-height: 80px; width: 100%; }
.dialog-form button { justify-self: start; }
.dialog-form p { color: #912c2b; }
dl { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 5px 16px; margin: 0 0 16px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.badge { border-radius: 15px; color: #1c5e51; background: #dff4ec; padding: 3px 9px; }
@media (max-width: 940px) {
  .workspace { grid-template-columns: 156px minmax(0,1fr); }
  .metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 650px) {
  .workspace { display: block; }
  .sidebar { height: auto; position: static; padding: 10px; }
  nav { display: flex; overflow: auto; }
  .brand { display: none; }
  .identity { padding-top: 4px; }
  main { padding: 12px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .charts { grid-template-columns: 1fr; }
}
.feature-actions { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
#report-summary { padding:13px 14px 4px; }
#report-summary h2 { margin:0 0 9px; }
#report-summary .metric { background:#f5f8fd; }
#report-summary .metrics { grid-template-columns:repeat(auto-fit,minmax(125px,1fr)); }
.feature-form { display:grid; gap:14px; }
.config-items { display:grid; grid-template-columns:repeat(auto-fit,minmax(102px,1fr)); gap:8px; }
.config-items label input { width:100%; }
.feature-form textarea { width:100%; min-height:74px; }
.feature-form button { justify-self:start; }
.feature-message { color:var(--muted); margin:4px 0 10px; }
.grant { padding:10px 12px; border:1px solid var(--line); border-radius:10px; margin-bottom:9px; }
.inline-note { color:#a53637; }
.catalog-grid input[type=text] { width:min(38vw,400px); min-width:200px; }
.catalog-grid input[type=number] { width:110px; }
.catalog-grid input[type=checkbox] { min-height:0; width:17px; height:17px; accent-color:var(--blue); }
.catalog-grid td button { margin-right:9px; }
