/* ============================================================
 * DORO OPERATIONS · VPS Watch · 机房值班日志 —— 2026-09-30 重新设计
 * 延续原「暖纸手账」风格：纸张底纹、绿色书脊、牛皮纸胶带、红图钉、墨线与手写标题。
 * 新增：印章状态、铅笔排线进度条、机队心电图、巡检倒计时、滑动页签墨迹、
 *       卡片入场/状态变化动画、便利贴提示、抽屉交互趋势图。
 * 状态始终「颜色 + 图标 + 文字 + 线型」表达；prefers-reduced-motion 下关闭全部动效。
 * 素材：../img/*.webp|png，字体：../fonts/handwriting.css（Ma Shan Zheng）。
 * ============================================================ */

:root {
  --paper-canvas: #f5eedf;
  --paper-sheet: #fbf7ef;
  --paper-card: #f3ebd9;
  --paper-card-subtle: rgba(255, 252, 246, 0.72);
  --paper-hover: #fffaf1;

  --ink-900: #2d2417;
  --ink-800: #3c3223;
  --ink-700: #544734;
  --ink-500: #6e604b;
  --ink-400: #8c7d66;
  --ink-300: #a89a82;
  --ink-200: #c9bea9;

  --rule-solid: rgba(60, 50, 35, 0.48);
  --rule-strong: rgba(60, 50, 35, 0.78);
  --rule-subtle: rgba(60, 50, 35, 0.18);
  --rule-faint: rgba(60, 50, 35, 0.08);

  --ok-bg: #eaf4ec;   --ok-ink: #1f563b;   --ok: #2f6f4f;
  --warn-bg: #fbf2e3; --warn-ink: #7c4e16; --warn: #b4762a;
  --crit-bg: #fae9e6; --crit-ink: #6d2f22; --crit: #a2432f;
  --unk-bg: #ede8dc;  --unk-ink: #675c4c;  --unk: #7e7362;

  --kraft: #e2cfa6;
  --pin-red: #b8412f;

  --radius-xl: 14px;
  --radius-lg: 12px;
  --radius-md: 9px;
  --radius-sm: 6px;
  --radius-pill: 9999px;
  /* 略带手绘不规则感的圆角 */
  --radius-sketch: 14px 11px 15px 10px / 11px 15px 10px 14px;
  --radius-sketch-sm: 9px 7px 10px 6px / 7px 10px 6px 9px;

  --shadow-sketch: 2px 3px 0 rgba(60, 50, 35, 0.16);
  --shadow-sketch-hover: 4px 8px 0 rgba(60, 50, 35, 0.18);
  --shadow-sketch-active: 1px 1px 0 rgba(60, 50, 35, 0.16);
  --shadow-float: 0 18px 40px -18px rgba(45, 36, 23, 0.45);

  --font-hand: "Ma Shan Zheng", "Kaiti SC", "STKaiti", "KaiTi", cursive;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", ui-monospace, Menlo, Consolas, monospace;

  --ease-spring: cubic-bezier(0.2, 0.9, 0.25, 1.25);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  --spine-width: 26px;
  --page-max-width: 1440px;
  --alerts-rail-width: 340px;
  --header-offset: 86px;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: rgba(60, 50, 35, 0.35) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper-canvas);
  background-image:
    radial-gradient(ellipse at 12% -10%, rgba(255, 250, 238, 0.9), transparent 55%),
    radial-gradient(ellipse at 110% 110%, rgba(214, 196, 160, 0.35), transparent 50%),
    url("../img/paper-bg.webp");
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, auto, 640px auto;
  background-attachment: fixed, fixed, scroll;
  color: var(--ink-800);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.drawer-open { overflow: hidden; }

::selection { background: rgba(47, 111, 79, 0.22); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(60, 50, 35, 0.28);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-track { background: transparent; }

img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-weight: 400; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important; border: 0 !important;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  display: inline-block;
  vertical-align: -0.2em;
  flex-shrink: 0;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px dashed var(--ok);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---------- 书脊与桌面装饰 ---------- */
.book-spine {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--spine-width);
  background-color: #38563f;
  background-image: url("../img/spine-green.webp");
  background-repeat: repeat-y;
  background-size: var(--spine-width) auto;
  border-right: 1.5px solid var(--rule-solid);
  box-shadow: 2px 0 8px rgba(45, 36, 23, 0.25);
  z-index: 40;
  pointer-events: none;
}

.book-spine::after {
  /* 书脊上的缝线 */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  border-left: 1.5px dashed rgba(245, 238, 223, 0.35);
}

.desk-deco {
  position: fixed;
  right: -70px;
  top: 38%;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background:
    radial-gradient(circle, transparent 57%, rgba(150, 105, 55, 0.14) 59%, rgba(150, 105, 55, 0.05) 62%, transparent 64%),
    radial-gradient(circle at 46% 54%, transparent 60%, rgba(150, 105, 55, 0.08) 62%, transparent 66%);
  transform: rotate(-18deg);
}

/* ---------- 页面容器 ---------- */
.page-wrap {
  position: relative;
  z-index: 10;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 28px 48px calc(var(--spine-width) + 28px);
}

.pushpin {
  position: absolute;
  width: 32px;
  height: auto;
  pointer-events: none;
  z-index: 30;
  filter: drop-shadow(1px 3px 2px rgba(45, 36, 23, 0.3));
}

/* ---------- 标题与墨线 ---------- */
.section-title {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  padding-bottom: 8px;
}

.section-title-text {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--ink-900);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.ink-underline {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 8px;
  object-fit: fill;
  pointer-events: none;
  opacity: 0.85;
}

/* ============================================================
 * 顶栏（桌面吸顶，滚动后变紧凑）
 * ============================================================ */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin: 0 -14px;
  padding: 16px 14px 14px;
  border-bottom: 2px solid var(--rule-solid);
  background: linear-gradient(to bottom, rgba(245, 238, 223, 0.97), rgba(245, 238, 223, 0.92));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: padding 0.3s var(--ease-soft), box-shadow 0.3s var(--ease-soft);
}

.page-header.is-scrolled {
  padding-top: 8px;
  padding-bottom: 8px;
  box-shadow: 0 10px 24px -20px rgba(45, 36, 23, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 240px;
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  padding: 5px;
  border: 2px solid var(--ok);
  border-radius: 12px;
  background-color: var(--paper-sheet);
  box-shadow: 2px 2px 0 rgba(47, 111, 79, 0.25);
  transform: rotate(-3deg);
  object-fit: contain;
  transition: transform 0.4s var(--ease-spring), width 0.3s var(--ease-soft), height 0.3s var(--ease-soft);
}

.brand:hover .brand-mark { transform: rotate(4deg) scale(1.06); }
.page-header.is-scrolled .brand-mark { width: 38px; height: 38px; }

.header-text { min-width: 0; }

.brand-eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink-400);
  text-transform: uppercase;
  line-height: 1.3;
}

.site-title {
  margin: 1px 0 0;
  font-family: var(--font-hand);
  font-size: clamp(1.7rem, 3.2vw, 2.25rem);
  color: var(--ink-900);
  line-height: 1.05;
  transition: font-size 0.3s var(--ease-soft);
}

.page-header.is-scrolled .site-title { font-size: 1.6rem; }

.header-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 连接状态：实时时圆点带涟漪 */
.conn-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 9px;
  border-radius: var(--radius-pill);
  border: 1.5px dashed currentColor;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--paper-card-subtle);
}

.conn-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.conn-dot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
}

.conn-status--live { color: var(--ok-ink); border-style: solid; }
.conn-status--live .conn-dot::after { animation: ripple 2s var(--ease-out) infinite; }
.conn-status--connecting { color: var(--unk-ink); }
.conn-status--connecting .conn-dot { animation: blink 1s steps(2, jump-none) infinite; }
.conn-status--reconnecting { color: var(--warn-ink); }
.conn-status--reconnecting .conn-dot { border-radius: 2px; animation: spin 1.4s linear infinite; }
.conn-status--offline { color: var(--crit-ink); }
.conn-status--offline .conn-dot { border-radius: 0; }

/* 主机健康徽章 */
.host-health-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.host-health-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-500);
  letter-spacing: 0.06em;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--rule-solid);
  font-size: 0.84rem;
  font-weight: 700;
  background: var(--paper-sheet);
  box-shadow: var(--shadow-sketch-active);
  white-space: nowrap;
}

.health-badge .icon { width: 0.95em; height: 0.95em; }
.health-badge--ok { color: var(--ok-ink); background: var(--ok-bg); border-color: var(--ok); }
.health-badge--warn { color: var(--warn-ink); background: var(--warn-bg); border-color: var(--warn); border-style: dashed; }
.health-badge--crit { color: var(--crit-ink); background: var(--crit-bg); border-color: var(--crit); border-width: 2px; animation: throb 1.8s var(--ease-soft) infinite; }
.health-badge--unknown { color: var(--unk-ink); background: var(--unk-bg); border-color: var(--unk); border-style: dotted; }

