:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #d9dee5;
  --text: #1d2530;
  --muted: #66707d;
  --accent: #2563eb;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body { display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 22px;
  height: 52px;
  background: #ffffff;
  border-bottom: 1px solid #e4e4e4;
}

.brand {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.brand-logo { height: 32px; display: block; }

.search-wrap {
  position: relative;
  flex: 0 1 440px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: #9a9a9a;
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid #d6d6d6;
  border-radius: 7px;
  font-size: 13px;
  background: #ffffff;
  color: #111111;
  transition: border-color 0.15s ease;
}

#search:focus {
  outline: none;
  border-color: #111111;
}

#search::placeholder { color: #9a9a9a; }

.export-btn {
  margin-left: auto;
  padding: 7px 16px;
  border: 1px solid #111111;
  border-radius: 7px;
  background: #111111;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.export-btn:hover { background: #333333; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  max-height: 340px;
  overflow-y: auto;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.search-results div {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--bg);
}

.search-results div:hover { background: #eef2ff; }
.search-results .meta { color: var(--muted); font-size: 11px; }

.banner {
  padding: 8px 16px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
  border-bottom: 1px solid #fcd34d;
}

.layout { flex: 1; display: flex; min-height: 0; position: relative; }

#cy { flex: 1; min-width: 0; }

.panel {
  width: 340px;
  flex: none;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
}

.panel h2 { margin: 0 0 2px; font-size: 16px; }
.panel h3 {
  margin: 18px 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.panel .subtitle { color: var(--muted); font-size: 12px; margin-bottom: 10px; }

.panel dl { margin: 0; display: grid; grid-template-columns: 45% 55%; row-gap: 5px; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; overflow-wrap: anywhere; }

.panel .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.panel .actions button {
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.panel .actions button.secondary { background: var(--surface); color: var(--accent); }

.panel .close {
  float: right;
  border: none;
  background: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: #e0e7ff;
  color: #3730a3;
  margin: 2px 4px 2px 0;
}

.source-note {
  margin-top: 16px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
}

.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

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

.chip { padding: 1px 8px; border-radius: 9px; font-size: 10px; color: #fff; }
.chip.company { background: #2563eb; }
.chip.unregistered { background: #6b7280; }
.chip.person { background: #059669; }
.chip.unknown { background: #d97706; }
.chip.inactive { background: #dc2626; }

.hidden { display: none !important; }
