/* Panel chi tiết nhà, hành trình request, bảng hệ thống/server/cảnh báo, bố cục điện thoại. */
.detail {
  position: absolute; top: calc(82px + env(safe-area-inset-top, 0px)); right: 66px; width: 350px;
  max-height: calc(100% - 82px - 340px); min-height: 220px; overflow-y: auto; z-index: 6; padding: 14px 16px 16px;
}
.detail-head { display: grid; grid-template-columns: 40px 1fr auto; gap: 11px; align-items: start; }
.detail-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); }
.detail-icon svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font: 600 10.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.detail h2 { margin: 1px 0 0; font: 600 17px/1.25 var(--font-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.detail-sub { margin: 2px 0 0; font: 12px var(--font-mono); color: var(--ink-3); overflow-wrap: anywhere; }
.detail-actions { display: flex; gap: 6px; }
.detail-actions .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.detail-actions .icon-btn svg { width: 15px; height: 15px; }
.detail-status { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--st-soft, var(--unknown-soft)); display: grid; gap: 6px; }
.detail-status p { margin: 0; font-size: 12.5px; color: var(--ink); line-height: 1.45; overflow-wrap: anywhere; }
.meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.meter .bar { height: 7px; border-radius: 4px; background: var(--unknown-soft); overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter b { font: 600 12px var(--font-mono); color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 14px 0 0; font-size: 12.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
.kv dd.mono { font: 12px var(--font-mono); }
.detail-sec { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail-sec h3 { margin: 0 0 8px; font: 600 11px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.detail-sec ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.detail-sec ul li { display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; align-items: baseline; font-size: 12.5px; }
.detail-sec ul li .dot { transform: translateY(-1px); }
.detail-sec ul li span { min-width: 0; overflow-wrap: anywhere; }
.detail-sec ul li small { font: 11.5px var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.detail-sec .note { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card-solid); border-radius: var(--r-pill); padding: 4px 10px;
  font: 500 12px var(--font-ui); cursor: pointer; color: var(--ink-2);
}
.chip:hover, .chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Hành trình request */
.journey { position: absolute; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(560px, calc(50% - 28px)); padding: 13px 16px 14px; z-index: 4; }
.journey header { display: flex; align-items: center; gap: 10px; }
.journey header b { font: 600 14px var(--font-display); white-space: nowrap; }
.journey header > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.journey-sys { font-size: 12px; color: var(--ink-3); margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.journey header .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.journey header .icon-btn svg { width: 14px; height: 14px; }
.steps { display: flex; align-items: flex-start; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.step { position: relative; flex: 1 0 86px; display: grid; justify-items: center; gap: 5px; text-align: center; padding: 0 4px; cursor: pointer; }
.step::before {
  content: ''; position: absolute; top: 15px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 3px; border-radius: 2px;
  background: var(--st, var(--line));
}
.step:first-child::before { display: none; }
.step-dot { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--st-soft); border: 2px solid var(--st); }
.step-dot svg { width: 15px; height: 15px; fill: none; stroke: var(--st); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.step b { font: 600 11.5px/1.25 var(--font-ui); color: var(--ink); max-width: 110px; overflow-wrap: anywhere; }
.step small { font: 11px var(--font-mono); color: var(--st); }
.journey footer { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.journey footer b { color: var(--ink); font-weight: 600; }
.journey footer .why { flex-basis: 100%; color: var(--st, var(--ink-2)); }

/* Bảng */
.tables { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(520px, calc(50% - 28px)); max-height: 300px; display: flex; flex-direction: column; z-index: 4; }
.tabs { display: flex; align-items: center; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 7px 10px 9px; font: 600 12.5px var(--font-ui); color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button b { font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs-note { margin-left: auto; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.table-body { overflow-y: auto; padding: 4px 6px 8px; }
.row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; text-align: left;
  padding: 8px 8px; border: 0; background: transparent; border-radius: 9px; cursor: pointer;
}
.row:hover { background: var(--hover); }
.row-main { min-width: 0; }
.row-main b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { display: block; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-metric { font: 11.5px var(--font-mono); color: var(--ink-2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.alert { grid-template-columns: 4px minmax(0, 1fr) auto; }
.row.alert .stripe { align-self: stretch; border-radius: 2px; background: var(--st); }
.row.alert .row-main small { white-space: normal; }
.group-title { padding: 10px 8px 4px; font: 600 10.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

/* Màn vừa: bỏ bớt chú thích, panel chi tiết nhường chỗ */
@media (max-width: 1180px) {
  .kpi { width: 170px; }
  .kpi-value { font-size: 19px; }
}
@media (max-width: 920px) {
  .kpis { overflow-x: auto; scrollbar-width: none; }
  .journey { width: calc(100% - 32px); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .tables { display: none; }
  .district-pick select { max-width: 150px; }
  .brand span { display: none; }
  .detail { top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: 16px; width: min(380px, calc(100% - 32px)); max-height: 60%; min-height: 0; z-index: 7; }
}
/* Điện thoại: thanh trên 2 dòng, KPI cuộn ngang, nút bản đồ nằm dưới KPI, chi tiết thành tấm trượt dưới đáy */
@media (max-width: 640px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 10px; gap: 8px; left: 10px; right: 10px; top: calc(10px + env(safe-area-inset-top, 0px)); }
  .brand { flex: 1 1 auto; }
  .brand-mark { width: 24px; height: 24px; }
  .brand b { font-size: 15px; }
  .live { margin-left: 0; height: 26px; padding: 0 9px; font-size: 11.5px; }
  .live-extra { display: none; }
  .alerts-btn { width: 34px; height: 34px; }
  .search { order: 5; flex: 1 1 40%; min-width: 0; height: 36px; max-width: none; }
  .search kbd { display: none; }
  .district-pick { order: 6; height: 36px; }
  .district-pick { min-width: 0; flex: 0 1 auto; }
  .district-pick select { max-width: 86px; }
  .kpis { top: calc(114px + env(safe-area-inset-top, 0px)); left: 10px; max-width: calc(100% - 20px); }
  .kpi { width: 150px; flex: none; padding: 9px 11px 9px 9px; }
  .kpi-icon { display: none; }
  .kpi-value { font-size: 18px; }
  .map-tools { top: calc(196px + env(safe-area-inset-top, 0px)); right: 10px; padding: 4px; gap: 4px; }
  .map-tools .icon-btn { width: 32px; height: 32px; }
  .journey { left: 10px; width: calc(100% - 20px); padding: 10px 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .journey footer span:not(.why) { display: none; }
  .step { flex-basis: 74px; }
  .step b { font-size: 11px; }
  .detail { left: 10px; right: 10px; width: auto; top: auto; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); max-height: 60%; z-index: 7; }
}