/* 巡检倒计时圈 */
.cycle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-500);
  white-space: nowrap;
}

.cycle-ring {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--ink-700);
  min-width: 58px;
}

.cycle-ring svg { width: 22px; height: 22px; transform: rotate(-90deg); flex-shrink: 0; }
.cycle-ring-track { fill: none; stroke: var(--rule-subtle); stroke-width: 3; }
.cycle-ring-arc {
  fill: none;
  stroke: var(--ok);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 56.55;
  stroke-dashoffset: 56.55;
  transition: stroke-dashoffset 0.5s linear;
}

.cycle-ring.is-waiting .cycle-ring-arc { stroke: var(--warn); animation: blink-soft 0.9s ease-in-out infinite; }
.last-updated { font-family: var(--font-mono); font-size: 0.78rem; }

/* ---------- 胶带按键 ---------- */
.btn-tape {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 36px;
  padding: 6px 14px;
  border: 1.5px solid var(--rule-solid);
  border-radius: var(--radius-sketch-sm);
  background-color: #ebdcb9;
  background-image: url("../img/tape-kraft.png");
  background-size: cover;
  background-position: center;
  color: var(--ink-900);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-sketch);
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s ease, filter 0.18s ease;
  user-select: none;
}

.btn-tape:hover:not(:disabled) { transform: translateY(-2px) rotate(-1deg); box-shadow: var(--shadow-sketch-hover); }
.btn-tape:active:not(:disabled) { transform: translateY(1px) scale(0.98); box-shadow: var(--shadow-sketch-active); }
.btn-tape:disabled { opacity: 0.62; cursor: not-allowed; filter: grayscale(0.25); }
.btn-tape.is-spinning .icon { animation: spin 0.9s linear infinite; }
.btn-tape.is-on .icon { color: var(--ok); }
.btn-tape.is-ringing .icon { animation: ring 1.1s var(--ease-soft); transform-origin: 50% 10%; }

.btn-tape--ghost {
  background-image: none;
  background-color: var(--paper-card-subtle);
}

.btn-tape--primary {
  min-height: 46px;
  padding: 10px 26px;
  font-size: 1.02rem;
}

/* ============================================================
 * 页签
 * ============================================================ */
.dashboard-tabs-nav {
  position: relative;
  margin: 18px 0 0;
  border-bottom: 2px solid var(--rule-solid);
}

.dashboard-tablist {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.dashboard-tablist::-webkit-scrollbar { display: none; }

.dashboard-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 16px 9px 18px;
  border: 1.5px solid var(--rule-solid);
  border-bottom: none;
  border-radius: 12px 10px 0 0;
  background-color: #ece2cd;
  color: var(--ink-700);
  font-family: var(--font-hand);
  font-size: 1.22rem;
  white-space: nowrap;
  margin-bottom: -2px;
  box-shadow: inset 0 -3px 4px rgba(60, 50, 35, 0.07);
  transition: transform 0.25s var(--ease-spring), background-color 0.2s ease, color 0.2s ease;
}

.dashboard-tab .icon { width: 1.02em; height: 1.02em; color: var(--ink-400); transition: color 0.2s ease, transform 0.35s var(--ease-spring); }
.dashboard-tab:hover { background-color: #f4ecdc; color: var(--ink-900); transform: translateY(-2px); }
.dashboard-tab:hover .icon { transform: rotate(-10deg) scale(1.1); }

.dashboard-tab[aria-selected="true"] {
  background-color: var(--paper-sheet);
  background-image: url("../img/card-paper.webp");
  background-size: 560px auto;
  color: var(--ink-900);
  border-bottom: 2.5px solid var(--paper-sheet);
  transform: translateY(-3px);
  z-index: 2;
  box-shadow: 2px -2px 0 rgba(60, 50, 35, 0.08);
}

.dashboard-tab[aria-selected="true"] .icon { color: var(--ok); }

.dashboard-tab:focus-visible { outline-offset: 2px; z-index: 3; }

.tab-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 6px;
  border-radius: var(--radius-pill);
  border: 1.5px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.5;
  background: var(--paper-sheet);
}

.tab-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tab-badge--ok { color: var(--ok-ink); }
.tab-badge--warn { color: var(--warn-ink); border-style: dashed; }
.tab-badge--warn::before { border-radius: 1px; transform: rotate(45deg); }
.tab-badge--crit { color: var(--crit-ink); background: var(--crit-bg); }
.tab-badge--crit::before { border-radius: 0; animation: blink 1s steps(2, jump-none) infinite; }
.tab-badge--unknown { color: var(--unk-ink); border-style: dotted; }
.tab-badge.is-alerting { animation: wiggle 0.7s var(--ease-soft) 2; }

/* 滑动墨迹：跟随激活页签 */
.tab-ink {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 0;
  border-radius: 3px;
  background: var(--ok);
  opacity: 0.85;
  z-index: 3;
  transition: transform 0.45s var(--ease-spring), width 0.45s var(--ease-spring);
  pointer-events: none;
  -webkit-mask: linear-gradient(90deg, transparent 0 8%, #000 18% 82%, transparent 92%);
  mask: linear-gradient(90deg, transparent 0 8%, #000 18% 82%, transparent 92%);
}

.tab-ink.no-anim { transition: none; }

.dashboard-tabpanel { position: relative; outline: none; }
.dashboard-tabpanel.is-revealing { animation: fade-up 0.45s var(--ease-out) both; }

/* ============================================================
 * Hero：标语 + 机队心跳 + 四格概览
 * ============================================================ */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 18px 32px;
  align-items: end;
  padding: 26px 4px 6px;
}

.hero-text { min-width: 0; }

.hero-eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-400);
}

.hero-title {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 1.15;
  color: var(--ink-900);
  overflow-wrap: anywhere;
}

.hero-accent-wrap {
  position: relative;
  display: inline-block;
  color: var(--ok);
  transition: color 0.4s ease;
}

.hero-accent-wrap[data-level="warn"] { color: var(--warn); }
.hero-accent-wrap[data-level="crit"] { color: var(--crit); }
.hero-accent-wrap[data-level="unknown"] { color: var(--unk); }

.hero-squiggle {
  position: absolute;
  left: -2%;
  bottom: -6px;
  width: 104%;
  height: 14px;
  overflow: visible;
  pointer-events: none;
}

.hero-squiggle path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  opacity: 0.55;
  stroke-dasharray: 420;
  stroke-dashoffset: 0;
}

.is-opening .hero-squiggle path,
.hero-accent-wrap.is-rewriting .hero-squiggle path { animation: draw 1.1s var(--ease-out) 0.35s both; }
.hero-accent-wrap.is-rewriting .hero-title-accent { animation: rewrite 0.6s var(--ease-out) both; }

.hero-sub {
  margin: 12px 0 0;
  color: var(--ink-500);
  font-size: 0.92rem;
}

/* 机队心跳：走纸心电图 */
.fleet-pulse-wrap {
  margin-top: 16px;
  padding: 8px 12px 6px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-sketch-sm);
  background:
    linear-gradient(rgba(60, 50, 35, 0.06) 1px, transparent 1px) 0 0 / 100% 10px,
    linear-gradient(90deg, rgba(60, 50, 35, 0.06) 1px, transparent 1px) 0 0 / 10px 100%,
    var(--paper-card-subtle);
}

.fleet-pulse-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.74rem;
  color: var(--ink-500);
}

.fleet-pulse-head > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: var(--ink-700);
}

.fleet-pulse { height: 44px; margin-top: 2px; }

/* 通用心电线 */
.heartbeat {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--ok);
}

.heartbeat-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.heartbeat-track { animation: beat-scroll 2.6s linear infinite; }
.heartbeat--warn { color: var(--warn); }
.heartbeat--warn .heartbeat-track { animation-duration: 1.3s; }
.heartbeat--crit { color: var(--crit); }
.heartbeat--crit .heartbeat-track { animation: none; }
.heartbeat--crit .heartbeat-line { stroke-dasharray: 6 5; }
.heartbeat-x path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.heartbeat-x { animation: blink-soft 1.2s ease-in-out infinite; }
.heartbeat--unknown { color: var(--unk); }
.heartbeat--unknown .heartbeat-track { animation: none; }
.heartbeat--unknown .heartbeat-line { stroke-dasharray: 2 6; }

/* 四格概览：钉在纸上的索引卡 */
.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.overview-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 136px;
  padding: 14px 14px 12px;
  border: 2px solid var(--rule-solid);
  border-radius: var(--radius-sketch);
  background-color: var(--paper-card);
  background-image: url("../img/card-paper.webp");
  background-size: 560px auto;
  box-shadow: var(--shadow-sketch);
  min-width: 0;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s var(--ease-spring), box-shadow 0.3s ease;
}

