/* cs2op — shared styles. Light theme by default, dark via [data-theme="dark"]. */
:root {
  --bg: #f5f7fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #e3e8f2;
  --border-strong: #cfd7e6;
  --text: #121a2b;
  --text-2: #4a5568;
  --text-3: #8592a8;
  --primary: #315bd4;
  --primary-hover: #2a4fbd;
  --primary-soft: rgba(49, 91, 212, .1);
  --accent: #f08a24;
  --accent-soft: rgba(240, 138, 36, .12);
  --ok: #12a46b;
  --ok-soft: rgba(18, 164, 107, .12);
  --warn: #d98a00;
  --warn-soft: rgba(217, 138, 0, .14);
  --bad: #e04848;
  --bad-soft: rgba(224, 72, 72, .12);
  --up: #e04848;    /* 国内习惯：涨红 */
  --down: #12a46b;  /*           跌绿 */
  --shadow: 0 1px 2px rgba(18, 26, 43, .04), 0 8px 24px rgba(18, 26, 43, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --font: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --sidebar: 232px;
  --page: 1400px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1220;
  --bg-soft: #121a2c;
  --surface: #151d31;
  --surface-2: #1a233a;
  --border: #253050;
  --border-strong: #31406a;
  --text: #e8edf8;
  --text-2: #aab5cc;
  --text-3: #6f7c99;
  --primary: #5577e9;
  --primary-hover: #6485f1;
  --primary-soft: rgba(85, 119, 233, .16);
  --accent: #ff9c3d;
  --accent-soft: rgba(255, 156, 61, .14);
  --ok: #2cc888;
  --ok-soft: rgba(44, 200, 136, .14);
  --warn: #f3b33d;
  --warn-soft: rgba(243, 179, 61, .14);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, .14);
  --up: #ff6b6b;
  --down: #2cc888;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
/* The hero glow and skin image bleed past the content width on purpose; clip them here. */
.hero-band {
  overflow: clip;
  background:
    radial-gradient(900px 520px at 78% 40%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(800px 600px at 15% 10%, var(--primary-soft), transparent 70%),
    linear-gradient(color-mix(in srgb, var(--border) 55%, transparent) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, color-mix(in srgb, var(--border) 55%, transparent) 1px, transparent 1px) 0 0 / 56px 56px,
    var(--bg);
}
.hero-band::after { content: ""; display: block; height: 1px; background: var(--border); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: .02em; }
/* The mark is as tall as the two text lines next to it (18 + 5 + 15 = 38px). */
.brand-mark {
  width: 38px; height: 38px; flex: none; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #6c4ee8 60%, var(--accent));
  color: #fff; font-size: 14px; font-weight: 900; letter-spacing: 0;
  box-shadow: 0 6px 16px rgba(49, 91, 212, .35);
}
/* Domain on top, a one-line tagline under it (same layout as cs2up.cn's header). */
.brand-text { display: block; font-size: 18px; font-weight: 800; line-height: 1; letter-spacing: .01em; }
.brand-sub { display: block; margin-top: 5px; font-size: 12px; line-height: 15px; font-weight: 500; letter-spacing: .04em; color: var(--text-3); }

/* ---------- buttons, pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-xl { height: 56px; padding: 0 30px; font-size: 17px; border-radius: 14px; }
.btn-primary.btn-xl { box-shadow: 0 10px 26px color-mix(in srgb, var(--primary) 35%, transparent); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border);
  white-space: nowrap; flex: none;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.pill.soon { color: var(--text-3); }
.pill.live .dot { animation: pulse 1.8s infinite; }
@media (prefers-reduced-motion: reduce) { .pill.live .dot { animation: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.card-head h2, .card-head h3 { margin: 0; font-size: 18px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--text-3); margin-bottom: 4px; }

/* ---------- home: top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--border);
}
/* Three columns so the nav sits in the true centre whatever the brand and action widths are. */
/* Matches the tool pages' sidebar brand and .main-top (height, logo position, right padding), so nothing jumps between pages. */
.topbar-inner { max-width: none; margin: 0; height: 64px; padding: 0 28px 0 22px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; }
.top-actions { grid-column: 3; justify-self: end; display: flex; gap: 10px; align-items: center; }
/* Text tabs as tall as the bar; the current page gets a line along the bar's bottom edge (as on cs2up.cn). */
.topnav { display: flex; align-items: center; align-self: stretch; gap: 4px; }
.topnav a { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 14px; font-weight: 600; font-size: 15px; color: var(--text-2); }
.topnav a:hover, .topnav a.active { color: var(--primary); }
.topnav a.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.topnav-sep { width: 1px; height: 16px; margin: 0 8px; background: var(--border-strong); }
.topnav a .soon-dot { font-size: 11px; font-weight: 700; color: var(--text-3); }

/* ---------- home: hero ---------- */
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 32px; }
.hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px;
  align-items: center; padding: 72px 0 64px; min-height: min(78vh, 760px);
}
.hero::before {
  content: ""; position: absolute; inset: -40px -200px auto auto; width: 760px; height: 760px; z-index: -1;
  background: radial-gradient(circle at center, var(--primary-soft), transparent 62%);
}
.hero h1 { margin: 22px 0 20px; font-size: clamp(40px, 5.4vw, 96px); line-height: 1.08; letter-spacing: -.02em; font-weight: 900; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--primary), #7a5cf0 55%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { margin: 0 0 34px; font-size: clamp(16px, 1.25vw, 20px); color: var(--text-2); max-width: 620px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { margin-top: 26px; font-size: 14px; color: var(--text-3); display: flex; gap: 18px; flex-wrap: wrap; }
.hero-note span::before { content: "✓"; color: var(--ok); margin-right: 6px; font-weight: 700; }

