/* Classic dark status page. Default is dark, independently of the OS theme. */
:root {
  color-scheme: dark;
  --bg: #0a0a0a; --surface: #0a0a0a; --frame: #171717; --border: #292929;
  --text: #fafafa; --secondary: #b0b0b0; --muted: #a3a3a3; --button: #141414;
  --hover: #232323; --green: #22c55e; --red: #f87171; --yellow: #fbbf24;
  --blue: #60a5fa; --unknown: #a3a3a3; --bar-unknown: #444444;
  --tip-bg: #262626; --tip-text: #fafafa; --tip-sub: #d4d4d4; --tip-border: #3a3a3a;
  --hero-ok: #0b3425; --hero-bad: #3a171b; --hero-warn: #342b15;
  --hero-maint: #142c40; --hero-mute: #202020; --brand: #7aa2ff;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff; --surface: #ffffff; --frame: #f2f2f2; --border: #e5e5e5;
  --text: #171717; --secondary: #525252; --muted: #626262; --button: #fafafa;
  --hover: #eeeeee; --green: #15803d; --red: #b91c1c; --yellow: #996600;
  --blue: #2563eb; --unknown: #737373; --bar-unknown: #d4d4d4;
  --tip-bg: #ffffff; --tip-text: #171717; --tip-sub: #404040; --tip-border: #d4d4d4;
  --hero-ok: #dcfce7; --hero-bad: #fee2e2; --hero-warn: #fef3c7;
  --hero-maint: #dbeafe; --hero-mute: #f1f1f1; --brand: #3458d0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 30px 24px 32px; }
.skip { position: absolute; top: -80px; left: 16px; z-index: 20; background: var(--surface); border: 1px solid var(--border); padding: 10px 14px; border-radius: 6px; }
.skip:focus { top: 12px; }

/* Reference-style compact brand and toolbar. */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; min-width: 0; gap: 10px; }
.brand-mark { width: 30px; height: 30px; display: inline-flex; color: var(--brand); flex: 0 0 auto; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-copy { display: block; }
h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.brand-sub { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 2px; }
.toolbar { display: flex; align-items: center; flex: 0 0 auto; gap: 8px; }
.control { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 12px; color: var(--text); background: var(--button); border: 1px solid var(--border); border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s ease; }
.control:hover { background: var(--hover); }
.control:disabled { opacity: .55; cursor: wait; }
.control svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-control { width: 44px; padding: 0; }
.moon-icon { display: none; }
:root[data-theme="light"] .sun-icon { display: none; }
:root[data-theme="light"] .moon-icon { display: block; }
.refresh[aria-busy="true"] svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

[data-tone="ok"] { --tone: var(--green); --tone-bg: var(--hero-ok); }
[data-tone="bad"] { --tone: var(--red); --tone-bg: var(--hero-bad); }
[data-tone="warn"] { --tone: var(--yellow); --tone-bg: var(--hero-warn); }
[data-tone="maint"] { --tone: var(--blue); --tone-bg: var(--hero-maint); }
[data-tone="mute"] { --tone: var(--unknown); --tone-bg: var(--hero-mute); }
.hero { padding: 17px 20px; background: var(--tone-bg, var(--hero-mute)); border-radius: 12px; }
.hero-line { display: flex; align-items: center; gap: 9px; }
.hero h2 { margin: 0; font-size: 16px; font-weight: 550; line-height: 1.5; }
.status-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%; background: var(--tone, var(--unknown)); color: #ffffff; font-size: 11px; font-weight: 700; line-height: 1; }
.status-icon::after { content: "?"; }
[data-tone="ok"] > .hero-line > .status-icon::after, .svc[data-tone="ok"] .status-icon::after { content: ""; width: 7px; height: 4px; border-left: 1.7px solid #fff; border-bottom: 1.7px solid #fff; transform: translateY(-1px) rotate(-45deg); }
[data-tone="bad"] > .hero-line > .status-icon::after, .svc[data-tone="bad"] .status-icon::after { content: "!"; }
[data-tone="warn"] > .hero-line > .status-icon::after, .svc[data-tone="warn"] .status-icon::after { content: "!"; color: #171717; }
[data-tone="maint"] > .hero-line > .status-icon::after, .svc[data-tone="maint"] .status-icon::after { content: "Ⅱ"; }
.hero-note { margin: 3px 0 0 25px; font-size: 14px; line-height: 1.6; color: var(--secondary); }
.notice { margin: 10px 0 0 25px; font-size: 13px; line-height: 1.65; color: var(--secondary); }
.notice-line { display: block; }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 16px; row-gap: 4px; margin: 12px 1px 20px; color: var(--muted); font-size: 12px; }
.page-meta p { margin: 0; }
.page-meta time { font-variant-numeric: tabular-nums; }

/* DeepSeek-like dark frame with an inset component list. */
.panel { overflow: hidden; border-radius: 12px; background: var(--frame); padding: 0 4px 4px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 550; line-height: 1.5; }
.section-hint { color: var(--muted); font-size: 12px; }
.services { margin: 0; padding: 0; list-style: none; background: var(--surface); border-radius: 8px; overflow: hidden; }
.chat-services { margin-top: 4px; }
.chat-toggle { list-style: none; min-height: 44px; align-items: center; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.chat-toggle::-webkit-details-marker { display: none; }
.chat-toggle::marker { content: ""; }
.chat-toggle:hover .svc-id h3 { color: var(--secondary); }
.chat-toggle .svc-id::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: 0 0 auto; }
.chat-details[open] > .chat-toggle .svc-id::before { transform: rotate(45deg); }
.svc { padding: 16px; border-bottom: 1px solid var(--border); }
.svc:last-child { border-bottom: 0; }
.svc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.svc-id { min-width: 0; display: flex; align-items: center; gap: 8px; }
.svc-id .status-icon { margin-top: 1px; }
.svc-id h3 { margin: 0; font-size: 14px; font-weight: 550; line-height: 1.55; overflow-wrap: anywhere; }
.svc-uptime { flex-shrink: 0; color: var(--muted); font-size: 13px; line-height: 1.65; font-variant-numeric: tabular-nums; white-space: nowrap; }
.svc-uptime .uptime-label { margin-left: 4px; }
.svc-cat { margin: 6px 0 0; color: var(--secondary); font-size: 13px; line-height: 1.65; }
.svc-hist { margin-top: 11px; }
.bars { display: flex; gap: 2px; height: 19px; align-items: stretch; }
.bar { flex: 1 1 0; min-width: 0; display: block; border-radius: 1.5px; background: var(--bar-unknown); transition: opacity .15s; }
.bar { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.bar:hover, .bar.is-active { opacity: .7; }
.bar.is-active { outline: 1px solid var(--text); outline-offset: 1px; opacity: 1; }
.tip { position: fixed; z-index: 30; left: 0; top: 0; display: flex; flex-direction: column; gap: 2px; max-width: min(280px, calc(100vw - 16px)); padding: 7px 10px; border-radius: 7px; background: var(--tip-bg); color: var(--tip-text); border: 1px solid var(--tip-border); box-shadow: 0 6px 20px rgba(0,0,0,.28); font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; pointer-events: none; white-space: normal; }
.tip[hidden] { display: none; }
.tip::after { content: ""; position: absolute; left: var(--arrow, 50%); bottom: -5px; width: 8px; height: 8px; margin-left: -4px; background: var(--tip-bg); border-right: 1px solid var(--tip-border); border-bottom: 1px solid var(--tip-border); transform: rotate(45deg); }
.tip.below::after { bottom: auto; top: -5px; transform: rotate(225deg); }
.tip-time { font-weight: 600; }
.tip-stats { color: var(--tip-sub); display: inline-flex; align-items: center; gap: 6px; }
.tip-stats::before { content: ""; width: 7px; height: 7px; border-radius: 2px; flex: 0 0 auto; background: var(--bar-unknown); }
.tip[data-tone="up"] .tip-stats::before { background: var(--green); }
.tip[data-tone="partial"] .tip-stats::before, .tip[data-tone="pending"] .tip-stats::before { background: var(--yellow); }
.tip[data-tone="down"] .tip-stats::before { background: var(--red); }
.tip[data-tone="maintenance"] .tip-stats::before { background: var(--blue); }
.tip[data-tone="outside"] .tip-stats::before { background: var(--blue); }
.bar.up, .sw.up { background: var(--green); }
.bar.down, .sw.down { background: var(--red); }
.bar.pending, .sw.pending, .bar.partial, .sw.partial { background: var(--yellow); }
.bar.maintenance, .sw.maintenance { background: var(--blue); }
.bar.outside, .sw.outside { background: var(--blue); }
.bar.unknown, .sw.unknown { background: var(--bar-unknown); }
.svc.is-stale .bars { opacity: .45; }
.axis { display: flex; justify-content: space-between; gap: 10px; margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.axis span { min-width: 0; }
.axis span:last-child { text-align: right; }
.axis .axis-mid { flex: 1 1 auto; text-align: center; opacity: .85; }
@media (max-width: 420px) { .axis .axis-mid { display: none; } }
.svc-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.state-label { display: inline-flex; align-items: center; gap: 6px; color: var(--tone, var(--unknown)); }
.state-dot { width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.tag { margin-left: 5px; color: var(--yellow); }
.hist-empty { margin: 0; padding: 6px 0; color: var(--muted); font-size: 13px; }
.empty { margin: 0; padding: 24px 16px; background: var(--surface); border-radius: 8px; color: var(--secondary); }
.panel-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; padding: 12px 12px 8px; }
.legend { font-size: 12px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }

/* Hourly / daily segmented toggle. */
.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--button); }
.seg button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--hover); color: var(--text); font-weight: 550; }
.seg button:hover { color: var(--text); }