.overview-item:nth-child(1) { --tilt: -0.8deg; }
.overview-item:nth-child(2) { --tilt: 0.6deg; }
.overview-item:nth-child(3) { --tilt: -0.4deg; }
.overview-item:nth-child(4) { --tilt: 0.9deg; }
.overview-item:hover { transform: rotate(0deg) translateY(-3px); box-shadow: var(--shadow-sketch-hover); }

.overview-item::before {
  /* 顶部一小截胶带 */
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 46px;
  height: 14px;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--kraft) url("../img/tape-kraft.png") center / cover;
  opacity: 0.8;
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(60, 50, 35, 0.15);
}

.overview-icon,
.ov-ring {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink-500);
}

.overview-icon {
  border: 1.5px dashed var(--rule-solid);
  background: var(--paper-sheet);
}

.overview-icon .icon, .ov-ring .icon { width: 20px; height: 20px; }
.ov-ring svg { position: absolute; inset: 0; width: 44px; height: 44px; transform: rotate(-90deg); }
.ov-ring-track { fill: var(--paper-sheet); stroke: var(--rule-subtle); stroke-width: 4; }
.ov-ring-arc {
  fill: none;
  stroke: var(--ok);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 113.1;
  stroke-dashoffset: calc(113.1 * (1 - var(--ratio, 0)));
  transition: stroke-dashoffset 1.1s var(--ease-out);
}
.ov-ring .icon { position: relative; color: var(--ink-700); }

.overview-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-500);
  white-space: nowrap;
}

.overview-num {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  font-family: var(--font-hand);
  font-size: 3rem;
  line-height: 1;
  color: var(--ink-900);
  transform-origin: left bottom;
}

.overview-sub {
  font-size: 0.72rem;
  color: var(--ink-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-item--ok .overview-num,
.overview-item--ok .overview-icon { color: var(--ok); }
.overview-item--ok .overview-icon { border-color: var(--ok); background: var(--ok-bg); }
.overview-item--warn .overview-num { color: var(--warn); }
.overview-item--crit .overview-num { color: var(--crit); }
.overview-item--warn.is-lit .overview-icon { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.overview-item--crit.is-lit { border-color: var(--crit); animation: lit 1.8s var(--ease-soft) infinite; }
.overview-item--crit.is-lit .overview-icon { color: var(--crit); border-style: solid; border-color: var(--crit); background: var(--crit-bg); }
.overview-item--warn.is-lit { border-color: var(--warn); border-style: dashed; }

.is-bumped { animation: bump 0.6s var(--ease-spring); }

/* ============================================================
 * 主体：主机卡双列 + 告警栏
 * ============================================================ */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--alerts-rail-width);
  gap: 26px;
  align-items: start;
  margin-top: 26px;
}

.hosts-column { min-width: 0; }

.server-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.server-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 13px 19px;
  border: 2px solid var(--rule-solid);
  border-radius: var(--radius-sketch);
  background-color: var(--paper-card);
  background-image: url("../img/card-paper.webp");
  background-size: 560px auto;
  box-shadow: var(--shadow-sketch);
  min-width: 0;
  cursor: pointer;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease, border-color 0.3s ease;
}

/* 左侧状态条 */
.server-card::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 14px;
  bottom: 14px;
  width: 6px;
  border-radius: 0 4px 4px 0;
  background: var(--unk);
  transition: background-color 0.4s ease;
}

.server-card--ok::before { background: var(--ok); }
.server-card--warn::before { background: repeating-linear-gradient(180deg, var(--warn) 0 8px, transparent 8px 12px); }
.server-card--crit::before { background: var(--crit); width: 8px; }
.server-card--warn { border-style: dashed; border-color: var(--warn); }
.server-card--crit { border-color: var(--crit); border-width: 2.5px; animation: alarm-glow 2.2s var(--ease-soft) infinite; }
.server-card--stale { background-color: #eee6d4; }

.server-card:hover,
.server-card:focus-visible {
  transform: translateY(-4px) rotate(-0.35deg);
  box-shadow: var(--shadow-sketch-hover);
}

.card-tape {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 18px;
  transform: translateX(-50%) translateY(-6px) rotate(2deg);
  background: var(--kraft) url("../img/tape-kraft.png") center / cover;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(60, 50, 35, 0.2);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.35s var(--ease-spring);
  pointer-events: none;
}

.server-card:hover .card-tape,
.server-card:focus-visible .card-tape { opacity: 0.9; transform: translateX(-50%) translateY(0) rotate(-2deg); }

.card-seal {
  position: absolute;
  right: 18px;
  top: 58px;
  padding: 2px 12px;
  border: 3px double var(--crit);
  border-radius: 8px;
  color: var(--crit);
  font-family: var(--font-hand);
  font-size: 1.6rem;
  letter-spacing: 0.2em;
  line-height: 1.2;
  opacity: 0.32;
  transform: rotate(-14deg);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-provider {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-400);
  letter-spacing: 0.04em;
}

.card-provider span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-provider .icon { width: 0.95em; height: 0.95em; }

.card-title {
  margin: -2px 0 0;
  font-family: var(--font-hand);
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--ink-900);
  overflow-wrap: anywhere;
}

.card-role {
  margin: -8px 0 0;
  font-size: 0.8rem;
  color: var(--ink-500);
  overflow-wrap: anywhere;
}

/* 印章式状态 */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.32em;
  flex-shrink: 0;
  padding: 3px 9px 3px 7px;
  border: 2px solid currentColor;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.3;
  background: var(--paper-sheet);
  box-shadow: inset 0 0 0 1.5px var(--paper-sheet), inset 0 0 0 2.5px currentColor;
  transform: rotate(-3deg);
  white-space: nowrap;
}

.stamp .icon { width: 1em; height: 1em; }
.stamp--ok { color: var(--ok-ink); background-color: var(--ok-bg); }
.stamp--warn { color: var(--warn-ink); background-color: var(--warn-bg); border-style: dashed; box-shadow: none; }
.stamp--crit { color: var(--crit-ink); background-color: var(--crit-bg); transform: rotate(-5deg) scale(1.05); }
.stamp--unknown { color: var(--unk-ink); background-color: var(--unk-bg); border-style: dotted; box-shadow: none; }

/* 台账行 */
.card-ledger {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  margin: 0;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-md);
  background: var(--paper-card-subtle);
  overflow: hidden;
}

.card-ledger > div {
  min-width: 0;
  padding: 6px 10px;
  border-left: 1.5px dashed var(--rule-subtle);
}

.card-ledger > div:first-child { border-left: none; }
.card-ledger dt { font-size: 0.68rem; color: var(--ink-400); }
.card-ledger dd {
  margin: 1px 0 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 指标：铅笔排线进度条 */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
}

.metric { min-width: 0; }

/* 按卡片自身宽度决定指标排布：窄卡 2×2，避免「内核不可回收」等标签被截断 */
.server-card { container-type: inline-size; }
@container (max-width: 520px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px 14px; }
}

.metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.metric-name {
  font-size: 0.74rem;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value { font-size: 0.9rem; font-weight: 700; white-space: nowrap; color: var(--ink-900); }
.metric--ok .metric-value { color: var(--ok-ink); }
.metric--warn .metric-value { color: var(--warn-ink); }
.metric--crit .metric-value { color: var(--crit-ink); }

.metric-bar {
  --fill: var(--ok);
  height: 9px;
  margin-top: 5px;
  border: 1.5px solid var(--rule-solid);
  border-radius: 5px 3px 4px 3px / 3px 5px 3px 4px;
  background: var(--paper-sheet);
  overflow: hidden;
}

.metric-bar--thin { height: 7px; margin-top: 6px; }
.metric--warn .metric-bar, .usage-panel--warn .metric-bar { --fill: var(--warn); }
.metric--crit .metric-bar, .usage-panel--crit .metric-bar { --fill: var(--crit); }
.metric--unknown .metric-bar, .usage-panel--unknown .metric-bar { --fill: var(--unk); }

.metric-bar-fill {
  display: block;
  height: 100%;
  background-color: var(--fill);
  background-image: repeating-linear-gradient(-45deg, transparent 0 3px, rgba(255, 250, 238, 0.4) 3px 5px);
  border-right: 1.5px solid rgba(45, 36, 23, 0.35);
  transform-origin: left center;
  transition: width 0.9s var(--ease-out), background-color 0.4s ease;
}

.metric--warn .metric-bar-fill { background-image: repeating-linear-gradient(45deg, transparent 0 2px, rgba(255, 250, 238, 0.5) 2px 4px); }
.metric--crit .metric-bar-fill { background-image: repeating-linear-gradient(90deg, transparent 0 3px, rgba(255, 250, 238, 0.45) 3px 4px); }

.metric-sub {
  margin-top: 3px;
  font-size: 0.68rem;
  color: var(--ink-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 卡片内 CPU 走势 */
.mini-trend {
  --line: var(--ok);
  padding: 6px 10px 4px;
  border: 1.5px dashed var(--rule-subtle);
  border-radius: var(--radius-md);
  background:
    linear-gradient(rgba(60, 50, 35, 0.05) 1px, transparent 1px) 0 0 / 100% 9px,
    rgba(255, 252, 246, 0.5);
}

.mini-trend--warn { --line: var(--warn); }
.mini-trend--crit { --line: var(--crit); }
.mini-trend--unknown { --line: var(--unk); }

.mini-trend-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--ink-500);
}

.mini-trend-head span:first-child { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.mini-trend-head .icon { width: 0.95em; height: 0.95em; }
.mini-trend-svg { display: block; width: 100%; height: 34px; margin-top: 2px; overflow: visible; }
.mini-trend-line { fill: none; stroke: var(--line); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mini-trend-area { fill: var(--line); opacity: 0.12; }
.mini-trend--empty { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ink-400); padding: 8px 10px; }

/* 流量与合约：收据样式 */
.usage-panel {
  position: relative;
  padding: 9px 11px 8px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 240, 0.7);
  -webkit-mask: radial-gradient(circle 4px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 4px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 4px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle 4px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
}

.usage-head, .usage-line, .usage-facts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.usage-title { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 700; color: var(--ink-800); }
.usage-title .icon { width: 1em; height: 1em; }

.usage-source {
  padding: 0 7px;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  color: var(--ok-ink);
  font-size: 0.66rem;
  font-weight: 700;
}

.usage-panel--warn .usage-source { color: var(--warn-ink); }
.usage-panel--crit .usage-source { color: var(--crit-ink); }
.usage-panel--unknown .usage-source { color: var(--unk-ink); border-style: dotted; }

.usage-line { margin-top: 6px; font-size: 0.72rem; color: var(--ink-500); justify-content: flex-start; flex-wrap: wrap; }
.usage-line strong { color: var(--ink-900); font-size: 0.78rem; overflow-wrap: anywhere; }
.usage-line em { margin-left: auto; font-style: normal; font-size: 0.72rem; font-weight: 700; color: var(--ink-700); }

.usage-facts { margin-top: 6px; font-size: 0.7rem; color: var(--ink-500); justify-content: flex-start; flex-wrap: wrap; gap: 4px 14px; }
.usage-facts span { display: inline-flex; align-items: center; gap: 4px; }
.usage-facts .icon { width: 0.9em; height: 0.9em; color: var(--ink-400); }
.usage-facts b { color: var(--ink-800); font-weight: 700; }
.usage-note { margin: 4px 0 0; font-size: 0.64rem; color: var(--ink-400); line-height: 1.35; overflow-wrap: anywhere; }

/* 服务便签 */
.services-row { border-top: 1.5px dashed var(--rule-subtle); padding-top: 10px; }

.services-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-500);
}

.services-count { color: var(--ok-ink); }
.services-count.is-short { color: var(--crit-ink); }

.service-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.service-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  max-width: 100%;
  padding: 3px 10px 3px 8px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  background: var(--paper-card-subtle);
  color: var(--ink-800);
  transition: transform 0.2s var(--ease-spring);
}

.service-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-chip .icon { width: 0.95em; height: 0.95em; }
.service-chip--ok { border-color: rgba(47, 111, 79, 0.55); color: var(--ok-ink); }
.service-chip--ok .icon { color: var(--ok); }
.service-chip--crit { border-color: var(--crit); border-style: dashed; color: var(--crit-ink); background: var(--crit-bg); animation: wiggle 2.8s var(--ease-soft) infinite; }
.service-chip--unknown { border-color: var(--unk); border-style: dotted; color: var(--unk-ink); background: var(--unk-bg); }
.service-none { font-size: 0.76rem; color: var(--ink-400); }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1.5px dashed var(--rule-subtle);
  font-size: 0.74rem;
  color: var(--ink-400);
}

.card-foot-status, .card-foot-time { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.card-foot-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot .icon { width: 0.95em; height: 0.95em; }
.card-foot-time { flex-shrink: 0; }
.server-card--ok .card-foot-status { color: var(--ok-ink); font-weight: 700; }
.server-card--warn .card-foot-status { color: var(--warn-ink); font-weight: 700; }
.server-card--crit .card-foot-status { color: var(--crit-ink); font-weight: 800; }

/* 骨架：铅笔排线扫光 */
.skeleton {
  position: relative;
  border: 2px dashed var(--rule-subtle);
  border-radius: var(--radius-sketch);
  background:
    linear-gradient(100deg, transparent 20%, rgba(255, 252, 244, 0.85) 45%, transparent 70%) 0 0 / 220% 100%,
    repeating-linear-gradient(-45deg, rgba(60, 50, 35, 0.05) 0 2px, transparent 2px 9px),
    var(--paper-card-subtle);
  animation: shimmer 1.6s linear infinite;
}

.skeleton--host { min-height: 360px; }
.skeleton--bot { min-height: 150px; }
.skeleton--site { min-height: 190px; }

/* ---------- 告警栏 ---------- */
.alerts-column {
  position: sticky;
  top: calc(var(--header-offset) + 12px);
  min-width: 0;
  padding: 18px 16px 16px;
  border: 2px solid var(--rule-solid);
  border-radius: var(--radius-sketch);
  background-color: var(--paper-card);
  background-image: url("../img/card-paper.webp");
  background-size: 560px auto;
  box-shadow: var(--shadow-sketch);
  max-height: calc(100vh - var(--header-offset) - 28px);
  overflow-y: auto;
  transition: border-color 0.4s ease;
}

.alerts-column.has-active { border-color: var(--crit); }
.alerts-column .pushpin { top: -12px; right: 16px; }
.alerts-column .section-title { margin-bottom: 6px; }

.alert-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--crit);
  color: #fff8ef;
  font-size: 0.78rem;
  font-weight: 800;
  animation: throb 1.6s var(--ease-soft) infinite;
}

.alert-policy { margin: 0 0 12px; font-size: 0.8rem; color: var(--ink-500); line-height: 1.45; }

.all-clear {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--ok);
  border-radius: var(--radius-sketch-sm);
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.all-clear-doodle { width: 46px; height: 46px; flex-shrink: 0; color: var(--ok); }
.all-clear-doodle path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.doodle-circle { stroke-width: 2.4; stroke-dasharray: 190; stroke-dashoffset: 0; opacity: 0.6; }
.doodle-check { stroke-width: 4; stroke-dasharray: 60; stroke-dashoffset: 0; }
.is-opening .doodle-circle, .all-clear.is-drawing .doodle-circle { animation: draw-190 0.9s var(--ease-out) 0.4s both; }
.is-opening .doodle-check, .all-clear.is-drawing .doodle-check { animation: draw-60 0.5s var(--ease-out) 1.1s both; }
.all-clear strong { display: block; font-family: var(--font-hand); font-size: 1.2rem; line-height: 1.2; }
.all-clear span { display: block; font-size: 0.78rem; opacity: 0.85; }

.alert-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-note {
  position: relative;
  padding: 10px 12px 10px 14px;
  border: 1.5px solid var(--rule-solid);
  border-radius: 3px 3px 12px 3px;
  background: #fff6c9;
  box-shadow: 2px 3px 0 rgba(60, 50, 35, 0.14);
  transform: rotate(-0.6deg);
}

.alert-note:nth-child(even) { transform: rotate(0.5deg); }
.alert-note--crit { background: #fde2dc; border-color: var(--crit); border-width: 2px; }
.alert-note--warn { background: #fdf0d2; border-color: var(--warn); border-style: dashed; }

.alert-note::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 40px;
  height: 12px;
  transform: translateX(-50%) rotate(-4deg);
  background: var(--kraft) url("../img/tape-kraft.png") center / cover;
  opacity: 0.85;
  border-radius: 2px;
}

.alert-note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.alert-note-head > .icon { width: 1.1em; height: 1.1em; }
.alert-note--crit .alert-note-head > .icon { color: var(--crit); animation: blink-soft 1.2s ease-in-out infinite; }
.alert-note--warn .alert-note-head > .icon { color: var(--warn); }
.alert-note-alias { font-weight: 800; font-size: 0.9rem; color: var(--ink-900); }

.alert-note-kind {
  padding: 0 7px;
  border: 1.5px solid currentColor;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 800;
}

.alert-note--crit .alert-note-kind { color: var(--crit-ink); }
.alert-note--warn .alert-note-kind { color: var(--warn-ink); border-style: dashed; }
.alert-note-time { margin-left: auto; font-size: 0.7rem; color: var(--ink-500); }
.alert-note-msg { margin: 5px 0 0; font-size: 0.8rem; color: var(--ink-800); line-height: 1.4; overflow-wrap: anywhere; }
.alert-note-since { display: flex; align-items: center; gap: 4px; margin: 4px 0 0; font-size: 0.7rem; color: var(--ink-500); }
.alert-note-since .icon { width: 0.9em; height: 0.9em; }

.section-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 10px;
  font-family: var(--font-hand);
  font-size: 1.22rem;
  color: var(--ink-900);
}