.hero-visual { position: relative; height: clamp(420px, 38vw, 600px); }
.hero-skin {
  position: absolute; inset: 40px 0 40px 0; display: grid; place-items: center;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
}
.hero-skin img { width: 122%; max-width: none; filter: drop-shadow(0 30px 40px rgba(18, 26, 43, .28)); transform: rotate(-8deg); }
.float-card {
  position: absolute; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 16px; padding: 16px 20px; box-shadow: var(--shadow); min-width: 210px;
}
.float-card .label { font-size: 13px; color: var(--text-3); font-weight: 600; }
.float-card .value { font-size: 28px; font-weight: 800; margin-top: 2px; }
.float-card .sub { font-size: 13px; margin-top: 2px; }
.fc-1 { top: 6px; left: 0; }
.fc-2 { top: 40px; right: 0; }
.fc-3 { bottom: 10px; right: 30px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- live metrics band ---------- */
.metrics { background: var(--surface); border-bottom: 1px solid var(--border); }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { padding: 28px 28px 26px; border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.metric:first-child { border-left: 0; }
.metric .label { font-size: 14px; font-weight: 600; color: var(--text-3); }
.metric b { font-size: clamp(28px, 2.6vw, 42px); font-weight: 800; line-height: 1.15; }
.metric small { font-size: 13px; color: var(--text-2); }

/* ---------- tools grid ---------- */
.section { padding: 80px 0 8px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 32px; }
.section-head h2 { margin: 0; font-size: clamp(28px, 2.4vw, 40px); letter-spacing: -.01em; }
.section-head p { margin: 8px 0 0; color: var(--text-2); font-size: 16px; }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.tool {
  position: relative; padding: 30px; display: flex; flex-direction: column; gap: 12px; min-height: 290px;
  transition: transform .18s, border-color .18s, box-shadow .18s; overflow: hidden;
}
a.tool::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--primary-soft), transparent); pointer-events: none; }
a.tool:hover { box-shadow: 0 18px 40px color-mix(in srgb, var(--primary) 14%, transparent); }
a.tool:hover { transform: translateY(-3px); border-color: var(--primary); }
.tool-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.tool-icon svg { width: 26px; height: 26px; }
.tool-kind { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--primary); margin-top: 6px; }
.tool.is-soon .tool-kind { color: var(--text-3); }
.tool h3 { margin: 0; font-size: 23px; letter-spacing: -.01em; }
.tool p { margin: 0; color: var(--text-2); font-size: 15px; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); }
.tool .pill { position: absolute; top: 28px; right: 28px; }
.tool-foot { font-size: 14px; font-weight: 700; color: var(--primary); }
.tool.is-soon { opacity: .72; }
.tool.is-soon .tool-icon { background: var(--surface-2); color: var(--text-3); }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.feature { padding: 30px; border-radius: var(--radius); border: 1px dashed var(--border-strong); }
.feature h3 { margin: 18px 0 8px; font-size: 20px; }
.feature p { margin: 0; color: var(--text-2); font-size: 15px; }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.stat { padding: 18px 20px; }
.stat .label { font-size: 13px; color: var(--text-3); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; margin-top: 4px; line-height: 1.2; }
.stat .sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.site-footer { margin-top: 96px; background: #0b1120; color: #9aa6bf; font-size: 14px; }
.site-footer .brand-text { color: #e8edf8; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(2, minmax(0, 1fr)); gap: 40px; padding-top: 56px; padding-bottom: 40px; }
.footer-brand p { margin: 16px 0 0; max-width: 360px; line-height: 1.7; }
.site-footer h4 { margin: 4px 0 14px; color: #e8edf8; font-size: 14px; }
.site-footer .footer-grid a:not(.brand), .site-footer .footer-grid span:not([class]) { display: block; margin-bottom: 10px; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1d2740; padding-top: 18px; padding-bottom: 28px; font-size: 12px; color: #6f7c99; }
.footer { margin-top: 64px; border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--text-3); font-size: 13px; }
.footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer a:hover { color: var(--primary); }

/* ---------- app shell (tool pages) ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 0 14px 18px;
}
/* Same height and bottom border as .main-top, so the two lines meet across the page. */
.sidebar .brand { flex: none; height: 64px; margin: 0 -14px 12px; padding: 0 22px; border-bottom: 1px solid var(--border); }
.side-group { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--text-3); padding: 14px 12px 6px; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; font-size: 14px;
}
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--primary-soft); color: var(--primary); }
.side-link .pill { margin-left: auto; padding: 1px 7px; font-size: 11px; }
.side-soon summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
.side-soon summary::-webkit-details-marker { display: none; }
.side-soon summary::after { content: ""; width: 6px; height: 6px; margin: 0 6px 0 auto; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.side-soon[open] summary::after { transform: rotate(45deg); }
.side-soon summary:hover { color: var(--text-2); }
.side-count { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); letter-spacing: 0; }
.side-link.is-soon { color: var(--text-3); cursor: default; }
.side-link.is-soon:hover { background: none; color: var(--text-3); }

