:root {
  --bg: #edf1f4;
  --panel: #ffffff;
  --ink: #18212b;
  --muted: #697586;
  --line: #dfe4ea;
  --line-strong: #c9d1d9;
  --nav: #18212b;
  --left: #a94442;
  --left-soft: #fff1f0;
  --left-line: #d99a96;
  --right: #28679b;
  --right-soft: #eef6fc;
  --right-line: #91b9dd;
  --purple: #7456a8;
  --purple-soft: #f4f0fa;
  --green: #2e7656;
  --bad: #a4524d;
  --soft: #f5f7f9;
  --shadow: 0 8px 22px rgba(24, 33, 43, .07);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}
[hidden] { display: none !important; }
.bootScreen {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: #edf1f4;
  color: #697586;
  font-size: 11px;
}
.bootMark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 8px; background: #18212b; color: #fff; font-size: 16px; font-weight: 900; }
button, input, select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  padding: 0 10px;
}
button { cursor: pointer; font-weight: 700; }
button:hover { border-color: #c1cbd5; background: #f3f6f8; }
button:disabled { cursor: default; opacity: .45; }
input:focus, select:focus {
  outline: none;
  border-color: #8297aa;
  box-shadow: 0 0 0 3px rgba(40, 103, 155, .11);
}
[hidden] { display: none !important; }
.primary { border-color: var(--nav); background: var(--nav); color: #fff; }
.primary:hover { background: #263442; }
.wide { width: 100%; }

/* Login */
.loginScreen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background-color: #edf1f4;
  background-image: linear-gradient(#e2e7eb 1px, transparent 1px), linear-gradient(90deg, #e2e7eb 1px, transparent 1px);
  background-size: 30px 30px;
}
.loginShell { width: min(460px, 100%); }
.loginPanel {
  padding: 28px 30px 25px;
  border: 1px solid #d2dae2;
  border-top: 4px solid var(--nav);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(24, 33, 43, .13);
}
.brandMark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--nav);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.brandMark.small { width: 38px; height: 38px; font-size: 12px; }
.loginBrand { display: flex; align-items: center; gap: 14px; }
.loginBrand h1 { margin: 0; font-size: 21px; }
.loginBrand p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; }
.loginDivider { height: 1px; margin: 21px 0 17px; background: #e6eaee; }
.loginPanelHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.loginPanelHead h2 { margin: 0; font-size: 16px; }
.languageSeg { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.languageSeg button { height: 29px; border: 0; border-radius: 0; color: var(--muted); font-size: 11px; }
.languageSeg button + button { border-left: 1px solid var(--line); }
.languageSeg button.active { background: var(--nav); color: #fff; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field span { color: #273442; font-size: 12px; font-weight: 800; }
.field input { height: 43px; }
.formError { min-height: 20px; margin-top: 8px; color: var(--bad); font-size: 11px; }
.loginStatusBlock { margin-top: 12px; border: 1px solid #e1e6eb; border-radius: 7px; background: #f7f9fa; }
.loginNotice { padding: 11px 12px 9px; color: #516170; font-size: 11.5px; line-height: 1.55; }
.snapshotLine {
  min-height: 38px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-top: 1px solid #e3e8ec;
  color: var(--muted);
  font-size: 10.5px;
}
.snapshotLine b { color: #344252; text-align: right; }
.snapshotDot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(46, 118, 86, .1); }
.loginPrivacy { display: block; margin-top: 14px; color: #405b73; font-size: 11px; text-align: center; text-underline-offset: 3px; }

/* Stable application header */
.appView { height: 100%; }
.appHeader { height: 68px; background: var(--nav); color: #fff; }
.head {
  height: 68px;
  display: grid;
  grid-template-columns: minmax(250px, 320px) auto minmax(260px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
}
.titleBlock { min-width: 0; display: flex; align-items: center; gap: 10px; }
.titleCopy { min-width: 0; }
.titleCopy h1 { margin: 0; font-size: 16px; line-height: 1.2; }
.headerContext { min-width: 0; margin-top: 4px; color: #aebac5; font-size: 10.5px; line-height: 1.25; }
.headerContext .headerAccount, .headerContext .headerUpdated { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.headerUpdateDot { width: 6px; height: 6px; display: inline-block; margin-right: 5px; border-radius: 50%; background: #73a789; }
.mainNav { display: flex; align-items: center; gap: 3px; }
.mainNav button { height: 36px; border: 0; background: transparent; color: #b8c2cc; white-space: nowrap; }
.mainNav button.active { background: #fff; color: var(--nav); }
.accountActions { justify-self: end; display: flex; align-items: center; gap: 6px; min-width: 0; }
.langToggle, .logoutButton { border-color: #3c4955; background: transparent; color: #dce3e9; }
.logoutButton { color: #efc5c2; }
.userChip {
  width: 170px;
  height: 40px;
  display: grid;
  align-content: center;
  padding: 0 10px;
  border: 1px solid #3d4955;
  border-radius: 7px;
  background: #222d38;
}
.userChip b, .userChip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userChip b { font-size: 10.5px; }
.userChip span { margin-top: 2px; color: #aeb9c4; font-size: 9.5px; }
.moduleSummary { min-width: 0; }

/* Relationship workspace */
.workspace {
  height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 382px;
  gap: 10px;
  padding: 10px;
}
.depthRail, .graphShell, .detailPanel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.depthRail { overflow: hidden; }
.railHeader { height: 52px; display: grid; place-items: center; align-content: center; gap: 2px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.railHeader b { color: var(--ink); font-size: 15px; }
.depthList { height: calc(100% - 52px); overflow: auto; padding: 6px; }
.depthButton {
  width: 100%;
  height: 42px;
  margin-bottom: 5px;
  padding: 0;
  border: 0;
  background: #f2f4f6;
  color: #627181;
  font-size: 9.5px;
  line-height: 1.25;
}
.depthButton b { display: block; color: inherit; font-size: 12px; }
.depthButton.active { background: var(--nav); color: #fff; }
.graphShell { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.graphTopbar { position: relative; z-index: 10; border-bottom: 1px solid var(--line); background: #fff; }
.graphToolbar { min-height: 52px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #f8fafb; }
.searchWrap { position: relative; min-width: 230px; max-width: 430px; flex: 1; }
.searchWrap input { width: 100%; padding-right: 34px; }
.searchClear { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; display: none; padding: 0; border: 0; background: transparent; color: #748190; font-size: 18px; }
.searchClear.visible { display: block; }
.searchResults {
  position: absolute;
  z-index: 80;
  top: 41px;
  left: 0;
  right: 0;
  max-height: 340px;
  overflow: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(24, 33, 43, .17);
}
.searchResult { width: 100%; min-height: 48px; height: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 7px 9px; border: 0; text-align: left; }
.searchResult > span:first-child { min-width: 0; display: grid; gap: 2px; }
.searchResult b { font-size: 12px; }
.searchResult span { color: var(--muted); font-size: 10.5px; }
.searchResult em { color: var(--purple); font-size: 10px; font-style: normal; font-weight: 700; }
.headerActions { display: flex; align-items: center; gap: 6px; }
.segmented { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.segmented button { border: 0; border-radius: 0; white-space: nowrap; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.active { background: var(--nav); color: #fff; }
.recommendControl { display: flex; align-items: center; gap: 5px; }
.recommendControl > button.active { border-color: #b9aad0; background: var(--purple-soft); color: #5e438c; }
.recommendStatus { max-width: 110px; overflow: hidden; color: var(--muted); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.recommendStatus.issue { color: var(--bad); }
.exportBox { display: flex; }
.exportBox button { border-radius: 0; }
.exportBox button:first-child { border-radius: 7px 0 0 7px; }
.exportBox button:last-child { margin-left: -1px; border-radius: 0 7px 7px 0; }
.pathBar { min-height: 67px; padding: 7px 10px; background: #fff; }
.pathHead { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.pathline { min-width: 0; flex: 1; overflow: auto hidden; color: #536171; font-size: 10.5px; white-space: nowrap; }
.pathline b { color: var(--ink); }
.crumbBtn { height: 26px; padding: 0 6px; border: 0; background: transparent; color: #405c75; font-size: 10px; }
.pathNavButtons { display: flex; gap: 5px; }
.pathNavButtons button { height: 27px; font-size: 10px; }
.pathStats { display: flex; align-items: center; gap: 5px; overflow: auto hidden; padding-top: 5px; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: #f7f9fa; color: #536171; font-size: 10px; }
.chip.left { border-color: #efc7c3; background: var(--left-soft); color: var(--left); }
.chip.right { border-color: #c9ddec; background: var(--right-soft); color: var(--right); }
.graph {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background-color: #fff;
  background-image: linear-gradient(#eef1f3 1px, transparent 1px), linear-gradient(90deg, #eef1f3 1px, transparent 1px);
  background-size: 28px 28px;
}
.graph svg { display: block; min-width: 100%; min-height: 100%; }
.mobileTree { min-height: 100%; padding: 12px 8px 64px; }
.tooltip {
  position: absolute;
  z-index: 20;
  display: none;
  width: 285px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 14px 30px rgba(24, 33, 43, .16);
  color: #354353;
  font-size: 10.5px;
  line-height: 1.55;
  pointer-events: none;
}
.tooltip.visible { display: block; top: 8px; right: 8px; }
.tooltip b { color: var(--ink); font-size: 12px; }
.tooltip .muted { color: var(--muted); }

/* Tree geometry and cards */
.treeEdge { fill: none; stroke: #aeb9c3; stroke-width: 2; }
.treeEdge.left { stroke: var(--left-line); }
.treeEdge.right { stroke: var(--right-line); }
.treeEdge.referral { stroke: #b9a9cf; }
.recommendEdge { fill: none; stroke: var(--purple); stroke-width: 2; stroke-dasharray: 7 5; opacity: .82; pointer-events: none; }
.edgeLabel { font-size: 10px; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.edgeLabel.left { fill: var(--left); }
.edgeLabel.right { fill: var(--right); }
.edgeLabel.referral { fill: var(--purple); }
.node { cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transform-box: fill-box; transform-origin: center; transition: filter .12s; }
.node .card { fill: #fff; stroke: #a9b5c1; stroke-width: 1.15; filter: drop-shadow(0 3px 7px rgba(24, 33, 43, .1)); }
.node:hover .card, .node:focus .card { stroke: var(--nav); stroke-width: 1.8; }
.node.root .card { stroke: var(--nav); stroke-width: 2; }
.areaBar.left { fill: var(--left); }
.areaBar.right { fill: var(--right); }
.areaBar.referral { fill: var(--purple); }
.areaBar.root { fill: var(--nav); }
.tagBg { stroke-width: 1; }
.tagBg.left { fill: var(--left-soft); stroke: #efc7c3; }
.tagBg.right { fill: var(--right-soft); stroke: #c6dceb; }
.tagBg.referral { fill: var(--purple-soft); stroke: #d8cbe8; }
.tagBg.root { fill: #edf0f3; stroke: #c9d1d9; }
.tagText { fill: #344252; font-size: 9.5px; font-weight: 850; }
.viewingBadge { fill: #eef1f3; stroke: #cbd3da; }
.viewingBadgeText { fill: #3d4a57; font-size: 9px; font-weight: 800; }
.levelBadge { stroke-width: 1; }
.levelBadge.level0, .levelBadge.level1 { fill: #f2f4f6; stroke: #d8dee4; }
.levelBadge.level2 { fill: #eef4f8; stroke: #c9dce8; }
.levelBadge.level3 { fill: #fff6e7; stroke: #ead4a6; }
.levelBadge.level4 { fill: #fff0ef; stroke: #e6bfbc; }
.levelBadgeText { fill: #455362; font-size: 9px; font-weight: 800; }
.identityBox { fill: #f5f7f9; stroke: #e4e8ec; }
.nodeName { fill: #111827; font-size: 13px; font-weight: 800; }
.nodeAccount { fill: #263442; font-size: 11.5px; font-weight: 850; }
.dataBox { fill: #fafbfc; stroke: #e4e8ec; }
.metricLabel { fill: #18212b; font-size: 10px; font-weight: 750; }
.metricValue { fill: #3d4a57; font-size: 10.5px; font-weight: 650; }
.nodeLine { stroke: #e4e8ec; }
.relLabel { fill: #18212b; font-size: 10px; font-weight: 750; }
.relValue { fill: #465464; font-size: 10px; font-weight: 600; }
.mobileLevelNode .card { fill: #fff; stroke: #b8c2cb; stroke-width: 1.1; filter: drop-shadow(0 2px 5px rgba(24, 33, 43, .09)); }
.mobileLevelNode.root .card { stroke-width: 1.8; }
.mobileNodeDepth { fill: #667482; font-size: 8.5px; font-weight: 800; }
.mobileNodeName { fill: #111827; font-size: 11.5px; font-weight: 800; }
.mobileNodeAccount { fill: #344352; font-size: 9.5px; font-weight: 800; }
.mobileMetricLabel { fill: #64717e; font-size: 7.5px; font-weight: 750; }
.mobileMetricValue { fill: #23313e; font-size: 8.5px; font-weight: 750; }
.mobileLevelEdge { stroke-width: 1.8; }
.mobileLevelEdgeLabel { font-size: 8px; stroke-width: 3px; }
.mobileReferralNode .card { fill: #fff; stroke: #b9aacd; stroke-width: 1.15; filter: drop-shadow(0 2px 5px rgba(61, 42, 87, .1)); }
.mobileReferralNode.root .card { stroke: var(--nav); stroke-width: 1.8; }
.mobileReferralTrunk,
.mobileReferralEdge { stroke: #a995c5; stroke-width: 1.8; }
.mobileReferralGroupLabel { fill: var(--purple); font-size: 8px; font-weight: 800; stroke-width: 3px; }

/* Full mobile outline tree */
.mobileTreeNode { position: relative; margin: 0 0 13px; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.mobileTreeNode.indent1 { margin-left: 10px; }
.mobileTreeNode.indent2 { margin-left: 20px; }
.mobileTreeNode.indent3 { margin-left: 30px; }
.mobileTreeNode.indent4 { margin-left: 40px; }
.mobileTreeConnector { position: absolute; top: -13px; bottom: -13px; left: 7px; width: 14px; border-left: 2px solid #aeb9c3; border-bottom: 2px solid #aeb9c3; pointer-events: none; }
.mobileTreeConnector.left { border-color: var(--left-line); }
.mobileTreeConnector.right { border-color: var(--right-line); }
.mobileTreeConnector.referral { border-color: #b9a9cf; }
.mobileTreeNode:first-child .mobileTreeConnector { display: none; }
.mobileNodeCard { position: relative; margin-left: 20px; overflow: hidden; border: 1px solid #cfd6dd; border-left: 4px solid var(--nav); border-radius: 7px; background: #fff; box-shadow: 0 4px 12px rgba(24, 33, 43, .07); }
.mobileTreeNode.left .mobileNodeCard { border-left-color: var(--left); }
.mobileTreeNode.right .mobileNodeCard { border-left-color: var(--right); }
.mobileTreeNode.referral .mobileNodeCard { border-left-color: var(--purple); }
.mobileNodeCard > header { min-height: 32px; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border-bottom: 1px solid #e7ebef; background: #f8fafb; }
.mobileAreaTag, .mobileDepthBadge, .mobileLevelBadge { display: inline-flex; align-items: center; min-height: 19px; padding: 2px 7px; border: 1px solid #d6dde4; border-radius: 999px; color: #40505f; font-size: 9px; font-weight: 850; }
.mobileAreaTag.left { border-color: #efc7c3; background: var(--left-soft); color: var(--left); }
.mobileAreaTag.right { border-color: #c6dceb; background: var(--right-soft); color: var(--right); }
.mobileAreaTag.referral { border-color: #d8cbe8; background: var(--purple-soft); color: var(--purple); }
.mobileDepthBadge { margin-left: auto; }
.mobileLevelBadge.level3 { border-color: #ead4a6; background: #fff6e7; }
.mobileLevelBadge.level4 { border-color: #e6bfbc; background: #fff0ef; }
.mobileIdentity { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 10px 8px; }
.mobileIdentity b { min-width: 0; overflow: hidden; color: #111827; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.mobileIdentity strong { color: #273645; font-size: 11px; white-space: nowrap; }
.mobileMetrics { display: grid; grid-template-columns: 1fr 1fr; margin: 0 10px; border-top: 1px solid #e8ecef; border-left: 1px solid #e8ecef; }
.mobileMetrics span { min-width: 0; padding: 6px 8px; border-right: 1px solid #e8ecef; border-bottom: 1px solid #e8ecef; }
.mobileMetrics em, .mobileMetrics b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobileMetrics em { color: #4c5967; font-size: 9.5px; font-style: normal; font-weight: 750; }
.mobileMetrics b { margin-top: 2px; color: #1f2d3a; font-size: 11px; }
.mobileRelations { display: grid; gap: 4px; padding: 8px 10px 10px; color: #536171; font-size: 10px; }
.mobileRelations span { overflow-wrap: anywhere; }
.mobileRelations b { display: inline-block; min-width: 44px; color: #18212b; }
.mobilePathSummary { width: 100%; min-width: 0; display: flex; align-items: center; gap: 7px; }
.mobilePathAccount { min-width: 0; height: 32px; display: grid; align-content: center; justify-items: start; flex: 1; padding: 2px 7px; border: 0; background: transparent; text-align: left; }
.mobilePathAccount b, .mobilePathAccount span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobilePathAccount b { color: #263746; font-size: 9.5px; }
.mobilePathAccount span { color: #6d7985; font-size: 8.5px; }
.mobilePathMeta { flex: 0 0 auto; display: flex; gap: 4px; }
.mobilePathMeta span { min-width: 45px; display: grid; justify-items: center; color: #6b7783; font-size: 7.5px; }
.mobilePathMeta b { color: #283745; font-size: 10.5px; }

/* Detail inspector */
.detailPanel { display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; }
.detailHero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 13px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.detailArea { padding: 4px 8px; border-radius: 999px; background: #eef1f3; color: #3f4d5a; font-size: 9.5px; font-weight: 800; }
.detailArea.left { background: var(--left-soft); color: var(--left); }
.detailArea.right { background: var(--right-soft); color: var(--right); }
.detailArea.referral { background: var(--purple-soft); color: var(--purple); }
.detailHeroText { min-width: 0; }
.detailHero h2 { margin: 0; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.detailHero p { margin: 4px 0 0; color: var(--muted); font-size: 10.5px; }
.copyButton { width: 30px; height: 30px; padding: 0; font-size: 15px; }
.detailHero #closeDetail { width: 30px; height: 30px; padding: 0; font-size: 16px; }
.detailTabs { display: flex; gap: 3px; padding: 7px; border-bottom: 1px solid var(--line); background: #f7f9fa; }
.detailTabs button { min-width: 0; flex: 1; border: 0; background: transparent; font-size: 10.5px; }
.detailTabs button.active { background: var(--nav); color: #fff; }
.detailBody { min-height: 0; overflow: auto; padding: 13px; }
.panelSection { padding: 0 0 14px; }
.panelSection + .panelSection { padding-top: 14px; border-top: 1px solid #e8ecef; }
.sectionTitle, .panelTitle { margin: 0 0 9px; color: #293746; font-size: 11px; font-weight: 850; }
.panelTitle.spacedTitle { margin-top: 11px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.stat { padding: 10px 11px; border: 1px solid var(--line); border-left: 3px solid #76899b; border-radius: 7px; background: #f8fafb; }
.stat b { display: block; font-size: 17px; }
.stat span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.metricGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric { min-width: 0; padding: 10px; border: 1px solid var(--line); border-left: 3px solid #8090a0; border-radius: 7px; background: #f9fbfc; }
.metric:nth-child(1) { border-left-color: var(--left); }
.metric:nth-child(2) { border-left-color: var(--right); }
.metric:nth-child(3) { border-left-color: var(--green); }
.metric:nth-child(4) { border-left-color: var(--purple); }
.metric span { display: block; color: var(--muted); font-size: 10px; }
.metric b { display: block; overflow: hidden; margin-top: 4px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.relationRows, .kv { display: grid; gap: 0; margin: 0; }
.relationRow, .kv > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-bottom: 1px solid #edf0f2; font-size: 11px; }
.relationRow:last-child, .kv > div:last-child { border-bottom: 0; }
.relationRow span, .kv dt { color: var(--muted); }
.relationRow b, .kv dd { margin: 0; color: #2f3c49; font-weight: 700; word-break: break-word; }
.paymentChips { display: flex; flex-wrap: wrap; gap: 5px; }
.paymentChip { padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: #f7f9fa; color: #4b5968; font-size: 10px; }
.pointDetailSection { padding-bottom: 0; }
.pointTabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-bottom: 9px; }
.pointTab { height: auto; min-height: 44px; padding: 6px 4px; border-color: #dde3e9; background: #fff; color: #536171; font-size: 10.5px; line-height: 1.3; white-space: normal; }
.pointTab span { color: #7b8794; font-size: 9.5px; font-weight: 650; }
.pointTab.active { border-color: #2d3946; background: #2d3946; color: #fff; }
.pointTab.active span { color: #dbe2e8; }
.pointList { display: grid; max-height: none; }
.pointRow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid #edf0f2; font-size: 10.5px; }
.pointRow:last-child { border-bottom: 0; }
.pointTime { color: #1f2937; font-size: 10.5px; font-weight: 800; }
.pointAbout { margin-top: 2px; color: #667085; word-break: break-word; }
.pointAmount { align-self: start; font-size: 11px; font-weight: 900; text-align: right; white-space: nowrap; }
.pointAmount.out { color: var(--left); }
.pointAmount.in { color: var(--green); }
.pointMeta { grid-column: 1 / 3; color: #8a96a5; font-size: 9.5px; line-height: 1.45; word-break: break-word; }
.pointEmpty { padding: 24px 8px; color: #8a96a5; font-size: 11px; text-align: center; }
.personalBox { margin: 0; padding: 0; border: 0; background: transparent; }
.personalTitleRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.personalTitleRow h2 { margin: 0; color: #111827; font-size: 14px; }
.profileMode { flex: 0 0 auto; padding: 4px 8px; border: 1px solid #d9e0e6; border-radius: 999px; background: #f3f5f7; color: #697586; font-size: 9.5px; font-weight: 800; }
.profileMode.editable { border-color: #c8ddd1; background: #eef7f1; color: var(--green); }
.personalGrid { display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 8px 9px; }
.personalGrid > label { color: #111827; font-size: 12px; font-weight: 800; }
.personalGrid > input { width: 100%; height: 35px; padding: 0 9px; border-color: #dfe7ef; background: #fff; font-size: 12px; }
.personalGrid > input:disabled { border-color: #e3e7eb; background: #f5f7f9; color: #4e5b68; opacity: 1; -webkit-text-fill-color: #4e5b68; }
.personalGrid .wide { grid-column: 1 / 3; width: 100%; }
.personalGrid input[aria-invalid="true"] { border-color: #c56d67; box-shadow: 0 0 0 3px rgba(185, 74, 72, .1); }
.customsNotice { margin: 3px 0 0; padding: 9px 10px; border-left: 3px solid #7b8c9c; background: #f4f6f8; color: #536171; font-size: 10px; line-height: 1.55; }
.personalActions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 11px; }
.personalActions button { height: 34px; }
.personalStatus { min-height: 16px; color: #52705f; font-size: 11px; }
.personalValidation { min-height: 17px; margin-top: 7px; color: var(--left); font-size: 10.5px; }
.personalMeta { min-height: 16px; margin-top: 5px; color: #7b8794; font-size: 10px; }
.dangerButton { border-color: #e2bcb9; color: var(--bad); }
.shipment { margin-bottom: 8px; padding: 10px; border: 1px solid var(--line); border-left: 4px solid #6d8093; border-radius: 7px; }
.shipmentHead { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; }
.shipmentProducts { margin: 8px 0; padding: 7px; background: #f4f6f8; font-size: 11px; font-weight: 800; }
.shipmentMeta { display: grid; grid-template-columns: 70px 1fr; gap: 5px; font-size: 10.5px; }
.shipmentMeta span { color: var(--muted); }
.logisticsEmptyState { padding: 28px 12px; text-align: center; }
.logisticsEmptyState b { display: block; color: #334150; font-size: 12px; }
.logisticsEmptyState p { margin: 7px auto 13px; max-width: 260px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.logisticsEmptyState button { height: 34px; }
.empty { padding: 28px 12px; color: var(--muted); font-size: 11px; text-align: center; }
.mobileOnly { display: none; }

/* Administration pages */
.modulePage { height: calc(100vh - 68px); overflow: auto; padding: 18px; }
.moduleInner { max-width: 1480px; margin: 0 auto; }
.moduleTitle { min-height: 50px; margin-bottom: 12px; }
.moduleTitle h2 { margin: 0; font-size: 20px; }
.moduleTitle p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.moduleCard { margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.filterBar { display: grid; grid-template-columns: minmax(230px, 1fr) 150px 150px auto; align-items: center; gap: 8px; }
.accountFilter { grid-template-columns: minmax(230px, 1fr) 150px 150px; }
.filterBar input, .filterBar select { width: 100%; }
.tableWrap { overflow: auto; border: 1px solid var(--line); border-radius: 7px; }
.dataTable { width: 100%; min-width: 1080px; border-collapse: collapse; font-size: 11px; }
.dataTable th { position: sticky; top: 0; z-index: 1; padding: 9px; border-bottom: 1px solid var(--line); background: #f2f4f6; text-align: left; }
.dataTable td { padding: 9px; border-bottom: 1px solid #edf0f2; vertical-align: middle; }
.dataTable tr:last-child td { border-bottom: 0; }
.tableAction button:disabled { opacity: .45; }
.tableAccount b, .tableAccount span { display: block; }
.tableAccount span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.systemAccountRow { background: #f7f9fb; }
.systemAccountLabel { display: inline-block; margin-top: 5px; padding: 2px 6px; border: 1px solid #cbd5df; border-radius: 999px; color: #52677a; font-size: 9px; font-style: normal; font-weight: 800; }
.passwordState.systemLocked { max-width: 220px; margin-top: 0; color: #52677a; line-height: 1.45; }
.passwordEditor { min-width: 340px; display: grid; grid-template-columns: minmax(120px, 1fr) auto auto; gap: 5px; }
.passwordEditor input, .passwordEditor button { height: 31px; }
.passwordState { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.passwordState.custom { color: #8b5f24; font-weight: 800; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 10px; }
.summaryGrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.summaryMetric { padding: 12px; border-left: 4px solid #76899b; background: #f3f5f7; }
.summaryMetric span { display: block; color: var(--muted); font-size: 10px; }
.summaryMetric b { display: block; margin-top: 4px; font-size: 17px; }
.profileManagementCard { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.profileSummaryGrid { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 8px; }
.profileManagementCard > button { flex: 0 0 auto; min-width: 210px; height: 42px; }
.newAccountHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.newAccountHead .sectionTitle { margin-bottom: 5px; }
.newAccountHead p { max-width: 720px; margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.newAccountCount { flex: 0 0 auto; min-width: 110px; padding: 9px 11px; border-left: 3px solid var(--green); background: #f3f7f5; }
.newAccountCount span { display: block; color: var(--muted); font-size: 10px; }
.newAccountCount b { display: block; margin-top: 3px; font-size: 20px; }
.newAccountsTable { min-width: 760px; }
.includedState { display: inline-block; padding: 3px 7px; border: 1px solid #c8ddd1; border-radius: 999px; background: #eef7f1; color: var(--green); font-size: 9.5px; font-weight: 800; }
.importBar { display: flex; align-items: center; gap: 8px; }
.logisticsPreview { border-left: 4px solid #6d8093; }
.previewHeader, .coverageHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.previewHeader h3, .coverageHead h3 { margin: 0; font-size: 14px; }
.previewHeader p, .coverageHead p { margin: 5px 0 0; color: var(--muted); font-size: 10.5px; }
.previewActions { display: flex; gap: 7px; }
.previewMetrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin: 13px 0; }
.previewMetrics span { padding: 9px; border-left: 3px solid #788a9a; background: #f5f7f9; }
.previewMetrics em, .previewMetrics b { display: block; }
.previewMetrics em { color: var(--muted); font-size: 9.5px; font-style: normal; }
.previewMetrics b { margin-top: 3px; font-size: 15px; }
.logisticsPreview h4 { margin: 12px 0 7px; font-size: 11px; }
.previewTable { min-width: 760px; }
.previewIssues, .syncFailures { margin-top: 12px; border-top: 1px solid #e4e8ec; padding-top: 10px; }
.previewIssues summary, .syncFailures summary { cursor: pointer; color: #405b73; font-size: 11px; font-weight: 800; }
.previewIssue { display: grid; grid-template-columns: 150px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid #edf0f2; font-size: 10.5px; }
.previewIssue span { color: var(--muted); }
.syncCoverage { border-left: 4px solid var(--green); }
.syncCoverage.partial { border-left-color: #b88439; background: #fffcf6; }
.coverageState { display: inline-block; margin-bottom: 5px; color: var(--green); font-size: 10px; font-weight: 900; }
.syncCoverage.partial .coverageState { color: #9a6925; }
.coverageHead > b { padding: 8px 10px; border: 1px solid #dce3e8; border-radius: 6px; background: #fff; font-size: 18px; }
.syncFailures .tableWrap { margin-top: 8px; }
.auditRow { display: grid; grid-template-columns: 150px 110px 120px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid #edf0f2; font-size: 10.5px; }
.toast { position: fixed; z-index: 100; top: 78px; right: 18px; display: none; max-width: 360px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 14px 32px rgba(24, 33, 43, .16); font-size: 11px; }
.toast.show { display: block; }
.toast.error { color: var(--bad); }
.detailBackdrop { position: fixed; z-index: 69; inset: 0; background: rgba(17, 24, 39, .38); }

/* Privacy page */
.privacyPage { min-height: 100%; overflow: auto; padding: 28px 16px; background: #edf1f4; }
.privacyDocument { width: min(820px, 100%); margin: 0 auto; padding: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.privacyBack { display: inline-block; margin-bottom: 22px; color: #405b73; font-size: 12px; text-underline-offset: 3px; }
.privacyDocument header { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.privacyDocument header span { color: #6c7d8e; font-size: 10px; font-weight: 900; }
.privacyDocument h1 { margin: 6px 0 3px; font-size: 26px; }
.privacyDocument header p { margin: 0; color: var(--muted); font-size: 14px; }
.privacyDocument section { padding: 18px 0; border-bottom: 1px solid #edf0f2; }
.privacyDocument h2 { margin: 0 0 8px; font-size: 14px; }
.privacyDocument p { margin: 5px 0; color: #455465; font-size: 12.5px; line-height: 1.7; }
.privacyDocument footer { padding-top: 18px; color: var(--muted); font-size: 11px; }

@media (max-width: 1260px) {
  .head { grid-template-columns: 250px auto 1fr; gap: 9px; }
  .userChip { width: 145px; }
  .workspace { grid-template-columns: 64px minmax(0, 1fr) 340px; }
  .graphToolbar { align-items: stretch; flex-direction: column; }
  .searchWrap { width: 100%; max-width: none; }
  .headerActions { flex-wrap: wrap; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .appHeader { position: sticky; z-index: 60; top: 0; }
  .appHeader, .head { height: 112px; }
  .head { grid-template-columns: 1fr auto; grid-template-rows: 46px 42px; padding: 8px 10px; }
  .titleBlock { grid-column: 1; grid-row: 1; }
  .accountActions { grid-column: 2; grid-row: 1; }
  .mainNav { grid-column: 1 / 3; grid-row: 2; }
  .workspace { height: calc(100dvh - 112px); grid-template-columns: 58px minmax(0, 1fr); }
  .detailPanel { position: fixed; z-index: 70; top: 120px; right: 8px; bottom: 8px; width: min(382px, calc(100vw - 16px)); transform: translateX(calc(100% + 16px)); transition: transform .2s ease; }
  .detailPanel.open { transform: translateX(0); }
  .mobileOnly { display: block; }
  .modulePage { height: calc(100dvh - 112px); }
  .summaryGrid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .loginScreen { padding: 0; place-items: stretch; }
  .loginShell { width: 100%; min-height: 100vh; display: grid; place-items: center; padding: 18px; }
  .loginPanel { width: 100%; padding: 23px 19px; }
  .loginPanel .field input,
  .searchWrap input,
  .personalGrid > input,
  .modulePage input,
  .modulePage select { font-size: 16px; }
  .appHeader, .head { height: 122px; }
  .head { grid-template-columns: 1fr; grid-template-rows: 34px 34px 36px; gap: 3px; padding: 5px 7px; }
  .titleBlock, .mainNav, .accountActions { grid-column: 1; grid-row: auto; }
  .brandMark.small { width: 28px; height: 28px; font-size: 10px; }
  .titleBlock { gap: 7px; }
  .titleCopy h1 { font-size: 12px; }
  .headerContext { max-width: calc(100vw - 58px); font-size: 8.5px; }
  .headerContext .headerAccount { display: none; }
  .headerContext .headerUpdated { margin-top: 2px; }
  .accountActions { width: 100%; justify-self: stretch; display: grid; grid-template-columns: 58px minmax(0, 1fr) 48px; gap: 4px; }
  .accountActions > button { height: 32px; padding: 0 5px; font-size: 10px; }
  .userChip { width: auto; height: 32px; padding: 0 8px; }
  .userChip b { font-size: 9.5px; }
  .userChip span { font-size: 8.5px; }
  .mainNav { width: 100%; }
  .mainNav button { min-width: 0; height: 32px; flex: 1; padding: 0 4px; font-size: 9.5px; }
  .workspace { width: 100vw; max-width: 100vw; height: calc(100dvh - 122px); min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: 46px minmax(0, 1fr); gap: 6px; padding: 6px; overflow: hidden; }
  .depthRail { height: 46px; }
  .railHeader { display: none; }
  .depthList { height: 46px; display: flex; overflow: auto hidden; padding: 4px; }
  .depthButton { flex: 0 0 52px; height: 36px; margin: 0 4px 0 0; }
  .graphShell, .graphTopbar, .graphToolbar, .headerActions, .searchWrap, .pathBar, .graph { width: 100%; max-width: 100%; min-width: 0; }
  .graphShell { min-height: 0; }
  .graphToolbar { gap: 5px; padding: 6px; overflow: hidden; }
  .headerActions { display: grid; grid-template-columns: minmax(0, 1fr) 76px 76px; }
  .relationModeSeg { width: 100%; min-width: 0; }
  .relationModeSeg button { min-width: 0; flex: 1; padding: 0 3px; font-size: 10px; }
  #centerRoot, #mobileDetail { width: 76px; min-width: 0; padding: 0 4px; font-size: 10px; }
  .recommendControl { display: none; }
  .exportBox { display: none; }
  #centerRoot { justify-self: start; }
  .pathBar { min-height: 42px; overflow: hidden; padding: 4px 7px; }
  .mobilePathSummary .pathNavButtons button { width: 30px; height: 30px; overflow: hidden; padding: 0 4px; font-size: 14px; }
  .mobilePathSummary .pathActionLabel { display: none; }
  .pathHead { min-width: 0; }
  .pathStats { padding-bottom: 1px; }
  .pathline { max-width: 100%; }
  .graph { min-height: 0; scroll-padding-bottom: 64px; }
  .detailPanel { top: auto; left: 6px; right: 6px; bottom: 0; width: auto; height: min(82dvh, 720px); padding-bottom: env(safe-area-inset-bottom); border-radius: 8px 8px 0 0; transform: translateY(calc(100% + 14px)); }
  .detailPanel.open { transform: translateY(0); }
  .modulePage { height: auto; min-height: calc(100dvh - 122px); padding: 9px; }
  .moduleTitle { min-height: 42px; margin-bottom: 8px; }
  .moduleTitle h2 { font-size: 17px; }
  .filterBar { grid-template-columns: 1fr 1fr; }
  .accountFilter { grid-template-columns: 1fr 1fr; }
  .filterBar input { grid-column: 1 / 3; }
  .filterBar button { width: 100%; }
  .summaryGrid { grid-template-columns: 1fr 1fr; }
  .profileManagementCard { align-items: stretch; flex-direction: column; }
  .profileSummaryGrid { grid-template-columns: 1fr; }
  .profileManagementCard > button { width: 100%; min-width: 0; }
  .previewHeader, .coverageHead { align-items: stretch; flex-direction: column; }
  .previewActions { width: 100%; }
  .previewActions button { flex: 1; }
  .previewMetrics { grid-template-columns: 1fr 1fr; }
  .previewIssue { grid-template-columns: 1fr; gap: 3px; }
  .responsiveTable { display: block; min-width: 0; }
  .responsiveTable thead { display: none; }
  .responsiveTable tbody { display: grid; gap: 8px; }
  .responsiveTable tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
  .responsiveTable td { width: 100%; display: grid; grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #edf0f2; word-break: break-word; }
  .responsiveTable td::before { content: attr(data-label); color: #697586; font-size: 9.5px; font-weight: 750; }
  .responsiveTable td:last-child { border-bottom: 0; }
  .responsiveTable td.empty { display: block; padding: 24px 10px; text-align: center; }
  .responsiveTable td.empty::before { content: none; }
  .responsiveTable select, .responsiveTable input, .responsiveTable button { width: 100%; min-width: 0; }
  .responsiveTable .tableAccount b { font-size: 12px; }
  .responsiveTable .tableAction { background: #f7f9fa; }
  .tableWrap:has(.responsiveTable) { overflow: visible; border: 0; }
  .passwordEditor { min-width: 0; grid-template-columns: 1fr 1fr; }
  .passwordEditor input { grid-column: 1 / 3; }
  .newAccountsTable, .previewTable { min-width: 0; }
  .newAccountHead { align-items: stretch; flex-direction: column; }
  .newAccountCount { width: 120px; }
  .auditRow { grid-template-columns: 1fr 1fr; }
  .auditRow div { grid-column: 1 / 3; }
  .privacyPage { padding: 0; }
  .privacyDocument { min-height: 100vh; padding: 22px 18px; border: 0; border-radius: 0; }
  .privacyDocument h1 { font-size: 22px; }
}