.section-subtitle .icon { width: 0.9em; height: 0.9em; color: var(--ink-400); }

#alert-recovered { border-top: 1.5px dashed var(--rule-subtle); padding-top: 12px; }

/* 最近恢复：时间线 */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  border-left: 2px dashed var(--rule-subtle);
}

.timeline-item { position: relative; padding: 0 0 12px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -18px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ok);
  background: var(--paper-sheet);
}

.timeline-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--ok);
}

.timeline-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.timeline-alias { font-weight: 800; font-size: 0.84rem; color: var(--ink-900); }
.timeline-kind { display: inline-flex; align-items: center; gap: 3px; font-size: 0.7rem; color: var(--ink-500); }
.timeline-kind .icon { width: 0.9em; height: 0.9em; }
.timeline-item--crit .timeline-kind .icon { color: var(--crit); }
.timeline-item--warn .timeline-kind .icon { color: var(--warn); }
.timeline-time { margin-left: auto; font-size: 0.7rem; color: var(--ink-400); }
.timeline-msg { margin: 2px 0 0; font-size: 0.76rem; color: var(--ink-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-dur { margin: 1px 0 0; font-size: 0.68rem; color: var(--ok-ink); }

/* ============================================================
 * 通用面板卡（机器人 / 网站）
 * ============================================================ */
.panel-card {
  position: relative;
  margin-top: 22px;
  padding: 20px 22px 20px;
  border: 2px solid var(--rule-solid);
  border-radius: var(--radius-sketch);
  background-color: var(--paper-card);
  background-image: url("../img/card-paper.webp");
  background-size: 560px auto;
  box-shadow: var(--shadow-sketch);
}

.panel-card > .pushpin { top: -13px; left: 26px; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1.5px dashed var(--rule-subtle);
}

.panel-head .section-title { margin-bottom: 4px; }
.panel-desc { margin: 0; font-size: 0.82rem; color: var(--ink-500); line-height: 1.45; overflow-wrap: anywhere; }
.panel-desc b { color: var(--ink-800); }

.stat-pills { display: flex; flex-wrap: wrap; gap: 6px 8px; }

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--rule-subtle);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--paper-sheet);
  color: var(--ink-700);
  white-space: nowrap;
  box-shadow: 1px 1px 0 rgba(60, 50, 35, 0.08);
}

.stat-pill .icon { width: 0.95em; height: 0.95em; }
.stat-pill .mono { display: inline-block; font-size: 0.92rem; }
.stat-pill--total { border-color: var(--rule-solid); color: var(--ink-900); }
.stat-pill--ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok-ink); }
.stat-pill--warn { background: var(--warn-bg); border-color: var(--warn); border-style: dashed; color: var(--warn-ink); }
.stat-pill--crit { background: var(--crit-bg); border-color: var(--crit); color: var(--crit-ink); }
.stat-pill--unknown { background: var(--unk-bg); border-color: var(--unk); border-style: dotted; color: var(--unk-ink); }

/* ---------- 机器人卡 ---------- */
.bot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 14px 10px;
  border: 1.5px solid var(--rule-solid);
  border-radius: var(--radius-sketch-sm);
  background-color: var(--paper-sheet);
  box-shadow: 2px 3px 0 rgba(60, 50, 35, 0.12);
  cursor: pointer;
  min-width: 0;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}

.bot-card:hover, .bot-card:focus-visible { transform: translateY(-3px) rotate(-0.4deg); box-shadow: var(--shadow-sketch-hover); }
.bot-card--ok { border-color: rgba(47, 111, 79, 0.7); }
.bot-card--crit { border-color: var(--crit); border-width: 2px; background-color: #fdf1ee; animation: alarm-glow 2.2s var(--ease-soft) infinite; }
.bot-card--unknown, .bot-card--stale { border-color: var(--unk); border-style: dotted; background-color: #f3eee3; }

.bot-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.bot-name-group { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bot-name { font-family: var(--font-hand); font-size: 1.4rem; line-height: 1.1; color: var(--ink-900); overflow-wrap: anywhere; }
.bot-host { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; color: var(--ink-500); min-width: 0; }
.bot-host span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-host .icon { width: 0.9em; height: 0.9em; }

.bot-pulse {
  height: 36px;
  padding: 2px 0;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(rgba(60, 50, 35, 0.05) 1px, transparent 1px) 0 0 / 100% 8px,
    linear-gradient(90deg, rgba(60, 50, 35, 0.05) 1px, transparent 1px) 0 0 / 8px 100%;
}

.bot-card:nth-child(3n+2) .heartbeat-track { animation-delay: -0.9s; }
.bot-card:nth-child(3n) .heartbeat-track { animation-delay: -1.7s; }

.bot-probe {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--rule-subtle);
  border-radius: var(--radius-sm);
  background: var(--paper-card-subtle);
  font-size: 0.74rem;
  color: var(--ink-700);
  min-width: 0;
}

.bot-probe span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-probe .icon { width: 0.95em; height: 0.95em; color: var(--ink-400); }

.bot-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed var(--rule-subtle);
  font-size: 0.72rem;
  color: var(--ink-400);
}

.bot-fresh { font-weight: 700; color: var(--ok-ink); }
.bot-card--crit .bot-fresh { color: var(--crit-ink); }
.bot-fresh--stale, .bot-card--unknown .bot-fresh { color: var(--warn-ink); }
.bot-time { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bot-time .icon { width: 0.9em; height: 0.9em; }

/* ---------- 网站 ---------- */
.websites-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  grid-template-areas: "search status" "group group";
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-md);
  background: var(--paper-card-subtle);
}

.search-box { grid-area: search; position: relative; display: flex; align-items: center; min-width: 0; }
#site-filter-status { grid-area: status; }
#site-filter-group { grid-area: group; }

.search-box .icon { position: absolute; left: 11px; width: 1rem; height: 1rem; color: var(--ink-400); pointer-events: none; }

.search-input {
  width: 100%;
  min-height: 40px;
  padding: 7px 40px 7px 34px;
  border: 1.5px solid var(--rule-solid);
  border-radius: var(--radius-sketch-sm);
  background: var(--paper-sheet);
  color: var(--ink-900);
  font-size: 0.86rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder { color: var(--ink-300); }
.search-input:focus-visible { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(47, 111, 79, 0.15); outline-offset: 2px; }

.search-clear {
  position: absolute;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--ink-400);
  transition: color 0.2s ease, transform 0.3s var(--ease-spring);
}

.search-clear .icon { position: static; }
.search-clear:hover { color: var(--ink-900); transform: rotate(90deg); }

.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.chip-row-label { flex-shrink: 0; font-size: 0.74rem; font-weight: 700; color: var(--ink-500); margin-right: 2px; white-space: nowrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 11px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-pill);
  background: var(--paper-sheet);
  color: var(--ink-700);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-spring), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chip .icon { width: 0.95em; height: 0.95em; }
.chip:hover { transform: translateY(-1px); border-color: var(--rule-solid); }
.chip[aria-pressed="true"] { background: var(--ink-800); border-color: var(--ink-800); color: var(--paper-sheet); box-shadow: 1px 2px 0 rgba(60, 50, 35, 0.2); }
.chip-count { font-family: var(--font-mono); font-size: 0.72rem; opacity: 0.75; }
.chip--ok .icon { color: var(--ok); }
.chip--warn .icon { color: var(--warn); }
.chip--crit .icon { color: var(--crit); }
.chip--unknown .icon { color: var(--unk); }
.chip[aria-pressed="true"] .icon { color: inherit; }

.site-group { margin-top: 16px; }

.site-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--ink-900);
}

.site-group-title .icon { width: 0.85em; height: 0.85em; color: var(--ok); }
.site-group-title small { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-400); }
.site-group-title::after { content: ""; flex: 1; border-top: 1.5px dashed var(--rule-subtle); margin-left: 6px; }

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.site-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 14px 10px;
  border: 1.5px solid var(--rule-solid);
  border-radius: var(--radius-sketch-sm);
  background: var(--paper-sheet);
  box-shadow: 2px 3px 0 rgba(60, 50, 35, 0.1);
  min-width: 0;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}

.site-card:hover { transform: translateY(-3px) rotate(-0.3deg); box-shadow: var(--shadow-sketch-hover); }
.site-card--ok { border-color: rgba(47, 111, 79, 0.6); }
.site-card--warn { border-color: var(--warn); border-style: dashed; background: #fdf7ea; }
.site-card--crit { border-color: var(--crit); border-width: 2px; background: #fdf1ee; animation: alarm-glow 2.2s var(--ease-soft) infinite; }
.site-card--unknown { border-color: var(--unk); border-style: dotted; background: #f3eee3; }
.site-card--stale { opacity: 0.9; }

.site-card-head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }

.site-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink-700);
  border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%;
  background: var(--paper-card);
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--ink-800);
  transform: rotate(-6deg);
  transition: transform 0.4s var(--ease-spring);
}

