:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #17202a;
  background: #f3f5f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
.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; }
/* Plotly normally injects these rules inline; keep them local for the strict CSP. */
.js-plotly-plot .plotly { position: relative; direction: ltr; }
.js-plotly-plot .plotly .main-svg { position: absolute; top: 0; left: 0; pointer-events: none; }
.js-plotly-plot .plotly .main-svg .draglayer { pointer-events: all; }
.js-plotly-plot .plotly .modebar { position: absolute; top: 2px; right: 2px; }
.js-plotly-plot .plotly .modebar-group { position: relative; display: inline-block; float: left; padding-left: 8px; white-space: nowrap; }
.js-plotly-plot .plotly .modebar-btn { position: relative; display: inline-block; padding: 3px 4px; font-size: 16px; line-height: normal; cursor: pointer; }
.js-plotly-plot .plotly .modebar-btn svg { position: relative; top: 2px; }
.js-plotly-plot .plotly .modebar--hover > .modebar-group { opacity: 0; transition: opacity .2s ease; }
.js-plotly-plot:hover .plotly .modebar--hover > .modebar-group,
.js-plotly-plot:focus-within .plotly .modebar--hover > .modebar-group { opacity: 1; }
html, body { margin: 0; min-width: 320px; min-height: 100%; overflow-x: hidden; }
body { background: #f3f5f7; }
button, input, select { font: inherit; }
button, select { min-height: 38px; }

.topbar {
  min-height: 64px; padding: 10px clamp(16px, 3vw, 40px); background: #fff;
  border-bottom: 1px solid #dfe4e8; display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.product, .toolbar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.product > span:last-child { min-width: 0; }
.product strong, .product small { display: block; white-space: nowrap; }
.product strong { font-size: 16px; }
.product small { margin-top: 2px; color: #7b8794; font-size: 9px; }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center;
  border-radius: 6px; color: #fff; background: #1d3f5f; font-size: 12px; font-weight: 700;
}
.toolbar label { color: #64717e; font-size: 13px; }
.toolbar select {
  width: min(210px, 28vw); border: 1px solid #cbd3da; border-radius: 5px;
  background: #fff; padding: 0 32px 0 10px; color: #17202a; text-overflow: ellipsis;
}
.toolbar form { margin: 0; }
.quiet-button { border: 1px solid #cbd3da; border-radius: 5px; background: #fff; color: #35424f; padding: 0 14px; cursor: pointer; }
.quiet-button:hover { background: #f4f6f8; }

.page-shell { width: min(1440px, 100%); margin: 0 auto; padding: 18px clamp(12px, 2.8vw, 40px) 40px; }
.status-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff;
  border: 1px solid #dfe4e8; border-radius: 6px; margin-bottom: 12px;
}
.status-strip > div { min-height: 56px; padding: 10px 14px; border-right: 1px solid #e7ebee; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.status-strip > div:last-child { border-right: 0; }
.status-strip span { color: #75818d; font-size: 11px; }
.status-strip strong, #account-status { margin-top: 3px; color: #26323d; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-strip > div:first-child { flex-direction: row; align-items: center; justify-content: flex-start; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: #98a2ad; }
.status-dot.normal { background: #16845b; }
.status-dot.delayed { background: #c17713; }
.status-dot.unavailable { background: #b24040; }

.summary-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; border: 1px solid #dfe4e8; border-radius: 6px; overflow: hidden; background: #dfe4e8; margin-bottom: 14px; }
.metric { padding: 12px 14px; min-width: 0; background: #fff; }
.metric span { display: block; color: #71808e; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric strong { display: block; margin-top: 6px; font: 600 18px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.metric strong.positive { color: #137a56; }
.metric strong.negative { color: #ad3e3e; }

.chart-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.chart-panel { min-width: 0; background: #fff; border: 1px solid #dfe4e8; border-radius: 6px; overflow: hidden; }
.chart-panel h2 { height: 42px; margin: 0; padding: 0 14px; border-bottom: 1px solid #edf0f2; display: flex; align-items: center; font-size: 14px; font-weight: 600; }
.chart { width: 100%; height: 300px; }
.chart-main { height: 380px; }
.empty-state { padding: 36px 20px; border: 1px dashed #cbd3da; border-radius: 6px; background: #fff; text-align: center; margin-bottom: 14px; }
.empty-state strong, .empty-state span { display: block; }
.empty-state span { margin-top: 6px; color: #75818d; font-size: 13px; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: #eef2f4; }
.login-shell { width: min(380px, 100%); padding: 34px; border: 1px solid #d9e0e5; border-radius: 8px; background: #fff; box-shadow: 0 12px 28px rgba(35, 48, 60, .08); }
.login-shell .brand-mark { margin-bottom: 18px; }
.eyebrow { color: #7b8794; font-size: 10px; margin: 0 0 7px; }
.login-shell h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
.login-caption { margin: 8px 0 24px; color: #6d7985; font-size: 13px; }
.login-form label { display: block; margin-bottom: 7px; font-size: 13px; }
.login-form input { width: 100%; height: 42px; border: 1px solid #bdc7cf; border-radius: 5px; padding: 0 10px; }
.login-form input:focus { outline: 2px solid #8da9bf; outline-offset: 1px; }
.login-form button { width: 100%; margin-top: 14px; border: 0; border-radius: 5px; background: #1d3f5f; color: #fff; cursor: pointer; }

@media (min-width: 900px) {
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-wide { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar select { width: auto; min-width: 0; flex: 1; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip > div:nth-child(2) { border-right: 0; }
  .status-strip > div:nth-child(-n+2) { border-bottom: 1px solid #e7ebee; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart, .chart-main { height: 290px; }
}
