/* ==========================================================================
   TBEATZ Web — 组件层
   依赖 tokens.css（语义层）与 base.css。
   纪律：本文件不得出现裸十六进制颜色，全部引用 --surface-* / --text-* /
   --line / --accent* / --state-* / --tz-space-* / --tz-radius-* 等语义变量。
   ========================================================================== */

/* ==========================================================================
   品牌 — Brand
   --------------------------------------------------------------------------
   logo PNG 本身是透明的（实测 60.8% 像素 alpha=0，0% 不透明白色），
   所以浅色模式下**不需要任何承载底**：主色 #001878 对暖砂地面 #faf9f5
   实测 14.22:1，直接放上去比套一块白板干净得多。

   深色模式下同样的蓝对 #1a1917 只有 1.17:1，对卡片面 1.03:1——等于看不见。
   解法是换一版浅色墨的 logo（Eric 2026-08-10 批准重新着色），
   而不是给它垫一块板。实测 15.29:1。
   ========================================================================== */

.tz-brand { display: inline-flex; align-items: center; gap: var(--tz-space-3); text-decoration: none; color: inherit; }

.tz-brand-carrier {
  display: inline-flex;
  align-items: center;
  /* 浅色模式：无底板、无描边、无投影。图形直接坐在页面上。 */
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--tz-radius-md);
  box-shadow: none;
}

/* 深色模式：换成浅色墨的 logo，不再加底板（Eric 2026-08-10 批准）。
   浅色墨版只替换不透明像素的颜色，**alpha 通道原样保留**——
   不是滤镜也不是反色：那两种会连带改变抗锯齿边缘的灰度，字形会发虚。
   实测浅色墨对深色地面 15.29:1、对卡片面 13.47:1。

   用 CSS content 换图而不是加第二个 <img>：一条规则覆盖全部页面，
   不必去每个页面的 HTML 里加标签，将来新页面也自动生效。
   两个选择器都要写——[data-theme] 由 JS 打，媒体查询是无 JS 回退。 */
:root[data-theme="dark"] .tz-brand-carrier img {
  content: url("/assets/brand/tbea-logo-horizontal-light.png");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tz-brand-carrier img {
    content: url("/assets/brand/tbea-logo-horizontal-light.png");
  }
}
.tz-brand-carrier img { height: 22px; width: auto; }
@media (max-width: 560px) { .tz-brand-carrier img { height: 18px; } }

.tz-brand-name { font-family: var(--tz-font-serif); font-size: var(--tz-text-lg); letter-spacing: var(--tz-tracking-tight); }
.tz-brand-sub { font-size: var(--tz-text-xs); color: var(--text-muted); }

/* ==========================================================================
   按钮 — Button
   一个视图里原则上只有一个 .is-primary 实心按钮。
   ========================================================================== */

.tz-btn {
  --_btn-bg: transparent;
  --_btn-fg: var(--text-primary);
  --_btn-border: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tz-space-2);
  padding: 9px var(--tz-space-4);
  min-height: 38px;
  background: var(--_btn-bg);
  color: var(--_btn-fg);
  border: 1px solid var(--_btn-border);
  border-radius: var(--tz-radius-md);
  font-size: var(--tz-text-sm);
  font-weight: var(--tz-weight-medium);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--tz-duration-fast) var(--tz-ease-out),
              border-color var(--tz-duration-fast) var(--tz-ease-out),
              color var(--tz-duration-fast) var(--tz-ease-out),
              transform var(--tz-duration-instant) var(--tz-ease-out);
}
.tz-btn .tz-icon { width: 16px; height: 16px; flex: none; }
@media (hover: hover) {
  .tz-btn:hover { background: var(--surface-hover); border-color: var(--text-faint); }
}
.tz-btn:active { transform: translateY(1px); }
.tz-btn[disabled], .tz-btn[aria-disabled="true"] {
  opacity: .5; pointer-events: none;
}

