:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --line: #d9dee7;
  --line-strong: #b8c1ce;
  --text: #1d2430;
  --muted: #667085;
  --muted-2: #8a94a6;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #14805e;
  --green-soft: #e8f6ef;
  --amber: #9a6400;
  --amber-soft: #fff4d8;
  --red: #b42318;
  --red-soft: #fee9e7;
  --cyan: #0e7490;
  --cyan-soft: #e6f6fa;
  --violet: #6d3fc8;
  --violet-soft: #f0e9ff;
  --shadow: 0 16px 38px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 247, 249, 0.96)),
    repeating-linear-gradient(90deg, #e8edf4 0, #e8edf4 1px, transparent 1px, transparent 96px),
    repeating-linear-gradient(0deg, #e8edf4 0, #e8edf4 1px, transparent 1px, transparent 96px);
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.login-panel h1 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.25;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
}

.login-brand p {
  margin: 0;
  font-size: 13px;
}

.form-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.form-row label {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.field,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 9px 11px;
  outline: none;
}

.textarea {
  min-height: 94px;
  resize: vertical;
}

.field:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.btn:hover {
  border-color: #98a2b3;
  background: var(--surface-soft);
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn.primary:hover {
  background: #1d4ed8;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.danger {
  border-color: #f2b8b5;
  background: var(--red-soft);
  color: var(--red);
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.floating-nav {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 80;
}

.nav-trigger {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
  display: grid;
  place-items: center;
  cursor: pointer;
  list-style: none;
}

.nav-trigger::-webkit-details-marker {
  display: none;
}

.floating-menu {
  position: absolute;
  top: 46px;
  right: 0;
  width: min(300px, calc(100vw - 20px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.floating-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.floating-search-input {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 10px;
  outline: none;
}

.floating-search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.menu-item {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 11px;
  text-align: center;
}

.menu-item:hover {
  border-color: #98a2b3;
  background: var(--surface-soft);
}

.menu-item.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.org-logo {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #b8c7d9;
  background:
    linear-gradient(135deg, #ffffff 0%, #eef5ff 58%, #edf8f2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.org-logo-large {
  width: 44px;
  height: 44px;
  border-radius: 9px;
}

.logo-line,
.logo-node {
  position: absolute;
  display: block;
}

.logo-line {
  background: #94a3b8;
}

.logo-line-v {
  left: 50%;
  top: 11px;
  width: 1px;
  height: 16px;
  transform: translateX(-50%);
}

.logo-line-h {
  left: 10px;
  right: 10px;
  top: 25px;
  height: 1px;
}

.logo-node {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.logo-node-top {
  left: 50%;
  top: 7px;
  transform: translateX(-50%);
  background: #1d4ed8;
}

.logo-node-left {
  left: 7px;
  top: 22px;
  background: #14805e;
}

.logo-node-mid {
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  background: #334155;
}

.logo-node-right {
  right: 7px;
  top: 22px;
  background: #0e7490;
}

.org-logo-large .logo-line-v {
  top: 13px;
  height: 20px;
}

.org-logo-large .logo-line-h {
  left: 12px;
  right: 12px;
  top: 31px;
}

.org-logo-large .logo-node {
  width: 8px;
  height: 8px;
}

.org-logo-large .logo-node-top {
  top: 8px;
}

.org-logo-large .logo-node-left,
.org-logo-large .logo-node-mid,
.org-logo-large .logo-node-right {
  top: 27px;
}

.org-logo-large .logo-node-left {
  left: 9px;
}

.org-logo-large .logo-node-right {
  right: 9px;
}

.brand-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title span {
  font-size: 12px;
  color: var(--muted);
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 14px 0 38px;
  background: #fff;
  outline: none;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
}

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

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 9px;
  text-align: left;
}

.nav-item:hover {
  background: var(--surface-soft);
}

.nav-item.active {
  border-color: #c8d8fb;
  background: var(--blue-soft);
  color: #1e429f;
}

.content {
  width: min(100%, 1180px);
  min-width: 0;
  margin: 0 auto;
  padding: 16px;
  overflow: auto;
}

.hierarchy-page {
  display: grid;
  gap: 14px;
}

.inline-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-search-input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
  outline: none;
}

.inline-search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.breadcrumb-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  min-height: 32px;
  padding: 5px 8px;
}

.breadcrumb-item::after {
  content: "/";
  margin-left: 8px;
  color: var(--muted-2);
}

.breadcrumb-item:last-child::after {
  content: "";
  margin: 0;
}

.breadcrumb-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.breadcrumb-item.active {
  color: var(--text);
  font-weight: 750;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 8px;
  border: 1px solid #cbd7e6;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fafc, #edf3f8);
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

.mode-card {
  position: relative;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  min-height: 64px;
  padding: 12px 14px 12px 16px;
  text-align: center;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
}

.mode-card:hover {
  border-color: #9ab5d6;
  background: #ffffff;
}

.mode-card.active {
  border-color: #1d4ed8;
  background: linear-gradient(180deg, #1f3f82, #172f62);
  color: #fff;
  box-shadow: 0 10px 22px rgba(29, 78, 216, 0.2);
}

.mode-card strong {
  font-size: 16px;
  line-height: 1.2;
}

.mode-card span {
  color: #5d6b7e;
  font-size: 12px;
  font-weight: 650;
}

.mode-card.active span {
  color: #c9d7ff;
}

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

.quick-entry-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: 96px;
  padding: 14px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 8px;
}

.quick-entry-card:hover {
  border-color: #8fb0ec;
  background: #f8fbff;
}

.quick-entry-card strong {
  font-size: 17px;
}

.quick-entry-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.overview-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  background: #101828;
  color: #fff;
  border-radius: 8px;
  padding: 18px;
}

.overview-main {
  display: grid;
  gap: 6px;
}

.overview-main h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.overview-main p {
  margin: 0;
  color: #d0d5dd;
  line-height: 1.6;
}

.overview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.overview-actions .btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.overview-actions .btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

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

.leader-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 15px;
  min-height: 128px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 7px;
}

.leader-card:hover,
.leader-card.active {
  border-color: #8fb0ec;
  background: #f8fbff;
}

.leader-card strong {
  font-size: 24px;
  line-height: 1.15;
}

.leader-role,
.leader-area,
.leader-status {
  font-size: 13px;
}

.leader-role {
  color: var(--muted);
}

.leader-area {
  color: #344054;
}

.leader-status.status-confirmed {
  color: var(--green);
}

.leader-status.status-review {
  color: var(--amber);
}

.leader-status.status-stale {
  color: var(--red);
}

.child-section {
  display: grid;
  gap: 10px;
}

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

.child-area-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: 88px;
  padding: 12px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 7px;
}

.child-area-card:hover {
  border-color: #8fb0ec;
  background: #f8fbff;
}

.child-area-card strong {
  font-size: 16px;
}

.child-area-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.org-list-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 13px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.org-list-card > strong {
  font-size: 16px;
}

.org-list-card > span {
  color: var(--muted);
  font-size: 13px;
}

.mini-person-list {
  display: grid;
  gap: 6px;
}

.mini-person-list button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  min-height: 38px;
  padding: 7px 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.mini-person-list button:hover {
  border-color: #8fb0ec;
  background: #f8fbff;
}

.mini-person-list small {
  color: var(--muted);
  text-align: right;
  line-height: 1.35;
}

.compact-overview {
  margin-top: 4px;
}

.section-kicker {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.section-kicker strong {
  font-size: 16px;
}

.section-kicker span {
  color: var(--muted);
  font-size: 13px;
}

.secondary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.data-overview {
  display: grid;
  gap: 10px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.page-title {
  display: grid;
  gap: 6px;
}

.page-title h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.page-title p {
  margin: 0;
  color: var(--muted);
}

.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.data-overview .metrics {
  margin-bottom: 0;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-items: center;
  margin: -2px 0 4px;
  padding: 7px;
  border: 1px solid #d3dce8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.05);
}

.category-tab {
  min-height: 46px;
  border: 1px solid #d7e0eb;
  border-radius: 7px;
  background: #f7f9fc;
  color: #2f3a4a;
  padding: 9px 7px;
  font-weight: 750;
  font-size: 13px;
  text-align: center;
}

.category-tab:hover {
  border-color: #94aeca;
  background: #eef4fb;
}

.category-tab.active {
  border-color: #0e7490;
  background: linear-gradient(180deg, #e6f6fa, #d9eef4);
  color: #0f4f62;
  box-shadow: inset 0 -2px 0 #0e7490;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.panel {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 14px;
  overflow-x: auto;
}

.topology {
  width: 100%;
  min-height: 0;
  max-width: 100%;
  overflow: auto;
  background:
    radial-gradient(circle at 1px 1px, rgba(145, 158, 171, 0.24) 1px, transparent 0),
    #fbfcfe;
  background-size: 22px 22px;
  position: relative;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-inline: contain;
  user-select: none;
}

.topology-canvas {
  position: relative;
  flex: 0 0 auto;
}

.topology-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  max-width: none;
  min-height: 0;
  touch-action: pan-x pan-y;
}

.graph-zoom-btn {
  width: 38px;
  padding-inline: 0;
  font-weight: 800;
}

.graph-zoom-value {
  background: var(--cyan-soft);
  color: var(--cyan);
  min-width: 56px;
  justify-content: center;
}

.province-entry {
  border-color: #b7e6d0;
  background: linear-gradient(180deg, #ffffff, #f3fbf7);
}

.province-entry:hover {
  border-color: #78c8a1;
}

.graph-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.graph-link {
  fill: none;
  stroke: #a7b4c7;
  stroke-width: 1.6;
  opacity: 0.82;
}

.graph-arrow {
  fill: #a7b4c7;
}

.graph-node {
  outline: none;
}

.graph-node .graph-card {
  fill: #fff;
  stroke: #c8d2df;
  stroke-width: 1;
  filter: drop-shadow(0 8px 14px rgba(16, 24, 40, 0.08));
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.graph-node:hover .graph-card,
.graph-node:focus .graph-card {
  fill: #f8fbff;
  stroke: #7da2ee;
}

.graph-node.active .graph-card {
  stroke: var(--blue);
  stroke-width: 2;
}

.graph-root .graph-card {
  fill: #101828;
  stroke: #101828;
}

.graph-root .graph-title {
  fill: #fff;
}

.graph-root .graph-subtitle {
  fill: #d0d5dd;
}

.graph-title {
  fill: #1d2430;
  font-size: 14px;
  font-weight: 750;
}

.graph-subtitle {
  fill: #667085;
  font-size: 12px;
}

.graph-status {
  font-size: 11px;
  font-weight: 700;
}

.graph-action {
  fill: #475467;
  font-size: 11px;
  font-weight: 750;
}

.graph-status.status-confirmed {
  fill: var(--green);
}

.graph-status.status-review {
  fill: var(--amber);
}

.graph-status.status-stale {
  fill: var(--red);
}

.graph-dot {
  fill: var(--blue);
}

.type-party .graph-dot {
  fill: var(--red);
}

.type-government .graph-dot {
  fill: var(--blue);
}

.type-congress .graph-dot {
  fill: var(--green);
}

.type-cppcc .graph-dot {
  fill: var(--violet);
}

.type-discipline .graph-dot {
  fill: var(--amber);
}

.type-court .graph-dot,
.type-procuratorate .graph-dot {
  fill: var(--cyan);
}

.type-department .graph-dot {
  fill: #0f766e;
}

.type-agency .graph-dot {
  fill: #4f46e5;
}

.graph-level {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 28px;
  padding: 22px;
  min-width: 720px;
}

.area-column,
.org-column {
  display: grid;
  align-content: start;
  gap: 14px;
}

.node {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.05);
}

.area-node {
  padding: 16px;
  border-color: #b5c8ed;
}

.area-node strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.area-node span {
  color: var(--muted);
  line-height: 1.6;
}

.org-list {
  display: grid;
  gap: 12px;
}

.org-node {
  overflow: hidden;
}

.org-main {
  width: 100%;
  min-height: 54px;
  border: 0;
  background: var(--surface);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 11px 12px;
}

.org-main:hover {
  background: var(--surface-soft);
}

.org-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.org-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.org-type-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
}

.type-party .org-type-dot {
  background: var(--red);
}

.type-government .org-type-dot {
  background: var(--blue);
}

.type-congress .org-type-dot {
  background: var(--green);
}

.type-cppcc .org-type-dot {
  background: var(--violet);
}

.type-discipline .org-type-dot {
  background: var(--amber);
}

.type-court .org-type-dot,
.type-procuratorate .org-type-dot {
  background: var(--cyan);
}

.type-department .org-type-dot {
  background: #0f766e;
}

.type-agency .org-type-dot {
  background: #4f46e5;
}

.person-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.person-node {
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 9px;
  text-align: left;
}

.person-node:hover {
  border-color: #9db7ef;
  background: #f8fbff;
}

.person-node.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.person-node strong {
  display: block;
}

.person-node span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  min-height: 22px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid transparent;
}

.status-confirmed {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b7e6d0;
}

.status-review {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f2d391;
}

.status-stale {
  color: var(--red);
  background: var(--red-soft);
  border-color: #fac5c0;
}

.person-detail {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.empty-detail {
  display: grid;
  place-items: center;
  min-height: 360px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.detail-section {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.detail-section:first-child {
  border-top: 0;
}

.detail-title {
  margin: 0 0 8px;
  font-size: 13px;
  color: #344054;
}

.kv {
  display: grid;
  gap: 8px;
}

.kv-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
  align-items: start;
}

.kv-row span:first-child {
  color: var(--muted);
}

.detail-text {
  color: #344054;
  line-height: 1.8;
  white-space: pre-wrap;
}

.source-list {
  display: grid;
  gap: 9px;
}

.source-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
  background: var(--surface-soft);
}

.source-item strong {
  display: block;
  margin-bottom: 4px;
}

.source-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.search-page {
  display: grid;
  gap: 12px;
}

.result-list {
  display: grid;
  gap: 8px;
}

.result-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
}

.result-item:hover {
  border-color: #9db7ef;
}

.result-main strong {
  display: block;
  margin-bottom: 4px;
}

.result-main span {
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 14px;
}

.admin-tabs {
  display: grid;
  gap: 8px;
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.admin-table th {
  color: #344054;
  font-size: 12px;
  background: var(--surface-soft);
}

.admin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.compact-metrics {
  margin-bottom: 14px;
}

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #b7e6d0;
  border-radius: 8px;
  background: #f1fbf6;
  color: #17634a;
  line-height: 1.6;
}

.ingest-form .textarea {
  min-height: 260px;
  line-height: 1.6;
}

.evidence-cell {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.evidence-cell strong {
  font-size: 13px;
}

.evidence-cell span {
  color: var(--muted);
  line-height: 1.5;
}

.tool-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.data-import {
  margin-top: 4px;
}

.data-import .textarea {
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  background: #101828;
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

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

  .child-area-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secondary-grid {
    grid-template-columns: 1fr;
  }

  .person-detail {
    position: static;
    max-height: none;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 820px) {
  .main-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 12px;
  }

  .mode-card {
    min-height: 58px;
    padding: 10px 8px;
  }

  .mode-card strong {
    font-size: 15px;
  }

  .mode-card span {
    font-size: 11px;
  }

  .overview-panel {
    display: grid;
    padding: 16px;
  }

  .overview-main h1 {
    font-size: 24px;
  }

  .overview-actions {
    justify-content: flex-start;
  }

  .leader-card-grid,
  .child-area-grid,
  .quick-entry-grid,
  .org-list-grid {
    grid-template-columns: 1fr;
  }

  .mini-person-list button {
    display: grid;
    justify-content: stretch;
  }

  .mini-person-list small {
    text-align: left;
  }

  .leader-card {
    min-height: 112px;
  }

  .leader-card strong {
    font-size: 22px;
  }

  .section-kicker {
    display: grid;
    align-items: start;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-head {
    display: grid;
  }

  .head-actions {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .category-tab {
    min-width: 0;
    min-height: 44px;
    padding-inline: 5px;
    text-align: center;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .graph-tools,
  .top-actions {
    justify-content: flex-start;
  }

  .graph-tools .btn,
  .graph-tools .badge {
    min-height: 32px;
    font-size: 12px;
    padding: 5px 8px;
  }

  .graph-tools .graph-zoom-btn {
    width: 32px;
    padding-inline: 0;
  }

  .graph-zoom-value {
    min-width: 46px;
  }

  .result-item {
    grid-template-columns: 1fr;
  }

  .topology {
    min-height: 0;
    max-height: none;
    margin-inline: 0;
    overflow: auto;
  }
}

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

  .category-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .graph-title {
    font-size: 13px;
  }

  .graph-subtitle {
    font-size: 11px;
  }
}