.site-card:hover .site-avatar { transform: rotate(6deg) scale(1.06); }
.site-card--ok .site-avatar { border-color: var(--ok); color: var(--ok-ink); }
.site-card--crit .site-avatar { border-color: var(--crit); color: var(--crit-ink); }
.site-card--warn .site-avatar { border-color: var(--warn); color: var(--warn-ink); border-style: dashed; }

.site-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.site-name { margin: 0; font-family: var(--font-hand); font-size: 1.3rem; line-height: 1.15; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.site-domain {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  width: fit-content;
  font-size: 0.72rem;
  color: var(--ink-500);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-domain-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.site-ext { width: 0.9em; height: 0.9em; transition: transform 0.25s var(--ease-spring); }
a.site-domain:hover { color: var(--ok-ink); border-bottom-color: currentColor; }
a.site-domain:hover .site-ext { transform: translate(2px, -2px); }

.site-avail {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--rule-subtle);
  border-radius: var(--radius-sm);
  background: var(--paper-card-subtle);
}

.site-avail-main { display: flex; flex-direction: column; min-width: 0; }
.site-avail-num { font-size: 1.15rem; font-weight: 800; color: var(--ink-900); line-height: 1.1; }
.site-avail-label { font-size: 0.66rem; color: var(--ink-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-avail-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 0.7rem; color: var(--ink-500); white-space: nowrap; }
.lat { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.lat .icon { width: 0.9em; height: 0.9em; }
.lat--ok { color: var(--ok-ink); }
.lat--warn { color: var(--warn-ink); }
.lat--crit { color: var(--crit-ink); }

.site-msg {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 4px 8px;
  border: 1px dashed var(--crit);
  border-radius: var(--radius-sm);
  background: rgba(250, 233, 230, 0.8);
  font-size: 0.72rem;
  color: var(--crit-ink);
  min-width: 0;
}

.site-card--unknown .site-msg { border-color: var(--unk); background: var(--unk-bg); color: var(--unk-ink); }
.site-card--warn .site-msg { border-color: var(--warn); background: var(--warn-bg); color: var(--warn-ink); }
.site-msg .icon { width: 0.95em; height: 0.95em; }
.site-msg span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.site-history { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.site-history-head { display: flex; justify-content: space-between; font-size: 0.66rem; color: var(--ink-400); }

.site-history-strip {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 2px;
  height: 14px;
  align-items: end;
}

.site-history-cell {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--ok);
  transform-origin: bottom;
  transition: background-color 0.3s ease, height 0.3s ease;
}

.site-history-cell--online { background: var(--ok); opacity: 0.85; }
.site-history-cell--offline { background: var(--crit); height: 100%; }
.site-history-cell--unknown { background: repeating-linear-gradient(-45deg, var(--unk) 0 2px, transparent 2px 4px); height: 60%; }
.site-history-cell--pad { background: var(--rule-faint); height: 40%; }
.site-history-cell:last-child { box-shadow: 0 0 0 1.5px var(--paper-sheet), 0 0 0 3px currentColor; color: var(--rule-solid); }
.site-history-empty { font-size: 0.7rem; color: var(--ink-400); font-style: italic; }

.site-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--rule-subtle);
  font-size: 0.68rem;
  color: var(--ink-400);
}

.site-foot span:first-child { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-foot .icon { width: 0.9em; height: 0.9em; }
.site-foot b { color: var(--ink-700); font-weight: 700; }

/* ---------- 空状态 ---------- */
.empty-state {
  margin-top: 14px;
  padding: 26px 18px;
  text-align: center;
  color: var(--ink-400);
  border: 1.5px dashed var(--rule-subtle);
  border-radius: var(--radius-sketch);
  background: var(--paper-card-subtle);
}

.empty-state .icon { width: 2rem; height: 2rem; color: var(--ink-300); }
.empty-state p { margin: 6px 0 0; font-size: 0.86rem; }

/* ---------- 页脚 ---------- */
.page-footer {
  margin-top: 44px;
  padding-top: 16px;
  border-top: 1.5px dashed var(--rule-subtle);
  text-align: center;
  font-size: 0.76rem;
  color: var(--ink-400);
}

.footer-dot { margin: 0 8px; }

/* ============================================================
 * 启动与登录
 * ============================================================ */
.app-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: var(--paper-canvas);
  background-image: url("../img/paper-bg.webp");
  background-size: 640px auto;
}

.gate-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 40px 30px 30px;
  text-align: center;
  border: 2px solid var(--rule-solid);
  border-radius: var(--radius-sketch);
  background-color: var(--paper-card);
  background-image: url("../img/card-paper.webp");
  background-size: 560px auto;
  box-shadow: var(--shadow-sketch-hover), var(--shadow-float);
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotate(-1deg);
  animation: gate-in 0.7s var(--ease-spring) both;
}

.gate-card.is-shaking { animation: shake 0.5s var(--ease-soft); }
.gate-card .pushpin { top: -16px; left: 50%; margin-left: -16px; animation: pin-drop 0.6s var(--ease-spring) 0.35s both; }

.gate-tape {
  position: absolute;
  width: 82px;
  height: 20px;
  background: var(--kraft) url("../img/tape-kraft.png") center / cover;
  opacity: 0.85;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(60, 50, 35, 0.18);
  animation: fade-in 0.4s ease 0.5s both;
}

.gate-tape--l { left: -22px; top: 14px; transform: rotate(-38deg); }
.gate-tape--r { right: -22px; bottom: 18px; transform: rotate(-38deg); }

.gate-card .brand-mark { width: 56px; height: 56px; margin-bottom: 12px; }
.gate-card .site-title { font-size: 2.4rem; }

.gate-pulse { width: 200px; height: 40px; margin: 14px 0 2px; }

.gate-note { margin: 12px 0 18px; color: var(--ink-500); font-size: 0.92rem; }

.gate-dots::after {
  content: "…";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
  overflow: hidden;
  vertical-align: bottom;
}

.gate-field { position: relative; width: 100%; margin-bottom: 12px; }
.gate-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-400); }

.gate-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--rule-solid);
  border-radius: var(--radius-sketch-sm);
  background: var(--paper-sheet);
  color: var(--ink-900);
  font-size: 1rem;
  letter-spacing: 0.1em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gate-input::placeholder { letter-spacing: 0.02em; color: var(--ink-300); }
.gate-input:focus-visible { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(47, 111, 79, 0.16); outline-offset: 2px; }

.gate-error { margin: -2px 0 12px; font-size: 0.84rem; color: var(--crit-ink); font-weight: 700; }
#login-submit { width: 100%; }

/* ============================================================
 * 详情抽屉
 * ============================================================ */
.drawer { position: fixed; inset: 0; z-index: 90; }

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 36, 23, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  padding: 30px 26px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--paper-canvas);
  background-image: url("../img/card-paper.webp");
  background-size: 560px auto;
  border-left: 2.5px solid var(--rule-solid);
  box-shadow: -12px 0 30px rgba(45, 36, 23, 0.22);
  transform: translateX(104%);
  transition: transform 0.42s var(--ease-spring);
}

.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer.is-open .drawer-panel { transform: translateX(0); }
.drawer.is-closing .drawer-panel { transition: transform 0.24s var(--ease-soft); }
.drawer .pushpin { top: 8px; left: 50%; margin-left: -16px; }

.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--rule-solid);
  border-radius: 50%;
  background: var(--paper-sheet);
  color: var(--ink-900);
  box-shadow: var(--shadow-sketch-active);
  transition: transform 0.35s var(--ease-spring);
}

.drawer-close:hover { transform: rotate(90deg); }

.drawer-eyebrow {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink-400);
}

.drawer-title {
  margin: 2px 52px 10px 0;
  font-family: var(--font-hand);
  font-size: 2.1rem;
  line-height: 1.15;
  color: var(--ink-900);
  overflow-wrap: anywhere;
}

.drawer.is-open .drawer-body > * { animation: fade-up 0.45s var(--ease-out) both; }
.drawer.is-open .drawer-body > *:nth-child(2) { animation-delay: 0.04s; }
.drawer.is-open .drawer-body > *:nth-child(3) { animation-delay: 0.08s; }
.drawer.is-open .drawer-body > *:nth-child(4) { animation-delay: 0.12s; }
.drawer.is-open .drawer-body > *:nth-child(5) { animation-delay: 0.16s; }
.drawer.is-open .drawer-body > *:nth-child(n+6) { animation-delay: 0.2s; }

.drawer-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.drawer-alias { font-size: 0.84rem; font-weight: 600; color: var(--ink-500); }
.drawer-provider { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--ink-500); }
.drawer-provider .icon { width: 0.95em; height: 0.95em; }
.drawer-role { margin: 0 0 12px; font-size: 0.84rem; color: var(--ink-500); }