.main { min-width: 0; }
.main-top {
  position: sticky; top: 0; z-index: 10; height: 64px; display: flex; align-items: center; gap: 16px;
  padding: 0 28px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px);
}
.main-top h1 { margin: 0; font-size: 18px; flex: 1; }
.main-top .brand { display: none; }
.content { padding: 28px; max-width: 1320px; margin: 0 auto; }
/* Tool pages use flat cards; the soft drop shadow stays on the home page. */
.content .card { box-shadow: 0 1px 2px rgba(18, 26, 43, .04); }

/* ---------- status page ---------- */
.status-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; padding: 30px; align-items: center; }
.status-hero h2 { margin: 16px 0 10px; font-size: clamp(30px, 3.6vw, 46px); line-height: 1.1; letter-spacing: -.02em; font-weight: 900; }
.status-hero p { margin: 0 0 14px; color: var(--text-2); max-width: 460px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.kpi .label { font-size: 13px; font-weight: 600; color: var(--text-3); }
.kpi .value { font-size: 30px; font-weight: 800; line-height: 1.25; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--text-2); }
.kpi.ok { background: var(--ok-soft); border-color: transparent; }
.kpi.ok .value { color: var(--ok); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.chart-card .card-head .tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 9px; border: 1px solid var(--border); }
.tabs button { border: 0; background: transparent; padding: 4px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-3); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chart-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px 22px 0; }
.chart-meta > div { padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.chart-meta .label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.chart-meta .value { font-size: 18px; font-weight: 800; }
.chart { padding: 10px 14px 16px; }
.chart svg { width: 100%; height: auto; aspect-ratio: 720 / 300; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--mono); }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#areaFill); }
.chart .peak { fill: var(--accent); }
.chart-tip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; white-space: nowrap; transform: translate(-50%, -120%); opacity: 0; transition: opacity .1s; }

