/* PetaCom Radware Lab dashboard */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6e69;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-text: #b42828;
  --meter-track: #e1e0d9;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222220;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #9a998f;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --good-text: #0ca30c;
    --critical-text: #e66767;
    --meter-track: #2c2c2a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #9a998f;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --good-text: #0ca30c;
  --critical-text: #e66767;
  --meter-track: #2c2c2a;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; margin-bottom: 8px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
strong { font-weight: 600; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-text p { margin: 0; font-size: 12px; }
/* 公司 logo 為白色透明底,固定放在深色底板上(兩種主題都一樣,不改動 logo 本身) */
.logo-plate {
  display: inline-flex; align-items: center; height: 48px; padding: 6px 12px;
  background: #1a1a19; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.10);
}
.logo-plate img { height: 36px; width: auto; display: block; }
.logo-plate .wordmark { display: none; color: #ffffff; font-weight: 700; letter-spacing: 0.02em; }
.logo-plate.no-logo img { display: none; }
.logo-plate.no-logo .wordmark { display: inline; }
.viewer { display: flex; gap: 20px; flex-wrap: wrap; margin-left: auto; font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.clock { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ghost-btn {
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  border-radius: 6px; width: 32px; height: 32px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.ghost-btn:hover { background: var(--surface-2); }

.banner {
  margin: 12px 24px 0; padding: 10px 14px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--critical); color: var(--ink);
}
.banner::before { content: "✕ "; color: var(--critical); font-weight: 700; }

main { padding: 8px 24px 24px; max-width: 1480px; margin: 0 auto; }
main.stale { opacity: 0.55; transition: opacity 0.3s; }
.section { margin-top: 20px; }
.section-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head p { margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; box-shadow: var(--shadow); min-width: 0;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-2 + .card, .charts + .card { margin-top: 12px; }
.charts { margin-top: 12px; }
.placeholder { border-style: dashed; }
.footnote { margin: 12px 0 0; }
.sub-h { font-size: 13px; margin: 16px 0 6px; }

/* probes */
.probe-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.probe {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface-2);
}
.probe-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.probe-label { font-weight: 600; }
.probe-group { font-size: 22px; font-weight: 600; margin: 6px 0 2px; word-break: break-all; }
.probe-meta { color: var(--ink-2); font-size: 12px; word-break: break-all; }

/* status badges: icon + label, never color alone */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 2px 10px 2px 8px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.badge.good .dot { background: var(--good); }
.badge.warning .dot { background: var(--warning); }
.badge.serious .dot { background: var(--serious); }
.badge.critical .dot { background: var(--critical); }
.badge.neutral .dot { background: var(--axis); }

/* certificate */
.cert-body dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 4px 0 0; }
.cert-body dt { color: var(--muted); }
.cert-body dd { margin: 0; word-break: break-all; }
.cert-cn { font-size: 20px; font-weight: 600; margin: 2px 0 6px; word-break: break-all; }
.meter { height: 8px; border-radius: 4px; background: var(--meter-track); overflow: hidden; margin: 6px 0 2px; }
.meter > span { display: block; height: 100%; border-radius: 4px; }
.meter.good > span { background: var(--good); }
.meter.warning > span { background: var(--warning); }
.meter.critical > span { background: var(--critical); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.tile-label { color: var(--ink-2); font-size: 13px; }
.tile-value { font-size: 32px; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.tile-sub { color: var(--muted); font-size: 12px; margin-top: 4px; min-height: 18px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tile-sub .k { display: inline-flex; align-items: center; gap: 5px; }
.key-line { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }

/* charts */
.chart { position: relative; height: 220px; }
.chart canvas { display: block; width: 100%; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin: -2px 0 6px; min-height: 18px; }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.chart-card h3 { margin-bottom: 4px; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 20; min-width: 140px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.tooltip .tt-time { color: var(--muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row strong { font-size: 13px; min-width: 48px; font-variant-numeric: tabular-nums; }
.tooltip .tt-row span.name { color: var(--ink-2); }

/* tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.data-table.num td:not(:first-child):not(:nth-child(2)) { text-align: right; font-variant-numeric: tabular-nums; }
.data-table.num th:not(:first-child):not(:nth-child(2)) { text-align: right; }
.node-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

.footer { padding: 12px 24px 24px; text-align: center; }

@media (max-width: 1200px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 10px 16px; gap: 12px; }
  main { padding: 8px 16px 16px; }
  .viewer { margin-left: 0; }
  .banner { margin: 12px 16px 0; }
}
