/* Tỉ lệ thành công + trang Thống kê: thanh 2 đoạn, KPI, biểu đồ SVG, khối "job hiện tại" trên thẻ máy.
   Màu: ok = mint (--ok), lỗi = coral (--err). Chữ luôn kèm số; không dùng style="" inline (CSP). */
.tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-err { color: var(--err-soft-text); } .tone-muted { color: var(--text-3); }

/* ---------- Thanh 2 đoạn (SVG, viewBox 100 x 10 co giãn theo chiều ngang) ---------- */
.ratebar { display: block; width: 100%; border-radius: 999px; overflow: hidden; }
.ratebar-sm { height: 8px; min-width: 64px; }
.ratebar-lg { height: 14px; }
.rb-track { fill: var(--surface-3); }
.rb-err { fill: var(--err); }
.rb-ok { fill: var(--ok); stroke: var(--surface); stroke-width: 3; vector-effect: non-scaling-stroke; } /* viền = khe giữa 2 đoạn */
.rate-cell { min-width: 128px; }
.table-jobs .url-cell { max-width: 200px; }
.mainnav-link { white-space: nowrap; }
.rate-cell-inner { display: grid; grid-template-columns: minmax(48px, 1fr) 52px; align-items: center; gap: 10px; }
.rate-text { font-size: 13px; text-align: right; }
.okfail { display: inline-flex; align-items: center; gap: 6px; }
.okfail .icon { width: 13px; height: 13px; stroke-width: 2; vertical-align: -2px; margin-right: 2px; }
.okfail-sep { color: var(--text-4); }
.rate-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.rate-legend li { display: inline-flex; align-items: center; gap: 6px; }
.rate-legend strong { color: var(--text); font-weight: 500; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
.swatch-ok { background: var(--ok); } .swatch-err { background: var(--err); }

/* Chi tiết job: số lớn + thanh */
.ph-rate { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px 28px; margin: 0 0 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.ph-rate-main { display: grid; gap: 2px; }
.ph-rate-main .label { font-size: 12px; color: var(--text-3); }
.ph-rate-value { font-size: 34px; font-weight: 500; line-height: 1.1; letter-spacing: -.03em; }
.ph-rate-chart { display: grid; gap: 10px; min-width: 0; }
@media (max-width: 560px) { .ph-rate { grid-template-columns: 1fr; } }

/* Bảng danh sách job: cột tỉ lệ + dòng tổng hợp khi lọc */
.agg-line { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 14px; color: var(--text-2); }
.agg-line strong { color: var(--text); font-weight: 600; }
.toolbar-q { flex: 1 1 220px; width: auto; min-width: 0; height: 40px; font-size: 14px; }
@media (max-width: 560px) { .toolbar-q { flex-basis: 100%; } }

/* ---------- Thẻ máy: job hiện tại ---------- */
.mc-job { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid rgba(200, 242, 90, .22); border-radius: 10px; background: rgba(200, 242, 90, .04); min-width: 0; }
.mc-job-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.mc-job-rate { margin-left: auto; font-size: 14px; font-weight: 500; }
.mc-job .url-text { font-size: 12px; }
.mc-job-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.mc-queue { display: flex; align-items: center; gap: 6px; margin: 0; }
.mc-job .mc-queue { padding-top: 2px; }

/* ---------- Trang Thống kê ---------- */
.seg { display: inline-flex; max-width: 100%; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.seg-item { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 9px; color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg-item:hover { color: var(--text); background: var(--surface-2); }
.seg-item.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg-item.is-active:hover { color: var(--accent-ink); }
@media (max-width: 560px) { .seg { width: 100%; } .seg-item { flex: 1 1 0; justify-content: center; padding: 0 6px; } }
.link-full { margin-top: 8px; max-width: 100%; }
.link-full code { font-size: 14px; padding: 6px 10px; }
.stats-note { margin-top: 20px; }
.link-stats { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 13px; color: var(--accent); white-space: nowrap; }
.link-stats:hover { text-decoration: underline; text-underline-offset: 3px; }

.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; min-width: 0; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi-lead { background: linear-gradient(120deg, rgba(200, 242, 90, .07), transparent 70%); }
.kpi-label { font-size: 13px; color: var(--text-2); }
.kpi-value { font-size: 28px; font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.kpi-lead .kpi-value { font-size: 32px; }
.kpi-value.is-accent { color: var(--accent); }
.kpi-note { font-size: 12px; color: var(--text-3); line-height: 1.4; }
@media (max-width: 1100px) {
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0; border-top: 1px solid var(--line); padding: 14px; }
  .kpi:nth-child(even) { border-left: 1px solid var(--line); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi-value, .kpi-lead .kpi-value { font-size: 24px; }
}

.chart-card { margin-bottom: 0; padding: 20px 20px 12px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.chart-head .card-title { margin: 0; }
.chart-scroll { overflow-x: auto; direction: rtl; scrollbar-color: var(--line-strong) transparent; } /* rtl: nếu phải cuộn thì mở ở phía "hôm nay" */
.chart-svg { direction: ltr; display: block; width: 100%; min-width: 0; max-width: 980px; height: auto; margin: 0 auto; }
.chart-svg.chart-wide { min-width: 760px; }
}
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-tick, .chart-xlabel { fill: var(--text-3); font: 400 12px var(--font-mono); }
.chart-xlabel.is-today { fill: var(--accent); font-weight: 500; }
.bar-ok { fill: var(--ok); } .bar-err { fill: var(--err); } .bar-zero { fill: var(--line-strong); }
.chart-hit { fill: transparent; }
.chart-bar:hover .chart-hit { fill: rgba(236, 237, 230, .05); }
.chart-bar:hover .bar-ok, .chart-bar:hover .bar-err { filter: brightness(1.15); }
.chart-table { margin-top: 8px; border-top: 1px solid var(--line); padding: 8px 0; }
.chart-table summary { cursor: pointer; padding: 8px 0; color: var(--text-2); font-size: 13px; }
.chart-table summary:hover { color: var(--text); }
.chart-table[open] summary { margin-bottom: 8px; }
.table-compact th, .table-compact td { padding: 8px 14px; }
.table-compact tbody th { font-weight: 400; color: var(--text); }
.table-stats { min-width: 640px; }
.url-cell-wide { max-width: 420px; }
.url-cell-wide a.url-text { color: var(--text); }
.url-cell-wide a.url-text:hover { color: var(--accent); }
@media (max-width: 900px) { .server-time { display: none; } .topbar-inner { gap: 14px; } }
@media (max-width: 480px) { .mainnav-link { padding: 0 8px; gap: 6px; font-size: 13px; } }
@media (max-width: 560px) { /* co biểu đồ vừa khung: tăng cỡ chữ theo hệ toạ độ SVG, ẩn nhãn ngày xen kẽ */
  .chart-tick { font-size: 28px; } .chart-xlabel { font-size: 30px; }
  .chart-scroll { padding-left: 14px; } .chart-svg { overflow: visible; }
  .chart-svg:not(.chart-wide) .lbl-alt { display: none; }
  .chart-svg.chart-wide .chart-xlabel { font-size: 13px; }
  .table-stats .col-sm-hide { display: none; }
  .url-cell-wide { max-width: 170px; }
}