.tz-btn.is-primary { --_btn-bg: var(--accent); --_btn-fg: var(--text-on-accent); --_btn-border: var(--accent); }
@media (hover: hover) {
  .tz-btn.is-primary:hover { --_btn-bg: var(--accent-hover); --_btn-border: var(--accent-hover); }
}

.tz-btn.is-quiet { --_btn-bg: var(--accent-quiet); --_btn-fg: var(--accent); --_btn-border: transparent; }
@media (hover: hover) {
  .tz-btn.is-quiet:hover { --_btn-bg: var(--accent-quiet-hover); --_btn-border: transparent; }
}

.tz-btn.is-ghost { --_btn-border: transparent; --_btn-fg: var(--text-secondary); }

.tz-btn.is-danger { --_btn-fg: var(--state-bad); --_btn-border: var(--state-bad); }
@media (hover: hover) {
  .tz-btn.is-danger:hover { --_btn-bg: var(--state-bad-wash); --_btn-border: var(--state-bad); }
}

.tz-btn.is-sm { min-height: 30px; padding: 6px var(--tz-space-3); font-size: var(--tz-text-xs); }
.tz-btn.is-lg { min-height: 46px; padding: 12px var(--tz-space-6); font-size: var(--tz-text-md); }
.tz-btn.is-icon { padding: 0; width: 38px; min-height: 38px; }
.tz-btn.is-icon.is-sm { width: 30px; min-height: 30px; }

/* ==========================================================================
   卡片 — Card
   深度来自 1px 发丝线，不来自投影。这是"轻盈"的技术定义。
   ========================================================================== */

.tz-card {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--tz-radius-lg);
  padding: var(--tz-space-5);
  transition: border-color var(--tz-duration-base) var(--tz-ease-out),
              box-shadow var(--tz-duration-base) var(--tz-ease-out);
}
.tz-card.is-quiet { background: var(--surface-sunken); }
.tz-card.is-flat { border-radius: var(--tz-radius-md); padding: var(--tz-space-4); }

/* hover 效果必须锁在 hover 设备内，避免触屏误触后卡住高亮 */
@media (hover: hover) {
  .tz-card.is-interactive:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
}
.tz-card.is-interactive { cursor: pointer; }

.tz-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--tz-space-3); margin-bottom: var(--tz-space-3);
}
.tz-card-title { font-size: var(--tz-text-sm); font-weight: var(--tz-weight-semibold); color: var(--text-secondary); }
.tz-card-note { font-size: var(--tz-text-xs); color: var(--text-muted); margin-top: var(--tz-space-2); line-height: var(--tz-leading-snug); }
/* 模块里最后一条说明推到底部：同一行卡片的说明行因此互相对齐 */
.tz-module-body > .tz-card-note:last-child { margin-top: auto; padding-top: var(--tz-space-2); }

/* 色点：卡片的语义分类。不替代 badge 的实时状态。 */
.tz-dot { display: inline-block; width: 7px; height: 7px; border-radius: var(--tz-radius-full); background: var(--state-info); flex: none; }
.tz-dot[data-tone="ok"] { background: var(--state-ok); }
.tz-dot[data-tone="warn"] { background: var(--state-warn); }
.tz-dot[data-tone="bad"] { background: var(--state-bad); }
.tz-dot[data-tone="data"] { background: var(--state-data); }
.tz-dot[data-tone="aux"] { background: var(--state-aux); }
.tz-dot.is-live { position: relative; }
.tz-dot.is-live::after {
  content: ""; position: absolute; inset: -3px; border-radius: inherit;
  border: 1px solid currentColor; color: inherit; opacity: .4;
  animation: tz-pulse 2.4s var(--tz-ease-in-out) infinite;
}
@keyframes tz-pulse { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: 0; transform: scale(1.5); } }
@media (prefers-reduced-motion: reduce) { .tz-dot.is-live::after { animation: none; } }

/* ==========================================================================
   指标 — Metric
   ========================================================================== */

