:root {
  color-scheme: light;
  --bg: #f4f4f2; --surface: #ffffff; --text: #191919; --text2: #666666; --line: #e4e4e1;
  --good: #0aac23; --warning: #fbb315; --serious: #f18a59; --critical: #dc3c3d; --none: #d6d6d2; --accent: #257de0;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f0f0f; --surface: #191919; --text: #efefef; --text2: #9c9c9c; --line: #2c2c2c;
    --none: #3a3a3a; --accent: #338ced;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; }
#app { max-width: 880px; margin: 0 auto; padding: 0 12px calc(28px + env(safe-area-inset-bottom)); }
.muted { color: var(--text2); } .pad { padding: 24px 4px; } .num { font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(10px + env(safe-area-inset-top)) 0 8px; }
.top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top h1 { font-size: 17px; margin: 0; font-weight: 650; }
.top .sub { color: var(--text2); font-size: 12px; margin-left: auto; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 8px; }
.tabs { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 7px 4px; border-radius: 7px; font-size: 13px; white-space: nowrap; color: var(--text2); }
.tabs button[aria-selected="true"] { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.iconbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 10px; font-size: 12px; }

/* 状态：圆点 + 文字，颜色不单独表意 */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--none); flex: none; }
.dot.good { background: var(--good); } .dot.warning { background: var(--warning); } .dot.critical { background: var(--critical); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.pill.critical { border-color: var(--critical); } .pill.warning { border-color: var(--warning); } .pill.good { border-color: var(--good); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.card h2 { font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.card h2 .side { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--text2); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 8px; text-align: center; min-width: 0; }
.tile .k { font-size: 12px; color: var(--text2); display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.tile .s { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .tile .v { font-size: 18px; } .tiles { gap: 6px; } .tile { padding: 8px 4px; } .tile .k { font-size: 11.5px; } }

.banner { border: 1px solid var(--line); border-left: 4px solid var(--none); background: var(--surface); border-radius: 8px; padding: 8px 10px; margin-top: 10px; font-size: 13px; }
.banner.warning { border-left-color: var(--warning); } .banner.critical { border-left-color: var(--critical); }

.row { padding: 9px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-of-type { border-top: 0; }
.l1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.right { margin-left: auto; display: flex; gap: 10px; align-items: baseline; white-space: nowrap; font-size: 12px; color: var(--text2); flex: none; }
.right b { color: var(--text); font-size: 14px; }
.l2 { font-size: 12px; color: var(--text2); margin-top: 3px; overflow-wrap: anywhere; }
.l2.strong { color: var(--text); font-weight: 600; }
.l3 { font-size: 12px; color: var(--text2); display: flex; gap: 8px; margin-top: 2px; }
.l3 span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.l3 span:last-child { margin-left: auto; white-space: nowrap; flex: none; }

/* 24 小时色块 / 心跳条：每格之间留 2px 底色 */
.bars { display: flex; gap: 2px; margin-top: 6px; }
.bars i { flex: 1; height: 14px; border-radius: 2px; background: var(--none); min-width: 0; }
.bars.thin i { height: 10px; }
.bars i.good { background: var(--good); } .bars i.warning { background: var(--warning); } .bars i.critical { background: var(--critical); }
.bars i:hover { outline: 2px solid var(--text); outline-offset: 0; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--none); }
.legend i.good { background: var(--good); } .legend i.warning { background: var(--warning); } .legend i.critical { background: var(--critical); }

.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 5px 10px; font-size: 13px; color: var(--text2); border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); font-weight: 600; }
.controls input[type=search] { flex: 1; min-width: 140px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 2px; }
.kv div { text-align: center; min-width: 0; }
.kv .k { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv .v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: var(--none); overflow: hidden; margin: 6px 0 2px; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--good); }
.meter i.warning { background: var(--warning); } .meter i.critical { background: var(--critical); }
.more { border: 0; background: transparent; color: var(--accent); padding: 8px 0 0; font-size: 13px; }
.ev { display: flex; gap: 8px; font-size: 12px; padding: 4px 0; }
.ev time { color: var(--text2); flex: none; width: 38px; font-variant-numeric: tabular-nums; }
.ev .q { color: var(--text2); }
.foot { color: var(--text2); font-size: 12px; text-align: center; margin-top: 16px; }

.login { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); margin: 12px 0 10px; text-align: center; }
.login button { width: 100%; padding: 10px; border-radius: 10px; border: 0; background: var(--text); color: var(--surface); font-weight: 600; }
.login .err { color: var(--critical); font-size: 13px; min-height: 20px; margin-top: 8px; }

#tip { position: fixed; z-index: 20; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px; padding: 5px 8px; border-radius: 6px; max-width: 260px; line-height: 1.4; white-space: pre-line; }
/* 点色块看这一小时的明细 */
.bars i[data-tip] { cursor: pointer; }
.bars i.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.detail { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.detail .l2.strong { margin-top: 8px; }
.detail .l3 .pill { padding: 0 6px; font-size: 11px; }
.errcard { margin: 6px 0 10px; }
.taskids { margin: 4px 0 2px; font-size: 12px; }
.taskids .muted { color: var(--text2); }
.taskids .l3 button { margin-left: auto; }
.taskids .tid { display: flex; align-items: center; gap: 8px; padding: 1px 0; min-width: 0; }
.taskids .tid code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskids .tid .ch { font-size: 11px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taskids button.more { padding: 0; font-size: 11.5px; }
.errtext { margin: 4px 0; padding: 7px 9px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; user-select: text; }