/* Pinned notes banner + historical events. */
.banner { display: grid; gap: 10px; margin-top: 12px; }
.banner[hidden], .ev-empty[hidden] { display: none; }
.banner-card, .ev { border-left: 3px solid var(--tone, var(--yellow)); }
.banner-card { padding: 13px 16px; border-radius: 10px; background: var(--frame); }
.ev-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ev-tag { flex: 0 0 auto; padding: 0 6px; border-radius: 4px; font-size: 11px; line-height: 18px; color: var(--tone, var(--yellow)); background: var(--tone-bg, var(--hero-warn)); }
.ev-title { margin: 0; font-size: 14px; font-weight: 550; line-height: 1.55; overflow-wrap: anywhere; }
.ev-body { margin: 5px 0 0; color: var(--secondary); font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-meta { margin: 5px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.board { margin-top: 24px; }
.history { margin-top: 24px; }
.events { display: grid; gap: 4px; }
.ev-day { padding: 0; border-radius: 8px; background: var(--surface); }
.ev-day[open] { padding-bottom: 14px; }
.ev-date { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 14px 16px; font-size: 13px; font-weight: 550; color: var(--text); font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; }
.ev-date::-webkit-details-marker { display: none; }
.ev-date::marker { content: ""; }
.ev-date-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ev-date-label::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: 0 0 auto; }
.ev-day[open] > .ev-date > .ev-date-label::before { transform: rotate(45deg); }
.ev-date-count { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.ev-date:hover { color: var(--text); background: var(--hover); }
.ev-day[open] > .ev-date { margin-bottom: 2px; }
.ev-list { display: grid; gap: 10px; padding: 0 16px; }
.ev { padding: 2px 0 2px 12px; }
.ev-empty { margin: 0; padding: 20px 16px; border-radius: 8px; background: var(--surface); color: var(--secondary); font-size: 13px; }

.about { margin-top: 24px; }
.about-body { padding: 16px; border-radius: 8px; background: var(--surface); }
.about-body p { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; margin: 0; font-size: 13px; line-height: 1.75; }
.about-body p + p { margin-top: 14px; }
.about-body strong { font-weight: 500; color: var(--text); }
.about-body span { color: var(--secondary); }
.foot { margin-top: 26px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.8; }
.foot p { margin: 3px 0; }
.footer-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 2px; }
.separator { margin: 0 8px; }
.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 (max-width: 520px) {
  .wrap { padding: 22px 16px 26px; }
  .masthead { gap: 12px; margin-bottom: 22px; }
  .brand { gap: 8px; }
  h1 { font-size: 18px; }
  .brand-mark { width: 28px; height: 28px; }
  .hero { padding: 16px; }
  .page-meta { margin-bottom: 16px; }
  .panel-head { padding: 13px 12px; }
  .section-hint { font-size: 12px; }
  .svc { padding: 14px 12px; }
  .svc-top { gap: 8px; }
  .svc-uptime { font-size: 12px; }
  .svc-uptime .uptime-label { display: block; margin: 0; text-align: right; }
  .bars { height: 20px; gap: 1.5px; }
  .board, .about, .history { margin-top: 20px; }
  .ev-date { padding: 12px; }
  .ev-day[open] { padding-bottom: 12px; }
  .ev-list { padding: 0 12px; }
  .banner-card { padding: 12px; }
  .panel-head { flex-wrap: wrap; }
  .about-body { padding: 14px 12px; }
  .about-body p { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