.tz-metric {
  font-family: var(--tz-font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  font-size: var(--tz-text-3xl);
  font-weight: var(--tz-weight-medium);
  line-height: 1.1;
  letter-spacing: var(--tz-tracking-tight);
  color: var(--text-primary);
}
.tz-metric-unit { font-size: .5em; color: var(--text-muted); margin-left: 2px; font-weight: var(--tz-weight-normal); }
.tz-metric.is-sm { font-size: var(--tz-text-xl); }

/* ==========================================================================
   徽标 — Badge（实时状态，必须带文字，不能只靠颜色）
   ========================================================================== */

.tz-badge {
  display: inline-flex; align-items: center; gap: var(--tz-space-1);
  padding: 3px var(--tz-space-2);
  border-radius: var(--tz-radius-sm);
  font-size: var(--tz-text-2xs);
  font-weight: var(--tz-weight-medium);
  line-height: 1.5;
  background: var(--surface-inset);
  color: var(--text-secondary);
  white-space: nowrap;
}
.tz-badge[data-state="ok"]   { background: var(--state-ok-wash);   color: var(--state-ok); }
.tz-badge[data-state="warn"] { background: var(--state-warn-wash); color: var(--state-warn); }
.tz-badge[data-state="bad"]  { background: var(--state-bad-wash);  color: var(--state-bad); }
.tz-badge[data-state="info"] { background: var(--state-info-wash); color: var(--state-info); }
.tz-badge[data-state="data"] { background: var(--state-data-wash); color: var(--state-data); }
.tz-badge[data-state="aux"]  { background: var(--state-aux-wash);  color: var(--state-aux); }
.tz-badge.is-mono { font-family: var(--tz-font-mono); }

/* ==========================================================================
   提示条 — Callout
   ========================================================================== */

.tz-callout {
  display: flex; gap: var(--tz-space-3);
  padding: var(--tz-space-4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--state-info);
  border-radius: var(--tz-radius-md);
  background: var(--state-info-wash);
  font-size: var(--tz-text-sm);
  color: var(--text-secondary);
}
.tz-callout[data-state="ok"]   { border-left-color: var(--state-ok);   background: var(--state-ok-wash); }
.tz-callout[data-state="warn"] { border-left-color: var(--state-warn); background: var(--state-warn-wash); }
.tz-callout[data-state="bad"]  { border-left-color: var(--state-bad);  background: var(--state-bad-wash); }
.tz-callout .tz-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.tz-callout strong { color: var(--text-primary); }

/* ==========================================================================
   进度 / 计量 — Meter
   ========================================================================== */

.tz-meter { height: 6px; background: var(--surface-track); border-radius: var(--tz-radius-full); overflow: hidden; }
.tz-meter > i {
  display: block; height: 100%; width: 0;
  background: var(--state-info); border-radius: inherit;
  transition: width var(--tz-duration-slow) var(--tz-ease-out);
}
.tz-meter[data-state="ok"] > i   { background: var(--state-ok); }
.tz-meter[data-state="warn"] > i { background: var(--state-warn); }
.tz-meter[data-state="bad"] > i  { background: var(--state-bad); }
.tz-meter[data-state="data"] > i { background: var(--state-data); }

/* ==========================================================================
   表格 — Table（数据密度在这里，不在卡片外框）
   ========================================================================== */

.tz-table { width: 100%; border-collapse: collapse; font-size: var(--tz-text-sm); }
.tz-table th {
  text-align: left; font-weight: var(--tz-weight-semibold);
  font-size: var(--tz-text-2xs); letter-spacing: var(--tz-tracking-wide);
  text-transform: uppercase; color: var(--text-muted);
  padding: var(--tz-space-2) var(--tz-space-3);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.tz-table td { padding: var(--tz-space-3); border-bottom: 1px solid var(--line); color: var(--text-secondary); vertical-align: top; }
.tz-table tr:last-child td { border-bottom: 0; }
.tz-table td.is-num { font-family: var(--tz-font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
/* 复合度量（"420.2MiB / 17.56GiB"）必须整体不折行；宽了让表格自己横向滚，
   而不是把一个数拆成三行。 */
.tz-table td.is-measure { font-family: var(--tz-font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (hover: hover) { .tz-table tbody tr:hover td { background: var(--surface-hover); } }

/* ==========================================================================
   标签页 — Tabs
   ========================================================================== */

.tz-tabs {
  display: flex; gap: var(--tz-space-1);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.tz-tabs::-webkit-scrollbar { display: none; }
.tz-tab {
  appearance: none; background: none; border: 0;
  padding: var(--tz-space-3) var(--tz-space-4);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: var(--tz-text-sm); font-weight: var(--tz-weight-medium);
  white-space: nowrap;
  transition: color var(--tz-duration-fast) var(--tz-ease-out),
              border-color var(--tz-duration-fast) var(--tz-ease-out);
}
@media (hover: hover) { .tz-tab:hover { color: var(--text-primary); } }
.tz-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ==========================================================================
   分段控件 — Segmented（主题切换、语言切换）
   ========================================================================== */

.tz-segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: var(--tz-radius-md);
  gap: 2px;
}
.tz-segmented > button {
  appearance: none; background: none; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 5px var(--tz-space-3);
  min-height: 28px;
  border-radius: var(--tz-radius-sm);
  color: var(--text-muted);
  font-size: var(--tz-text-xs); font-weight: var(--tz-weight-medium);
  white-space: nowrap;
  transition: background-color var(--tz-duration-fast) var(--tz-ease-out),
              color var(--tz-duration-fast) var(--tz-ease-out);
}
.tz-segmented > button .tz-icon { width: 14px; height: 14px; }
@media (hover: hover) { .tz-segmented > button:hover { color: var(--text-primary); } }
.tz-segmented > button[aria-pressed="true"] {
  background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--shadow-1);
}
.tz-segmented.is-icon-only > button { padding: 5px; width: 28px; }

/* ==========================================================================
   表单 — Form
   ========================================================================== */

.tz-field { display: flex; flex-direction: column; gap: var(--tz-space-2); }
.tz-label { font-size: var(--tz-text-sm); font-weight: var(--tz-weight-medium); color: var(--text-secondary); }
.tz-hint { font-size: var(--tz-text-xs); color: var(--text-muted); }

.tz-input, .tz-select, .tz-textarea {
  width: 100%;
  padding: 9px var(--tz-space-3);
  min-height: 38px;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--tz-radius-md);
  color: var(--text-primary);
  font-size: var(--tz-text-sm);
  transition: border-color var(--tz-duration-fast) var(--tz-ease-out),
              background-color var(--tz-duration-fast) var(--tz-ease-out);
}
.tz-textarea { min-height: 96px; resize: vertical; font-family: var(--tz-font-mono); line-height: var(--tz-leading-snug); }
.tz-input::placeholder, .tz-textarea::placeholder { color: var(--text-faint); }
.tz-input:hover, .tz-select:hover, .tz-textarea:hover { border-color: var(--text-faint); }
.tz-input:focus-visible, .tz-select:focus-visible, .tz-textarea:focus-visible { border-color: var(--accent); }
.tz-input[aria-invalid="true"] { border-color: var(--state-bad); }

.tz-select {
  appearance: none;
  padding-right: var(--tz-space-8);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.tz-switch {
  position: relative; display: inline-flex; align-items: center;
  width: 40px; height: 23px; flex: none;
  background: var(--surface-track); border: 1px solid var(--line-strong);
  border-radius: var(--tz-radius-full);
  transition: background-color var(--tz-duration-fast) var(--tz-ease-out),
              border-color var(--tz-duration-fast) var(--tz-ease-out);
}
.tz-switch > i {
  position: absolute; left: 2px; width: 17px; height: 17px;
  background: var(--surface-raised); border-radius: var(--tz-radius-full);
  box-shadow: var(--shadow-1);
  transition: transform var(--tz-duration-fast) var(--tz-ease-out);
}
.tz-switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.tz-switch[aria-checked="true"] > i { transform: translateX(17px); }

/* ==========================================================================
   顶栏 / 页脚 — Shell
   ========================================================================== */

.tz-topbar {
  position: sticky; top: 0; z-index: var(--tz-z-sticky);
  background: color-mix(in srgb, var(--surface-page) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(1px)) { .tz-topbar { background: var(--surface-page); } }
.tz-topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--tz-space-4); min-height: 60px;
}
.tz-topnav { display: flex; align-items: center; gap: var(--tz-space-1); }
.tz-topnav a {
  padding: var(--tz-space-2) var(--tz-space-3);
  border-radius: var(--tz-radius-sm);
  color: var(--text-secondary); text-decoration: none;
  font-size: var(--tz-text-sm); font-weight: var(--tz-weight-medium);
  transition: background-color var(--tz-duration-fast) var(--tz-ease-out),
              color var(--tz-duration-fast) var(--tz-ease-out);
}
@media (hover: hover) { .tz-topnav a:hover { background: var(--surface-hover); color: var(--text-primary); } }
.tz-topnav a[aria-current="page"] { color: var(--text-primary); background: var(--surface-inset); }
@media (max-width: 760px) { .tz-topnav { display: none; } }

.tz-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--tz-space-10);
  color: var(--text-muted);
  font-size: var(--tz-text-sm);
}

/* ==========================================================================
   图标 — Icon（本地 sprite，无外部图标库）
   ========================================================================== */

.tz-icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

/* ==========================================================================
   骨架屏 — Skeleton（数据到达前占位，避免布局跳动）
   ========================================================================== */

.tz-skeleton {
  background: linear-gradient(90deg, var(--surface-inset) 25%, var(--surface-track) 37%, var(--surface-inset) 63%);
  background-size: 400% 100%;
  border-radius: var(--tz-radius-sm);
  animation: tz-shimmer 1.4s var(--tz-ease-in-out) infinite;
  color: transparent !important;
}
@keyframes tz-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .tz-skeleton { animation: none; } }

/* ==========================================================================
   代码块 — Code
   ========================================================================== */

.tz-code {
  display: block;
  padding: var(--tz-space-4);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--tz-radius-md);
  font-family: var(--tz-font-mono);
  font-size: var(--tz-text-xs);
  line-height: var(--tz-leading-snug);
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}

