:root {
  color-scheme: light;
  --paper: #f5f4f0;
  --surface: #fff;
  --ink: #242135;
  --muted: #615f70;
  --stroke: #dedbe4;
  --nav: #27223b;
  --violet: #58439c;
  --violet-dark: #45327f;
  --lilac: #ebe5f9;
  --green: #21654f;
  --green-bg: #dff1e9;
  --amber: #82500d;
  --amber-bg: #f9edd5;
  --red: #9d353e;
  --red-bg: #fae8e8;
  --mono: 'IBM Plex Mono', Consolas, 'Microsoft YaHei UI', monospace;
  font-family: 'Instrument Sans', 'Microsoft YaHei UI', 'PingFang SC', 'Noto Sans CJK SC', system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.15; letter-spacing: -.045em; }
h2 { font-size: 18px; letter-spacing: -.025em; }
a { color: var(--violet-dark); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 13px; border: 1px solid var(--stroke);
  border-radius: 7px; color: var(--ink); background: var(--surface); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
button:hover, .button:hover { background: #f5f2fc; border-color: #cfc3e8; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid #a38add; outline-offset: 3px; }
.primary { background: var(--violet); border-color: var(--violet); color: white; font-weight: 650; }
.primary:hover { background: var(--violet-dark); border-color: var(--violet-dark); }
.quiet { border-color: transparent; background: transparent; color: var(--violet-dark); }
.danger { color: var(--red); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.subtle { color: var(--muted); font-size: 13px; line-height: 1.6; }
.stack { display: grid; gap: 6px; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 214px minmax(0, 1fr); }
.sidebar {
  background: var(--nav); color: #f4effd; display: flex; flex-direction: column;
  min-height: 100vh; position: sticky; top: 0; align-self: start; padding: 24px 16px 17px;
}
.brand { display: flex; gap: 11px; align-items: center; font-size: 17px; font-weight: 700; margin: 0 9px 32px; }
.brand-mark {
  background: #b8a8e9; color: #292044; display: inline-grid; place-items: center;
  border-radius: 8px; width: 33px; height: 33px; font: 700 18px var(--mono);
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav button {
  color: #e1d9ee; justify-content: flex-start; border: 0; background: transparent; min-height: 42px;
  padding-inline: 12px; font-weight: 550;
}
.sidebar nav span { width: 23px; font-size: 17px; color: #cab8ed; text-align: left; }
.sidebar nav button:hover, .sidebar nav button[aria-current] { background: #44365e; color: white; }
.sidebar-foot {
  margin-top: auto; padding: 13px 3px 0; border-top: 1px solid #514564; display: flex; justify-content: space-between;
  align-items: center; gap: 8px; color: #ddd2ed; font-size: 12px;
}
.sidebar-foot button { background: transparent; border: 0; color: #f2eaff; font-size: 12px; }
.sidebar-foot button:hover { background: #44365e; }
.workspace { min-width: 0; }
.topbar {
  height: 65px; background: var(--surface); border-bottom: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(16px, 3vw, 42px);
}
.top-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content; white-space: nowrap;
  padding: 4px 8px; border-radius: 5px; background: var(--lilac); color: var(--violet-dark); font-size: 12px; font-weight: 650;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 100%; background: currentColor; }
.pill.good { color: var(--green); background: var(--green-bg); }
.pill.warn { color: var(--amber); background: var(--amber-bg); }
.pill.bad { color: var(--red); background: var(--red-bg); }
.pill.neutral { color: #555268; background: #efedf3; }
main#content { max-width: 1540px; margin: 0 auto; padding: 33px clamp(16px, 3vw, 42px) 55px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 23px; }
.page-head p { margin-top: 10px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.panel { border: 1px solid var(--stroke); border-radius: 12px; background: var(--surface); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 17px 20px; border-bottom: 1px solid var(--stroke); }
.panel-body { padding: 18px 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(265px, 1fr); gap: 16px; align-items: start; }
.grid-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.metrics {
  display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 12px; overflow: hidden; margin-bottom: 17px;
}
.metric { padding: 15px 20px; display: grid; gap: 8px; border-right: 1px solid var(--stroke); }
.metric:last-child { border: 0; }
.metric:first-child { background: var(--lilac); }
.metric strong { font: 650 clamp(21px, 3vw, 32px)/1.05 var(--mono); letter-spacing: -.065em; }
.metric small { font: 500 14px var(--mono); letter-spacing: 0; color: var(--muted); }
.account-board { display: grid; }
.account-line { display: grid; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--stroke); }
.account-line:last-child { border-bottom: 0; }
.account-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-meta strong { min-width: 0; overflow-wrap: anywhere; }
.schedule { display: flex; flex-wrap: wrap; gap: 7px 15px; font-size: 12px; color: var(--muted); }
.gauge {
  height: 7px; width: 100%; border-radius: 4px; display: block; border: 0; overflow: hidden;
  background: var(--lilac); color: var(--violet);
}
.gauge::-webkit-progress-bar { background: var(--lilac); border-radius: 4px; }
.gauge::-webkit-progress-value { background: var(--violet); border-radius: 4px; }
.gauge::-moz-progress-bar { background: var(--violet); border-radius: 4px; }
.events { margin: 0; padding: 0; list-style: none; }
.events li { padding: 13px 20px; border-bottom: 1px solid var(--stroke); display: grid; gap: 4px; }
.events li:last-child { border-bottom: 0; }
.events li.warning { border-left: 3px solid #ac7422; padding-left: 17px; }
.events p, .reason { overflow-wrap: anywhere; }
.notice { margin: 0 0 16px; border: 1px solid #e8d1a9; background: #fbf2e1; border-radius: 8px; padding: 12px 15px; display: grid; gap: 6px; }
.notice button { justify-self: start; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 15px; vertical-align: top; border-bottom: 1px solid var(--stroke); line-height: 1.5; }
th { font-size: 12px; background: #f8f7fb; color: #555167; font-weight: 650; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .actions { flex-wrap: nowrap; }
td .actions button { min-height: 30px; padding: 3px 8px; font-size: 12px; }
.select-cell { width: 32px; }
.reason { max-width: 390px; margin-top: 5px; }
.empty { padding: 28px 20px; color: var(--muted); line-height: 1.6; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 15px; border-bottom: 1px solid var(--stroke); }
.filters .push { margin-left: auto; }
.pagination { min-height: 53px; border-top: 1px solid var(--stroke); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 15px; }
label { display: grid; gap: 7px; font-weight: 600; }
input:not([type=checkbox]), select, textarea {
  min-height: 37px; padding: 7px 10px; border: 1px solid #cfcbd8; border-radius: 6px; background: white; color: var(--ink); min-width: 0;
}
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--violet); }
input[type=search] { width: min(235px, 100%); }
textarea { min-height: 84px; resize: vertical; }
dialog {
  width: min(500px, calc(100% - 30px)); max-height: calc(100% - 30px); border: 1px solid var(--stroke);
  border-radius: 13px; padding: 0; color: var(--ink); box-shadow: 0 20px 65px #1711203b;
}
dialog::backdrop { background: #221b36a0; }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--stroke); display: flex; justify-content: space-between; align-items: center; }
.modal-head button { min-width: 35px; padding: 3px 7px; font-size: 21px; line-height: 1; }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-body .actions { justify-content: flex-end; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-error { font-size: 13px; color: var(--red); line-height: 1.5; }
.form-error:empty { display: none; }
.standalone { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.auth-card {
  width: min(100%, 395px); background: var(--surface); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 27px; display: grid; gap: 17px;
}
.auth-card h1 { font-size: 26px; }
.auth-card p { color: var(--muted); line-height: 1.6; }
.auth-card p.form-error { color: var(--red); }
.toast, .load-status {
  position: fixed; z-index: 2; right: 18px; bottom: 18px; max-width: min(480px, calc(100vw - 36px));
  padding: 13px 17px; background: var(--nav); color: white; border-radius: 9px; line-height: 1.55;
}
.toast.error { background: #742b36; }
.definitions { display: grid; grid-template-columns: auto 1fr; column-gap: 15px; row-gap: 12px; margin: 0; align-items: baseline; }
.definitions dt { color: var(--muted); }
.definitions dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; }
@media (max-width: 1020px) {
  .grid-main { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 168px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
}
@media (max-width: 720px) {
  .layout { display: block; }
  .sidebar { position: static; min-height: 0; padding: 12px; }
  .brand { margin: 0 0 10px 4px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 3px; }
  .sidebar nav button { min-height: 32px; padding: 4px 7px; font-size: 12px; gap: 4px; }
  .sidebar nav span { width: auto; font-size: 13px; }
  .sidebar-foot { margin-top: 8px; padding-top: 4px; }
  .topbar { height: auto; min-height: 57px; padding-block: 8px; }
  .top-status .subtle { font-size: 11px; }
  main#content { padding-top: 25px; }
  .grid-settings { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { border-bottom: 1px solid var(--stroke); padding: 12px 14px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(3) { border-bottom: 0; }
  .filters .push { margin-left: 0; }
}