.svc-group { padding: 6px 22px 18px; }
.svc-group h3 { display: flex; justify-content: space-between; font-size: 14px; margin: 14px 0 10px; }
.svc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.svc { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.svc .name { font-weight: 600; font-size: 14px; }
.svc .meta { font-size: 12px; color: var(--text-3); }

.incidents { padding: 8px 22px 20px; }
.incident { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.incident:last-child { border-bottom: 0; }
.incident time { font-size: 12px; color: var(--text-3); font-family: var(--mono); padding-top: 2px; }
.incident b { display: block; font-size: 14px; }
.incident span { font-size: 13px; color: var(--text-2); }

.chart-empty, .incident-empty { padding: 48px 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.incident-empty { padding: 24px 0; }

/* ---------- status: chart + services on the left, update timeline on the right ---------- */
.status-grid { align-items: stretch; }
.status-left { display: grid; gap: 20px; align-content: start; min-width: 0; }
.updates-card { display: flex; flex-direction: column; min-height: 0; }
/* The left column sets the row height; the timeline fills the rest and scrolls. */
.timeline { position: relative; flex: 1; min-height: 0; overflow: auto; contain: size; margin: 14px 0 0; padding: 4px 18px 18px 42px; list-style: none; }
.timeline::before { content: ""; position: absolute; top: 12px; bottom: 18px; left: 25px; width: 2px; border-radius: 2px; background: var(--border); }
.timeline > li { position: relative; margin-bottom: 12px; }
.timeline > li:not(.incident-empty)::before { content: ""; position: absolute; top: 16px; left: -22px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong); }
.timeline > li:first-child:not(.incident-empty)::before { border-color: var(--primary); background: var(--primary); }
.tl-card { display: block; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); transition: border-color .15s; }
.tl-card:hover { border-color: var(--primary); }
.tl-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.tl-meta time { margin-left: auto; }
.tl-tag { font-weight: 800; color: var(--primary); }
.tl-tag.is-news { color: var(--accent); }
.tl-tag.is-silent { color: var(--text-2); }
.tl-ver { padding: 1px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 11px; color: var(--text-2); }
.tl-title { display: block; margin-top: 6px; font-size: 15px; line-height: 1.4; }
.tl-sum { margin: 4px 0 0; font-size: 13px; line-height: 1.6; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.load-error { margin-bottom: 18px; padding: 10px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 13px; font-weight: 600; }
.load-error[hidden] { display: none; }

/* ---------- inventory page ---------- */
.inv-search { padding: 26px 28px; display: grid; gap: 18px; }
.inv-search h2 { margin: 2px 0 6px; font-size: 26px; letter-spacing: -.01em; }
.inv-search p { margin: 0; max-width: 640px; font-size: 14px; }
/* What the lookup returns: shown until a query starts, then the result takes its place. */
.inv-intro { display: grid; gap: 20px; margin-top: 20px; }
.inv-result:not(:empty) ~ .inv-intro, .inv-loading:not([hidden]) ~ .inv-intro { display: none; }
.intro-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.intro-items > div { padding: 24px 26px; }
.intro-items > div + div { border-left: 1px solid var(--border); }
.intro-items .tool-icon { width: 42px; height: 42px; border-radius: 12px; }
.intro-items .tool-icon svg { width: 21px; height: 21px; }
.intro-items h3 { margin: 14px 0 6px; font-size: 16px; }
.intro-items p { margin: 0; font-size: 14px; color: var(--text-2); }
.intro-formats { padding: 22px 26px; }
.intro-formats h3 { margin: 0 0 12px; font-size: 15px; }
.intro-formats ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; }
.intro-formats li { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.intro-formats b { color: var(--text-2); }
.intro-formats code { font-family: var(--mono); font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.inv-form { display: flex; gap: 10px; }
.inv-input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px; outline: none; }
.inv-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.inv-recent { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.inv-recent:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; font-weight: 600; cursor: pointer; max-width: 200px; }
.chip img { width: 22px; height: 22px; border-radius: 50%; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .6; cursor: progress; }

.inv-loading { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 14px; }
.inv-loading[hidden] { display: none; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[data-inv-error] { margin-top: 20px; }

.inv-profile { margin-top: 20px; display: flex; align-items: center; gap: 18px; padding: 20px 22px; }
.inv-avatar { width: 72px; height: 72px; border-radius: 14px; background: var(--surface-2); flex: none; }
.inv-who { flex: 1; min-width: 0; }
.inv-who h2 { margin: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-who .muted { font-size: 13px; }
.inv-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.inv-message { margin-top: 20px; padding: 28px; text-align: center; color: var(--text-2); }
.inv-stats { margin-top: 20px; }
.stat-cd .value { color: var(--accent); }

.inv-list { margin-top: 20px; padding: 18px 20px 6px; }
.inv-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-toolbar .tabs { flex-wrap: wrap; }
.inv-tools { display: flex; gap: 8px; }
.inv-filter, .inv-sort { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 13px; }
.inv-filter { width: 160px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-top: 16px; }
.inv-item { position: relative; padding: 10px 12px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2);
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s; }
.inv-item:hover { border-color: var(--primary); transform: translateY(-2px); }
.inv-item.is-protected { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.inv-thumb { position: relative; height: 96px; display: grid; place-items: center; border-radius: 10px;
  background: radial-gradient(closest-side, var(--primary-soft), transparent); }
.inv-thumb img { max-height: 90px; width: auto; }
.inv-tag { position: absolute; top: 0; left: 0; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; }
.tag-cd { background: var(--accent); color: #fff; }
.tag-own { background: var(--primary-soft); color: var(--primary); }
.inv-count { position: absolute; top: 0; right: 0; padding: 1px 7px; border-radius: 6px; background: var(--text); color: var(--surface); font-size: 11px; font-weight: 800; }
.inv-name { font-size: 13px; font-weight: 600; line-height: 1.35; min-height: 35px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inv-wear { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.wear-bar { position: relative; height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, #2cc888 0 7%, #8fd14f 7% 15%, #f3b33d 15% 38%, #f08a24 38% 45%, #e04848 45%); }
.wear-bar i { position: absolute; top: -3px; width: 2px; height: 10px; border-radius: 2px; background: var(--text); transform: translateX(-1px); }
.inv-price { display: flex; align-items: baseline; justify-content: space-between; margin-top: 2px; }
.inv-price b { font-size: 15px; }
.inv-price small { font-size: 11px; color: var(--text-3); }
.inv-stack summary { font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; list-style: none; }
.inv-stack summary::-webkit-details-marker { display: none; }
.inv-stack[open] summary { margin-bottom: 4px; }
.inv-stack ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.inv-stack li { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.inv-stack li b { margin-left: auto; font-size: 11px; color: var(--text); }
.inv-stack em { font-style: normal; padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 800; }
.inv-meta { font-size: 12px; margin: 14px 0 10px; }

/* ---------- account modal ---------- */
.account-btn { height: 38px; padding: 0 14px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 36px; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 14, 24, .5); backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal-box { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 30px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.modal-box h2 { margin: 0; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.modal-head { display: flex; align-items: center; gap: 12px; padding-right: 36px; }
.modal-head .brand-mark { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
.modal-kicker { display: block; font-size: 11px; font-weight: 800; letter-spacing: .22em; color: var(--primary); }
.modal-head + .modal-note, .modal-head + .modal-status { margin-top: 12px; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none;
  font-size: 22px; line-height: 1; color: var(--text-3); cursor: pointer; }
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-note, .modal-status { margin: 6px 0 0; font-size: 14px; color: var(--text-2); }
.modal-status { font-weight: 600; }
.modal-status.ok { color: var(--ok); }
.modal-status.warn { color: var(--warn); }
.modal-form { display: grid; gap: 14px; margin-top: 20px; }
.modal-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.modal-form { gap: 12px; }
.modal-form input { height: 50px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 15px; outline: none; transition: border-color .15s, background .15s; }
.modal-form input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.modal-submit { width: 100%; height: 50px; border-radius: 12px; font-size: 16px; letter-spacing: .12em;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 30%, transparent); }
.modal-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; font-size: 12px; color: var(--text-3); }
.modal-divider::before, .modal-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.modal-wechat { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid color-mix(in srgb, #07c160 45%, transparent); background: color-mix(in srgb, #07c160 8%, var(--surface));
  font: inherit; color: var(--text); text-align: left; transition: border-color .15s; }
.modal-wechat:hover { border-color: #07c160; }
.modal-wechat-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface);
  box-shadow: 0 1px 3px rgba(18, 26, 43, .08); }
.modal-wechat-icon svg { width: 26px; height: 26px; }
.modal-wechat b { display: block; font-size: 14px; }
.modal-wechat small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.modal-chevron { margin-left: auto; font-size: 22px; line-height: 1; color: var(--text-3); }
.modal-signup { margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface-2);
  text-align: center; font-size: 13px; color: var(--text-3); }
.modal-signup button { display: block; margin: 4px auto 0; border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--primary); cursor: pointer; }
.modal-error { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 13px; font-weight: 600; }
.modal-error[hidden] { display: none; }
.modal-switch { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--text-3); }
.modal-switch button, .modal-logout { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--primary); cursor: pointer; }
.modal-group { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding: 14px 16px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.modal-group b { display: block; font-size: 14px; }
.modal-group span { font-size: 13px; color: var(--text-2); }
.modal-logout { display: block; margin: 18px auto 0; font-size: 14px; color: var(--text-3); }
.qr { display: grid; justify-items: center; gap: 10px; margin-top: 18px; padding: 18px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.qr img { width: 200px; height: 200px; }
.qr-wait { margin: 0; font-size: 13px; color: #6f7c99; }
.qr .modal-error { margin: 0; }
.modal-hint { margin: 14px 0 0; font-size: 12px; line-height: 1.6; color: var(--text-3); }
.modal-logout:hover { color: var(--bad); }

/* ---------- mobile ---------- */
.tabbar { display: none; }
@media (min-width: 1800px) {
  :root { --page: 1680px; }
}
@media (max-width: 1280px) {
  .topnav .soon-dot { display: none; }
  .topnav a { padding: 0 10px; }
  .topnav a.active::after { left: 10px; right: 10px; }
}
@media (max-width: 1080px) {
  .tools, .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; }
  .metric { border-top: 1px solid var(--border); }
  .metric:nth-child(-n+2) { border-top: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .timeline { contain: none; max-height: 640px; }
}
@media (max-width: 860px) {
  .topnav { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 28px; min-height: 0; }
  .hero-visual { height: 340px; }
  .status-hero { grid-template-columns: 1fr; padding: 22px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-top { padding: 0 16px; }
  .main-top .brand { display: flex; margin-right: auto; }
  .main-top h1 { display: none; }
  .content { padding: 16px 16px 96px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 4px 0; }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.active { color: var(--primary); }
  body.home { padding-bottom: 64px; }
}
@media (max-width: 600px) {
  .hero { padding: 36px 0 24px; }
  .btn-xl { height: 50px; padding: 0 22px; font-size: 16px; }
  /* The hero's floating cards repeat the stats band right below them, and cover the gun on a phone. */
  .float-card { display: none; }
  .metric { padding: 18px 12px; }
  .features, .footer-grid { grid-template-columns: 1fr; }
  .tool { min-height: 0; padding: 22px; }
  .tool .pill { top: 22px; right: 22px; }
  .tool h3 { font-size: 20px; }
  .section { padding-top: 56px; }
  .inv-search { padding: 20px 16px; }
  .inv-search h2 { font-size: 21px; }
  .intro-items, .intro-formats ul { grid-template-columns: 1fr; }
  .intro-items > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .inv-form { flex-direction: column; }
  .inv-form .inv-input { flex: none; }
  .inv-profile { flex-wrap: wrap; padding: 16px; }
  .inv-profile .btn { width: 100%; }
  .inv-avatar { width: 56px; height: 56px; }
  .inv-list { padding: 14px 12px 4px; }
  .inv-tools, .inv-filter { width: 100%; }
  .inv-filter { flex: 1; }
  .inv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .strip.inv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wrap, .topbar-inner { padding: 0 16px; }
  .topbar-inner { gap: 12px; }
  .top-actions .btn:not(.account-btn) { display: none; }
  .tools, .strip, .kpis, .svc-grid { grid-template-columns: 1fr; }
  .main-top { gap: 10px; }
  .main-top .pill { display: none; }
  .chart-card .card-head { flex-wrap: wrap; align-items: center; }
  .chart-card .card-head .tabs { width: 100%; }
  .chart-card .tabs button { flex: 1; white-space: nowrap; }
  .chart-meta { gap: 8px; padding: 14px 16px 0; }
  .chart-meta > div { padding: 8px 10px; }
  .chart-meta .value { font-size: 15px; }
  .chart { padding: 8px 8px 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 20px; }
  .hero { gap: 0; }
  .hero-visual { height: 190px; }
  .hero-skin { inset: 0; }
  .section-head { flex-direction: column; align-items: start; }
  .incident { grid-template-columns: 1fr; gap: 4px; }
  .card-head, .svc-group, .incidents { padding-left: 16px; padding-right: 16px; }
}