/* ==========================================================================
   模块 — Module
   --------------------------------------------------------------------------
   模块是页面的装配单元。外壳由 lib/tbeatz-modules.js 生成，这里只管样式。
   ========================================================================== */

/* min-width:0 贯穿整条链：flex/grid 子项默认 min-width:auto，
   里面一张宽表格的固有宽度会一路顶到栅格轨道上，把页面撑出横向滚动。
   .tz-scroll-x 自己滚动的前提，是它被允许收缩。 */
.tz-module { display: flex; flex-direction: column; gap: var(--tz-space-3); min-width: 0; height: 100%; }
.tz-module .tz-card-head { margin-bottom: 0; min-width: 0; }
.tz-module-body { display: flex; flex-direction: column; gap: var(--tz-space-3); flex: 1; min-width: 0; }
.tz-module-tools { display: inline-flex; align-items: center; gap: var(--tz-space-2); }
.tz-module-status { font-size: var(--tz-text-2xs); color: var(--text-muted); }

.tz-module.is-expandable { cursor: pointer; }
.tz-module.is-expandable .tz-module-expand { opacity: .45; transition: opacity var(--tz-duration-fast) var(--tz-ease-out); }
@media (hover: hover) {
  .tz-module.is-expandable:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
  .tz-module.is-expandable:hover .tz-module-expand { opacity: 1; }
}
.tz-module.is-expandable:focus-visible { box-shadow: var(--focus-ring); }