.drawer-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1.5px dashed var(--ok);
  border-radius: var(--radius-md);
  background: var(--ok-bg);
  color: var(--ok-ink);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.drawer-message .icon { margin-top: 2px; }
.drawer-message--warn { border-color: var(--warn); background: var(--warn-bg); color: var(--warn-ink); }
.drawer-message--crit { border-color: var(--crit); border-style: solid; background: var(--crit-bg); color: var(--crit-ink); }
.drawer-message--unknown { border-color: var(--unk); border-style: dotted; background: var(--unk-bg); color: var(--unk-ink); }

.drawer-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }

.drawer-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 8px 10px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-md);
  background: var(--paper-sheet);
}

.drawer-stat-label { font-size: 0.7rem; color: var(--ink-400); }
.drawer-stat-value { font-size: 1.05rem; font-weight: 800; color: var(--ink-900); }
.drawer-stat--ok .drawer-stat-value { color: var(--ok-ink); }
.drawer-stat--warn .drawer-stat-value { color: var(--warn-ink); }
.drawer-stat--crit .drawer-stat-value { color: var(--crit-ink); }
.drawer-stat-sub { font-size: 0.64rem; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drawer-subtitle {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 22px 0 10px;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--ink-900);
}

.drawer-subtitle .icon { width: 0.85em; height: 0.85em; color: var(--ink-400); align-self: center; }
.drawer-subtitle small { font-family: var(--font-sans); font-size: 0.74rem; color: var(--ink-400); }

/* 趋势图 */
.trend {
  padding: 10px 12px 8px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-md);
  background: var(--paper-sheet);
  box-shadow: var(--shadow-sketch-active);
}

.trend-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 4px; font-size: 0.76rem; color: var(--ink-700); }
.trend-key { display: inline-flex; align-items: center; gap: 6px; }
.trend-plot { position: relative; min-height: 120px; }
.trend-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.trend-grid { stroke: rgba(60, 50, 35, 0.1); stroke-width: 1; }
.trend-grid--base { stroke: rgba(60, 50, 35, 0.4); }
.trend-axis { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-400); }
.trend-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-reveal { transform-box: fill-box; transform-origin: left center; }
.drawer.is-open .trend-reveal { animation: reveal-x 1s var(--ease-out) 0.15s both; }
.trend-cursor-line { stroke: var(--ink-700); stroke-width: 1; stroke-dasharray: 3 3; }
.trend-dot { stroke: var(--paper-sheet); stroke-width: 2; }
.trend-hit { fill: transparent; cursor: crosshair; }
.trend-svg:focus-visible { outline-offset: 4px; }

.trend-tip {
  position: absolute;
  top: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 132px;
  padding: 7px 10px;
  border: 1.5px solid var(--rule-solid);
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 244, 0.97);
  box-shadow: var(--shadow-sketch);
  font-size: 0.74rem;
  color: var(--ink-700);
  pointer-events: none;
}

.trend-tip strong { font-size: 0.72rem; color: var(--ink-900); margin-bottom: 2px; }
.trend-tip span { display: flex; align-items: center; gap: 6px; }
.trend-tip i { width: 10px; height: 3px; border-radius: 2px; }
.trend-tip b { margin-left: auto; color: var(--ink-900); }
.trend-empty { display: flex; align-items: center; gap: 6px; margin: 30px 0; justify-content: center; color: var(--ink-400); font-size: 0.84rem; }

.trend-table-wrap { margin-top: 8px; font-size: 0.78rem; }
.trend-table-wrap summary { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--ink-500); font-weight: 700; min-height: 32px; }
.trend-table-wrap summary .icon { width: 0.95em; height: 0.95em; }
.trend-table { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.74rem; }
.trend-table th, .trend-table td { padding: 4px 6px; text-align: right; border-bottom: 1px dashed var(--rule-subtle); }
.trend-table th:first-child, .trend-table td:first-child { text-align: left; }
.trend-table th { font-family: var(--font-sans); color: var(--ink-400); font-weight: 700; }

.drawer .usage-panel { -webkit-mask: none; mask: none; }
.drawer-usage { margin-top: 18px; }

.drawer-services { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.drawer-service {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--rule-subtle);
  border-radius: var(--radius-md);
  background: var(--paper-sheet);
  font-size: 0.86rem;
  min-width: 0;
}

