/* A quiet, neutral workspace. Colour is reserved for chart series and meaning. */
:root {
  color-scheme: light;
  --ink: #363636;
  --muted: #767676;
  --line: #e7e7e7;
  --paper: #fafafa;
  --surface: #ffffff;
  --soft: #f5f5f5;
  --chart: #7a7a7a;
  --red: #707070;
  --green: #767676;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button, a, input, select, summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--chart); }
a { color: #646464; text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* Navigation */
.shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 10;
  display: flex; flex-direction: column; width: 196px;
  padding: 29px 16px 22px; background: #fdfdfd; border-right: 1px solid var(--line);
}
.brand { padding: 0 13px; color: var(--ink); font-size: 20px; font-weight: 550; letter-spacing: 1.4px; }
.brand:hover { text-decoration: none; }
.brand em { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; font-style: normal; font-weight: 400; letter-spacing: .5px; }
.nav-label { margin: 40px 13px 13px; color: #777777; font-size: 11px; }
.sidebar a.nav { display: flex; align-items: center; gap: 11px; padding: 12px 13px; margin-bottom: 6px; border-radius: 4px; color: #6f6f6f; font-size: 12px; }
.sidebar a.nav:hover { background: var(--soft); text-decoration: none; }
.sidebar a.active { color: #393939; background: #eeeeee; font-weight: 550; }
.sidebar a.nav span[aria-hidden] { display: flex; width: 16px; flex-shrink: 0; color: #8b8b8b; }
.sidebar .nav-text { white-space: nowrap; }
.nav-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.side-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 13px 0; color: #777777; font-size: 10px; line-height: 1.9; }
.side-bottom strong { color: #6a6a6a; font-weight: 400; }
.content { grid-column: 2; min-width: 0; width: 100%; max-width: 1800px; margin: auto; padding: 0 34px 32px; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 12px; border-bottom: 1px solid var(--line); }
.breadcrumb { font-size: 11px; color: var(--muted); }
.breadcrumb b { color: #5a5a5a; font-weight: 400; }
.account { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 11px; }
.avatar { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid #e3e3e3; border-radius: 50%; color: #727272; background: transparent; font-size: 11px; }
.text-button { border: 0; padding: 6px; color: var(--muted); background: transparent; }
.text-button:hover { color: var(--ink); }

/* Page header and controls */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 25px 0 22px; }
.hero h1 { margin: 0 0 8px; font-size: 24px; font-weight: 500; letter-spacing: -.4px; }
.hero p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.hero-actions { display: flex; gap: 8px; }
.eyebrow { margin-bottom: 9px; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .8px; }
.button { padding: 8px 12px; border: 1px solid #dddddd; border-radius: 4px; background: var(--surface); color: #5c5c5c; font-size: 11px; white-space: nowrap; }
.button:hover { border-color: #c3c3c3; background: #f9f9f9; }
.button.primary { border-color: #cecece; background: #f2f2f2; color: #515151; }
.button.primary:hover { background: #ececec; border-color: #bebebe; }
.button.small { padding: 5px 9px; font-size: 11px; }
.notice { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; margin-bottom: 15px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.notice strong { flex-shrink: 0; color: #646464; font-weight: 500; white-space: nowrap; }
.notice.example { margin-bottom: 0; padding: 8px 12px; border: 1px solid #e4e4e4; border-radius: 4px; background: #f3f3f3; color: #6b6b6b; }
.notice.error { padding: 10px 12px; border: 1px solid #d8d8d8; border-radius: 4px; background: #f9f9f9; color: #656565; }
.filter-panel { margin-bottom: 23px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.filter-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #eeeeee; }
.tabs { display: flex; gap: 5px; }
.tabs button { padding: 7px 12px; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 12px; }
.tabs button[aria-pressed=true] { background: #f0f0f0; color: #565656; font-weight: 500; }
.tabs button:hover { color: var(--ink); background: #f5f5f5; }
.range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range input { min-width: 125px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: #5a5a5a; font-size: 11px; }
.preset { padding: 5px; border: 0; color: var(--muted); background: transparent; font-size: 11px; }
.preset[aria-pressed=true] { color: #5c5c5c; text-decoration: underline; text-underline-offset: 4px; font-weight: 500; }
.filter-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 11px 14px; }
.field { min-width: 135px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: #5b5b5b; font-size: 11px; }
.search { flex: 1; min-width: 190px; max-width: 350px; }
.search::placeholder { color: #888888; }
.compare { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
input[type=checkbox] { accent-color: #808080; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 0 14px 11px; font-size: 11px; }
.chip { border: 1px solid #e3e3e3; border-radius: 3px; padding: 4px 7px; background: #f5f5f5; color: #676767; }

/* Metrics and actionable exceptions */
.section-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 13px; }
.section-line h2 { margin: 0; font-size: 13px; font-weight: 500; }
.section-line p { margin: 0; color: var(--muted); font-size: 10px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 14px; padding: 18px 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.metric { min-width: 0; padding: 0 20px; border-right: 1px solid #ededed; }
.metric:last-child { border-right: 0; }
.metric-label { color: #747474; font-size: 11px; }
.metric-label span { display: none; }
.metric-value { margin: 13px 0 9px; color: #454545; font-size: 29px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.6px; white-space: nowrap; }
.metric-value small { margin-right: 5px; color: #767676; font-size: 13px; font-weight: 400; }
.metric-foot { color: var(--muted); font-size: 10px; line-height: 1.8; }
.up { color: var(--green); }
.down { color: var(--red); }
.muted { color: var(--muted); }
.anomalies { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 5px; background: #fdfdfd; }
.anomalies:empty { display: none; }
.anomaly { display: flex; align-items: center; justify-content: space-between; flex: 1; min-width: 175px; gap: 9px; margin: 10px 0; padding: 3px 16px; border: 0; border-right: 1px solid var(--line); color: #646464; background: transparent; text-align: left; }
.anomaly:last-child { border-right: 0; }
.anomaly:hover { color: #4a4a4a; background: #f2f2f2; }
.anomaly b { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 400; }
.anomaly small { color: #747474; font-size: 10px; }
.anomaly span { color: #969696; font-size: 15px; }

/* Charts, finance and tables */
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 19px 11px; }
.panel-heading h2 { margin: 0 0 6px; font-size: 13px; font-weight: 500; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.chart-row { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(260px, 1fr); gap: 17px; margin-bottom: 20px; }
.chart-wrap { position: relative; padding: 8px 15px 0; }
.chart-wrap svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart-grid { stroke: #efefef; stroke-dasharray: 2 5; }
.chart-label { fill: #757575; font-size: 10px; }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chart-before { fill: none; stroke: #919191; stroke-width: 1.3; stroke-dasharray: 4 5; stroke-linejoin: round; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:hover, .chart-hit:focus { fill: #7a7a7a0a; outline: none; stroke: #7a7a7a45; }
.chart-tooltip { position: absolute; top: 36px; right: 28px; z-index: 2; padding: 10px 13px; border: 1px solid #dfdfdf; border-radius: 4px; color: #595959; background: #ffffff; box-shadow: 0 3px 12px #37373710; pointer-events: none; font-size: 11px; line-height: 1.9; }
.chart-tooltip b { font-weight: 500; }
.chart-legend { display: flex; justify-content: center; align-items: center; gap: 17px; padding: 6px 10px 17px; color: var(--muted); font-size: 10px; }
.legend-dot { display: inline-block; width: 14px; height: 2px; margin: 0 6px 3px 0; background: var(--chart); }
.legend-dot.before { background: repeating-linear-gradient(to right, #919191 0 4px, transparent 4px 7px); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px; border: 1px solid #e5e5e5; border-radius: 3px; background: #f7f7f7; color: #767676; font-size: 10px; line-height: 1.3; }
.badge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.badge.warn { border-color: #e2e2e2; background: #f9f9f9; color: #7c7c7c; }
.badge.neutral { border-color: #e7e7e7; color: var(--muted); background: #f8f8f8; }
.finance-items { padding: 0 19px 9px; }
.finance-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 13px 0; border-bottom: 1px solid #efefef; }
.finance-item:last-child { border-bottom: 0; }
.finance-item span { font-size: 11px; line-height: 1.7; }
.finance-item span small { display: block; max-width: 190px; color: var(--muted); font-size: 10px; }
.finance-item strong { font-size: 18px; font-weight: 500; letter-spacing: -.3px; white-space: nowrap; }
.panel-note { padding: 10px 19px; border-top: 1px solid #eeeeee; background: #fcfcfc; color: var(--muted); font-size: 10px; line-height: 1.8; }
.table-tabs { display: flex; align-items: center; gap: 19px; }
.table-tabs button { padding: 0 0 10px; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; }
.table-tabs button[aria-pressed=true] { border-color: #858585; color: #5e5e5e; font-weight: 500; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: 12px; }
th { padding: 11px 17px; border-top: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb; background: #f8f8f8; color: var(--muted); font-size: 11px; font-weight: 400; }
td { padding: 14px 17px; border-bottom: 1px solid #efefef; vertical-align: middle; font-variant-numeric: tabular-nums; }
td.numeric, th.numeric { text-align: right; }
tbody tr:hover { background: #fafafa; }
.row-link { padding: 0; border: 0; color: var(--ink); background: transparent; text-align: left; }
.row-link b { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; }
.row-link small { display: block; max-width: 220px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; font-size: 10px; }
.row-link:hover b { color: #666666; text-decoration: underline; text-underline-offset: 3px; }
.status-tag { padding: 3px 6px; border: 1px solid #e2e2e2; border-radius: 3px; background: #f9f9f9; color: #7c7c7c; font-size: 10px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; color: var(--muted); font-size: 10px; }
.pagination { display: flex; align-items: center; gap: 10px; }
.empty { padding: 45px 20px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.9; }
.empty b { display: block; margin-bottom: 8px; color: var(--ink); font-size: 14px; font-weight: 500; }
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 18px 0; }
.health-item { padding: 1px 11px; border-left: 1px solid #c5c5c5; color: var(--muted); font-size: 10px; line-height: 1.9; }
.health-item.warn { border-color: #bdbdbd; }
.health-item strong { color: var(--ink); font-weight: 400; }
.footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 18px; color: #767676; font-size: 10px; line-height: 1.8; }
.busy { opacity: .5; pointer-events: none; }
.loading { padding: 50px; color: var(--muted); text-align: center; }

/* Detail explorer */
.drawer { position: fixed; inset: 0; z-index: 30; width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: transparent; }
.drawer::backdrop { background: #3a3a3a40; }
.drawer-card { display: flex; flex-direction: column; width: min(660px, 100%); height: 100%; margin-left: auto; border-left: 1px solid #e2e2e2; background: var(--surface); box-shadow: -8px 0 30px #35353510; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 25px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0 0 8px; font-size: 20px; font-weight: 500; }
.drawer-head p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.drawer-body { flex: 1; overflow: auto; padding: 22px 25px; }
.detail-row { margin-bottom: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; line-height: 1.8; }
.detail-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.detail-title b { font-weight: 500; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.detail-grid span { display: block; color: var(--muted); font-size: 10px; }
.detail-grid strong { font-size: 13px; font-weight: 500; }
.detail-note { margin-top: 12px; padding: 8px 10px; border-radius: 3px; background: #f5f5f5; color: #757575; font-size: 10px; }
.detail-row details { margin-top: 12px; color: var(--muted); font-size: 10px; }
.detail-row summary { cursor: pointer; }
.operation { padding: 9px 0; border-top: 1px solid #eeeeee; overflow-wrap: anywhere; }
.operation b { color: var(--ink); font-weight: 400; }
.detail-pager { display: flex; align-items: center; justify-content: space-between; padding: 13px 25px; border-top: 1px solid var(--line); font-size: 11px; }

/* Login and compact navigation */
.login-screen { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--paper); }
.login-card { width: min(400px, 100%); padding: 38px; border: 1px solid #e3e3e3; border-radius: 6px; background: var(--surface); }
.login-card h1 { margin: 0 0 9px; font-size: 24px; font-weight: 500; }
.login-card p { margin-bottom: 25px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.login-card label { display: block; margin-bottom: 17px; font-size: 12px; }
.login-card input { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 1px solid #e3e3e3; border-radius: 4px; }
.login-card .button { width: 100%; padding: 12px; }
.login-error { min-height: 20px; margin: 10px 0; color: var(--red); font-size: 12px; }
.login-brand { margin-bottom: 28px; color: #767676; font-size: 11px; font-weight: 500; letter-spacing: 1px; }
.mobile-nav { display: none; position: relative; font-size: 11px; }
.mobile-nav summary { list-style: none; cursor: pointer; }
.mobile-nav nav { position: absolute; top: 25px; left: 0; z-index: 20; min-width: 150px; padding: 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); box-shadow: 0 4px 16px #3131310d; }
.mobile-nav a { display: block; padding: 10px; color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (min-width: 1500px) {
  .content { padding-left: 44px; padding-right: 44px; }
  .metric-value { font-size: 31px; }
  .chart-wrap svg { height: 250px; }
}
@media (max-width: 1100px) {
  .sidebar { width: 175px; padding-left: 10px; padding-right: 10px; }
  .shell { grid-template-columns: 175px minmax(0, 1fr); }
  .content { padding: 0 20px 25px; }
  .metric { padding: 0 15px; }
  .metric-value { font-size: 24px; }
  .chart-row { grid-template-columns: minmax(0, 1.8fr) minmax(240px, 1fr); }
  .compare { margin-left: 0; }
  .range { gap: 5px; }
  .hero-actions { flex-wrap: wrap; }
}
@media (max-width: 800px) {
  .sidebar { align-items: center; width: 64px; padding: 24px 5px; }
  .brand { padding: 0; font-size: 15px; letter-spacing: 0; }
  .brand em, .sidebar .nav-label, .sidebar .nav-text, .side-bottom { display: none; }
  .sidebar a.nav { margin-top: 8px; padding: 13px; }
  .sidebar nav { margin-top: 30px; }
  .shell { grid-template-columns: 64px minmax(0, 1fr); }
  .content { padding: 0 16px 24px; }
  .hero { padding-top: 23px; }
  .hero h1 { font-size: 23px; }
  .hero-actions .button:first-child { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
  .metric { padding: 17px; border-bottom: 1px solid var(--line); }
  .metric:nth-child(even) { border-right: 0; }
  .metric:nth-last-child(-n+2) { border-bottom: 0; }
  .chart-row { grid-template-columns: 1fr; }
  .finance-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .finance-item { display: block; border: 0; }
  .finance-item strong { display: block; margin-top: 10px; }
  .finance-item span small { min-height: 30px; }
  .filter-top { align-items: flex-start; }
  .filter-bottom { gap: 8px; }
  .hero p { max-width: 350px; }
  .topbar { height: 60px; }
  .chart-wrap svg { height: 220px; }
  .section-line p { max-width: 200px; text-align: right; }
  .anomaly { min-width: 150px; }
}
@media (max-width: 520px) {
  .sidebar { display: none; }
  .shell { display: block; }
  .content { padding: 0 13px 20px; }
  .topbar { height: 54px; }
  .breadcrumb { display: none; }
  .mobile-nav { display: block; }
  .hero { gap: 10px; padding: 23px 0 19px; }
  .hero h1 { font-size: 23px; }
  .hero p { max-width: 205px; font-size: 11px; }
  .hero-actions .button { padding: 8px; }
  .metric { padding: 15px; }
  .metric-value { font-size: 25px; }
  .metric-foot { font-size: 10px; }
  .filter-top, .filter-bottom { padding: 11px; }
  .filter-bottom .field { flex: 1; min-width: 110px; }
  .filter-bottom .search { max-width: none; flex-basis: 100%; }
  .compare { margin-top: 5px; }
  .tabs button { padding: 7px 11px; }
  .range { width: 100%; justify-content: flex-start; }
  .range input { min-width: 0; width: 133px; padding: 7px 5px; }
  .preset { padding: 5px 7px; }
  .notice { align-items: flex-start; font-size: 10px; }
  .notice.example { padding: 8px 10px; }
  .finance-items { gap: 12px; padding: 0 15px; }
  .finance-item strong { font-size: 15px; }
  .finance-item span { font-size: 10px; }
  .finance-item span small { min-height: 47px; font-size: 10px; }
  .panel-heading { padding: 16px 15px 10px; }
  .panel-heading h2 { font-size: 13px; }
  .panel-note { padding: 10px 15px; }
  .footer { display: block; font-size: 10px; }
  .health { grid-template-columns: 1fr; }
  .chart-wrap { padding: 6px 9px 0; }
  .chart-wrap svg { height: 205px; }
  .chart-tooltip { right: 15px; top: 20px; }
  .chart-legend { flex-wrap: wrap; gap: 7px 15px; }
  .table-footer { padding: 12px; font-size: 10px; }
  .drawer-head, .drawer-body { padding: 20px; }
  .detail-grid { gap: 8px; }
  .detail-grid strong { font-size: 12px; }
  .section-line { align-items: flex-start; }
  .section-line p { max-width: 190px; font-size: 10px; }
  .account { gap: 8px; }
  .anomaly { min-width: 145px; margin: 0; padding: 11px; border-bottom: 1px solid var(--line); }
  .anomaly:nth-child(even) { border-right: 0; }
  .anomaly:last-child { border-bottom: 0; }
  .anomaly b { font-size: 10px; }
}