.tz-module-error {
  display: flex; align-items: flex-start; gap: var(--tz-space-2);
  padding: var(--tz-space-3);
  border-radius: var(--tz-radius-sm);
  background: var(--state-warn-wash);
  color: var(--state-warn);
  font-size: var(--tz-text-xs);
}
.tz-module-error .tz-icon { width: 15px; height: 15px; margin-top: 1px; flex: none; }

/* 可点条目：模块内用来做联动筛选的行 */
.tz-pick {
  display: flex; align-items: center; gap: var(--tz-space-3);
  width: 100%; text-align: left;
  padding: var(--tz-space-2);
  margin-inline: calc(var(--tz-space-2) * -1);
  background: none; border: 0; border-radius: var(--tz-radius-sm);
  color: inherit; font-size: var(--tz-text-sm);
  transition: background-color var(--tz-duration-fast) var(--tz-ease-out);
}
@media (hover: hover) { .tz-pick:hover { background: var(--surface-hover); } }
.tz-pick[aria-pressed="true"] { background: var(--accent-quiet); }
.tz-pick > .tz-pick-main { flex: 1; min-width: 0; }
.tz-pick-tail { display: inline-flex; align-items: center; gap: var(--tz-space-2); flex: none; color: var(--text-muted); }
.tz-pick-tail .tz-icon { opacity: .4; transition: opacity var(--tz-duration-fast) var(--tz-ease-out), transform var(--tz-duration-fast) var(--tz-ease-out); }
@media (hover: hover) { .tz-pick:hover .tz-pick-tail .tz-icon { opacity: 1; transform: translateX(2px); } }
.tz-pick > .tz-pick-main > b { display: block; font-weight: var(--tz-weight-medium); }
.tz-pick > .tz-pick-main > small { color: var(--text-muted); font-size: var(--tz-text-xs); }
/* 行内的 b + small 必须分行：贴在一起读起来像一个词
   （"数据库恢复点6小时前完成"）。 */