.drawer-service .icon { width: 1em; height: 1em; }
.drawer-service--ok { border-color: rgba(47, 111, 79, 0.5); }
.drawer-service--ok .icon { color: var(--ok); }
.drawer-service--crit { border-color: var(--crit); border-style: dashed; background: var(--crit-bg); color: var(--crit-ink); }
.drawer-service--unknown { border-color: var(--unk); border-style: dotted; background: var(--unk-bg); color: var(--unk-ink); }
.drawer-service-name { font-weight: 700; }
.drawer-service-status { font-size: 0.74rem; color: var(--ink-500); }
.drawer-service-detail { margin-left: auto; max-width: 45%; font-size: 0.74rem; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-empty { color: var(--ink-400); font-size: 0.85rem; }

.drawer-facts { margin: 20px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.drawer-facts > div { padding: 8px 12px; border: 1.5px solid var(--rule-subtle); border-radius: var(--radius-md); background: var(--paper-sheet); }
.drawer-facts dt { font-size: 0.7rem; color: var(--ink-400); }
.drawer-facts dd { margin: 2px 0 0; font-size: 0.86rem; font-weight: 700; color: var(--ink-900); overflow-wrap: anywhere; }

/* ============================================================
 * 便利贴提示
 * ============================================================ */
.toast-stack {
  position: fixed;
  top: 92px;
  right: 18px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(340px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 10px 12px 14px;
  border: 1.5px solid var(--rule-solid);
  border-radius: 3px 3px 14px 3px;
  background: #fff6c9;
  box-shadow: var(--shadow-sketch), var(--shadow-float);
  color: var(--ink-900);
  pointer-events: auto;
  transform: rotate(-1deg);
  animation: toast-in 0.55s var(--ease-spring) both;
}

.toast::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 52px;
  height: 14px;
  transform: translateX(-50%) rotate(3deg);
  background: var(--kraft) url("../img/tape-kraft.png") center / cover;
  opacity: 0.85;
}

.toast.is-leaving { animation: toast-out 0.3s var(--ease-soft) both; }
.toast--crit { background: #fde2dc; border-color: var(--crit); }
.toast--warn { background: #fdf0d2; border-color: var(--warn); border-style: dashed; }
.toast--ok { background: #e3f1e5; border-color: var(--ok); }
.toast-icon { width: 1.3em; height: 1.3em; margin-top: 2px; }
.toast--crit .toast-icon { color: var(--crit); }
.toast--warn .toast-icon { color: var(--warn); }
.toast--ok .toast-icon { color: var(--ok); }
.toast-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.toast-title { font-family: var(--font-hand); font-size: 1.15rem; line-height: 1.2; font-weight: 400; }
.toast-text { font-size: 0.8rem; color: var(--ink-700); overflow-wrap: anywhere; }
.toast-close { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; color: var(--ink-500); flex-shrink: 0; }
.toast-close:hover { background: rgba(60, 50, 35, 0.08); color: var(--ink-900); }

/* ============================================================
 * 入场与状态变化动画
 * ============================================================ */
.is-opening .page-header { animation: drop-in 0.55s var(--ease-out) both; }
.is-opening .dashboard-tabs-nav { animation: fade-up 0.5s var(--ease-out) 0.08s both; }
.is-opening .hero-text { animation: fade-up 0.6s var(--ease-out) 0.14s both; }
.is-opening .overview-item { animation: card-in 0.6s var(--ease-spring) both; }
.is-opening .overview-item:nth-child(1) { animation-delay: 0.18s; }
.is-opening .overview-item:nth-child(2) { animation-delay: 0.24s; }
.is-opening .overview-item:nth-child(3) { animation-delay: 0.3s; }
.is-opening .overview-item:nth-child(4) { animation-delay: 0.36s; }
.is-opening .alerts-column { animation: fade-left 0.6s var(--ease-out) 0.3s both; }
.is-opening .alerts-column .pushpin { animation: pin-drop 0.6s var(--ease-spring) 0.75s both; }

.is-entering { animation: card-in 0.6s var(--ease-spring) both; animation-delay: calc(var(--enter-i, 0) * 70ms + 0.2s); }
.alert-note.is-entering { animation: note-in 0.6s var(--ease-spring) both; }
.timeline-item.is-entering { animation: fade-up 0.45s var(--ease-out) both; animation-delay: calc(var(--enter-i, 0) * 50ms + 0.3s); }
.site-group.is-entering { animation: fade-up 0.45s var(--ease-out) both; }
.is-entering .stamp { animation: stamp-in 0.5s var(--ease-spring) both; animation-delay: calc(var(--enter-i, 0) * 70ms + 0.55s); }
.is-entering .metric-bar-fill { animation: bar-grow 1s var(--ease-out) both; animation-delay: calc(var(--enter-i, 0) * 70ms + 0.45s); }
.site-card.is-entering .site-history-cell { animation: cell-grow 0.4s var(--ease-out) both; animation-delay: calc(var(--c, 0) * 18ms + 0.4s); }
.is-entering .mini-trend-line { stroke-dasharray: 1200; animation: draw-1200 1.4s var(--ease-out) 0.6s both; }

.server-card.is-changed { animation: nudge 0.7s var(--ease-soft); }
.server-card.is-changed .stamp { animation: stamp-in 0.55s var(--ease-spring) 0.1s both; }

/* ---------- 关键帧 ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-left { from { opacity: 0; transform: translateX(18px) rotate(1deg); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) rotate(-1.6deg) scale(0.97); }
  to { opacity: 1; transform: rotate(var(--tilt, 0deg)); }
}
@keyframes note-in {
  0% { opacity: 0; transform: translateX(26px) rotate(4deg); }
  60% { opacity: 1; transform: translateX(-3px) rotate(-1.5deg); }
  100% { opacity: 1; transform: rotate(-0.6deg); }
}
@keyframes stamp-in {
  0% { opacity: 0; transform: scale(1.9) rotate(-16deg); }
  60% { opacity: 1; transform: scale(0.92) rotate(-2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-3deg); }
}
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cell-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes reveal-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw { from { stroke-dashoffset: 420; } to { stroke-dashoffset: 0; } }
@keyframes draw-190 { from { stroke-dashoffset: 190; } to { stroke-dashoffset: 0; } }
@keyframes draw-60 { from { stroke-dashoffset: 60; } to { stroke-dashoffset: 0; } }
@keyframes draw-1200 { from { stroke-dashoffset: 1200; } to { stroke-dashoffset: 0; } }
@keyframes rewrite { from { opacity: 0; filter: blur(3px); transform: translateY(6px); } to { opacity: 1; filter: none; transform: none; } }
@keyframes beat-scroll { from { transform: translateX(0); } to { transform: translateX(-120px); } }
@keyframes ripple { from { opacity: 0.7; transform: scale(1); } to { opacity: 0; transform: scale(2.8); } }
@keyframes blink { 50% { opacity: 0.25; } }
@keyframes blink-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes throb { 0%, 100% { box-shadow: 0 0 0 0 rgba(162, 67, 47, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(162, 67, 47, 0); } }
@keyframes alarm-glow {
  0%, 100% { box-shadow: var(--shadow-sketch), 0 0 0 0 rgba(162, 67, 47, 0.28); }
  50% { box-shadow: var(--shadow-sketch), 0 0 0 7px rgba(162, 67, 47, 0); }
}
@keyframes lit { 0%, 100% { box-shadow: var(--shadow-sketch), 0 0 0 0 rgba(162, 67, 47, 0.3); } 50% { box-shadow: var(--shadow-sketch), 0 0 0 6px rgba(162, 67, 47, 0); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.28) rotate(-4deg); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-4deg); } 40% { transform: rotate(3deg); } 60% { transform: rotate(-2deg); } 80% { transform: rotate(1deg); } }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); } 45% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }
@keyframes nudge { 0%, 100% { transform: none; } 20% { transform: translateX(-5px) rotate(-0.8deg); } 40% { transform: translateX(5px) rotate(0.6deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes shake { 0%, 100% { transform: rotate(-1deg); } 20% { transform: translateX(-10px) rotate(-2deg); } 40% { transform: translateX(9px) rotate(0.5deg); } 60% { transform: translateX(-6px) rotate(-1.5deg); } 80% { transform: translateX(4px) rotate(-1deg); } }
@keyframes gate-in { from { opacity: 0; transform: translateY(-26px) rotate(-5deg) scale(0.96); } to { opacity: 1; transform: rotate(-1deg); } }
@keyframes pin-drop { 0% { opacity: 0; transform: translateY(-40px) scale(1.3); } 70% { opacity: 1; transform: translateY(3px) scale(0.95); } 100% { opacity: 1; transform: none; } }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
@keyframes shimmer { from { background-position: 120% 0, 0 0, 0 0; } to { background-position: -120% 0, 0 0, 0 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(60px) rotate(6deg); } to { opacity: 1; transform: rotate(-1deg); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px) rotate(4deg) scale(0.96); } }

/* ============================================================
 * 响应式
 * ============================================================ */
@media (max-width: 1240px) {
  .site-grid, .bot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1120px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .main-layout { grid-template-columns: 1fr; }
  .alerts-column { position: relative; top: 0; max-height: none; overflow: visible; }
  .websites-toolbar { grid-template-columns: 1fr; grid-template-areas: "search" "status" "group"; }
}

@media (max-width: 760px) {
  .server-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --spine-width: 12px; }

  body { font-size: 14.5px; }
  .page-wrap { padding: 0 12px 36px calc(var(--spine-width) + 12px); }
  .desk-deco { display: none; }

  .page-header { position: relative; margin: 0 -6px; padding: 12px 6px 12px; gap: 10px; }
  .brand { gap: 10px; }
  .brand-mark { width: 40px; height: 40px; }
  .header-status { width: 100%; justify-content: flex-start; gap: 8px; }
  .cycle { order: 3; }
  .header-actions { order: 5; width: 100%; display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .btn-tape { min-height: 44px; padding: 8px 10px; }

  .dashboard-tabs-nav { margin-top: 12px; }
  .dashboard-tablist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 0 2px; }
  .dashboard-tab { justify-content: center; flex-wrap: wrap; gap: 2px 5px; min-height: 52px; padding: 6px 4px 7px; font-size: 1.08rem; }
  .tab-badge { font-size: 0.62rem; padding: 0 5px; }

  .hero { padding-top: 16px; gap: 16px; }
  .hero-title { font-size: clamp(1.9rem, 8.4vw, 2.4rem); }
  .overview-strip { grid-template-columns: 1fr 1fr; gap: 12px 10px; }
  .overview-item { padding: 12px 10px 10px; min-height: 108px; }
  .overview-icon, .ov-ring, .ov-ring svg { width: 36px; height: 36px; }
  .overview-icon, .ov-ring { top: 10px; right: 10px; }
  .overview-num { font-size: 2.3rem; }

  .main-layout { gap: 18px; margin-top: 18px; }
  .server-grid { gap: 16px; }
  .server-card { padding: 14px 12px 12px 15px; }
  .card-title { font-size: 1.5rem; }
  .card-ledger { grid-template-columns: 1fr 1fr; }
  .card-ledger > div:first-child { grid-column: 1 / -1; border-bottom: 1.5px dashed var(--rule-subtle); }
  .card-ledger > div:nth-child(2) { border-left: none; }
  .card-seal { top: 52px; font-size: 1.35rem; }

  .alerts-column { padding: 16px 12px 14px; }

  .panel-card { padding: 16px 12px 14px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .stat-pills { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .stat-pill { justify-content: center; min-height: 36px; }
  /* 手机上网站状态计数已显示在筛选按钮里，隐藏重复的统计药丸 */
  #websites-section .stat-pills { display: none; }
  .bot-grid, .site-grid { grid-template-columns: 1fr; gap: 10px; }

  .websites-toolbar { padding: 10px; }
  .search-input { min-height: 44px; font-size: 16px; }
  .search-clear { width: 44px; height: 44px; right: 0; }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -10px; padding: 2px 10px; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { min-height: 44px; padding: 4px 13px; }
  a.site-domain { min-height: 44px; margin: -12px 0 -10px; padding: 0; }

  .drawer-panel { width: 100%; border-left: none; padding: 26px 14px 32px; }
  .drawer-stats { grid-template-columns: 1fr 1fr; }
  .drawer-title { font-size: 1.8rem; }

  .toast-stack { top: auto; bottom: 16px; right: 12px; }
}

/* ============================================================
 * 减弱动效
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .heartbeat-track, .heartbeat-x, .skeleton { animation: none !important; }
  .server-card:hover, .server-card:focus-visible, .bot-card:hover, .bot-card:focus-visible,
  .site-card:hover, .btn-tape:hover:not(:disabled), .drawer-close:hover, .overview-item:hover,
  .dashboard-tab:hover { transform: none !important; }
}

/* ============================================================
 * 打印
 * ============================================================ */
@media print {
  .book-spine, .desk-deco, .drawer, .app-gate, .btn-tape, .pushpin, .toast-stack, .dashboard-tabs-nav { display: none !important; }
  .page-header { position: static; background: none; }
  .page-wrap { padding-left: 0; max-width: 100%; }
  body { background: none; color: #000; }
  .dashboard-tabpanel[hidden] { display: block !important; }
  .main-layout { grid-template-columns: 1fr; }
  .alerts-column { position: static; max-height: none; }
  * { animation: none !important; }
}