.rowlist b + small,
.rowlist > div > div > b + small { display: block; margin-top: 3px; }

/* ==========================================================================
   详情抽屉 — Drawer
   ========================================================================== */

.tz-drawer { position: fixed; inset: 0; z-index: var(--tz-z-modal); }
.tz-drawer-scrim {
  position: absolute; inset: 0;
  background: rgba(26, 25, 23, .38);
  opacity: 0;
  transition: opacity var(--tz-duration-base) var(--tz-ease-out);
}
.tz-drawer.is-open .tz-drawer-scrim { opacity: 1; }

.tz-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface-page);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  transform: translateX(100%);
  transition: transform var(--tz-duration-base) var(--tz-ease-out);
}
.tz-drawer.is-open .tz-drawer-panel { transform: translateX(0); }

.tz-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--tz-space-3);
  padding: var(--tz-space-4) var(--tz-space-5);
  border-bottom: 1px solid var(--line);
}
.tz-drawer-head h2 { font-size: var(--tz-text-lg); font-weight: var(--tz-weight-semibold); }
.tz-drawer-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--tz-space-5);
  display: flex; flex-direction: column; gap: var(--tz-space-5);
}
body.tz-drawer-open { overflow: hidden; }

@media (max-width: 620px) {
  .tz-drawer-panel {
    width: 100vw; top: auto; height: 88vh;
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: var(--tz-radius-xl) var(--tz-radius-xl) 0 0;
    transform: translateY(100%);
  }
  .tz-drawer.is-open .tz-drawer-panel { transform: translateY(0); }
}

/* ==========================================================================
   筛选条 — Filter banner（模块联动的可见状态）
   ========================================================================== */

.tz-filter-banner {
  display: flex; align-items: center; gap: var(--tz-space-3);
  padding: var(--tz-space-2) var(--tz-space-4);
  border: 1px solid var(--accent-border);
  border-radius: var(--tz-radius-md);
  background: var(--accent-wash);
  font-size: var(--tz-text-sm);
}
.tz-filter-banner [data-role=label] { flex: 1; min-width: 0; color: var(--text-secondary); }

/* ==========================================================================
   定义列表 — 抽屉里最常用的键值展示
   ========================================================================== */

.tz-kv { display: grid; grid-template-columns: minmax(9ch, auto) 1fr; gap: var(--tz-space-2) var(--tz-space-4); font-size: var(--tz-text-sm); }
.tz-kv dt { color: var(--text-muted); font-size: var(--tz-text-xs); padding-top: 2px; }
.tz-kv dd { margin: 0; color: var(--text-secondary); word-break: break-word; }

/* ==========================================================================
   迷你图表 — Chart
   --------------------------------------------------------------------------
   纯 div 柱图 + 悬浮读数 + 时间轴。不引图表库（离线可用是硬约束）。

   悬浮命中做在整个图表区域上、按 X 坐标算最近一根柱子，
   而不是给每根柱子挂事件：柱子只有 1–3px 宽，逐根命中在实际使用中够不着。
   ========================================================================== */

.tz-chart { position: relative; }
.tz-chart-plot { display: flex; align-items: flex-end; gap: 2px; height: 44px; overflow: hidden; cursor: crosshair; }
.tz-chart-plot > i {
  flex: 1 1 0; min-width: 1px;
  background: var(--state-info); border-radius: 1px 1px 0 0; opacity: .7;
  transition: opacity var(--tz-duration-instant) var(--tz-ease-out);
}
.tz-chart-plot > i[data-tone="bad"]  { background: var(--state-bad);  opacity: 1; }
.tz-chart-plot > i[data-tone="warn"] { background: var(--state-warn); opacity: .9; }
.tz-chart-plot > i.is-hot { opacity: 1; outline: 1px solid var(--accent); outline-offset: 0; }

.tz-chart-axis {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font-size: var(--tz-text-2xs); color: var(--text-faint);
  font-family: var(--tz-font-mono);
}

.tz-chart-tip {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  transform: translateX(-50%);
  padding: var(--tz-space-2) var(--tz-space-3);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--tz-radius-sm);
  box-shadow: var(--shadow-2);
  font-size: var(--tz-text-xs);
  white-space: nowrap;
  pointer-events: none;
  z-index: var(--tz-z-dropdown);
  opacity: 0;
  transition: opacity var(--tz-duration-fast) var(--tz-ease-out);
}
.tz-chart-tip.is-visible { opacity: 1; }
.tz-chart-tip b { font-family: var(--tz-font-mono); font-variant-numeric: tabular-nums; color: var(--text-primary); }
.tz-chart-tip small { display: block; color: var(--text-muted); }

/* 键盘可达：整块图表一个焦点，左右键移动读数游标 */
.tz-chart-plot:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--tz-radius-xs); }

/* ==========================================================================
   设备与规格清单
   ========================================================================== */

.tz-spec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--tz-space-3); }
.tz-spec-list > div { min-width: 0; }
.tz-spec-list dt { font-size: var(--tz-text-2xs); color: var(--text-muted); letter-spacing: var(--tz-tracking-wide); text-transform: uppercase; }
.tz-spec-list dd { margin: 2px 0 0; font-size: var(--tz-text-sm); color: var(--text-primary); overflow-wrap: anywhere; }
.tz-spec-list dd.is-num { font-family: var(--tz-font-mono); font-variant-numeric: tabular-nums; }

/* 可点的提示条：告警行既是提示也是入口 */
.tz-callout-button {
  width: 100%; text-align: left; cursor: pointer;
  font: inherit;
  transition: border-color var(--tz-duration-fast) var(--tz-ease-out),
              box-shadow var(--tz-duration-fast) var(--tz-ease-out);
}
.tz-callout-button > .tz-icon:last-child { margin-left: auto; opacity: .4; align-self: center; }
@media (hover: hover) {
  .tz-callout-button:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
  .tz-callout-button:hover > .tz-icon:last-child { opacity: 1; }
}
